diff --git a/src/index.js b/src/index.js index 1bc6b0c..fe40ee5 100644 --- a/src/index.js +++ b/src/index.js @@ -16,6 +16,7 @@ import { reducer } from "./reducer"; import { RIGHT_POLICY } from "./constants"; import { policyMutation } from "./utils/utils"; import PolicyRenewalsReport from "./reports/PolicyRenewalsReport"; +import PolicyPrimaryOperationalIndicatorsReport from "./reports/PolicyPrimaryOperationalIndicatorsReport"; const ROUTE_POLICY_POLICIES = "policy/policies"; const ROUTE_POLICY_POLICY = "policy/policy"; @@ -49,11 +50,50 @@ const DEFAULT_CONFIG = { return params; }, }, + { + key: "policy_primary_operational_indicators", + component: PolicyPrimaryOperationalIndicatorsReport, + isValid: (values) => (values) => values.yearMonth, + getParams: (values) => { + const params = {yearMonth: values.yearMonth} + if (values.location) { + params.locationId = decodeId(values.location.id); + } + return params; + }, + }, ], "refs": [ { key: "policy.PolicyOfficerPicker", ref: PolicyOfficerPicker }, - { key: "policy.PolicyOfficerPicker.projection", ref: ["id", "uuid", "code", "lastName", "otherNames"] }, - { key: "policy.PolicyPicker.projection", ref: ["id", "uuid", "startDate", "product{name, code}", "expiryDate", "value", "sumPremiums"] }, + { + key: "policy.PolicyOfficerPicker.projection", + ref: ["id", "uuid", "code", "lastName", "otherNames"], + }, + { + key: "policy.PolicyPicker.projection", + ref: [ + "id", + "uuid", + "startDate", + "product{name, code}", + "expiryDate", + "value", + "sumPremiums", + ], + }, + { + key: "policy.PolicyPicker.projection.withFamily", + ref: [ + "id", + "uuid", + "startDate", + "product{name, code}", + "expiryDate", + "value", + "sumPremiums", + "family{id, uuid, headInsuree{chfId, lastName, otherNames, dob}}", + ], + }, { key: "policy.PolicyOfficerPicker.sort", ref: 'officer__code' }, { key: "policy.PolicyStatusPicker", ref: PolicyStatusPicker }, { key: "policy.PolicyStatusPicker.projection", ref: null }, diff --git a/src/reports/PolicyPrimaryOperationalIndicatorsReport.js b/src/reports/PolicyPrimaryOperationalIndicatorsReport.js new file mode 100644 index 0000000..6670d63 --- /dev/null +++ b/src/reports/PolicyPrimaryOperationalIndicatorsReport.js @@ -0,0 +1,39 @@ +import { Grid } from "@material-ui/core"; +import { PublishedComponent, useModulesManager, useTranslations } from "@openimis/fe-core"; +import React from "react"; + +const InsureeMissingPhotoReport = (props) => { + const { values, setValues } = props; + const modulesManager = useModulesManager(); + const { formatMessage } = useTranslations("policy", modulesManager); + + return ( + + + setValues({ ...values, yearMonth })} + /> + + + + setValues({ + ...values, + location, + }) + } + value={values.location} + locationLevel={1} + /> + + + ); +}; + +export default InsureeMissingPhotoReport;