Skip to content

Commit

Permalink
OMT-313: Added claim percentage referrals report (#89)
Browse files Browse the repository at this point in the history
  • Loading branch information
tdethier authored Apr 20, 2023
1 parent 8fe00ca commit d1da9d0
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 1 deletion.
18 changes: 18 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ import ClaimMasterPanelExt from "./components/ClaimMasterPanelExt";
import AttachmentsDialog from "./components/AttachmentsDialog";
import messages_en from "./translations/en.json";
import reducer from "./reducer";
import { decodeId } from "@openimis/fe-core";
import ClaimPercentageReferralsReport from "./reports/ClaimPercentageReferralsReport";


const ROUTE_HEALTH_FACILITIES = "claim/healthFacilities";
const ROUTE_CLAIM_EDIT = "claim/healthFacilities/claim";
Expand All @@ -25,6 +28,21 @@ const ROUTE_CLAIM_FEEDBACK = "claim/feedback";
const DEFAULT_CONFIG = {
"translations": [{ key: "en", messages: messages_en }],
"reducers": [{ key: "claim", reducer }],
"reports": [
{
key: "claim_percentage_referrals",
component: ClaimPercentageReferralsReport,
isValid: (values) => values.region && values.district && values.dateStart && values.dateEnd,
getParams: (values) => {
const params = {}
params.region_id = decodeId(values.region.id);
params.district_id = decodeId(values.district.id);
params.date_start = values.dateStart;
params.date_end = values.dateEnd;
return params;
},
},
],
"refs": [
{ key: "claim.route.healthFacilities", ref: ROUTE_HEALTH_FACILITIES },
{ key: "claim.route.claimEdit", ref: ROUTE_CLAIM_EDIT },
Expand Down
64 changes: 64 additions & 0 deletions src/reports/ClaimPercentageReferralsReport.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import { Grid } from "@material-ui/core";
import { PublishedComponent, useModulesManager, useTranslations } from "@openimis/fe-core";
import React from "react";

const ClaimPercentageReferralsReport = (props) => {
const { values, setValues } = props;
const modulesManager = useModulesManager();
const { formatMessage } = useTranslations("claim", modulesManager);

return (
<Grid container direction="column" spacing={1}>
<Grid item>
<PublishedComponent
pubRef="location.RegionPicker"
label={formatMessage("ClaimPercentageReferralsReport.region")}
onChange={(region) =>
setValues({
...values,
region,
})
}
required
value={values.region}
/>
</Grid>
<Grid item>
<PublishedComponent
pubRef="location.DistrictPicker"
label={formatMessage("ClaimPercentageReferralsReport.district")}
onChange={(district) =>
setValues({
...values,
district,
})
}
required
value={values.district}
/>
</Grid>
<Grid item>
<PublishedComponent
pubRef="core.DatePicker"
value={values.dateStart}
module="claim"
required
label="ClaimPercentageReferralsReport.dateStart"
onChange={(dateStart) => setValues({ ...values, dateStart })}
/>
</Grid>
<Grid item>
<PublishedComponent
pubRef="core.DatePicker"
value={values.dateEnd}
module="claim"
required
label="ClaimPercentageReferralsReport.dateEnd"
onChange={(dateEnd) => setValues({ ...values, dateEnd })}
/>
</Grid>
</Grid>
);
};

export default ClaimPercentageReferralsReport;
6 changes: 5 additions & 1 deletion src/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -230,5 +230,9 @@
"claim.ClaimFilter.processedDateTo": "Processed To",
"claim.claimSummaries.processedDate": "Processed On",
"claim.edit.items.pricevaluated": "Valuated",
"claim.edit.services.pricevaluated": "Valuated"
"claim.edit.services.pricevaluated": "Valuated",
"claim.ClaimPercentageReferralsReport.region": "Region",
"claim.ClaimPercentageReferralsReport.district": "District",
"claim.ClaimPercentageReferralsReport.dateStart": "Date From",
"claim.ClaimPercentageReferralsReport.dateEnd": "Date To"
}

0 comments on commit d1da9d0

Please sign in to comment.