This commit is contained in:
Patrick Alvin Alcala 2025-02-28 17:02:46 +08:00
parent 6a6b5f45fa
commit 5f0d2e60d2
8 changed files with 70 additions and 57 deletions

View file

@ -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);