UAT bug fix
This commit is contained in:
parent
9cd64e5c03
commit
ad396fefb0
@ -144,6 +144,7 @@ class _RaiseClaimDialogState extends State<RaiseClaimDialog> {
|
|||||||
bool isIntimationDateValid = true;
|
bool isIntimationDateValid = true;
|
||||||
bool isAdmitDateValid = true;
|
bool isAdmitDateValid = true;
|
||||||
bool isDischargeDateValid = true;
|
bool isDischargeDateValid = true;
|
||||||
|
bool isAccidentService = false;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@ -395,6 +396,8 @@ class _RaiseClaimDialogState extends State<RaiseClaimDialog> {
|
|||||||
// ☠ Accident / Death
|
// ☠ Accident / Death
|
||||||
final isAccident = [2, 3, 4].contains(serviceId);
|
final isAccident = [2, 3, 4].contains(serviceId);
|
||||||
|
|
||||||
|
isAccidentService = isAccident ? true : false;
|
||||||
|
|
||||||
isAccidentDateValid = !isAccident || accidentDate != null;
|
isAccidentDateValid = !isAccident || accidentDate != null;
|
||||||
isIntimationDateValid = !isAccident || intimationDate != null;
|
isIntimationDateValid = !isAccident || intimationDate != null;
|
||||||
});
|
});
|
||||||
@ -1129,12 +1132,33 @@ class _RaiseClaimDialogState extends State<RaiseClaimDialog> {
|
|||||||
value: selectedValue,
|
value: selectedValue,
|
||||||
hint: const Text('Select'),
|
hint: const Text('Select'),
|
||||||
icon: const Icon(Icons.keyboard_arrow_down),
|
icon: const Icon(Icons.keyboard_arrow_down),
|
||||||
|
|
||||||
|
/// ✅ This controls selected value (closed state)
|
||||||
|
selectedItemBuilder: (context) {
|
||||||
|
return itemsList.map<Widget>((item) {
|
||||||
|
return Align(
|
||||||
|
alignment: Alignment.centerLeft,
|
||||||
|
child: Text(
|
||||||
|
item[displayField] ?? '',
|
||||||
|
maxLines: 1,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
softWrap: false,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}).toList();
|
||||||
|
},
|
||||||
|
|
||||||
|
/// ✅ This controls dropdown list (open state)
|
||||||
items: itemsList.map<DropdownMenuItem<int>>((item) {
|
items: itemsList.map<DropdownMenuItem<int>>((item) {
|
||||||
return DropdownMenuItem<int>(
|
return DropdownMenuItem<int>(
|
||||||
value: item['id'],
|
value: item['id'],
|
||||||
child: Text(item[displayField]),
|
child: Text(
|
||||||
|
item[displayField] ?? '',
|
||||||
|
style: const TextStyle(fontSize: 13),
|
||||||
|
), // FULL TEXT here
|
||||||
);
|
);
|
||||||
}).toList(),
|
}).toList(),
|
||||||
|
|
||||||
onChanged: onChanged,
|
onChanged: onChanged,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -1146,6 +1170,7 @@ class _RaiseClaimDialogState extends State<RaiseClaimDialog> {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Widget buildDropdownFieldSearch(
|
Widget buildDropdownFieldSearch(
|
||||||
String label,
|
String label,
|
||||||
void Function(int?) onChanged,
|
void Function(int?) onChanged,
|
||||||
@ -1215,7 +1240,16 @@ class _RaiseClaimDialogState extends State<RaiseClaimDialog> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
searchMatchFn: (item, searchValue) {
|
searchMatchFn: (item, searchValue) {
|
||||||
final text = item.child.toString().toLowerCase();
|
final matchedItem = itemsList.firstWhere(
|
||||||
|
(e) => e['id'] == item.value,
|
||||||
|
orElse: () => {},
|
||||||
|
);
|
||||||
|
|
||||||
|
final text = matchedItem[displayField]
|
||||||
|
?.toString()
|
||||||
|
.toLowerCase() ??
|
||||||
|
'';
|
||||||
|
|
||||||
return text.contains(searchValue.toLowerCase());
|
return text.contains(searchValue.toLowerCase());
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@ -1229,7 +1263,8 @@ class _RaiseClaimDialogState extends State<RaiseClaimDialog> {
|
|||||||
return DropdownMenuItem<int>(
|
return DropdownMenuItem<int>(
|
||||||
value: item['id'],
|
value: item['id'],
|
||||||
child: Text(
|
child: Text(
|
||||||
item[displayField],
|
item[displayField] ?? '',
|
||||||
|
style: const TextStyle(fontSize: 12),
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@ -387,9 +387,9 @@ class _cdTransactionDetailsState extends State<cdTransactionDetails> {
|
|||||||
: '-',
|
: '-',
|
||||||
item['endorsement_no'] ?? '',
|
item['endorsement_no'] ?? '',
|
||||||
item['sub_type_text'] ?? '',
|
item['sub_type_text'] ?? '',
|
||||||
item['transaction_type'] == 'Credit' ? '₹${item['amount']}' : '-',
|
item['transaction_type'] == 'Credit' ? '₹${formatAmount(item['amount'])}' : '-',
|
||||||
item['transaction_type'] == 'Debit' ? '₹${item['amount']}' : '-',
|
item['transaction_type'] == 'Debit' ? '₹${formatAmount(item['amount'])}' : '-',
|
||||||
'₹${item['balance'] ?? '0'}',
|
'₹${formatAmount(item['balance']) ?? '0'}',
|
||||||
item['description'] ?? '',
|
item['description'] ?? '',
|
||||||
item['username'] ?? '',
|
item['username'] ?? '',
|
||||||
]);
|
]);
|
||||||
|
|||||||
@ -1527,7 +1527,12 @@ class _ClaimsPolicieState extends State<ClaimsPolicies> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
searchMatchFn: (item, searchValue) {
|
searchMatchFn: (item, searchValue) {
|
||||||
final text = item.child.toString().toLowerCase();
|
final matchedItem = itemsList.firstWhere(
|
||||||
|
(e) => e['id'] == item.value,
|
||||||
|
orElse: () => {},
|
||||||
|
);
|
||||||
|
|
||||||
|
final text = matchedItem['name']?.toString().toLowerCase() ?? '';
|
||||||
return text.contains(searchValue.toLowerCase());
|
return text.contains(searchValue.toLowerCase());
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@ -1542,7 +1547,7 @@ class _ClaimsPolicieState extends State<ClaimsPolicies> {
|
|||||||
return DropdownMenuItem<int>(
|
return DropdownMenuItem<int>(
|
||||||
value: item['id'],
|
value: item['id'],
|
||||||
child: Text(
|
child: Text(
|
||||||
item[displayField],
|
item[displayField] ?? '',
|
||||||
style: const TextStyle(fontSize: 12),
|
style: const TextStyle(fontSize: 12),
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
),
|
),
|
||||||
|
|||||||
@ -350,58 +350,62 @@ class _HrPolicyDetailsState extends State<hrPolicyDetails>
|
|||||||
}
|
}
|
||||||
|
|
||||||
void search(String query) {
|
void search(String query) {
|
||||||
print(query);
|
final lowerQuery = query.toLowerCase().trim();
|
||||||
// Check if the query is empty
|
|
||||||
if (query.isEmpty) {
|
if (lowerQuery.isEmpty) {
|
||||||
// If search query is empty, show all data
|
|
||||||
setState(() {
|
setState(() {
|
||||||
filteredData = List.from(originalData);
|
filteredData = List.from(originalData);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// Filter the original data based on the search query
|
|
||||||
setState(() {
|
setState(() {
|
||||||
filteredData = originalData.where((row) {
|
filteredData = originalData.where((row) {
|
||||||
final empStatus = row['emp_is_active'] == 1 ? 'active' : 'Inactive';
|
|
||||||
// Implement your filter logic here
|
final status =
|
||||||
// For example, check if any field in the row contains the query
|
row['status']?.toString().toLowerCase().trim() ?? '';
|
||||||
// Adjust this logic based on your data structure
|
|
||||||
|
bool statusMatch;
|
||||||
|
|
||||||
|
if (lowerQuery == 'active' || lowerQuery == 'inactive') {
|
||||||
|
// ✅ Exact match for these two
|
||||||
|
statusMatch = status == lowerQuery;
|
||||||
|
} else {
|
||||||
|
// ✅ Partial match for others
|
||||||
|
statusMatch = status.contains(lowerQuery);
|
||||||
|
}
|
||||||
|
|
||||||
return row['name']
|
return row['name']
|
||||||
.toString()
|
?.toString()
|
||||||
.toLowerCase()
|
.toLowerCase()
|
||||||
.contains(query.toLowerCase()) ||
|
.contains(lowerQuery) == true ||
|
||||||
row['uhid']
|
row['uhid']
|
||||||
.toString()
|
?.toString()
|
||||||
.toLowerCase()
|
.toLowerCase()
|
||||||
.contains(query.toLowerCase()) ||
|
.contains(lowerQuery) == true ||
|
||||||
row['relationship']
|
row['relationship']
|
||||||
.toString()
|
?.toString()
|
||||||
.toLowerCase()
|
.toLowerCase()
|
||||||
.contains(query.toLowerCase()) ||
|
.contains(lowerQuery) == true ||
|
||||||
row['formatted_dob'].replaceAll("/", "-")
|
row['formatted_dob']
|
||||||
.toString()
|
?.toString()
|
||||||
|
.replaceAll("/", "-")
|
||||||
.toLowerCase()
|
.toLowerCase()
|
||||||
.contains(query.toLowerCase()) ||
|
.contains(lowerQuery) == true ||
|
||||||
row['gender']
|
row['gender']
|
||||||
.toString()
|
?.toString()
|
||||||
.toLowerCase()
|
.toLowerCase()
|
||||||
.contains(query.toLowerCase()) ||
|
.contains(lowerQuery) == true ||
|
||||||
row['mobile']
|
row['mobile']
|
||||||
.toString()
|
?.toString()
|
||||||
.toLowerCase()
|
.toLowerCase()
|
||||||
.contains(query.toLowerCase()) ||
|
.contains(lowerQuery) == true ||
|
||||||
row['email_corporate']
|
row['email_corporate']
|
||||||
.toString()
|
?.toString()
|
||||||
.toLowerCase()
|
.toLowerCase()
|
||||||
.contains(query.toLowerCase()) ||
|
.contains(lowerQuery) == true ||
|
||||||
row['status']
|
statusMatch;
|
||||||
.toString()
|
|
||||||
.toLowerCase()
|
|
||||||
.contains(query.toLowerCase()) ||
|
|
||||||
empStatus.contains(query.toLowerCase());
|
|
||||||
}).toList();
|
}).toList();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
print(filteredData.length);
|
|
||||||
}
|
}
|
||||||
// emp_is_active
|
// emp_is_active
|
||||||
|
|
||||||
@ -1578,81 +1582,96 @@ class _HrPolicyDetailsState extends State<hrPolicyDetails>
|
|||||||
return SizedBox(); // No icon to show
|
return SizedBox(); // No icon to show
|
||||||
}
|
}
|
||||||
|
|
||||||
return Row(
|
return SizedBox(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
height: 40,
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
child: Row(
|
||||||
children: [
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
// --- eCard Button ---
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
if (showEcard)
|
children: [
|
||||||
Tooltip(
|
|
||||||
message: 'Download e-Card',
|
|
||||||
child: MouseRegion(
|
|
||||||
cursor: SystemMouseCursors.click,
|
|
||||||
child: GestureDetector(
|
|
||||||
onTap: () {
|
|
||||||
getEcardDownload(
|
|
||||||
item['emp_code'],
|
|
||||||
item['employee_id'],
|
|
||||||
item['client_policy_id'],
|
|
||||||
item['policy_no']);
|
|
||||||
},
|
|
||||||
child: Container(
|
|
||||||
height: 40,
|
|
||||||
width: 40,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: Color(0xFFE6F5F6),
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
),
|
|
||||||
child: Padding(
|
|
||||||
padding: EdgeInsets.all(4),
|
|
||||||
child: Image.asset(
|
|
||||||
'assets/credit_card.png',
|
|
||||||
fit: BoxFit.contain,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
if (showEcard && showClaim) SizedBox(width: 8),
|
/// --- eCard Button (Fixed Space) ---
|
||||||
|
SizedBox(
|
||||||
// --- Claim Button ---
|
width: 40,
|
||||||
if (showClaim)
|
height: 40,
|
||||||
Tooltip(
|
child: Visibility(
|
||||||
message: 'View Claims',
|
visible: showEcard,
|
||||||
child: MouseRegion(
|
maintainSize: true,
|
||||||
cursor: SystemMouseCursors.click,
|
maintainAnimation: true,
|
||||||
child: GestureDetector(
|
maintainState: true,
|
||||||
onTap: () {
|
child: Tooltip(
|
||||||
Navigator.push(
|
message: 'Download e-Card',
|
||||||
context,
|
child: MouseRegion(
|
||||||
MaterialPageRoute(
|
cursor: SystemMouseCursors.click,
|
||||||
builder: (context) => ClaimsPolicies(
|
child: GestureDetector(
|
||||||
empCode: item['emp_code']!,
|
onTap: () {
|
||||||
|
getEcardDownload(
|
||||||
|
item['emp_code'],
|
||||||
|
item['employee_id'],
|
||||||
|
item['client_policy_id'],
|
||||||
|
item['policy_no'],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: const Color(0xFFE6F5F6),
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
),
|
||||||
|
padding: const EdgeInsets.all(6),
|
||||||
|
child: Image.asset(
|
||||||
|
'assets/credit_card.png',
|
||||||
|
fit: BoxFit.contain,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
|
||||||
},
|
|
||||||
child: Container(
|
|
||||||
height: 40,
|
|
||||||
width: 40,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: Color(0xFFE6F5F6),
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
),
|
),
|
||||||
child: Padding(
|
),
|
||||||
padding: EdgeInsets.all(4),
|
),
|
||||||
child: Image.asset(
|
),
|
||||||
'assets/claim.png',
|
),
|
||||||
fit: BoxFit.contain,
|
|
||||||
|
const SizedBox(width: 8),
|
||||||
|
|
||||||
|
/// --- Claim Button (Fixed Space) ---
|
||||||
|
SizedBox(
|
||||||
|
width: 40,
|
||||||
|
height: 40,
|
||||||
|
child: Visibility(
|
||||||
|
visible: showClaim,
|
||||||
|
maintainSize: true,
|
||||||
|
maintainAnimation: true,
|
||||||
|
maintainState: true,
|
||||||
|
child: Tooltip(
|
||||||
|
message: 'View Claims',
|
||||||
|
child: MouseRegion(
|
||||||
|
cursor: SystemMouseCursors.click,
|
||||||
|
child: GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (context) => ClaimsPolicies(
|
||||||
|
empCode: item['emp_code']!,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: const Color(0xFFE6F5F6),
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
),
|
||||||
|
padding: const EdgeInsets.all(6),
|
||||||
|
child: Image.asset(
|
||||||
|
'assets/claim.png',
|
||||||
|
fit: BoxFit.contain,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|||||||
@ -520,7 +520,7 @@ class _excelVerifyState extends State<preFileUpload> {
|
|||||||
isLoading = false;
|
isLoading = false;
|
||||||
Map<String, dynamic> data = json.decode(responseString);
|
Map<String, dynamic> data = json.decode(responseString);
|
||||||
if (data['status'] == false) {
|
if (data['status'] == false) {
|
||||||
ToastHelper.showSuccessToast(context, data['message']);
|
ToastHelper.showErrorToast(context, data['message']);
|
||||||
print('Table');
|
print('Table');
|
||||||
|
|
||||||
setState(() {
|
setState(() {
|
||||||
@ -787,13 +787,21 @@ class _excelVerifyState extends State<preFileUpload> {
|
|||||||
final picked = await showDatePicker(
|
final picked = await showDatePicker(
|
||||||
context: context,
|
context: context,
|
||||||
firstDate: DateTime(2000),
|
firstDate: DateTime(2000),
|
||||||
lastDate: DateTime(2100),
|
lastDate: DateTime.now(),
|
||||||
initialDate: DateTime.now(),
|
initialDate: DateTime.now(),
|
||||||
);
|
);
|
||||||
if (picked != null) {
|
if (picked != null) {
|
||||||
openDateController.text =
|
final formatted =
|
||||||
DateFormat('dd-MM-yyyy').format(picked);
|
DateFormat('dd-MM-yyyy').format(picked);
|
||||||
|
|
||||||
|
// ✅ If open date changed, clear close date
|
||||||
|
if (openDateController.text != formatted) {
|
||||||
|
closeDateController.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
openDateController.text = formatted;
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -804,12 +812,22 @@ class _excelVerifyState extends State<preFileUpload> {
|
|||||||
label: 'Enrolment Close Date',
|
label: 'Enrolment Close Date',
|
||||||
controller: closeDateController,
|
controller: closeDateController,
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
|
|
||||||
|
if (openDateController.text.isEmpty) {
|
||||||
|
ToastHelper.showErrorToast(context, 'Please select Enrolment Open Date first');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final openDate = DateFormat('dd-MM-yyyy')
|
||||||
|
.parse(openDateController.text);
|
||||||
|
|
||||||
final picked = await showDatePicker(
|
final picked = await showDatePicker(
|
||||||
context: context,
|
context: context,
|
||||||
firstDate: DateTime(2000),
|
firstDate: openDate, // ✅ Cannot select before open date
|
||||||
lastDate: DateTime(2100),
|
lastDate: DateTime(2100),
|
||||||
initialDate: DateTime.now(),
|
initialDate: openDate,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (picked != null) {
|
if (picked != null) {
|
||||||
closeDateController.text =
|
closeDateController.text =
|
||||||
DateFormat('dd-MM-yyyy').format(picked);
|
DateFormat('dd-MM-yyyy').format(picked);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user