claim form

This commit is contained in:
Surendiran 2026-03-17 10:53:55 +05:30
parent f1f3bcd1b6
commit 724768e240
4 changed files with 67 additions and 517 deletions

View File

@ -19,12 +19,12 @@ if (project.hasProperty('google-services.json')) {
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '54'
flutterVersionCode = '55'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '2.0.16'
flutterVersionName = '2.0.17'
}
def keystoreProperties = new Properties()

View File

@ -85,7 +85,6 @@ class _planclaimsformState extends State<planclaimsform> {
int? claimTypeId;
bool isClaimTypeValid = true;
// Declare subjectController and bodyController as instance variables
late TextEditingController subjectController;
late TextEditingController messageController;
@ -946,14 +945,14 @@ class _planclaimsformState extends State<planclaimsform> {
vertical: MediaQuery.of(context).size.height *
0.05, // 5% of screen height as vertical padding
)
: EdgeInsets.all(10),
color: Colors.white,
: EdgeInsets.all(10),
color: Colors.white,
child: Column(children: [
Card(
elevation: 5,
shape: RoundedRectangleBorder(
borderRadius:
BorderRadius.circular(15.0), // Set border radius here
BorderRadius.circular(15.0), // Set border radius here
),
child: Container(
decoration: BoxDecoration(
@ -964,10 +963,10 @@ class _planclaimsformState extends State<planclaimsform> {
padding: Responsive.isDesktop(context)
? EdgeInsets.only(top: 15, bottom: 15, left: 15, right: 15)
: EdgeInsets.only(
top: 10,
bottom: 10,
left: 10,
right: 10), // Add padding to the container
top: 10,
bottom: 10,
left: 10,
right: 10), // Add padding to the container
child: Row(
children: [
Expanded(
@ -987,22 +986,22 @@ class _planclaimsformState extends State<planclaimsform> {
),
padding: Responsive.isDesktop(context)
? EdgeInsets.only(
top: 20,
bottom: 20,
left: 0,
right: 0)
top: 20,
bottom: 20,
left: 0,
right: 0)
: EdgeInsets.only(
top: 10,
bottom: 10,
left: 10,
right: 10),
top: 10,
bottom: 10,
left: 10,
right: 10),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.center,
CrossAxisAlignment.center,
children: [
Row(
mainAxisAlignment:
MainAxisAlignment.start,
MainAxisAlignment.start,
children: [
Expanded(
flex: 1,
@ -1018,40 +1017,6 @@ class _planclaimsformState extends State<planclaimsform> {
),
),
),
padding: Responsive.isDesktop(context)
? EdgeInsets.only(
top: 20,
bottom: 20,
left: 0,
right: 0)
: EdgeInsets.only(
top: 10,
bottom: 10,
left: 10,
right: 10),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.center,
children: [
Row(
mainAxisAlignment:
MainAxisAlignment.start,
children: [
Expanded(
flex: 1,
child: InkWell(
onTap: () {
final route = fromClaimsPage == 0 ? 'claims' : 'help';
context.go('/$route');
},
child: Icon(
Icons
.chevron_left, // Replace with your desired icon
color: Color(0xFF000000),
size: 30,
),
),
),
Expanded(
flex: 11,
child: Row(
@ -1070,8 +1035,8 @@ class _planclaimsformState extends State<planclaimsform> {
fontSize:
Responsive.isDesktop(
context)
? 20
: 16,
? 20
: 16,
fontWeight: FontWeight.w600,
color: Color(0xFF000000),
),
@ -1091,16 +1056,16 @@ class _planclaimsformState extends State<planclaimsform> {
children: [
Column(
crossAxisAlignment:
CrossAxisAlignment.start,
CrossAxisAlignment.start,
children: [
Container(
width: double.infinity,
alignment: Alignment.centerLeft,
child: Column(
mainAxisAlignment:
MainAxisAlignment.start,
MainAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
CrossAxisAlignment.start,
children: [
Form(
key: formKey,
@ -1193,6 +1158,32 @@ class _planclaimsformState extends State<planclaimsform> {
Text('Please select a policy', style: TextStyle(color: Colors.red)),
],
),
SizedBox(height: 15),
if (policyTypeCondition == 1 || policyTypeCondition == 72)
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
buildDropdownField(
'Select Claim Type',
(value) {
setState(() {
claimTypeId = value;
isClaimTypeValid = true;
});
},
false,
claimTypeList,
'name',
claimTypeId,
),
if (!isClaimTypeValid)
Text(
'Please select a claim type',
style: TextStyle(color: Colors.red),
),
],
),
// // if (fromClaimsPage == 1)
// buildDropdownField(
@ -1254,7 +1245,7 @@ class _planclaimsformState extends State<planclaimsform> {
Text('Please select a member', style: TextStyle(color: Colors.red)),
],
),
SizedBox(height: 15),
SizedBox(height: 15),
// buildDropdownField(
// 'Member Name',
// (value) {
@ -1278,7 +1269,7 @@ SizedBox(height: 15),
// 'name',
// selectedMemberId, // Pass current selectedMemberId as selectedValue
// ),
Column(
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// buildTextField('Subject',
@ -1322,12 +1313,12 @@ SizedBox(height: 15),
Text('Please enter the Hospital Pincode', style: TextStyle(color: Colors.red)),
SizedBox(height: 15),
buildTextField('Hospital Phone No', hospitalPhoneNoController,
isRequired: true,
keyboardType: TextInputType.number,
inputFormatters: [
FilteringTextInputFormatter.digitsOnly,
LengthLimitingTextInputFormatter(10),
],minLength: 10,),
isRequired: true,
keyboardType: TextInputType.number,
inputFormatters: [
FilteringTextInputFormatter.digitsOnly,
LengthLimitingTextInputFormatter(10),
],minLength: 10,),
if (!isHospitalPhoneNoValid)
Text(
hospitalPhoneNoController.text.trim().isEmpty
@ -1454,9 +1445,9 @@ SizedBox(height: 15),
SizedBox(height: 15),
if (serviceId == 1) ...[
buildTextField('Claims Amount', claimAmountController, isRequired: true, keyboardType: TextInputType.number,
inputFormatters: [
FilteringTextInputFormatter.digitsOnly,
]),
inputFormatters: [
FilteringTextInputFormatter.digitsOnly,
]),
if (!isClaimAmountValid)
Text('Please enter the Claims Amount', style: TextStyle(color: Colors.red)),
],
@ -1475,7 +1466,7 @@ SizedBox(height: 15),
],
),
]
),
),
SizedBox(height: 15),
// ThemedUploadField(
// hintText: "Upload Documents",
@ -1504,442 +1495,6 @@ SizedBox(height: 15),
],
),
),
),
SizedBox(height: 15),
Container(
child: Column(
children: [
Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Container(
width: double.infinity,
alignment: Alignment.centerLeft,
child: Column(
mainAxisAlignment:
MainAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Form(
key: formKey,
child: Column(
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
buildDropdownField(
'Service',
(value) {
setState(() {
serviceId = value;
selectedServiceName = departmentList.firstWhere(
(serList) => serList['id'] == value,
orElse: () => {'name': ''},
)['name'];
policyNumberId = null;
loadClaimTypes(serviceId); // LOAD CLAIM TYPES
isServiceValid = true;
if (fromClaimsPage == 1) {
fetchPoliciesBasedOnService(serviceId);
}
});
},
fromClaimsPage == 0,
departmentList,
'name',
serviceId,
),
if (!isServiceValid)
Text('Please select a service', style: TextStyle(color: Colors.red)),
],
),
// buildDropdownField(
// 'Service',
// (value) {
// setState(() {
// serviceId = value;
// selectedServiceName =
// departmentList
// .firstWhere(
// (serList) =>
// serList[
// 'id'] ==
// value,
// orElse: () =>
// {'name': ''},
// )['name'];
// policyNumberId =
// null;
// if (fromClaimsPage ==
// 1) {
// fetchPoliciesBasedOnService(
// serviceId);
// }
// });
// },
// fromClaimsPage == 0,
// departmentList,
// 'name',
// serviceId, // Pass current serviceId as selectedValue
// ),
SizedBox(height: 15),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
buildDropdownField(
'Select Policy',
(value) {
setState(() {
policyNumberId = value;
selectedMemberId = null;
String? selectedPolicyNo = policyNumberList.firstWhere(
(item) => item['id'] == value,
orElse: () => {'policy_no': ''},
)['policy_no'];
if (selectedPolicyNo != null && fromClaimsPage == 1) {
fetchMemberBasedOnPolicy(selectedPolicyNo);
}
isPolicyValid = true;
});
},
fromClaimsPage == 0,
policyNumberList,
'policy_no',
policyNumberId,
),
if (!isPolicyValid)
Text('Please select a policy', style: TextStyle(color: Colors.red)),
],
),
SizedBox(height: 15),
if (policyTypeCondition == 1 || policyTypeCondition == 72)
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
buildDropdownField(
'Select Claim Type',
(value) {
setState(() {
claimTypeId = value;
isClaimTypeValid = true;
});
},
false,
claimTypeList,
'name',
claimTypeId,
),
if (!isClaimTypeValid)
Text(
'Please select a claim type',
style: TextStyle(color: Colors.red),
),
],
),
// // if (fromClaimsPage == 1)
// buildDropdownField(
// 'Select Policy',
// (value) {
// setState(() {
// policyNumberId =
// value;
// selectedMemberId =
// null;
// String?
// selectedPolicyNo =
// policyNumberList
// .firstWhere(
// (item) =>
// item['id'] ==
// value,
// orElse: () =>
// {
// 'policy_no': ''
// })['policy_no'];
//
// if (selectedPolicyNo !=
// null &&
// fromClaimsPage ==
// 1) {
// fetchMemberBasedOnPolicy(
// selectedPolicyNo);
// }
// });
// },
// fromClaimsPage == 0,
// policyNumberList,
// 'policy_no',
// policyNumberId, // Pass current policyNumberId as selectedValue
// ),
SizedBox(height: 15),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
buildDropdownField(
'Member Name',
(value) {
setState(() {
selectedMemberId = value;
selectedMemberName = employeePolicyList.firstWhere(
(member) => member['id'] == value,
orElse: () => {'name': ''},
)['name'];
isMemberValid = true;
});
},
false,
employeePolicyList,
'name',
selectedMemberId,
),
if (!isMemberValid)
Text('Please select a member', style: TextStyle(color: Colors.red)),
],
),
SizedBox(height: 15),
// buildDropdownField(
// 'Member Name',
// (value) {
// setState(() {
// selectedMemberId =
// value;
// selectedMemberName =
// employeePolicyList
// .firstWhere(
// (member) =>
// member[
// 'id'] ==
// value,
// orElse: () =>
// {'name': ''},
// )['name'];
// });
// },
// false,
// employeePolicyList,
// 'name',
// selectedMemberId, // Pass current selectedMemberId as selectedValue
// ),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// buildTextField('Subject',
// subjectController),
// if (!isSubjectValid)
// Text('Please enter the Subject', style: TextStyle(color: Colors.red)),
SizedBox(height: 15),
buildTextAreaField(
'Message',
messageController),
SizedBox(height: 15),
// if (policyTypeCondition ==
// 3)
// buildTextField(
// 'Accident Details',
// accidentDetailsController),
SizedBox(height: 15),
if (policyTypeCondition == 1 || policyTypeCondition == 72) ...[
buildTextField('Hospital Name', hospitalNameController),
if (!isHospitalNameValid)
Text('Please enter the Hospital Name', style: TextStyle(color: Colors.red)),
SizedBox(height: 15),
buildTextAreaField('Hospital Address',hospitalAddressController),
if (!isHospitalAddressValid)
Text('Please enter the Hospital Address', style: TextStyle(color: Colors.red)),
SizedBox(height: 15),
buildTextField('Hospital City', hospitalCityController),
if (!isHospitalCityValid)
Text('Please enter the Hospital City', style: TextStyle(color: Colors.red)),
SizedBox(height: 15),
buildTextField('Hospital State', hospitalStateController),
if (!isHospitalStateValid)
Text('Please enter the Hospital State', style: TextStyle(color: Colors.red)),
SizedBox(height: 15),
buildTextField('Hospital Pincode', hospitalPinCodeController,keyboardType: TextInputType.number,
inputFormatters: [
FilteringTextInputFormatter.digitsOnly,
LengthLimitingTextInputFormatter(6), // optional
]),
if (!isHospitalPincodeValid)
Text('Please enter the Hospital Pincode', style: TextStyle(color: Colors.red)),
SizedBox(height: 15),
buildTextField('Hospital Phone No', hospitalPhoneNoController,keyboardType: TextInputType.number,
inputFormatters: [
FilteringTextInputFormatter.digitsOnly,
LengthLimitingTextInputFormatter(10), // optional
]),
if (!isHospitalPhoneNoValid)
Text('Please enter the Hospital Phone No', style: TextStyle(color: Colors.red)),
],
SizedBox(height: 15),
if (serviceId == 2 ||
serviceId == 3 ||
serviceId == 4) ...[
buildDatePickerField(
label:
'Date of Birth',
selectedDate:
birthDate,
allowFuture: false,
onDateSelected:
(selectedDate) {
setState(() {
birthDate =
selectedDate;
});
},
),
SizedBox(height: 15),
buildDatePickerField(
label: 'Accident Date',
selectedDate: accidentDate,
allowFuture: false,
minDate: parsedPolicyStartDate,
maxDate: parsedPolicyEndDate,
onDateSelected: (selectedDate) {
setState(() {
if (deathDate != null) deathDate = null;
if (intimationDate != null) intimationDate = null;
accidentDate = selectedDate;
});
},
),
if (!isAccidentDateValid)
Text('Please select the Accident Date', style: TextStyle(color: Colors.red)),
SizedBox(height: 15),
buildDatePickerField(
label:
'Date of Death',
selectedDate:
deathDate,
allowFuture: false,
minDate: accidentDate ?? parsedPolicyStartDate,
maxDate: parsedPolicyEndDate,
onDateSelected:
(selectedDate) {
setState(() {
deathDate =
selectedDate;
});
},
),
SizedBox(height: 15),
buildDatePickerField(
label: 'Date of Intimation',
selectedDate: intimationDate,
allowFuture: false,
minDate: accidentDate ?? deathDate ?? parsedPolicyStartDate,
maxDate: parsedPolicyEndDate,
onDateSelected: (selectedDate) {
setState(() {
intimationDate = selectedDate;
});
},
),
if (!isIntimationDateValid)
Text('Please select the Intimation Date', style: TextStyle(color: Colors.red)),
],
SizedBox(height: 15),
// buildTextAreaField(
// 'Accident Details',
// accidentDetailsController),
// SizedBox(height: 15),
if (policyTypeCondition == 1 || policyTypeCondition == 72) ...[
// 🟡 Admit Date no future allowed
buildDatePickerField(
label: 'Admit Date',
selectedDate: admitDate,
allowFuture: false,
onDateSelected: (selectedDate) {
setState(() {
admitDate = selectedDate;
dischargeDate = null; // reset discharge when admit changes
});
},
),
if (!isAdmitDateValid)
const Text('Please select the Admit Date', style: TextStyle(color: Colors.red)),
const SizedBox(height: 20),
// 🟢 Discharge Date must be after Admit Date
buildDatePickerField(
label: 'Discharge Date',
selectedDate: dischargeDate,
allowFuture: true,
minDate: admitDate != null
? admitDate!.add(const Duration(days: 1))
: DateTime.now().add(const Duration(days: 1)),
maxDate: null,
onDateSelected: (selectedDate) {
setState(() {
dischargeDate = selectedDate;
});
},
),
if (!isDischargeDateValid)
const Text('Please select the Discharge Date', style: TextStyle(color: Colors.red)),
],
SizedBox(height: 15),
if (serviceId == 1) ...[
buildTextField('Claims Amount', claimAmountController, keyboardType: TextInputType.number,
inputFormatters: [
FilteringTextInputFormatter.digitsOnly,
]),
if (!isClaimAmountValid)
Text('Please enter the Claims Amount', style: TextStyle(color: Colors.red)),
],
SizedBox(height: 15),
if (serviceId == 2 ||
serviceId == 3 ||
serviceId == 4)
buildTextField(
'Sum Insured',
sumInsuredController,
keyboardType: TextInputType.number,
inputFormatters: [
FilteringTextInputFormatter.digitsOnly,
],
),
]
),
SizedBox(height: 15),
// ThemedUploadField(
// hintText: "Upload Documents",
// txtwidth: MediaQuery.of(context).size.width < 600
// ? MediaQuery.of(context).size.width // Full width on mobile
// : MediaQuery.of(context).size.width * 0.26, // 26% on desktop
// txtheight: 45,
// onFilesSelected: (files) {
// print("Picked files: ${files.map((f) => f.name).toList()}");
// setState(() {
// uploadedFiles = files; // store all selected files
// });
// },
// ),
Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
children: [
const MultiFileUploadWidget(),
],
),
),
],
),
),
],
),
),
],
),
SizedBox(height: 15),
@ -2185,7 +1740,7 @@ SizedBox(height: 15),
List<Map<String, dynamic>> itemsList,
String displayField,
int? selectedValue, // Added selectedValue parameter
{bool isRequired = false,}
{bool isRequired = false,}
) {
return DropdownButtonFormField<int>(
value: selectedValue,

View File

@ -421,13 +421,8 @@ class ApiService {
ToastHelper.showWarningToast(context, message);
return {};
} else if (response.statusCode == 429) {
<<<<<<< HEAD
final body = jsonDecode(response.body);
=======
if (!context.mounted) return {};
final body = jsonDecode(response.body);
>>>>>>> 24f532f750daddbb5d414d9056a4e1c4c760a2c4
final message = body['message'];
final body = jsonDecode(response.body);
final message = body['message'];
ToastHelper.showWarningToast(context, message);
return {};
} else {

View File

@ -17,8 +17,8 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
#version: 1.0.32+32
version: 1.0.29+34
#version: 2.0.16+54
version: 1.0.30+35
#version: 2.0.17+55
environment:
sdk: '>=3.3.3 <4.0.0'