update
This commit is contained in:
parent
6a6b5f45fa
commit
5f0d2e60d2
8 changed files with 70 additions and 57 deletions
|
|
@ -1,6 +1,7 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:gap/gap.dart';
|
||||
import 'package:internet_connection_checker/internet_connection_checker.dart';
|
||||
import 'package:pharmacy_mobile/functions/checkexisting_function.dart';
|
||||
import 'package:pharmacy_mobile/tables/ref_categories.dart';
|
||||
import 'package:pharmacy_mobile/widgets/button_widget.dart';
|
||||
import 'package:pharmacy_mobile/widgets/form_border_widget2.dart';
|
||||
|
|
@ -29,6 +30,13 @@ class _AddCategoryPageState extends State<AddCategoryPage> {
|
|||
|
||||
try {
|
||||
if (await InternetConnectionChecker.instance.hasConnection) {
|
||||
final existing = await checkExisting(_refCategories, _categoryController);
|
||||
|
||||
if (existing && mounted) {
|
||||
showNotification(context, 'Category already listed', false);
|
||||
return;
|
||||
}
|
||||
|
||||
final post = await _refCategories.postCategory(_categoryController.text.toUpperCase());
|
||||
|
||||
if (post && mounted) {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import 'package:gap/gap.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:internet_connection_checker/internet_connection_checker.dart';
|
||||
import 'package:pharmacy_mobile/functions/checkexisting_function.dart';
|
||||
import 'package:pharmacy_mobile/tables/ref_categories.dart';
|
||||
import 'package:pharmacy_mobile/tables/ref_generic_names.dart';
|
||||
import 'package:pharmacy_mobile/widgets/button_widget.dart';
|
||||
|
|
@ -50,11 +51,6 @@ class _AddGenericsPageState extends State<AddGenericsPage> {
|
|||
}
|
||||
}
|
||||
|
||||
Future<bool> _checkExisting() async {
|
||||
final uuid = await _refGenericNames.getUUID(_nameController.text);
|
||||
return uuid.isNotEmpty;
|
||||
}
|
||||
|
||||
void autoRun() async {
|
||||
if (await InternetConnectionChecker.instance.hasConnection) {
|
||||
_getList();
|
||||
|
|
@ -80,7 +76,7 @@ class _AddGenericsPageState extends State<AddGenericsPage> {
|
|||
|
||||
try {
|
||||
if (await InternetConnectionChecker.instance.hasConnection) {
|
||||
final existing = await _checkExisting();
|
||||
final existing = await checkExisting(_refGenericNames, _nameController);
|
||||
|
||||
if (existing && mounted) {
|
||||
showNotification(context, 'Generic Name already existing', false);
|
||||
|
|
|
|||
|
|
@ -73,6 +73,7 @@ class _AddStockPageState extends State<AddStockPage> with WidgetsBindingObserver
|
|||
final stockExpiration = _dateController.text;
|
||||
|
||||
await _stocks.postStock(stockNameUUID, stockExpiration, stockQuantity);
|
||||
|
||||
} else {
|
||||
if (mounted) {
|
||||
showNotification(context, 'Error: No Internet Connection', false);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import 'package:gap/gap.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:internet_connection_checker/internet_connection_checker.dart';
|
||||
import 'package:pharmacy_mobile/functions/checkexisting_function.dart';
|
||||
import 'package:pharmacy_mobile/tables/ref_types.dart';
|
||||
import 'package:pharmacy_mobile/widgets/button_widget.dart';
|
||||
import 'package:pharmacy_mobile/widgets/form_border_widget2.dart';
|
||||
|
|
@ -29,10 +30,17 @@ class _AddTypePageState extends State<AddTypePage> {
|
|||
setState(() => _isLoading = true);
|
||||
try {
|
||||
if (await InternetConnectionChecker.instance.hasConnection) {
|
||||
await _refTypes.postType(_typeController.text);
|
||||
final existing = await checkExisting(_refTypes, _typeController);
|
||||
|
||||
if (mounted) {
|
||||
showNotification(context, 'Medicine Type Saved', true);
|
||||
if (existing && mounted) {
|
||||
showNotification(context, 'Medicine type already listed', false);
|
||||
return;
|
||||
}
|
||||
|
||||
final post = await _refTypes.postType(_typeController.text);
|
||||
|
||||
if (post && mounted) {
|
||||
showNotification(context, 'Medicine type saved', true);
|
||||
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
if (mounted) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue