FIX_in list
This commit is contained in:
parent
001953fbd7
commit
d94a16cc4a
File diff suppressed because one or more lines are too long
@ -2088,6 +2088,7 @@ class ApiService {
|
|||||||
final url = Uri.parse(
|
final url = Uri.parse(
|
||||||
'${Env.apiUrl}reports/endorsement-excel?manager_id=$managerId',
|
'${Env.apiUrl}reports/endorsement-excel?manager_id=$managerId',
|
||||||
);
|
);
|
||||||
|
// final url = Uri.parse('http://localhost/nhance_partner_be/reports/endorsement-excel?manager_id=$managerId');
|
||||||
print('getPdfDownload endorsement-excel - $url');
|
print('getPdfDownload endorsement-excel - $url');
|
||||||
await _initializeToken();
|
await _initializeToken();
|
||||||
|
|
||||||
|
|||||||
@ -335,6 +335,13 @@ class endosementState extends ConsumerState<Endorsement> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String _truncateText(String? text, int maxLength) {
|
||||||
|
if (text == null || text.length <= maxLength) {
|
||||||
|
return text ?? '-';
|
||||||
|
}
|
||||||
|
return '${text.substring(0, maxLength)}...';
|
||||||
|
}
|
||||||
|
|
||||||
List<Widget> _buildPopupMenuActions(BuildContext context, Map<String, dynamic> item) {
|
List<Widget> _buildPopupMenuActions(BuildContext context, Map<String, dynamic> item) {
|
||||||
final String Id = item['id']?.toString() ?? '';
|
final String Id = item['id']?.toString() ?? '';
|
||||||
final String? pdfPath = item["endorsement_completion_file"];
|
final String? pdfPath = item["endorsement_completion_file"];
|
||||||
@ -673,6 +680,13 @@ class endosementState extends ConsumerState<Endorsement> {
|
|||||||
style: _headerStyle,
|
style: _headerStyle,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
Expanded(
|
||||||
|
flex: 2,
|
||||||
|
child: Text(
|
||||||
|
'Partner',
|
||||||
|
style: _headerStyle,
|
||||||
|
),
|
||||||
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 2,
|
flex: 2,
|
||||||
child: Text(
|
child: Text(
|
||||||
@ -959,12 +973,12 @@ class endosementState extends ConsumerState<Endorsement> {
|
|||||||
|
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 2,
|
flex: 2,
|
||||||
child: Text(item['policy_start_date'] ?? '-',
|
child: Text(formatDateForList(item['policy_start_date']),
|
||||||
style: _dataBold)),
|
style: _dataBold)),
|
||||||
|
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 2,
|
flex: 2,
|
||||||
child: Text(item['policy_end_date'] ?? '-',
|
child: Text(formatDateForList(item['policy_end_date']),
|
||||||
style: _dataBold)),
|
style: _dataBold)),
|
||||||
|
|
||||||
Expanded(
|
Expanded(
|
||||||
@ -976,6 +990,16 @@ class endosementState extends ConsumerState<Endorsement> {
|
|||||||
flex: 2,
|
flex: 2,
|
||||||
child:
|
child:
|
||||||
Text(item['broker_name'] ?? '-', style: _dataBold)),
|
Text(item['broker_name'] ?? '-', style: _dataBold)),
|
||||||
|
Expanded(
|
||||||
|
flex: 2,
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(item['agent_code'] ?? '-', style: _dataBold),
|
||||||
|
Text(_truncateText(item['agent_name'], 20), style: _dataSub),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 2,
|
flex: 2,
|
||||||
child: Text(
|
child: Text(
|
||||||
@ -2187,6 +2211,24 @@ class endosementState extends ConsumerState<Endorsement> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String formatDateForList(String? dateStr) {
|
||||||
|
if (dateStr == null || dateStr.isEmpty || dateStr == '-') return '-';
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Catch invalid dates like "0000-00-00" or "30-11--0001"
|
||||||
|
if (dateStr.contains('0000') || dateStr.startsWith('30-11--')) return '-';
|
||||||
|
|
||||||
|
DateTime parsed = DateTime.parse(dateStr);
|
||||||
|
|
||||||
|
// Validate year is reasonable
|
||||||
|
if (parsed.year < 2000 || parsed.year > 2100) return '-';
|
||||||
|
|
||||||
|
return DateFormat('dd-MM-yyyy').format(parsed);
|
||||||
|
} catch (e) {
|
||||||
|
return '-';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> _showEndorsementUploadMenu(
|
Future<void> _showEndorsementUploadMenu(
|
||||||
BuildContext buttonContext,
|
BuildContext buttonContext,
|
||||||
Map<String, dynamic> item,
|
Map<String, dynamic> item,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user