@openmrs/esm-stock-management-app 1.0.1-pre.350 → 1.0.1-pre.352
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/842.js +1 -1
- package/dist/842.js.map +1 -1
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/openmrs-esm-stock-management-app.js.buildmanifest.json +6 -6
- package/dist/routes.json +1 -1
- package/package.json +1 -1
- package/src/stock-batch/stock-batch.resource.ts +7 -5
- package/src/stock-items/add-stock-item/stock-item-rules/stock-rules.resource.ts +7 -5
- package/src/stock-items/stock-items.resource.ts +23 -19
- package/src/stock-lookups/stock-lookups.resource.ts +15 -15
- package/src/stock-operations/stock-operations.resource.ts +18 -14
- package/src/stock-sources/stock-sources.resource.ts +5 -5
- package/src/stock-user-role-scopes/stock-user-role-scopes.resource.ts +5 -5
@@ -86,10 +86,10 @@
|
|
86
86
|
"initial": true,
|
87
87
|
"entry": true,
|
88
88
|
"recorded": false,
|
89
|
-
"size":
|
89
|
+
"size": 4661498,
|
90
90
|
"sizes": {
|
91
91
|
"consume-shared": 252,
|
92
|
-
"javascript":
|
92
|
+
"javascript": 4639549,
|
93
93
|
"share-init": 252,
|
94
94
|
"runtime": 21445
|
95
95
|
},
|
@@ -106,7 +106,7 @@
|
|
106
106
|
"auxiliaryFiles": [
|
107
107
|
"main.js.map"
|
108
108
|
],
|
109
|
-
"hash": "
|
109
|
+
"hash": "e089a437fc95ee5a",
|
110
110
|
"childrenByOrder": {}
|
111
111
|
},
|
112
112
|
{
|
@@ -306,9 +306,9 @@
|
|
306
306
|
"initial": false,
|
307
307
|
"entry": false,
|
308
308
|
"recorded": false,
|
309
|
-
"size":
|
309
|
+
"size": 950126,
|
310
310
|
"sizes": {
|
311
|
-
"javascript":
|
311
|
+
"javascript": 949916,
|
312
312
|
"consume-shared": 210
|
313
313
|
},
|
314
314
|
"names": [],
|
@@ -322,7 +322,7 @@
|
|
322
322
|
"auxiliaryFiles": [
|
323
323
|
"842.js.map"
|
324
324
|
],
|
325
|
-
"hash": "
|
325
|
+
"hash": "0d11978287475114",
|
326
326
|
"childrenByOrder": {}
|
327
327
|
},
|
328
328
|
{
|
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"}],"pages":[{"component":"stockManagement","route":"stock-management"}],"version":"1.0.1-pre.
|
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"}],"pages":[{"component":"stockManagement","route":"stock-management"}],"version":"1.0.1-pre.352"}
|
package/package.json
CHANGED
@@ -2,7 +2,7 @@ import useSWR from "swr";
|
|
2
2
|
import { ResourceFilterCriteria, toQueryParams } from "../core/api/api";
|
3
3
|
import { BatchJob, BatchJobType } from "../core/api/types/BatchJob";
|
4
4
|
import { PageableResult } from "../core/api/types/PageableResult";
|
5
|
-
import { openmrsFetch } from "@openmrs/esm-framework";
|
5
|
+
import { openmrsFetch, restBaseUrl } from "@openmrs/esm-framework";
|
6
6
|
import { ReportType } from "../stock-reports/ReportType";
|
7
7
|
|
8
8
|
export interface BatchJobFilter extends ResourceFilterCriteria {
|
@@ -17,7 +17,9 @@ export interface BatchJobFilter extends ResourceFilterCriteria {
|
|
17
17
|
|
18
18
|
// getBatchJobs
|
19
19
|
export function useBatchJobs(filter: BatchJobFilter) {
|
20
|
-
const apiUrl =
|
20
|
+
const apiUrl = `${restBaseUrl}/stockmanagement/batchjob${toQueryParams(
|
21
|
+
filter
|
22
|
+
)}`;
|
21
23
|
const { data, error, isLoading } = useSWR<
|
22
24
|
{ data: PageableResult<BatchJob> },
|
23
25
|
Error
|
@@ -40,7 +42,7 @@ export function cancelBatchJobs(ids: string[]) {
|
|
40
42
|
if (otherIds.length > 0) {
|
41
43
|
otherIds = "?ids=" + otherIds;
|
42
44
|
}
|
43
|
-
const apiUrl =
|
45
|
+
const apiUrl = `${restBaseUrl}/stockmanagement/batchjob/${ids[0]}${otherIds}`;
|
44
46
|
const abortController = new AbortController();
|
45
47
|
return openmrsFetch(apiUrl, {
|
46
48
|
method: "DELETE",
|
@@ -53,7 +55,7 @@ export function cancelBatchJobs(ids: string[]) {
|
|
53
55
|
|
54
56
|
// createBatchJob
|
55
57
|
export function createBatchJob(item: BatchJob) {
|
56
|
-
const apiUrl =
|
58
|
+
const apiUrl = `${restBaseUrl}/stockmanagement/batchjob`;
|
57
59
|
const abortController = new AbortController();
|
58
60
|
return openmrsFetch(apiUrl, {
|
59
61
|
method: "POST",
|
@@ -66,7 +68,7 @@ export function createBatchJob(item: BatchJob) {
|
|
66
68
|
}
|
67
69
|
// getReportTypes
|
68
70
|
export function useReportTypes() {
|
69
|
-
const apiUrl =
|
71
|
+
const apiUrl = `${restBaseUrl}/stockmanagement/report?v=default`;
|
70
72
|
const { data, error, isLoading } = useSWR<
|
71
73
|
{ data: PageableResult<ReportType> },
|
72
74
|
Error
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { openmrsFetch } from "@openmrs/esm-framework";
|
1
|
+
import { openmrsFetch, restBaseUrl } from "@openmrs/esm-framework";
|
2
2
|
import { ResourceFilterCriteria, toQueryParams } from "../../../core/api/api";
|
3
3
|
import useSWR from "swr";
|
4
4
|
import { PageableResult } from "../../../core/api/types/PageableResult";
|
@@ -10,7 +10,9 @@ export interface StockSourceFilter extends ResourceFilterCriteria {
|
|
10
10
|
|
11
11
|
// Get Stock Rules
|
12
12
|
export function useStockRules(filter: StockSourceFilter) {
|
13
|
-
const apiUrl =
|
13
|
+
const apiUrl = `${restBaseUrl}/stockmanagement/stockrule${toQueryParams(
|
14
|
+
filter
|
15
|
+
)}`;
|
14
16
|
|
15
17
|
const { data, error, isLoading } = useSWR<
|
16
18
|
{ data: PageableResult<StockRule> },
|
@@ -26,7 +28,7 @@ export function useStockRules(filter: StockSourceFilter) {
|
|
26
28
|
|
27
29
|
// Get Stock Rule
|
28
30
|
export function useStockRule(id: string) {
|
29
|
-
const apiUrl =
|
31
|
+
const apiUrl = `${restBaseUrl}/stockmanagement/stockrule/${id}`;
|
30
32
|
const { data, error, isLoading } = useSWR<{ data: StockRule }, Error>(
|
31
33
|
apiUrl,
|
32
34
|
openmrsFetch
|
@@ -48,7 +50,7 @@ export function deleteStockRule(ids: string[]) {
|
|
48
50
|
if (otherIds.length > 0) {
|
49
51
|
otherIds = "?ids=" + otherIds;
|
50
52
|
}
|
51
|
-
const apiUrl =
|
53
|
+
const apiUrl = `${restBaseUrl}/stockmanagement/stockrule/${ids[0]}${otherIds}`;
|
52
54
|
const abortController = new AbortController();
|
53
55
|
return openmrsFetch(apiUrl, {
|
54
56
|
method: "DELETE",
|
@@ -63,7 +65,7 @@ export function deleteStockRule(ids: string[]) {
|
|
63
65
|
export function createOrUpdateStockRule(item: StockRule) {
|
64
66
|
const isNew = item.uuid != null;
|
65
67
|
|
66
|
-
const apiUrl =
|
68
|
+
const apiUrl = `${restBaseUrl}/stockmanagement/stockrule${
|
67
69
|
isNew ? "/" + item.uuid : ""
|
68
70
|
}`;
|
69
71
|
const abortController = new AbortController();
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { openmrsFetch } from "@openmrs/esm-framework";
|
1
|
+
import { openmrsFetch, restBaseUrl } from "@openmrs/esm-framework";
|
2
2
|
import { ResourceFilterCriteria, toQueryParams } from "../core/api/api";
|
3
3
|
import { PageableResult } from "../core/api/types/PageableResult";
|
4
4
|
import {
|
@@ -65,7 +65,9 @@ export interface StockRuleFilter extends ResourceFilterCriteria {
|
|
65
65
|
|
66
66
|
// getStockItems
|
67
67
|
export function useStockItems(filter: StockItemFilter) {
|
68
|
-
const apiUrl =
|
68
|
+
const apiUrl = `${restBaseUrl}/stockmanagement/stockitem${toQueryParams(
|
69
|
+
filter
|
70
|
+
)}`;
|
69
71
|
const { data, error, isLoading } = useSWR<
|
70
72
|
{
|
71
73
|
data: PageableResult<StockItemDTO>;
|
@@ -82,7 +84,7 @@ export function useStockItems(filter: StockItemFilter) {
|
|
82
84
|
|
83
85
|
// getStockItemTransactions
|
84
86
|
export function useStockItemTransactions(filter: StockItemTransactionFilter) {
|
85
|
-
const apiUrl =
|
87
|
+
const apiUrl = `${restBaseUrl}/stockmanagement/stockitemtransaction${toQueryParams(
|
86
88
|
filter
|
87
89
|
)}`;
|
88
90
|
const { data, error, isLoading } = useSWR<
|
@@ -101,7 +103,7 @@ export function useStockItemTransactions(filter: StockItemTransactionFilter) {
|
|
101
103
|
|
102
104
|
// getStockItemInventory
|
103
105
|
export function useStockItemInventory(filter: StockItemInventoryFilter) {
|
104
|
-
const apiUrl =
|
106
|
+
const apiUrl = `${restBaseUrl}/stockmanagement/stockiteminventory${toQueryParams(
|
105
107
|
filter
|
106
108
|
)}`;
|
107
109
|
const { data, error, isLoading } = useSWR<
|
@@ -120,7 +122,7 @@ export function useStockItemInventory(filter: StockItemInventoryFilter) {
|
|
120
122
|
|
121
123
|
// getStockOperationItemsCost
|
122
124
|
export function useStockOperationItemsCost(filter: string) {
|
123
|
-
const apiUrl =
|
125
|
+
const apiUrl = `${restBaseUrl}/stockmanagement/stockoperationitemcost?v=default&stockOperationUuid=${filter}`;
|
124
126
|
const { data, error, isLoading } = useSWR<
|
125
127
|
{
|
126
128
|
data: PageableResult<StockOperationItemCost>;
|
@@ -136,7 +138,7 @@ export function useStockOperationItemsCost(filter: string) {
|
|
136
138
|
|
137
139
|
// getStockBatches
|
138
140
|
export function useStockBatches(filter: StockBatchFilter) {
|
139
|
-
const apiUrl =
|
141
|
+
const apiUrl = `${restBaseUrl}/stockmanagement/stockbatch${toQueryParams(
|
140
142
|
filter
|
141
143
|
)}`;
|
142
144
|
const { data, error, isLoading } = useSWR<
|
@@ -154,7 +156,7 @@ export function useStockBatches(filter: StockBatchFilter) {
|
|
154
156
|
|
155
157
|
// getStockItemPackagingUOMs
|
156
158
|
export function useStockItemPackagingUOMs(filter: StockItemPackagingUOMFilter) {
|
157
|
-
const apiUrl =
|
159
|
+
const apiUrl = `${restBaseUrl}/stockmanagement/stockitempackaginguom${toQueryParams(
|
158
160
|
filter
|
159
161
|
)}`;
|
160
162
|
const { data, error, isLoading } = useSWR<
|
@@ -173,7 +175,7 @@ export function useStockItemPackagingUOMs(filter: StockItemPackagingUOMFilter) {
|
|
173
175
|
|
174
176
|
// getStockItem
|
175
177
|
export function useStockItem(id: string) {
|
176
|
-
const apiUrl =
|
178
|
+
const apiUrl = `${restBaseUrl}/stockmanagement/stockitem/${id}?v=full`;
|
177
179
|
const { data, error, isLoading } = useSWR<
|
178
180
|
{
|
179
181
|
data: StockItemDTO;
|
@@ -198,7 +200,7 @@ export function deleteStockItems(ids: string[]) {
|
|
198
200
|
otherIds = "?ids=" + otherIds;
|
199
201
|
}
|
200
202
|
|
201
|
-
const apiUrl =
|
203
|
+
const apiUrl = `${restBaseUrl}/stockmanagement/stockitem/${ids[0]}${otherIds}`;
|
202
204
|
|
203
205
|
const abortController = new AbortController();
|
204
206
|
|
@@ -213,7 +215,7 @@ export function deleteStockItems(ids: string[]) {
|
|
213
215
|
|
214
216
|
// deleteStockItemPackagingUnit
|
215
217
|
export function deleteStockItemPackagingUnit(id: string) {
|
216
|
-
const apiUrl =
|
218
|
+
const apiUrl = `${restBaseUrl}/stockmanagement/stockitempackaginguom/${id}`;
|
217
219
|
const abortController = new AbortController();
|
218
220
|
|
219
221
|
return openmrsFetch(apiUrl, {
|
@@ -227,7 +229,7 @@ export function deleteStockItemPackagingUnit(id: string) {
|
|
227
229
|
|
228
230
|
// createStockItem
|
229
231
|
export function createStockItem(item: StockItemDTO) {
|
230
|
-
const apiUrl =
|
232
|
+
const apiUrl = `${restBaseUrl}/stockmanagement/stockitem`;
|
231
233
|
const abortController = new AbortController();
|
232
234
|
delete item.isDrug;
|
233
235
|
return openmrsFetch(apiUrl, {
|
@@ -242,7 +244,7 @@ export function createStockItem(item: StockItemDTO) {
|
|
242
244
|
|
243
245
|
// updateStockItem
|
244
246
|
export function updateStockItem(item: StockItemDTO) {
|
245
|
-
const apiUrl =
|
247
|
+
const apiUrl = `${restBaseUrl}/stockmanagement/stockitem/${item.uuid}`;
|
246
248
|
const abortController = new AbortController();
|
247
249
|
delete item.isDrug;
|
248
250
|
delete item.dateCreated;
|
@@ -258,7 +260,7 @@ export function updateStockItem(item: StockItemDTO) {
|
|
258
260
|
|
259
261
|
// createStockItemPackagingUnit
|
260
262
|
export function createStockItemPackagingUnit(item: StockItemPackagingUOMDTO) {
|
261
|
-
const apiUrl =
|
263
|
+
const apiUrl = `${restBaseUrl}/stockmanagement/stockitempackaginguom`;
|
262
264
|
const abortController = new AbortController();
|
263
265
|
return openmrsFetch(apiUrl, {
|
264
266
|
method: "POST",
|
@@ -272,7 +274,7 @@ export function createStockItemPackagingUnit(item: StockItemPackagingUOMDTO) {
|
|
272
274
|
|
273
275
|
// updateStockItemPackagingUnit
|
274
276
|
export function updateStockItemPackagingUnit(item: StockItemDTO, uuid: string) {
|
275
|
-
const apiUrl =
|
277
|
+
const apiUrl = `${restBaseUrl}/stockmanagement/stockitempackaginguom/${uuid}`;
|
276
278
|
const abortController = new AbortController();
|
277
279
|
return openmrsFetch(apiUrl, {
|
278
280
|
method: "POST",
|
@@ -286,7 +288,7 @@ export function updateStockItemPackagingUnit(item: StockItemDTO, uuid: string) {
|
|
286
288
|
|
287
289
|
// importStockItem
|
288
290
|
export function importStockItem(item: FormData) {
|
289
|
-
const apiUrl =
|
291
|
+
const apiUrl = `${restBaseUrl}/stockmanagement/stockitemimport`;
|
290
292
|
const abortController = new AbortController();
|
291
293
|
return openmrsFetch(apiUrl, {
|
292
294
|
method: "POST",
|
@@ -302,7 +304,9 @@ export function importStockItem(item: FormData) {
|
|
302
304
|
// getStockRules
|
303
305
|
export function useStockRules(filter: StockRuleFilter) {
|
304
306
|
console.warn("Rules filter: " + JSON.stringify(filter));
|
305
|
-
const apiUrl =
|
307
|
+
const apiUrl = `${restBaseUrl}/stockmanagement/stockrule${toQueryParams(
|
308
|
+
filter
|
309
|
+
)}`;
|
306
310
|
const { data, error, isLoading } = useSWR<
|
307
311
|
{
|
308
312
|
data: PageableResult<StockRule>;
|
@@ -325,7 +329,7 @@ export function useStockRules(filter: StockRuleFilter) {
|
|
325
329
|
|
326
330
|
// createStockRule
|
327
331
|
export function createStockRule(item: StockRule) {
|
328
|
-
const apiUrl =
|
332
|
+
const apiUrl = `${restBaseUrl}/stockmanagement/stockrule`;
|
329
333
|
const abortController = new AbortController();
|
330
334
|
return openmrsFetch(apiUrl, {
|
331
335
|
method: "POST",
|
@@ -339,7 +343,7 @@ export function createStockRule(item: StockRule) {
|
|
339
343
|
|
340
344
|
// updateStockRule
|
341
345
|
export function updateStockRule(item: StockRule, uuid: string) {
|
342
|
-
const apiUrl =
|
346
|
+
const apiUrl = `${restBaseUrl}/stockmanagement/stockrule/${uuid}`;
|
343
347
|
const abortController = new AbortController();
|
344
348
|
return openmrsFetch(apiUrl, {
|
345
349
|
method: "POST",
|
@@ -353,7 +357,7 @@ export function updateStockRule(item: StockRule, uuid: string) {
|
|
353
357
|
|
354
358
|
// deleteStockRule
|
355
359
|
export function deleteStockRule(id: string) {
|
356
|
-
const apiUrl =
|
360
|
+
const apiUrl = `${restBaseUrl}/stockmanagement/stockrule/${id}`;
|
357
361
|
const abortController = new AbortController();
|
358
362
|
return openmrsFetch(apiUrl, {
|
359
363
|
method: "DELETE",
|
@@ -41,7 +41,7 @@ interface FHIRResponse {
|
|
41
41
|
|
42
42
|
// getLocations
|
43
43
|
export function useStockLocations(filter: LocationFilterCriteria) {
|
44
|
-
const apiUrl =
|
44
|
+
const apiUrl = `${restBaseUrl}/location${toQueryParams(filter, false)}`;
|
45
45
|
const { data, error, isLoading } = useSWR<
|
46
46
|
{
|
47
47
|
data: PageableResult<OpenMRSLocation>;
|
@@ -76,7 +76,7 @@ export function useStockTagLocations() {
|
|
76
76
|
|
77
77
|
// getLocationWithIdByUuid
|
78
78
|
export function useLocationWithIdByUuid(id: string) {
|
79
|
-
const apiUrl =
|
79
|
+
const apiUrl = `${restBaseUrl}/stockmanagement/location/${id}`;
|
80
80
|
const { data, error, isLoading } = useSWR<
|
81
81
|
{
|
82
82
|
data: PageableResult<OpenMRSLocation>;
|
@@ -92,7 +92,7 @@ export function useLocationWithIdByUuid(id: string) {
|
|
92
92
|
|
93
93
|
// deleteLocation
|
94
94
|
export function deleteLocation(id: string) {
|
95
|
-
const apiUrl =
|
95
|
+
const apiUrl = `${restBaseUrl}/stockmanagement/location/${id}`;
|
96
96
|
const abortController = new AbortController();
|
97
97
|
return openmrsFetch(apiUrl, {
|
98
98
|
method: "DELETE",
|
@@ -105,7 +105,7 @@ export function deleteLocation(id: string) {
|
|
105
105
|
|
106
106
|
// getLocationTags
|
107
107
|
export function useLocationTags(q: string) {
|
108
|
-
const apiUrl =
|
108
|
+
const apiUrl = `${restBaseUrl}/locationtag?v=default${
|
109
109
|
q && q.length > 0 ? "&q=" + encodeURIComponent(q) : ""
|
110
110
|
}`;
|
111
111
|
const { data, error, isLoading } = useSWR<
|
@@ -123,7 +123,7 @@ export function useLocationTags(q: string) {
|
|
123
123
|
|
124
124
|
// getRoles
|
125
125
|
export function useRoles(filter: ResourceFilterCriteria) {
|
126
|
-
const apiUrl =
|
126
|
+
const apiUrl = `${restBaseUrl}/role${toQueryParams(filter)}`;
|
127
127
|
const { data, error, isLoading } = useSWR<
|
128
128
|
{
|
129
129
|
data: PageableResult<Role>;
|
@@ -139,7 +139,7 @@ export function useRoles(filter: ResourceFilterCriteria) {
|
|
139
139
|
|
140
140
|
// getStockOperationTypes
|
141
141
|
export function useStockOperationTypes() {
|
142
|
-
const apiUrl =
|
142
|
+
const apiUrl = `${restBaseUrl}/stockmanagement/stockoperationtype?v=default`;
|
143
143
|
const { data, isLoading, error } = useSWR<
|
144
144
|
{
|
145
145
|
data: PageableResult<StockOperationType>;
|
@@ -156,13 +156,13 @@ export function useStockOperationTypes() {
|
|
156
156
|
export function getStockOperationTypes(): Promise<
|
157
157
|
FetchResponse<PageableResult<StockOperationType>>
|
158
158
|
> {
|
159
|
-
const apiUrl =
|
159
|
+
const apiUrl = `${restBaseUrl}/stockmanagement/stockoperationtype?v=default`;
|
160
160
|
return openmrsFetch(apiUrl);
|
161
161
|
}
|
162
162
|
|
163
163
|
// getUsers
|
164
164
|
export function useUsers(filter: UserFilterCriteria) {
|
165
|
-
const apiUrl =
|
165
|
+
const apiUrl = `${restBaseUrl}/user${toQueryParams(filter)}`;
|
166
166
|
const { data, error, isLoading } = useSWR<
|
167
167
|
{
|
168
168
|
data: PageableResult<User>;
|
@@ -178,7 +178,7 @@ export function useUsers(filter: UserFilterCriteria) {
|
|
178
178
|
|
179
179
|
// getUser
|
180
180
|
export function useUser(id: string) {
|
181
|
-
const apiUrl =
|
181
|
+
const apiUrl = `${restBaseUrl}/user${id}`;
|
182
182
|
const { data, error, isLoading } = useSWR<
|
183
183
|
{
|
184
184
|
data: User;
|
@@ -193,7 +193,7 @@ export function useUser(id: string) {
|
|
193
193
|
}
|
194
194
|
|
195
195
|
export function useConcept(conceptUuid: string) {
|
196
|
-
const apiUrl =
|
196
|
+
const apiUrl = `${restBaseUrl}/concept/${conceptUuid}`;
|
197
197
|
const { data, error, isLoading } = useSWR<
|
198
198
|
{
|
199
199
|
data: Concept;
|
@@ -209,7 +209,7 @@ export function useConcept(conceptUuid: string) {
|
|
209
209
|
|
210
210
|
// getParties
|
211
211
|
export function useParties() {
|
212
|
-
const apiUrl =
|
212
|
+
const apiUrl = `${restBaseUrl}/stockmanagement/party?v=default`;
|
213
213
|
const { data, error, isLoading } = useSWR<
|
214
214
|
{
|
215
215
|
data: PageableResult<Party>;
|
@@ -224,13 +224,13 @@ export function useParties() {
|
|
224
224
|
}
|
225
225
|
|
226
226
|
export function getParties(): Promise<FetchResponse<PageableResult<Party>>> {
|
227
|
-
const apiUrl =
|
227
|
+
const apiUrl = `${restBaseUrl}/stockmanagement/party?v=default`;
|
228
228
|
return openmrsFetch(apiUrl);
|
229
229
|
}
|
230
230
|
|
231
231
|
// getDrugs
|
232
232
|
export function useDrugs(filter: DrugFilterCriteria) {
|
233
|
-
const apiUrl =
|
233
|
+
const apiUrl = `${restBaseUrl}/drug${toQueryParams(filter)}`;
|
234
234
|
const { data, error, isLoading } = useSWR<
|
235
235
|
{
|
236
236
|
data: PageableResult<Drug>;
|
@@ -246,7 +246,7 @@ export function useDrugs(filter: DrugFilterCriteria) {
|
|
246
246
|
|
247
247
|
// getConcepts
|
248
248
|
export function useConcepts(filter: ConceptFilterCriteria) {
|
249
|
-
const apiUrl =
|
249
|
+
const apiUrl = `${restBaseUrl}/concept${toQueryParams(filter)}`;
|
250
250
|
const { data, error, isLoading } = useSWR<
|
251
251
|
{
|
252
252
|
data: PageableResult<Concept>;
|
@@ -262,7 +262,7 @@ export function useConcepts(filter: ConceptFilterCriteria) {
|
|
262
262
|
|
263
263
|
// getPatients
|
264
264
|
export function usePatients(filter: ConceptFilterCriteria) {
|
265
|
-
const apiUrl =
|
265
|
+
const apiUrl = `${restBaseUrl}/patient${toQueryParams(filter)}`;
|
266
266
|
const { data, error, isLoading } = useSWR<
|
267
267
|
{
|
268
268
|
data: PageableResult<Patient>;
|
@@ -1,4 +1,8 @@
|
|
1
|
-
import {
|
1
|
+
import {
|
2
|
+
FetchResponse,
|
3
|
+
openmrsFetch,
|
4
|
+
restBaseUrl,
|
5
|
+
} from "@openmrs/esm-framework";
|
2
6
|
import useSWR from "swr";
|
3
7
|
import { ResourceFilterCriteria, toQueryParams } from "../core/api/api";
|
4
8
|
import { PageableResult } from "../core/api/types/PageableResult";
|
@@ -34,7 +38,7 @@ export interface StockItemInventoryFilter extends ResourceFilterCriteria {
|
|
34
38
|
|
35
39
|
// getStockOperations
|
36
40
|
export function useStockOperations(filter: StockOperationFilter) {
|
37
|
-
const apiUrl =
|
41
|
+
const apiUrl = `${restBaseUrl}/stockmanagement/stockoperation${toQueryParams(
|
38
42
|
filter
|
39
43
|
)}`;
|
40
44
|
const { data, error, isLoading } = useSWR<
|
@@ -51,7 +55,7 @@ export function useStockOperations(filter: StockOperationFilter) {
|
|
51
55
|
|
52
56
|
// getStockOperationLinks
|
53
57
|
export function useStockOperationLinks(filter: string) {
|
54
|
-
const apiUrl =
|
58
|
+
const apiUrl = `${restBaseUrl}/stockmanagement/stockoperationlink?v=default&q=${filter}`;
|
55
59
|
const { data, error, isLoading } = useSWR<
|
56
60
|
{ data: PageableResult<StockOperationLinkDTO> },
|
57
61
|
Error
|
@@ -65,7 +69,7 @@ export function useStockOperationLinks(filter: string) {
|
|
65
69
|
|
66
70
|
// getStockOperation
|
67
71
|
export function useStockOperation(id: string) {
|
68
|
-
const apiUrl =
|
72
|
+
const apiUrl = `${restBaseUrl}/stockmanagement/stockoperation/${id}`;
|
69
73
|
const { data, error, isLoading } = useSWR<{ data: StockOperationDTO }, Error>(
|
70
74
|
apiUrl,
|
71
75
|
openmrsFetch
|
@@ -79,14 +83,14 @@ export function useStockOperation(id: string) {
|
|
79
83
|
export function getStockOperation(
|
80
84
|
id: string
|
81
85
|
): Promise<FetchResponse<StockOperationDTO>> {
|
82
|
-
const apiUrl =
|
86
|
+
const apiUrl = `${restBaseUrl}/stockmanagement/stockoperation/${id}?v=full`;
|
83
87
|
|
84
88
|
return openmrsFetch(apiUrl);
|
85
89
|
}
|
86
90
|
|
87
91
|
// getStockOperationAndItems
|
88
92
|
export function useStockOperationAndItems(id: string) {
|
89
|
-
const apiUrl =
|
93
|
+
const apiUrl = `${restBaseUrl}/stockmanagement/stockoperation/${id}?v=full`;
|
90
94
|
const { data, error, isLoading } = useSWR<{ data: StockOperationDTO }, Error>(
|
91
95
|
apiUrl,
|
92
96
|
openmrsFetch
|
@@ -108,7 +112,7 @@ export function deleteStockOperations(ids: string[]) {
|
|
108
112
|
if (otherIds.length > 0) {
|
109
113
|
otherIds = "?ids=" + otherIds;
|
110
114
|
}
|
111
|
-
const apiUrl =
|
115
|
+
const apiUrl = `${restBaseUrl}/stockmanagement/stockoperation/${ids[0]}${otherIds}`;
|
112
116
|
const abortController = new AbortController();
|
113
117
|
return openmrsFetch(apiUrl, {
|
114
118
|
method: "DELETE",
|
@@ -121,7 +125,7 @@ export function deleteStockOperations(ids: string[]) {
|
|
121
125
|
|
122
126
|
// deleteStockOperationItem
|
123
127
|
export function deleteStockOperationItem(id: string) {
|
124
|
-
const apiUrl =
|
128
|
+
const apiUrl = `${restBaseUrl}/stockmanagement/stockoperationitem/${id}`;
|
125
129
|
const abortController = new AbortController();
|
126
130
|
return openmrsFetch(apiUrl, {
|
127
131
|
method: "DELETE",
|
@@ -134,7 +138,7 @@ export function deleteStockOperationItem(id: string) {
|
|
134
138
|
|
135
139
|
// createStockOperation
|
136
140
|
export function createStockOperation(item: StockOperationDTO) {
|
137
|
-
const apiUrl =
|
141
|
+
const apiUrl = `${restBaseUrl}/stockmanagement/stockoperation`;
|
138
142
|
const abortController = new AbortController();
|
139
143
|
return openmrsFetch(apiUrl, {
|
140
144
|
method: "POST",
|
@@ -148,7 +152,7 @@ export function createStockOperation(item: StockOperationDTO) {
|
|
148
152
|
|
149
153
|
// updateStockOperation
|
150
154
|
export function updateStockOperation(item: StockOperationDTO) {
|
151
|
-
const apiUrl =
|
155
|
+
const apiUrl = `${restBaseUrl}/stockmanagement/stockoperation/${item.uuid}`;
|
152
156
|
const abortController = new AbortController();
|
153
157
|
return openmrsFetch(apiUrl, {
|
154
158
|
method: "POST",
|
@@ -162,7 +166,7 @@ export function updateStockOperation(item: StockOperationDTO) {
|
|
162
166
|
|
163
167
|
// executeStockOperationAction
|
164
168
|
export function executeStockOperationAction(item: StopOperationAction) {
|
165
|
-
const apiUrl =
|
169
|
+
const apiUrl = `${restBaseUrl}/stockmanagement/stockoperationaction`;
|
166
170
|
const abortController = new AbortController();
|
167
171
|
return openmrsFetch(apiUrl, {
|
168
172
|
method: "POST",
|
@@ -179,7 +183,7 @@ export function updateStockOperationBatchNumbers(
|
|
179
183
|
item: StockOperationDTO,
|
180
184
|
uuid: string
|
181
185
|
) {
|
182
|
-
const apiUrl =
|
186
|
+
const apiUrl = `${restBaseUrl}/stockmanagement/stockoperationbatchnumbers/${uuid}`;
|
183
187
|
const abortController = new AbortController();
|
184
188
|
return openmrsFetch(apiUrl, {
|
185
189
|
method: "POST",
|
@@ -193,7 +197,7 @@ export function updateStockOperationBatchNumbers(
|
|
193
197
|
|
194
198
|
// get stock operation itemcosts
|
195
199
|
export function getStockOperationItemsCost(filter: StockOperationFilter) {
|
196
|
-
const apiUrl =
|
200
|
+
const apiUrl = `${restBaseUrl}/stockmanagement/stockoperationitemcost?v=default&stockOperationUuid=${filter}`;
|
197
201
|
const abortController = new AbortController();
|
198
202
|
return openmrsFetch(apiUrl, {
|
199
203
|
method: "GET",
|
@@ -205,7 +209,7 @@ export function getStockOperationItemsCost(filter: StockOperationFilter) {
|
|
205
209
|
}
|
206
210
|
// get stockiteminvoentory
|
207
211
|
export function getStockItemInventory(filter: StockItemInventoryFilter) {
|
208
|
-
const apiUrl =
|
212
|
+
const apiUrl = `${restBaseUrl}/stockmanagement/stockiteminventory${toQueryParams(
|
209
213
|
filter
|
210
214
|
)}`;
|
211
215
|
const abortController = new AbortController();
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { openmrsFetch } from "@openmrs/esm-framework";
|
1
|
+
import { openmrsFetch, restBaseUrl } from "@openmrs/esm-framework";
|
2
2
|
import { ResourceFilterCriteria, toQueryParams } from "../core/api/api";
|
3
3
|
import useSWR from "swr";
|
4
4
|
import { PageableResult } from "../core/api/types/PageableResult";
|
@@ -10,7 +10,7 @@ export interface StockSourceFilter extends ResourceFilterCriteria {
|
|
10
10
|
|
11
11
|
// getStockSources
|
12
12
|
export function useStockSources(filter: StockSourceFilter) {
|
13
|
-
const apiUrl =
|
13
|
+
const apiUrl = `${restBaseUrl}/stockmanagement/stocksource${toQueryParams(
|
14
14
|
filter
|
15
15
|
)}`;
|
16
16
|
|
@@ -28,7 +28,7 @@ export function useStockSources(filter: StockSourceFilter) {
|
|
28
28
|
|
29
29
|
// getStockSource
|
30
30
|
export function useStockSource(id: string) {
|
31
|
-
const apiUrl =
|
31
|
+
const apiUrl = `${restBaseUrl}/stockmanagement/stocksource/${id}`;
|
32
32
|
const { data, error, isLoading } = useSWR<{ data: StockSource }, Error>(
|
33
33
|
apiUrl,
|
34
34
|
openmrsFetch
|
@@ -50,7 +50,7 @@ export function deleteStockSource(ids: string[]) {
|
|
50
50
|
if (otherIds.length > 0) {
|
51
51
|
otherIds = "?ids=" + otherIds;
|
52
52
|
}
|
53
|
-
const apiUrl =
|
53
|
+
const apiUrl = `${restBaseUrl}/stockmanagement/stocksource/${ids[0]}${otherIds}`;
|
54
54
|
const abortController = new AbortController();
|
55
55
|
return openmrsFetch(apiUrl, {
|
56
56
|
method: "DELETE",
|
@@ -65,7 +65,7 @@ export function deleteStockSource(ids: string[]) {
|
|
65
65
|
export function createOrUpdateStockSource(item: StockSource) {
|
66
66
|
const isNew = item.uuid != null;
|
67
67
|
|
68
|
-
const apiUrl =
|
68
|
+
const apiUrl = `${restBaseUrl}/stockmanagement/stocksource${
|
69
69
|
isNew ? "/" + item.uuid : ""
|
70
70
|
}`;
|
71
71
|
const abortController = new AbortController();
|
@@ -2,13 +2,13 @@ import useSWR from "swr";
|
|
2
2
|
import { ResourceFilterCriteria, toQueryParams } from "../core/api/api";
|
3
3
|
import { PageableResult } from "../core/api/types/PageableResult";
|
4
4
|
import { UserRoleScope } from "../core/api/types/identity/UserRoleScope";
|
5
|
-
import { openmrsFetch } from "@openmrs/esm-framework";
|
5
|
+
import { openmrsFetch, restBaseUrl } from "@openmrs/esm-framework";
|
6
6
|
|
7
7
|
export type UserRoleScopeFilter = ResourceFilterCriteria;
|
8
8
|
|
9
9
|
// getUserRoleScopes
|
10
10
|
export function useUserRoleScopes(filter: UserRoleScopeFilter) {
|
11
|
-
const apiUrl =
|
11
|
+
const apiUrl = `${restBaseUrl}/stockmanagement/userrolescope${toQueryParams(
|
12
12
|
filter
|
13
13
|
)}`;
|
14
14
|
const { data, error, isLoading } = useSWR<
|
@@ -24,7 +24,7 @@ export function useUserRoleScopes(filter: UserRoleScopeFilter) {
|
|
24
24
|
|
25
25
|
// getUserRoleScope
|
26
26
|
export function useUserRoleScope(id: string) {
|
27
|
-
const apiUrl =
|
27
|
+
const apiUrl = `${restBaseUrl}/stockmanagement/userrolescope/${id}`;
|
28
28
|
const { data, error, isLoading } = useSWR<{ data: UserRoleScope }, Error>(
|
29
29
|
apiUrl,
|
30
30
|
openmrsFetch
|
@@ -46,7 +46,7 @@ export function deleteUserRoleScopes(ids: string[]) {
|
|
46
46
|
if (otherIds.length > 0) {
|
47
47
|
otherIds = "?ids=" + otherIds;
|
48
48
|
}
|
49
|
-
const apiUrl =
|
49
|
+
const apiUrl = `${restBaseUrl}/stockmanagement/userrolescope/${ids[0]}${otherIds}`;
|
50
50
|
const abortController = new AbortController();
|
51
51
|
|
52
52
|
return openmrsFetch(apiUrl, {
|
@@ -62,7 +62,7 @@ export function deleteUserRoleScopes(ids: string[]) {
|
|
62
62
|
export function createOrUpdateUserRoleScope(item: UserRoleScope) {
|
63
63
|
const abortController = new AbortController();
|
64
64
|
const isNew = item.uuid != null;
|
65
|
-
const apiUrl =
|
65
|
+
const apiUrl = `${restBaseUrl}/stockmanagement/userrolescope${
|
66
66
|
isNew ? "/" + item.uuid : ""
|
67
67
|
}`;
|
68
68
|
return openmrsFetch(apiUrl, {
|