diff --git a/Frontend/patient_manager/lib/pages/profileBusinessAdd.dart b/Frontend/patient_manager/lib/pages/profileBusinessAdd.dart index 197414f6..ad04253c 100644 --- a/Frontend/patient_manager/lib/pages/profileBusinessAdd.dart +++ b/Frontend/patient_manager/lib/pages/profileBusinessAdd.dart @@ -147,8 +147,34 @@ class _ProfileBusinessAddState extends State { ); } + bool isFieldsFilled() { + if (nameController.text.isEmpty || + typeController.text.isEmpty || + regController.text.isEmpty || + logonameController.text.isEmpty || + fnameController.text.isEmpty || + lnameController.text.isEmpty || + titleController.text.isEmpty || + signtureController.text.isEmpty || + accessController.text.isEmpty || + contactController.text.isEmpty) { + return false; + } else { + return true; + } + } + void submitForm() { - createBusinessProfileAPICall(); + if (isFieldsFilled()) { + createBusinessProfileAPICall(); + } else { + showDialog( + context: context, + builder: (context) { + return const MIHErrorMessage(errorType: "Input Error"); + }, + ); + } } @override diff --git a/Frontend/patient_manager/lib/pages/profileBusinessUpdate.dart b/Frontend/patient_manager/lib/pages/profileBusinessUpdate.dart index 4a6df30b..1ca6bcbe 100644 --- a/Frontend/patient_manager/lib/pages/profileBusinessUpdate.dart +++ b/Frontend/patient_manager/lib/pages/profileBusinessUpdate.dart @@ -215,9 +215,34 @@ class _ProfileBusinessUpdateState extends State { ); } + bool isFieldsFilled() { + if (nameController.text.isEmpty || + typeController.text.isEmpty || + regController.text.isEmpty || + logonameController.text.isEmpty || + fnameController.text.isEmpty || + lnameController.text.isEmpty || + titleController.text.isEmpty || + signtureController.text.isEmpty || + accessController.text.isEmpty || + contactController.text.isEmpty) { + return false; + } else { + return true; + } + } + void submitForm(String business_id) { - //to-do late - updateBusinessProfileAPICall(business_id); + if (isFieldsFilled()) { + updateBusinessProfileAPICall(business_id); + } else { + showDialog( + context: context, + builder: (context) { + return const MIHErrorMessage(errorType: "Input Error"); + }, + ); + } } @override