diff --git a/assets/claimsData.png b/assets/claimsData.png new file mode 100644 index 0000000..4d0d5ea Binary files /dev/null and b/assets/claimsData.png differ diff --git a/lib/claimshistory.dart b/lib/claimshistory.dart index 135044c..044c510 100644 --- a/lib/claimshistory.dart +++ b/lib/claimshistory.dart @@ -34,6 +34,7 @@ class _ClaimHistoryPopupState extends State { List stepKeys = []; late Map stepMap; int _index = 4; + bool isLoading = false; @override void initState() { @@ -56,7 +57,7 @@ class _ClaimHistoryPopupState extends State { Future getClaimsHistoryDetails() async { setState(() { - // isLoading = true; + isLoading = true; }); try { print('10'); @@ -68,7 +69,7 @@ class _ClaimHistoryPopupState extends State { widget.ticket_id, widget.postToken); if (response['status'] == 'success') { setState(() { - // isLoading = false; + isLoading = false; }); setState(() { getClaimsHistoryList = [ @@ -84,7 +85,7 @@ class _ClaimHistoryPopupState extends State { }); } else { setState(() { - // isLoading = false; + isLoading = false; }); // ToastHelper.showWarningToast( @@ -93,12 +94,12 @@ class _ClaimHistoryPopupState extends State { } } catch (e) { setState(() { - // isLoading = false; + isLoading = false; }); print('Exception occurred: $e'); } finally { setState(() { - // _isLoading = false; + isLoading = false; }); } } @@ -149,7 +150,7 @@ class _ClaimHistoryPopupState extends State { border: Border.all(color: Color(0xFFBCBCBC)), borderRadius: BorderRadius.circular(6), ), - child: Icon( + child: const Icon( Icons.close, size: 25, color: Color(0xFFBCBCBC), @@ -165,7 +166,7 @@ class _ClaimHistoryPopupState extends State { decoration: BoxDecoration( color: Color(0xFFFFFFFF), // White background borderRadius: BorderRadius.circular(12), - boxShadow: [ + boxShadow: const [ BoxShadow( color: Color(0xFFEBEBEB), // Shadow color blurRadius: 14, // How soft the shadow is @@ -290,25 +291,63 @@ class _ClaimHistoryPopupState extends State { // ); // }), // ) - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: List.generate(stepKeys.length, (index) { - String stepTitleKey = stepKeys[index]; - Map stepData = stepMap[stepTitleKey]; - print('stepTitleKey'); - print(stepTitleKey); - print('stepData'); - print(stepData); + 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( + child: getClaimsHistoryList.isNotEmpty + ? Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: List.generate(stepKeys.length, (index) { + String stepTitleKey = stepKeys[index]; + Map stepData = + stepMap[stepTitleKey]; - return _buildStep( - stepNumber: index + 1, - title: _getStepTitleFromApi(stepTitleKey, stepData), - content: _getStepContentFromApi(stepData), - isLast: index == stepKeys.length - 1, - ); - }), - ) + print('stepTitleKey'); + print(stepTitleKey); + print('stepData'); + print(stepData); + + return _buildStep( + stepNumber: index + 1, + title: _getStepTitleFromApi( + stepTitleKey, stepData), + content: _getStepContentFromApi(stepData), + isLast: index == stepKeys.length - 1, + ); + }), + ) + : Container( + height: MediaQuery.of(context).size.height * 0.4, + // color: Colors.red, + child: Center( + child: Column( + children: [ + Image.asset( + 'assets/claimsData.png', // Replace 'default_image.png' with your default image asset path + width: 200, + height: 200, + fit: BoxFit.cover, + ), + Text( + 'No Available Claims', + style: TextStyle( + fontWeight: FontWeight.w500, + fontSize: 15), + ), + ], + )), + ), + ) ], ), ), @@ -354,9 +393,9 @@ class _ClaimHistoryPopupState extends State { // Dotted line below circle (except for last step) if (!isLast) Container( - height: 120, // increase to extend line + height: 70, // increase to extend line width: 2, - // margin: EdgeInsets.only(top: 4, bottom: 4), + margin: EdgeInsets.only(top: 4, bottom: 4), child: CustomPaint( painter: DottedLinePainter(), ), diff --git a/lib/hrDashboard.dart b/lib/hrDashboard.dart index d33d488..9d9b073 100755 --- a/lib/hrDashboard.dart +++ b/lib/hrDashboard.dart @@ -169,14 +169,14 @@ class _hrDashboardState extends State print('allowed_modules'); String? modulesString = prefs.getString('empAllowed_modules'); - String? enrollmodulesString = - prefs.getString('enrollmentAllowed_modules'); - if (modulesString != null || enrollmodulesString != null) { - empAllowed_modules = jsonDecode(modulesString!); - enrollmentAllowed_modules = jsonDecode(enrollmodulesString!); + // String? enrollmodulesString = + // prefs.getString('enrollmentAllowed_modules'); + if (modulesString != null) { + empAllowed_modules = jsonDecode(modulesString); + // enrollmentAllowed_modules = jsonDecode(enrollmodulesString!); print("empAllowed_modules - $empAllowed_modules"); // [2, 3, 4] - print( - "enrollmentAllowed_modules - $enrollmentAllowed_modules"); // [2, 3, 4] + // print( + // "enrollmentAllowed_modules - $enrollmentAllowed_modules"); // [2, 3, 4] if (empAllowed_modules.contains(2)) { print("visibleTabs.length2"); @@ -215,7 +215,7 @@ class _hrDashboardState extends State if (empAllowed_modules.contains(4)) { tabData.add({ 'icon': Icons.receipt_long, - 'label': 'Claims', + 'label': 'Claims', // Label Name Integrated with code (dont change) }); // tabViews.add(ClaimsPolicies( // empClientId: empClientId, @@ -246,9 +246,15 @@ class _hrDashboardState extends State print('111'); if (widget.selectedIndex == 3) { print("Process1"); - _tabController.index = 3; + print("ProcessTAb - $tabData"); + + final claimsIndex = tabData.indexWhere((tab) => tab['label'] == 'Claims'); + print('Claims tab index: $claimsIndex'); + _tabController.index = claimsIndex; + // _tabController.index = 3; setState(() { - selectedIndex = 3; + selectedIndex = claimsIndex; + // selectedIndex = 3; isHrcode = 1; empCodeFromHrPolcy = widget.empCodeFromHrPolicy; }); @@ -610,9 +616,23 @@ class _hrDashboardState extends State ], ), ) - : const Center( - child: Text("No Data Available"), + : Container( + height: MediaQuery.of(context).size.height * 0.6, + // color: Colors.white, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Image.asset( + 'assets/claimsData.png', // Replace 'default_image.png' with your default image asset path + width: 300, + height: 300, + fit: BoxFit.cover, + ), + const Text("No Data Available"), + ], + ), ), + SizedBox(height: 16), // Expanded TabBarView Expanded( @@ -733,6 +753,7 @@ class CustomTab extends StatelessWidget { @override Widget build(BuildContext context) { + print("isSelected - $isSelected"); return Tab( child: Container( // margin: const EdgeInsets.symmetric(horizontal: 6), diff --git a/lib/hrPolicyDetails.dart b/lib/hrPolicyDetails.dart index 495ad02..93af9e8 100755 --- a/lib/hrPolicyDetails.dart +++ b/lib/hrPolicyDetails.dart @@ -61,6 +61,7 @@ class _HrPolicyDetailsState extends State with TickerProviderStateMixin { Uint8List? fileBytes; String empCodeFromHrPolcy = ''; + bool hasAnyEcardLink = false; late String _token; List> getEmpDependenceByClintId = []; List> getCDPolicies = []; @@ -79,6 +80,9 @@ class _HrPolicyDetailsState extends State dynamic clientPolicyId; dynamic clientId; dynamic empRefId; + String? modulesString; + final storeModuleId = 4; + bool hasModule = false; int inceptionType = 0; TextEditingController searchController = TextEditingController(); late ApiService apiService; @@ -99,6 +103,8 @@ class _HrPolicyDetailsState extends State apiService = ApiService(context); // Initialize ApiService here getCDPoliciesDetails(); print("_PreEnrollmentState 1"); + + print('allowed_modules'); } Future getCDPoliciesDetails() async { @@ -109,6 +115,24 @@ class _HrPolicyDetailsState extends State try { print('10'); + final SharedPreferences prefs = await SharedPreferences.getInstance(); + modulesString = prefs.getString('empAllowed_modules'); + // modulesString = "[2,3]"; + + print("empmodulesString - $modulesString"); + + if (modulesString != null && modulesString!.trim().isNotEmpty) { + final List? moduleList = modulesString + ?.replaceAll('[', '') + .replaceAll(']', '') + .split(',') + .map((e) => int.tryParse(e.trim()) ?? -1) // convert to int safely + .where((id) => id != -1) // filter out invalid + .toList(); + + hasModule = moduleList!.contains(storeModuleId); + } + final response = widget.TokenType == "post" ? await apiService.getEmployeeAndDependenceToApi(widget.ClientId, widget.ClientPoliyId, widget.clientBranchId, widget.Token) @@ -397,63 +421,65 @@ class _HrPolicyDetailsState extends State 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, + if (widget.TokenType != "post") + 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, - // 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 ), ), - ); - // 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( + '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, ), @@ -534,6 +560,18 @@ class _HrPolicyDetailsState extends State } Widget _buildCDDataTable(BuildContext context) { + if (_paginatedData.isNotEmpty) { + hasAnyEcardLink = _paginatedData.any( + (item) => item['ecard_download_link'] != null, + ); + + if (widget.TokenType == "post" && hasModule) { + print("paginatTtt - $_paginatedData"); + + print("📥 Any e-card link present: $hasAnyEcardLink"); + } + } + if (filteredData.isEmpty) { return SizedBox( // height: 50, @@ -641,17 +679,18 @@ class _HrPolicyDetailsState extends State ), ), ), - Expanded( - flex: 3, - child: Text( - 'Action', - textAlign: TextAlign.center, - style: GoogleFonts.poppins( - color: Colors.black, - fontWeight: FontWeight.w600, + if (widget.TokenType != "pre" && (hasAnyEcardLink || hasModule)) + Expanded( + flex: 3, + child: Text( + 'Action', + textAlign: TextAlign.center, + style: GoogleFonts.poppins( + color: Colors.black, + fontWeight: FontWeight.w600, + ), ), ), - ), ], ), ), @@ -794,72 +833,77 @@ class _HrPolicyDetailsState extends State ), ), ), - 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, + 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), ), - ), - ), - ), - SizedBox( - width: 10, - ), - GestureDetector( - onTap: () { - setState(() { - print("policytabdata - ${item['emp_code']!}"); - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => hrDashboard( - selectedIndex: 3, - empCodeFromHrPolicy: item['emp_code']!, - isHrcode: 1, + child: Padding( + padding: EdgeInsets.all( + 6), // You can adjust this value + 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, ), ), + 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/service/hrDashboardTabs/activePolicies.dart b/lib/service/hrDashboardTabs/activePolicies.dart index 7a47ccf..da8cd06 100644 --- a/lib/service/hrDashboardTabs/activePolicies.dart +++ b/lib/service/hrDashboardTabs/activePolicies.dart @@ -349,14 +349,18 @@ class _ActivePolicieState extends State { fontSize: 12, ), ), - Text( - "${policy['insurer_short_name']} - ${policy['policy_name']} " ?? - '', - style: const TextStyle( - fontSize: 11, - color: Colors.grey, - ), - ), + policy['insurer_name'] != '' + ? Text( + // "${policy['insurer_short_name']} - ${policy['policy_name']} " ?? + // '', + + policy['insurer_name'] ?? "", + style: const TextStyle( + fontSize: 11, + color: Colors.grey, + ), + ) + : SizedBox.shrink(), ], ), ], diff --git a/lib/service/hrDashboardTabs/preEnrollment.dart b/lib/service/hrDashboardTabs/preEnrollment.dart index 6aef82b..f2e7b3e 100644 --- a/lib/service/hrDashboardTabs/preEnrollment.dart +++ b/lib/service/hrDashboardTabs/preEnrollment.dart @@ -92,10 +92,10 @@ class _PreEnrollmentState extends State { print("hr_id -$hr_id"); print("token -$token"); - isLoading = true; - // setState(() { - // _isLoading = true; - // }); + // isLoading = true; + setState(() { + isLoading = true; + }); try { if (clintBranchId == null || clintID == null) { return; @@ -159,7 +159,7 @@ class _PreEnrollmentState extends State { ), // child: Column( - mainAxisAlignment: MainAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.start, children: [ isLoading ? Container( @@ -203,12 +203,12 @@ class _PreEnrollmentState extends State { : GridView.builder( itemCount: getCardArrays.length, gridDelegate: - SliverGridDelegateWithFixedCrossAxisCount( + const SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 4, crossAxisSpacing: 20, mainAxisSpacing: 20, - // childAspectRatio: 2, - childAspectRatio: aspectRatio, + childAspectRatio: 2.6, + // childAspectRatio: aspectRatio, // childAspectRatio: 2.1, ), itemBuilder: (context, index) { @@ -225,7 +225,7 @@ class _PreEnrollmentState extends State { final mediaQuery = MediaQuery.of(context); final devicePixelRatio = mediaQuery.devicePixelRatio; final logicalWidth = 230 / devicePixelRatio; - final logicalHeight = 115 / devicePixelRatio; + final logicalHeight = 189 / devicePixelRatio; print("logicalWidth - $logicalWidth"); print("logicalHeight - $logicalHeight"); @@ -280,10 +280,10 @@ class _PreEnrollmentState extends State { padding: const EdgeInsets.all(12), child: Column( mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, children: [ Container( - height: MediaQuery.of(context).size.height * 0.07, + height: MediaQuery.of(context).size.height * 0.03, // color: Colors.green.shade100, child: Row( children: [ @@ -298,22 +298,15 @@ class _PreEnrollmentState extends State { fontSize: 12, ), ), - Text( - // "${policy['insurer_short_name']} - ${policy['policy_name']} " ?? - // '', - - policy['insurer_name'] ?? "", - style: const TextStyle( - fontSize: 11, - color: Colors.grey, - ), - ), ], ), ], ), ), // Spacer(), + SizedBox( + height: 5, + ), Container( // color: Colors.pink.shade50, height: MediaQuery.of(context).size.height * 0.09,