Skip to content

Commit

Permalink
Merge pull request #84 from openimis/feature/OP-1814
Browse files Browse the repository at this point in the history
OP-1814: make maxinstallments optional
  • Loading branch information
delcroip authored Mar 8, 2024
2 parents aa5cbf9 + 7c118dc commit 7bd7b97
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions src/components/ProductForm/ContributionTabForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,10 @@ const ContributionTabForm = (props) => {
<Grid item xs={3} className={classes.item}>
<NumberInput
module="product"
min={1}
label="maxInstallments"
required
readOnly={readOnly}
value={edited?.maxInstallments ?? 1}
displayZero
value={edited?.maxInstallments}
onChange={(maxInstallments) => onEditedChanged({ ...edited, maxInstallments })}
/>
</Grid>
Expand Down
4 changes: 2 additions & 2 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ export const validateProductForm = (values, rules, isProductCodeValid) => {
"name",
"maxMembers",
"insurancePeriod",
"maxInstallments",
"gracePeriodPayment",
"dateFrom",
"dateTo",
Expand Down Expand Up @@ -87,7 +86,6 @@ export const toFormValues = (product, shouldDuplicate) => {
lumpSum: product.lumpSum ?? 0,
maxMembers: product.maxMembers ?? 0,
insurancePeriod: product.insurancePeriod ?? 12,
maxInstallments: product.maxInstallments ?? 1,
gracePeriodPayment: product.gracePeriodPayment ?? 0,
gracePeriodEnrolment: product.gracePeriodEnrolment ?? 0,
gracePeriodRenewal: product.gracePeriodRenewal ?? 0,
Expand Down Expand Up @@ -117,6 +115,7 @@ export const toInputValues = (values) => {
items,
services,
ceilingType,
maxInstallments,
...inputValues
} = values;

Expand Down Expand Up @@ -151,6 +150,7 @@ export const toInputValues = (values) => {
services: hasEditedServices ? services.map(formatService) : undefined,
items: hasEditedItems ? items.map(formatItem) : undefined,
uuid,
maxInstallments: maxInstallments ? Number(maxInstallments) : null,
code: code,
dateFrom: toISODate(values.dateFrom),
dateTo: toISODate(values.dateTo),
Expand Down

0 comments on commit 7bd7b97

Please sign in to comment.