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) {
|
void updateEmployeePopUp(int index) {
|
||||||
setState(() {
|
setState(() {
|
||||||
accessController.text = widget.employees[index].access;
|
accessController.text = widget.employees[index].access;
|
||||||
|
|
@ -214,7 +222,17 @@ class _BuildEmployeeListState extends State<BuildEmployeeList> {
|
||||||
.theme
|
.theme
|
||||||
.primaryColor(),
|
.primaryColor(),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
|
if (isRequiredFieldsCaptured()) {
|
||||||
updateEmployeeAPICall(index);
|
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() {
|
void internetConnectionPopUp() {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
|
|
@ -189,7 +197,17 @@ class _BuildUserListState extends State<BuildUserList> {
|
||||||
.theme
|
.theme
|
||||||
.primaryColor(),
|
.primaryColor(),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
|
if (isRequiredFieldsCaptured()) {
|
||||||
createBusinessUserAPICall(index);
|
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