Skip to content

Commit

Permalink
Merge pull request #46 from openimis/feature/OP-1854
Browse files Browse the repository at this point in the history
OP-1854: use billPayment instead of paymentInvoice
  • Loading branch information
jdolkowski authored Apr 3, 2024
2 parents f6a6773 + 85bb50c commit c4b5f80
Show file tree
Hide file tree
Showing 2 changed files with 100 additions and 117 deletions.
66 changes: 28 additions & 38 deletions src/components/BillPaymentsFilter.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ import _debounce from "lodash/debounce";
import { Grid } from "@material-ui/core";
import { withTheme, withStyles } from "@material-ui/core/styles";

import { withModulesManager, formatMessage, TextInput, NumberInput, PublishedComponent } from "@openimis/fe-core";
import { withModulesManager, TextInput, NumberInput, PublishedComponent } from "@openimis/fe-core";
import { CONTAINS_LOOKUP, DEFUALT_DEBOUNCE_TIME, STARTS_WITH_LOOKUP } from "../constants";
import PaymentInvoiceStatusPicker from "../pickers/PaymentInvoiceStatusPicker";

const styles = (theme) => ({
form: {
Expand All @@ -18,7 +17,7 @@ const styles = (theme) => ({
},
});

const BillPaymentsFilter = ({ intl, classes, filters, onChangeFilters }) => {
const BillPaymentsFilter = ({ classes, filters, onChangeFilters }) => {
const debouncedOnChangeFilters = _debounce(onChangeFilters, DEFUALT_DEBOUNCE_TIME);

const filterValue = (filterName) => filters?.[filterName]?.value;
Expand Down Expand Up @@ -57,98 +56,89 @@ const BillPaymentsFilter = ({ intl, classes, filters, onChangeFilters }) => {

return (
<Grid container className={classes.form}>
<Grid item xs={2} className={classes.item}>
<PaymentInvoiceStatusPicker
label="paymentInvoice.reconciliationStatus.label"
withNull
nullLabel={formatMessage(intl, "invoice", "any")}
value={filterValue("reconciliationStatus")}
onChange={(value) =>
onChangeFilters([
{
id: "reconciliationStatus",
value: value,
filter: `reconciliationStatus: "${value}"`,
},
])
}
/>
</Grid>
<Grid item xs={2} className={classes.item}>
<TextInput
module="invoice"
label="paymentInvoice.codeExt"
label="billPayment.codeExt"
value={filterTextFieldValue("codeExt")}
onChange={onChangeStringFilter("codeExt", CONTAINS_LOOKUP)}
/>
</Grid>
<Grid item xs={2} className={classes.item}>
<TextInput
module="invoice"
label="paymentInvoice.label"
label="billPayment.label"
value={filterTextFieldValue("label")}
onChange={onChangeStringFilter("label", STARTS_WITH_LOOKUP)}
/>
</Grid>
<Grid item xs={2} className={classes.item}>
<TextInput
module="invoice"
label="paymentInvoice.codeTp"
label="billPayment.codeTp"
value={filterTextFieldValue("codeTp")}
onChange={onChangeStringFilter("codeTp", CONTAINS_LOOKUP)}
/>
</Grid>
<Grid item xs={2} className={classes.item}>
<TextInput
module="invoice"
label="paymentInvoice.codeReceipt"
label="billPayment.codeReceipt"
value={filterTextFieldValue("codeReceipt")}
onChange={onChangeStringFilter("codeReceipt", CONTAINS_LOOKUP)}
/>
</Grid>
<Grid item xs={2} className={classes.item}>
<NumberInput
module="invoice"
label="paymentInvoice.fees"
label="billPayment.fees"
min={0}
value={filterValue("fees")}
onChange={onChangeFilter("fees")}
onChange={(fee) =>
onChangeFilters([
{
id: "fees",
value: !fee ? null : fee,
filter: fee ? `fees: "${parseFloat(fee)}"` : null,
},
])
}
/>
</Grid>
<Grid item xs={2} className={classes.item}>
<NumberInput
module="invoice"
label="paymentInvoice.amountReceived"
label="billPayment.amountReceived"
min={0}
value={filterValue("amountReceived")}
onChange={onChangeFilter("amountReceived")}
onChange={(amountReceived) =>
onChangeFilters([
{
id: "amountReceived",
value: !amountReceived ? null : amountReceived,
filter: amountReceived ? `amountReceived: "${parseFloat(amountReceived)}"` : null,
},
])
}
/>
</Grid>
<Grid item xs={2} className={classes.item}>
<PublishedComponent
pubRef="core.DatePicker"
module="invoice"
label="paymentInvoice.datePayment"
label="billPayment.datePayment"
value={filterValue("datePayment")}
onChange={onChangeStringFilter("datePayment")}
/>
</Grid>
<Grid item xs={2} className={classes.item}>
<TextInput
module="invoice"
label="paymentInvoice.paymentOrigin"
label="billPayment.paymentOrigin"
value={filterTextFieldValue("paymentOrigin")}
onChange={onChangeStringFilter("paymentOrigin", CONTAINS_LOOKUP)}
/>
</Grid>
<Grid item xs={2} className={classes.item}>
<TextInput
module="invoice"
label="paymentInvoice.payerRef"
value={filterTextFieldValue("payerRef")}
onChange={onChangeStringFilter("payerRef", CONTAINS_LOOKUP)}
/>
</Grid>
</Grid>
);
};
Expand Down
Loading

0 comments on commit c4b5f80

Please sign in to comment.