Skip to content

Commit

Permalink
CM-742: update benefit plan UI
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan committed Mar 21, 2024
1 parent 57240d1 commit 7243d13
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 37 deletions.
73 changes: 39 additions & 34 deletions src/components/PaymentPlanHeadPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ class PaymentPlanHeadPanel extends FormPanel {
const paymentPlanType = paymentPlan?.benefitPlanTypeName;
const { appliedCustomFilters, appliedFiltersRowStructure } = this.state;

const isBenefitPlanType = () => paymentPlanType.replace(/\s+/g, '') === PAYMENT_PLAN_TYPE.BENEFIT_PLAN;

if (paymentPlanType) {
// probably could get rid of that if we use double JSON.parse in reducer
const objectBenefitPlan = typeof paymentPlan.productOrBenefitPlan === 'object' ?
Expand Down Expand Up @@ -300,43 +302,13 @@ class PaymentPlanHeadPanel extends FormPanel {
/>
</Grid>
</Grid>
{paymentPlanType.replace(/\s+/g, '') === PAYMENT_PLAN_TYPE.BENEFIT_PLAN && (
<>
<Divider />
<Fragment>
<Typography>
<div className={classes.item}>
<FormattedMessage module="contributionPlan" id="paymentPlan.advancedCriteria" />
</div>
</Typography>
<div className={classes.item}>
<FormattedMessage module="contributionPlan" id="paymentPlan.advancedCriteria.tip" />
</div>
<Divider />
<Grid container className={classes.item}>

<AdvancedCriteriaDialog
object={paymentPlan.benefitPlan}
objectToSave={paymentPlan}
moduleName="social_protection"
objectType="BenefitPlan"
setAppliedCustomFilters={this.setAppliedCustomFilters}
appliedCustomFilters={appliedCustomFilters}
appliedFiltersRowStructure={appliedFiltersRowStructure}
setAppliedFiltersRowStructure={this.setAppliedFiltersRowStructure}
updateAttributes={this.updateJsonExt}
getDefaultAppliedCustomFilters={this.getDefaultAppliedCustomFilters}
edited={this.props.edited} />

</Grid>
</Fragment>
<Divider />
</>
)}
<Fragment>
<Typography>
<div className={classes.item}>
<FormattedMessage module="contributionPlan" id="calculationParams" />
{isBenefitPlanType() ?
<FormattedMessage module="contributionPlan" id="calculationParamsBFType"/> :
<FormattedMessage module="contributionPlan" id="calculationParams"/>
}
</div>
</Typography>
<Divider />
Expand All @@ -357,6 +329,39 @@ class PaymentPlanHeadPanel extends FormPanel {
/>
</Grid>
</Fragment>
{isBenefitPlanType() && (
<>
<Divider />
<Fragment>
<Typography>
<div className={classes.item}>
<FormattedMessage module="contributionPlan" id="paymentPlan.advancedCriteria" />
</div>
</Typography>
<div className={classes.item}>
<FormattedMessage module="contributionPlan" id="paymentPlan.advancedCriteria.tip" />
</div>
<Divider />
<Grid container className={classes.item}>

<AdvancedCriteriaDialog
object={paymentPlan.benefitPlan}
objectToSave={paymentPlan}
moduleName="social_protection"
objectType="BenefitPlan"
setAppliedCustomFilters={this.setAppliedCustomFilters}
appliedCustomFilters={appliedCustomFilters}
appliedFiltersRowStructure={appliedFiltersRowStructure}
setAppliedFiltersRowStructure={this.setAppliedFiltersRowStructure}
updateAttributes={this.updateJsonExt}
getDefaultAppliedCustomFilters={this.getDefaultAppliedCustomFilters}
edited={this.props.edited} />

</Grid>
</Fragment>
<Divider />
</>
)}
</Fragment>
);
}
Expand Down
7 changes: 4 additions & 3 deletions src/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"contributionPlan.bundleCodeTaken": "Contribution plan bundle code already exists",
"contributionPlan.name": "Name",
"contributionPlan.calculationParams": "Additional parameters",
"contributionPlan.calculationParamsBFType": "Parameters",
"contributionPlan.calculation": "Calculation Rule",
"contributionPlan.benefitPlan": "Insurance Product",
"contributionPlan.periodicity": "Periodicity (no of months)",
Expand Down Expand Up @@ -87,16 +88,16 @@
"paymentPlan.type.product": "Product",
"paymentPlan.type.benefitplan": "Benefit Plan",
"paymentPlan.advancedCriteria": "Advanced Criteria",
"paymentPlan.advancedCriteria.tip": "Please click the 'Confirm Filters' button to apply your chosen criteria.",
"paymentPlan.advancedCriteria.tip": "Please click the 'Confirm Criteria' button to apply your chosen criteria.",
"paymentPlan.advancedCriteria.field": "Field",
"paymentPlan.advancedCriteria.filter": "Confirm Filters",
"paymentPlan.advancedCriteria.value": "Value",
"paymentPlan.advancedCriteria.amount": "Amount",
"paymentPlan.advancedCriteria.button.AdvancedCriteria": "Advanced Criteria",
"paymentPlan.advancedCriteria.button.addFilters": "Add filter",
"paymentPlan.advancedCriteria.button.addFilters": "Add criterion",
"paymentPlan.advancedCriteria.button.clearAllFilters": "Clear All Criteria",
"paymentPlan.advancedCriteria.button.cancel": "Cancel",
"paymentPlan.advancedCriteria.button.filter": "Confirm Filters",
"paymentPlan.advancedCriteria.button.filter": "Confirm Criteria",
"paymentPlanPicker.label": "Payment Plan Picker",
"paymentPlan.deactivatePaymentPlan": "Deactivate Payment Plan"
}

0 comments on commit 7243d13

Please sign in to comment.