input validation added to business manager
This commit is contained in:
parent
7111ad3600
commit
87f495e48e
2 changed files with 38 additions and 2 deletions
|
|
@ -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");
|
||||
},
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue