@openmrs/esm-stock-management-app 1.0.1-pre.411 → 1.0.1-pre.417

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": 1033865,
35
+ "size": 1033781,
36
36
  "sizes": {
37
- "javascript": 1033655,
37
+ "javascript": 1033571,
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": "36d7594192fbb296",
51
+ "hash": "eeb1734d0a851954",
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": 4725045,
113
+ "size": 4724961,
114
114
  "sizes": {
115
115
  "consume-shared": 252,
116
- "javascript": 4703097,
116
+ "javascript": 4703013,
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": "ae5edd249b6c153d",
133
+ "hash": "46366f56eb7924f5",
134
134
  "childrenByOrder": {}
135
135
  },
136
136
  {
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.411"}
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.417"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openmrs/esm-stock-management-app",
3
- "version": "1.0.1-pre.411",
3
+ "version": "1.0.1-pre.417",
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/";
@@ -20,6 +20,7 @@ const ControlledNumberInput = <T,>(props: ControlledNumberInputProps<T>) => {
20
20
  <NumberInput
21
21
  id={`${props.name}-${props.row?.id}-${props.row?.uuid}`}
22
22
  value={props.row?.factor ?? value}
23
+ min={props.min}
23
24
  ref={ref}
24
25
  onChange={(
25
26
  event: React.MouseEvent<HTMLButtonElement>,
@@ -174,6 +174,7 @@ const PackagingUnitRow: React.FC<{
174
174
  control,
175
175
  formState: { errors },
176
176
  } = useFormContext();
177
+ const minPackagingQuantity = 0;
177
178
 
178
179
  return (
179
180
  <>
@@ -198,6 +199,7 @@ const PackagingUnitRow: React.FC<{
198
199
  row={row}
199
200
  controllerName="factor"
200
201
  name="factor"
202
+ min={minPackagingQuantity}
201
203
  control={control}
202
204
  id={`${row.uuid}-${key}`}
203
205
  invalid={!!errors.factor}
@@ -172,6 +172,7 @@ const StockItemDetails = forwardRef<never, StockItemDetailsProps>(
172
172
  name="expiryNotice"
173
173
  control={control}
174
174
  controllerName="expiryNotice"
175
+ min={0}
175
176
  size={"md"}
176
177
  allowEmpty={true}
177
178
  label={t("expiryNoticeDays", "Expiration Notice (days)")}
@@ -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
  })}