@openmrs/esm-stock-management-app 1.0.1-pre.406 → 1.0.1-pre.413

Sign up to get free protection for your applications and to get access to all the features.
@@ -32,9 +32,9 @@
32
32
  "initial": false,
33
33
  "entry": false,
34
34
  "recorded": false,
35
- "size": 1033651,
35
+ "size": 1033664,
36
36
  "sizes": {
37
- "javascript": 1033441,
37
+ "javascript": 1033454,
38
38
  "consume-shared": 210
39
39
  },
40
40
  "names": [],
@@ -48,7 +48,7 @@
48
48
  "auxiliaryFiles": [
49
49
  "39.js.map"
50
50
  ],
51
- "hash": "94b7d138985a7d25",
51
+ "hash": "18c3174bdcd2453a",
52
52
  "childrenByOrder": {}
53
53
  },
54
54
  {
@@ -110,10 +110,10 @@
110
110
  "initial": true,
111
111
  "entry": true,
112
112
  "recorded": false,
113
- "size": 4724831,
113
+ "size": 4724844,
114
114
  "sizes": {
115
115
  "consume-shared": 252,
116
- "javascript": 4702883,
116
+ "javascript": 4702896,
117
117
  "share-init": 252,
118
118
  "runtime": 21444
119
119
  },
@@ -130,7 +130,7 @@
130
130
  "auxiliaryFiles": [
131
131
  "main.js.map"
132
132
  ],
133
- "hash": "418aee604a9f031d",
133
+ "hash": "698d620af01dedda",
134
134
  "childrenByOrder": {}
135
135
  },
136
136
  {
@@ -212,9 +212,9 @@
212
212
  "initial": false,
213
213
  "entry": false,
214
214
  "recorded": false,
215
- "size": 1643,
215
+ "size": 1706,
216
216
  "sizes": {
217
- "javascript": 1643
217
+ "javascript": 1706
218
218
  },
219
219
  "names": [],
220
220
  "idHints": [],
@@ -226,7 +226,7 @@
226
226
  "574.js"
227
227
  ],
228
228
  "auxiliaryFiles": [],
229
- "hash": "b3e5d6afecdfdf79",
229
+ "hash": "79c30f90fd2e5c04",
230
230
  "childrenByOrder": {}
231
231
  },
