CHANGE_
This commit is contained in:
parent
4565440151
commit
ecc4dc9371
@ -497,12 +497,18 @@ class _empDetailsState extends State<empDetails> {
|
|||||||
Future<void> _selectDate(BuildContext context, formType) async {
|
Future<void> _selectDate(BuildContext context, formType) async {
|
||||||
print(formType);
|
print(formType);
|
||||||
var ageValidation = formType['age_validation'];
|
var ageValidation = formType['age_validation'];
|
||||||
int min =
|
print(ageValidation);
|
||||||
int.parse(ageValidation['min']); // Parsing the string to an integer
|
// Ensure ageValidation is a Map and contains the expected values
|
||||||
int max =
|
if (ageValidation is Map<String, dynamic>) {
|
||||||
int.parse(ageValidation['max']); // Parsing the string to an integer
|
int min = ageValidation.containsKey('min')
|
||||||
print(min);
|
? int.tryParse(ageValidation['min'].toString()) ?? 0
|
||||||
print(max);
|
: 0;
|
||||||
|
int max = ageValidation.containsKey('max')
|
||||||
|
? int.tryParse(ageValidation['max'].toString()) ?? 100
|
||||||
|
: 100;
|
||||||
|
|
||||||
|
print('Min age: $min');
|
||||||
|
print('Max age: $max');
|
||||||
late DateTime minDate;
|
late DateTime minDate;
|
||||||
late DateTime maxDate;
|
late DateTime maxDate;
|
||||||
|
|
||||||
@ -538,6 +544,24 @@ class _empDetailsState extends State<empDetails> {
|
|||||||
return date.isAfter(minDate.subtract(const Duration(days: 1))) &&
|
return date.isAfter(minDate.subtract(const Duration(days: 1))) &&
|
||||||
date.isBefore(maxDate.add(const Duration(days: 1)));
|
date.isBefore(maxDate.add(const Duration(days: 1)));
|
||||||
},
|
},
|
||||||
|
builder: (BuildContext context, Widget? child) {
|
||||||
|
return Theme(
|
||||||
|
data: ThemeData.light().copyWith(
|
||||||
|
primaryColor: Color(0xFFE26728), // Header background color
|
||||||
|
colorScheme: ColorScheme.light(
|
||||||
|
primary: Color(0xFFE26728), secondary: Color(0xFFE26728)),
|
||||||
|
buttonTheme: ButtonThemeData(textTheme: ButtonTextTheme.primary),
|
||||||
|
// dialogBackgroundColor:
|
||||||
|
// Colors.white, // Background color of the dialog
|
||||||
|
iconTheme: IconThemeData(color: Color(0xFFE26728)),
|
||||||
|
textButtonTheme: TextButtonThemeData(
|
||||||
|
style: TextButton.styleFrom(
|
||||||
|
foregroundColor: Color(0xFFE26728)), // Button color
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: child!,
|
||||||
|
);
|
||||||
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
if (picked != null && picked != _selectedDate) {
|
if (picked != null && picked != _selectedDate) {
|
||||||
@ -546,6 +570,9 @@ class _empDetailsState extends State<empDetails> {
|
|||||||
_dobController.text = DateFormat('dd-MM-yyyy').format(_selectedDate);
|
_dobController.text = DateFormat('dd-MM-yyyy').format(_selectedDate);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
print('Invalid age validation data');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> deleteItem(Map<String, dynamic> deletedItem) async {
|
Future<void> deleteItem(Map<String, dynamic> deletedItem) async {
|
||||||
@ -1314,6 +1341,13 @@ class _empDetailsState extends State<empDetails> {
|
|||||||
)
|
)
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
|
// Set the dropdown value based on the form_type
|
||||||
|
String? dropdownValue;
|
||||||
|
if (floaterData['form_type'] == 'spouse') {
|
||||||
|
dropdownValue = 'Spouse';
|
||||||
|
_relationShipController.text = 'Spouse';
|
||||||
|
}
|
||||||
|
|
||||||
print(selectedRelationships);
|
print(selectedRelationships);
|
||||||
print(gmcMappedFamilyFloaters);
|
print(gmcMappedFamilyFloaters);
|
||||||
if (action == 'Add') {
|
if (action == 'Add') {
|
||||||
@ -1418,9 +1452,10 @@ class _empDetailsState extends State<empDetails> {
|
|||||||
contentPadding: EdgeInsets.symmetric(
|
contentPadding: EdgeInsets.symmetric(
|
||||||
vertical: 5, horizontal: 5),
|
vertical: 5, horizontal: 5),
|
||||||
),
|
),
|
||||||
value: action == 'Edit'
|
value: dropdownValue ??
|
||||||
|
(action == 'Edit'
|
||||||
? _relationShipController.text
|
? _relationShipController.text
|
||||||
: null,
|
: null),
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
_relationShipController.text = value!;
|
_relationShipController.text = value!;
|
||||||
},
|
},
|
||||||
|
|||||||
@ -705,12 +705,14 @@ class _empReviewDetailsState extends State<empReviewDetails> {
|
|||||||
isChecked = false;
|
isChecked = false;
|
||||||
});
|
});
|
||||||
print('response.statusCode == 200');
|
print('response.statusCode == 200');
|
||||||
|
_showSuccessDialog();
|
||||||
ToastHelper.showSuccessToast(context, 'Saved Successfully...');
|
ToastHelper.showSuccessToast(context, 'Saved Successfully...');
|
||||||
} else {
|
} else {
|
||||||
setState(() {
|
setState(() {
|
||||||
isLoading = false;
|
isLoading = false;
|
||||||
});
|
});
|
||||||
// Handle other status codes
|
// Handle other status codes
|
||||||
|
_showErrorDialog();
|
||||||
ToastHelper.showErrorToast(context, 'Failed to Save');
|
ToastHelper.showErrorToast(context, 'Failed to Save');
|
||||||
print('Request failed with status: ${response['code']}');
|
print('Request failed with status: ${response['code']}');
|
||||||
}
|
}
|
||||||
@ -723,6 +725,67 @@ class _empReviewDetailsState extends State<empReviewDetails> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _showSuccessDialog() {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return AlertDialog(
|
||||||
|
backgroundColor: Colors.white,
|
||||||
|
title: Text(
|
||||||
|
'Success',
|
||||||
|
style: GoogleFonts.poppins(
|
||||||
|
color: Colors.green,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
content: Text('Enrollment Completed'),
|
||||||
|
actions: <Widget>[
|
||||||
|
TextButton(
|
||||||
|
child: Text(
|
||||||
|
'OK',
|
||||||
|
style: GoogleFonts.poppins(
|
||||||
|
color: Color(0xFFE26728),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.popAndPushNamed(context, 'empDetails');
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _showErrorDialog() {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return AlertDialog(
|
||||||
|
title: Text(
|
||||||
|
'Error',
|
||||||
|
style: GoogleFonts.poppins(
|
||||||
|
color: Colors.red,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
content: Text('Something went wrong. Enrollemnt not completed'),
|
||||||
|
actions: <Widget>[
|
||||||
|
TextButton(
|
||||||
|
child: Text(
|
||||||
|
'OK',
|
||||||
|
style: GoogleFonts.poppins(
|
||||||
|
color: Color(0xFFE26728),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
if ((gpaMappedFamilyFloaters == [] && gpaMappedFamilyFloaters == null) &&
|
if ((gpaMappedFamilyFloaters == [] && gpaMappedFamilyFloaters == null) &&
|
||||||
|
|||||||
@ -138,14 +138,16 @@ class _HrPolicyDetailsState extends State<hrPolicyDetails>
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> getEmployeeAndDependence(clintID, getPolicyNo) async {
|
Future<void> getEmployeeAndDependence(clintID, getPolicyNo) async {
|
||||||
// setState(() {
|
setState(() {
|
||||||
isLoading = true;
|
isLoading = true;
|
||||||
// });
|
});
|
||||||
try {
|
try {
|
||||||
final response = await apiService.getEmployeeAndDependenceToApi(
|
final response = await apiService.getEmployeeAndDependenceToApi(
|
||||||
clintID!, getPolicyNo!, empRefId!);
|
clintID!, getPolicyNo!, empRefId!);
|
||||||
if (response['status'] == 'success') {
|
if (response['status'] == 'success') {
|
||||||
|
setState(() {
|
||||||
isLoading = false;
|
isLoading = false;
|
||||||
|
});
|
||||||
setState(() {
|
setState(() {
|
||||||
getEmpDependenceByClintId =
|
getEmpDependenceByClintId =
|
||||||
List<Map<String, dynamic>>.from(response['data']);
|
List<Map<String, dynamic>>.from(response['data']);
|
||||||
@ -155,13 +157,18 @@ class _HrPolicyDetailsState extends State<hrPolicyDetails>
|
|||||||
print(filteredData);
|
print(filteredData);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
setState(() {
|
||||||
isLoading = false;
|
isLoading = false;
|
||||||
|
});
|
||||||
|
|
||||||
// ToastHelper.showWarningToast(
|
// ToastHelper.showWarningToast(
|
||||||
// context, 'Request failed with status: ${response.statusCode}');
|
// context, 'Request failed with status: ${response.statusCode}');
|
||||||
print('Request failed with status: ${response['code']}');
|
print('Request failed with status: ${response['code']}');
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
_isLoading = false;
|
setState(() {
|
||||||
|
isLoading = false;
|
||||||
|
});
|
||||||
print('Exception occurred: $e');
|
print('Exception occurred: $e');
|
||||||
} finally {
|
} finally {
|
||||||
setState(() {
|
setState(() {
|
||||||
|
|||||||
@ -88,6 +88,8 @@ flutter:
|
|||||||
- .env
|
- .env
|
||||||
- .env.development
|
- .env.development
|
||||||
- .env.production
|
- .env.production
|
||||||
|
- .env.uat
|
||||||
|
- .env.test
|
||||||
# - images/a_dot_burr.jpeg
|
# - images/a_dot_burr.jpeg
|
||||||
# - images/a_dot_ham.jpeg
|
# - images/a_dot_ham.jpeg
|
||||||
# An image asset can refer to one or more resolution-specific "variants", see
|
# An image asset can refer to one or more resolution-specific "variants", see
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user