@openmrs/esm-stock-management-app 1.0.1-pre.692 → 1.0.1-pre.702

Sign up to get free protection for your applications and to get access to all the features.
@@ -134,10 +134,10 @@
134
134
  "initial": true,
135
135
  "entry": true,
136
136
  "recorded": false,
137
- "size": 5407793,
137
+ "size": 5408566,
138
138
  "sizes": {
139
139
  "consume-shared": 252,
140
- "javascript": 5385844,
140
+ "javascript": 5386617,
141
141
  "share-init": 252,
142
142
  "runtime": 21445
143
143
  },
@@ -154,7 +154,7 @@
154
154
  "auxiliaryFiles": [
155
155
  "main.js.map"
156
156
  ],
157
- "hash": "b6ba4ea06ac17137",
157
+ "hash": "bde00c76e90fc524",
158
158
  "childrenByOrder": {}
159
159
  },
160
160
  {
@@ -326,9 +326,9 @@
326
326
  "initial": false,
327
327
  "entry": false,
328
328
  "recorded": false,
329
- "size": 11501,
329
+ "size": 11531,
330
330
  "sizes": {
331
- "javascript": 11501
331
+ "javascript": 11531
332
332
  },
333
333
  "names": [],
334
334
  "idHints": [],
@@ -340,7 +340,7 @@
340
340
  "574.js"
341
341
  ],
342
342
  "auxiliaryFiles": [],
343
- "hash": "b881a6484ecb0d98",
343
+ "hash": "882eba03e470bb3e",
344
344
  "childrenByOrder": {}
345
345
  },
346
346
  {
@@ -607,9 +607,9 @@
607
607
  "initial": false,
608
608
  "entry": false,
609
609
  "recorded": false,
610
- "size": 1748921,
610
+ "size": 1749694,
611
611
  "sizes": {
612
- "javascript": 1748711,
612
+ "javascript": 1749484,
613
613
  "consume-shared": 210
614
614
  },
615
615
  "names": [],
@@ -623,7 +623,7 @@
623
623
  "auxiliaryFiles": [
624
624
  "973.js.map"
625
625
  ],
626
- "hash": "f060b14379d6e58f",
626
+ "hash": "4e40bb4e6400af3e",
627
627
  "childrenByOrder": {}
628
628
  }
629
629
  ]
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-management-app-menu-item","component":"stockManagementAppMenuItem","slot":"app-menu-item-slot","meta":{"name":" Stock Management"}},{"name":"delete-packaging-unit-button","component":"deletePackagingUnitButton"}],"modals":[{"name":"delete-stock-modal","component":"deleteStockModal"},{"name":"delete-stock-user-scope-modal","component":"deleteUserScopeModal"},{"name":"delete-stock-rule-modal","component":"deleteStockRuleModal"},{"name":"delete-packaging-unit-modal","component":"deletePackagingUnitModal"},{"name":"import-bulk-stock-items","component":"importBulkStockItemsModal"},{"name":"stock-operation-dialog","component":"stockOperationModal"}],"pages":[{"component":"root","route":"stock-management"}],"version":"1.0.1-pre.692"}
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-management-app-menu-item","component":"stockManagementAppMenuItem","slot":"app-menu-item-slot","meta":{"name":" Stock Management"}},{"name":"delete-packaging-unit-button","component":"deletePackagingUnitButton"}],"modals":[{"name":"delete-stock-modal","component":"deleteStockModal"},{"name":"delete-stock-user-scope-modal","component":"deleteUserScopeModal"},{"name":"delete-stock-rule-modal","component":"deleteStockRuleModal"},{"name":"delete-packaging-unit-modal","component":"deletePackagingUnitModal"},{"name":"import-bulk-stock-items","component":"importBulkStockItemsModal"},{"name":"stock-operation-dialog","component":"stockOperationModal"}],"pages":[{"component":"root","route":"stock-management"}],"version":"1.0.1-pre.702"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openmrs/esm-stock-management-app",
3
- "version": "1.0.1-pre.692",
3
+ "version": "1.0.1-pre.702",
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",
@@ -133,48 +133,55 @@ const StockOperations: React.FC<StockOperationsTableProps> = () => {
133
133
  );
