From 0b1ed34f693d582718ea923084a65dd299972c6e Mon Sep 17 00:00:00 2001 From: venbaittech Date: Mon, 7 Jul 2025 15:40:34 +0530 Subject: [PATCH] UI_HR_POLICY_CHANGES --- lib/claimshistory.dart | 467 ++++++++++++++++ lib/excel_verification.dart | 22 +- lib/hrDashboard.dart | 2 +- lib/hrPolicyDetails.dart | 494 +++++++++-------- .../hrDashboardTabs/activePolicies.dart | 94 ++-- lib/service/hrDashboardTabs/cd.dart | 508 +++++++++++------- lib/service/hrDashboardTabs/claims.dart | 120 +++-- .../hrDashboardTabs/preEnrollment.dart | 82 +-- 8 files changed, 1238 insertions(+), 551 deletions(-) create mode 100644 lib/claimshistory.dart diff --git a/lib/claimshistory.dart b/lib/claimshistory.dart new file mode 100644 index 0000000..f4fd777 --- /dev/null +++ b/lib/claimshistory.dart @@ -0,0 +1,467 @@ +import 'package:flutter/material.dart'; +import 'package:google_fonts/google_fonts.dart'; +import 'package:nhancepolicy/service/api_service.dart'; + +class ClaimHistoryPopup extends StatefulWidget { + final String ticket_id; + final String empName; + final String empCode; + final String policyType; + final String clientPolicyNo; + final String claimAmount; + final String claimNo; + final String postToken; + + const ClaimHistoryPopup({ + Key? key, + required this.ticket_id, + required this.empName, + required this.empCode, + required this.policyType, + required this.clientPolicyNo, + required this.claimAmount, + required this.claimNo, + required this.postToken, + }) : super(key: key); + + @override + State createState() => _ClaimHistoryPopupState(); +} + +class _ClaimHistoryPopupState extends State { + late ApiService apiService; + List> getClaimsHistoryList = []; + int _index = 4; + + @override + void initState() { + super.initState(); + apiService = ApiService(context); + print(widget.postToken); + print(widget.claimAmount); + print(widget.claimNo); + print(widget.clientPolicyNo); + print(widget.empCode); + print(widget.policyType); + print(widget.ticket_id); + // getClaimsHistoryDetails(); + } + + @override + void dispose() { + 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; + // }); + // } + // } + + @override + Widget build(BuildContext context) { + if (getClaimsHistoryList.isEmpty) { + return SizedBox( + height: 50, + child: Center(child: Text('No available Claims')), + ); + } + return Container( + constraints: BoxConstraints(maxWidth: 800, maxHeight: 800), + padding: EdgeInsets.all(20), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(12), + ), + child: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Expanded( + child: Align( + alignment: Alignment.centerLeft, + child: Text( + 'Claim History', + style: GoogleFonts.poppins( + fontSize: 20, + fontWeight: FontWeight.w500, + color: Color(0xFF101010), + ), + ), + ), + ), + MouseRegion( + cursor: SystemMouseCursors.click, // Show pointer cursor + child: GestureDetector( + onTap: () => Navigator.of(context).pop(), + child: Container( + height: 30, + width: 30, + decoration: BoxDecoration( + color: Colors.white, + border: Border.all(color: Color(0xFFBCBCBC)), + borderRadius: BorderRadius.circular(6), + ), + child: Icon( + Icons.close, + size: 25, + color: Color(0xFFBCBCBC), + ), + ), + ), + ) + ], + ), + SizedBox(height: 10), + // Container( + // decoration: BoxDecoration( + // color: Color(0xFFFFFFFF), // White background + // borderRadius: BorderRadius.circular(12), + // boxShadow: [ + // BoxShadow( + // color: Color(0xFFEBEBEB), // Shadow color + // blurRadius: 14, // How soft the shadow is + // spreadRadius: 2, // How much it spreads + // offset: Offset(0, 1), // X and Y offset + // ), + // ], + // ), + // padding: const EdgeInsets.all(16), + // child: Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // Row( + // children: [ + // Expanded( + // child: _buildKeyValue( + // 'Name', '${widget.empName ?? ''} (${widget.empCode ?? ''})'), + // ), + // SizedBox(width: 16), + // Expanded( + // child: _buildKeyValue('Policy Name', + // '${widget.policyType ?? ''} - ${widget.clientPolicyNo ?? ''}')), + // ], + // ), + // SizedBox(height: 16), + // Row( + // children: [ + // Expanded( + // child: _buildKeyValue( + // 'Claim Amount', '₹${widget.claimAmount ?? ''}'), + // ), + // SizedBox(width: 16), + // Expanded( + // child: _buildKeyValue('Claim Number', widget.claimNo ?? ''), + // ), + // ], + // ), + // ], + // ), + // ), + // SizedBox(height: 10), + // // Container( + // // padding: const EdgeInsets.all(16), + // // child: Stepper( + // // currentStep: _index, + // // onStepCancel: () { + // // if (_index > 0) { + // // setState(() { + // // _index -= 1; + // // }); + // // } + // // }, + // // onStepContinue: () { + // // if (_index < 4) { + // // setState(() { + // // _index += 1; + // // }); + // // } + // // }, + // // onStepTapped: (int index) { + // // setState(() { + // // _index = index; + // // }); + // // }, + // // steps: [ + // // Step( + // // title: Text('Step 1: PAYMENT INITIATED'), + // // content: Text('Pay Initiate Date: 05-05-2025'), + // // isActive: true, + // // state: StepState.complete, + // // ), + // // Step( + // // title: Text('Step 2: INFORMATION REQUIRED'), + // // content: Text('Raised Date: 05-05-2025'), + // // isActive: true, + // // state: StepState.complete, + // // ), + // // Step( + // // title: Text('Step 3: CLAIM NO. UPDATION'), + // // content: Column( + // // crossAxisAlignment: CrossAxisAlignment.start, + // // children: [ + // // Text('Claim Number: 4315440'), + // // Text('Registration Date: 05-05-2025'), + // // ], + // // ), + // // isActive: true, + // // state: StepState.complete, + // // ), + // // Step( + // // title: Text('Step 4: QUERY DOCUMENT REQUIRED'), + // // content: Text('Query Received Date: 05-05-2025'), + // // isActive: true, + // // state: StepState.complete, + // // ), + // // Step( + // // title: Text('Step 5: APPROVED'), + // // content: Column( + // // crossAxisAlignment: CrossAxisAlignment.start, + // // children: [ + // // Text('Approved Amount: 4315440'), + // // Text('Approved Date: 05-05-2025'), + // // Text('Approved Letter: Lorem ipsum...'), + // // Text('Description: Lorem ipsum...'), + // // ], + // // ), + // // isActive: true, + // // state: StepState.complete, + // // ), + // // ], + // // ), + // // ) + // Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: List.generate(5, (index) { + // return _buildStep( + // stepNumber: index + 1, + // title: _getStepTitle(index), + // content: _getStepContent(index), + // isLast: index == 4, + // ); + // }), + // ) + ], + ), + ), + ); + } + + Widget _buildStep({ + required int stepNumber, + required String title, + required Widget content, + bool isLast = false, + }) { + return Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // Left Column with circle + line + Column( + children: [ + // Add top spacing before circle + SizedBox(height: stepNumber == 1 ? 0 : 4), + + // Step number circle + Container( + height: 28, + width: 28, + decoration: BoxDecoration( + color: Color(0xFF00A5A8), + shape: BoxShape.circle, + ), + alignment: Alignment.center, + child: Text( + '$stepNumber', + style: TextStyle( + color: Colors.white, + fontSize: 13, + fontWeight: FontWeight.w600, + ), + ), + ), + + // Dotted line below circle (except for last step) + if (!isLast) + Container( + height: 50, // increase to extend line + width: 2, + margin: EdgeInsets.only(top: 4, bottom: 4), + child: CustomPaint( + painter: DottedLinePainter(), + ), + ), + ], + ), + + SizedBox(width: 12), + + // Right Side: Step title and content + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + title, + style: TextStyle( + fontWeight: FontWeight.w600, + fontSize: 15, + ), + ), + SizedBox(height: 8), + Container( + width: double.infinity, + padding: EdgeInsets.all(12), + decoration: BoxDecoration( + color: Color(0xFFF7F7F7), + borderRadius: BorderRadius.circular(8), + border: Border.all(color: Color(0xFFE0E0E0)), + ), + child: content, + ), + SizedBox(height: isLast ? 0 : 16), + ], + ), + ), + ], + ); + } + + String _getStepTitle(int index) { + switch (index) { + case 0: + return 'PAYMENT INITIATED (Nalini – 21–06–2025 / 11:20:02 AM)'; + case 1: + return 'INFORMATION REQUIRED (Nalini – 21–06–2025 / 11:20:02 AM)'; + case 2: + return 'UNDER PROCESS – CLAIM NO. UPDATION (Nalini – 21–06–2025 / 11:20:02 AM)'; + case 3: + return 'UNDER PROCESS – QUERY DOCUMENT REQUIRED (Nalini – 21–06–2025 / 11:20:02 AM)'; + case 4: + return 'APPROVED (Nalini – 21–06–2025 / 11:20:02 AM)'; + default: + return ''; + } + } + + Widget _getStepContent(int index) { + switch (index) { + case 0: + return Text('Pay Initiate Date: 05-05-2025'); + case 1: + return Text('Raised Date: 05-05-2025'); + case 2: + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text('Claim Number: 4315440'), + Text('Registration Date: 05-05-2025'), + ], + ); + case 3: + return Text('Query Received Date: 05-05-2025'); + case 4: + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text('Approved Amount: 4315440'), + Text('Approved Date: 05-05-2025'), + Text('Approved Letter: Lorem ipsum...'), + Text('Description: Lorem ipsum...'), + ], + ); + default: + return SizedBox.shrink(); + } + } + + Widget _buildKeyValue(String title, String value) { + final displayValue = + (value == null || value.trim().isEmpty) ? 'N/A' : value; + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + title, + style: TextStyle( + color: Colors.grey[600], + fontSize: 14, + ), + ), + SizedBox(height: 4), + Text( + displayValue, + style: TextStyle( + color: Colors.black, + fontWeight: FontWeight.w500, + fontSize: 15, + ), + ), + ], + ); + } +} + +class DottedLinePainter extends CustomPainter { + @override + void paint(Canvas canvas, Size size) { + const dashHeight = 4.0; + const dashSpace = 3.0; + double startY = 0; + final paint = Paint() + ..color = Colors.grey.shade400 + ..strokeWidth = 1; + + while (startY < size.height) { + canvas.drawLine( + Offset(0, startY), + Offset(0, startY + dashHeight), + paint, + ); + startY += dashHeight + dashSpace; + } + } + + @override + bool shouldRepaint(CustomPainter oldDelegate) => false; +} diff --git a/lib/excel_verification.dart b/lib/excel_verification.dart index 9bc9cc0..7e21b1a 100755 --- a/lib/excel_verification.dart +++ b/lib/excel_verification.dart @@ -32,7 +32,19 @@ class excelVerify extends StatefulWidget { final String cardInsurer_name; final String cardPolicy_name; final String cardPolicy_ExpDate; - const excelVerify({Key? key, required this.ClientId, required this.ClientPoliyId, required this.clientBranchId, required this.Token, required this.TokenType, required this.cardType, required this.cardPolicyNo, required this.cardInsurer_name, required this.cardPolicy_name, required this.cardPolicy_ExpDate}) : super(key: key); + const excelVerify( + {Key? key, + required this.ClientId, + required this.ClientPoliyId, + required this.clientBranchId, + required this.Token, + required this.TokenType, + required this.cardType, + required this.cardPolicyNo, + required this.cardInsurer_name, + required this.cardPolicy_name, + required this.cardPolicy_ExpDate}) + : super(key: key); @override State createState() => _excelVerifyState(); @@ -608,9 +620,11 @@ class _excelVerifyState extends State { // invalidRelationships = 0; // dobAgeCheckCount = 0; // nonExcelFilteredData = []; - Navigator.pushNamed( - context, 'hrPolicyDetails', - arguments: argumentsData); + // Navigator.pushNamed( + // context, 'hrPolicyDetails', + // arguments: argumentsData); + + Navigator.pop(context); }, child: Text( 'Close', diff --git a/lib/hrDashboard.dart b/lib/hrDashboard.dart index 2c3b967..86e52c6 100755 --- a/lib/hrDashboard.dart +++ b/lib/hrDashboard.dart @@ -310,7 +310,7 @@ class _hrDashboardState extends State print("hr_id -$hr_id"); print("token -$token"); - // isLoading = true; + isLoading = true; // setState(() { // _isLoading = true; // }); diff --git a/lib/hrPolicyDetails.dart b/lib/hrPolicyDetails.dart index f4a0497..a124366 100755 --- a/lib/hrPolicyDetails.dart +++ b/lib/hrPolicyDetails.dart @@ -20,6 +20,7 @@ import 'package:intl/intl.dart'; import 'package:path_provider/path_provider.dart'; import 'package:path/path.dart' as path; import 'package:collection/collection.dart'; +import 'package:url_launcher/url_launcher.dart'; import 'customAppBar/customFooter.dart'; class hrPolicyDetails extends StatefulWidget { @@ -106,14 +107,14 @@ class _HrPolicyDetailsState extends State print('10'); final response = widget.TokenType == "post" - ? await apiService.getEmployeeAndDependenceToApi( - widget.ClientId, widget.ClientPoliyId, widget.clientBranchId, widget.Token) - : await apiService.getEmployeeAndDependenceToApiPre( - widget.ClientId, widget.ClientPoliyId, widget.clientBranchId, widget.Token); + ? await apiService.getEmployeeAndDependenceToApi(widget.ClientId, + widget.ClientPoliyId, widget.clientBranchId, widget.Token) + : await apiService.getEmployeeAndDependenceToApiPre(widget.ClientId, + widget.ClientPoliyId, widget.clientBranchId, widget.Token); if (response['status'] == 'success') { setState(() { - // isLoading = false; + isLoading = false; }); setState(() { getCDPolicies = List>.from(response['data']); @@ -124,7 +125,7 @@ class _HrPolicyDetailsState extends State }); } else { setState(() { - // isLoading = false; + isLoading = false; }); // ToastHelper.showWarningToast( @@ -133,7 +134,7 @@ class _HrPolicyDetailsState extends State } } catch (e) { setState(() { - // isLoading = false; + isLoading = false; }); print('Exception occurred: $e'); } finally { @@ -143,6 +144,18 @@ class _HrPolicyDetailsState extends State } } + Future _launchURL(String url) async { + final Uri uri = Uri.parse(url); // Parse the URL properly + print('_launchURL $uri'); + if (uri != null) { + print('If $uri'); + await launchUrl(uri, mode: LaunchMode.externalApplication); + } else { + print('else $uri'); + throw 'Could not launch $url'; + } + } + void search(String query) { print(query); // Check if the query is empty @@ -257,229 +270,263 @@ class _HrPolicyDetailsState extends State // TODO: implement build return Scaffold( appBar: CustomAppBar(), - body: Container( - color: Color(0xFFEFF3F6), - padding: const EdgeInsets.symmetric(vertical: 20, horizontal: 40), - child: Column( - children: [ - Container( - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, + backgroundColor: Color(0xFFEFF3F6), + body: Stack(children: [ + // color: Color(0xFFEFF3F6), + + // padding: const EdgeInsets.symmetric(vertical: 20, horizontal: 40), + SingleChildScrollView( + scrollDirection: Axis.vertical, + child: Container( + padding: EdgeInsets.only(top: 30, bottom: 200, left: 50, right: 50), + child: Column( children: [ Container( - // color: Colors.greenAccent.shade100, - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - IconButton( - padding: EdgeInsets.zero, // Removes default padding - constraints: BoxConstraints(), - onPressed: () { - Navigator.pop(context); - }, - icon: Icon( - Icons.arrow_back_ios, - color: Colors.grey, - size: 17, - )), - // IconButton( - // padding: EdgeInsets.zero, // Removes default padding - // constraints: BoxConstraints(), - // onPressed: () {}, - // icon: Icon( - // Icons.arrow_back_ios, - // color: Colors.grey, - // // size: 12, - // )), - ], - ), - ), - Container( - // color: Colors.redAccent.shade100, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Text( - "${widget.cardType} - ${widget.cardPolicyNo} " ?? '', - style: GoogleFonts.poppins( - color: Colors.black, - fontSize: 14, - fontWeight: FontWeight.w500, - ), + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + // color: Colors.greenAccent.shade100, + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + IconButton( + padding: + EdgeInsets.zero, // Removes default padding + constraints: BoxConstraints(), + onPressed: () { + Navigator.pop(context); + }, + icon: Icon( + Icons.arrow_back_ios, + color: Colors.grey, + size: 17, + )), + // IconButton( + // padding: EdgeInsets.zero, // Removes default padding + // constraints: BoxConstraints(), + // onPressed: () {}, + // icon: Icon( + // Icons.arrow_back_ios, + // color: Colors.grey, + // // size: 12, + // )), + ], ), - Text( - "${widget.cardInsurer_name} - ${widget.cardPolicy_name} (${widget.cardPolicy_ExpDate}) " ?? - '', - style: GoogleFonts.poppins( - color: Colors.grey, - fontSize: 12, - fontWeight: FontWeight.w400, - ), - ), - ], - ), - ), - ], - )), - SizedBox( - height: 20, - ), - Container( - decoration: BoxDecoration( - color: Colors.white, - borderRadius: - BorderRadius.circular(10), // 👈 set your desired radius - ), - // height: 400, - // margin: const EdgeInsets.only(left: 40.0, right: 40.0), - padding: const EdgeInsets.all(16.0), - child: Column( - children: [ - Row( - children: [ - Expanded( - flex: 4, - child: Align( - alignment: Alignment.centerLeft, - child: Container( - width: 400, - height: 37, - decoration: BoxDecoration( - color: Color(0xFFF0F0F0), - borderRadius: BorderRadius.circular(8), - ), - child: TextField( - decoration: InputDecoration( - hintText: 'Search', - prefixIcon: Icon(Icons.search, size: 18), - contentPadding: EdgeInsets.symmetric( - horizontal: 12, vertical: 8), - border: InputBorder - .none, // No border since Container handles it - ), - controller: searchController, - onChanged: search, - style: TextStyle(fontSize: 14), + ), + Container( + // color: Colors.redAccent.shade100, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Text( + "${widget.cardType} - ${widget.cardPolicyNo} " ?? + '', + style: GoogleFonts.poppins( + color: Colors.black, + fontSize: 14, + fontWeight: FontWeight.w500, ), ), - ), + Text( + "${widget.cardInsurer_name} - ${widget.cardPolicy_name} (${widget.cardPolicy_ExpDate}) " ?? + '', + style: GoogleFonts.poppins( + color: Colors.grey, + fontSize: 12, + fontWeight: FontWeight.w400, + ), + ), + ], ), - SizedBox(width: 12), - Expanded( - flex: 2, - child: Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - ElevatedButton( - onPressed: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => - excelVerify( - ClientId: widget.ClientId, // <-- from map + ), + ], + )), + SizedBox( + height: 20, + ), + Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: + BorderRadius.circular(10), // 👈 set your desired radius + ), + // height: 400, + // margin: const EdgeInsets.only(left: 40.0, right: 40.0), + padding: const EdgeInsets.all(16.0), + child: Column( + children: [ + Row( + children: [ + Expanded( + flex: 4, + child: Align( + alignment: Alignment.centerLeft, + child: Container( + width: 400, + height: 37, + decoration: BoxDecoration( + color: Color(0xFFF0F0F0), + borderRadius: BorderRadius.circular(8), + ), + child: TextField( + decoration: InputDecoration( + hintText: 'Search', + prefixIcon: Icon(Icons.search, size: 18), + contentPadding: EdgeInsets.symmetric( + horizontal: 12, vertical: 8), + border: InputBorder + .none, // No border since Container handles it + ), + controller: searchController, + onChanged: search, + style: TextStyle(fontSize: 14), + ), + ), + ), + ), + SizedBox(width: 12), + Expanded( + flex: 2, + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + ElevatedButton( + onPressed: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => excelVerify( + ClientId: + widget.ClientId, // <-- from map ClientPoliyId: widget.ClientPoliyId, clientBranchId: widget.clientBranchId, Token: widget.Token, TokenType: widget.TokenType, cardType: widget.cardType, cardPolicyNo: widget.cardPolicyNo, - cardInsurer_name: widget.cardInsurer_name, - cardPolicy_name: widget.cardPolicy_name, - cardPolicy_ExpDate: widget.cardPolicy_ExpDate, + cardInsurer_name: + widget.cardInsurer_name, + cardPolicy_name: + widget.cardPolicy_name, + cardPolicy_ExpDate: + widget.cardPolicy_ExpDate, - // Token: widget.Token, - // ClientId: widget.ClientId, - // ClientPolicyId : widget.ClientPoliyId, - // PolicyName: widget.cardPolicy_name, - // PolicyNo: widget.cardPolicyNo, - // ClientBranchId: widget.HrId, - // PolicyType: widget.cardType, + // Token: widget.Token, + // ClientId: widget.ClientId, + // ClientPolicyId : widget.ClientPoliyId, + // PolicyName: widget.cardPolicy_name, + // PolicyNo: widget.cardPolicyNo, + // ClientBranchId: widget.HrId, + // PolicyType: widget.cardType, ), + ), + ); + // exportToCsv(filteredData); + }, + style: ElevatedButton.styleFrom( + backgroundColor: Color(0xFFE26728), + padding: + EdgeInsets.all(10), // Internal padding + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular( + 10), // Border radius + side: BorderSide( + color: Colors + .transparent, // Optional border color + width: 1, // Border width + ), + ), + elevation: 0, ), - ); - // exportToCsv(filteredData); - }, - style: ElevatedButton.styleFrom( - backgroundColor: Color(0xFFE26728), - padding: EdgeInsets.all(10), // Internal padding - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular( - 10), // Border radius - side: BorderSide( - color: Colors - .transparent, // Optional border color - width: 1, // Border width + child: Text( + 'Import', + style: GoogleFonts.poppins( + fontSize: 12, + color: Color(0xFFFFFFFF), + fontWeight: FontWeight.w500, + letterSpacing: 1), ), ), - elevation: 0, - ), - child: Text( - 'Import', - style: GoogleFonts.poppins( - fontSize: 12, - color: Color(0xFFFFFFFF), - fontWeight: FontWeight.w500, - letterSpacing: 1), - ), - ), - SizedBox( - width: 10, - ), - ElevatedButton( - onPressed: () { - exportToCsv(filteredData); - }, - style: ElevatedButton.styleFrom( - backgroundColor: Color(0xFFE26728), - padding: EdgeInsets.all(10), // Internal padding - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular( - 10), // Border radius - side: BorderSide( - color: Colors - .transparent, // Optional border color - width: 1, // Border width + SizedBox( + width: 10, + ), + ElevatedButton( + onPressed: () { + exportToCsv(filteredData); + }, + style: ElevatedButton.styleFrom( + backgroundColor: Color(0xFFE26728), + padding: + EdgeInsets.all(10), // Internal padding + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular( + 10), // Border radius + side: BorderSide( + color: Colors + .transparent, // Optional border color + width: 1, // Border width + ), + ), + elevation: 0, + ), + child: Text( + 'Export', + style: GoogleFonts.poppins( + fontSize: 12, + color: Color(0xFFFFFFFF), + fontWeight: FontWeight.w500, + letterSpacing: 1), ), ), - elevation: 0, - ), - child: Text( - 'Export', - style: GoogleFonts.poppins( - fontSize: 12, - color: Color(0xFFFFFFFF), - fontWeight: FontWeight.w500, - letterSpacing: 1), + ], + ), + ), + ], + ), + SizedBox(height: 20), + Row( + children: [ + Expanded( + child: Container( + child: SingleChildScrollView( + scrollDirection: Axis.vertical, + child: _buildCDDataTable(context), ), ), - ], - ), + ) + ], ), ], ), - SizedBox(height: 20), - Row( - children: [ - Expanded( - child: Container( - child: SingleChildScrollView( - scrollDirection: Axis.vertical, - child: _buildCDDataTable(context), - ), - ), - ) - ], - ), - ], - ), + ), + ], ), - ], + ), ), - ), + + if (isLoading) + Container( + color: Color(0x98FFFCE5), // Semi-transparent background + child: Center( + child: // Your GIF loader widget + Image.asset( + height: 60, + width: 60, + 'assets/nhance-loader.gif'), // Adjust path to your GIF loader + ), + ), + Align( + alignment: Alignment.bottomCenter, + child: Container( + width: double.infinity, // Make the footer full width + child: CustomFooter(), + ), + ), + ]), ); } @@ -749,24 +796,28 @@ class _HrPolicyDetailsState extends State child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ - GestureDetector( - onTap: () {}, - child: Container( - height: 35, - width: 35, - decoration: BoxDecoration( - color: Color(0xFFE6F5F6), - borderRadius: BorderRadius.circular(8), - ), - child: Padding( - padding: EdgeInsets.all(6), // You can adjust this value - child: Image.asset( - 'assets/credit_card.png', - fit: BoxFit.contain, + if (item['ecard_download_link'] != null) + GestureDetector( + onTap: () { + _launchURL(item['ecard_download_link']); + }, + child: Container( + height: 35, + width: 35, + decoration: BoxDecoration( + color: Color(0xFFE6F5F6), + borderRadius: BorderRadius.circular(8), + ), + child: Padding( + padding: EdgeInsets.all( + 6), // You can adjust this value + child: Image.asset( + 'assets/credit_card.png', + fit: BoxFit.contain, + ), ), ), ), - ), SizedBox( width: 10, ), @@ -780,15 +831,14 @@ class _HrPolicyDetailsState extends State borderRadius: BorderRadius.circular(8), ), child: Padding( - padding: EdgeInsets.all(6), // You can adjust this value + padding: EdgeInsets.all( + 6), // You can adjust this value child: Image.asset( 'assets/claim.png', fit: BoxFit.contain, ), ), ), - - ), ], ), diff --git a/lib/service/hrDashboardTabs/activePolicies.dart b/lib/service/hrDashboardTabs/activePolicies.dart index ed91d17..7a47ccf 100644 --- a/lib/service/hrDashboardTabs/activePolicies.dart +++ b/lib/service/hrDashboardTabs/activePolicies.dart @@ -30,6 +30,7 @@ class _ActivePolicieState extends State { dynamic getCardArrays = []; int selectedIndex = 1; int stausVal = 1; + bool isLoading = false; // List> getCardArrays = [ // { @@ -108,7 +109,7 @@ class _ActivePolicieState extends State { print("hr_id -$hr_id"); print("token -$token"); - // isLoading = true; + isLoading = true; // setState(() { // _isLoading = true; // }); @@ -124,7 +125,7 @@ class _ActivePolicieState extends State { // clintID!, clintBranchId!, hr_id, token); print('IN1'); if (response['status'] == 'success') { - // isLoading = false; + isLoading = false; setState(() { print('response'); print(response['data']); @@ -141,6 +142,7 @@ class _ActivePolicieState extends State { print('IN2'); print("getCardArrays9 - $getCardArrays"); } else { + isLoading = false; print('API request failed with status'); setState(() { getCardArrays = []; @@ -211,47 +213,59 @@ class _ActivePolicieState extends State { ), ], ), - SizedBox( + const SizedBox( height: 15, ), - Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Container( - // color: Colors.redAccent.shade100, - // color: Colors.white, - // color: Colors.white, - padding: EdgeInsets.symmetric(horizontal: 16.0), - height: MediaQuery.of(context).size.height * 0.4, - // height: 400, + isLoading + ? Expanded( + // color: Color(0x98FFFCE5), // Semi-transparent background + child: Center( + child: // Your GIF loader widget + Image.asset( + height: 60, + width: 60, + 'assets/nhance-loader.gif'), // Adjust path to your GIF loader + ), + ) + : Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Container( + // color: Colors.redAccent.shade100, + // color: Colors.white, + // color: Colors.white, + padding: EdgeInsets.symmetric(horizontal: 16.0), + height: MediaQuery.of(context).size.height * 0.4, + // height: 400, - child: getCardArrays.isEmpty - ? Center( - child: Text( - 'No data found', - style: TextStyle( - fontSize: 16, - color: Colors.grey.shade600, - ), - ), - ) - : GridView.builder( - itemCount: getCardArrays.length, - gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 4, - crossAxisSpacing: 20, - mainAxisSpacing: 20, - // childAspectRatio: 2, - childAspectRatio: aspectRatio, - // childAspectRatio: 2.1, - ), - itemBuilder: (context, index) { - return buildPolicyCard(getCardArrays[index]); - }, - ), - ), - ], - ), + child: getCardArrays.isEmpty + ? Center( + child: Text( + 'No data found', + style: TextStyle( + fontSize: 16, + color: Colors.grey.shade600, + ), + ), + ) + : GridView.builder( + itemCount: getCardArrays.length, + gridDelegate: + SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 4, + crossAxisSpacing: 20, + mainAxisSpacing: 20, + // childAspectRatio: 2, + childAspectRatio: aspectRatio, + // childAspectRatio: 2.1, + ), + itemBuilder: (context, index) { + return buildPolicyCard(getCardArrays[index]); + }, + ), + ), + ], + ), ], ), ); diff --git a/lib/service/hrDashboardTabs/cd.dart b/lib/service/hrDashboardTabs/cd.dart index a539b36..4a155cc 100644 --- a/lib/service/hrDashboardTabs/cd.dart +++ b/lib/service/hrDashboardTabs/cd.dart @@ -66,7 +66,7 @@ class _CdPolicieState extends State { List get _paginatedData { final startIndex = (_currentPage - 1) * _rowsPerPage; final endIndex = - (_currentPage * _rowsPerPage).clamp(0, filteredData.length); + (_currentPage * _rowsPerPage).clamp(0, filteredData.length); return filteredData.sublist(startIndex, endIndex); } @@ -85,7 +85,7 @@ class _CdPolicieState extends State { Future getCDPoliciesDetails() async { print('9'); setState(() { - // isLoading = true; + isLoading = true; }); try { print('10'); @@ -93,7 +93,7 @@ class _CdPolicieState extends State { widget.empClientId, widget.empHrId, widget.postToken); if (response['status'] == 'success') { setState(() { - // isLoading = false; + isLoading = false; }); setState(() { getCDPolicies = List>.from(response['data']); @@ -104,7 +104,7 @@ class _CdPolicieState extends State { }); } else { setState(() { - // isLoading = false; + isLoading = false; }); // ToastHelper.showWarningToast( @@ -113,12 +113,12 @@ class _CdPolicieState extends State { } } catch (e) { setState(() { - // isLoading = false; + isLoading = false; }); print('Exception occurred: $e'); } finally { setState(() { - // _isLoading = false; + _isLoading = false; }); } } @@ -268,22 +268,30 @@ class _CdPolicieState extends State { ], ), SizedBox(height: 20), - Row( - children: [ - Expanded( - child: SingleChildScrollView( - child: _buildCDDataTable(context), - ), - ) - ], - ), - + isLoading + ? Expanded( + // color: Color(0x98FFFCE5), // semi-transparent overlay + child: Center( + child: Image.asset( + 'assets/nhance-loader.gif', + height: 60, + width: 60, + ), + ), + ) + : Expanded( + child: SingleChildScrollView( + child: _buildCDDataTable(context), + ), + ) ], ), ); } Widget _buildCDDataTable(BuildContext context) { + // Loader overlay + if (filteredData.isEmpty) { return const SizedBox( height: 50, @@ -291,206 +299,306 @@ class _CdPolicieState extends State { ); } - // Loader overlay - if (isLoading) - return Container( - color: Color(0x98FFFCE5), // semi-transparent overlay - child: Center( - child: Image.asset( - 'assets/nhance-loader.gif', - height: 60, - width: 60, - ), + 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), + // ), + // ), + // ], + // ), + // ), + // + // 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) { + return Container( + padding: const EdgeInsets.symmetric(vertical: 6, horizontal: 16), + margin: const EdgeInsets.only(top: 10), + decoration: BoxDecoration( + color: Color(0xFFE0F7F9), + border: const Border( + bottom: BorderSide(color: Color(0xFFD7E9EB), width: 1), ), - ); - - 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( + borderRadius: BorderRadius.circular(8), + ), + child: Row( + children: [ + Expanded( + flex: 4, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, 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), - ), - ); - }, - ), - ), - ), + Text(item['insurer_name'] ?? '-', style: _dataBold), ], ), - ); - }).toList(), + ), + Expanded( + flex: 4, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text(item['cd_master_account_no'] ?? '-', style: _dataBold), + ], + ), + ), + Expanded( + flex: 3, + child: Text("₹${item['balance'] ?? '0'}", style: _dataBold), + ), + 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), + ), + ); + }, + ), + ), + ), + ], + ), + ); + } - Row( - mainAxisAlignment: MainAxisAlignment.end, + Widget _buildHeader() { + return Container( + decoration: BoxDecoration( + color: Color(0xFF00A6A6), + borderRadius: BorderRadius.circular(6), + ), + padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 16), + child: const Row( + children: [ + Expanded(flex: 4, child: Text('Insurer Name', style: _headerStyle)), + Expanded( + flex: 4, child: Text('CD Account number', style: _headerStyle)), + Expanded( + flex: 4, child: Text('Current Balance', style: _headerStyle)), + Expanded(flex: 4, child: Text('Actions', style: _headerStyle)), + ], + ), + ); + } + + static final _dataBold = GoogleFonts.poppins( + fontSize: 12, + fontWeight: FontWeight.w400, + color: Color(0xFF000000), + ); + + static final _dataSub = GoogleFonts.poppins( + fontSize: 10, + fontWeight: FontWeight.w300, + color: Color(0xFF585757), + ); + + static const _headerStyle = TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + ); + + Widget _buildPagination(BuildContext context) { + return Row(mainAxisAlignment: MainAxisAlignment.end, children: [ + Padding( + padding: const EdgeInsets.symmetric(vertical: 12), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, children: [ - Padding( - padding: const EdgeInsets.symmetric(vertical: 12), - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - DropdownButton( - value: _rowsPerPage, - items: [5, 10, 15, 20, 50].map((int value) { - return DropdownMenuItem( - value: value, - child: Text( - ' $value ', - style: GoogleFonts.poppins(fontSize: 15), - ), - ); - }).toList(), - onChanged: (newValue) { - setState(() { - _rowsPerPage = newValue!; - _currentPage = 1; - }); - }, + DropdownButton( + value: _rowsPerPage, + items: [5, 10, 15, 20, 50].map((int value) { + return DropdownMenuItem( + value: value, + child: Text( + ' $value ', + style: GoogleFonts.poppins(fontSize: 15), ), - IconButton( - onPressed: _currentPage > 1 - ? () { + ); + }).toList(), + onChanged: (newValue) { + setState(() { + _rowsPerPage = newValue!; + _currentPage = + 1; // Reset to first page when rows per page changes + }); + }, + ), + IconButton( + onPressed: _currentPage > 1 + ? () { setState(() { _currentPage--; }); } - : null, - icon: Icon(Icons.chevron_left), + : null, + icon: Icon(Icons.chevron_left), + ), + for (int i = 1; + i <= (filteredData.length / _rowsPerPage).ceil(); + i++) + Padding( + padding: const EdgeInsets.symmetric(horizontal: 4), + child: ElevatedButton( + style: ElevatedButton.styleFrom( + backgroundColor: _currentPage == i + ? Color(0xFF00A6A6) + : Colors.grey[300], + foregroundColor: + _currentPage == i ? Colors.white : Colors.black, + minimumSize: Size(36, 36), + padding: EdgeInsets.zero, ), - for (int i = 1; - i <= (filteredData.length / _rowsPerPage).ceil(); - i++) - Padding( - padding: const EdgeInsets.symmetric(horizontal: 4), - child: ElevatedButton( - style: ElevatedButton.styleFrom( - backgroundColor: _currentPage == i - ? Color(0xFF00A6A6) - : Colors.grey[300], - foregroundColor: - _currentPage == i ? Colors.white : Colors.black, - minimumSize: Size(36, 36), - padding: EdgeInsets.zero, - ), - onPressed: () { - setState(() { - _currentPage = i; - }); - }, - child: Text(i.toString()), - ), - ), - IconButton( - onPressed: _currentPage < - (filteredData.length / _rowsPerPage).ceil() - ? () { - setState(() { - _currentPage++; - }); - } - : null, - icon: Icon(Icons.chevron_right), - ), - ], + onPressed: () { + setState(() { + _currentPage = i; + }); + }, + child: Text(i.toString()), + ), ), + IconButton( + onPressed: + _currentPage < (filteredData.length / _rowsPerPage).ceil() + ? () { + setState(() { + _currentPage++; + }); + } + : null, + icon: Icon(Icons.chevron_right), ), ], ), - ], - ); + ), + ]); } } diff --git a/lib/service/hrDashboardTabs/claims.dart b/lib/service/hrDashboardTabs/claims.dart index 74f5bb7..c3f1848 100644 --- a/lib/service/hrDashboardTabs/claims.dart +++ b/lib/service/hrDashboardTabs/claims.dart @@ -8,6 +8,7 @@ import 'package:http/http.dart' as http; import 'package:collection/collection.dart'; import 'package:jwt_decode/jwt_decode.dart'; +import '../../claimshistory.dart'; import '../../models/environment.dart'; import '../api_service.dart'; @@ -119,14 +120,14 @@ class _ClaimsPolicieState extends State { final response = await apiService.getClaimPoliciesToApi(widget.postToken); if (response['status'] == 'success') { setState(() { - // isLoading = false; + isLoading = false; }); setState(() { getClaimPoliciesApi = Map.from(response['data']); }); } else { setState(() { - // isLoading = false; + isLoading = false; }); // ToastHelper.showWarningToast( @@ -227,9 +228,20 @@ class _ClaimsPolicieState extends State { height: 10, ), - Expanded( - child: _buildClaimsDataTable(context), - ), + isLoading + ? Expanded( + // color: Color(0x98FFFCE5), // Semi-transparent background + child: Center( + child: // Your GIF loader widget + Image.asset( + height: 60, + width: 60, + 'assets/nhance-loader.gif'), // Adjust path to your GIF loader + ), + ) + : Expanded( + child: _buildClaimsDataTable(context), + ), // Expanded( // child: Container( // child: Column( @@ -692,24 +704,46 @@ class _ClaimsPolicieState extends State { child: Text(item['ticket_created_date'] ?? '-', style: _dataBold), ), Expanded( - flex: 2, + flex: 1, child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ GestureDetector( - onTap: () {}, + onTap: () { + showDialog( + context: context, + barrierDismissible: true, + builder: (BuildContext context) { + return Dialog( + backgroundColor: Colors.transparent, + insetPadding: EdgeInsets.all(16), + child: ClaimHistoryPopup( + ticket_id: item['id'], + empName: item['emp_name'], // example + empCode: item['emp_code'], // example + policyType: item['policy_type'], + clientPolicyNo: item['client_policy_no'], + claimAmount: item['claim_amount'], + claimNo: item['claim_no'], + postToken: widget.postToken, + ), + ); + }, + ); + }, child: Container( - height: 30, - width: 30, + height: 35, + width: 35, decoration: BoxDecoration( color: Color(0xFF86D1D4), borderRadius: BorderRadius.circular(8), ), child: Padding( - padding: EdgeInsets.all(6), // You can adjust this value + padding: EdgeInsets.all(10), // You can adjust this value child: Image.asset( - 'assets/claimHistory.png', + 'assets/cliamHistory.png', fit: BoxFit.contain, + width: 5, ), ), ), @@ -1106,6 +1140,12 @@ class _ClaimsPolicieState extends State { height: 40, child: DropdownSearch( selectedItem: selectedPolicyTypeName, + dropdownBuilder: (context, selectedItem) { + return Text( + selectedItem ?? "", + style: TextStyle(fontSize: 12), + ); + }, items: (String? filter, _) { return ticketTypeList .map((item) => item['type_name'].toString()) @@ -1123,7 +1163,6 @@ class _ClaimsPolicieState extends State { }, decoratorProps: DropDownDecoratorProps( decoration: InputDecoration( - constraints: BoxConstraints(maxHeight: 200), hintText: "Select Policy Type", hintStyle: TextStyle(fontSize: 12), filled: true, @@ -1144,9 +1183,12 @@ class _ClaimsPolicieState extends State { EdgeInsets.symmetric(horizontal: 12, vertical: 10), ), ), - popupProps: const PopupProps.menu( + popupProps: PopupProps.menu( + menuProps: const MenuProps(color: Colors.red), + fit: FlexFit.loose, + constraints: const BoxConstraints(maxHeight: 250), showSearchBox: true, - searchFieldProps: TextFieldProps( + searchFieldProps: const TextFieldProps( decoration: InputDecoration( hintText: "Search Policy Type", hintStyle: TextStyle(fontSize: 12), @@ -1207,7 +1249,7 @@ class _ClaimsPolicieState extends State { "Claim Status", style: TextStyle(fontSize: 12), ), - SizedBox( + const SizedBox( height: 3, ), SizedBox( @@ -1229,42 +1271,15 @@ class _ClaimsPolicieState extends State { "Selected selectedClaimStatusName: $selectedClaimStatusName"); print("Selected selectedClaimStatus: $selectedClaimStatus"); }, - - // selectedItem: selectedClaimStatus, - // selectedItem: getTypeNameById(selectedClaimStatus), - // items: (String? filter, _) { - // List allItems = claimStatusList - // .map((item) => item['claim_status'].toString()) - // .toList(); - // - // if (filter == null || filter.isEmpty) return allItems; - // - // return allItems - // .where((element) => - // element.toLowerCase().contains(filter.toLowerCase())) - // .toList(); - // }, - - // - // onChanged: (value) { - // if (!mounted) return; - // print("Selected ticket_type11: $value"); - // - // final id = getIdByTypeName(value); - // print("getIdByTypeName returned: $id"); - // - // if (id != null) { - // setState(() { - // selectedClaimStatus = id; - // }); - // } else { - // print("No match found for $value"); - // } - // }, - + dropdownBuilder: (context, selectedItem) { + return Text( + selectedItem ?? "", + style: TextStyle(fontSize: 12), + ); + }, decoratorProps: DropDownDecoratorProps( decoration: InputDecoration( - constraints: BoxConstraints(maxHeight: 200), + // suffixStyle: TextStyle(color: Colors.red), hintText: "Select Policy Type", hintStyle: TextStyle(fontSize: 12), filled: true, @@ -1283,12 +1298,17 @@ class _ClaimsPolicieState extends State { ), contentPadding: EdgeInsets.symmetric(horizontal: 12, vertical: 10), + labelStyle: TextStyle(fontSize: 19, color: Colors.red), ), ), - popupProps: PopupProps.menu( + popupProps: const PopupProps.menu( + fit: FlexFit.loose, + constraints: BoxConstraints(maxHeight: 250), showSearchBox: true, searchFieldProps: TextFieldProps( + style: TextStyle(fontSize: 14.0, color: Colors.red), decoration: InputDecoration( + labelStyle: TextStyle(fontSize: 19, color: Colors.red), hintText: "Search Claim Status", hintStyle: TextStyle(fontSize: 12), contentPadding: diff --git a/lib/service/hrDashboardTabs/preEnrollment.dart b/lib/service/hrDashboardTabs/preEnrollment.dart index 4a0d8c9..8c970af 100644 --- a/lib/service/hrDashboardTabs/preEnrollment.dart +++ b/lib/service/hrDashboardTabs/preEnrollment.dart @@ -29,6 +29,7 @@ class _PreEnrollmentState extends State { late ApiService apiService; dynamic getCardArrays = []; int selectedIndex = 0; + bool isLoading = false; // List> getCardArrays = [ // { // "client_policy_id": 392, @@ -91,7 +92,7 @@ class _PreEnrollmentState extends State { print("hr_id -$hr_id"); print("token -$token"); - // isLoading = true; + isLoading = true; // setState(() { // _isLoading = true; // }); @@ -106,7 +107,7 @@ class _PreEnrollmentState extends State { // clintID!, clintBranchId!, hr_id, token); print('IN1'); if (response['status'] == 'success') { - // isLoading = false; + isLoading = false; setState(() { print('response'); print(response['data']); @@ -120,6 +121,7 @@ class _PreEnrollmentState extends State { print('IN2'); print("getCardArrays9 - $getCardArrays"); } else { + isLoading = false; print('API request failed with status'); } } catch (e) { @@ -159,39 +161,51 @@ class _PreEnrollmentState extends State { child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ - Container( - // color: Colors.redAccent.shade100, - // color: Colors.white, - // color: Colors.white, - padding: EdgeInsets.symmetric(horizontal: 16.0), - height: MediaQuery.of(context).size.height * 0.45, - // height: 400, - - child: getCardArrays.isEmpty - ? Center( - child: Text( - 'No data found', - style: TextStyle( - fontSize: 16, - color: Colors.grey.shade600, - ), - ), - ) - : GridView.builder( - itemCount: getCardArrays.length, - gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 4, - crossAxisSpacing: 20, - mainAxisSpacing: 20, - // childAspectRatio: 2, - childAspectRatio: aspectRatio, - // childAspectRatio: 2.1, - ), - itemBuilder: (context, index) { - return buildPolicyCard(getCardArrays[index]); - }, + isLoading + ? Container( + // color: Color(0x98FFFCE5), // Semi-transparent background + child: Center( + child: // Your GIF loader widget + Image.asset( + height: 60, + width: 60, + 'assets/nhance-loader.gif'), // Adjust path to your GIF loader ), - ), + ) + : Container( + // color: Colors.redAccent.shade100, + // color: Colors.white, + // color: Colors.white, + padding: EdgeInsets.symmetric(horizontal: 16.0), + height: MediaQuery.of(context).size.height * 0.45, + // height: 400, + + child: getCardArrays.isEmpty + ? Center( + child: Text( + 'No data found', + style: TextStyle( + fontSize: 16, + color: Colors.grey.shade600, + ), + ), + ) + : GridView.builder( + itemCount: getCardArrays.length, + gridDelegate: + SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 4, + crossAxisSpacing: 20, + mainAxisSpacing: 20, + // childAspectRatio: 2, + childAspectRatio: aspectRatio, + // childAspectRatio: 2.1, + ), + itemBuilder: (context, index) { + return buildPolicyCard(getCardArrays[index]); + }, + ), + ), ], ), );