@openmrs/esm-stock-management-app 1.0.1-pre.630 → 1.0.1-pre.635

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. package/.eslintignore +1 -1
  2. package/.husky/pre-commit +0 -3
  3. package/.husky/pre-push +1 -6
  4. package/dist/173.js +1 -1
  5. package/dist/173.js.map +1 -1
  6. package/dist/main.js +1 -1
  7. package/dist/main.js.map +1 -1
  8. package/dist/openmrs-esm-stock-management-app.js.buildmanifest.json +6 -6
  9. package/dist/routes.json +1 -1
  10. package/package.json +4 -2
  11. package/src/core/components/carbon/controlled-number-input/controlled-number-input.component.tsx +1 -0
  12. package/src/stock-batch/stock-batch.resource.ts +2 -2
  13. package/src/stock-home/stock-home-inventory-expiry.resource.tsx +2 -2
  14. package/src/stock-home/stock-home-inventory-items.resource.tsx +2 -2
  15. package/src/stock-home/stock-home-issuing.resource.tsx +2 -2
  16. package/src/stock-home/stock-home-receiving.resource.tsx +2 -2
  17. package/src/stock-home/useDisposalList.tsx +2 -2
  18. package/src/stock-home/useStockList.tsx +2 -2
  19. package/src/stock-items/add-stock-item/batch-information/batch-information.resource.tsx +2 -2
  20. package/src/stock-items/add-stock-item/packaging-units/packaging-units.resource.tsx +2 -2
  21. package/src/stock-items/add-stock-item/quantities/quantities.resource.tsx +2 -2
  22. package/src/stock-items/add-stock-item/stock-item-references/stock-item-references.resource.ts +2 -2
  23. package/src/stock-items/add-stock-item/stock-item-rules/stock-item-rules.resource.tsx +2 -2
  24. package/src/stock-items/add-stock-item/stock-item-rules/stock-rules-filter.component.tsx +2 -2
  25. package/src/stock-items/add-stock-item/stock-item-rules/stock-rules.resource.ts +2 -2
  26. package/src/stock-items/add-stock-item/transactions/transactions.resource.tsx +2 -2
  27. package/src/stock-items/stock-items-table.resource.ts +2 -2
  28. package/src/stock-items/stock-items.resource.ts +9 -9
  29. package/src/stock-lookups/stock-lookups.resource.ts +12 -12
  30. package/src/stock-operations/add-stock-operation/add-stock-operation.component.tsx +2 -2
  31. package/src/stock-operations/add-stock-operation/add-stock-operation.resource.tsx +3 -3
  32. package/src/stock-operations/add-stock-operation/stock-items-addition-row.component.tsx +5 -4
  33. package/src/stock-operations/qty-uom-selector/qty-uom-selector.component.tsx +2 -2
  34. package/src/stock-operations/stock-operation-operations-filter/stock-operation-operations-filter.component.tsx +2 -2
  35. package/src/stock-operations/stock-operation-reason-selector/stock-operation-reason-selector.component.tsx +2 -2
  36. package/src/stock-operations/stock-operation-sources-filter/stock-operation-sources-filter.component.tsx +2 -2
  37. package/src/stock-operations/stock-operation-types-selector/stock-operation-types-selector.component.tsx +2 -2
  38. package/src/stock-operations/stock-operations-table.resource.tsx +2 -2
  39. package/src/stock-operations/stock-operations.resource.ts +3 -3
  40. package/src/stock-reports/generate-report/create-stock-report.component.tsx +3 -2
  41. package/src/stock-reports/stock-reports.resource.ts +2 -2
  42. package/src/stock-sources/stock-sources-filter/stock-sources-filter.component.tsx +2 -2
  43. package/src/stock-sources/stock-sources-items-table.resource.ts +2 -2
  44. package/src/stock-sources/stock-sources.resource.ts +2 -2
  45. package/src/stock-user-role-scopes/stock-user-role-scopes-items-table.resource.ts +2 -2
  46. package/src/stock-user-role-scopes/stock-user-role-scopes.resource.ts +2 -2
@@ -85,9 +85,9 @@
85
85
  "initial": false,
86
86
  "entry": false,
87
87
  "recorded": false,
88
- "size": 1841315,
88
+ "size": 1841242,
89
89
  "sizes": {
90
- "javascript": 1841105,
90
+ "javascript": 1841032,
91
91
  "consume-shared": 210
92
92
  },
