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) {
|
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: () {
|
||||||
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() {
|
void internetConnectionPopUp() {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
@@ -189,7 +197,17 @@ class _BuildUserListState extends State<BuildUserList> {
|
|||||||
.theme
|
.theme
|
||||||
.primaryColor(),
|
.primaryColor(),
|
||||||
onTap: () {
|
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