232
232
  {
package/dist/routes.json CHANGED
@@ -1 +1 @@
1
- {"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"fhir2":">=1.2","webservices.rest":"^2.24.0"},"extensions":[{"name":"stock-management-dashboard","slot":"stock-management-dashboard-slot","component":"stockManagementDashboard"},{"name":"stock-management-admin-card-link","slot":"system-admin-page-card-link-slot","component":"stockManagementAdminCardLink"},{"name":"stock-operation-dialog","component":"stockOperationDialog"},{"name":"import-bulk-stock-items","component":"importBulkStockItemsDialog"},{"name":"delete-stock-modal","component":"deleteStockModal"},{"name":"delete-stock-user-scope-modal","component":"deleteUserScopeModal"},{"name":"stock-management-app-menu-item","component":"stockManagementAppMenuItem","slot":"app-menu-item-slot","meta":{"name":" Stock Management"}},{"name":"delete-stock-rule-modal","component":"deleteStockRuleModal"},{"name":"delete-packaging-unit-modal","component":"deletePackagingUnitModal"},{"name":"delete-packaging-unit-button","component":"deletePackagingUnitButton"}],"pages":[{"component":"stockManagement","route":"stock-management"}],"version":"1.0.1-pre.406"}
1
+ {"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"fhir2":">=1.2","webservices.rest":"^2.24.0"},"extensions":[{"name":"stock-management-dashboard","slot":"stock-management-dashboard-slot","component":"stockManagementDashboard"},{"name":"stock-management-admin-card-link","slot":"system-admin-page-card-link-slot","component":"stockManagementAdminCardLink"},{"name":"stock-operation-dialog","component":"stockOperationDialog"},{"name":"import-bulk-stock-items","component":"importBulkStockItemsDialog"},{"name":"delete-stock-modal","component":"deleteStockModal"},{"name":"delete-stock-user-scope-modal","component":"deleteUserScopeModal"},{"name":"stock-management-app-menu-item","component":"stockManagementAppMenuItem","slot":"app-menu-item-slot","meta":{"name":" Stock Management"}},{"name":"delete-stock-rule-modal","component":"deleteStockRuleModal"},{"name":"delete-packaging-unit-modal","component":"deletePackagingUnitModal"},{"name":"delete-packaging-unit-button","component":"deletePackagingUnitButton"}],"pages":[{"component":"stockManagement","route":"stock-management"}],"version":"1.0.1-pre.413"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openmrs/esm-stock-management-app",
3
- "version": "1.0.1-pre.406",
3
+ "version": "1.0.1-pre.413",
4
4
  "license": "MPL-2.0",
5
5
  "description": "Stock management microfrontend for OpenMRS 3.x",
6
6
  "browser": "dist/openmrs-esm-stock-management-app.js",
package/src/constants.ts CHANGED
@@ -110,7 +110,6 @@ export const PRINT_LOGO =
110
110
  export const PRINT_LOGO_TEXT = "Ministry of Health";
111
111
 
112
112
  export const MAIN_STORE_LOCATION_TAG = "Main Store";
113
-
114
113
  export const BASE_OPENMRS_APP_URL = "/openmrs/";
115
114
 
116
115
  export const STOCKMGMT_RESOURCE_URL = "/openmrs/stockmanagement/spa.page/";
@@ -38,13 +38,16 @@ const StockHomeInventoryCard = () => {
38
38
 
39
39
  mergedArray = mergedArray.filter((item) => item.hasExpiration);
40
40
 
41
- const filteredData = mergedArray.filter((item) => {
42
- const expirationDate = new Date(item.expiration);
43
- const differenceInDays = Math.ceil(
44
- (expirationDate.getTime() - currentDate.getTime()) / (1000 * 60 * 60 * 24)
45
- );
46
- return differenceInDays <= 180 && differenceInDays >= 0;
47
- });
41
+ const filteredData = mergedArray
42
+ .filter((item) => {
43
+ const expirationDate = new Date(item.expiration);
44
+ const differenceInDays = Math.ceil(
45
+ (expirationDate.getTime() - currentDate.getTime()) /
46
+ (1000 * 60 * 60 * 24)
47
+ );
48
+ return differenceInDays <= 180 && differenceInDays >= 0;
49
+ })
50
+ .slice(0, 5);
48
51
 
49
52
  return (
50
53
  <>
@@ -5,6 +5,7 @@ import { ComboBox, TextInputSkeleton } from "@carbon/react";
5
5
  import { useConcept } from "../../../stock-lookups/stock-lookups.resource";
6
6
  import { type ConfigObject } from "../../../config-schema";
7
7
  import { useConfig } from "@openmrs/esm-framework";
8
+ import { useTranslation } from "react-i18next";
8
9
 
9
10
  interface StockItemCategorySelectorProps<T> {
10
11
  categoryUuid?: string;
@@ -23,6 +24,8 @@ interface StockItemCategorySelectorProps<T> {
23
24
  const StockItemCategorySelector = <T,>(
24
25
  props: StockItemCategorySelectorProps<T>
25
26
  ) => {
27
+ const { t } = useTranslation();
28
+
26
29
  const { stockItemCategoryUUID } = useConfig<ConfigObject>();
27
30
  const {
28
31
  items: { answers: categories },
@@ -52,10 +55,10 @@ const StockItemCategorySelector = <T,>(
52
55
  categories?.find((p) => p.uuid === props.categoryUuid) || {}
53
56
  }
54
57
  itemToString={(item?: Concept) =>
55
- item && item?.display ? `${item?.display}` : ""
58
+ item && item?.display ? `${t(item?.display)}` : ""
56
59
  }
57
60
  shouldFilterItem={() => true}
58
- value={categories?.find((p) => p.uuid === value)?.display ?? ""}
61
+ value={t(categories?.find((p) => p.uuid === value)?.display) ?? ""}
59
62
  placeholder={props.placeholder}
60
63
  ref={ref}
61
64
  invalid={props.invalid}
@@ -4,8 +4,8 @@ export interface RadioOption {
4
4
  }
5
5
 
6
6
  export const radioOptions: RadioOption[] = [
7
- { label: "Drug", value: true },
8
- { label: "Other", value: false },
7
+ { label: "Pharmaceuticals", value: true },
8
+ { label: "Non Pharmaceuticals", value: false },
9
9
  ];
10
10
 
11
11
  export const expirationOptions: RadioOption[] = [
@@ -15,7 +15,7 @@ import React, { ChangeEvent, useCallback, useState, useEffect } from "react";
15
15
  import styles from "./add-stock-rules.scss";
16
16
  import {
17
17
  useRoles,
18
- useStockLocations,
18
+ useStockTagLocations,
19
19
  } from "../../../stock-lookups/stock-lookups.resource";
20
20
  import { createOrUpdateStockRule } from "./stock-rules.resource";
21
21
  import { StockRule } from "../../../core/api/types/stockItem/StockRule";
@@ -38,7 +38,6 @@ const StockRulesAddOrUpdate: React.FC<AddStockRuleProps> = ({
38
38
  stockItemUuid,
39
39
  }) => {
40
40
  const { t } = useTranslation();
41
- console.warn("Got stock id: ", stockItemUuid);
42
41
 
43
42
  const [stockItemFilter, setStockItemFilter] =
44
43
  useState<StockItemInventoryFilter>({
@@ -59,10 +58,7 @@ const StockRulesAddOrUpdate: React.FC<AddStockRuleProps> = ({
59
58
 
60
59
  const { items: dispensingUnits } = useStockItemPackagingUOMs(stockItemFilter);
61
60
 
62
- //locations
63
- const {
64
- locations: { results: locations },
65
- } = useStockLocations({ v: ResourceRepresentation.Default });
61
+ const { stockLocations } = useStockTagLocations();
66
62
 
67
63
  //Roles
68
64
  const {
@@ -113,8 +109,10 @@ const StockRulesAddOrUpdate: React.FC<AddStockRuleProps> = ({
113
109
  };
114
110
 
115
111
  const onLocationChange = (evt: ChangeEvent<HTMLSelectElement>) => {
116
- const selectedLocation = locations.find((x) => x.uuid === evt.target.value);
117
- setFormModel({ ...formModel, locationUuid: selectedLocation.uuid });
112
+ const selectedLocation = stockLocations.find(
113
+ (x) => x.id === evt.target.value
114
+ );
115
+ setFormModel({ ...formModel, locationUuid: selectedLocation.id });
118
116
  };
119
117
 
120
118
  const onQuantityUnitChange = (evt: ChangeEvent<HTMLSelectElement>) => {
@@ -217,12 +215,12 @@ const StockRulesAddOrUpdate: React.FC<AddStockRuleProps> = ({
217
215
  value=""
218
216
  text={t("chooseLocation", "Choose the location")}
219
217
  />
220
- {locations?.map((location) => {
218
+ {stockLocations?.map((location) => {
221
219
  return (
222
220
  <SelectItem
223
- key={location.uuid}
224
- value={location.uuid}
225
- text={location.display}
221
+ key={location.id}
222
+ value={location.id}
223
+ text={location.name}
226
224
  />
227
225
  );
228
226
  })}
@@ -19,8 +19,12 @@ const FilterStockItems: React.FC<FilterStockItemsProps> = ({
19
19
  className={styles.spacing}
20
20
  >
21
21
  <RadioButton labelText="All" value="" id="is-drug-all" />
22
- <RadioButton labelText="Drugs" value="true" id="is-drug-drug" />
23
- <RadioButton labelText="Other" value="false" id="is-drug-other" />
22
+ <RadioButton labelText="Pharmaceuticals" value="true" id="is-drug-drug" />
23
+ <RadioButton
24
+ labelText="Non Pharmaceuticals"
25
+ value="false"
26
+ id="is-drug-other"
27
+ />
24
28
  </RadioButtonGroup>
25
29
  );
26
30
  };
@@ -118,7 +118,9 @@ const BaseOperationDetails: React.FC<BaseOperationDetailsProps> = ({
118
118
  maxDate={formatForDatePicker(today())}
119
119
  locale="en"
120
120
  dateFormat={DATE_PICKER_CONTROL_FORMAT}
121
- onChange={onChange}
121
+ onChange={([newDate]) => {
122
+ onChange(newDate);
123
+ }}
122
124
  >
123
125
  <DatePickerInput
124
126
  invalid={!!errors.operationDate}
@@ -127,7 +129,7 @@ const BaseOperationDetails: React.FC<BaseOperationDetailsProps> = ({
127
129
  name="operationDate"
128
130
  placeholder={DATE_PICKER_FORMAT}
129
131
  labelText={t("operationDate", "Operation Date")}
130
- value={formatForDatePicker(model?.operationDate)}
132
+ defaultValue={formatForDatePicker(model?.operationDate)}
131
133
  />
132
134
  </DatePicker>
133
135
  )}
@@ -20,5 +20,7 @@
20
20
  "patientGetterExplainer": "Try clicking the button below to fetch a patient from the backend",
21
21
  "resources": "Resources",
22
22
  "usefulLinks": "Below are some links to useful resources",
23
- "welcomeText": "Welcome to the O3 Template app"
23
+ "welcomeText": "Welcome to the O3 Template app",
24
+ "Is a Drug": "Pharmaceuticals",
25
+ "Non Drug": "Non Pharmaceuticals"
24
26
  }