134
134
 
135
135
  const tableRows = useMemo(() => {
136
- return items?.map((stockOperation, index) => ({
137
- ...stockOperation,
138
- id: stockOperation?.uuid,
139
- key: `key-${stockOperation?.uuid}`,
140
- operationTypeName: `${stockOperation?.operationTypeName}`,
141
- operationNumber: (
142
- <EditStockOperationActionMenu
143
- model={stockOperation}
144
- operations={operations}
145
- operationUuid={operation.uuid}
146
- operationNumber={''}
147
- onEdit={() => handleEditClick(stockOperation, true)}
148
- showIcon={false}
149
- showprops={true}
150
- />
151
- ),
152
- status: `${stockOperation?.status}`,
153
- source: `${stockOperation?.sourceName ?? ''}`,
154
- destination: `${stockOperation?.destinationName ?? ''}`,
155
- location: (
156
- <>
157
- {stockOperation?.sourceName ?? ''}
158
- {stockOperation?.sourceName && stockOperation?.destinationName ? <ArrowRight size={16} /> : ''}{' '}
159
- {stockOperation?.destinationName ?? ''}
160
- </>
161
- ),
162
- responsiblePerson: `${
163
- stockOperation?.responsiblePersonFamilyName ?? stockOperation?.responsiblePersonOther ?? ''
164
- } ${stockOperation?.responsiblePersonGivenName ?? ''}`,
165
- operationDate: formatDisplayDate(stockOperation?.operationDate),
166
- actions: (
167
- <EditStockOperationActionMenu
168
- model={stockOperation}
169
- operations={operations}
170
- operationUuid={operation.uuid}
171
- operationNumber={''}
172
- onEdit={() => handleEditClick(stockOperation, true)}
173
- showIcon={true}
174
- showprops={false}
175
- />
176
- ),
177
- }));
136
+ return items?.map((stockOperation, index) => {
137
+ const commonNames = stockOperation?.stockOperationItems
138
+ ? stockOperation?.stockOperationItems.map((item) => item.commonName).join(', ')
139
+ : '';
140
+
141
+ return {
142
+ ...stockOperation,
143
+ id: stockOperation?.uuid,
144
+ key: `key-${stockOperation?.uuid}`,
145
+ operationTypeName: `${stockOperation?.operationTypeName}`,
146
+ operationNumber: (
147
+ <EditStockOperationActionMenu
148
+ model={stockOperation}
149
+ operations={operations}
150
+ operationUuid={operation.uuid}
151
+ operationNumber={''}
152
+ onEdit={() => handleEditClick(stockOperation, true)}
153
+ showIcon={false}
154
+ showprops={true}
155
+ />
156
+ ),
157
+ stockOperationItems: commonNames,
158
+ status: `${stockOperation?.status}`,
159
+ source: `${stockOperation?.sourceName ?? ''}`,
160
+ destination: `${stockOperation?.destinationName ?? ''}`,
161
+ location: (
162
+ <>
163
+ {stockOperation?.sourceName ?? ''}
164
+ {stockOperation?.sourceName && stockOperation?.destinationName ? <ArrowRight size={16} /> : ''}{' '}
165
+ {stockOperation?.destinationName ?? ''}
166
+ </>
167
+ ),
168
+ responsiblePerson: `${
169
+ stockOperation?.responsiblePersonFamilyName ?? stockOperation?.responsiblePersonOther ?? ''
170
+ } ${stockOperation?.responsiblePersonGivenName ?? ''}`,
171
+ operationDate: formatDisplayDate(stockOperation?.operationDate),
172
+ actions: (
173
+ <EditStockOperationActionMenu
174
+ model={stockOperation}
175
+ operations={operations}
176
+ operationUuid={operation.uuid}
177
+ operationNumber={''}
178
+ onEdit={() => handleEditClick(stockOperation, true)}
179
+ showIcon={true}
180
+ showprops={false}
181
+ />
182
+ ),
183
+ };
184
+ });
178
185
  }, [items, operations, handleEditClick, operation]);
179
186
 
