diff --git a/lib/cdTransactionDetails.dart b/lib/cdTransactionDetails.dart index b6f343d..d847a9f 100644 --- a/lib/cdTransactionDetails.dart +++ b/lib/cdTransactionDetails.dart @@ -15,6 +15,7 @@ import '../../models/environment.dart'; import 'package:collection/collection.dart'; import 'customAppBar/customAppBar.dart'; +import 'customAppBar/customFooter.dart'; class cdTransactionDetails extends StatefulWidget { final String insurerName; @@ -63,6 +64,15 @@ class _cdTransactionDetailsState extends State { int inceptionType = 0; TextEditingController searchController = TextEditingController(); late ApiService apiService; + int _currentPage = 1; + int _rowsPerPage = 5; + + List get _paginatedData { + final startIndex = (_currentPage - 1) * _rowsPerPage; + final endIndex = + (_currentPage * _rowsPerPage).clamp(0, filteredData.length); + return filteredData.sublist(startIndex, endIndex); + } @override void initState() { @@ -87,7 +97,7 @@ class _cdTransactionDetailsState extends State { widget.empClientId, widget.insurerId,widget.cd_ac_pk, widget.postToken); if (response['status'] == 'success') { setState(() { - // isLoading = false; + isLoading = false; }); setState(() { getCDTransData = List>.from(response['data']['deposit_data']); @@ -102,7 +112,7 @@ class _cdTransactionDetailsState extends State { }); } else { setState(() { - // isLoading = false; + isLoading = false; }); // ToastHelper.showWarningToast( @@ -111,12 +121,12 @@ class _cdTransactionDetailsState extends State { } } catch (e) { setState(() { - // isLoading = false; + isLoading = false; }); print('Exception occurred: $e'); } finally { setState(() { - // _isLoading = false; + _isLoading = false; }); } } @@ -262,146 +272,164 @@ class _cdTransactionDetailsState extends State { backgroundColor: Color(0xFFEFF3F6), body: Stack( children: [ - SingleChildScrollView( - child: Container( - padding: - EdgeInsets.only(top: 30, bottom: 200, left: 50, right: 50), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - MouseRegion( - cursor: SystemMouseCursors.click, // 👈 shows pointer on hover - child: GestureDetector( - onTap: () { - Navigator.pop(context); // or your desired action - }, - child: Row( - children: [ - Icon(Icons.arrow_back_ios_new_outlined, color: Color(0xFF707070)), - SizedBox(width: 8), - Expanded( - child: Text( - 'Transaction Details - ${widget.insurerName} (${widget.cdMasterAccountNo})', - style: GoogleFonts.poppins( - fontSize: 18, - fontWeight: FontWeight.w600, - color: Color(0xFF101010), - ), - ), - ), - ], - ), - ), - ), - SizedBox(height: 20), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - _buildInfoCard('Deposits', '₹$total_deposit', Color(0xFF39D45B), Icons.arrow_upward), - _buildInfoCard('Consumed', '₹$total_consumed', Color(0xFFED1D24), Icons.arrow_downward), - _buildInfoCard('Refund', '₹$total_refund', Color(0xFF39D45B), Icons.arrow_upward), - _buildInfoCard('Current Balance', '₹$currect_balance', Colors.black, null), - ], - ), - SizedBox(height: 16), - Container( - decoration: BoxDecoration( - color: Colors.white, - borderRadius: - BorderRadius.circular(10), // 👈 set your desired radius - ), - // height: 400, - padding: const EdgeInsets.all(16.0), - child: Column( - children: [ - Row( + SingleChildScrollView( + child: Container( + padding: + EdgeInsets.only(top: 30, bottom: 200, left: 50, right: 50), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, 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 + MouseRegion( + cursor: SystemMouseCursors.click, // 👈 shows pointer on hover + child: GestureDetector( + onTap: () { + Navigator.pop(context); // or your desired action + }, + child: Row( + children: [ + Icon(Icons.arrow_back_ios_new_outlined, color: Color(0xFF707070)), + SizedBox(width: 8), + Expanded( + child: Text( + 'Transaction Details - ${widget.insurerName} (${widget.cdMasterAccountNo})', + style: GoogleFonts.poppins( + fontSize: 18, + fontWeight: FontWeight.w600, + color: Color(0xFF101010), + ), + ), ), - controller: searchController, - onChanged: search, - style: GoogleFonts.poppins(fontSize: 14), - ), + ], ), ), ), - SizedBox(width: 12), - Expanded( - flex: 2, - child: Row( - mainAxisAlignment: MainAxisAlignment.end, + SizedBox(height: 20), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + _buildInfoCard('Deposits', '₹$total_deposit', Color(0xFF39D45B), Icons.arrow_upward), + _buildInfoCard('Consumed', '₹$total_consumed', Color(0xFFED1D24), Icons.arrow_downward), + _buildInfoCard('Refund', '₹$total_refund', Color(0xFF39D45B), Icons.arrow_upward), + _buildInfoCard('Current Balance', '₹$currect_balance', Colors.black, null), + ], + ), + SizedBox(height: 16), + Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: + BorderRadius.circular(10), // 👈 set your desired radius + ), + // height: 400, + padding: const EdgeInsets.all(16.0), + child: Column( children: [ - SizedBox( - width: 116, - height: 37, - child: 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 + 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: GoogleFonts.poppins(fontSize: 14), + ), ), ), - elevation: 0, ), - child: Text( - 'Export', - style: GoogleFonts.poppins( - fontSize: 16, - color: Color(0xFFFFFFFF), - fontWeight: FontWeight.w700, - letterSpacing: 1), + SizedBox(width: 12), + Expanded( + flex: 2, + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + SizedBox( + width: 116, + height: 37, + child: 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: 16, + color: Color(0xFFFFFFFF), + fontWeight: FontWeight.w700, + letterSpacing: 1), + ), + ), + ), + ], + ), ), - ), + ], + ), + SizedBox(height: 20), + Row( + children: [ + Expanded( + child: SingleChildScrollView( + child: _buildCDDataTable(context), + ), + ) + ], ), ], ), - ), - ], - ), - SizedBox(height: 20), - Row( - children: [ - Expanded( - child: SingleChildScrollView( - 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(), + ), ), - ) - ], - ) - ) - ) ] ) ); @@ -583,7 +611,7 @@ class _cdTransactionDetailsState extends State { const SizedBox(height: 6), // Table body rows - ...filteredData.mapIndexed((index, item) { + ..._paginatedData.mapIndexed((index, item) { return Container( margin: const EdgeInsets.only(bottom: 8), padding: const EdgeInsets.symmetric(vertical: 5, horizontal: 16), @@ -619,8 +647,8 @@ class _cdTransactionDetailsState extends State { Expanded( flex: 4, child: Text( - 'The Kancheepuram District Consumers Operative Wholesale Stores Limited-5526', - // item['unit'] ?? '-', + // 'The Kancheepuram District Consumers Operative Wholesale Stores Limited-5526', + item['unit'] ?? '-', textAlign: TextAlign.left, style: GoogleFonts.poppins(color: Color(0xFF000000)), ), @@ -628,11 +656,11 @@ class _cdTransactionDetailsState extends State { Expanded( flex: 3, child: Text( - 'Motor - 3001/379707905/00/000', - // item['policy_type'] != null && item['policy_type'].toString().trim().isNotEmpty && - // item['policy_no'] != null && item['policy_no'].toString().trim().isNotEmpty - // ? '${item['policy_type']} - ${item['policy_no']}' - // : '-', + // 'Motor - 3001/379707905/00/000', + item['policy_type'] != null && item['policy_type'].toString().trim().isNotEmpty && + item['policy_no'] != null && item['policy_no'].toString().trim().isNotEmpty + ? '${item['policy_type']} - ${item['policy_no']}' + : '-', textAlign: TextAlign.left, style: GoogleFonts.poppins(color: Color(0xFF000000)), ), @@ -697,6 +725,82 @@ class _cdTransactionDetailsState extends State { ), ); }).toList(), + + Row( + mainAxisAlignment: MainAxisAlignment.end, + 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; + }); + }, + ), + IconButton( + onPressed: _currentPage > 1 + ? () { + setState(() { + _currentPage--; + }); + } + : 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, + ), + 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/customAppBar/customAppBar.dart b/lib/customAppBar/customAppBar.dart index dab6831..79e59cd 100755 --- a/lib/customAppBar/customAppBar.dart +++ b/lib/customAppBar/customAppBar.dart @@ -24,66 +24,18 @@ class _CustomAppBarState extends State { // _checkTokens(); } - Future _checkTokens() async { - final prefs = await SharedPreferences.getInstance(); - final String? hrtoken = prefs.getString('hrtoken'); - final String? token = prefs.getString('token'); - // showBackToHR = prefs.getBool('showBackToHR')!; - - setState(() { - // showBackToHR = prefs.getBool('showBackToHR'); - // showBackToHR = (hrtoken != null && hrtoken.isNotEmpty) && - // (token != null && token.isNotEmpty); - // print((hrtoken != null && hrtoken.isNotEmpty)); - // print((token != null && token.isNotEmpty)); - // print('showBackToHR $showBackToHR'); - - // hideInactiveStatus = token != null && token.isNotEmpty; - }); - } - - Future hrLogout(BuildContext context) async { - final prefs = await SharedPreferences.getInstance(); - final String? hrtoken = prefs.getString('hrtoken'); - - // if (hrtoken != null && hrtoken.isNotEmpty) { - // prefs.setBool('showBackToHR', false); - // prefs.remove('token'); - // Navigator.pushNamed(context, 'hrDashboard'); - // } else { - // await prefs.clear(); - // Navigator.pushNamed(context, 'phone'); - // } - } Future logout(BuildContext context) async { final prefs = await SharedPreferences.getInstance(); - final String? hrtoken = prefs.getString('hrtoken'); - final String? token = prefs.getString('token'); - - if (token != null && token.isNotEmpty) { - if (hrtoken != null && hrtoken.isNotEmpty) { - await prefs.clear(); - Navigator.pushNamed(context, 'hrLogin'); - } else { - await prefs.clear(); - Navigator.pushNamed(context, 'phone'); - } - } else if (hrtoken != null && hrtoken.isNotEmpty) { - await prefs.clear(); - Navigator.pushNamed(context, 'hrLogin'); - } + // final String? hrtoken = prefs.getString('_postToken'); + // final String? token = prefs.getString('enrollToken'); + prefs.clear(); + Navigator.pushNamed(context, 'hrLogin'); } @override Widget build(BuildContext context) { final sw = MediaQuery.of(context).size.width; - // if (isLoading) { - // // Show a loading indicator or a placeholder AppBar while waiting - // return AppBar( - // title: Text('Loading...'), - // ); - // } return Scaffold( backgroundColor: Color(0xFFFFFCE5), // Set background color for AppBar appBar: PreferredSize( @@ -133,13 +85,13 @@ class _CustomAppBarState extends State { // Navigator.pushNamed(context, 'oldPolicy'); // }, // ), - if (showBackToHR) - NavBarItem( - text: "Back To HR", - onTap: () { - hrLogout(context); - }, - ), + // if (showBackToHR) + // NavBarItem( + // text: "Back To HR", + // onTap: () { + // // hrLogout(context); + // }, + // ), NavBarItem( text: "Logout", onTap: () async { diff --git a/lib/email_verify.dart b/lib/email_verify.dart index 853b7a3..917b94e 100644 --- a/lib/email_verify.dart +++ b/lib/email_verify.dart @@ -431,89 +431,89 @@ class _MyEmailVerifyState extends State { color: Colors.white, child: Stack( children: [ - Visibility( - visible: _size.width <= 1100, - child: ClipRRect( - borderRadius: BorderRadius.only( - bottomLeft: Radius.circular(30), - bottomRight: Radius.circular(30), - ), - child: Container( - height: _size.height / 3, - width: double.infinity, - color: Color(0xFFFFFCE5), - child: Stack( - children: [ - Column( - children: [ - SizedBox( - height: _size.height / - 6.4), // Adjust the spacing between the rows - Row( - mainAxisAlignment: MainAxisAlignment - .center, // Align to the center - children: [ - Expanded( - flex: Responsive.isDesktop(context) - ? 10 - : 12, - child: Align( - alignment: Responsive.isDesktop(context) - ? Alignment.centerLeft - : Alignment.bottomCenter, - child: Image.asset( - 'assets/nhance_app_logo.png', - width: 150, - height: 150, - ), - ), - ), - if (!Responsive.isMobile(context) && - !Responsive.isTablet(context)) - Expanded( - flex: 2, - child: MouseRegion( - cursor: SystemMouseCursors.click, - child: GestureDetector( - onTap: () { - // Add your navigation logic here - // For example, you can use Navigator.push to navigate to another page - Navigator.pushNamed( - context, 'hrLogin'); - }, - child: Row( - mainAxisAlignment: MainAxisAlignment - .end, // Align to the end (right) - children: [ - Text( - 'HR Login', - style: GoogleFonts.poppins( - color: Color( - 0xFF000000), // Text color - // Add other text styles as needed - ), - ), - SizedBox(width: 5), - Icon( - Icons - .east, // Icon for customer login - color: Colors - .black, // Adjust color as needed - ), - ], - ), - ), - ), - ), - ], - ), - ], - ), - ], - ), - ), - ), - ), + // Visibility( + // visible: _size.width <= 1100, + // child: ClipRRect( + // borderRadius: BorderRadius.only( + // bottomLeft: Radius.circular(30), + // bottomRight: Radius.circular(30), + // ), + // child: Container( + // height: _size.height / 3, + // width: double.infinity, + // color: Color(0xFFFFFCE5), + // child: Stack( + // children: [ + // Column( + // children: [ + // SizedBox( + // height: _size.height / + // 6.4), // Adjust the spacing between the rows + // Row( + // mainAxisAlignment: MainAxisAlignment + // .center, // Align to the center + // children: [ + // Expanded( + // flex: Responsive.isDesktop(context) + // ? 10 + // : 12, + // child: Align( + // alignment: Responsive.isDesktop(context) + // ? Alignment.centerLeft + // : Alignment.bottomCenter, + // child: Image.asset( + // 'assets/nhance_app_logo.png', + // width: 150, + // height: 150, + // ), + // ), + // ), + // if (!Responsive.isMobile(context) && + // !Responsive.isTablet(context)) + // Expanded( + // flex: 2, + // child: MouseRegion( + // cursor: SystemMouseCursors.click, + // child: GestureDetector( + // onTap: () { + // // Add your navigation logic here + // // For example, you can use Navigator.push to navigate to another page + // Navigator.pushNamed( + // context, 'hrLogin'); + // }, + // child: Row( + // mainAxisAlignment: MainAxisAlignment + // .end, // Align to the end (right) + // children: [ + // Text( + // 'HR Login', + // style: GoogleFonts.poppins( + // color: Color( + // 0xFF000000), // Text color + // // Add other text styles as needed + // ), + // ), + // SizedBox(width: 5), + // Icon( + // Icons + // .east, // Icon for customer login + // color: Colors + // .black, // Adjust color as needed + // ), + // ], + // ), + // ), + // ), + // ), + // ], + // ), + // ], + // ), + // ], + // ), + // ), + // ), + // ), Container( margin: marginInsets, alignment: Alignment.bottomCenter, @@ -566,18 +566,18 @@ class _MyEmailVerifyState extends State { .bottomCenter, // Align to the start child: _size.width <= 1100 ? Image.asset( - 'assets/nhance_app_logo.png', + 'assets/Nhance-Logo-Final 1.png', width: 150, height: 150, ) : _size.width > 1100 ? Image.asset( - 'assets/nhance_app_logo.png', + 'assets/Nhance-Logo-Final 1.png', width: 150, height: 150, ) : Image.asset( - 'assets/nhance_app_logo.png', + 'assets/Nhance-Logo-Final 1.png', width: 150, height: 150, ), diff --git a/lib/excel_verification.dart b/lib/excel_verification.dart index 0e3ab4f..9bc9cc0 100755 --- a/lib/excel_verification.dart +++ b/lib/excel_verification.dart @@ -1,6 +1,7 @@ import 'dart:typed_data'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; +import 'package:google_fonts/google_fonts.dart'; import 'package:jwt_decode/jwt_decode.dart'; import 'package:nhancepolicy/customAppBar/customAppBar.dart'; import 'dart:convert'; @@ -21,8 +22,17 @@ import 'package:spreadsheet_decoder/spreadsheet_decoder.dart'; import 'customAppBar/customFooter.dart'; class excelVerify extends StatefulWidget { + final String ClientId; + final String ClientPoliyId; + final String clientBranchId; final String Token; - const excelVerify({Key? key, required this.Token}) : super(key: key); + final String TokenType; + final String cardType; + final String cardPolicyNo; + 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); @override State createState() => _excelVerifyState(); @@ -49,10 +59,6 @@ class _excelVerifyState extends State { List> filteredData = []; // Filtered data source List> tableData = []; // Filtered data source - dynamic policy_name; - dynamic clientPolicyId; - dynamic clientId; - dynamic policyType; List> nonExcelFilteredData = []; dynamic invalidRelationships = 0; dynamic dobAgeCheckCount = 0; @@ -85,9 +91,7 @@ class _excelVerifyState extends State { _token = token; }); Map? decodedToken = Jwt.parseJwt(token); - clintID = decodedToken['client_id'].toString(); - empRefId = prefs.getString('empRefId'); - await getPolicyDetails(); + print('decodedToken $decodedToken'); } else { // Token is empty or null, handle accordingly (e.g., navigate to login screen) // For now, let's navigate to the login screen @@ -96,14 +100,14 @@ class _excelVerifyState extends State { } } - Future getPolicyDetails() async { - setState(() { - clientPolicyId = argumentsData['client_policy_id']; - clientId = argumentsData['client_id']; - policyType = argumentsData['type']; - policy_name = argumentsData['policy_name']; - }); - } + // Future getPolicyDetails() async { + // setState(() { + // clientPolicyId = argumentsData['client_policy_id']; + // clientId = argumentsData['client_id']; + // policyType = argumentsData['type']; + // policy_name = argumentsData['policy_name']; + // }); + // } // Future _uploadFile1(importPolicyName) async { // FilePickerResult? result = await FilePicker.platform.pickFiles( @@ -435,11 +439,10 @@ class _excelVerifyState extends State { filename: fileName ?? 'default_filename.xlsx', )); print('clintID: $clintID'); - request.fields['client_id'] = clintID; - print('clientPolicyId: $clientPolicyId'); + request.fields['client_id'] = widget.ClientId; // if (policyFirstPart == 'GPA') { - request.fields['policy_id'] = clientPolicyId; - request.fields['client_branch_id'] = empRefId; + request.fields['policy_id'] = widget.ClientPoliyId; + request.fields['client_branch_id'] = widget.clientBranchId; // } else { // request.fields['policy_id'] = '3'; // } @@ -492,6 +495,9 @@ class _excelVerifyState extends State { }); } } else { + setState(() { + isLoading = false; + }); // ToastHelper.showSuccessToast( // context, 'Failed to upload file: ${response.reasonPhrase}'); ToastHelper.showSuccessToast(context, 'Something went wrong'); @@ -553,13 +559,6 @@ class _excelVerifyState extends State { @override Widget build(BuildContext context) { - dynamic arguments = ModalRoute.of(context)!.settings.arguments; - print('arguments'); - print(arguments); - if (arguments != null && arguments is Map) { - argumentsData = arguments; - } - return Scaffold( appBar: CustomAppBar(), body: Stack(children: [ @@ -568,16 +567,16 @@ class _excelVerifyState extends State { data: ThemeData( canvasColor: Color(0xFFF4F7FE), colorScheme: Theme.of(context).colorScheme.copyWith( - primary: Color(0xFFE26728), + primary: Color(0xFF00999E), background: Colors.red, - secondary: Color(0xFFE26728), + secondary: Color(0xFF00999E), ), ), child: Container( padding: const EdgeInsets.all(20), color: Color(0xFFEFF3F6), child: Card( - elevation: 1, + elevation: 0, color: Colors.white, child: Column( children: [ @@ -776,8 +775,8 @@ class _excelVerifyState extends State { title: Container( child: Text( 'Import Excel', - style: TextStyle( - color: Color(0xFFE26728), + style: GoogleFonts.poppins( + color: Color(0xFF00999E), ), ), ), @@ -795,7 +794,7 @@ class _excelVerifyState extends State { children: [ Expanded( child: Text( - '$policy_name - ($policyType)', + '${widget.cardPolicy_name} - (${widget.cardType})', textAlign: TextAlign.center, style: TextStyle( fontSize: 20, @@ -993,7 +992,7 @@ class _excelVerifyState extends State { style: TextStyle( fontSize: 15, color: Color( - 0xFFE26728), // Add underline decoration + 0xFF00999E), // Add underline decoration ), ), ), @@ -1012,7 +1011,7 @@ class _excelVerifyState extends State { Step( title: Text( 'Excel Validation', - style: TextStyle(color: Color(0xFFE26728)), + style: TextStyle(color: Color(0xFF00999E)), ), content: isSuccess ? Center( diff --git a/lib/hrDashboard.dart b/lib/hrDashboard.dart index 1e86484..5b9cdc1 100755 --- a/lib/hrDashboard.dart +++ b/lib/hrDashboard.dart @@ -499,7 +499,7 @@ class _hrDashboardState extends State SizedBox(height: 16), Container( padding: const EdgeInsets.all(5), - height: MediaQuery.of(context).size.height * 0.08, + // height: MediaQuery.of(context).size.height * 0.08, decoration: BoxDecoration( color: Color(0xFFC4E3E6), // 🔹 Background behind the TabBar diff --git a/lib/hrPolicyDetails.dart b/lib/hrPolicyDetails.dart index 642db30..f4a0497 100755 --- a/lib/hrPolicyDetails.dart +++ b/lib/hrPolicyDetails.dart @@ -26,7 +26,7 @@ class hrPolicyDetails extends StatefulWidget { final String ClientId; // final String ClientBranchId; final String ClientPoliyId; - final String HrId; + final String clientBranchId; final String Token; final String TokenType; final String cardType; @@ -40,7 +40,7 @@ class hrPolicyDetails extends StatefulWidget { required this.ClientId, // required this.ClientBranchId, required this.ClientPoliyId, - required this.HrId, + required this.clientBranchId, required this.Token, required this.TokenType, required this.cardType, @@ -107,9 +107,9 @@ class _HrPolicyDetailsState extends State final response = widget.TokenType == "post" ? await apiService.getEmployeeAndDependenceToApi( - widget.ClientId, widget.ClientPoliyId, widget.HrId, widget.Token) + widget.ClientId, widget.ClientPoliyId, widget.clientBranchId, widget.Token) : await apiService.getEmployeeAndDependenceToApiPre( - widget.ClientId, widget.ClientPoliyId, widget.HrId, widget.Token); + widget.ClientId, widget.ClientPoliyId, widget.clientBranchId, widget.Token); if (response['status'] == 'success') { setState(() { @@ -379,7 +379,26 @@ class _HrPolicyDetailsState extends State context, MaterialPageRoute( builder: (context) => - excelVerify(Token: widget.Token), + 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, + + // Token: widget.Token, + // ClientId: widget.ClientId, + // ClientPolicyId : widget.ClientPoliyId, + // PolicyName: widget.cardPolicy_name, + // PolicyNo: widget.cardPolicyNo, + // ClientBranchId: widget.HrId, + // PolicyType: widget.cardType, + ), ), ); // exportToCsv(filteredData); @@ -733,18 +752,19 @@ class _HrPolicyDetailsState extends State GestureDetector( onTap: () {}, child: Container( - height: 30, - width: 30, + height: 35, + width: 35, decoration: BoxDecoration( - color: Color(0xFFE6F5F6), - borderRadius: BorderRadius.circular(12)), - child: Icon(Icons.credit_card, - color: Color(0xFF3D3D3D)), - // child: Image.asset( - // 'assets/ecard.jpg', - // height: 20, - // fit: BoxFit.cover, - // ), + 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( @@ -753,21 +773,22 @@ class _HrPolicyDetailsState extends State GestureDetector( onTap: () {}, child: Container( - height: 30, - width: 30, + height: 35, + width: 35, decoration: BoxDecoration( - color: Color(0xFFE6F5F6), - borderRadius: BorderRadius.circular(12)), - // child: Icon( - // Icons.policy, - // color: Color(0xFF3D3D3D), - // ), - child: Image.asset( - 'assets/claims.jpg', - height: 20, - fit: BoxFit.cover, + color: Color(0xFFE6F5F6), + borderRadius: BorderRadius.circular(8), + ), + child: Padding( + padding: EdgeInsets.all(6), // You can adjust this value + child: Image.asset( + 'assets/claim.png', + fit: BoxFit.contain, + ), ), ), + + ), ], ), diff --git a/lib/main.dart b/lib/main.dart index 1d0e40b..aa237b3 100755 --- a/lib/main.dart +++ b/lib/main.dart @@ -68,7 +68,16 @@ Future main() async { ), 'hrHome': (context) => MyHrHome(), 'excelVerify': (context) => excelVerify( + ClientId: '', + ClientPoliyId: '', + clientBranchId: '', Token: '', + TokenType: '', + cardType: '', + cardPolicyNo: '', + cardInsurer_name: '', + cardPolicy_name: '', + cardPolicy_ExpDate: '', ), 'empDetails': (context) => empDetails(), 'addOnsDetails': (context) => addOnsDetails(), @@ -85,7 +94,7 @@ Future main() async { 'hrPolicyDetails': (context) => hrPolicyDetails( ClientId: '', ClientPoliyId: '', - HrId: '', + clientBranchId: '', Token: '', TokenType: '', cardType: '', diff --git a/lib/service/hrDashboardTabs/activePolicies.dart b/lib/service/hrDashboardTabs/activePolicies.dart index 1336d84..ed91d17 100644 --- a/lib/service/hrDashboardTabs/activePolicies.dart +++ b/lib/service/hrDashboardTabs/activePolicies.dart @@ -276,7 +276,7 @@ class _ActivePolicieState extends State { builder: (context) => hrPolicyDetails( ClientId: policy['client_id'].toString(), // <-- from map ClientPoliyId: policy['client_policy_id'].toString(), - HrId: widget.empClientBranchId, + clientBranchId: widget.empClientBranchId, Token: widget.postToken, TokenType: 'post', cardType: policy['type'].toString(), diff --git a/lib/service/hrDashboardTabs/cd.dart b/lib/service/hrDashboardTabs/cd.dart index f8d902d..806d3f7 100644 --- a/lib/service/hrDashboardTabs/cd.dart +++ b/lib/service/hrDashboardTabs/cd.dart @@ -60,6 +60,15 @@ class _CdPolicieState extends State { int inceptionType = 0; TextEditingController searchController = TextEditingController(); late ApiService apiService; + int _currentPage = 1; + int _rowsPerPage = 5; + + List get _paginatedData { + final startIndex = (_currentPage - 1) * _rowsPerPage; + final endIndex = + (_currentPage * _rowsPerPage).clamp(0, filteredData.length); + return filteredData.sublist(startIndex, endIndex); + } @override void initState() { @@ -76,7 +85,7 @@ class _CdPolicieState extends State { Future getCDPoliciesDetails() async { print('9'); setState(() { - isLoading = true; + // isLoading = true; }); try { print('10'); @@ -264,6 +273,7 @@ class _CdPolicieState extends State { ) ], ), + ], ), ); @@ -277,6 +287,19 @@ 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 Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -325,7 +348,7 @@ class _CdPolicieState extends State { const SizedBox(height: 6), // Table body rows - ...filteredData.mapIndexed((index, item) { + ..._paginatedData.mapIndexed((index, item) { return Container( margin: const EdgeInsets.only(bottom: 8), padding: const EdgeInsets.symmetric(vertical: 5, horizontal: 16), @@ -390,6 +413,82 @@ class _CdPolicieState extends State { ), ); }).toList(), + + Row( + mainAxisAlignment: MainAxisAlignment.end, + 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; + }); + }, + ), + IconButton( + onPressed: _currentPage > 1 + ? () { + setState(() { + _currentPage--; + }); + } + : 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, + ), + 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/preEnrollment.dart b/lib/service/hrDashboardTabs/preEnrollment.dart index 136052b..4a0d8c9 100644 --- a/lib/service/hrDashboardTabs/preEnrollment.dart +++ b/lib/service/hrDashboardTabs/preEnrollment.dart @@ -215,7 +215,7 @@ class _PreEnrollmentState extends State { builder: (context) => hrPolicyDetails( ClientId: policy['client_id'].toString(), // <-- from map ClientPoliyId: policy['client_policy_id'].toString(), - HrId: widget.enrollmentClientBranchId, + clientBranchId: widget.enrollmentClientBranchId, Token: widget.enrollToken, TokenType: "pre", cardType: policy['type'].toString(), diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift index ff40429..2ce5852 100755 --- a/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -5,7 +5,6 @@ import FlutterMacOS import Foundation -import file_picker import firebase_auth import firebase_core import google_sign_in_ios @@ -15,7 +14,6 @@ import smart_auth import url_launcher_macos func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { - FilePickerPlugin.register(with: registry.registrar(forPlugin: "FilePickerPlugin")) FLTFirebaseAuthPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseAuthPlugin")) FLTFirebaseCorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseCorePlugin")) FLTGoogleSignInPlugin.register(with: registry.registrar(forPlugin: "FLTGoogleSignInPlugin"))