From d683b1fe103d0bfd55e439156867e0c267083d60 Mon Sep 17 00:00:00 2001 From: SurendarSuri30 Date: Mon, 21 Jul 2025 16:54:25 +0530 Subject: [PATCH] hr live changes --- lib/customAppBar/customFooter.dart | 2 +- lib/email_verify.dart | 2 +- lib/excel_verification.dart | 6 +- lib/hrLogin.dart | 3 +- lib/hrPolicyDetails.dart | 229 +++++++++++++----- lib/hrVerify.dart | 3 +- lib/main.dart | 2 + .../hrDashboardTabs/activePolicies.dart | 1 + .../hrDashboardTabs/preEnrollment.dart | 1 + 9 files changed, 175 insertions(+), 74 deletions(-) diff --git a/lib/customAppBar/customFooter.dart b/lib/customAppBar/customFooter.dart index db7f7b2..8a56e9d 100755 --- a/lib/customAppBar/customFooter.dart +++ b/lib/customAppBar/customFooter.dart @@ -10,7 +10,7 @@ class CustomFooter extends StatelessWidget { mainAxisSize: MainAxisSize.min, children: [ Text( - 'Copyright@ 2024 Nhance - Jubiliant', + 'Copyright @ ${DateTime.now().year} Nhance', style: TextStyle( fontSize: 14, color: Colors.grey[600], // Text color diff --git a/lib/email_verify.dart b/lib/email_verify.dart index b74a9c2..61353d4 100644 --- a/lib/email_verify.dart +++ b/lib/email_verify.dart @@ -562,7 +562,7 @@ class _MyEmailVerifyState extends State { child: Align( alignment: Responsive .isDesktop(context) - ? Alignment.centerLeft + ? Alignment.center : Alignment .bottomCenter, // Align to the start child: _size.width <= 1100 diff --git a/lib/excel_verification.dart b/lib/excel_verification.dart index 355eb0f..c04799d 100755 --- a/lib/excel_verification.dart +++ b/lib/excel_verification.dart @@ -25,6 +25,7 @@ import 'customAppBar/customFooter.dart'; class excelVerify extends StatefulWidget { final String ClientId; + final String policyTypeId; final String ClientPoliyId; final String clientBranchId; final String Token; @@ -37,6 +38,7 @@ class excelVerify extends StatefulWidget { const excelVerify( {Key? key, required this.ClientId, + required this.policyTypeId, required this.ClientPoliyId, required this.clientBranchId, required this.Token, @@ -765,7 +767,9 @@ class _excelVerifyState extends State { builder: (context) => hrPolicyDetails( ClientId: widget - .ClientId, // <-- from map + .ClientId, + policyTypeId: widget + .policyTypeId, // <-- from map ClientPoliyId: widget.ClientPoliyId, clientBranchId: diff --git a/lib/hrLogin.dart b/lib/hrLogin.dart index 2da9539..3e54ae6 100755 --- a/lib/hrLogin.dart +++ b/lib/hrLogin.dart @@ -482,8 +482,7 @@ class _MyPhoneState extends State { Expanded( flex: 8, child: Align( - alignment: Alignment - .topRight, // Align to the start + alignment: Alignment.center, // Align to the start child: _size.width <= 1100 ? Image.asset( 'assets/Nhance-Logo-Final-mobile.png', diff --git a/lib/hrPolicyDetails.dart b/lib/hrPolicyDetails.dart index a1b67b3..b1e4bc0 100755 --- a/lib/hrPolicyDetails.dart +++ b/lib/hrPolicyDetails.dart @@ -27,6 +27,7 @@ import 'hrDashboard.dart'; class hrPolicyDetails extends StatefulWidget { final String ClientId; + final String policyTypeId; // final String ClientBranchId; final String ClientPoliyId; final String clientBranchId; @@ -41,6 +42,7 @@ class hrPolicyDetails extends StatefulWidget { const hrPolicyDetails( {Key? key, required this.ClientId, + required this.policyTypeId, // required this.ClientBranchId, required this.ClientPoliyId, required this.clientBranchId, @@ -470,6 +472,7 @@ class _HrPolicyDetailsState extends State builder: (context) => excelVerify( ClientId: widget.ClientId, // <-- from map + policyTypeId: widget.policyTypeId, ClientPoliyId: widget.ClientPoliyId, clientBranchId: widget.clientBranchId, @@ -612,6 +615,9 @@ class _HrPolicyDetailsState extends State } } + print('widgetpolicyTypeId'); + print(widget.policyTypeId); + if (filteredData.isEmpty) { return SizedBox( // height: 50, @@ -649,6 +655,7 @@ class _HrPolicyDetailsState extends State ), ), ), + if(widget.policyTypeId != '6' && widget.policyTypeId != '7') Expanded( flex: 2, child: Text( @@ -700,7 +707,7 @@ class _HrPolicyDetailsState extends State ), ), Expanded( - flex: 6, + flex: 5, child: Text( 'Email', style: GoogleFonts.poppins( @@ -746,8 +753,10 @@ class _HrPolicyDetailsState extends State SingleChildScrollView( scrollDirection: Axis.vertical, child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: _paginatedData.mapIndexed((index, item) { return Container( + // margin: const EdgeInsets.only(bottom: 8), padding: const EdgeInsets.symmetric(vertical: 5, horizontal: 16), @@ -788,6 +797,7 @@ class _HrPolicyDetailsState extends State ], ), ), + if(widget.policyTypeId != '6' && widget.policyTypeId != '7') Expanded( flex: 2, child: Text( @@ -839,7 +849,7 @@ class _HrPolicyDetailsState extends State ), ), Expanded( - flex: 6, + flex: 5, child: Text( "${item['email_corporate'] ?? ''}", style: GoogleFonts.poppins( @@ -873,77 +883,162 @@ class _HrPolicyDetailsState extends State ), ), ), - if (widget.TokenType != "pre" && - (hasAnyEcardLink || hasModule)) - Expanded( - flex: 3, - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - 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, - ), - if (widget.TokenType == "post" && hasModule) - GestureDetector( - onTap: () { - setState(() { - print( - "policytabdata - ${item['emp_code']!}"); - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => hrDashboard( - selectedIndex: 3, - empCodeFromHrPolicy: - item['emp_code']!, - isHrcode: 1, + if (widget.TokenType != "pre" && (hasAnyEcardLink || hasModule)) + Expanded( + flex: 3, + child: Builder( + builder: (context) { + final isSelf = item['relationship'] == 'Self'; + final hasEcard = item['ecard_download_link'] != null; + final showEcard = isSelf && hasEcard; + final showClaim = widget.TokenType == "post" && hasModule; + + if (!showEcard && !showClaim) { + return SizedBox(); // No icon to show + } + + return Row( + mainAxisAlignment: showEcard && !showClaim + ? MainAxisAlignment.start // Only eCard, push to right + : MainAxisAlignment.end, // eCard + claim OR only claim + children: [ + if (showEcard) + Padding( + padding: const EdgeInsets.symmetric(horizontal: 4.0), + child: 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), + child: Image.asset( + 'assets/credit_card.png', + fit: BoxFit.contain, ), ), - ); - }); - }, - 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/claim.png', - fit: BoxFit.contain, ), ), ), - ), - ], - ), + + if (showEcard && showClaim) SizedBox(width: 8), + + if (showClaim) + Padding( + padding: const EdgeInsets.symmetric(horizontal: 4.0), + child: GestureDetector( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => hrDashboard( + selectedIndex: 3, + empCodeFromHrPolicy: item['emp_code']!, + isHrcode: 1, + ), + ), + ); + }, + child: Container( + height: 35, + width: 35, + decoration: BoxDecoration( + color: Color(0xFFE6F5F6), + borderRadius: BorderRadius.circular(8), + ), + child: Padding( + padding: EdgeInsets.all(6), + child: Image.asset( + 'assets/claim.png', + fit: BoxFit.contain, + ), + ), + ), + ), + ), + ], + ); + }, ), + ), + + // if (widget.TokenType != "pre" && + // (hasAnyEcardLink || hasModule)) + // Expanded( + // flex: 3, + // child: Row( + // mainAxisAlignment: MainAxisAlignment.center, + // children: [ + // 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, + // ), + // if (widget.TokenType == "post" && hasModule) + // GestureDetector( + // onTap: () { + // setState(() { + // print( + // "policytabdata - ${item['emp_code']!}"); + // Navigator.push( + // context, + // MaterialPageRoute( + // builder: (context) => hrDashboard( + // selectedIndex: 3, + // empCodeFromHrPolicy: + // item['emp_code']!, + // isHrcode: 1, + // ), + // ), + // ); + // }); + // }, + // 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/claim.png', + // fit: BoxFit.contain, + // ), + // ), + // ), + // ), + // ], + // ), + // ), ], ), ); diff --git a/lib/hrVerify.dart b/lib/hrVerify.dart index 4e041df..57efc15 100755 --- a/lib/hrVerify.dart +++ b/lib/hrVerify.dart @@ -577,8 +577,7 @@ class _MyVerifyState extends State { Expanded( flex: 8, child: Align( - alignment: Alignment - .topRight, // Align to the start + alignment: Alignment.center, // Align to the start child: _size.width <= 1100 ? Image.asset( 'assets/Nhance-Logo-Final-mobile.png', diff --git a/lib/main.dart b/lib/main.dart index 60e688a..34fee4b 100755 --- a/lib/main.dart +++ b/lib/main.dart @@ -69,6 +69,7 @@ Future main() async { 'hrHome': (context) => MyHrHome(), 'excelVerify': (context) => const excelVerify( ClientId: '', + policyTypeId: '', ClientPoliyId: '', clientBranchId: '', Token: '', @@ -97,6 +98,7 @@ Future main() async { ), 'hrPolicyDetails': (context) => hrPolicyDetails( ClientId: '', + policyTypeId: '', ClientPoliyId: '', clientBranchId: '', Token: '', diff --git a/lib/service/hrDashboardTabs/activePolicies.dart b/lib/service/hrDashboardTabs/activePolicies.dart index da8cd06..651528a 100644 --- a/lib/service/hrDashboardTabs/activePolicies.dart +++ b/lib/service/hrDashboardTabs/activePolicies.dart @@ -289,6 +289,7 @@ class _ActivePolicieState extends State { MaterialPageRoute( builder: (context) => hrPolicyDetails( ClientId: policy['client_id'].toString(), // <-- from map + policyTypeId: policy['policy_type_id'].toString(), // <-- from map ClientPoliyId: policy['client_policy_id'].toString(), clientBranchId: widget.empClientBranchId, Token: widget.postToken, diff --git a/lib/service/hrDashboardTabs/preEnrollment.dart b/lib/service/hrDashboardTabs/preEnrollment.dart index f2e7b3e..95ee170 100644 --- a/lib/service/hrDashboardTabs/preEnrollment.dart +++ b/lib/service/hrDashboardTabs/preEnrollment.dart @@ -238,6 +238,7 @@ class _PreEnrollmentState extends State { MaterialPageRoute( builder: (context) => hrPolicyDetails( ClientId: policy['client_id'].toString(), // <-- from map + policyTypeId: policy['policy_type_id'].toString(), // <-- from map ClientPoliyId: policy['client_policy_id'].toString(), clientBranchId: widget.enrollmentClientBranchId, Token: widget.enrollToken,