loader user creation
This commit is contained in:
parent
e1d1266853
commit
2003fc68bc
@ -29,6 +29,7 @@ import '../../../services/apiService.dart';
|
|||||||
import '../../../widgets/custom_text_field.dart';
|
import '../../../widgets/custom_text_field.dart';
|
||||||
import '../../../widgets/custom_text_forex.dart';
|
import '../../../widgets/custom_text_forex.dart';
|
||||||
import '../../../widgets/custom_user_form.dart';
|
import '../../../widgets/custom_user_form.dart';
|
||||||
|
import '../../../widgets/saving_loader.dart';
|
||||||
import 'office_details.dart';
|
import 'office_details.dart';
|
||||||
|
|
||||||
import 'package:universal_html/html.dart' as html;
|
import 'package:universal_html/html.dart' as html;
|
||||||
@ -822,6 +823,13 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
|
|||||||
// printFormData();
|
// printFormData();
|
||||||
print("travel validation");
|
print("travel validation");
|
||||||
bool isValid = travellerDetailsKey.currentState?.boolValidation() ?? false;
|
bool isValid = travellerDetailsKey.currentState?.boolValidation() ?? false;
|
||||||
|
|
||||||
|
print("Start loader at: ${DateTime.now()}");
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
barrierDismissible: false,
|
||||||
|
builder: (context) => const SavingLoader(),
|
||||||
|
);
|
||||||
if (selectedRole == "5" || setSelectesUserType == true) {
|
if (selectedRole == "5" || setSelectesUserType == true) {
|
||||||
print("NO validation");
|
print("NO validation");
|
||||||
|
|
||||||
@ -954,6 +962,8 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
|
|||||||
createUserData(userDetials);
|
createUserData(userDetials);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mounted) Navigator.of(context, rootNavigator: true).pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isValidData(Map<String, dynamic> data) {
|
bool isValidData(Map<String, dynamic> data) {
|
||||||
@ -1168,6 +1178,26 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
|
|||||||
} else {
|
} else {
|
||||||
print("❌ Submission failed. Status: ${response.statusCode}");
|
print("❌ Submission failed. Status: ${response.statusCode}");
|
||||||
print("📨 Body: ${response.body}");
|
print("📨 Body: ${response.body}");
|
||||||
|
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return AlertDialog(
|
||||||
|
title: Text("User Creation Failed"),
|
||||||
|
content: Text(
|
||||||
|
"There was a problem in creating user. Please try again.",
|
||||||
|
),
|
||||||
|
actions: [
|
||||||
|
TextButton(
|
||||||
|
child: Text("OK"),
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
print("🔥 Error submitting user: $e");
|
print("🔥 Error submitting user: $e");
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user