93
93
  "names": [],
@@ -101,7 +101,7 @@
101
101
  "auxiliaryFiles": [
102
102
  "173.js.map"
103
103
  ],
104
- "hash": "cfc6763ad2a3bc31",
104
+ "hash": "f2850dca772388be",
105
105
  "childrenByOrder": {}
106
106
  },
107
107
  {
@@ -109,10 +109,10 @@
109
109
  "initial": true,
110
110
  "entry": true,
111
111
  "recorded": false,
112
- "size": 5509742,
112
+ "size": 5509669,
113
113
  "sizes": {
114
114
  "consume-shared": 252,
115
- "javascript": 5487792,
115
+ "javascript": 5487719,
116
116
  "share-init": 252,
117
117
  "runtime": 21446
118
118
  },
@@ -129,7 +129,7 @@
129
129
  "auxiliaryFiles": [
130
130
  "main.js.map"
131
131
  ],
132
- "hash": "4b33e6cb5bea649a",
132
+ "hash": "c7d23e1193b201e4",
133
133
  "childrenByOrder": {}
134
134
  },
135
135
  {
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-nav-menu","slot":"stock-sidebar-slot","component":"stockNavMenu","online":true,"offline":true},{"name":"overview-db-link","slot":"stock-page-dashboard-slot","component":"stockOverviewLink","meta":{"name":"overview","slot":"overview-dashboard-slot","title":"overview"},"order":0,"online":true,"offline":true},{"name":"stock-overview-db","slot":"overview-dashboard-slot","component":"stockOverview"},{"name":"operations-db-link","slot":"stock-page-dashboard-slot","component":"stockOperationsLink","meta":{"name":"operations","slot":"operations-dashboard-slot","title":"operations"},"order":2,"online":true,"offline":true},{"name":"stock-operations-db","slot":"operations-dashboard-slot","component":"stockOperations"},{"name":"items-db-link","slot":"stock-page-dashboard-slot","component":"stockItemsLink","meta":{"name":"items","slot":"items-dashboard-slot","title":"items"},"order":1,"online":true,"offline":true},{"name":"stock-items-db","slot":"items-dashboard-slot","component":"stockItems"},{"name":"user-scopes-db-link","slot":"stock-page-dashboard-slot","component":"stockUserScopesLink","meta":{"name":"user-scopes","slot":"user-scopes-dashboard-slot","title":"user-scopes"},"order":3,"online":true,"offline":true},{"name":"stock-user-scopes-db","slot":"user-scopes-dashboard-slot","component":"stockUserScopes"},{"name":"sources-db-link","slot":"stock-page-dashboard-slot","component":"stockSourcesLink","meta":{"name":"sources","slot":"sources-dashboard-slot","title":"Sources"},"order":2,"online":true,"offline":true},{"name":"stock-sources-db","slot":"sources-dashboard-slot","component":"stockSources"},{"name":"locations-db-link","slot":"stock-page-dashboard-slot","component":"stockLocationsLink","meta":{"name":"locations","slot":"locations-dashboard-slot","title":"Locations"},"order":4,"online":true,"offline":true},{"name":"stock-locations-db","slot":"locations-dashboard-slot","component":"stockLocations"},{"name":"reports-db-link","slot":"stock-page-dashboard-slot","component":"stockReportsLink","meta":{"name":"reports","slot":"reports-dashboard-slot","title":"Reports"},"order":5,"online":true,"offline":true},{"name":"stock-reports-db","slot":"reports-dashboard-slot","component":"stockReports"},{"name":"settings-db-link","slot":"stock-page-dashboard-slot","component":"stockSettingsLink","meta":{"name":"settings","slot":"settings-dashboard-slot","title":"Settings"},"order":6,"online":true,"offline":true},{"name":"stock-settings-db","slot":"settings-dashboard-slot","component":"stockSettings"},{"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":"root","route":"stock-management"}],"version":"1.0.1-pre.630"}
1
+ {"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"fhir2":">=1.2","webservices.rest":"^2.24.0"},"extensions":[{"name":"stock-nav-menu","slot":"stock-sidebar-slot","component":"stockNavMenu","online":true,"offline":true},{"name":"overview-db-link","slot":"stock-page-dashboard-slot","component":"stockOverviewLink","meta":{"name":"overview","slot":"overview-dashboard-slot","title":"overview"},"order":0,"online":true,"offline":true},{"name":"stock-overview-db","slot":"overview-dashboard-slot","component":"stockOverview"},{"name":"operations-db-link","slot":"stock-page-dashboard-slot","component":"stockOperationsLink","meta":{"name":"operations","slot":"operations-dashboard-slot","title":"operations"},"order":2,"online":true,"offline":true},{"name":"stock-operations-db","slot":"operations-dashboard-slot","component":"stockOperations"},{"name":"items-db-link","slot":"stock-page-dashboard-slot","component":"stockItemsLink","meta":{"name":"items","slot":"items-dashboard-slot","title":"items"},"order":1,"online":true,"offline":true},{"name":"stock-items-db","slot":"items-dashboard-slot","component":"stockItems"},{"name":"user-scopes-db-link","slot":"stock-page-dashboard-slot","component":"stockUserScopesLink","meta":{"name":"user-scopes","slot":"user-scopes-dashboard-slot","title":"user-scopes"},"order":3,"online":true,"offline":true},{"name":"stock-user-scopes-db","slot":"user-scopes-dashboard-slot","component":"stockUserScopes"},{"name":"sources-db-link","slot":"stock-page-dashboard-slot","component":"stockSourcesLink","meta":{"name":"sources","slot":"sources-dashboard-slot","title":"Sources"},"order":2,"online":true,"offline":true},{"name":"stock-sources-db","slot":"sources-dashboard-slot","component":"stockSources"},{"name":"locations-db-link","slot":"stock-page-dashboard-slot","component":"stockLocationsLink","meta":{"name":"locations","slot":"locations-dashboard-slot","title":"Locations"},"order":4,"online":true,"offline":true},{"name":"stock-locations-db","slot":"locations-dashboard-slot","component":"stockLocations"},{"name":"reports-db-link","slot":"stock-page-dashboard-slot","component":"stockReportsLink","meta":{"name":"reports","slot":"reports-dashboard-slot","title":"Reports"},"order":5,"online":true,"offline":true},{"name":"stock-reports-db","slot":"reports-dashboard-slot","component":"stockReports"},{"name":"settings-db-link","slot":"stock-page-dashboard-slot","component":"stockSettingsLink","meta":{"name":"settings","slot":"settings-dashboard-slot","title":"Settings"},"order":6,"online":true,"offline":true},{"name":"stock-settings-db","slot":"settings-dashboard-slot","component":"stockSettings"},{"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":"root","route":"stock-management"}],"version":"1.0.1-pre.635"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openmrs/esm-stock-management-app",
3
- "version": "1.0.1-pre.630",
3
+ "version": "1.0.1-pre.635",
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",
@@ -18,7 +18,8 @@
18
18
  "verify": "turbo run lint typescript coverage",
19
19
  "coverage": "yarn test --coverage",
20
20
  "prepare": "husky install",
21
- "extract-translations": "i18next 'src/**/*.component.tsx' 'src/**/*.tsx' --config ./i18next-parser.config.js"
21
+ "extract-translations": "i18next 'src/**/*.component.tsx' 'src/**/*.tsx' --config ./i18next-parser.config.js",
22
+ "postinstall": "husky"
22
23
  },
23
24
  "browserslist": [
24
25
  "extends browserslist-config-openmrs"
@@ -83,6 +84,7 @@
83
84
  "eslint": "^8.44.0",
84
85
  "eslint-plugin-react-hooks": "^4.6.2",
85
86
  "eslint-plugin-testing-library": "^6.3.0",
87
+ "husky": "^9.1.6",
86
88
  "i18next": "^23.2.8",
87
89
  "i18next-parser": "^8.0.0",
88
90
  "identity-obj-proxy": "^3.0.0",
@@ -19,6 +19,7 @@ const ControlledNumberInput = <T,>(props: ControlledNumberInputProps<T>) => {
19
19
  control={props.control}
20
20
  render={({ field: { onChange, value, ref } }) => (
21
21
  <NumberInput
22
+ disableWheel
22
23
  label={props.label}
23
24
  id={`${props.name}-${props.id}-${props.row?.uuid}`}
24
25
  value={props.row?.factor ?? value}
@@ -23,7 +23,7 @@ export function useBatchJobs(filter: BatchJobFilter) {
23
23
  return {
24
24
  items: data.data ? data.data : [],
25
25
  isLoading,
26
- isError: error,
26
+ error,
27
27
  };
28
28
  }
29
29
 
@@ -68,6 +68,6 @@ export function useReportTypes() {
68
68
  return {
69
69
  items: data.data ? data.data : [],
70
70
  isLoading,
71
- isError: error,
71
+ error,
72
72
  };
73
73
  }
@@ -22,11 +22,11 @@ export function useStockInventory() {
22
22
  });
23
23
  }, []);
24
24
 
25
- const { items, isLoading, isError } = useStockBatches(stockItemFilter);
25
+ const { items, isLoading, error } = useStockBatches(stockItemFilter);
26
26
 
27
27
  return {
28
28
  items: items.results ?? [],
29
29
  isLoading,
30
- isError,
30
+ error,
31
31
  };
32
32
  }
@@ -8,7 +8,7 @@ export function useStockInventoryItems(v?: ResourceRepresentation) {
8
8
  totalCount: true,
9
9
  });
