Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release/2022 04 #30

Merged
merged 12 commits into from
Oct 5, 2022
17 changes: 15 additions & 2 deletions .github/workflows/npmpublish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down Expand Up @@ -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"
Expand Down
4 changes: 4 additions & 0 deletions src/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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");
Expand Down
1 change: 1 addition & 0 deletions src/components/FamilyMasterPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
2 changes: 0 additions & 2 deletions src/components/InsureeSearcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ class InsureeSearcher extends Component {
<PublishedComponent
pubRef="insuree.InsureeMaritalStatusPicker"
withLabel={false}
withNull={true}
readOnly={true}
value={insuree.marital}
/>
Expand All @@ -160,7 +159,6 @@ class InsureeSearcher extends Component {
<PublishedComponent
pubRef="insuree.InsureeGenderPicker"
withLabel={false}
withNull={true}
readOnly={true}
value={!!insuree.gender ? insuree.gender.code : null}
/>
Expand Down
41 changes: 39 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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 },
Expand Down Expand Up @@ -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) => {
Expand Down
2 changes: 1 addition & 1 deletion src/menus/InsureeMainMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: <GroupAdd />,
route: "/" + modulesManager.getRef("insuree.route.family"),
withDivider: true,
Expand Down
1 change: 0 additions & 1 deletion src/pickers/InsureeGenderPicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
48 changes: 48 additions & 0 deletions src/reports/EnrolledFamiliesReport.js
Original file line number Diff line number Diff line change
@@ -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 (
<Grid container direction="column" spacing={1}>
<Grid item>
<PublishedComponent
pubRef="location.LocationPicker"
onChange={(location) =>
setValues({
...values,
location,
})
}
required
value={values.location}
locationLevel={2}
/>
</Grid>
<Grid item>
<PublishedComponent
pubRef="core.DatePicker"
value={values.dateFrom}
module="insuree"
required
label="EnrolledFamiliesReport.dateFrom"
onChange={(dateFrom) => setValues({ ...values, dateFrom })}
/>
</Grid>
<Grid item>
<PublishedComponent
pubRef="core.DatePicker"
value={values.dateTo}
module="insuree"
required
label="EnrolledFamiliesReport.dateTo"
onChange={(dateTo) => setValues({ ...values, dateTo })}
/>
</Grid>
</Grid>
);
};

export default EnrolledFamiliesReport;
34 changes: 34 additions & 0 deletions src/reports/InsureeFamilyOverviewReport.js
Original file line number Diff line number Diff line change
@@ -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 (
<Grid container direction="column" spacing={1}>
<Grid item>
<PublishedComponent
pubRef="core.DatePicker"
value={values.dateFrom}
module="insuree"
required
label="InsureeFamilyOverviewReport.dateFrom"
onChange={(dateFrom) => setValues({ ...values, dateFrom })}
/>
</Grid>
<Grid item>
<PublishedComponent
pubRef="core.DatePicker"
value={values.dateTo}
module="insuree"
required
label="InsureeFamilyOverviewReport.dateTo"
onChange={(dateTo) => setValues({ ...values, dateTo })}
/>
</Grid>
</Grid>
);
};

export default InsureeFamilyOverviewReport;
6 changes: 5 additions & 1 deletion src/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}