@openmrs/esm-stock-management-app 1.0.1-pre.38 → 1.0.1-pre.383
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/56.js +1 -0
- package/dist/56.js.map +1 -0
- package/dist/835.js +2 -0
- package/dist/835.js.map +1 -0
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/openmrs-esm-stock-management-app.js +1 -1
- package/dist/openmrs-esm-stock-management-app.js.buildmanifest.json +42 -42
- package/dist/openmrs-esm-stock-management-app.js.map +1 -1
- package/dist/routes.json +1 -1
- package/package.json +1 -1
- package/src/core/api/types/BatchJob.ts +2 -2
- package/src/stock-items/add-stock-item/stock-item-details/stock-item-details.component.tsx +0 -1
- package/src/stock-items/add-stock-item/stock-item-rules/stock-item-rules.component.tsx +2 -2
- package/src/stock-items/stock-items-table.component.tsx +22 -3
- package/src/stock-items/types.ts +79 -0
- package/src/stock-locations/add-locations-form.component.tsx +74 -0
- package/src/stock-locations/location-admin-form.component.tsx +164 -0
- package/src/stock-locations/stock-locations-table.component.tsx +33 -10
- package/src/stock-locations/stock-locations-table.resource.tsx +67 -12
- package/src/stock-locations/stock-locations-table.scss +3 -0
- package/src/stock-lookups/stock-lookups.resource.ts +1 -1
- package/src/stock-operations/add-stock-operation/add-stock-operation.component.tsx +18 -8
- package/src/stock-operations/add-stock-operation/add-stock-utils.ts +0 -2
- package/src/stock-operations/add-stock-operation/base-operation-details.component.tsx +28 -37
- package/src/stock-operations/stock-operation.utils.tsx +17 -2
- package/src/stock-operations/stock-operations-dialog/stock-operations-dialog.component.tsx +12 -12
- package/src/stock-operations/stock-operations-dialog/stock-operations-issue-stock-button.component.tsx +10 -2
- package/src/stock-operations/stock-operations-table.component.tsx +16 -15
- package/src/stock-operations/validation-schema.ts +0 -3
- package/src/stock-reports/ReportType.ts +2 -2
- package/src/stock-reports/generate-report/create-stock-report.component.tsx +635 -31
- package/src/stock-reports/generate-report/create-stock-report.scss +9 -2
- package/src/stock-reports/report-list/stock-reports.component.tsx +8 -1
- package/src/stock-reports/report-validation-schema.ts +40 -0
- package/src/stock-user-role-scopes/add-stock-user-scope/add-stock-user-role-scope.component.tsx +7 -19
- package/tsconfig.json +2 -1
- package/dist/500.js +0 -2
- package/dist/500.js.map +0 -1
- package/dist/842.js +0 -1
- package/dist/842.js.map +0 -1
- /package/dist/{500.js.LICENSE.txt → 835.js.LICENSE.txt} +0 -0
@@ -2,8 +2,15 @@
|
|
2
2
|
@use '@carbon/styles/scss/type';
|
3
3
|
@import '~@openmrs/esm-styleguide/src/vars';
|
4
4
|
|
5
|
-
.
|
6
|
-
|
5
|
+
.reportContainer {
|
6
|
+
min-height: 15rem;
|
7
|
+
display: flex;
|
8
|
+
flex-direction: column;
|
9
|
+
row-gap: 1rem;
|
10
|
+
padding: 1rem;
|
11
|
+
}
|
12
|
+
.reportButton {
|
13
|
+
padding: 1rem
|
7
14
|
}
|
8
15
|
|
9
16
|
.sectionTitle {
|
@@ -17,6 +17,7 @@ import {
|
|
17
17
|
TableToolbarSearch,
|
18
18
|
Tile,
|
19
19
|
Button,
|
20
|
+
InlineLoading,
|
20
21
|
} from "@carbon/react";
|
21
22
|
import { isDesktop } from "@openmrs/esm-framework";
|
22
23
|
import NewReportActionButton from "./new-report-button.component";
|
@@ -30,7 +31,6 @@ import {
|
|
30
31
|
BatchJobStatusExpired,
|
31
32
|
BatchJobStatusFailed,
|
32
33
|
BatchJobStatusPending,
|
33
|
-
BatchJobStatusRunning,
|
34
34
|
} from "../../core/api/types/BatchJob";
|
35
35
|
import {
|
36
36
|
CheckmarkOutline,
|
@@ -118,6 +118,13 @@ const StockReports: React.FC = () => {
|
|
118
118
|
)),
|
119
119
|
status: (
|
120
120
|
<>
|
121
|
+
{batchJob.status === BatchJobStatusPending && (
|
122
|
+
<InlineLoading
|
123
|
+
status="active"
|
124
|
+
iconDescription="Loading"
|
125
|
+
description="Generating report..."
|
126
|
+
/>
|
127
|
+
)}
|
121
128
|
{batchJob.status === BatchJobStatusFailed && (
|
122
129
|
<WarningAltFilled
|
123
130
|
className="report-failed"
|
@@ -0,0 +1,40 @@
|
|
1
|
+
import { z } from "zod";
|
2
|
+
|
3
|
+
export const reportSchema = z.object({
|
4
|
+
startDate: z.coerce.date().refine((date) => date !== undefined, {
|
5
|
+
message: "Start Date is required",
|
6
|
+
}),
|
7
|
+
endDate: z.coerce.date().refine((date) => date !== undefined, {
|
8
|
+
message: "End Date is required",
|
9
|
+
}),
|
10
|
+
location: z.string({ required_error: "Location Required" }).min(1, {
|
11
|
+
message: "Location Required",
|
12
|
+
}),
|
13
|
+
reportName: z.string({ required_error: "Report Name Required" }).min(1, {
|
14
|
+
message: "Report Name Required",
|
15
|
+
}),
|
16
|
+
stockReportItemCategory: z.string().optional(),
|
17
|
+
mostLeastMoving: z.string().optional(),
|
18
|
+
mostLeastMovingName: z.string().optional(),
|
19
|
+
stockItemUuid: z.string().optional(),
|
20
|
+
stockItemName: z.string().optional(),
|
21
|
+
patientUuid: z.string().optional(),
|
22
|
+
patientName: z.string().optional(),
|
23
|
+
locationUuid: z.string().optional(),
|
24
|
+
childLocations: z.boolean().optional(),
|
25
|
+
stockSourceUuid: z.string().optional(),
|
26
|
+
stockSource: z.string().optional(),
|
27
|
+
stockSourceDestinationUuid: z.string().optional(),
|
28
|
+
stockSourceDestination: z.string().optional(),
|
29
|
+
inventoryGroupBy: z.string().optional(),
|
30
|
+
inventoryGroupByName: z.string().optional(),
|
31
|
+
stockItemCategoryConceptUuid: z.string().optional(),
|
32
|
+
reportSystemName: z.string().optional(),
|
33
|
+
stockItemCategory: z.string().optional(),
|
34
|
+
maxReorderLevelRatio: z.number().optional(),
|
35
|
+
fullFillment: z.string().array().optional(),
|
36
|
+
limit: z.string().optional(),
|
37
|
+
date: z.date().optional(),
|
38
|
+
});
|
39
|
+
|
40
|
+
export type StockReportSchema = z.infer<typeof reportSchema>;
|
package/src/stock-user-role-scopes/add-stock-user-scope/add-stock-user-role-scope.component.tsx
CHANGED
@@ -14,10 +14,9 @@ import {
|
|
14
14
|
Select,
|
15
15
|
SelectItem,
|
16
16
|
} from "@carbon/react";
|
17
|
-
import React, { ChangeEvent,
|
17
|
+
import React, { ChangeEvent, useState } from "react";
|
18
18
|
import styles from "./add-stock-user-role-scope.scss";
|
19
19
|
import {
|
20
|
-
UserFilterCriteria,
|
21
20
|
useRoles,
|
22
21
|
useStockOperationTypes,
|
23
22
|
useStockTagLocations,
|
@@ -64,7 +63,6 @@ const AddStockUserRoleScope: React.FC<AddStockUserRoleScopeProps> = ({
|
|
64
63
|
|
65
64
|
const [roles, setRoles] = useState<Role[]>([]);
|
66
65
|
|
67
|
-
const { data: user } = useUser(model?.uuid);
|
68
66
|
const [showItems, setShowItems] = useState(false);
|
69
67
|
|
70
68
|
// operation types
|
@@ -80,6 +78,9 @@ const AddStockUserRoleScope: React.FC<AddStockUserRoleScopeProps> = ({
|
|
80
78
|
isLoading: loadingUsers,
|
81
79
|
} = useUsers({ v: ResourceRepresentation.Default });
|
82
80
|
|
81
|
+
const [selectedUserUuid, setSelectedUserUuid] = useState<string | null>(null);
|
82
|
+
const { data: user, isError } = useUser(selectedUserUuid);
|
83
|
+
|
83
84
|
// get roles
|
84
85
|
const { items: rolesData, isLoading: loadingRoles } = useRoles({
|
85
86
|
v: ResourceRepresentation.Default,
|
@@ -201,17 +202,6 @@ const AddStockUserRoleScope: React.FC<AddStockUserRoleScopeProps> = ({
|
|
201
202
|
const onActiveDatesChange = (dates: Date[]): void => {
|
202
203
|
setFormModel({ ...formModel, activeFrom: dates[0], activeTo: dates[1] });
|
203
204
|
};
|
204
|
-
const handleUsersSearch = useMemo(
|
205
|
-
() =>
|
206
|
-
debounce((searchTerm) => {
|
207
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
208
|
-
useUsers({
|
209
|
-
v: ResourceRepresentation.Default,
|
210
|
-
q: searchTerm,
|
211
|
-
} as any as UserFilterCriteria);
|
212
|
-
}, 3),
|
213
|
-
[]
|
214
|
-
);
|
215
205
|
|
216
206
|
const onUserChanged = (data: { selectedItem: User }) => {
|
217
207
|
const stockRolesUUIDs = [
|
@@ -227,8 +217,7 @@ const AddStockUserRoleScope: React.FC<AddStockUserRoleScopeProps> = ({
|
|
227
217
|
);
|
228
218
|
setFormModel({ ...formModel, userUuid: data.selectedItem?.uuid });
|
229
219
|
setRoles(filteredStockRoles ?? []);
|
230
|
-
|
231
|
-
console.info(roles);
|
220
|
+
setSelectedUserUuid(data?.selectedItem?.uuid);
|
232
221
|
};
|
233
222
|
|
234
223
|
const onRoleChange = (e: ChangeEvent<HTMLSelectElement>) => {
|
@@ -311,7 +300,6 @@ const AddStockUserRoleScope: React.FC<AddStockUserRoleScopeProps> = ({
|
|
311
300
|
}
|
312
301
|
);
|
313
302
|
};
|
314
|
-
|
315
303
|
if (isLoading || loadingRoles || loadingUsers) {
|
316
304
|
return (
|
317
305
|
<InlineLoading
|
@@ -321,7 +309,6 @@ const AddStockUserRoleScope: React.FC<AddStockUserRoleScopeProps> = ({
|
|
321
309
|
/>
|
322
310
|
);
|
323
311
|
}
|
324
|
-
|
325
312
|
return (
|
326
313
|
<div>
|
327
314
|
<Form>
|
@@ -337,6 +324,7 @@ const AddStockUserRoleScope: React.FC<AddStockUserRoleScopeProps> = ({
|
|
337
324
|
size="md"
|
338
325
|
labelText={t("user", "User")}
|
339
326
|
items={filteredItems}
|
327
|
+
onChange={onUserChanged}
|
340
328
|
shouldFilterItem={() => true}
|
341
329
|
itemToString={(item) =>
|
342
330
|
`${item?.person?.display ?? item?.display ?? ""}`
|
@@ -448,6 +436,7 @@ const AddStockUserRoleScope: React.FC<AddStockUserRoleScopeProps> = ({
|
|
448
436
|
<Checkbox
|
449
437
|
value={type.uuid}
|
450
438
|
checked={isOperationChecked(type)}
|
439
|
+
className={styles.checkbox}
|
451
440
|
onChange={(event) =>
|
452
441
|
onStockOperationTypeChanged(
|
453
442
|
event,
|
@@ -455,7 +444,6 @@ const AddStockUserRoleScope: React.FC<AddStockUserRoleScopeProps> = ({
|
|
455
444
|
isOperationChecked(type)
|
456
445
|
)
|
457
446
|
}
|
458
|
-
className={styles.checkbox}
|
459
447
|
labelText={type.name}
|
460
448
|
id={type.uuid}
|
461
449
|
/>
|