10
10
 
11
- const { items, isLoading, isError } = useStockItems(stockItemFilter);
11
+ const { items, isLoading, error } = useStockItems(stockItemFilter);
12
12
 
13
13
  useEffect(() => {
14
14
  setStockItemFilter({
@@ -20,6 +20,6 @@ export function useStockInventoryItems(v?: ResourceRepresentation) {
20
20
  return {
21
21
  items: items?.results ?? [],
22
22
  isLoading,
23
- isError,
23
+ error,
24
24
  };
25
25
  }
@@ -1,7 +1,7 @@
1
1
  import { StockOperationFilter, useStockOperations } from '../stock-operations/stock-operations.resource';
2
2
 
3
3
  export function useStockIssuing(filter: StockOperationFilter) {
4
- const { items, isLoading, isError } = useStockOperations(filter);
4
+ const { items, isLoading, error } = useStockOperations(filter);
5
5
 
6
6
  const receivedItems = items?.results?.filter(
7
7
  (item) => item?.operationType === 'stockissue' && item?.status !== 'COMPLETED',
@@ -9,6 +9,6 @@ export function useStockIssuing(filter: StockOperationFilter) {
9
9
  return {
10
10
  items: receivedItems,
11
11
  isLoading,
12
- isError,
12
+ error,
13
13
  };
14
14
  }
@@ -1,7 +1,7 @@
1
1
  import { StockOperationFilter, useStockOperations } from '../stock-operations/stock-operations.resource';
2
2
 
3
3
  export function useStockReceiving(filter: StockOperationFilter) {
4
- const { items, isLoading, isError } = useStockOperations(filter);
4
+ const { items, isLoading, error } = useStockOperations(filter);
5
5
 
6
6
  const receivedItems = items?.results?.filter(
7
7
  (item) => item?.operationType === 'receipt' && item?.status !== 'COMPLETED',
@@ -9,6 +9,6 @@ export function useStockReceiving(filter: StockOperationFilter) {
9
9
  return {
10
10
  items: receivedItems,
11
11
  isLoading,
12
- isError,
12
+ error,
13
13
  };
14
14
  }
@@ -1,13 +1,13 @@
1
1
  import { StockOperationFilter, useStockOperations } from '../stock-operations/stock-operations.resource';
2
2
 
3
3
  export function useDisposalList(filter: StockOperationFilter) {
4
- const { items, isLoading, isError } = useStockOperations(filter);
4
+ const { items, isLoading, error } = useStockOperations(filter);
5
5
 
6
6
  const receivedItems = items?.results?.filter((item) => item?.operationType === 'disposed');
7
7
 
8
8
  return {
9
9
  items: receivedItems,
10
10
  isLoading,
11
- isError,
11
+ error,
12
12
  };
13
13
  }
@@ -15,7 +15,7 @@ interface StockList {
15
15
  const useStockList = () => {
16
16
  const url = `${restBaseUrl}/stockmanagement/stockitem?v=default&totalCount=true`;
17
17
 
18
- const { data, error } = useSWR<{ data: { results: Array<StockList> } }>(url, openmrsFetch);
18
+ const { data, error, isLoading } = useSWR<{ data: { results: Array<StockList> } }>(url, openmrsFetch);
19
19
 
20
20
  const stocks = data?.data.results.map((stock) => ({
21
21
  uuid: stock.uuid,
@@ -25,7 +25,7 @@ const useStockList = () => {
25
25
 
26
26
  return {
27
27
  stockList: (stocks as Array<any>) ?? [],
28
- isLoading: !data && !error,
28
+ isLoading,
29
29
  error,
30
30
  };
31
31
  };
@@ -38,7 +38,7 @@ export function useStockItemBatchInformationHook(filter?: StockItemInventoryFilt
38
38
  });
39
39
  }, [searchString, currentPage, currentPageSize, stockItemUuid, partyUuid, locationUuid, stockBatchUuid]);
40
40
 
41
- const { items, isLoading, isError } = useStockItemInventory(stockItemFilter);
41
+ const { items, isLoading, error } = useStockItemInventory(stockItemFilter);
42
42
 
43
43
  return {
44
44
  items: items.results ?? [],
@@ -49,7 +49,7 @@ export function useStockItemBatchInformationHook(filter?: StockItemInventoryFilt
49
49
  setPageSize,
50
50
  pageSizes,
51
51
  isLoading,
52
- isError,
52
+ error,
53
53
  setSearchString,
54
54
  setStockItemUuid,
55
55
  setLocationUuid,
@@ -21,13 +21,13 @@ export function useStockItemPackageUnitsHook(v?: ResourceRepresentation) {
21
21
  });
22
22
  }, [stockItemUuid]);
23
23
 
24
- const { items, isLoading, isError, mutate } = useStockItemPackagingUOMs(stockItemFilter);
24
+ const { items, isLoading, error, mutate } = useStockItemPackagingUOMs(stockItemFilter);
25
25
 
26
26
  return {
27
27
  items: items.results,
28
28
  totalCount: items.totalCount,
29
29
  isLoading,
30
- isError,
30
+ error,
31
31
  setStockItemUuid,
32
32
  mutate,
33
33
  };
@@ -36,7 +36,7 @@ export function useStockItemQuantitiesHook(v?: ResourceRepresentation) {
36
36
  });
37
37
  }, [searchString, currentPage, currentPageSize, stockItemUuid, partyUuid, locationUuid, stockBatchUuid]);
38
38
 
39
- const { items, isLoading, isError } = useStockItemInventory(stockItemFilter);
39
+ const { items, isLoading, error } = useStockItemInventory(stockItemFilter);
40
40
 
41
41
  return {
42
42
  items: items.results ?? [],
@@ -47,7 +47,7 @@ export function useStockItemQuantitiesHook(v?: ResourceRepresentation) {
47
47
  setPageSize,
48
48
  pageSizes,
49
49
  isLoading,
50
- isError,
50
+ error,
51
51
  setSearchString,
52
52
  setStockItemUuid,
53
53
  setLocationUuid,
@@ -21,13 +21,13 @@ export function useStockItemReferencesHook(v?: ResourceRepresentation) {
21
21
  });
22
22
  }, [stockItemUuid]);
23
23
 
24
- const { items, isLoading, isError } = useStockItemReferences(stockItemReferenceFilter);
24
+ const { items, isLoading, error } = useStockItemReferences(stockItemReferenceFilter);
25
25
 
26
26
  return {
27
27
  items: items.results,
28
28
  totalCount: items.totalCount,
29
29
  isLoading,
30
- isError,
30
+ error,
31
31
  setStockItemUuid,
32
32
  };
33
33
  }
@@ -3,7 +3,7 @@ import { StockRuleFilter, useStockRules } from '../../stock-items.resource';
3
3
  import { usePagination } from '@openmrs/esm-framework';
4
4
 
5
5
  export function useStockItemRules(filter: StockRuleFilter) {
6
- const { items, isLoading, isError } = useStockRules(filter);
6
+ const { items, isLoading, error } = useStockRules(filter);
7
7
 
8
8
  const pageSizes = [10, 20, 30, 40, 50];
9
9
  const [currentPageSize, setPageSize] = useState(10);
@@ -61,7 +61,7 @@ export function useStockItemRules(filter: StockRuleFilter) {
61
61
  goTo,
62
62
  pageSizes,
63
63
  isLoading,
64
- isError,
64
+ error,
65
65
  setPageSize,
66
66
  tableHeaders,
67
67
  };
@@ -9,13 +9,13 @@ interface StockRulesFilterProps {
9
9
  }
10
10
 
11
11
  const StockRulesFilter: React.FC<StockRulesFilterProps> = ({ stockItemUuid }) => {
12
- const { items, isLoading, isError } = useStockRules({
12
+ const { items, isLoading, error } = useStockRules({
13
13
  v: ResourceRepresentation.Default,
14
14
  totalCount: true,
15
15
  stockItemUuid: stockItemUuid,
16
16
  });
17
17
 
18
- if (isLoading || isError) {
18
+ if (isLoading || error) {
19
19
  return <DropdownSkeleton />;
20
20
  }
21
21
  return (
@@ -17,7 +17,7 @@ export function useStockRules(filter: StockSourceFilter) {
17
17
  return {
18
18
  items: data?.data || <PageableResult<StockRule>>{},
19
19
  isLoading,
20
- isError: error,
20
+ error,
21
21
  };
22
22
  }
23
23
 
@@ -28,7 +28,7 @@ export function useStockRule(id: string) {
28
28
  return {
29
29
  items: data.data ? data.data : [],
30
30
  isLoading,
31
- isError: error,
31
+ error,
32
32
  };
33
33
  }
34
34
 
@@ -36,7 +36,7 @@ export function useStockItemsTransactions(filter?: StockItemInventoryFilter) {
36
36
  });
37
37
  }, [searchString, currentPage, currentPageSize, stockItemUuid, partyUuid, locationUuid, stockBatchUuid]);
38
38
 
39
- const { items, isLoading, isError } = useStockItemTransactions(stockItemFilter);
39
+ const { items, isLoading, error } = useStockItemTransactions(stockItemFilter);
40
40
 
41
41
  const tableHeaders = useMemo(
42
42
  () => [
@@ -85,7 +85,7 @@ export function useStockItemsTransactions(filter?: StockItemInventoryFilter) {
85
85
  setPageSize,
86
86
  pageSizes,
87
87
  isLoading,
88
- isError,
88
+ error,
89
89
  setSearchString,
90
90
  tableHeaders,
91
91
  setStockItemUuid,
@@ -23,7 +23,7 @@ export function useStockItemsPages(v?: ResourceRepresentation) {
23
23
  totalCount: true,
24
24
  });
25
25
 
26
- const { items, isLoading, isError } = useStockItems(stockItemFilter);
26
+ const { items, isLoading, error } = useStockItems(stockItemFilter);
27
27
  const pagination = usePagination(items.results, currentPageSize);
28
28
 
29
29
  useEffect(() => {
@@ -47,7 +47,7 @@ export function useStockItemsPages(v?: ResourceRepresentation) {
47
47
  setPageSize,
48
48
  pageSizes,
49
49
  isLoading,
50
- isError,
50
+ error,
51
51
  isDrug,
52
52
  setDrug: (drug: string) => {
53
53
  setCurrentPage(1);
@@ -77,7 +77,7 @@ export function useStockItems(filter: StockItemFilter) {
77
77
  return {
78
78
  items: data?.data || <PageableResult<StockItemDTO>>{},
79
79
  isLoading,
80
- isError: error,
80
+ error,
81
81
  };
82
82
  }
83
83
 
@@ -100,7 +100,7 @@ export function useStockItemTransactions(filter: StockItemTransactionFilter) {
100
100
  return {
101
101
  items: data?.data || <PageableResult<StockItemTransactionDTO>>{},
102
102
  isLoading,
103
- isError: error,
103
+ error,
104
104
  };
105
105
  }
106
106
 
@@ -117,7 +117,7 @@ export function useStockItemInventory(filter: StockItemInventoryFilter) {
117
117
  return {
118
118
  items: data?.data || <StockInventoryResult>{},
119
119
  isLoading,
120
- isError: error,
120
+ error,
121
121
  };
122
122
  }
123
123
 
@@ -133,7 +133,7 @@ export function useStockOperationItemsCost(filter: string) {
133
133
  return {
134
134
  items: data.data ? data.data : [],
135
135
  isLoading,
136
- isError: error,
136
+ error,
137
137
  };
138
138
  }
139
139
 
@@ -149,7 +149,7 @@ export function useStockBatches(filter: StockBatchFilter) {
149
149
  return {
150
150
  items: data?.data || <PageableResult<StockBatchDTO>>{},
151
151
  isLoading,
152
- isError: error,
152
+ error,
153
153
  };
154
154
  }
155
155
 
@@ -166,7 +166,7 @@ export function useStockItemPackagingUOMs(filter: StockItemPackagingUOMFilter) {
166
166
  return {
167
167
  items: data?.data || <PageableResult<StockItemPackagingUOMDTO>>{},
168
168
  isLoading,
169
- isError: error,
169
+ error,
170
170
  mutate,
171
171
  };
172
172
  }
@@ -183,7 +183,7 @@ export function useStockItem(id: string) {
183
183
  return {
184
184
  item: data?.data || <StockItemDTO>{},
185
185
  isLoading,
186
- isError: error,
186
+ error,
187
187
  };
188
188
  }
189
189
 
@@ -312,7 +312,7 @@ export function useStockRules(filter: StockRuleFilter) {
312
312
  return {
313
313
  items: data?.data || <PageableResult<StockRule>>{},
314
314
  isLoading,
315
- isError: error,
315
+ error,
316
316
  };
317
317
  }
318
318
 
@@ -371,7 +371,7 @@ export function useStockItemReferences(filter: StockItemReferenceFilter) {
371
371
  return {
372
372
  items: data?.data || <PageableResult<StockItemReferenceDTO>>{},
373
373
  isLoading,
374
- isError: error,
374
+ error,
375
375
  };
376
376
  }
377
377
 
@@ -48,7 +48,7 @@ export function useStockLocations(filter: LocationFilterCriteria) {
48
48
  >(apiUrl, openmrsFetch);
49
49
  return {
50
50
  locations: data?.data || <PageableResult<OpenMRSLocation>>{},
51
- isErrorLocation: error,
51
+ errorLocation: error,
52
52
  isLoadingLocations: isLoading,
53
53
  };
54
54
  }
@@ -81,7 +81,7 @@ export function useLocationWithIdByUuid(id: string) {
81
81
  return {
82
82
  items: data.data ? data.data : [],
83
83
  isLoading,
84
- isError: error,
84
+ error,
85
85
  };
86
86
  }
87
87
 
@@ -110,7 +110,7 @@ export function useLocationTags(q: string) {
110
110
  return {
111
111
  items: data.data ? data.data : [],
112
112
  isLoading,
113
- isError: error,
113
+ error,
114
114
  };
115
115
  }
116
116
 
@@ -126,7 +126,7 @@ export function useRoles(filter: ResourceFilterCriteria) {
126
126
  return {
127
127
  items: data?.data || <PageableResult<Role>>{},
128
128
  isLoading,
129
- isError: error,
129
+ error,
130
130
  };
131
131
  }
132
132
 
@@ -142,7 +142,7 @@ export function useStockOperationTypes() {
142
142
  return {
143
143
  types: data?.data || <PageableResult<StockOperationType>>{},
144
144
  isLoading,
145
- isError: error,
145
+ error,
146
146
  };
147
147
  }
148
148
 
@@ -163,7 +163,7 @@ export function useUsers(filter: UserFilterCriteria) {
163
163
  return {
164
164
  items: data?.data || <PageableResult<User>>{},
165
165
  isLoading,
166
- isError: error,
166
+ error,
167
167
  };
168
168
  }
169
169
 
@@ -179,7 +179,7 @@ export function useUser(id: string) {
179
179
  return {
180
180
  data: data?.data || <User>{},
181
181
  isLoading,
182
- isError: error,
182
+ error,
183
183
  };
184
184
  }
185
185
 
@@ -194,7 +194,7 @@ export function useConcept(conceptUuid: string) {
194
194
  return {
195
195
  items: data?.data || <Concept>{},
196
196
  isLoading,
197
- isError: error,
197
+ error,
198
198
  };
199
199
  }
200
200
 
@@ -210,7 +210,7 @@ export function useParties() {
210
210
  return {
211
211
  items: data?.data || <PageableResult<Party>>{},
212
212
  isLoading,
213
- isError: error,
213
+ error,
214
214
  };
215
215
  }
216
216
 
@@ -231,7 +231,7 @@ export function useDrugs(filter: DrugFilterCriteria) {
231
231
  return {
232
232
  items: data?.data || <PageableResult<Drug>>{},
233
233
  isLoading,
234
- isError: error,
234
+ error,
235
235
  };
236
236
  }
237
237
 
@@ -247,7 +247,7 @@ export function useConcepts(filter: ConceptFilterCriteria) {
247
247
  return {
248
248
  items: data?.data || <PageableResult<Concept>>{},
249
249
  isLoading,
250
- isError: error,
250
+ error,
251
251
  };
252
252
  }
253
253
 
@@ -263,7 +263,7 @@ export function usePatients(filter: ConceptFilterCriteria) {
263
263
  return {
264
264
  items: data.data ? data.data : [],
265
265
  isLoading,
266
- isError: error,
266
+ error,
267
267
  };
268
268
  }
269
269
 
@@ -37,7 +37,7 @@ import { StockOperationLinkDTO } from '../../core/api/types/stockOperation/Stock
37
37
  const AddStockOperation: React.FC<AddStockOperationProps> = (props) => {
38
38
  const { t } = useTranslation();
39
39
  const { isEditing, canEdit, canPrint } = props;
40
- const { isLoading, isError, result } = useInitializeStockOperations(props);
40
+ const { isLoading, error, result } = useInitializeStockOperations(props);
41
41
  const [operationLinks, setOperationLinks] = useState<StockOperationLinkDTO[]>();
42
42
  const [manageStockItems, setManageStockItems] = useState(props?.isEditing);
43
43
  const { types } = useStockOperationTypes();
@@ -85,7 +85,7 @@ const AddStockOperation: React.FC<AddStockOperationProps> = (props) => {
85
85
  }, [props?.model?.permission]);
86
86
 
87
87
  if (isLoading) return <AccordionSkeleton />;
88
- if (isError) {
88
+ if (error) {
89
89
  closeOverlay();
90
90
  showSnackbar({
91
91
  kind: 'error',
@@ -4,7 +4,7 @@ import { AddStockOperationProps, InitializeResult } from './types';
4
4
 
5
5
  export const useInitializeStockOperations = (props: AddStockOperationProps) => {
6
6
  const [isLoading, setIsLoading] = useState(true);
7
- const [isError, setIsError] = useState(false);
7
+ const [error, setError] = useState(false);
8
8
  const [result, setResult] = useState<InitializeResult>();
9
9
 
10
10
  useEffect(() => {
@@ -15,13 +15,13 @@ export const useInitializeStockOperations = (props: AddStockOperationProps) => {
15
15
  setIsLoading(false);
16
16
  })
17
17
  .catch(() => {
18
- setIsError(true);
18
+ setError(true);
19
19
  });
20
20
  }, [props.model, props.operation, props.operations]);
21
21
 
22
22
  return {
23
23
  isLoading,
24
- isError,
24
+ error,
25
25
  result,
26
26
  };
27
27
  };
@@ -3,7 +3,6 @@ import { isDesktop } from '@openmrs/esm-framework';
3
3
  import { Button, DatePicker, DatePickerInput, Link, NumberInput, TableCell, TableRow, TextInput } from '@carbon/react';
4
4
  import { TrashCan } from '@carbon/react/icons';
5
5
  import { StockOperationItemFormData } from '../validation-schema';
6
- import StockItemSelector from '../stock-item-selector/stock-item-selector.component';
7
6
  import {
8
7
  Control,
9
8
  FieldArrayWithId,
@@ -217,11 +216,12 @@ const StockItemsAdditionRow: React.FC<StockItemsAdditionRowProps> = ({
217
216
  <div className={styles.cellContent}>
218
217
  {canEdit && (
219
218
  <NumberInput
219
+ allowEmpty
220
220
  className="small-placeholder-text"
221
+ disableWheel
222
+ hideSteppers
221
223
  size="sm"
222
224
  id={`qty-${row?.uuid}`}
223
- hideSteppers={true}
224
- allowEmpty={true}
225
225
  onChange={(e: any) => setValue(`stockItems.${index}.quantity`, e?.target?.value)}
226
226
  value={row?.quantity ?? ''}
227
227
  invalidText={errors?.stockItems?.[index]?.quantity?.message}
@@ -262,11 +262,12 @@ const StockItemsAdditionRow: React.FC<StockItemsAdditionRowProps> = ({
262
262
  <div className={styles.cellContent}>
263
263
  {canEdit && (
264
264
  <NumberInput
265
+ allowEmpty
266
+ disableWheel
265
267
  size="sm"
266
268
  invalid={!!errors?.stockItems?.[index]?.purchasePrice}
267
269
  invalidText=""
268
270
  id={`purchaseprice-${row.uuid}`}
269
- allowEmpty={true}
270
271
  onChange={(e: any) => setValue(`stockItems.${index}.purchasePrice`, e?.target?.value)}
271
272
  value={row?.purchasePrice ?? ''}
272
273
  title=""