@openmrs/esm-stock-management-app 1.0.1-pre.413 → 1.0.1-pre.418
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/39.js +1 -1
- package/dist/39.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/core/components/carbon/controlled-number-input/controlled-number-input.component.tsx +1 -0
- package/src/stock-items/add-stock-item/packaging-units/packaging-units.component.tsx +2 -0
- package/src/stock-items/add-stock-item/stock-item-details/stock-item-details.component.tsx +1 -0
- package/src/stock-reports/generate-report/create-stock-report.component.tsx +59 -3
- package/src/stock-reports/report-validation-schema.ts +73 -36
@@ -32,9 +32,9 @@
|
|
32
32
|
"initial": false,
|
33
33
|
"entry": false,
|
34
34
|
"recorded": false,
|
35
|
-
"size":
|
35
|
+
"size": 1037961,
|
36
36
|
"sizes": {
|
37
|
-
"javascript":
|
37
|
+
"javascript": 1037751,
|
38
38
|
"consume-shared": 210
|
39
39
|
},
|
40
40
|
"names": [],
|
@@ -48,7 +48,7 @@
|
|
48
48
|
"auxiliaryFiles": [
|
49
49
|
"39.js.map"
|
50
50
|
],
|
51
|
-
"hash": "
|
51
|
+
"hash": "961566f1d8c2c3a7",
|
52
52
|
"childrenByOrder": {}
|
53
53
|
},
|
54
54
|
{
|
@@ -110,10 +110,10 @@
|
|
110
110
|
"initial": true,
|
111
111
|
"entry": true,
|
112
112
|
"recorded": false,
|
113
|
-
"size":
|
113
|
+
"size": 4729141,
|
114
114
|
"sizes": {
|
115
115
|
"consume-shared": 252,
|
116
|
-
"javascript":
|
116
|
+
"javascript": 4707193,
|
117
117
|
"share-init": 252,
|
118
118
|
"runtime": 21444
|
119
119
|
},
|
@@ -130,7 +130,7 @@
|
|
130
130
|
"auxiliaryFiles": [
|
131
131
|
"main.js.map"
|
132
132
|
],
|
133
|
-
"hash": "
|
133
|
+
"hash": "a943f526f7763672",
|
134
134
|
"childrenByOrder": {}
|
135
135
|
},
|
136
136
|
{
|
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"},{"name":"delete-packaging-unit-modal","component":"deletePackagingUnitModal"},{"name":"delete-packaging-unit-button","component":"deletePackagingUnitButton"}],"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"},{"name":"delete-packaging-unit-modal","component":"deletePackagingUnitModal"},{"name":"delete-packaging-unit-button","component":"deletePackagingUnitButton"}],"pages":[{"component":"stockManagement","route":"stock-management"}],"version":"1.0.1-pre.418"}
|
package/package.json
CHANGED
package/src/core/components/carbon/controlled-number-input/controlled-number-input.component.tsx
CHANGED
@@ -20,6 +20,7 @@ const ControlledNumberInput = <T,>(props: ControlledNumberInputProps<T>) => {
|
|
20
20
|
<NumberInput
|
21
21
|
id={`${props.name}-${props.row?.id}-${props.row?.uuid}`}
|
22
22
|
value={props.row?.factor ?? value}
|
23
|
+
min={props.min}
|
23
24
|
ref={ref}
|
24
25
|
onChange={(
|
25
26
|
event: React.MouseEvent<HTMLButtonElement>,
|
@@ -174,6 +174,7 @@ const PackagingUnitRow: React.FC<{
|
|
174
174
|
control,
|
175
175
|
formState: { errors },
|
176
176
|
} = useFormContext();
|
177
|
+
const minPackagingQuantity = 0;
|
177
178
|
|
178
179
|
return (
|
179
180
|
<>
|
@@ -198,6 +199,7 @@ const PackagingUnitRow: React.FC<{
|
|
198
199
|
row={row}
|
199
200
|
controllerName="factor"
|
200
201
|
name="factor"
|
202
|
+
min={minPackagingQuantity}
|
201
203
|
control={control}
|
202
204
|
id={`${row.uuid}-${key}`}
|
203
205
|
invalid={!!errors.factor}
|
@@ -172,6 +172,7 @@ const StockItemDetails = forwardRef<never, StockItemDetailsProps>(
|
|
172
172
|
name="expiryNotice"
|
173
173
|
control={control}
|
174
174
|
controllerName="expiryNotice"
|
175
|
+
min={0}
|
175
176
|
size={"md"}
|
176
177
|
allowEmpty={true}
|
177
178
|
label={t("expiryNoticeDays", "Expiration Notice (days)")}
|
@@ -355,7 +355,7 @@ const CreateReport: React.FC<CreateReportProps> = ({ model }) => {
|
|
355
355
|
if (displayDate) {
|
356
356
|
parameters += getReportParameter(
|
357
357
|
ReportParameter.Date,
|
358
|
-
JSON.stringify(report.date).replaceAll('"', ""),
|
358
|
+
report.date ? JSON.stringify(report.date).replaceAll('"', "") : "",
|
359
359
|
formatDisplayDate(report.date) ?? "",
|
360
360
|
t("stockmanagement.report.edit.date"),
|
361
361
|
newLine
|
@@ -364,7 +364,9 @@ const CreateReport: React.FC<CreateReportProps> = ({ model }) => {
|
|
364
364
|
if (displayStartDate) {
|
365
365
|
parameters += getReportParameter(
|
366
366
|
ReportParameter.StartDate,
|
367
|
-
|
367
|
+
report.startDate
|
368
|
+
? JSON.stringify(report.startDate).replaceAll('"', "")
|
369
|
+
: "",
|
368
370
|
formatDisplayDate(report.startDate) ?? "",
|
369
371
|
t(getReportStartDateLabel(report.reportSystemName)),
|
370
372
|
newLine
|
@@ -373,7 +375,9 @@ const CreateReport: React.FC<CreateReportProps> = ({ model }) => {
|
|
373
375
|
if (displayEndDate) {
|
374
376
|
parameters += getReportParameter(
|
375
377
|
ReportParameter.EndDate,
|
376
|
-
|
378
|
+
report.endDate
|
379
|
+
? JSON.stringify(report.endDate).replaceAll('"', "")
|
380
|
+
: "",
|
377
381
|
formatDisplayDate(report.endDate) ?? "",
|
378
382
|
t(getReportEndDateLabel(report.reportSystemName)),
|
379
383
|
newLine
|
@@ -529,6 +533,30 @@ const CreateReport: React.FC<CreateReportProps> = ({ model }) => {
|
|
529
533
|
)}
|
530
534
|
/>
|
531
535
|
)}
|
536
|
+
{displayInventoryGroupBy && (
|
537
|
+
<Select
|
538
|
+
id="inventoryGroupBy"
|
539
|
+
defaultValue={model?.inventoryGroupBy}
|
540
|
+
invalid={errors?.inventoryGroupBy?.message}
|
541
|
+
invalidText={errors?.inventoryGroupBy?.message}
|
542
|
+
labelText={t("inventoryBy", "Inventory by")}
|
543
|
+
onChange={(e) => setValue("inventoryGroupBy", e.target.value)}
|
544
|
+
>
|
545
|
+
<SelectItem value="" text={t("SelectOption", "Select an option")} />
|
546
|
+
<SelectItem
|
547
|
+
value="StockItemOnly"
|
548
|
+
text={t("stockItem", "Stock Item")}
|
549
|
+
/>
|
550
|
+
<SelectItem
|
551
|
+
value="LocationStockItem"
|
552
|
+
text={t("lcationstockitem", "Location and Stock Item")}
|
553
|
+
/>
|
554
|
+
<SelectItem
|
555
|
+
value="LocationStockItemBatchNo"
|
556
|
+
text={t("locationBatchno", "Location and Batch")}
|
557
|
+
/>
|
558
|
+
</Select>
|
559
|
+
)}
|
532
560
|
{displayLocation && (
|
533
561
|
<Select
|
534
562
|
name="location"
|
@@ -537,6 +565,8 @@ const CreateReport: React.FC<CreateReportProps> = ({ model }) => {
|
|
537
565
|
id="location"
|
538
566
|
onChange={(e) => setValue("location", e.target.value)}
|
539
567
|
defaultValue=""
|
568
|
+
invalid={errors?.location?.message}
|
569
|
+
invalidText={errors?.location?.message}
|
540
570
|
>
|
541
571
|
<SelectItem
|
542
572
|
disabled
|
@@ -674,6 +704,32 @@ const CreateReport: React.FC<CreateReportProps> = ({ model }) => {
|
|
674
704
|
/>
|
675
705
|
</div>
|
676
706
|
)}
|
707
|
+
{displayDate && (
|
708
|
+
<Controller
|
709
|
+
control={control}
|
710
|
+
name="date"
|
711
|
+
render={({ field: { onChange, value } }) => (
|
712
|
+
<DatePicker
|
713
|
+
datePickerType="single"
|
714
|
+
maxDate={formatForDatePicker(today())}
|
715
|
+
locale="en"
|
716
|
+
dateFormat={DATE_PICKER_CONTROL_FORMAT}
|
717
|
+
onChange={onChange}
|
718
|
+
value={value}
|
719
|
+
>
|
720
|
+
<DatePickerInput
|
721
|
+
id="date"
|
722
|
+
name="date"
|
723
|
+
placeholder={DATE_PICKER_FORMAT}
|
724
|
+
labelText={t("date", "Date")}
|
725
|
+
defaultValue=""
|
726
|
+
invalid={errors?.date?.message}
|
727
|
+
invalidText={errors?.date?.message}
|
728
|
+
/>
|
729
|
+
</DatePicker>
|
730
|
+
)}
|
731
|
+
/>
|
732
|
+
)}
|
677
733
|
</div>
|
678
734
|
<div className={styles.reportButton}>
|
679
735
|
<Button kind="secondary" onClick={closeOverlay}>
|
@@ -1,40 +1,77 @@
|
|
1
1
|
import { z } from "zod";
|
2
2
|
|
3
|
-
export const reportSchema = z
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
3
|
+
export const reportSchema = z
|
4
|
+
.object({
|
5
|
+
startDate: z.coerce.date().optional(),
|
6
|
+
endDate: z.coerce.date().optional(),
|
7
|
+
location: z.string({ required_error: "Location Required" }).min(1, {
|
8
|
+
message: "Location Required",
|
9
|
+
}),
|
10
|
+
reportName: z.string({ required_error: "Report Name Required" }).min(1, {
|
11
|
+
message: "Report Name Required",
|
12
|
+
}),
|
13
|
+
stockReportItemCategory: z.string().optional(),
|
14
|
+
mostLeastMoving: z.string().optional(),
|
15
|
+
mostLeastMovingName: z.string().optional(),
|
16
|
+
stockItemUuid: z.string().optional(),
|
17
|
+
stockItemName: z.string().optional(),
|
18
|
+
patientUuid: z.string().optional(),
|
19
|
+
patientName: z.string().optional(),
|
20
|
+
locationUuid: z.string().optional(),
|
21
|
+
childLocations: z.boolean().optional(),
|
22
|
+
stockSourceUuid: z.string().optional(),
|
23
|
+
stockSource: z.string().optional(),
|
24
|
+
stockSourceDestinationUuid: z.string().optional(),
|
25
|
+
stockSourceDestination: z.string().optional(),
|
26
|
+
inventoryGroupBy: z.string().optional(),
|
27
|
+
stockItemCategory: z.string().optional(),
|
28
|
+
inventoryGroupByName: z.string().optional(),
|
29
|
+
stockItemCategoryConceptUuid: z.string().optional(),
|
30
|
+
reportSystemName: z.string().optional(),
|
31
|
+
maxReorderLevelRatio: z.number().optional(),
|
32
|
+
fullFillment: z.string().array().optional(),
|
33
|
+
limit: z.string().optional(),
|
34
|
+
date: z.coerce.date().optional(),
|
35
|
+
})
|
36
|
+
.superRefine((data, ctx) => {
|
37
|
+
if (
|
38
|
+
data.reportName !== "Stock Status Report" &&
|
39
|
+
data.reportName !== "Stock-Out Report"
|
40
|
+
) {
|
41
|
+
if (!data.startDate) {
|
42
|
+
ctx.addIssue({
|
43
|
+
code: z.ZodIssueCode.custom,
|
44
|
+
message: "Start Date is required ",
|
45
|
+
path: ["startDate"],
|
46
|
+
});
|
47
|
+
}
|
48
|
+
if (!data.endDate) {
|
49
|
+
ctx.addIssue({
|
50
|
+
code: z.ZodIssueCode.custom,
|
51
|
+
message: "End Date is required",
|
52
|
+
path: ["endDate"],
|
53
|
+
});
|
54
|
+
}
|
55
|
+
}
|
56
|
+
if (
|
57
|
+
data.reportName === "Stock Status Report" ||
|
58
|
+
data.reportName === "Stock-Out Report"
|
59
|
+
) {
|
60
|
+
if (!data.date) {
|
61
|
+
ctx.addIssue({
|
62
|
+
code: z.ZodIssueCode.custom,
|
63
|
+
message: "Date is required ",
|
64
|
+
path: ["date"],
|
65
|
+
});
|
66
|
+
}
|
67
|
+
if (!data.inventoryGroupBy) {
|
68
|
+
ctx.addIssue({
|
69
|
+
code: z.ZodIssueCode.custom,
|
70
|
+
message: "Inventory by is required ",
|
71
|
+
path: ["inventoryGroupBy"],
|
72
|
+
});
|
73
|
+
}
|
74
|
+
}
|
75
|
+
});
|
39
76
|
|
40
77
|
export type StockReportSchema = z.infer<typeof reportSchema>;
|