forked from yaso_meth/mih-project
input validation added to business manager
This commit is contained in:
@@ -130,6 +130,14 @@ class _BuildEmployeeListState extends State<BuildEmployeeList> {
|
||||
);
|
||||
}
|
||||
|
||||
bool isRequiredFieldsCaptured() {
|
||||
if (accessController.text.isEmpty || typeController.text.isEmpty) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
void updateEmployeePopUp(int index) {
|
||||
setState(() {
|
||||
accessController.text = widget.employees[index].access;
|
||||
@@ -214,7 +222,17 @@ class _BuildEmployeeListState extends State<BuildEmployeeList> {
|
||||
.theme
|
||||
.primaryColor(),
|
||||
onTap: () {
|
||||
updateEmployeeAPICall(index);
|
||||
if (isRequiredFieldsCaptured()) {
|
||||
updateEmployeeAPICall(index);
|
||||
} else {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return const MIHErrorMessage(
|
||||
errorType: "Input Error");
|
||||
},
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
)
|
||||
|
||||
@@ -76,6 +76,14 @@ class _BuildUserListState extends State<BuildUserList> {
|
||||
}
|
||||
}
|
||||
|
||||
bool isRequiredFieldsCaptured() {
|
||||
if (accessController.text.isEmpty || typeController.text.isEmpty) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
void internetConnectionPopUp() {
|
||||
showDialog(
|
||||
context: context,
|
||||
@@ -189,7 +197,17 @@ class _BuildUserListState extends State<BuildUserList> {
|
||||
.theme
|
||||
.primaryColor(),
|
||||
onTap: () {
|
||||
createBusinessUserAPICall(index);
|
||||
if (isRequiredFieldsCaptured()) {
|
||||
createBusinessUserAPICall(index);
|
||||
} else {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return const MIHErrorMessage(
|
||||
errorType: "Input Error");
|
||||
},
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user