CHANGE_ : gmc
This commit is contained in:
parent
1d3c7ebc18
commit
d30f72acd9
@ -124,7 +124,7 @@ class _empReviewDetailsState extends State<empReviewDetails> {
|
|||||||
dynamic topUpParentTypeName;
|
dynamic topUpParentTypeName;
|
||||||
dynamic topUpParentFloterTextHeading;
|
dynamic topUpParentFloterTextHeading;
|
||||||
dynamic topUpParentDisclaimer;
|
dynamic topUpParentDisclaimer;
|
||||||
int topUpParentOpenForEnrollment = 0;
|
// int topUpParentOpenForEnrollment = 0;
|
||||||
int activeSiData = 0;
|
int activeSiData = 0;
|
||||||
int activeSiParentData = 0;
|
int activeSiParentData = 0;
|
||||||
int activeDependentData = 0;
|
int activeDependentData = 0;
|
||||||
@ -133,6 +133,10 @@ class _empReviewDetailsState extends State<empReviewDetails> {
|
|||||||
dynamic gpaDataIsEmpty = 1;
|
dynamic gpaDataIsEmpty = 1;
|
||||||
dynamic empClientBranchId;
|
dynamic empClientBranchId;
|
||||||
dynamic selfEmpStatus;
|
dynamic selfEmpStatus;
|
||||||
|
dynamic topUpOpenForEnrollment;
|
||||||
|
dynamic topUpParentOpenForEnrollment;
|
||||||
|
dynamic addOnsDependentOpenForEnrollment;
|
||||||
|
bool gmcEnrollmentStatus = false;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@ -390,6 +394,9 @@ class _empReviewDetailsState extends State<empReviewDetails> {
|
|||||||
showHideTopUpCard = 1;
|
showHideTopUpCard = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
topUpOpenForEnrollment =
|
||||||
|
topUpSiPolicies['gmc_si_topup']['OpenForEnrollment'];
|
||||||
|
|
||||||
topUpPolicyName =
|
topUpPolicyName =
|
||||||
await topUpSiPolicies['gmc_si_topup']['policy_name'];
|
await topUpSiPolicies['gmc_si_topup']['policy_name'];
|
||||||
|
|
||||||
@ -477,11 +484,11 @@ class _empReviewDetailsState extends State<empReviewDetails> {
|
|||||||
topUpParentECardDownload =
|
topUpParentECardDownload =
|
||||||
topUpSiParentPolicies['gmc_si_parent_topup']['eCardDownload'];
|
topUpSiParentPolicies['gmc_si_parent_topup']['eCardDownload'];
|
||||||
print(topUpParentECardDownload);
|
print(topUpParentECardDownload);
|
||||||
String intOpenForEnrollment =
|
// String intOpenForEnrollment =
|
||||||
topUpSiParentPolicies['gmc_si_parent_topup']
|
// topUpSiParentPolicies['gmc_si_parent_topup']
|
||||||
['OpenForEnrollment'];
|
// ['OpenForEnrollment'];
|
||||||
topUpParentOpenForEnrollment = int.parse(intOpenForEnrollment);
|
// topUpParentOpenForEnrollment = int.parse(intOpenForEnrollment);
|
||||||
print(topUpParentOpenForEnrollment);
|
// print(topUpParentOpenForEnrollment);
|
||||||
|
|
||||||
topUpParentTypeName =
|
topUpParentTypeName =
|
||||||
topUpSiParentPolicies['gmc_si_parent_topup']['type'];
|
topUpSiParentPolicies['gmc_si_parent_topup']['type'];
|
||||||
@ -500,6 +507,10 @@ class _empReviewDetailsState extends State<empReviewDetails> {
|
|||||||
showHideTopUpParentCard = 1;
|
showHideTopUpParentCard = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
topUpParentOpenForEnrollment =
|
||||||
|
await topUpSiParentPolicies['gmc_si_parent_topup']
|
||||||
|
['OpenForEnrollment'];
|
||||||
|
|
||||||
topUpParentDisclaimer =
|
topUpParentDisclaimer =
|
||||||
await topUpSiParentPolicies['gmc_si_parent_topup']
|
await topUpSiParentPolicies['gmc_si_parent_topup']
|
||||||
['disclaimer'];
|
['disclaimer'];
|
||||||
@ -575,6 +586,10 @@ class _empReviewDetailsState extends State<empReviewDetails> {
|
|||||||
addOnsDependentDisclaimer =
|
addOnsDependentDisclaimer =
|
||||||
await addOnsDependentPolicies['gmc_dependent_addon']
|
await addOnsDependentPolicies['gmc_dependent_addon']
|
||||||
['disclaimer'];
|
['disclaimer'];
|
||||||
|
|
||||||
|
addOnsDependentOpenForEnrollment =
|
||||||
|
await addOnsDependentPolicies['gmc_dependent_addon']
|
||||||
|
['OpenForEnrollment'];
|
||||||
} else {
|
} else {
|
||||||
print('No data found in the response');
|
print('No data found in the response');
|
||||||
}
|
}
|
||||||
@ -780,12 +795,50 @@ class _empReviewDetailsState extends State<empReviewDetails> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool isSubmitEnabled() {
|
bool isSubmitEnabled() {
|
||||||
|
print(
|
||||||
|
'topUpOpenForEnrollment: $topUpOpenForEnrollment (type: ${topUpOpenForEnrollment?.runtimeType})');
|
||||||
|
print(
|
||||||
|
'topUpParentOpenForEnrollment: $topUpParentOpenForEnrollment (type: ${topUpParentOpenForEnrollment?.runtimeType})');
|
||||||
|
print(
|
||||||
|
'addOnsDependentOpenForEnrollment: $addOnsDependentOpenForEnrollment (type: ${addOnsDependentOpenForEnrollment?.runtimeType})');
|
||||||
|
|
||||||
|
// Convert to integers and handle null values by defaulting to 0
|
||||||
|
bool enrollmentConditionsMet =
|
||||||
|
(int.tryParse(topUpOpenForEnrollment ?? '0') != 0) &&
|
||||||
|
(int.tryParse(topUpParentOpenForEnrollment ?? '0') != 0) &&
|
||||||
|
(int.tryParse(addOnsDependentOpenForEnrollment ?? '0') != 0);
|
||||||
|
|
||||||
|
print('enrollmentConditionsMet: $enrollmentConditionsMet');
|
||||||
|
print('gmcEnrollmentStatus: $gmcEnrollmentStatus');
|
||||||
|
|
||||||
return isChecked &&
|
return isChecked &&
|
||||||
|
enrollmentConditionsMet &&
|
||||||
|
gmcEnrollmentStatus &&
|
||||||
(activeSiData == 1 ? topUpSiIsChecked : true) &&
|
(activeSiData == 1 ? topUpSiIsChecked : true) &&
|
||||||
(activeSiParentData == 1 ? topUpParentIsChecked : true) &&
|
(activeSiParentData == 1 ? topUpParentIsChecked : true) &&
|
||||||
(activeDependentData == 1 ? addOnsDependentIsChecked : true);
|
(activeDependentData == 1 ? addOnsDependentIsChecked : true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool isEnrollmentOpen(List<dynamic>? policyList) {
|
||||||
|
// Check if the policy list is null or empty
|
||||||
|
if (policyList == null || policyList.isEmpty) {
|
||||||
|
return false; // Return false if there are no policies
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check each policy in the list
|
||||||
|
for (var policy in policyList) {
|
||||||
|
// Default to "0" if OpenForEnrollment is null
|
||||||
|
String openForEnrollment = policy["OpenForEnrollment"] ?? "0";
|
||||||
|
|
||||||
|
// If any policy's OpenForEnrollment is "0", return false
|
||||||
|
if (openForEnrollment == "0") {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// If none of the policies have OpenForEnrollment as "0", return true
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
if ((gpaMappedFamilyFloaters == [] && gpaMappedFamilyFloaters == null) &&
|
if ((gpaMappedFamilyFloaters == [] && gpaMappedFamilyFloaters == null) &&
|
||||||
@ -2713,7 +2766,7 @@ class _empReviewDetailsState extends State<empReviewDetails> {
|
|||||||
|
|
||||||
List<Widget> generateGmcCards(List<dynamic> data) {
|
List<Widget> generateGmcCards(List<dynamic> data) {
|
||||||
List<Widget> cards = [];
|
List<Widget> cards = [];
|
||||||
|
gmcEnrollmentStatus = isEnrollmentOpen(data);
|
||||||
for (var item in data) {
|
for (var item in data) {
|
||||||
setState(() {
|
setState(() {
|
||||||
gmcPolicyName = item['Policy_Name'];
|
gmcPolicyName = item['Policy_Name'];
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user