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

View File

@ -507,6 +507,19 @@ class ApiService {
return response; 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( Future<Map<String, dynamic>> getEmployeeAndDependenceToApi(
String clintID, String getPolicyNo, String empRefId, String token) async { String clintID, String getPolicyNo, String empRefId, String token) async {
print(_hrtoken); print(_hrtoken);

View File

@ -280,8 +280,12 @@ class _CdPolicieState extends State<CdPolicies> {
), ),
) )
: Expanded( : Expanded(
child: SingleChildScrollView( child: Row(
child: _buildCDDataTable(context), children: [
SingleChildScrollView(
child: _buildCDDataTable(context),
),
],
), ),
) )
], ],
@ -299,131 +303,129 @@ class _CdPolicieState extends State<CdPolicies> {
); );
} }
return ListView.builder( // return ListView.builder(
itemCount: _paginatedData.length + 2, // +1 for header, +1 for pagination // itemCount: _paginatedData.length + 2, // +1 for header, +1 for pagination
itemBuilder: (context, index) { // itemBuilder: (context, index) {
if (index == 0) return _buildHeader(); // if (index == 0) return _buildHeader();
if (index == _paginatedData.length + 1) // if (index == _paginatedData.length + 1)
return _buildPagination(context); // 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),
// ),
// ),
// ],
// ),
// ),
// //
// const SizedBox(height: 6), // final item = _paginatedData[index - 1];
// // return _buildDataRow(item);
// // 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(),
//
//
// ],
// ); // );
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) { Widget _buildDataRow(Map<String, dynamic> item) {

View File

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