diff --git a/lib/claimshistory.dart b/lib/claimshistory.dart index f4fd777..1ae452d 100644 --- a/lib/claimshistory.dart +++ b/lib/claimshistory.dart @@ -52,49 +52,50 @@ class _ClaimHistoryPopupState extends State { super.dispose(); } - // Future 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>.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 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>.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) { diff --git a/lib/service/api_service.dart b/lib/service/api_service.dart index 5bf7c9f..c9c2701 100755 --- a/lib/service/api_service.dart +++ b/lib/service/api_service.dart @@ -507,6 +507,19 @@ class ApiService { return response; } + Future> 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> getEmployeeAndDependenceToApi( String clintID, String getPolicyNo, String empRefId, String token) async { print(_hrtoken); diff --git a/lib/service/hrDashboardTabs/cd.dart b/lib/service/hrDashboardTabs/cd.dart index 4a155cc..2848ead 100644 --- a/lib/service/hrDashboardTabs/cd.dart +++ b/lib/service/hrDashboardTabs/cd.dart @@ -280,8 +280,12 @@ class _CdPolicieState extends State { ), ) : Expanded( - child: SingleChildScrollView( - child: _buildCDDataTable(context), + child: Row( + children: [ + SingleChildScrollView( + child: _buildCDDataTable(context), + ), + ], ), ) ], @@ -299,131 +303,129 @@ class _CdPolicieState extends State { ); } - 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 item) { diff --git a/lib/service/hrDashboardTabs/claims.dart b/lib/service/hrDashboardTabs/claims.dart index c3f1848..f6591fa 100644 --- a/lib/service/hrDashboardTabs/claims.dart +++ b/lib/service/hrDashboardTabs/claims.dart @@ -741,7 +741,7 @@ class _ClaimsPolicieState extends State { 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, ),