UAT bug fix

This commit is contained in:
Surendiran 2026-02-20 11:20:45 +05:30
parent 9cd64e5c03
commit ad396fefb0
5 changed files with 187 additions and 110 deletions

View File

@ -144,6 +144,7 @@ class _RaiseClaimDialogState extends State<RaiseClaimDialog> {
bool isIntimationDateValid = true;
bool isAdmitDateValid = true;
bool isDischargeDateValid = true;
bool isAccidentService = false;
@override
void initState() {
@ -395,6 +396,8 @@ class _RaiseClaimDialogState extends State<RaiseClaimDialog> {
// Accident / Death
final isAccident = [2, 3, 4].contains(serviceId);
isAccidentService = isAccident ? true : false;
isAccidentDateValid = !isAccident || accidentDate != null;
isIntimationDateValid = !isAccident || intimationDate != null;
});
@ -1129,12 +1132,33 @@ class _RaiseClaimDialogState extends State<RaiseClaimDialog> {
value: selectedValue,
hint: const Text('Select'),
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) {
return DropdownMenuItem<int>(
value: item['id'],
child: Text(item[displayField]),
child: Text(
item[displayField] ?? '',
style: const TextStyle(fontSize: 13),
), // FULL TEXT here
);
}).toList(),
onChanged: onChanged,
),
),
@ -1146,6 +1170,7 @@ class _RaiseClaimDialogState extends State<RaiseClaimDialog> {
Widget buildDropdownFieldSearch(
String label,
void Function(int?) onChanged,
@ -1215,7 +1240,16 @@ class _RaiseClaimDialogState extends State<RaiseClaimDialog> {
),
),
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());
},
),
@ -1229,7 +1263,8 @@ class _RaiseClaimDialogState extends State<RaiseClaimDialog> {
return DropdownMenuItem<int>(
value: item['id'],
child: Text(
item[displayField],
item[displayField] ?? '',
style: const TextStyle(fontSize: 12),
overflow: TextOverflow.ellipsis,
),
);

View File

@ -387,9 +387,9 @@ class _cdTransactionDetailsState extends State<cdTransactionDetails> {
: '-',
item['endorsement_no'] ?? '',
item['sub_type_text'] ?? '',
item['transaction_type'] == 'Credit' ? '${item['amount']}' : '-',
item['transaction_type'] == 'Debit' ? '${item['amount']}' : '-',
'${item['balance'] ?? '0'}',
item['transaction_type'] == 'Credit' ? '${formatAmount(item['amount'])}' : '-',
item['transaction_type'] == 'Debit' ? '${formatAmount(item['amount'])}' : '-',
'${formatAmount(item['balance']) ?? '0'}',
item['description'] ?? '',
item['username'] ?? '',
]);

View File

@ -1527,7 +1527,12 @@ class _ClaimsPolicieState extends State<ClaimsPolicies> {
),
),
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());
},
),
@ -1542,7 +1547,7 @@ class _ClaimsPolicieState extends State<ClaimsPolicies> {
return DropdownMenuItem<int>(
value: item['id'],
child: Text(
item[displayField],
item[displayField] ?? '',
style: const TextStyle(fontSize: 12),
overflow: TextOverflow.ellipsis,
),

View File

@ -350,58 +350,62 @@ class _HrPolicyDetailsState extends State<hrPolicyDetails>
}
void search(String query) {
print(query);
// Check if the query is empty
if (query.isEmpty) {
// If search query is empty, show all data
final lowerQuery = query.toLowerCase().trim();
if (lowerQuery.isEmpty) {
setState(() {
filteredData = List.from(originalData);
});
} else {
// Filter the original data based on the search query
setState(() {
filteredData = originalData.where((row) {
final empStatus = row['emp_is_active'] == 1 ? 'active' : 'Inactive';
// Implement your filter logic here
// For example, check if any field in the row contains the query
// Adjust this logic based on your data structure
final status =
row['status']?.toString().toLowerCase().trim() ?? '';
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']
.toString()
.toLowerCase()
.contains(query.toLowerCase()) ||
?.toString()
.toLowerCase()
.contains(lowerQuery) == true ||
row['uhid']
.toString()
?.toString()
.toLowerCase()
.contains(query.toLowerCase()) ||
.contains(lowerQuery) == true ||
row['relationship']
.toString()
?.toString()
.toLowerCase()
.contains(query.toLowerCase()) ||
row['formatted_dob'].replaceAll("/", "-")
.toString()
.contains(lowerQuery) == true ||
row['formatted_dob']
?.toString()
.replaceAll("/", "-")
.toLowerCase()
.contains(query.toLowerCase()) ||
.contains(lowerQuery) == true ||
row['gender']
.toString()
?.toString()
.toLowerCase()
.contains(query.toLowerCase()) ||
.contains(lowerQuery) == true ||
row['mobile']
.toString()
?.toString()
.toLowerCase()
.contains(query.toLowerCase()) ||
.contains(lowerQuery) == true ||
row['email_corporate']
.toString()
?.toString()
.toLowerCase()
.contains(query.toLowerCase()) ||
row['status']
.toString()
.toLowerCase()
.contains(query.toLowerCase()) ||
empStatus.contains(query.toLowerCase());
.contains(lowerQuery) == true ||
statusMatch;
}).toList();
});
}
print(filteredData.length);
}
// emp_is_active
@ -1578,81 +1582,96 @@ class _HrPolicyDetailsState extends State<hrPolicyDetails>
return SizedBox(); // No icon to show
}
return Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
// --- eCard Button ---
if (showEcard)
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,
),
),
),
),
),
),
return SizedBox(
height: 40,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
if (showEcard && showClaim) SizedBox(width: 8),
// --- Claim Button ---
if (showClaim)
Tooltip(
message: 'View Claims',
child: MouseRegion(
cursor: SystemMouseCursors.click,
child: GestureDetector(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ClaimsPolicies(
empCode: item['emp_code']!,
/// --- eCard Button (Fixed Space) ---
SizedBox(
width: 40,
height: 40,
child: Visibility(
visible: showEcard,
maintainSize: true,
maintainAnimation: true,
maintainState: true,
child: 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(
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,
),
),
),
),
),
),
),
],
],
),
);
},
),

View File

@ -520,7 +520,7 @@ class _excelVerifyState extends State<preFileUpload> {
isLoading = false;
Map<String, dynamic> data = json.decode(responseString);
if (data['status'] == false) {
ToastHelper.showSuccessToast(context, data['message']);
ToastHelper.showErrorToast(context, data['message']);
print('Table');
setState(() {
@ -787,13 +787,21 @@ class _excelVerifyState extends State<preFileUpload> {
final picked = await showDatePicker(
context: context,
firstDate: DateTime(2000),
lastDate: DateTime(2100),
lastDate: DateTime.now(),
initialDate: DateTime.now(),
);
if (picked != null) {
openDateController.text =
DateFormat('dd-MM-yyyy').format(picked);
final formatted =
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',
controller: closeDateController,
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(
context: context,
firstDate: DateTime(2000),
firstDate: openDate, // Cannot select before open date
lastDate: DateTime(2100),
initialDate: DateTime.now(),
initialDate: openDate,
);
if (picked != null) {
closeDateController.text =
DateFormat('dd-MM-yyyy').format(picked);