Skip to content

Commit

Permalink
CM-776: Make periodicity of the BenefitPlan paymentPlan not mandatory
Browse files Browse the repository at this point in the history
  • Loading branch information
sniedzielski committed Mar 13, 2024
1 parent ae9dbb8 commit 8d7ec3e
Showing 1 changed file with 21 additions and 14 deletions.
35 changes: 21 additions & 14 deletions src/components/PaymentPlanHeadPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,11 @@ class PaymentPlanHeadPanel extends FormPanel {
const objectBenefitPlan = typeof paymentPlan.productOrBenefitPlan === 'object' ?
paymentPlan.productOrBenefitPlan : JSON.parse(paymentPlan.productOrBenefitPlan || '{}');
paymentPlan.benefitPlan = objectBenefitPlan;
if (paymentPlanType === 'benefitplan' || paymentPlanType === 'benefit plan') {
paymentPlan.periodicity = 1;
this.state.data.periodicity = paymentPlan.periodicity;
console.log(this.state);
}
return (
<Fragment>
<Grid container className={classes.tableTitle}>
Expand Down Expand Up @@ -252,20 +257,22 @@ class PaymentPlanHeadPanel extends FormPanel {
onChange={(v) => this.updateAttribute("benefitPlan", v)}
/>
</Grid>
<Grid item xs={GRID_ITEM_SIZE} className={classes.item}>
<NumberInput
module="contributionPlan"
label="periodicity"
required
/**
* @see min set to @see EMPTY_PERIODICITY_FILTER when filter unset to avoid @see NumberInput error message
*/
min={!!paymentPlan.periodicity ? MIN_PERIODICITY_VALUE : EMPTY_PERIODICITY_VALUE}
max={MAX_PERIODICITY_VALUE}
value={!!paymentPlan.periodicity ? paymentPlan.periodicity : null}
onChange={(v) => this.updateAttribute("periodicity", v)}
/>
</Grid>
{paymentPlanType !== 'benefitplan' && paymentPlanType !== 'benefit plan' && (
<Grid item xs={GRID_ITEM_SIZE} className={classes.item}>
<NumberInput
module="contributionPlan"
label="periodicity"
required
/**
* @see min set to @see EMPTY_PERIODICITY_FILTER when filter unset to avoid @see NumberInput error message
*/
min={!!paymentPlan.periodicity ? MIN_PERIODICITY_VALUE : EMPTY_PERIODICITY_VALUE}
max={MAX_PERIODICITY_VALUE}
value={!!paymentPlan.periodicity ? paymentPlan.periodicity : null}
onChange={(v) => this.updateAttribute("periodicity", v)}
/>
</Grid>
)}
<Grid item xs={GRID_ITEM_SIZE} className={classes.item}>
<PublishedComponent
pubRef="core.DatePicker"
Expand Down

0 comments on commit 8d7ec3e

Please sign in to comment.