From cd0318232ac4c547675d86556a1c40f859bec16b Mon Sep 17 00:00:00 2001 From: venbaittech Date: Wed, 11 Dec 2024 09:55:09 +0530 Subject: [PATCH] disclaimer change added --- android/app/build.gradle | 4 +- lib/models/environment.dart | 7 +- lib/pages/enrollment/addons.dart | 231 ++--- lib/pages/enrollment/empReview.dart | 837 ++++++++++--------- lib/pages/postEnrollment/data.dart | 2 +- lib/pages/postEnrollment/help.dart | 286 +++++-- lib/pages/postEnrollment/home.dart | 1 + lib/pages/postEnrollment/planclaimsform.dart | 13 +- lib/pages/verify.dart | 2 + pubspec.yaml | 2 +- 10 files changed, 787 insertions(+), 598 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 5be799e..0b893f7 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -15,12 +15,12 @@ if (localPropertiesFile.exists()) { def flutterVersionCode = localProperties.getProperty('flutter.versionCode') if (flutterVersionCode == null) { - flutterVersionCode = '1' + flutterVersionCode = '3' } def flutterVersionName = localProperties.getProperty('flutter.versionName') if (flutterVersionName == null) { - flutterVersionName = '1.0' + flutterVersionName = '1.0.2' } def keystoreProperties = new Properties() diff --git a/lib/models/environment.dart b/lib/models/environment.dart index e58c64e..8a90e5d 100644 --- a/lib/models/environment.dart +++ b/lib/models/environment.dart @@ -33,7 +33,12 @@ class Environment { return dotenv.env['TICKET_API_URL'] ?? 'TICKET_API_URL not found!'; } +//Live static String get ticketToken { - return 'uncp8FvG310bEyYdV9MmStlo7KDRZ65fLWTeXCI2JzwPrNHjBqQhUiAgxsaO'; + return '3YTSia2mRoZ7A4zvBgkqbGPrCd6Ewp8IDOuyjXhVFsl1nxWNcQJ95MeUftKH'; } + //Dev + // static String get ticketToken { + // return 'uncp8FvG310bEyYdV9MmStlo7KDRZ65fLWTeXCI2JzwPrNHjBqQhUiAgxsaO'; + // } } diff --git a/lib/pages/enrollment/addons.dart b/lib/pages/enrollment/addons.dart index aba1029..57548e4 100644 --- a/lib/pages/enrollment/addons.dart +++ b/lib/pages/enrollment/addons.dart @@ -26,6 +26,13 @@ class addOnsDetails extends StatefulWidget { } class _addOnsDetailsState extends State { + List typeOrder = [ + 'GPA', + 'GMC', + 'GMC - Parents', + 'GMC - Topup', + 'GMC - Topup(Parents)' + ]; late ApiService apiService; bool isLoading = true; bool isChecked = false; @@ -67,6 +74,7 @@ class _addOnsDetailsState extends State { dynamic gmcTypeName; dynamic clientName; dynamic clientLogo; + dynamic addon_subheading; dynamic topUpECardDownload; dynamic topUpMappedFamilyFloatersSi; dynamic topUpMappedFamilyFloatersDependent; @@ -159,6 +167,14 @@ class _addOnsDetailsState extends State { super.dispose(); } + void _sortDisclaimerByTypeOrder() { + allDisclaimer.sort((a, b) { + int indexA = typeOrder.indexOf(a['type']); + int indexB = typeOrder.indexOf(b['type']); + return indexA.compareTo(indexB); + }); + } + String formatDate(String inputDate) { // Parse the input date string DateTime dateTime = DateFormat('dd-MM-yyyy').parse(inputDate); @@ -190,6 +206,7 @@ class _addOnsDetailsState extends State { if (prefs.containsKey('clientLogo') && prefs.containsKey('clientName')) { clientLogo = prefs.getString('clientLogo'); clientName = prefs.getString('clientName'); + addon_subheading = prefs.getString('addon_subheading'); } else { getClientLogoAndDetails(); } @@ -249,44 +266,47 @@ class _addOnsDetailsState extends State { gpaPolicies = response['data']; for (var item in gpaPolicies) { // Extract disclaimer value from each object - dynamic disclaimer = item['disclaimer']; + if (item['OpenForEnrollment'] == '1') { + dynamic disclaimer = item['disclaimer']; + if (disclaimer != null && disclaimer.isNotEmpty) { + // Temporary list to hold new entries + List> newEntries = []; - if (disclaimer != null && disclaimer.isNotEmpty) { - // Temporary list to hold new entries - List> newEntries = []; - - if (disclaimer is String) { - // Wrap string in a map with id and checked - newEntries.add({ - 'id': allDisclaimer.length + 1, // Unique ID based on length - 'text': disclaimer, - 'checked': false, - }); - } else if (disclaimer is List) { - // Convert each string in the list to a map with id and checked - newEntries.addAll( - List>.from( - disclaimer.map((text) => { - 'id': allDisclaimer.length + newEntries.length + 1, - 'text': text, - 'checked': false, - }), - ), - ); - } else { - print('Unexpected type for disclaimer'); - } - - // Add new entries to the main list, ensuring no duplicate texts - newEntries.forEach((entry) { - if (!allDisclaimer - .any((item) => item['text'] == entry['text'])) { - allDisclaimer.add(entry); + if (disclaimer is String) { + // Wrap string in a map with id and checked + newEntries.add({ + 'id': allDisclaimer.length + 1, // Unique ID based on length + 'text': disclaimer, + 'checked': false, + 'type': item['type'] + }); + } else if (disclaimer is List) { + // Convert each string in the list to a map with id and checked + newEntries.addAll( + List>.from( + disclaimer.map((text) => { + 'id': allDisclaimer.length + newEntries.length + 1, + 'text': text, + 'checked': false, + 'type': item['type'] + }), + ), + ); + } else { + print('Unexpected type for disclaimer'); } - }); - // Update the state - setState(() {}); + // Add new entries to the main list, ensuring no duplicate texts + newEntries.forEach((entry) { + if (!allDisclaimer + .any((item) => item['text'] == entry['text'])) { + allDisclaimer.add(entry); + } + }); + + // Sort disclaimers after adding + _sortDisclaimerByTypeOrder(); + } } } }); @@ -317,44 +337,46 @@ class _addOnsDetailsState extends State { // setState(() { gmcPolicies = response['data']; for (var item in gmcPolicies) { - // Extract disclaimer value from each object - dynamic disclaimer = item['disclaimer']; + if (item['OpenForEnrollment'] == '1') { + dynamic disclaimer = item['disclaimer']; + if (disclaimer != null && disclaimer.isNotEmpty) { + // Temporary list to hold new entries + List> newEntries = []; - if (disclaimer != null && disclaimer.isNotEmpty) { - // Temporary list to hold new entries - List> newEntries = []; - - if (disclaimer is String) { - // Wrap string in a map with id and checked - newEntries.add({ - 'id': allDisclaimer.length + 1, // Unique ID based on length - 'text': disclaimer, - 'checked': false, - }); - } else if (disclaimer is List) { - // Convert each string in the list to a map with id and checked - newEntries.addAll( - List>.from( - disclaimer.map((text) => { - 'id': allDisclaimer.length + newEntries.length + 1, - 'text': text, - 'checked': false, - }), - ), - ); - } else { - print('Unexpected type for disclaimer'); - } - - // Add new entries to the main list, ensuring no duplicate texts - newEntries.forEach((entry) { - if (!allDisclaimer.any((item) => item['text'] == entry['text'])) { - allDisclaimer.add(entry); + if (disclaimer is String) { + // Wrap string in a map with id and checked + newEntries.add({ + 'id': allDisclaimer.length + 1, // Unique ID based on length + 'text': disclaimer, + 'checked': false, + 'type': item['type'] + }); + } else if (disclaimer is List) { + // Convert each string in the list to a map with id and checked + newEntries.addAll( + List>.from( + disclaimer.map((text) => { + 'id': allDisclaimer.length + newEntries.length + 1, + 'text': text, + 'checked': false, + 'type': item['type'] + }), + ), + ); + } else { + print('Unexpected type for disclaimer'); } - }); - // Update the state - setState(() {}); + // Add new entries to the main list, ensuring no duplicate texts + newEntries.forEach((entry) { + if (!allDisclaimer + .any((item) => item['text'] == entry['text'])) { + allDisclaimer.add(entry); + } + }); + // Sort disclaimers after adding + _sortDisclaimerByTypeOrder(); + } } } // }); @@ -578,44 +600,53 @@ class _addOnsDetailsState extends State { addOnsDependentMappedFamilyFloatersDependent = addOnsDependentPolicies['gmc_dependent_addon'] ['family_floaters_of_dependent_and_si_array']; - }); - String intOpenForEnrollment = - addOnsDependentPolicies['gmc_dependent_addon'] - ['OpenForEnrollment']; - addOnsDependentOpenForEnrollment = int.parse(intOpenForEnrollment); + String intOpenForEnrollment = + addOnsDependentPolicies['gmc_dependent_addon'] + ['OpenForEnrollment']; + addOnsDependentOpenForEnrollment = + int.parse(intOpenForEnrollment); - addOnsdependentValue = - await addOnsDependentPolicies['gmc_dependent_addon'] - ['family_floaters_of_dependent_and_si_value']; + addOnsdependentValue = + addOnsDependentPolicies['gmc_dependent_addon'] + ['family_floaters_of_dependent_and_si_value']; - addOnsSelectedDependent = await addOnsdependentValue != 0 - ? addOnsdependentValue.toString() - : null; - if (addOnsSelectedDependent != null) { - setState(() { + final checkValue = addOnsdependentValue + + addOnsDependentPolicies['gmc_dependent_addon'] + ['family_floaters_of_dependent_and_si_premium_value']; + print('checkValue $checkValue'); + if (checkValue == 0) { + addOnsSelectedDependent = null; + _addOnsDependentSwitcher = false; + } else { + addOnsSelectedDependent = addOnsdependentValue.toString(); + } + // addOnsSelectedDependent = await addOnsdependentValue != 0 + // ? addOnsdependentValue.toString() + // : null; + if (addOnsSelectedDependent != null) { _addOnsDependentSwitcher = true; - addOnDependentPremiumValue = (addOnsDependentPolicies[ - 'gmc_dependent_addon'][ - 'family_floaters_of_dependent_and_si_premium_value'] - as double) - .toInt(); - ; + } + addOnDependentPremiumValue = (addOnsDependentPolicies[ + 'gmc_dependent_addon'] + ['family_floaters_of_dependent_and_si_premium_value'] + as double) + .toInt(); + ; - addOnsDependentPremiumGst = - (addOnsDependentPolicies['gmc_dependent_addon'] - ['family_floaters_of_dependent_and_gst_value'] - as double) - .toInt(); + addOnsDependentPremiumGst = + (addOnsDependentPolicies['gmc_dependent_addon'] + ['family_floaters_of_dependent_and_gst_value'] + as double) + .toInt(); - addOnsDependentTotalAmt = - addOnDependentPremiumValue + addOnsDependentPremiumGst; - }); + addOnsDependentTotalAmt = + addOnDependentPremiumValue + addOnsDependentPremiumGst; addOnsDependentECardDownload = addOnsDependentPolicies['gmc_dependent_addon'] ['eCardDownload']; - } + }); } else { print('No data found in the response'); } @@ -1768,7 +1799,7 @@ class _addOnsDetailsState extends State { CrossAxisAlignment.start, children: [ Text( - 'Add Ons', + 'Add-On Coverage', textAlign: TextAlign.left, style: GoogleFonts.poppins( fontSize: @@ -1781,7 +1812,7 @@ class _addOnsDetailsState extends State { color: Color(0xFF181818)), ), Text( - 'Medical coverage for your parents or in-laws by paying an additional premium', + addon_subheading ?? '', textAlign: TextAlign.left, style: GoogleFonts.poppins( fontSize: diff --git a/lib/pages/enrollment/empReview.dart b/lib/pages/enrollment/empReview.dart index e342f9e..74da7dc 100644 --- a/lib/pages/enrollment/empReview.dart +++ b/lib/pages/enrollment/empReview.dart @@ -25,6 +25,13 @@ class empReviewDetails extends StatefulWidget { } class _empReviewDetailsState extends State { + List typeOrder = [ + 'GPA', + 'GMC', + 'GMC - Parents', + 'GMC - Topup', + 'GMC - Topup(Parents)' + ]; late ApiService apiService; bool isLoading = true; bool isChecked = false; // Declare the _isSwitched variable here @@ -201,6 +208,7 @@ class _empReviewDetailsState extends State { getGpaEmpPolicyDetails(empPrimaryId); getGmcEmpPolicyDetails(empPrimaryId); primarySummary(); + _sortDisclaimerByTypeOrder(); } else { // Token is empty or null, handle accordingly (e.g., navigate to login screen) ToastHelper.showErrorToast(context, 'Session Out'); @@ -284,6 +292,14 @@ class _empReviewDetailsState extends State { print('Sum of Total Amounts: $totalPayableAmt'); } + void _sortDisclaimerByTypeOrder() { + allDisclaimer.sort((a, b) { + int indexA = typeOrder.indexOf(a['type']); + int indexB = typeOrder.indexOf(b['type']); + return indexA.compareTo(indexB); + }); + } + Future getClientLogoAndDetails() async { try { if (client_id == null || @@ -331,44 +347,47 @@ class _empReviewDetailsState extends State { print('gpaPolicies'); for (var item in gpaPolicies) { // Extract disclaimer value from each object - dynamic disclaimer = item['disclaimer']; + if (item['OpenForEnrollment'] == '1') { + dynamic disclaimer = item['disclaimer']; + if (disclaimer != null && disclaimer.isNotEmpty) { + // Temporary list to hold new entries + List> newEntries = []; - if (disclaimer != null && disclaimer.isNotEmpty) { - // Temporary list to hold new entries - List> newEntries = []; - - if (disclaimer is String) { - // Wrap string in a map with id and checked - newEntries.add({ - 'id': allDisclaimer.length + 1, // Unique ID based on length - 'text': disclaimer, - 'checked': false, - }); - } else if (disclaimer is List) { - // Convert each string in the list to a map with id and checked - newEntries.addAll( - List>.from( - disclaimer.map((text) => { - 'id': allDisclaimer.length + newEntries.length + 1, - 'text': text, - 'checked': false, - }), - ), - ); - } else { - print('Unexpected type for disclaimer'); - } - - // Add new entries to the main list, ensuring no duplicate texts - newEntries.forEach((entry) { - if (!allDisclaimer - .any((item) => item['text'] == entry['text'])) { - allDisclaimer.add(entry); + if (disclaimer is String) { + // Wrap string in a map with id and checked + newEntries.add({ + 'id': allDisclaimer.length + 1, // Unique ID based on length + 'text': disclaimer, + 'checked': false, + 'type': item['type'] + }); + } else if (disclaimer is List) { + // Convert each string in the list to a map with id and checked + newEntries.addAll( + List>.from( + disclaimer.map((text) => { + 'id': allDisclaimer.length + newEntries.length + 1, + 'text': text, + 'checked': false, + 'type': item['type'] + }), + ), + ); + } else { + print('Unexpected type for disclaimer'); } - }); - // Update the state - setState(() {}); + // Add new entries to the main list, ensuring no duplicate texts + newEntries.forEach((entry) { + if (!allDisclaimer + .any((item) => item['text'] == entry['text'])) { + allDisclaimer.add(entry); + } + }); + + // Sort disclaimers after adding + _sortDisclaimerByTypeOrder(); + } } } }); @@ -400,45 +419,46 @@ class _empReviewDetailsState extends State { gmcPolicies = response['data']; print('gmcPolicies'); for (var item in gmcPolicies) { - // Extract disclaimer value from each object - dynamic disclaimer = item['disclaimer']; + if (item['OpenForEnrollment'] == '1') { + dynamic disclaimer = item['disclaimer']; + if (disclaimer != null && disclaimer.isNotEmpty) { + // Temporary list to hold new entries + List> newEntries = []; - if (disclaimer != null && disclaimer.isNotEmpty) { - // Temporary list to hold new entries - List> newEntries = []; - - if (disclaimer is String) { - // Wrap string in a map with id and checked - newEntries.add({ - 'id': allDisclaimer.length + 1, // Unique ID based on length - 'text': disclaimer, - 'checked': false, - }); - } else if (disclaimer is List) { - // Convert each string in the list to a map with id and checked - newEntries.addAll( - List>.from( - disclaimer.map((text) => { - 'id': allDisclaimer.length + newEntries.length + 1, - 'text': text, - 'checked': false, - }), - ), - ); - } else { - print('Unexpected type for disclaimer'); - } - - // Add new entries to the main list, ensuring no duplicate texts - newEntries.forEach((entry) { - if (!allDisclaimer - .any((item) => item['text'] == entry['text'])) { - allDisclaimer.add(entry); + if (disclaimer is String) { + // Wrap string in a map with id and checked + newEntries.add({ + 'id': allDisclaimer.length + 1, // Unique ID based on length + 'text': disclaimer, + 'checked': false, + 'type': item['type'] + }); + } else if (disclaimer is List) { + // Convert each string in the list to a map with id and checked + newEntries.addAll( + List>.from( + disclaimer.map((text) => { + 'id': allDisclaimer.length + newEntries.length + 1, + 'text': text, + 'checked': false, + 'type': item['type'] + }), + ), + ); + } else { + print('Unexpected type for disclaimer'); } - }); - // Update the state - setState(() {}); + // Add new entries to the main list, ensuring no duplicate texts + newEntries.forEach((entry) { + if (!allDisclaimer + .any((item) => item['text'] == entry['text'])) { + allDisclaimer.add(entry); + } + }); + // Sort disclaimers after adding + _sortDisclaimerByTypeOrder(); + } } } }); @@ -509,43 +529,48 @@ class _empReviewDetailsState extends State { topUpDisclaimer = await topUpSiPolicies['gmc_si_topup']['disclaimer']; - if (topUpDisclaimer != null && topUpDisclaimer.isNotEmpty) { - // Temporary list to hold new entries - List> newEntries = []; + if (topUpOpenForEnrollment == '1' && activeSiData == 1) { + if (topUpDisclaimer != null && topUpDisclaimer.isNotEmpty) { + // Temporary list to hold new entries + List> newEntries = []; - if (topUpDisclaimer is String) { - // Wrap string in a map with id and checked - newEntries.add({ - 'id': allDisclaimer.length + 1, // Unique ID based on length - 'text': topUpDisclaimer, - 'checked': false, - }); - } else if (topUpDisclaimer is List) { - // Convert each string in the list to a map with id and checked - newEntries.addAll( - List>.from( - topUpDisclaimer.map((text) => { - 'id': allDisclaimer.length + newEntries.length + 1, - 'text': text, - 'checked': false, - }), - ), - ); - } else { - print('Unexpected type for disclaimer'); - } - - // Add new entries to the main list, ensuring no duplicate texts - newEntries.forEach((entry) { - if (!allDisclaimer - .any((item) => item['text'] == entry['text'])) { - allDisclaimer.add(entry); + if (topUpDisclaimer is String) { + // Wrap string in a map with id and checked + newEntries.add({ + 'id': allDisclaimer.length + 1, // Unique ID based on length + 'text': topUpDisclaimer, + 'checked': false, + 'type': topUpTypeName + }); + } else if (topUpDisclaimer is List) { + // Convert each string in the list to a map with id and checked + newEntries.addAll( + List>.from( + topUpDisclaimer.map((text) => { + 'id': allDisclaimer.length + newEntries.length + 1, + 'text': text, + 'checked': false, + 'type': topUpTypeName + }), + ), + ); + } else { + print('Unexpected type for disclaimer'); } - }); - // Update the state - setState(() {}); + // Add new entries to the main list, ensuring no duplicate texts + newEntries.forEach((entry) { + if (!allDisclaimer + .any((item) => item['text'] == entry['text'])) { + allDisclaimer.add(entry); + } + }); + + // Sort disclaimers after adding + _sortDisclaimerByTypeOrder(); + } } + // allDisclaimer = allDisclaimer.toSet().toList(); // }); } else { @@ -645,43 +670,48 @@ class _empReviewDetailsState extends State { await topUpSiParentPolicies['gmc_si_parent_topup'] ['disclaimer']; - if (topUpParentDisclaimer != null && - topUpParentDisclaimer.isNotEmpty) { - // Temporary list to hold new entries - List> newEntries = []; + if (topUpParentOpenForEnrollment == '1' && + activeSiParentData == 1) { + if (topUpParentDisclaimer != null && + topUpParentDisclaimer.isNotEmpty) { + // Temporary list to hold new entries + List> newEntries = []; - if (topUpParentDisclaimer is String) { - // Wrap string in a map with id and checked - newEntries.add({ - 'id': allDisclaimer.length + 1, // Unique ID based on length - 'text': topUpParentDisclaimer, - 'checked': false, - }); - } else if (topUpParentDisclaimer is List) { - // Convert each string in the list to a map with id and checked - newEntries.addAll( - List>.from( - topUpParentDisclaimer.map((text) => { - 'id': allDisclaimer.length + newEntries.length + 1, - 'text': text, - 'checked': false, - }), - ), - ); - } else { - print('Unexpected type for disclaimer'); - } - - // Add new entries to the main list, ensuring no duplicate texts - newEntries.forEach((entry) { - if (!allDisclaimer - .any((item) => item['text'] == entry['text'])) { - allDisclaimer.add(entry); + if (topUpParentDisclaimer is String) { + // Wrap string in a map with id and checked + newEntries.add({ + 'id': allDisclaimer.length + 1, // Unique ID based on length + 'text': topUpParentDisclaimer, + 'checked': false, + 'type': topUpParentTypeName + }); + } else if (topUpParentDisclaimer is List) { + // Convert each string in the list to a map with id and checked + newEntries.addAll( + List>.from( + topUpParentDisclaimer.map((text) => { + 'id': allDisclaimer.length + newEntries.length + 1, + 'text': text, + 'checked': false, + 'type': topUpParentTypeName + }), + ), + ); + } else { + print('Unexpected type for disclaimer'); } - }); - // Update the state - setState(() {}); + // Add new entries to the main list, ensuring no duplicate texts + newEntries.forEach((entry) { + if (!allDisclaimer + .any((item) => item['text'] == entry['text'])) { + allDisclaimer.add(entry); + } + }); + + // Sort disclaimers after adding + _sortDisclaimerByTypeOrder(); + } } } else { print('No data found in the response'); @@ -725,12 +755,22 @@ class _empReviewDetailsState extends State { ['family_floaters_of_dependent_and_si_value']; print(addOnsDependentSumInsured); - if (addOnsDependentSumInsured == 0) { + final checkValue = addOnsDependentSumInsured + + addOnsDependentPolicies['gmc_dependent_addon'] + ['family_floaters_of_dependent_and_si_premium_value']; + print('checkValue $checkValue'); + if (checkValue == 0) { showHideAddOnsCard = 0; } else { showHideAddOnsCard = 1; } + // if (addOnsDependentSumInsured == 0) { + // showHideAddOnsCard = 0; + // } else { + // showHideAddOnsCard = 1; + // } + addOnsDependentPolicyName = addOnsDependentPolicies['gmc_dependent_addon']['policy_name']; print(addOnsDependentPolicyName); @@ -756,48 +796,53 @@ class _empReviewDetailsState extends State { await addOnsDependentPolicies['gmc_dependent_addon'] ['disclaimer']; - if (addOnsDependentDisclaimer != null && - addOnsDependentDisclaimer.isNotEmpty) { - // Temporary list to hold new entries - List> newEntries = []; - - if (addOnsDependentDisclaimer is String) { - // Wrap string in a map with id and checked - newEntries.add({ - 'id': allDisclaimer.length + 1, // Unique ID based on length - 'text': addOnsDependentDisclaimer, - 'checked': false, - }); - } else if (addOnsDependentDisclaimer is List) { - // Convert each string in the list to a map with id and checked - newEntries.addAll( - List>.from( - addOnsDependentDisclaimer.map((text) => { - 'id': allDisclaimer.length + newEntries.length + 1, - 'text': text, - 'checked': false, - }), - ), - ); - } else { - print('Unexpected type for disclaimer'); - } - - // Add new entries to the main list, ensuring no duplicate texts - newEntries.forEach((entry) { - if (!allDisclaimer - .any((item) => item['text'] == entry['text'])) { - allDisclaimer.add(entry); - } - }); - - // Update the state - setState(() {}); - } - addOnsDependentOpenForEnrollment = await addOnsDependentPolicies['gmc_dependent_addon'] ['OpenForEnrollment']; + + if (addOnsDependentOpenForEnrollment == '1' && + activeDependentData == 1) { + if (addOnsDependentDisclaimer != null && + addOnsDependentDisclaimer.isNotEmpty) { + // Temporary list to hold new entries + List> newEntries = []; + + if (addOnsDependentDisclaimer is String) { + // Wrap string in a map with id and checked + newEntries.add({ + 'id': allDisclaimer.length + 1, // Unique ID based on length + 'text': addOnsDependentDisclaimer, + 'checked': false, + 'type': addOnsDependentPolicyType + }); + } else if (addOnsDependentDisclaimer is List) { + // Convert each string in the list to a map with id and checked + newEntries.addAll( + List>.from( + addOnsDependentDisclaimer.map((text) => { + 'id': allDisclaimer.length + newEntries.length + 1, + 'text': text, + 'checked': false, + 'type': addOnsDependentPolicyType + }), + ), + ); + } else { + print('Unexpected type for disclaimer'); + } + + // Add new entries to the main list, ensuring no duplicate texts + newEntries.forEach((entry) { + if (!allDisclaimer + .any((item) => item['text'] == entry['text'])) { + allDisclaimer.add(entry); + } + }); + + // Sort disclaimers after adding + _sortDisclaimerByTypeOrder(); + } + } } else { print('No data found in the response'); } @@ -1263,6 +1308,223 @@ class _empReviewDetailsState extends State { ], ), SizedBox(height: 16), + if (showHideAddOnsCard == 1) + Card( + elevation: 0, + color: Colors.white, + child: Padding( + padding: Responsive.isDesktop(context) + ? EdgeInsets.all(30) + : EdgeInsets.all(10), + child: Column( + children: [ + Container( + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + flex: 12, + child: Container( + alignment: Alignment.centerLeft, + child: Column( + mainAxisAlignment: + MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Text( + 'Add Ons', + textAlign: TextAlign.left, + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop( + context) + ? 18 + : 16, + color: Color(0xFF181818), + fontWeight: FontWeight.w600, + ), + ), + ], + ))), + ], + ), + ), + SizedBox(height: 15), + Container( + decoration: BoxDecoration( + color: Color( + 0xFFFFF1DD), // Set background color for the container + borderRadius: BorderRadius.circular( + 5), // Set border radius for the container + ), + padding: Responsive.isDesktop(context) + ? EdgeInsets.only( + top: 15, + bottom: 15, + left: 25, + right: 25) + : EdgeInsets.only( + top: 10, + bottom: 10, + left: 10, + right: 10), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + flex: Responsive.isDesktop(context) + ? 9 + : 7, + child: Container( + alignment: Alignment.centerLeft, + child: Column( + mainAxisAlignment: + MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Text( + '', + textAlign: TextAlign.left, + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop( + context) + ? 18 + : 14, + ), + ), + Row( + children: [ + Text( + Responsive.isDesktop( + context) + ? addOnsDependentPolicyName + : addOnsDependentPolicyType, + textAlign: TextAlign.left, + style: + GoogleFonts.poppins( + fontSize: Responsive + .isDesktop( + context) + ? 20 + : 16, + fontWeight: + FontWeight.w600, + ), + ), + if (addOnsDependentECardDownload != + null) + GestureDetector( + onTap: () async { + _launchURL( + addOnsDependentECardDownload); + }, + child: MouseRegion( + cursor: + SystemMouseCursors + .click, + child: Icon( + Icons.file_download, + color: Color( + 0xFFE26728), + size: 25, + ), + ), + ), + ], + ), + ], + ))), + Expanded( + flex: Responsive.isDesktop(context) + ? 3 + : 5, + child: Container( + alignment: Alignment.centerRight, + child: Column( + mainAxisAlignment: + MainAxisAlignment.end, + crossAxisAlignment: + CrossAxisAlignment.end, + children: [ + Text( + addOnsFloaterTextHeading ?? + '', + textAlign: TextAlign.right, + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop( + context) + ? 18 + : 14, + ), + ), + Text( + '₹ ${addOnsDependentSumInsured != null ? addOnsDependentSumInsured : 'NA'}', + textAlign: TextAlign.right, + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop( + context) + ? 20 + : 16, + fontWeight: FontWeight.w600, + ), + ), + ], + ))), + ], + ), + ), + SizedBox(height: 15), + Container( + padding: Responsive.isDesktop(context) + ? EdgeInsets.only( + top: 0, bottom: 0, left: 15, right: 15) + : EdgeInsets.only( + top: 0, bottom: 0, left: 5, right: 5), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: + addOnsDependentMappedFamilyFloatersArray + .where((item) => + item['is_value_exist'] == true) + .map((item) { + Map data = item['data']; + return Row( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Icon(Icons.arrow_right, + color: Color( + 0xFFE26728)), // Arrow icon + SizedBox( + width: Responsive.isDesktop(context) + ? 10 + : 5), // Space between icon and text + Expanded( + child: Text( + '${data['name']} - ${data['relationship']} - ${data['dob']}', + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) + ? 18 + : 14, + color: Color(0xFF232526), + ), + ), + ), + ], + ); + }).toList(), + ), + ), + ], + ), + )), + SizedBox(height: showHideAddOnsCard == 1 ? 16 : 0), if (showHideTopUpCard == 1) Card( elevation: 0, @@ -1707,224 +1969,7 @@ class _empReviewDetailsState extends State { ], ), )), - SizedBox(height: showHideTopUpCard == 1 ? 16 : 0), - if (showHideAddOnsCard == 1) - Card( - elevation: 0, - color: Colors.white, - child: Padding( - padding: Responsive.isDesktop(context) - ? EdgeInsets.all(30) - : EdgeInsets.all(10), - child: Column( - children: [ - Container( - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - flex: 12, - child: Container( - alignment: Alignment.centerLeft, - child: Column( - mainAxisAlignment: - MainAxisAlignment.start, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Text( - 'Add Ons', - textAlign: TextAlign.left, - style: GoogleFonts.poppins( - fontSize: - Responsive.isDesktop( - context) - ? 18 - : 16, - color: Color(0xFF181818), - fontWeight: FontWeight.w600, - ), - ), - ], - ))), - ], - ), - ), - SizedBox(height: 15), - Container( - decoration: BoxDecoration( - color: Color( - 0xFFFFF1DD), // Set background color for the container - borderRadius: BorderRadius.circular( - 5), // Set border radius for the container - ), - padding: Responsive.isDesktop(context) - ? EdgeInsets.only( - top: 15, - bottom: 15, - left: 25, - right: 25) - : EdgeInsets.only( - top: 10, - bottom: 10, - left: 10, - right: 10), - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - flex: Responsive.isDesktop(context) - ? 9 - : 7, - child: Container( - alignment: Alignment.centerLeft, - child: Column( - mainAxisAlignment: - MainAxisAlignment.start, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Text( - '', - textAlign: TextAlign.left, - style: GoogleFonts.poppins( - fontSize: - Responsive.isDesktop( - context) - ? 18 - : 14, - ), - ), - Row( - children: [ - Text( - Responsive.isDesktop( - context) - ? addOnsDependentPolicyName - : addOnsDependentPolicyType, - textAlign: TextAlign.left, - style: - GoogleFonts.poppins( - fontSize: Responsive - .isDesktop( - context) - ? 20 - : 16, - fontWeight: - FontWeight.w600, - ), - ), - if (addOnsDependentECardDownload != - null) - GestureDetector( - onTap: () async { - _launchURL( - addOnsDependentECardDownload); - }, - child: MouseRegion( - cursor: - SystemMouseCursors - .click, - child: Icon( - Icons.file_download, - color: Color( - 0xFFE26728), - size: 25, - ), - ), - ), - ], - ), - ], - ))), - Expanded( - flex: Responsive.isDesktop(context) - ? 3 - : 5, - child: Container( - alignment: Alignment.centerRight, - child: Column( - mainAxisAlignment: - MainAxisAlignment.end, - crossAxisAlignment: - CrossAxisAlignment.end, - children: [ - Text( - addOnsFloaterTextHeading ?? - '', - textAlign: TextAlign.right, - style: GoogleFonts.poppins( - fontSize: - Responsive.isDesktop( - context) - ? 18 - : 14, - ), - ), - Text( - '₹ ${addOnsDependentSumInsured != null ? addOnsDependentSumInsured : 'NA'}', - textAlign: TextAlign.right, - style: GoogleFonts.poppins( - fontSize: - Responsive.isDesktop( - context) - ? 20 - : 16, - fontWeight: FontWeight.w600, - ), - ), - ], - ))), - ], - ), - ), - SizedBox(height: 15), - Container( - padding: Responsive.isDesktop(context) - ? EdgeInsets.only( - top: 0, bottom: 0, left: 15, right: 15) - : EdgeInsets.only( - top: 0, bottom: 0, left: 5, right: 5), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: - addOnsDependentMappedFamilyFloatersArray - .where((item) => - item['is_value_exist'] == true) - .map((item) { - Map data = item['data']; - return Row( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Icon(Icons.arrow_right, - color: Color( - 0xFFE26728)), // Arrow icon - SizedBox( - width: Responsive.isDesktop(context) - ? 10 - : 5), // Space between icon and text - Expanded( - child: Text( - '${data['name']} - ${data['relationship']} - ${data['dob']}', - style: GoogleFonts.poppins( - fontSize: - Responsive.isDesktop(context) - ? 18 - : 14, - color: Color(0xFF232526), - ), - ), - ), - ], - ); - }).toList(), - ), - ), - ], - ), - )), - SizedBox(height: showHideAddOnsCard == 1 ? 16 : 0), + SizedBox(height: showHideTopUpParentCard == 1 ? 16 : 0), Card( elevation: 0, color: Colors.white, diff --git a/lib/pages/postEnrollment/data.dart b/lib/pages/postEnrollment/data.dart index 1974183..5232d70 100755 --- a/lib/pages/postEnrollment/data.dart +++ b/lib/pages/postEnrollment/data.dart @@ -3,7 +3,7 @@ import 'package:dash_chat_2/dash_chat_2.dart'; // String profileImage = // 'https://e7.pngegg.com/pngimages/811/700/png-clipart-chatbot-internet-bot-business-natural-language-processing-facebook-messenger-business-people-logo-thumbnail.png'; String profileImage = - 'https://dev.venbait.in/nhance/dev/public/assets/images/chatbot.png'; + 'https://app.nhanceindia.in/zenith/public/assets/images/chatbot.png'; // We have all the possibilities for users ChatUser user = ChatUser(id: '0'); diff --git a/lib/pages/postEnrollment/help.dart b/lib/pages/postEnrollment/help.dart index cc5948e..08db05d 100644 --- a/lib/pages/postEnrollment/help.dart +++ b/lib/pages/postEnrollment/help.dart @@ -137,8 +137,12 @@ class _helpState extends State { print('check 1'); final response = await apiService.getTrackClaimsList(empMobileNo!, empCodeString!); - print('check 1'); - if (response['success'] == true) { + print('check 2'); + setState(() { + isLoading = false; + }); + + if (response['success'] == true && response['data'] is List) { setState(() { trackClaimsList = response['data'] .where((item) => item['status_value'] != 'Closed') @@ -152,10 +156,15 @@ class _helpState extends State { reversedClaimsClosedList = List>.from(trackClaimsClosedList); trackClaimsClosedList = reversedClaimsClosedList.reversed.toList(); - isLoading = false; }); - print(trackClaimsList); + } else if (response['success'] == true && + response['data'] == "User Not Found") { + setState(() { + trackClaimsList = []; + trackClaimsClosedList = []; + }); } else { + ToastHelper.showErrorToast(context, 'Something went wrong'); print('API request failed with status: ${response['status']}'); } } @@ -418,94 +427,6 @@ class _helpState extends State { ), ), SizedBox(height: 5), - if (trackClaimsList == null) - Card( - elevation: 0, - shape: RoundedRectangleBorder( - side: BorderSide( - color: Color(0xFFD9D9D9), // Set the border color here - width: 1.0, // Set the border width here - ), - borderRadius: BorderRadius.circular( - 8.0), // Set the border radius here - ), - child: Column(children: [ - Container( - decoration: BoxDecoration( - color: Colors - .white, // Set background color for the container - ), - padding: Responsive.isDesktop(context) - ? EdgeInsets.only( - top: 10, bottom: 10, left: 10, right: 10) - : EdgeInsets.only( - top: 10, bottom: 10, left: 10, right: 10), - child: Row( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Expanded( - flex: 11, - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - SvgPicture.string( - SvgService.getSvg('tickets'), - width: 60, - height: 60, - ), - SizedBox( - width: - 10), // Adjust space between icon and text - Container( - alignment: Alignment.centerLeft, - child: Column( - mainAxisAlignment: - MainAxisAlignment.start, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Text( - 'No service request yet!', - textAlign: TextAlign.left, - style: GoogleFonts.poppins( - fontSize: - Responsive.isDesktop(context) - ? 18 - : 16, - fontWeight: FontWeight.w600, - color: Color(0xFF000000), - ), - ), - Container( - constraints: BoxConstraints( - maxWidth: Responsive.isDesktop( - context) - ? 800 - : 250), // Adjust the maximum width as needed - child: Text( - 'Please raise a service request, if you have any concerns with your policy.', - textAlign: TextAlign.left, - style: GoogleFonts.poppins( - fontSize: - Responsive.isDesktop(context) - ? 14 - : 12, - fontWeight: FontWeight.w400, - color: Color(0xFF777777), - ), - softWrap: - true, // Ensure text automatically wraps - ), - ), - ], - )) - ], - ), - ), - ], - ), - ), - ])), SizedBox(height: 15), Container( decoration: BoxDecoration( @@ -669,6 +590,96 @@ class _helpState extends State { ], ), ), + if (allClaimsActive == 0) + if (trackClaimsList == null || trackClaimsList.isEmpty) + Card( + elevation: 0, + shape: RoundedRectangleBorder( + side: BorderSide( + color: Color(0xFFD9D9D9), // Set the border color here + width: 1.0, // Set the border width here + ), + borderRadius: BorderRadius.circular( + 8.0), // Set the border radius here + ), + child: Column(children: [ + Container( + decoration: BoxDecoration( + color: Colors + .white, // Set background color for the container + ), + padding: Responsive.isDesktop(context) + ? EdgeInsets.only( + top: 10, bottom: 10, left: 10, right: 10) + : EdgeInsets.only( + top: 10, bottom: 10, left: 10, right: 10), + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + flex: 11, + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + SvgPicture.string( + SvgService.getSvg('tickets'), + width: 60, + height: 60, + ), + SizedBox( + width: + 10), // Adjust space between icon and text + Container( + alignment: Alignment.centerLeft, + child: Column( + mainAxisAlignment: + MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Text( + 'No service request yet!', + textAlign: TextAlign.left, + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) + ? 18 + : 16, + fontWeight: FontWeight.w600, + color: Color(0xFF000000), + ), + ), + Container( + constraints: BoxConstraints( + maxWidth: Responsive.isDesktop( + context) + ? 800 + : 250), // Adjust the maximum width as needed + child: Text( + 'Please raise a service request, if you have any concerns with your policy.', + textAlign: TextAlign.left, + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) + ? 14 + : 12, + fontWeight: FontWeight.w400, + color: Color(0xFF777777), + ), + softWrap: + true, // Ensure text automatically wraps + ), + ), + ], + )) + ], + ), + ), + ], + ), + ), + ]), + ), if (trackClaimsList != null) if (allClaimsActive == 0) SingleChildScrollView( @@ -679,6 +690,97 @@ class _helpState extends State { ), ), SizedBox(height: 15), + if (closedTrackActive == 0) + if (trackClaimsClosedList == null || + trackClaimsClosedList.isEmpty) + Card( + elevation: 0, + shape: RoundedRectangleBorder( + side: BorderSide( + color: Color(0xFFD9D9D9), // Set the border color here + width: 1.0, // Set the border width here + ), + borderRadius: BorderRadius.circular( + 8.0), // Set the border radius here + ), + child: Column(children: [ + Container( + decoration: BoxDecoration( + color: Colors + .white, // Set background color for the container + ), + padding: Responsive.isDesktop(context) + ? EdgeInsets.only( + top: 10, bottom: 10, left: 10, right: 10) + : EdgeInsets.only( + top: 10, bottom: 10, left: 10, right: 10), + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + flex: 11, + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + SvgPicture.string( + SvgService.getSvg('tickets'), + width: 60, + height: 60, + ), + SizedBox( + width: + 10), // Adjust space between icon and text + Container( + alignment: Alignment.centerLeft, + child: Column( + mainAxisAlignment: + MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Text( + 'No service request yet!', + textAlign: TextAlign.left, + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) + ? 18 + : 16, + fontWeight: FontWeight.w600, + color: Color(0xFF000000), + ), + ), + Container( + constraints: BoxConstraints( + maxWidth: Responsive.isDesktop( + context) + ? 800 + : 250), // Adjust the maximum width as needed + child: Text( + 'Please raise a service request, if you have any concerns with your policy.', + textAlign: TextAlign.left, + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) + ? 14 + : 12, + fontWeight: FontWeight.w400, + color: Color(0xFF777777), + ), + softWrap: + true, // Ensure text automatically wraps + ), + ), + ], + )) + ], + ), + ), + ], + ), + ), + ]), + ), if (trackClaimsClosedList != null) if (closedTrackActive == 0) SingleChildScrollView( diff --git a/lib/pages/postEnrollment/home.dart b/lib/pages/postEnrollment/home.dart index 8021e51..007ea71 100644 --- a/lib/pages/postEnrollment/home.dart +++ b/lib/pages/postEnrollment/home.dart @@ -114,6 +114,7 @@ class _HomeState extends State { } else { setState(() { policyDataIsEmpty = 0; + isLoadingGif = false; }); print('API request failed with status: ${response['status']}'); } diff --git a/lib/pages/postEnrollment/planclaimsform.dart b/lib/pages/postEnrollment/planclaimsform.dart index 80a1957..129818e 100644 --- a/lib/pages/postEnrollment/planclaimsform.dart +++ b/lib/pages/postEnrollment/planclaimsform.dart @@ -100,20 +100,21 @@ class _planclaimsformState extends State { @override void didChangeDependencies() { + print('didChangeDependencies'); super.didChangeDependencies(); dynamic arguments = ModalRoute.of(context)!.settings.arguments; if (arguments != null && arguments is Map) { argumentsData = arguments; claimsDetails = argumentsData['claimsDetails']; - print(claimsDetails); + print('claimsDetails $claimsDetails'); if (argumentsData.containsKey('fromClaimPage')) { fromClaimsPage = argumentsData['fromClaimPage']; - print(fromClaimsPage); + print('fromClaimsPage $fromClaimsPage'); } if (fromClaimsPage == 0) { claimsDepartmentId = claimsDetails['department_id']; - print(claimsDepartmentId); + print('claimsDepartmentId $claimsDepartmentId'); // employeePolicyList = claimsDetails['EmployeePolicy']; // print('employeePolicyList : $employeePolicyList'); @@ -381,9 +382,11 @@ class _planclaimsformState extends State { setState(() { isLoading = true; }); - print(employeePolicyList[0]['name']); - print('Help $filteredPoliciesList'); + // print('Check One'); + // print(employeePolicyList[0]['name']); + // print('Help $filteredPoliciesList'); try { + print('Check One'); Map formData = { 'opener': 'user', 'department_id': serviceId, diff --git a/lib/pages/verify.dart b/lib/pages/verify.dart index a291f33..bd8a3f8 100644 --- a/lib/pages/verify.dart +++ b/lib/pages/verify.dart @@ -306,6 +306,8 @@ class _MyVerifyState extends State { final SharedPreferences prefs = await SharedPreferences.getInstance(); prefs.setString('clientLogo', clientDetails['client']['client_logo']); prefs.setString('clientName', clientDetails['client']['client_name']); + prefs.setString( + 'addon_subheading', clientDetails['client']['addon_subheading']); setState(() { // dynamic clientDetails = data['data']; // print(clientDetails); diff --git a/pubspec.yaml b/pubspec.yaml index dc3ce2c..fe78e40 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # In Windows, build-name is used as the major, minor, and patch parts # of the product and file versions while build-number is used as the build suffix. -version: 1.0.0+1 +version: 1.0.0+3 environment: sdk: '>=3.3.3 <4.0.0'