This commit is contained in:
venbaittech 2025-07-07 15:50:47 +05:30
commit d3828f6b65
4 changed files with 185 additions and 169 deletions

View File

@ -52,49 +52,50 @@ class _ClaimHistoryPopupState extends State<ClaimHistoryPopup> {
super.dispose();
}
// Future<void> getClaimsHistoryDetails() async {
// setState(() {
// // isLoading = true;
// });
// try {
// print('10');
// final ticketID = widget.ticket_id;
// if(ticketID != '' || ticketID != null){
// return;
// }
// final response = await apiService.getClaimsHistoryToApi(
// widget.ticket_id, widget.postToken);
// if (response['status'] == 'success') {
// setState(() {
// // isLoading = false;
// });
// setState(() {
// getClaimsHistoryList = List<Map<String, dynamic>>.from(response['data']);
// // originalData = getCDPolicies;
// // filteredData = List.from(originalData);
// // print('filteredData');
// // print(filteredData);
// });
// } else {
// setState(() {
// // isLoading = false;
// });
//
// // ToastHelper.showWarningToast(
// // context, 'Request failed with status: ${response.statusCode}');
// print('Request failed with status: ${response['code']}');
// }
// } catch (e) {
// setState(() {
// // isLoading = false;
// });
// print('Exception occurred: $e');
// } finally {
// setState(() {
// // _isLoading = false;
// });
// }
// }
Future<void> getClaimsHistoryDetails() async {
setState(() {
// isLoading = true;
});
try {
print('10');
final ticketID = widget.ticket_id;
if (ticketID != '' || ticketID != null) {
return;
}
final response = await apiService.getClaimsHistoryToApi(
widget.ticket_id, widget.postToken);
if (response['status'] == 'success') {
setState(() {
// isLoading = false;
});
setState(() {
getClaimsHistoryList =
List<Map<String, dynamic>>.from(response['data']);
// originalData = getCDPolicies;
// filteredData = List.from(originalData);
// print('filteredData');
// print(filteredData);
});
} else {
setState(() {
// isLoading = false;
});
// ToastHelper.showWarningToast(
// context, 'Request failed with status: ${response.statusCode}');
print('Request failed with status: ${response['code']}');
}
} catch (e) {
setState(() {
// isLoading = false;
});
print('Exception occurred: $e');
} finally {
setState(() {
// _isLoading = false;
});
}
}
@override
Widget build(BuildContext context) {

View File

@ -507,6 +507,19 @@ class ApiService {
return response;
}
Future<Map<String, dynamic>> getClaimsHistoryToApi(
String ticket_type_id,String token) async {
print("getCashDepositDetailsToApi1");
final url = Uri.parse(
'${Environment.apiUrlPost}claimView?ticket_id=$ticket_type_id');
final headers = {
'Authorization': 'Bearer $token' ?? '',
};
final response = await _makeGetRequest(url, headers);
return response;
}
Future<Map<String, dynamic>> getEmployeeAndDependenceToApi(
String clintID, String getPolicyNo, String empRefId, String token) async {
print(_hrtoken);

View File

@ -280,8 +280,12 @@ class _CdPolicieState extends State<CdPolicies> {
),
)
: Expanded(
child: SingleChildScrollView(
child: _buildCDDataTable(context),
child: Row(
children: [
SingleChildScrollView(
child: _buildCDDataTable(context),
),
],
),
)
],
@ -299,131 +303,129 @@ class _CdPolicieState extends State<CdPolicies> {
);
}
return ListView.builder(
itemCount: _paginatedData.length + 2, // +1 for header, +1 for pagination
itemBuilder: (context, index) {
if (index == 0) return _buildHeader();
if (index == _paginatedData.length + 1)
return _buildPagination(context);
final item = _paginatedData[index - 1];
return _buildDataRow(item);
},
);
// return Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// // Header row
// Container(
// decoration: BoxDecoration(
// color: Color(0xFF00A6A6),
// borderRadius: BorderRadius.circular(6),
// ),
// padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 16),
// child: Row(
// children: [
// Expanded(
// flex: 4,
// child: Text(
// 'Insurer Name',
// style: GoogleFonts.poppins(
// color: Colors.white, fontWeight: FontWeight.bold),
// ),
// ),
// Expanded(
// flex: 3,
// child: Text(
// 'CD Account number',
// style: GoogleFonts.poppins(
// color: Colors.white, fontWeight: FontWeight.bold),
// ),
// ),
// Expanded(
// flex: 2,
// child: Text(
// 'Current Balance',
// style: GoogleFonts.poppins(
// color: Colors.white, fontWeight: FontWeight.bold),
// ),
// ),
// Expanded(
// flex: 1,
// child: Text(
// 'Action',
// textAlign: TextAlign.center,
// style: GoogleFonts.poppins(
// color: Colors.white, fontWeight: FontWeight.bold),
// ),
// ),
// ],
// ),
// ),
// return ListView.builder(
// itemCount: _paginatedData.length + 2, // +1 for header, +1 for pagination
// itemBuilder: (context, index) {
// if (index == 0) return _buildHeader();
// if (index == _paginatedData.length + 1)
// return _buildPagination(context);
//
// const SizedBox(height: 6),
//
// // Table body rows
// ..._paginatedData.mapIndexed((index, item) {
// return Container(
// margin: const EdgeInsets.only(bottom: 8),
// padding: const EdgeInsets.symmetric(vertical: 5, horizontal: 16),
// decoration: BoxDecoration(
// color: index % 2 == 0 ? Color(0xFFE6FAFB) : Colors.white,
// borderRadius: BorderRadius.circular(6),
// ),
// child: Row(
// children: [
// Expanded(
// flex: 4,
// child: Text(
// item['insurer_name'] ?? '-',
// style: GoogleFonts.poppins(color: Color(0xFF000000)),
// ),
// ),
// Expanded(
// flex: 3,
// child: Text(
// item['cd_master_account_no'] ?? '-',
// style: GoogleFonts.poppins(color: Color(0xFF000000)),
// ),
// ),
// Expanded(
// flex: 2,
// child: Text(
// "${item['balance'] ?? '0'}",
// style: GoogleFonts.poppins(color: Color(0xFF000000)),
// ),
// ),
// Expanded(
// flex: 1,
// child: Center(
// child: IconButton(
// icon: const Icon(Icons.remove_red_eye_outlined),
// onPressed: () {
// Navigator.push(
// context,
// MaterialPageRoute(
// builder: (context) => cdTransactionDetails(
// insurerName: item['insurer_name'],
// cdMasterAccountNo: item['cd_master_account_no'],
// insurerId: item['insurer_id'],
// cd_ac_pk: item['cd_ac_pk'],
// empClientId: widget.empClientId,
// postToken: widget.postToken),
// ),
// );
// },
// ),
// ),
// ),
// ],
// ),
// );
// }).toList(),
//
//
// ],
// final item = _paginatedData[index - 1];
// return _buildDataRow(item);
// },
// );
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Header row
Container(
decoration: BoxDecoration(
color: Color(0xFF00A6A6),
borderRadius: BorderRadius.circular(6),
),
padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 16),
child: Row(
children: [
Expanded(
flex: 4,
child: Text(
'Insurer Name',
style: GoogleFonts.poppins(
color: Colors.white, fontWeight: FontWeight.bold),
),
),
Expanded(
flex: 3,
child: Text(
'CD Account number',
style: GoogleFonts.poppins(
color: Colors.white, fontWeight: FontWeight.bold),
),
),
Expanded(
flex: 2,
child: Text(
'Current Balance',
style: GoogleFonts.poppins(
color: Colors.white, fontWeight: FontWeight.bold),
),
),
Expanded(
flex: 1,
child: Text(
'Action',
textAlign: TextAlign.center,
style: GoogleFonts.poppins(
color: Colors.white, fontWeight: FontWeight.bold),
),
),
],
),
),
const SizedBox(height: 6),
// Table body rows
..._paginatedData.mapIndexed((index, item) {
return Container(
margin: const EdgeInsets.only(bottom: 8),
padding: const EdgeInsets.symmetric(vertical: 5, horizontal: 16),
decoration: BoxDecoration(
color: index % 2 == 0 ? Color(0xFFE6FAFB) : Colors.white,
borderRadius: BorderRadius.circular(6),
),
child: Row(
children: [
Expanded(
flex: 4,
child: Text(
item['insurer_name'] ?? '-',
style: GoogleFonts.poppins(color: Color(0xFF000000)),
),
),
Expanded(
flex: 3,
child: Text(
item['cd_master_account_no'] ?? '-',
style: GoogleFonts.poppins(color: Color(0xFF000000)),
),
),
Expanded(
flex: 2,
child: Text(
"${item['balance'] ?? '0'}",
style: GoogleFonts.poppins(color: Color(0xFF000000)),
),
),
Expanded(
flex: 1,
child: Center(
child: IconButton(
icon: const Icon(Icons.remove_red_eye_outlined),
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => cdTransactionDetails(
insurerName: item['insurer_name'],
cdMasterAccountNo: item['cd_master_account_no'],
insurerId: item['insurer_id'],
cd_ac_pk: item['cd_ac_pk'],
empClientId: widget.empClientId,
postToken: widget.postToken),
),
);
},
),
),
),
],
),
);
}).toList(),
],
);
}
Widget _buildDataRow(Map<String, dynamic> item) {

View File

@ -741,7 +741,7 @@ class _ClaimsPolicieState extends State<ClaimsPolicies> {
child: Padding(
padding: EdgeInsets.all(10), // You can adjust this value
child: Image.asset(
'assets/cliamHistory.png',
'assets/claimHistory.png',
fit: BoxFit.contain,
width: 5,
),