diff --git a/.github/workflows/npmpublish.yml b/.github/workflows/npmpublish.yml index 2336d08..435edf0 100644 --- a/.github/workflows/npmpublish.yml +++ b/.github/workflows/npmpublish.yml @@ -5,29 +5,38 @@ name: Node.js Package on: release: - types: [created] + types: [published] jobs: build: runs-on: ubuntu-latest steps: + - uses: olegtarasov/get-tag@v2.1 + id: tagName - uses: actions/checkout@v2 - uses: actions/setup-node@v1 with: node-version: 12 + - name: update the version with TAG + run: echo $(jq --arg a "$GIT_TAG_NAME" '.version = ($a)' package.json) > package.json - run: yarn install - - run: yarn build + - run: yarn build + publish-npm: needs: build runs-on: ubuntu-latest steps: + - uses: olegtarasov/get-tag@v2.1 + id: tagName - uses: actions/checkout@v2 - uses: actions/setup-node@v1 with: node-version: 12 registry-url: https://registry.npmjs.org/ scope: openimis + - name: update the version with TAG + run: echo $(jq --arg a "$GIT_TAG_NAME" '.version = ($a)' package.json) > package.json - run: yarn install - run: yarn build - run: npm publish --access public @@ -38,11 +47,15 @@ jobs: needs: build runs-on: ubuntu-latest steps: + - uses: olegtarasov/get-tag@v2.1 + id: tagName - uses: actions/checkout@v2 - uses: actions/setup-node@v1 with: node-version: 12 registry-url: https://npm.pkg.github.com/ + - name: update the version with TAG + run: echo $(jq --arg a "$GIT_TAG_NAME" '.version = ($a)' package.json) > package.json - run: yarn install - run: yarn build - run: npm publish diff --git a/README.md b/README.md index 00792cd..c8fb1bd 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,7 @@ It is dedicated to be deployed as a module of [openimis-fe_js](https://github.co - `insuree.Insuree.panels`: `[InsureeFirstServicePointPanel]`, contributing to own contribution point and adding First Service Point contribution when creating a new Insuree - `insuree.InsureePage.panels`: `[InsureeMasterPanel, InsureeFirstServicePointPanel]`, contributing to own contribution point and register the defaults MasterPanel and First Service Point as panels of Insuree Page - `core.Router`: registering the `insuree/create`, `insuree/families`, `insuree/insurees`, `insuree/cappedItemService` and `insuree/profile` routes in openIMIS client-side router +- `invoice.SubjectAndThirdpartyPicker`, providing Insuree picker and Family picker for Invoice module ## Available Contribution Points diff --git a/package.json b/package.json index 08d307c..de3dcaf 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@openimis/fe-insuree", - "version": "1.3.0", + "version": "1.4.0-rc3", "license": "AGPL-3.0-only", "description": "openIMIS Frontend Insuree reference module", "repository": "openimis/openimis-fe-insuree_js", @@ -35,7 +35,6 @@ "prettier": "^2.3.2", "prop-types": "^15.7.2", "react-autosuggest": "^10.0.2", - "react-router-dom": "^5.2.0", "redux": "^4.0.5", "redux-api-middleware": "^3.2.1", "rollup": "^2.10.0" diff --git a/src/actions.js b/src/actions.js index 4553b8e..4dd01ae 100644 --- a/src/actions.js +++ b/src/actions.js @@ -26,6 +26,8 @@ const FAMILY_FULL_PROJECTION = (mm) => [ "clientMutationId", ]; +export const FAMILY_PICKER_PROJECTION = ["id", "uuid", "headInsuree{id chfId uuid lastName otherNames}"]; + const INSUREE_FULL_PROJECTION = (mm) => [ "id", "uuid", @@ -54,6 +56,8 @@ const INSUREE_FULL_PROJECTION = (mm) => [ "healthFacility" + mm.getProjection("location.HealthFacilityPicker.projection"), ]; +export const INSUREE_PICKER_PROJECTION = ["id", "uuid", "chfId", "lastName", "otherNames"]; + export function fetchInsureeGenders() { const payload = formatQuery("insureeGenders", null, ["code"]); return graphql(payload, "INSUREE_GENDERS"); diff --git a/src/components/FamilyMasterPanel.js b/src/components/FamilyMasterPanel.js index bb08adc..bec5181 100644 --- a/src/components/FamilyMasterPanel.js +++ b/src/components/FamilyMasterPanel.js @@ -123,6 +123,7 @@ class FamilyMasterPanel extends FormPanel { pubRef="location.DetailedLocation" withNull={true} readOnly={readOnly} + required value={!edited ? null : edited.location} onChange={(v) => this.updateAttribute("location", v)} filterLabels={false} diff --git a/src/components/InsureeSearcher.js b/src/components/InsureeSearcher.js index 05f2462..988e09f 100644 --- a/src/components/InsureeSearcher.js +++ b/src/components/InsureeSearcher.js @@ -151,7 +151,6 @@ class InsureeSearcher extends Component { @@ -160,7 +159,6 @@ class InsureeSearcher extends Component { diff --git a/src/index.js b/src/index.js index 3d78616..d5c8016 100644 --- a/src/index.js +++ b/src/index.js @@ -33,6 +33,10 @@ import FamilyDisplayPanel from "./components/FamilyDisplayPanel"; import { familyLabel } from "./utils/utils"; import messages_en from "./translations/en.json"; import reducer from "./reducer"; +import { FAMILY_PICKER_PROJECTION, INSUREE_PICKER_PROJECTION } from "./actions"; +import { decodeId } from "@openimis/fe-core"; +import EnrolledFamiliesReport from "./reports/EnrolledFamiliesReport"; +import InsureeFamilyOverviewReport from "./reports/InsureeFamilyOverviewReport"; const ROUTE_INSUREE_FAMILIES = "insuree/families"; const ROUTE_INSUREE_FAMILY_OVERVIEW = "insuree/familyOverview"; @@ -43,15 +47,36 @@ const ROUTE_INSUREE_INSUREE = "insuree/insuree"; const DEFAULT_CONFIG = { "translations": [{ key: "en", messages: messages_en }], "reducers": [{ key: "insuree", reducer }], + "reports": [ + { + key: "insuree_family_overview", + component: InsureeFamilyOverviewReport, + isValid: (values) => values.dateFrom && values.dateTo, + getParams: (values) => ({ + dateFrom: values.dateFrom, + dateTo: values.dateTo, + }), + }, + { + key: "enrolled_families", + component: EnrolledFamiliesReport, + isValid: (values) => values.location && values.dateFrom && values.dateTo, + getParams: (values) => ({ + locationId: decodeId(values.location.id), + dateFrom: values.dateFrom, + dateTo: values.dateTo, + }), + }, + ], "refs": [ { key: "insuree.InsureeOfficerPicker", ref: InsureeOfficerPicker }, { key: "insuree.InsureeOfficerPicker.projection", ref: ["id", "uuid", "code", "lastName", "otherNames"] }, { key: "insuree.InsureePicker", ref: InsureePicker }, { key: "insuree.InsureeChfIdPicker", ref: InsureeChfIdPicker }, - { key: "insuree.InsureePicker.projection", ref: ["id", "uuid", "chfId", "lastName", "otherNames"] }, + { key: "insuree.InsureePicker.projection", ref: INSUREE_PICKER_PROJECTION }, { key: "insuree.InsureePicker.sort", ref: "insuree__last_name" }, { key: "insuree.FamilyPicker", ref: FamilyPicker }, - { key: "insuree.FamilyPicker.projection", ref: ["id", "uuid", "headInsuree{id chfId uuid lastName otherNames}"] }, + { key: "insuree.FamilyPicker.projection", ref: FAMILY_PICKER_PROJECTION }, { key: "insuree.FamilyPicker.sort", ref: "family__head_insuree__lastName" }, { key: "insuree.familyLabel", ref: familyLabel }, { key: "insuree.InsureeGenderPicker", ref: InsureeGenderPicker }, @@ -95,6 +120,18 @@ const DEFAULT_CONFIG = { "insuree.InsureeSummaryExt": [InsureeFirstServicePointDisplay], "insuree.Insuree.panels": [InsureeFirstServicePointPanel], "policy.Policy.headPanel": [FamilyDisplayPanel], + "invoice.SubjectAndThirdpartyPicker": [ + { + type: "insuree", + picker: InsureePicker, + pickerProjection: INSUREE_PICKER_PROJECTION, + }, + { + type: "family", + picker: FamilyPicker, + pickerProjection: FAMILY_PICKER_PROJECTION, + }, + ], }; export const InsureeModule = (cfg) => { diff --git a/src/menus/InsureeMainMenu.js b/src/menus/InsureeMainMenu.js index 729bff2..a32688e 100644 --- a/src/menus/InsureeMainMenu.js +++ b/src/menus/InsureeMainMenu.js @@ -13,7 +13,7 @@ class InsureeMainMenu extends Component { let entries = []; if (rights.includes(RIGHT_FAMILY_ADD)) { entries.push({ - text: "Add Family/Group", + text: formatMessage(this.props.intl, "insuree", "menu.addFamilyOrGroup"), icon: , route: "/" + modulesManager.getRef("insuree.route.family"), withDivider: true, diff --git a/src/pickers/InsureeGenderPicker.js b/src/pickers/InsureeGenderPicker.js index 00db8af..3f54731 100644 --- a/src/pickers/InsureeGenderPicker.js +++ b/src/pickers/InsureeGenderPicker.js @@ -41,7 +41,6 @@ class InsureeGenderPicker extends Component { readOnly = false, required = false, withNull = false, - nullLabel = null, } = this.props; let options = !!insureeGenders ? insureeGenders.map((v) => ({ value: v, label: this.formatSuggestion(v) })) : []; if (withNull) { diff --git a/src/reports/EnrolledFamiliesReport.js b/src/reports/EnrolledFamiliesReport.js new file mode 100644 index 0000000..64725ac --- /dev/null +++ b/src/reports/EnrolledFamiliesReport.js @@ -0,0 +1,48 @@ +import { Grid } from "@material-ui/core"; +import { PublishedComponent } from "@openimis/fe-core"; +import React from "react"; + +const EnrolledFamiliesReport = (props) => { + const { values, setValues } = props; + + return ( + + + + setValues({ + ...values, + location, + }) + } + required + value={values.location} + locationLevel={2} + /> + + + setValues({ ...values, dateFrom })} + /> + + + setValues({ ...values, dateTo })} + /> + + + ); +}; + +export default EnrolledFamiliesReport; diff --git a/src/reports/InsureeFamilyOverviewReport.js b/src/reports/InsureeFamilyOverviewReport.js new file mode 100644 index 0000000..50e2df6 --- /dev/null +++ b/src/reports/InsureeFamilyOverviewReport.js @@ -0,0 +1,34 @@ +import { Grid } from "@material-ui/core"; +import { PublishedComponent } from "@openimis/fe-core"; +import React from "react"; + +const InsureeFamilyOverviewReport = (props) => { + const { values, setValues } = props; + + return ( + + + setValues({ ...values, dateFrom })} + /> + + + setValues({ ...values, dateTo })} + /> + + + ); +}; + +export default InsureeFamilyOverviewReport; diff --git a/src/translations/en.json b/src/translations/en.json index 06607ea..3678aa5 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -222,5 +222,9 @@ "insuree.selectHeadInsuree.tooltip": "Select existing insuree as head", "insuree.addInsuree.alert.title": "Add insuree to family warning(s):", "insuree.addInsuree.alert.message": "However, insuree can still be added to the family.", - "insuree.InsureeNumberInput.error": "Invalid Insuree Number" + "insuree.InsureeNumberInput.error": "Invalid Insuree Number", + "insuree.EnrolledFamiliesReport.dateFrom": "From Date", + "insuree.EnrolledFamiliesReport.dateTo": "To Date", + "insuree.InsureeFamilyOverviewReport.dateFrom": "From Date", + "insuree.InsureeFamilyOverviewReport.dateTo": "To Date" }