@openmrs/esm-stock-management-app 1.0.1-pre.359 → 1.0.1-pre.366
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/{304.js → 835.js} +2 -2
- package/dist/{304.js.map → 835.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 +1 -1
- package/dist/openmrs-esm-stock-management-app.js.buildmanifest.json +48 -48
- 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-lookups/stock-lookups.resource.ts +1 -1
- 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 +5 -16
- package/tsconfig.json +2 -1
- package/dist/969.js +0 -1
- package/dist/969.js.map +0 -1
- /package/dist/{304.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>) => {
|