summary hide and show
This commit is contained in:
parent
c9030d557e
commit
1ee02c793f
@ -19,12 +19,12 @@ if (project.hasProperty('google-services.json')) {
|
|||||||
|
|
||||||
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
|
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
|
||||||
if (flutterVersionCode == null) {
|
if (flutterVersionCode == null) {
|
||||||
flutterVersionCode = '69'
|
flutterVersionCode = '70'
|
||||||
}
|
}
|
||||||
|
|
||||||
def flutterVersionName = localProperties.getProperty('flutter.versionName')
|
def flutterVersionName = localProperties.getProperty('flutter.versionName')
|
||||||
if (flutterVersionName == null) {
|
if (flutterVersionName == null) {
|
||||||
flutterVersionName = '2.0.30'
|
flutterVersionName = '2.0.31'
|
||||||
}
|
}
|
||||||
|
|
||||||
def keystoreProperties = new Properties()
|
def keystoreProperties = new Properties()
|
||||||
|
|||||||
@ -104,7 +104,8 @@ class _addOnsDetailsState extends State<addOnsDetails> {
|
|||||||
dynamic opdSiPremiumValue;
|
dynamic opdSiPremiumValue;
|
||||||
dynamic opdSiPremiumGst;
|
dynamic opdSiPremiumGst;
|
||||||
dynamic opdSiTotalAmt;
|
dynamic opdSiTotalAmt;
|
||||||
bool opdIsPremiumSummary = false;
|
/// 0 = hide, 1 = full summary, 2 = total only
|
||||||
|
int opdIsPremiumSummary = 0;
|
||||||
dynamic topUpSiParentPolicies = [];
|
dynamic topUpSiParentPolicies = [];
|
||||||
dynamic topUpParentClientPolicyId;
|
dynamic topUpParentClientPolicyId;
|
||||||
dynamic topUpParentSlabRates;
|
dynamic topUpParentSlabRates;
|
||||||
@ -118,7 +119,8 @@ class _addOnsDetailsState extends State<addOnsDetails> {
|
|||||||
dynamic topUpParentSiPremiumValue;
|
dynamic topUpParentSiPremiumValue;
|
||||||
dynamic topUpParentSiPremiumGst;
|
dynamic topUpParentSiPremiumGst;
|
||||||
dynamic topUpParentSiTotalAmt;
|
dynamic topUpParentSiTotalAmt;
|
||||||
bool topUpParentIsPremiumSummary = false;
|
/// 0 = hide, 1 = full summary, 2 = total only
|
||||||
|
int topUpParentIsPremiumSummary = 0;
|
||||||
dynamic topUpParentTypeName;
|
dynamic topUpParentTypeName;
|
||||||
int topUpParentOpenForEnrollment = 0;
|
int topUpParentOpenForEnrollment = 0;
|
||||||
dynamic addOnsDependentPolicies = [];
|
dynamic addOnsDependentPolicies = [];
|
||||||
@ -130,7 +132,8 @@ class _addOnsDetailsState extends State<addOnsDetails> {
|
|||||||
dynamic addOnsDependentPolicyName;
|
dynamic addOnsDependentPolicyName;
|
||||||
dynamic addOnsDependentPolicyType;
|
dynamic addOnsDependentPolicyType;
|
||||||
dynamic addOnsDependentECardDownload;
|
dynamic addOnsDependentECardDownload;
|
||||||
bool addOnsDependentIsPremiumSummary = false;
|
/// 0 = hide, 1 = full summary, 2 = total only
|
||||||
|
int addOnsDependentIsPremiumSummary = 0;
|
||||||
dynamic addOnsDependentRelationShip;
|
dynamic addOnsDependentRelationShip;
|
||||||
int addOnsDependentOpenForEnrollment = 0;
|
int addOnsDependentOpenForEnrollment = 0;
|
||||||
dynamic siValue;
|
dynamic siValue;
|
||||||
@ -142,7 +145,8 @@ class _addOnsDetailsState extends State<addOnsDetails> {
|
|||||||
dynamic addOnsDependentTotalAmt;
|
dynamic addOnsDependentTotalAmt;
|
||||||
// dynamic topUpSiTotalAmt;
|
// dynamic topUpSiTotalAmt;
|
||||||
dynamic topUpSiTotalAmt;
|
dynamic topUpSiTotalAmt;
|
||||||
bool topUpIsPremiumSummary = false;
|
/// 0 = hide, 1 = full summary, 2 = total only
|
||||||
|
int topUpIsPremiumSummary = 0;
|
||||||
late TextEditingController _relationShipController;
|
late TextEditingController _relationShipController;
|
||||||
late TextEditingController _dobController;
|
late TextEditingController _dobController;
|
||||||
late TextEditingController _memberNameController;
|
late TextEditingController _memberNameController;
|
||||||
@ -259,25 +263,107 @@ class _addOnsDetailsState extends State<addOnsDetails> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool isPremiumEnabled(dynamic value) {
|
bool isPremiumEnabled(dynamic value) {
|
||||||
if (value == null) return false;
|
return parsePremiumSummaryMode(value) != 0;
|
||||||
if (value is bool) return value;
|
|
||||||
if (value is num) return value.toInt() != 0;
|
|
||||||
final normalized = value.toString().trim().toLowerCase();
|
|
||||||
if (normalized == 'true' || normalized == 'yes') return true;
|
|
||||||
final intValue = int.tryParse(normalized) ?? 0;
|
|
||||||
return intValue != 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool shouldShowPremiumSummary({
|
/// 0 = hide premium summary, 1 = full summary, 2 = total only
|
||||||
required bool isPremiumSummary,
|
int parsePremiumSummaryMode(dynamic value) {
|
||||||
dynamic premiumValue,
|
if (value == null) return 0;
|
||||||
dynamic gstValue,
|
if (value is bool) return value ? 1 : 0;
|
||||||
dynamic totalValue,
|
if (value is num) return value.toInt();
|
||||||
|
final normalized = value.toString().trim().toLowerCase();
|
||||||
|
if (normalized == 'true' || normalized == 'yes') return 1;
|
||||||
|
if (normalized == 'false' || normalized == 'no') return 0;
|
||||||
|
return int.tryParse(normalized) ?? 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool shouldShowPremiumSummary(int mode) => mode == 1 || mode == 2;
|
||||||
|
|
||||||
|
bool shouldShowFullPremiumBreakdown(int mode) => mode == 1;
|
||||||
|
|
||||||
|
bool _policyListHasFullPremiumBreakdown(dynamic policies) {
|
||||||
|
if (policies is! List) return false;
|
||||||
|
for (final policy in policies) {
|
||||||
|
if (policy is! Map) continue;
|
||||||
|
if (shouldShowFullPremiumBreakdown(
|
||||||
|
parsePremiumSummaryMode(policy['is_premium_summery']))) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// True when any visible premium-summary row needs Additional Premium / GST columns.
|
||||||
|
bool hasAnyFullPremiumBreakdown() {
|
||||||
|
return _policyListHasFullPremiumBreakdown(gpaPolicies) ||
|
||||||
|
_policyListHasFullPremiumBreakdown(gmcPolicies);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _premiumSummaryHeaderCell(
|
||||||
|
BuildContext context,
|
||||||
|
String label, {
|
||||||
|
TextAlign textAlign = TextAlign.start,
|
||||||
}) {
|
}) {
|
||||||
return isPremiumSummary ||
|
return TableCell(
|
||||||
premiumValue != null ||
|
child: Padding(
|
||||||
gstValue != null ||
|
padding: EdgeInsets.all(8.0),
|
||||||
totalValue != null;
|
child: SizedBox(
|
||||||
|
width: double.infinity,
|
||||||
|
child: Text(
|
||||||
|
label,
|
||||||
|
textAlign: textAlign,
|
||||||
|
style: GoogleFonts.poppins(
|
||||||
|
fontSize: Responsive.isDesktop(context) ? 16 : 13,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _premiumSummaryValueCell(
|
||||||
|
BuildContext context,
|
||||||
|
String value, {
|
||||||
|
TextAlign textAlign = TextAlign.start,
|
||||||
|
}) {
|
||||||
|
return TableCell(
|
||||||
|
child: Padding(
|
||||||
|
padding: EdgeInsets.all(8.0),
|
||||||
|
child: SizedBox(
|
||||||
|
width: double.infinity,
|
||||||
|
child: Text(
|
||||||
|
value,
|
||||||
|
textAlign: textAlign,
|
||||||
|
style: GoogleFonts.poppins(
|
||||||
|
fontSize: Responsive.isDesktop(context) ? 14 : 12,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Widget> buildPremiumSummaryRowCells({
|
||||||
|
required BuildContext context,
|
||||||
|
required String policyLabel,
|
||||||
|
required String premiumValue,
|
||||||
|
required String gstValue,
|
||||||
|
required String totalValue,
|
||||||
|
required bool includeBreakdownColumns,
|
||||||
|
required bool showBreakdownValues,
|
||||||
|
}) {
|
||||||
|
final totalAlign =
|
||||||
|
includeBreakdownColumns ? TextAlign.start : TextAlign.end;
|
||||||
|
return [
|
||||||
|
_premiumSummaryValueCell(context, policyLabel),
|
||||||
|
if (includeBreakdownColumns) ...[
|
||||||
|
_premiumSummaryValueCell(
|
||||||
|
context, showBreakdownValues ? premiumValue : ''),
|
||||||
|
_premiumSummaryValueCell(context, showBreakdownValues ? gstValue : ''),
|
||||||
|
],
|
||||||
|
_premiumSummaryValueCell(context, totalValue, textAlign: totalAlign),
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
List<String> _extractUniqueSiValues(dynamic slabRates) {
|
List<String> _extractUniqueSiValues(dynamic slabRates) {
|
||||||
@ -598,7 +684,7 @@ class _addOnsDetailsState extends State<addOnsDetails> {
|
|||||||
topUpSiTotalAmt = topUpSiPremiumValue + topUpSiPremiumGst;
|
topUpSiTotalAmt = topUpSiPremiumValue + topUpSiPremiumGst;
|
||||||
|
|
||||||
setState(() {
|
setState(() {
|
||||||
topUpIsPremiumSummary = isPremiumEnabled(topUpSiPolicies['gmc_si_topup']?['is_premium_summery']);
|
topUpIsPremiumSummary = parsePremiumSummaryMode(topUpSiPolicies['gmc_si_topup']?['is_premium_summery']);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@ -688,7 +774,7 @@ class _addOnsDetailsState extends State<addOnsDetails> {
|
|||||||
opdSiTotalAmt = opdSiPremiumValue + opdSiPremiumGst;
|
opdSiTotalAmt = opdSiPremiumValue + opdSiPremiumGst;
|
||||||
|
|
||||||
setState(() {
|
setState(() {
|
||||||
opdIsPremiumSummary = isPremiumEnabled(opdPolicies['gmc_opd']?['is_premium_summery']);
|
opdIsPremiumSummary = parsePremiumSummaryMode(opdPolicies['gmc_opd']?['is_premium_summery']);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@ -817,7 +903,7 @@ class _addOnsDetailsState extends State<addOnsDetails> {
|
|||||||
topUpParentSiPremiumValue + topUpParentSiPremiumGst;
|
topUpParentSiPremiumValue + topUpParentSiPremiumGst;
|
||||||
|
|
||||||
setState(() {
|
setState(() {
|
||||||
topUpParentIsPremiumSummary = isPremiumEnabled(topUpSiParentPolicies['gmc_si_parent_topup']?['is_premium_summery']);
|
topUpParentIsPremiumSummary = parsePremiumSummaryMode(topUpSiParentPolicies['gmc_si_parent_topup']?['is_premium_summery']);
|
||||||
logDebug(topUpParentECardDownload);
|
logDebug(topUpParentECardDownload);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -938,7 +1024,7 @@ class _addOnsDetailsState extends State<addOnsDetails> {
|
|||||||
['eCardDownload'];
|
['eCardDownload'];
|
||||||
|
|
||||||
setState(() {
|
setState(() {
|
||||||
addOnsDependentIsPremiumSummary = isPremiumEnabled(addOnsDependentPolicies['gmc_dependent_addon']?['is_premium_summery']);
|
addOnsDependentIsPremiumSummary = parsePremiumSummaryMode(addOnsDependentPolicies['gmc_dependent_addon']?['is_premium_summery']);
|
||||||
});
|
});
|
||||||
|
|
||||||
logDebug('addOnsDependentIsPremiumSummery $addOnsDependentIsPremiumSummary');
|
logDebug('addOnsDependentIsPremiumSummery $addOnsDependentIsPremiumSummary');
|
||||||
@ -1488,8 +1574,6 @@ class _addOnsDetailsState extends State<addOnsDetails> {
|
|||||||
print('topUpSiPremiumGst $topUpSiPremiumGst');
|
print('topUpSiPremiumGst $topUpSiPremiumGst');
|
||||||
print('topUpSiTotalAmt $topUpSiTotalAmt');
|
print('topUpSiTotalAmt $topUpSiTotalAmt');
|
||||||
|
|
||||||
topUpIsPremiumSummary = true;
|
|
||||||
|
|
||||||
// topUpSiTotalAmt = (topUpSum as double).toInt();
|
// topUpSiTotalAmt = (topUpSum as double).toInt();
|
||||||
});
|
});
|
||||||
sendAddonsGmcSiToAPI();
|
sendAddonsGmcSiToAPI();
|
||||||
@ -1616,7 +1700,6 @@ class _addOnsDetailsState extends State<addOnsDetails> {
|
|||||||
opdSiPremiumGst = opdGstSum.toInt();
|
opdSiPremiumGst = opdGstSum.toInt();
|
||||||
opdSiTotalAmt = opdSiPremiumValue + opdSiPremiumGst;
|
opdSiTotalAmt = opdSiPremiumValue + opdSiPremiumGst;
|
||||||
print('opdSiPremiumValue $opdSiTotalAmt');
|
print('opdSiPremiumValue $opdSiTotalAmt');
|
||||||
opdIsPremiumSummary = true;
|
|
||||||
});
|
});
|
||||||
sendAddonsGmcOPDToAPI();
|
sendAddonsGmcOPDToAPI();
|
||||||
}
|
}
|
||||||
@ -2813,15 +2896,13 @@ class _addOnsDetailsState extends State<addOnsDetails> {
|
|||||||
if (Responsive.isDesktop(context) &&
|
if (Responsive.isDesktop(context) &&
|
||||||
_addOnsDependentSwitcher &&
|
_addOnsDependentSwitcher &&
|
||||||
shouldShowPremiumSummary(
|
shouldShowPremiumSummary(
|
||||||
isPremiumSummary: addOnsDependentIsPremiumSummary,
|
addOnsDependentIsPremiumSummary))
|
||||||
premiumValue: addOnDependentPremiumValue,
|
|
||||||
gstValue: addOnsDependentPremiumGst,
|
|
||||||
totalValue: addOnsDependentTotalAmt,
|
|
||||||
))
|
|
||||||
Row(
|
Row(
|
||||||
crossAxisAlignment:
|
crossAxisAlignment:
|
||||||
CrossAxisAlignment.start,
|
CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
|
if (shouldShowFullPremiumBreakdown(
|
||||||
|
addOnsDependentIsPremiumSummary)) ...[
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 5,
|
flex: 5,
|
||||||
child: Container(
|
child: Container(
|
||||||
@ -2900,6 +2981,7 @@ class _addOnsDetailsState extends State<addOnsDetails> {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
))),
|
))),
|
||||||
|
],
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 5,
|
flex: 5,
|
||||||
child: Container(
|
child: Container(
|
||||||
@ -2944,16 +3026,14 @@ class _addOnsDetailsState extends State<addOnsDetails> {
|
|||||||
if (!Responsive.isDesktop(context) &&
|
if (!Responsive.isDesktop(context) &&
|
||||||
_addOnsDependentSwitcher == true &&
|
_addOnsDependentSwitcher == true &&
|
||||||
shouldShowPremiumSummary(
|
shouldShowPremiumSummary(
|
||||||
isPremiumSummary: addOnsDependentIsPremiumSummary,
|
addOnsDependentIsPremiumSummary))
|
||||||
premiumValue: addOnDependentPremiumValue,
|
|
||||||
gstValue: addOnsDependentPremiumGst,
|
|
||||||
totalValue: addOnsDependentTotalAmt,
|
|
||||||
))
|
|
||||||
Container(
|
Container(
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment:
|
crossAxisAlignment:
|
||||||
CrossAxisAlignment.start,
|
CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
|
if (shouldShowFullPremiumBreakdown(
|
||||||
|
addOnsDependentIsPremiumSummary)) ...[
|
||||||
Row(
|
Row(
|
||||||
crossAxisAlignment:
|
crossAxisAlignment:
|
||||||
CrossAxisAlignment.start,
|
CrossAxisAlignment.start,
|
||||||
@ -3082,6 +3162,7 @@ class _addOnsDetailsState extends State<addOnsDetails> {
|
|||||||
))),
|
))),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
],
|
||||||
Row(
|
Row(
|
||||||
crossAxisAlignment:
|
crossAxisAlignment:
|
||||||
CrossAxisAlignment.start,
|
CrossAxisAlignment.start,
|
||||||
@ -3466,16 +3547,12 @@ class _addOnsDetailsState extends State<addOnsDetails> {
|
|||||||
SizedBox(height: 20),
|
SizedBox(height: 20),
|
||||||
if (Responsive.isDesktop(context) &&
|
if (Responsive.isDesktop(context) &&
|
||||||
_topUpSiSwitcher == true &&
|
_topUpSiSwitcher == true &&
|
||||||
shouldShowPremiumSummary(
|
shouldShowPremiumSummary(topUpIsPremiumSummary))
|
||||||
isPremiumSummary: topUpIsPremiumSummary,
|
|
||||||
premiumValue: topUpSiPremiumValue,
|
|
||||||
gstValue: topUpSiPremiumGst,
|
|
||||||
totalValue: topUpSiTotalAmt,
|
|
||||||
))
|
|
||||||
Row(
|
Row(
|
||||||
crossAxisAlignment:
|
crossAxisAlignment:
|
||||||
CrossAxisAlignment.start,
|
CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
|
if (shouldShowFullPremiumBreakdown(topUpIsPremiumSummary)) ...[
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 5,
|
flex: 5,
|
||||||
child: Container(
|
child: Container(
|
||||||
@ -3550,6 +3627,7 @@ class _addOnsDetailsState extends State<addOnsDetails> {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
))),
|
))),
|
||||||
|
],
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 5,
|
flex: 5,
|
||||||
child: Container(
|
child: Container(
|
||||||
@ -3591,17 +3669,13 @@ class _addOnsDetailsState extends State<addOnsDetails> {
|
|||||||
),
|
),
|
||||||
if (!Responsive.isDesktop(context) &&
|
if (!Responsive.isDesktop(context) &&
|
||||||
_topUpSiSwitcher == true &&
|
_topUpSiSwitcher == true &&
|
||||||
shouldShowPremiumSummary(
|
shouldShowPremiumSummary(topUpIsPremiumSummary))
|
||||||
isPremiumSummary: topUpIsPremiumSummary,
|
|
||||||
premiumValue: topUpSiPremiumValue,
|
|
||||||
gstValue: topUpSiPremiumGst,
|
|
||||||
totalValue: topUpSiTotalAmt,
|
|
||||||
))
|
|
||||||
Container(
|
Container(
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment:
|
crossAxisAlignment:
|
||||||
CrossAxisAlignment.start,
|
CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
|
if (shouldShowFullPremiumBreakdown(topUpIsPremiumSummary)) ...[
|
||||||
Row(
|
Row(
|
||||||
crossAxisAlignment:
|
crossAxisAlignment:
|
||||||
CrossAxisAlignment.start,
|
CrossAxisAlignment.start,
|
||||||
@ -3730,6 +3804,7 @@ class _addOnsDetailsState extends State<addOnsDetails> {
|
|||||||
))),
|
))),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
],
|
||||||
Row(
|
Row(
|
||||||
crossAxisAlignment:
|
crossAxisAlignment:
|
||||||
CrossAxisAlignment.start,
|
CrossAxisAlignment.start,
|
||||||
@ -4115,16 +4190,12 @@ class _addOnsDetailsState extends State<addOnsDetails> {
|
|||||||
SizedBox(height: 20),
|
SizedBox(height: 20),
|
||||||
if (Responsive.isDesktop(context) &&
|
if (Responsive.isDesktop(context) &&
|
||||||
_opdSwitcher == true &&
|
_opdSwitcher == true &&
|
||||||
shouldShowPremiumSummary(
|
shouldShowPremiumSummary(opdIsPremiumSummary))
|
||||||
isPremiumSummary: opdIsPremiumSummary,
|
|
||||||
premiumValue: opdSiPremiumValue,
|
|
||||||
gstValue: opdSiPremiumGst,
|
|
||||||
totalValue: opdSiTotalAmt,
|
|
||||||
))
|
|
||||||
Row(
|
Row(
|
||||||
crossAxisAlignment:
|
crossAxisAlignment:
|
||||||
CrossAxisAlignment.start,
|
CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
|
if (shouldShowFullPremiumBreakdown(opdIsPremiumSummary)) ...[
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 5,
|
flex: 5,
|
||||||
child: Container(
|
child: Container(
|
||||||
@ -4199,6 +4270,7 @@ class _addOnsDetailsState extends State<addOnsDetails> {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
))),
|
))),
|
||||||
|
],
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 5,
|
flex: 5,
|
||||||
child: Container(
|
child: Container(
|
||||||
@ -4240,17 +4312,13 @@ class _addOnsDetailsState extends State<addOnsDetails> {
|
|||||||
),
|
),
|
||||||
if (!Responsive.isDesktop(context) &&
|
if (!Responsive.isDesktop(context) &&
|
||||||
_opdSwitcher == true &&
|
_opdSwitcher == true &&
|
||||||
shouldShowPremiumSummary(
|
shouldShowPremiumSummary(opdIsPremiumSummary))
|
||||||
isPremiumSummary: opdIsPremiumSummary,
|
|
||||||
premiumValue: opdSiPremiumValue,
|
|
||||||
gstValue: opdSiPremiumGst,
|
|
||||||
totalValue: opdSiTotalAmt,
|
|
||||||
))
|
|
||||||
Container(
|
Container(
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment:
|
crossAxisAlignment:
|
||||||
CrossAxisAlignment.start,
|
CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
|
if (shouldShowFullPremiumBreakdown(opdIsPremiumSummary)) ...[
|
||||||
Row(
|
Row(
|
||||||
crossAxisAlignment:
|
crossAxisAlignment:
|
||||||
CrossAxisAlignment.start,
|
CrossAxisAlignment.start,
|
||||||
@ -4379,6 +4447,7 @@ class _addOnsDetailsState extends State<addOnsDetails> {
|
|||||||
))),
|
))),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
],
|
||||||
Row(
|
Row(
|
||||||
crossAxisAlignment:
|
crossAxisAlignment:
|
||||||
CrossAxisAlignment.start,
|
CrossAxisAlignment.start,
|
||||||
@ -4763,16 +4832,12 @@ class _addOnsDetailsState extends State<addOnsDetails> {
|
|||||||
SizedBox(height: 20),
|
SizedBox(height: 20),
|
||||||
if (Responsive.isDesktop(context) &&
|
if (Responsive.isDesktop(context) &&
|
||||||
_topUpParentSiSwitcher == true &&
|
_topUpParentSiSwitcher == true &&
|
||||||
shouldShowPremiumSummary(
|
shouldShowPremiumSummary(topUpParentIsPremiumSummary))
|
||||||
isPremiumSummary: topUpParentIsPremiumSummary,
|
|
||||||
premiumValue: topUpParentSiPremiumValue,
|
|
||||||
gstValue: topUpParentSiPremiumGst,
|
|
||||||
totalValue: topUpParentSiTotalAmt,
|
|
||||||
))
|
|
||||||
Row(
|
Row(
|
||||||
crossAxisAlignment:
|
crossAxisAlignment:
|
||||||
CrossAxisAlignment.start,
|
CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
|
if (shouldShowFullPremiumBreakdown(topUpParentIsPremiumSummary)) ...[
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 5,
|
flex: 5,
|
||||||
child: Container(
|
child: Container(
|
||||||
@ -4847,6 +4912,7 @@ class _addOnsDetailsState extends State<addOnsDetails> {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
))),
|
))),
|
||||||
|
],
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 5,
|
flex: 5,
|
||||||
child: Container(
|
child: Container(
|
||||||
@ -4888,17 +4954,13 @@ class _addOnsDetailsState extends State<addOnsDetails> {
|
|||||||
),
|
),
|
||||||
if (!Responsive.isDesktop(context) &&
|
if (!Responsive.isDesktop(context) &&
|
||||||
_topUpParentSiSwitcher == true &&
|
_topUpParentSiSwitcher == true &&
|
||||||
shouldShowPremiumSummary(
|
shouldShowPremiumSummary(topUpParentIsPremiumSummary))
|
||||||
isPremiumSummary: topUpParentIsPremiumSummary,
|
|
||||||
premiumValue: topUpParentSiPremiumValue,
|
|
||||||
gstValue: topUpParentSiPremiumGst,
|
|
||||||
totalValue: topUpParentSiTotalAmt,
|
|
||||||
))
|
|
||||||
Container(
|
Container(
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment:
|
crossAxisAlignment:
|
||||||
CrossAxisAlignment.start,
|
CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
|
if (shouldShowFullPremiumBreakdown(topUpParentIsPremiumSummary)) ...[
|
||||||
Row(
|
Row(
|
||||||
crossAxisAlignment:
|
crossAxisAlignment:
|
||||||
CrossAxisAlignment.start,
|
CrossAxisAlignment.start,
|
||||||
@ -5027,6 +5089,7 @@ class _addOnsDetailsState extends State<addOnsDetails> {
|
|||||||
))),
|
))),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
],
|
||||||
Row(
|
Row(
|
||||||
crossAxisAlignment:
|
crossAxisAlignment:
|
||||||
CrossAxisAlignment.start,
|
CrossAxisAlignment.start,
|
||||||
@ -5155,111 +5218,65 @@ class _addOnsDetailsState extends State<addOnsDetails> {
|
|||||||
child: Container(
|
child: Container(
|
||||||
alignment: Alignment
|
alignment: Alignment
|
||||||
.centerLeft, // Adjust padding as needed
|
.centerLeft, // Adjust padding as needed
|
||||||
child: Table(
|
child: Builder(
|
||||||
columnWidths: {
|
builder: (context) {
|
||||||
0: FlexColumnWidth(
|
final bool includeBreakdownColumns =
|
||||||
2), // Adjust column width as needed
|
hasAnyFullPremiumBreakdown();
|
||||||
|
return Table(
|
||||||
|
columnWidths: includeBreakdownColumns
|
||||||
|
? {
|
||||||
|
0: FlexColumnWidth(2),
|
||||||
1: FlexColumnWidth(2),
|
1: FlexColumnWidth(2),
|
||||||
2: FlexColumnWidth(
|
2: FlexColumnWidth(2),
|
||||||
2), // Adjust column width as needed
|
|
||||||
3: FlexColumnWidth(2),
|
3: FlexColumnWidth(2),
|
||||||
|
}
|
||||||
|
: {
|
||||||
|
0: FlexColumnWidth(3),
|
||||||
|
1: FlexColumnWidth(1),
|
||||||
},
|
},
|
||||||
children: [
|
children: [
|
||||||
TableRow(
|
TableRow(
|
||||||
children: [
|
children: [
|
||||||
TableCell(
|
_premiumSummaryHeaderCell(
|
||||||
child: Padding(
|
context, 'Policy'),
|
||||||
padding:
|
if (includeBreakdownColumns) ...[
|
||||||
EdgeInsets.all(8.0),
|
_premiumSummaryHeaderCell(
|
||||||
child: Text(
|
context,
|
||||||
'Policy',
|
'Additional Premium'),
|
||||||
textAlign:
|
_premiumSummaryHeaderCell(
|
||||||
TextAlign.start,
|
context, 'GST'),
|
||||||
style: GoogleFonts.poppins(
|
],
|
||||||
fontSize: Responsive
|
_premiumSummaryHeaderCell(
|
||||||
.isDesktop(
|
context,
|
||||||
context)
|
|
||||||
? 16
|
|
||||||
: 13,
|
|
||||||
fontWeight:
|
|
||||||
FontWeight
|
|
||||||
.bold),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
TableCell(
|
|
||||||
child: Padding(
|
|
||||||
padding:
|
|
||||||
EdgeInsets.all(8.0),
|
|
||||||
child: Text(
|
|
||||||
'Additional Premium',
|
|
||||||
textAlign:
|
|
||||||
TextAlign.start,
|
|
||||||
style: GoogleFonts.poppins(
|
|
||||||
fontSize: Responsive
|
|
||||||
.isDesktop(
|
|
||||||
context)
|
|
||||||
? 16
|
|
||||||
: 13,
|
|
||||||
fontWeight:
|
|
||||||
FontWeight
|
|
||||||
.bold),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
TableCell(
|
|
||||||
child: Padding(
|
|
||||||
padding:
|
|
||||||
EdgeInsets.all(8.0),
|
|
||||||
child: Text(
|
|
||||||
'GST',
|
|
||||||
textAlign:
|
|
||||||
TextAlign.start,
|
|
||||||
style: GoogleFonts.poppins(
|
|
||||||
fontSize: Responsive
|
|
||||||
.isDesktop(
|
|
||||||
context)
|
|
||||||
? 16
|
|
||||||
: 13,
|
|
||||||
fontWeight:
|
|
||||||
FontWeight
|
|
||||||
.bold),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
TableCell(
|
|
||||||
child: Padding(
|
|
||||||
padding:
|
|
||||||
EdgeInsets.all(8.0),
|
|
||||||
child: Text(
|
|
||||||
'Total',
|
'Total',
|
||||||
textAlign:
|
textAlign: includeBreakdownColumns
|
||||||
TextAlign.start,
|
? TextAlign.start
|
||||||
style: GoogleFonts.poppins(
|
: TextAlign.end,
|
||||||
fontSize: Responsive
|
|
||||||
.isDesktop(
|
|
||||||
context)
|
|
||||||
? 16
|
|
||||||
: 13,
|
|
||||||
fontWeight:
|
|
||||||
FontWeight
|
|
||||||
.bold),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
if (gpaPolicies != null &&
|
if (gpaPolicies != null &&
|
||||||
gpaPolicies.length > 0)
|
gpaPolicies.length > 0)
|
||||||
...gpaBuildPolicyRows(
|
...gpaBuildPolicyRows(
|
||||||
gpaPolicies, context),
|
gpaPolicies,
|
||||||
|
context,
|
||||||
|
includeBreakdownColumns:
|
||||||
|
includeBreakdownColumns,
|
||||||
|
),
|
||||||
if (gmcPolicies != null &&
|
if (gmcPolicies != null &&
|
||||||
gmcPolicies.length > 0)
|
gmcPolicies.length > 0)
|
||||||
...gmcBuildPolicyRows(
|
...gmcBuildPolicyRows(
|
||||||
gmcPolicies, context),
|
gmcPolicies,
|
||||||
],
|
context,
|
||||||
|
includeBreakdownColumns:
|
||||||
|
includeBreakdownColumns,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
))
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -6407,6 +6424,13 @@ class _addOnsDetailsState extends State<addOnsDetails> {
|
|||||||
double gmcTotalableValue = gmcGstValue + gmcSiPremiumValue;
|
double gmcTotalableValue = gmcGstValue + gmcSiPremiumValue;
|
||||||
|
|
||||||
bool gmcIsValueValid = (gmcSiPremiumValue > 0 && gmcGstValue > 0);
|
bool gmcIsValueValid = (gmcSiPremiumValue > 0 && gmcGstValue > 0);
|
||||||
|
final int gmcPremiumSummaryMode =
|
||||||
|
parsePremiumSummaryMode(item['is_premium_summery']);
|
||||||
|
// 0 = hide, 1 = full summary, 2 = total only
|
||||||
|
final bool showFullGmcPremiumSummary =
|
||||||
|
gmcPremiumSummaryMode == 1 && gmcIsValueValid;
|
||||||
|
final bool showGmcPremiumTotalOnly =
|
||||||
|
gmcPremiumSummaryMode == 2 && gmcTotalableValue != 0;
|
||||||
|
|
||||||
List gmcMappedFamilyFloaters = item['mapped_family_floaters'] ?? [];
|
List gmcMappedFamilyFloaters = item['mapped_family_floaters'] ?? [];
|
||||||
|
|
||||||
@ -6577,10 +6601,12 @@ class _addOnsDetailsState extends State<addOnsDetails> {
|
|||||||
}).toList(),
|
}).toList(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (Responsive.isDesktop(context) && gmcIsValueValid)
|
if (Responsive.isDesktop(context) &&
|
||||||
|
(showFullGmcPremiumSummary || showGmcPremiumTotalOnly))
|
||||||
Row(
|
Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
|
if (showFullGmcPremiumSummary) ...[
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 5,
|
flex: 5,
|
||||||
child: Container(
|
child: Container(
|
||||||
@ -6633,6 +6659,7 @@ class _addOnsDetailsState extends State<addOnsDetails> {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
))),
|
))),
|
||||||
|
],
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 5,
|
flex: 5,
|
||||||
child: Container(
|
child: Container(
|
||||||
@ -6661,11 +6688,13 @@ class _addOnsDetailsState extends State<addOnsDetails> {
|
|||||||
))),
|
))),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
if (!Responsive.isDesktop(context) && gmcIsValueValid)
|
if (!Responsive.isDesktop(context) &&
|
||||||
|
(showFullGmcPremiumSummary || showGmcPremiumTotalOnly))
|
||||||
Container(
|
Container(
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
|
if (showFullGmcPremiumSummary) ...[
|
||||||
Row(
|
Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
@ -6754,6 +6783,7 @@ class _addOnsDetailsState extends State<addOnsDetails> {
|
|||||||
))),
|
))),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
],
|
||||||
Row(
|
Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
@ -6825,6 +6855,13 @@ class _addOnsDetailsState extends State<addOnsDetails> {
|
|||||||
double gpaTotalableValue = gpaSiPremiumValue + gpaGstValue;
|
double gpaTotalableValue = gpaSiPremiumValue + gpaGstValue;
|
||||||
|
|
||||||
bool isValueValid = gpaSiPremiumValue != 0 && gpaGstValue != 0;
|
bool isValueValid = gpaSiPremiumValue != 0 && gpaGstValue != 0;
|
||||||
|
final int premiumSummaryMode =
|
||||||
|
parsePremiumSummaryMode(item['is_premium_summery']);
|
||||||
|
// 0 = hide, 1 = full summary, 2 = total only
|
||||||
|
final bool showFullPremiumSummary =
|
||||||
|
premiumSummaryMode == 1 && isValueValid;
|
||||||
|
final bool showPremiumTotalOnly =
|
||||||
|
premiumSummaryMode == 2 && gpaTotalableValue != 0;
|
||||||
|
|
||||||
// -------------------------------
|
// -------------------------------
|
||||||
// FIX: mapped_family_floaters is ALREADY a list
|
// FIX: mapped_family_floaters is ALREADY a list
|
||||||
@ -7011,10 +7048,12 @@ class _addOnsDetailsState extends State<addOnsDetails> {
|
|||||||
Column(
|
Column(
|
||||||
children: familyFloaterContainers,
|
children: familyFloaterContainers,
|
||||||
),
|
),
|
||||||
if (Responsive.isDesktop(context) && isValueValid)
|
if (Responsive.isDesktop(context) &&
|
||||||
|
(showFullPremiumSummary || showPremiumTotalOnly))
|
||||||
Row(
|
Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
|
if (showFullPremiumSummary) ...[
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 5,
|
flex: 5,
|
||||||
child: Container(
|
child: Container(
|
||||||
@ -7065,6 +7104,7 @@ class _addOnsDetailsState extends State<addOnsDetails> {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
))),
|
))),
|
||||||
|
],
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 5,
|
flex: 5,
|
||||||
child: Container(
|
child: Container(
|
||||||
@ -7092,11 +7132,13 @@ class _addOnsDetailsState extends State<addOnsDetails> {
|
|||||||
))),
|
))),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
if (!Responsive.isDesktop(context) && isValueValid)
|
if (!Responsive.isDesktop(context) &&
|
||||||
|
(showFullPremiumSummary || showPremiumTotalOnly))
|
||||||
Container(
|
Container(
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
|
if (showFullPremiumSummary) ...[
|
||||||
Row(
|
Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
@ -7181,6 +7223,7 @@ class _addOnsDetailsState extends State<addOnsDetails> {
|
|||||||
))),
|
))),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
],
|
||||||
Row(
|
Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
@ -7237,7 +7280,10 @@ class _addOnsDetailsState extends State<addOnsDetails> {
|
|||||||
|
|
||||||
double calculateGpaTotalAmt(List<Map<String, dynamic>> policies) {
|
double calculateGpaTotalAmt(List<Map<String, dynamic>> policies) {
|
||||||
double total = policies
|
double total = policies
|
||||||
.where((policy) => policy is Map<String, dynamic>)
|
.where((policy) =>
|
||||||
|
policy is Map<String, dynamic> &&
|
||||||
|
shouldShowPremiumSummary(
|
||||||
|
parsePremiumSummaryMode(policy['is_premium_summery'])))
|
||||||
.map((policy) =>
|
.map((policy) =>
|
||||||
(policy["si_gst_value"] ?? 0) + (policy["si_premium_value"] ?? 0))
|
(policy["si_gst_value"] ?? 0) + (policy["si_premium_value"] ?? 0))
|
||||||
.fold(0.0, (sum, value) => sum + value);
|
.fold(0.0, (sum, value) => sum + value);
|
||||||
@ -7246,7 +7292,11 @@ class _addOnsDetailsState extends State<addOnsDetails> {
|
|||||||
return total;
|
return total;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<TableRow> gpaBuildPolicyRows(dynamic policies, BuildContext context) {
|
List<TableRow> gpaBuildPolicyRows(
|
||||||
|
dynamic policies,
|
||||||
|
BuildContext context, {
|
||||||
|
bool includeBreakdownColumns = true,
|
||||||
|
}) {
|
||||||
if (policies is! List) {
|
if (policies is! List) {
|
||||||
return []; // Return empty list if policies is not a list
|
return []; // Return empty list if policies is not a list
|
||||||
}
|
}
|
||||||
@ -7259,59 +7309,36 @@ class _addOnsDetailsState extends State<addOnsDetails> {
|
|||||||
.map((policy) {
|
.map((policy) {
|
||||||
var siGstValue = policy["si_gst_value"] ?? 0;
|
var siGstValue = policy["si_gst_value"] ?? 0;
|
||||||
var siPremiumValue = policy["si_premium_value"] ?? 0;
|
var siPremiumValue = policy["si_premium_value"] ?? 0;
|
||||||
|
final int premiumMode =
|
||||||
|
parsePremiumSummaryMode(policy['is_premium_summery']);
|
||||||
|
final total = (siPremiumValue is num ? siPremiumValue.toDouble() : 0.0) +
|
||||||
|
(siGstValue is num ? siGstValue.toDouble() : 0.0);
|
||||||
|
|
||||||
if (siGstValue == 0 || siPremiumValue == 0)
|
// 0 = hide, 1 = full, 2 = total only
|
||||||
return null; // Skip invalid policies
|
if (premiumMode == 0) return null;
|
||||||
|
if (premiumMode == 1 && (siGstValue == 0 || siPremiumValue == 0)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (premiumMode == 2 && total == 0) return null;
|
||||||
|
|
||||||
|
final bool showBreakdownValues =
|
||||||
|
shouldShowFullPremiumBreakdown(premiumMode);
|
||||||
|
final policyLabel = Responsive.isDesktop(context)
|
||||||
|
? (policy["Policy_Name"] ?? 'Default Policy Name')
|
||||||
|
: policy['type'];
|
||||||
|
final totalValue =
|
||||||
|
'₹${(policy["si_premium_value"] ?? 0) + (policy["si_gst_value"] ?? 0)}/-';
|
||||||
|
|
||||||
return TableRow(
|
return TableRow(
|
||||||
children: [
|
children: buildPremiumSummaryRowCells(
|
||||||
TableCell(
|
context: context,
|
||||||
child: Padding(
|
policyLabel: policyLabel?.toString() ?? '',
|
||||||
padding: EdgeInsets.all(8.0),
|
premiumValue: '₹${policy["si_premium_value"]}/Year',
|
||||||
child: Text(
|
gstValue: '₹${policy["si_gst_value"]}/-',
|
||||||
Responsive.isDesktop(context)
|
totalValue: totalValue,
|
||||||
? (policy["Policy_Name"] ?? 'Default Policy Name')
|
includeBreakdownColumns: includeBreakdownColumns,
|
||||||
: policy['type'],
|
showBreakdownValues: showBreakdownValues,
|
||||||
textAlign: TextAlign.start,
|
|
||||||
style: GoogleFonts.poppins(
|
|
||||||
fontSize: Responsive.isDesktop(context) ? 14 : 12),
|
|
||||||
),
|
),
|
||||||
),
|
|
||||||
),
|
|
||||||
TableCell(
|
|
||||||
child: Padding(
|
|
||||||
padding: EdgeInsets.all(8.0),
|
|
||||||
child: Text(
|
|
||||||
'₹${policy["si_premium_value"]}/Year',
|
|
||||||
textAlign: TextAlign.start,
|
|
||||||
style: GoogleFonts.poppins(
|
|
||||||
fontSize: Responsive.isDesktop(context) ? 14 : 12),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
TableCell(
|
|
||||||
child: Padding(
|
|
||||||
padding: EdgeInsets.all(8.0),
|
|
||||||
child: Text(
|
|
||||||
'₹${policy["si_gst_value"]}/-',
|
|
||||||
textAlign: TextAlign.start,
|
|
||||||
style: GoogleFonts.poppins(
|
|
||||||
fontSize: Responsive.isDesktop(context) ? 14 : 12),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
TableCell(
|
|
||||||
child: Padding(
|
|
||||||
padding: EdgeInsets.all(8.0),
|
|
||||||
child: Text(
|
|
||||||
'₹${(policy["si_premium_value"] ?? 0) + (policy["si_gst_value"] ?? 0)}/-',
|
|
||||||
textAlign: TextAlign.start,
|
|
||||||
style: GoogleFonts.poppins(
|
|
||||||
fontSize: Responsive.isDesktop(context) ? 14 : 12),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
.whereType<TableRow>() // Filter out null values
|
.whereType<TableRow>() // Filter out null values
|
||||||
@ -7320,7 +7347,10 @@ class _addOnsDetailsState extends State<addOnsDetails> {
|
|||||||
|
|
||||||
double calculateGmcTotalAmt(List<Map<String, dynamic>> policies) {
|
double calculateGmcTotalAmt(List<Map<String, dynamic>> policies) {
|
||||||
double total = policies
|
double total = policies
|
||||||
.where((policy) => policy is Map<String, dynamic>)
|
.where((policy) =>
|
||||||
|
policy is Map<String, dynamic> &&
|
||||||
|
shouldShowPremiumSummary(
|
||||||
|
parsePremiumSummaryMode(policy['is_premium_summery'])))
|
||||||
.map((policy) =>
|
.map((policy) =>
|
||||||
(policy["family_floaters_of_dependent_and_gst_value"] ?? 0) +
|
(policy["family_floaters_of_dependent_and_gst_value"] ?? 0) +
|
||||||
(policy["family_floaters_of_dependent_and_si_premium_value"] ?? 0))
|
(policy["family_floaters_of_dependent_and_si_premium_value"] ?? 0))
|
||||||
@ -7330,7 +7360,11 @@ class _addOnsDetailsState extends State<addOnsDetails> {
|
|||||||
return total;
|
return total;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<TableRow> gmcBuildPolicyRows(dynamic policies, BuildContext context) {
|
List<TableRow> gmcBuildPolicyRows(
|
||||||
|
dynamic policies,
|
||||||
|
BuildContext context, {
|
||||||
|
bool includeBreakdownColumns = true,
|
||||||
|
}) {
|
||||||
logDebug('gmcBuildPolicyRows $policies');
|
logDebug('gmcBuildPolicyRows $policies');
|
||||||
|
|
||||||
if (policies is! List) {
|
if (policies is! List) {
|
||||||
@ -7347,59 +7381,38 @@ class _addOnsDetailsState extends State<addOnsDetails> {
|
|||||||
policy["family_floaters_of_dependent_and_gst_value"] ?? 0;
|
policy["family_floaters_of_dependent_and_gst_value"] ?? 0;
|
||||||
var siPremiumValue =
|
var siPremiumValue =
|
||||||
policy["family_floaters_of_dependent_and_si_premium_value"] ?? 0;
|
policy["family_floaters_of_dependent_and_si_premium_value"] ?? 0;
|
||||||
|
final int premiumMode =
|
||||||
|
parsePremiumSummaryMode(policy['is_premium_summery']);
|
||||||
|
final total = (siPremiumValue is num ? siPremiumValue.toDouble() : 0.0) +
|
||||||
|
(siGstValue is num ? siGstValue.toDouble() : 0.0);
|
||||||
|
|
||||||
if (siGstValue == 0 || siPremiumValue == 0)
|
// 0 = hide, 1 = full, 2 = total only
|
||||||
return null; // Skip invalid policies
|
if (premiumMode == 0) return null;
|
||||||
|
if (premiumMode == 1 && (siGstValue == 0 || siPremiumValue == 0)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (premiumMode == 2 && total == 0) return null;
|
||||||
|
|
||||||
|
final bool showBreakdownValues =
|
||||||
|
shouldShowFullPremiumBreakdown(premiumMode);
|
||||||
|
final policyLabel = Responsive.isDesktop(context)
|
||||||
|
? (policy["Policy_Name"] ?? 'Default Policy Name')
|
||||||
|
: policy['type'];
|
||||||
|
final totalValue =
|
||||||
|
'₹${(policy["family_floaters_of_dependent_and_si_premium_value"] ?? 0) + (policy["family_floaters_of_dependent_and_gst_value"] ?? 0)}/-';
|
||||||
|
|
||||||
return TableRow(
|
return TableRow(
|
||||||
children: [
|
children: buildPremiumSummaryRowCells(
|
||||||
TableCell(
|
context: context,
|
||||||
child: Padding(
|
policyLabel: policyLabel?.toString() ?? '',
|
||||||
padding: EdgeInsets.all(8.0),
|
premiumValue:
|
||||||
child: Text(
|
|
||||||
Responsive.isDesktop(context)
|
|
||||||
? (policy["Policy_Name"] ?? 'Default Policy Name')
|
|
||||||
: policy['type'],
|
|
||||||
textAlign: TextAlign.start,
|
|
||||||
style: GoogleFonts.poppins(
|
|
||||||
fontSize: Responsive.isDesktop(context) ? 14 : 12),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
TableCell(
|
|
||||||
child: Padding(
|
|
||||||
padding: EdgeInsets.all(8.0),
|
|
||||||
child: Text(
|
|
||||||
'₹${policy["family_floaters_of_dependent_and_si_premium_value"]}/Year',
|
'₹${policy["family_floaters_of_dependent_and_si_premium_value"]}/Year',
|
||||||
textAlign: TextAlign.start,
|
gstValue:
|
||||||
style: GoogleFonts.poppins(
|
|
||||||
fontSize: Responsive.isDesktop(context) ? 14 : 12),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
TableCell(
|
|
||||||
child: Padding(
|
|
||||||
padding: EdgeInsets.all(8.0),
|
|
||||||
child: Text(
|
|
||||||
'₹${policy["family_floaters_of_dependent_and_gst_value"]}/-',
|
'₹${policy["family_floaters_of_dependent_and_gst_value"]}/-',
|
||||||
textAlign: TextAlign.start,
|
totalValue: totalValue,
|
||||||
style: GoogleFonts.poppins(
|
includeBreakdownColumns: includeBreakdownColumns,
|
||||||
fontSize: Responsive.isDesktop(context) ? 14 : 12),
|
showBreakdownValues: showBreakdownValues,
|
||||||
),
|
),
|
||||||
),
|
|
||||||
),
|
|
||||||
TableCell(
|
|
||||||
child: Padding(
|
|
||||||
padding: EdgeInsets.all(8.0),
|
|
||||||
child: Text(
|
|
||||||
'₹${(policy["family_floaters_of_dependent_and_si_premium_value"] ?? 0) + (policy["family_floaters_of_dependent_and_gst_value"] ?? 0)}/-',
|
|
||||||
textAlign: TextAlign.start,
|
|
||||||
style: GoogleFonts.poppins(
|
|
||||||
fontSize: Responsive.isDesktop(context) ? 14 : 12),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
.whereType<TableRow>() // Filter out null values
|
.whereType<TableRow>() // Filter out null values
|
||||||
|
|||||||
@ -1930,6 +1930,13 @@ class _empDetailsState extends State<empDetails> {
|
|||||||
double gpaTotalableValue = gpaSiPremiumValue + gpaGstValue;
|
double gpaTotalableValue = gpaSiPremiumValue + gpaGstValue;
|
||||||
|
|
||||||
bool isValueValid = gpaSiPremiumValue != 0 && gpaGstValue != 0;
|
bool isValueValid = gpaSiPremiumValue != 0 && gpaGstValue != 0;
|
||||||
|
final int premiumSummaryMode =
|
||||||
|
parsePremiumSummaryMode(item['is_premium_summery']);
|
||||||
|
// 0 = hide, 1 = full summary, 2 = total only
|
||||||
|
final bool showFullPremiumSummary =
|
||||||
|
premiumSummaryMode == 1 && isValueValid;
|
||||||
|
final bool showPremiumTotalOnly =
|
||||||
|
premiumSummaryMode == 2 && gpaTotalableValue != 0;
|
||||||
|
|
||||||
|
|
||||||
List<dynamic> gpaMappedFamilyFloaters = [];
|
List<dynamic> gpaMappedFamilyFloaters = [];
|
||||||
@ -2179,10 +2186,12 @@ class _empDetailsState extends State<empDetails> {
|
|||||||
Column(
|
Column(
|
||||||
children: familyFloaterContainers,
|
children: familyFloaterContainers,
|
||||||
),
|
),
|
||||||
if (Responsive.isDesktop(context) && isValueValid)
|
if (Responsive.isDesktop(context) &&
|
||||||
|
(showFullPremiumSummary || showPremiumTotalOnly))
|
||||||
Row(
|
Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
|
if (showFullPremiumSummary) ...[
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 5,
|
flex: 5,
|
||||||
child: Container(
|
child: Container(
|
||||||
@ -2233,6 +2242,7 @@ class _empDetailsState extends State<empDetails> {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
))),
|
))),
|
||||||
|
],
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 5,
|
flex: 5,
|
||||||
child: Container(
|
child: Container(
|
||||||
@ -2260,11 +2270,13 @@ class _empDetailsState extends State<empDetails> {
|
|||||||
))),
|
))),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
if (!Responsive.isDesktop(context) && isValueValid)
|
if (!Responsive.isDesktop(context) &&
|
||||||
|
(showFullPremiumSummary || showPremiumTotalOnly))
|
||||||
Container(
|
Container(
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
|
if (showFullPremiumSummary) ...[
|
||||||
Row(
|
Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
@ -2349,6 +2361,7 @@ class _empDetailsState extends State<empDetails> {
|
|||||||
))),
|
))),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
],
|
||||||
Row(
|
Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
@ -2409,6 +2422,17 @@ class _empDetailsState extends State<empDetails> {
|
|||||||
: value.toStringAsFixed(2);
|
: value.toStringAsFixed(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// 0 = hide premium summary, 1 = full summary, 2 = total only
|
||||||
|
int parsePremiumSummaryMode(dynamic value) {
|
||||||
|
if (value == null) return 0;
|
||||||
|
if (value is bool) return value ? 1 : 0;
|
||||||
|
if (value is num) return value.toInt();
|
||||||
|
final normalized = value.toString().trim().toLowerCase();
|
||||||
|
if (normalized == 'true' || normalized == 'yes') return 1;
|
||||||
|
if (normalized == 'false' || normalized == 'no') return 0;
|
||||||
|
return int.tryParse(normalized) ?? 0;
|
||||||
|
}
|
||||||
|
|
||||||
List<Widget> generateCards(List<dynamic> data) {
|
List<Widget> generateCards(List<dynamic> data) {
|
||||||
List<Widget> cards = [];
|
List<Widget> cards = [];
|
||||||
|
|
||||||
@ -2444,6 +2468,13 @@ class _empDetailsState extends State<empDetails> {
|
|||||||
double gmcTotalableValue = gmcGstValue + gmcSiPremiumValue;
|
double gmcTotalableValue = gmcGstValue + gmcSiPremiumValue;
|
||||||
|
|
||||||
bool gmcIsValueValid = (gmcSiPremiumValue > 0 && gmcGstValue > 0);
|
bool gmcIsValueValid = (gmcSiPremiumValue > 0 && gmcGstValue > 0);
|
||||||
|
final int gmcPremiumSummaryMode =
|
||||||
|
parsePremiumSummaryMode(item['is_premium_summery']);
|
||||||
|
// 0 = hide, 1 = full summary, 2 = total only
|
||||||
|
final bool showFullGmcPremiumSummary =
|
||||||
|
gmcPremiumSummaryMode == 1 && gmcIsValueValid;
|
||||||
|
final bool showGmcPremiumTotalOnly =
|
||||||
|
gmcPremiumSummaryMode == 2 && gmcTotalableValue != 0;
|
||||||
|
|
||||||
|
|
||||||
List gmcRelationShip = item['relationship'];
|
List gmcRelationShip = item['relationship'];
|
||||||
@ -2954,10 +2985,12 @@ class _empDetailsState extends State<empDetails> {
|
|||||||
|
|
||||||
],
|
],
|
||||||
SizedBox(height: 15),
|
SizedBox(height: 15),
|
||||||
if (Responsive.isDesktop(context) && gmcIsValueValid)
|
if (Responsive.isDesktop(context) &&
|
||||||
|
(showFullGmcPremiumSummary || showGmcPremiumTotalOnly))
|
||||||
Row(
|
Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
|
if (showFullGmcPremiumSummary) ...[
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 5,
|
flex: 5,
|
||||||
child: Container(
|
child: Container(
|
||||||
@ -3008,6 +3041,7 @@ class _empDetailsState extends State<empDetails> {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
))),
|
))),
|
||||||
|
],
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 5,
|
flex: 5,
|
||||||
child: Container(
|
child: Container(
|
||||||
@ -3035,11 +3069,13 @@ class _empDetailsState extends State<empDetails> {
|
|||||||
))),
|
))),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
if (!Responsive.isDesktop(context) && gmcIsValueValid)
|
if (!Responsive.isDesktop(context) &&
|
||||||
|
(showFullGmcPremiumSummary || showGmcPremiumTotalOnly))
|
||||||
Container(
|
Container(
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
|
if (showFullGmcPremiumSummary) ...[
|
||||||
Row(
|
Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
@ -3128,6 +3164,7 @@ class _empDetailsState extends State<empDetails> {
|
|||||||
))),
|
))),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
],
|
||||||
Row(
|
Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -17,8 +17,8 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
|||||||
# In Windows, build-name is used as the major, minor, and patch parts
|
# 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.
|
# of the product and file versions while build-number is used as the build suffix.
|
||||||
#version: 1.2.42+99
|
#version: 1.2.42+99
|
||||||
version: 1.0.42+49
|
version: 1.0.43+50
|
||||||
#version: 2.0.30+69
|
#version: 2.0.31+70
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: '>=3.3.3 <4.0.0'
|
sdk: '>=3.3.3 <4.0.0'
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user