180
187
  if (isLoading && !filterApplied) {
@@ -8,6 +8,7 @@ export function useStockOperationPages(filter: StockOperationFilter) {
8
8
 
9
9
  const pageSizes = [10, 20, 30, 40, 50];
10
10
  const [currentPageSize, setPageSize] = useState(10);
11
+ console.log(items.results);
11
12
 
12
13
  const { goTo, results: paginatedItems, currentPage } = usePagination(items.results, currentPageSize);
13
14
 
@@ -27,26 +28,31 @@ export function useStockOperationPages(filter: StockOperationFilter) {
27
28
  },
28
29
  {
29
30
  id: 2,
31
+ header: t('stockOperationItems', 'Items'),
32
+ key: 'stockOperationItems',
33
+ },
34
+ {
35
+ id: 3,
30
36
  header: t('status', 'Status'),
31
37
  key: 'status',
32
38
  },
33
39
  {
34
- id: 3,
40
+ id: 4,
35
41
  header: t('location', 'Location'),
36
42
  key: 'location',
37
43
  },
38
44
  {
39
- id: 4,
45
+ id: 5,
40
46
  header: t('responsiblePerson', 'Responsible Person'),
41
47
  key: 'responsiblePerson',
42
48
  },
43
49
  {
44
- id: 5,
50
+ id: 6,
45
51
  header: t('date', 'Date'),
46
52
  key: 'operationDate',
47
53
  },
48
54
  {
49
- id: 6,
55
+ id: 7,
50
56
  key: 'details',
51
57
  },
52
58
  { key: 'actions', header: '' },
@@ -22,7 +22,7 @@ import { Controller, useForm } from 'react-hook-form';
22
22
  import { zodResolver } from '@hookform/resolvers/zod';
23
23
  import { StockReportSchema, reportSchema } from '../report-validation-schema';
24
24
  import { useConcept, useStockTagLocations } from '../../stock-lookups/stock-lookups.resource';
25
- import { ConfigObject, showSnackbar, useConfig } from '@openmrs/esm-framework';
25
+ import { ConfigObject, restBaseUrl, showSnackbar, useConfig } from '@openmrs/esm-framework';
26
26
  import { Concept } from '../../core/api/types/concept/Concept';
27
27
  import { createBatchJob } from '../../stock-batch/stock-batch.resource';
28
28
  import {
@@ -34,6 +34,7 @@ import {
34
34
  } from '../ReportType';
35
35
  import { formatDisplayDate } from '../../core/utils/datetimeUtils';
36
36
  import { BatchJobTypeReport } from '../../core/api/types/BatchJob';
37
+ import { handleMutate } from '../../utils';
37
38
  interface CreateReportProps {
38
39
  model?: ReportModel;
39
40
  }
@@ -319,6 +320,7 @@ const CreateReport: React.FC<CreateReportProps> = ({ model }) => {
319
320
  subtitle: t('BatchJobSuccess', 'Batch job created successfully'),
320
321
  kind: 'success',
321
322
  });
323
+ handleMutate(`${restBaseUrl}/stockmanagement/batchjob?batchJobType=Report&v=default`);
322
324
  } else {
323
325
  showSnackbar({
324
326
  title: t('BatchJobErrorTitle', 'Batch job'),
@@ -59,7 +59,7 @@ const StockReports: React.FC = () => {
59
59
  const { t } = useTranslation();
60
60
 
61
61
  const handleRefresh = () => {
62
- handleMutate(`${restBaseUrl}/stockmanagement/report?v=default`);
62
+ handleMutate(`${restBaseUrl}/stockmanagement/batchjob?batchJobType=Report&v=default`);
63
63
  };
64
64
  const { reports, isLoading, currentPage, pageSizes, totalItems, goTo, currentPageSize, setPageSize } =
65
65
  useGetReports();
@@ -298,5 +298,6 @@
298
298
  "user": "User",
299
299
  "view": "View",
300
300
  "whoIsThePreferredVendor": "Who is the preferred vendor?",
301
- "yes": "Yes"
301
+ "yes": "Yes",
302
+ "stockOperationItems": "Items"
302
303
  }