Skip to content

Commit

Permalink
Merge pull request #20 from openimis/v1.3
Browse files Browse the repository at this point in the history
V1.3
  • Loading branch information
edarchis authored Oct 28, 2021
2 parents f275a9a + 65b2581 commit 1b727f5
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 20 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@openimis/fe-medical_pricelist",
"version": "1.2.1",
"version": "1.3.0",
"license": "AGPL-3.0-only",
"description": "openIMIS Frontend Medical Price List reference module",
"repository": "openimis/openimis-fe-medical_pricelist_js",
Expand Down
2 changes: 1 addition & 1 deletion src/components/PricelistForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import ReplayIcon from "@material-ui/icons/Replay";

const PricelistForm = (props) => {
const { readOnly, onBack, onSave, onReset, pricelist, onChange, fetchDetails, details } = props;
const canSave = () => pricelist.name && pricelist.location && pricelist.pricelistDate;
const canSave = () => pricelist.name && pricelist.pricelistDate;
return (
<>
<Form
Expand Down
1 change: 0 additions & 1 deletion src/components/PricelistGeneralPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ class PricelistGeneralPanel extends FormPanel {
<PublishedComponent
pubRef="location.RegionPicker"
value={region}
required
readOnly={readOnly}
withNull={true}
onChange={this.onRegionChange}
Expand Down
20 changes: 4 additions & 16 deletions src/components/PricelistsSearcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,8 @@ import PricelistsFilters from "./PricelistsFilters";
const isRowDisabled = (_, row) => Boolean(row.validityTo);
const isRowLocked = () => false;

const getLocationByType = (location, type) => {
if (location.type === type) {
return location;
} else if (location.parent?.type === type) {
return location.parent;
} else {
return null;
}
const formatLocation = (location) => {
return location ? `${location.code} - ${location.name}` : "";
};

const HEADERS = [
Expand Down Expand Up @@ -62,14 +56,8 @@ const PricelistsSearcher = (props) => {
() => [
(pricelist) => pricelist.name,
(pricelist) => formatDateFromISO(pricelist.pricelistDate),
(pricelist) =>
getLocationByType(pricelist.location, "R")
? `${getLocationByType(pricelist.location, "R").code} - ${getLocationByType(pricelist.location, "R").name}`
: null,
(pricelist) =>
getLocationByType(pricelist.location, "D")
? `${getLocationByType(pricelist.location, "D").code} - ${getLocationByType(pricelist.location, "D").name}`
: null,
(pricelist) => formatLocation(pricelist.location?.parent || pricelist.location),
(pricelist) => formatLocation(pricelist.location?.parent ? pricelist.location : null),
(pricelist) => formatDateFromISO(pricelist.validityFrom),
(pricelist) => formatDateFromISO(pricelist.validityTo),
(pricelist) => (
Expand Down
1 change: 0 additions & 1 deletion src/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ function reducer(
},
};
case "MEDICAL_PRICELIST_PRICELIST_RESP":
console.log(action);
return {
...state,
pricelists: {
Expand Down

0 comments on commit 1b727f5

Please sign in to comment.