umwd-components 0.1.622 → 0.1.624
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/node_modules/base64-js/index.js +1 -1
- package/dist/node_modules/ieee754/index.js +1 -1
- package/dist/node_modules/prop-types/node_modules/react-is/index.js +1 -1
- package/dist/node_modules/safe-buffer/index.js +1 -1
- package/dist/src/components/e-commerce/iro/CreateIROForm.js +7 -0
- package/dist/src/components/e-commerce/iro/IROItemFields.js +6 -0
- package/dist/src/components/e-commerce/iro/IROItemUpdater.js +6 -0
- package/dist/src/components/e-commerce/iro/IroItemDisplay.js +6 -0
- package/dist/src/components/e-commerce/iro/IroStatusIndicator.js +7 -0
- package/dist/src/components/e-commerce/iro/ManageIROForm.js +6 -0
- package/dist/src/components/e-commerce/iro/RmaForm.js +7 -0
- package/dist/src/components/e-commerce/iro/TextualIROItemUpdater.js +6 -0
- package/dist/src/components/e-commerce/iro/TextualManageIROForm.js +6 -0
- package/dist/src/components/e-commerce/opo/ManageOpoForm.js +1 -1
- package/dist/src/components/e-commerce/opo/TextualManageOpoForm.js +1 -1
- package/dist/src/components/logistics/ipo/ManageIPOForm.js +1 -1
- package/dist/src/components/logistics/ipo/TextualManageIPOForm.js +1 -1
- package/dist/src/data/actions/e-commerce/iro/createIroAction.js +7 -0
- package/dist/src/data/actions/e-commerce/iro/updateIroAction.js +7 -0
- package/dist/src/data/loaders/e-commerce/getAllOpos.js +7 -0
- package/dist/src/data/loaders/e-commerce/iros/getAllIros.js +7 -0
- package/dist/src/data/loaders/e-commerce/iros/getIroModel.js +7 -0
- package/dist/src/data/loaders/e-commerce/iros/getSingleIro.js +7 -0
- package/dist/src/data/loaders/e-commerce/iros/queryAllIros.js +7 -0
- package/dist/src/data/loaders/e-commerce-loaders.js +1 -1
- package/dist/src/data/services/common/confirmation-service.js +7 -0
- package/dist/src/index.js +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/components/e-commerce/iro/CreateIROForm.d.ts +3 -0
- package/dist/types/components/e-commerce/iro/IROItemFields.d.ts +5 -0
- package/dist/types/components/e-commerce/iro/IROItemUpdater.d.ts +4 -0
- package/dist/types/components/e-commerce/iro/IroItemDisplay.d.ts +4 -0
- package/dist/types/components/e-commerce/iro/IroStatusIndicator.d.ts +10 -0
- package/dist/types/components/e-commerce/iro/ManageIROForm.d.ts +3 -0
- package/dist/types/components/e-commerce/iro/RmaForm.d.ts +3 -0
- package/dist/types/components/e-commerce/iro/TextualIROItemUpdater.d.ts +4 -0
- package/dist/types/components/e-commerce/iro/TextualManageIROForm.d.ts +3 -0
- package/dist/types/data/actions/e-commerce/iro/createIroAction.d.ts +5 -0
- package/dist/types/data/actions/e-commerce/iro/updateIroAction.d.ts +1 -0
- package/dist/types/data/loaders/e-commerce/getAllOpos.d.ts +2 -1
- package/dist/types/data/loaders/e-commerce/iros/getAllIros.d.ts +2 -0
- package/dist/types/data/loaders/e-commerce/iros/getIroModel.d.ts +2 -0
- package/dist/types/data/loaders/e-commerce/iros/getSingleIro.d.ts +2 -0
- package/dist/types/data/loaders/e-commerce/iros/queryAllIros.d.ts +2 -0
- package/dist/types/data/loaders/e-commerce-loaders.d.ts +1 -2
- package/dist/types/index.d.ts +18 -2
- package/dist/types/types/e-commerce/iro/types.d.ts +89 -0
- package/package.json +1 -1
- package/src/components/e-commerce/iro/CreateIROForm.tsx +134 -0
- package/src/components/e-commerce/iro/IROItemFields.tsx +171 -0
- package/src/components/e-commerce/iro/IROItemUpdater.tsx +140 -0
- package/src/components/e-commerce/iro/IroItemDisplay.tsx +41 -0
- package/src/components/e-commerce/iro/IroStatusIndicator.tsx +81 -0
- package/src/components/e-commerce/iro/ManageIROForm.tsx +450 -0
- package/src/components/e-commerce/iro/RmaForm.tsx +225 -0
- package/src/components/e-commerce/iro/TextualIROItemUpdater.tsx +217 -0
- package/src/components/e-commerce/iro/TextualManageIROForm.tsx +456 -0
- package/src/components/e-commerce/opo/ManageOpoForm.tsx +1 -1
- package/src/components/e-commerce/opo/TextualManageOpoForm.tsx +1 -1
- package/src/components/logistics/ipo/ManageIPOForm.tsx +1 -1
- package/src/components/logistics/ipo/TextualManageIPOForm.tsx +1 -3
- package/src/data/actions/e-commerce/iro/createIroAction.ts +46 -0
- package/src/data/actions/e-commerce/iro/updateIroAction.ts +43 -0
- package/src/data/loaders/e-commerce/getAllOpos.ts +3 -1
- package/src/data/loaders/e-commerce/iros/getAllIros.ts +64 -0
- package/src/data/loaders/e-commerce/iros/getIroModel.ts +18 -0
- package/src/data/loaders/e-commerce/iros/getSingleIro.ts +47 -0
- package/src/data/loaders/e-commerce/iros/queryAllIros.ts +26 -0
- package/src/data/loaders/e-commerce-loaders.ts +2 -1
- package/src/data/services/{logistics/ipo → common}/confirmation-service.ts +2 -2
- package/src/index.ts +21 -2
- package/src/types/e-commerce/iro/types.ts +109 -0
- package/dist/src/data/services/logistics/ipo/confirmation-service.js +0 -7
- /package/dist/types/data/services/{logistics/ipo → common}/confirmation-service.d.ts +0 -0
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import Stack from "@mui/material/Stack";
|
|
3
|
+
import Typography from "@mui/material/Typography";
|
|
4
|
+
import IconButton from "@mui/material/IconButton";
|
|
5
|
+
import Divider from "@mui/material/Divider";
|
|
6
|
+
import Collapse from "@mui/material/Collapse";
|
|
7
|
+
import AmountUpdater from "../../common/AmountUpdater";
|
|
8
|
+
import ArrowButtonDownIcon from "@mui/icons-material/ArrowDropDown";
|
|
9
|
+
|
|
10
|
+
import { ItemUpdaterProps } from "../../../types/logistics/Ipo";
|
|
11
|
+
import ImagePreviewTooltip from "../../common/ImagePreviewTooltip";
|
|
12
|
+
import { Report } from "../../../types/logistics/Report";
|
|
13
|
+
import ReportMakingComponent from "../../logistics/report/ReportMakingComponent";
|
|
14
|
+
import ReportsDisplay from "../../logistics/report/ReportsDisplay";
|
|
15
|
+
|
|
16
|
+
function ItemUpdater({
|
|
17
|
+
item,
|
|
18
|
+
index,
|
|
19
|
+
handleUpdateQuantity,
|
|
20
|
+
image,
|
|
21
|
+
revalidateCallback,
|
|
22
|
+
}: ItemUpdaterProps) {
|
|
23
|
+
const {
|
|
24
|
+
line_item_number,
|
|
25
|
+
product,
|
|
26
|
+
received_quantity,
|
|
27
|
+
registered_quantity,
|
|
28
|
+
released_quantity,
|
|
29
|
+
ordered_quantity,
|
|
30
|
+
reports,
|
|
31
|
+
} = item;
|
|
32
|
+
|
|
33
|
+
const received_bad_quantity =
|
|
34
|
+
reports?.data !== undefined && reports.data.length > 0
|
|
35
|
+
? reports.data
|
|
36
|
+
.filter((report) => report.type === "received")
|
|
37
|
+
.reduce((a, b) => a + b.quantity, 0)
|
|
38
|
+
: 0;
|
|
39
|
+
|
|
40
|
+
const registered_bad_quantity =
|
|
41
|
+
reports?.data !== undefined && reports.data.length > 0
|
|
42
|
+
? reports.data
|
|
43
|
+
.filter((report) => report.type === "registered")
|
|
44
|
+
.reduce((a, b) => a + b.quantity, 0)
|
|
45
|
+
: 0;
|
|
46
|
+
|
|
47
|
+
const [open, setOpen] = useState(false);
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<Stack spacing={1} key={index}>
|
|
51
|
+
{item && (
|
|
52
|
+
<>
|
|
53
|
+
<Stack direction={"row"} justifyContent={"space-between"}>
|
|
54
|
+
<Stack spacing={1}>
|
|
55
|
+
<Typography variant="body1">
|
|
56
|
+
Line Item Number: {line_item_number}
|
|
57
|
+
</Typography>
|
|
58
|
+
<Typography variant="body1">
|
|
59
|
+
Part Number: {product.product_number}
|
|
60
|
+
</Typography>
|
|
61
|
+
</Stack>
|
|
62
|
+
{image && (
|
|
63
|
+
<>
|
|
64
|
+
<ImagePreviewTooltip image={image} label={item.product.title} />
|
|
65
|
+
</>
|
|
66
|
+
)}
|
|
67
|
+
</Stack>
|
|
68
|
+
<Typography variant="body2">Received</Typography>
|
|
69
|
+
<AmountUpdater
|
|
70
|
+
currentValue={received_quantity}
|
|
71
|
+
totalValue={ordered_quantity + received_bad_quantity}
|
|
72
|
+
minNewValue={0 + registered_quantity + -registered_bad_quantity}
|
|
73
|
+
maxNewValue={ordered_quantity + received_bad_quantity}
|
|
74
|
+
color={"info"}
|
|
75
|
+
handleChange={(newValue) => {
|
|
76
|
+
handleUpdateQuantity(newValue, item.id, "received_quantity");
|
|
77
|
+
}}
|
|
78
|
+
/>
|
|
79
|
+
<Typography variant="body2">Registered</Typography>
|
|
80
|
+
<AmountUpdater
|
|
81
|
+
currentValue={registered_quantity}
|
|
82
|
+
totalValue={ordered_quantity + received_bad_quantity}
|
|
83
|
+
minNewValue={0 + released_quantity}
|
|
84
|
+
maxNewValue={received_quantity + registered_bad_quantity}
|
|
85
|
+
color={"info"}
|
|
86
|
+
handleChange={(newValue) => {
|
|
87
|
+
handleUpdateQuantity(newValue, item.id, "registered_quantity");
|
|
88
|
+
}}
|
|
89
|
+
offsetEnd={registered_bad_quantity}
|
|
90
|
+
/>
|
|
91
|
+
<Divider sx={{ p: 0 }}>
|
|
92
|
+
<Stack direction={"row"} spacing={1} alignItems={"center"}>
|
|
93
|
+
<Typography variant="body2">
|
|
94
|
+
Irregularities / Corrections
|
|
95
|
+
</Typography>
|
|
96
|
+
<IconButton onClick={() => setOpen(!open)}>
|
|
97
|
+
<ArrowButtonDownIcon />
|
|
98
|
+
</IconButton>
|
|
99
|
+
</Stack>
|
|
100
|
+
</Divider>
|
|
101
|
+
|
|
102
|
+
<Collapse in={open}>
|
|
103
|
+
<Stack spacing={2}>
|
|
104
|
+
<Typography variant="body2">
|
|
105
|
+
Here you can report and correct for damages wrong items etc. Do
|
|
106
|
+
not forget to click the button!
|
|
107
|
+
</Typography>
|
|
108
|
+
<ReportsDisplay reports={reports.data as Report[]} />
|
|
109
|
+
<ReportMakingComponent
|
|
110
|
+
content={"content"}
|
|
111
|
+
quantity={0}
|
|
112
|
+
type="registered"
|
|
113
|
+
minValue={-(received_quantity + registered_bad_quantity)}
|
|
114
|
+
maxValue={received_quantity}
|
|
115
|
+
related={[{ id: item.id, __type: "api::logistics.ipo-item" }]}
|
|
116
|
+
revalidateCallback={revalidateCallback}
|
|
117
|
+
/>
|
|
118
|
+
</Stack>
|
|
119
|
+
</Collapse>
|
|
120
|
+
|
|
121
|
+
<Typography variant="body2">Released</Typography>
|
|
122
|
+
<AmountUpdater
|
|
123
|
+
currentValue={released_quantity || 0}
|
|
124
|
+
totalValue={
|
|
125
|
+
ordered_quantity + received_bad_quantity + registered_bad_quantity
|
|
126
|
+
}
|
|
127
|
+
minNewValue={0}
|
|
128
|
+
maxNewValue={registered_quantity}
|
|
129
|
+
color={"info"}
|
|
130
|
+
handleChange={(newValue) => {
|
|
131
|
+
handleUpdateQuantity(newValue, item.id, "released_quantity");
|
|
132
|
+
}}
|
|
133
|
+
/>
|
|
134
|
+
</>
|
|
135
|
+
)}
|
|
136
|
+
</Stack>
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export default ItemUpdater;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Stack from "@mui/material/Stack";
|
|
3
|
+
import Typography from "@mui/material/Typography";
|
|
4
|
+
|
|
5
|
+
import { IroItemDisplayProps } from "../../../types/e-commerce/iro/types";
|
|
6
|
+
import ImagePreviewTooltip from "../../../components/common/ImagePreviewTooltip";
|
|
7
|
+
|
|
8
|
+
function IroItemDisplay({ item, index, image }: IroItemDisplayProps) {
|
|
9
|
+
const { line_item_number, product, returned_quantity } = item;
|
|
10
|
+
|
|
11
|
+
return (
|
|
12
|
+
<Stack spacing={1} key={index}>
|
|
13
|
+
{item && (
|
|
14
|
+
<Stack
|
|
15
|
+
direction={"row"}
|
|
16
|
+
justifyContent={"space-between"}
|
|
17
|
+
alignItems={"center"}
|
|
18
|
+
>
|
|
19
|
+
<Stack spacing={1}>
|
|
20
|
+
<Typography variant="body1">
|
|
21
|
+
Line Item Number: {line_item_number}
|
|
22
|
+
</Typography>
|
|
23
|
+
<Typography variant="body1">
|
|
24
|
+
Part Number: {product?.product_number}
|
|
25
|
+
</Typography>
|
|
26
|
+
<Typography variant="body1">
|
|
27
|
+
Quantity Ordered: {returned_quantity}
|
|
28
|
+
</Typography>
|
|
29
|
+
</Stack>
|
|
30
|
+
{image && (
|
|
31
|
+
<>
|
|
32
|
+
<ImagePreviewTooltip image={image} label={item.product?.title} />
|
|
33
|
+
</>
|
|
34
|
+
)}
|
|
35
|
+
</Stack>
|
|
36
|
+
)}
|
|
37
|
+
</Stack>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export default IroItemDisplay;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import React from "react";
|
|
4
|
+
|
|
5
|
+
import Chip from "@mui/material/Chip";
|
|
6
|
+
|
|
7
|
+
import { IpoStatus } from "../../../types/logistics/Ipo";
|
|
8
|
+
import { Role } from "../../../types/auth/Role";
|
|
9
|
+
|
|
10
|
+
interface IroStatusIndicatorProps {
|
|
11
|
+
status: IpoStatus;
|
|
12
|
+
provider_id?: string;
|
|
13
|
+
role?: Role;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const statusColorArray: {
|
|
17
|
+
status: IpoStatus;
|
|
18
|
+
color: "warning" | "info" | "success" | "error" | "default";
|
|
19
|
+
}[] = [
|
|
20
|
+
{ status: "placed", color: "info" },
|
|
21
|
+
{ status: "ordered", color: "info" },
|
|
22
|
+
{ status: "logistics_operator_process", color: "info" },
|
|
23
|
+
{ status: "released_on_stock", color: "info" },
|
|
24
|
+
{ status: "done", color: "success" },
|
|
25
|
+
{ status: "cancelled", color: "error" },
|
|
26
|
+
{ status: null, color: "default" },
|
|
27
|
+
];
|
|
28
|
+
|
|
29
|
+
const enduserStatusColorArray: {
|
|
30
|
+
status: IpoStatus;
|
|
31
|
+
color: "warning" | "info" | "success" | "error" | "default";
|
|
32
|
+
}[] = [
|
|
33
|
+
{ status: "placed", color: "warning" },
|
|
34
|
+
{ status: "ordered", color: "info" },
|
|
35
|
+
{ status: "logistics_operator_process", color: "info" },
|
|
36
|
+
{ status: "released_on_stock", color: "info" },
|
|
37
|
+
{ status: "done", color: "success" },
|
|
38
|
+
{ status: "cancelled", color: "error" },
|
|
39
|
+
{ status: null, color: "default" },
|
|
40
|
+
];
|
|
41
|
+
|
|
42
|
+
const dispatcherStatusColorArray: {
|
|
43
|
+
status: IpoStatus;
|
|
44
|
+
color: "warning" | "info" | "success" | "error" | "default";
|
|
45
|
+
}[] = [
|
|
46
|
+
{ status: "placed", color: "info" },
|
|
47
|
+
{ status: "ordered", color: "warning" },
|
|
48
|
+
{ status: "logistics_operator_process", color: "info" },
|
|
49
|
+
{ status: "released_on_stock", color: "info" },
|
|
50
|
+
{ status: "done", color: "success" },
|
|
51
|
+
{ status: "cancelled", color: "error" },
|
|
52
|
+
{ status: null, color: "default" },
|
|
53
|
+
];
|
|
54
|
+
|
|
55
|
+
export const IroStatusIndicator: React.FC<IroStatusIndicatorProps> = ({
|
|
56
|
+
status,
|
|
57
|
+
role,
|
|
58
|
+
}) => {
|
|
59
|
+
const readableStatus = status
|
|
60
|
+
? status
|
|
61
|
+
.split("_")
|
|
62
|
+
.map((word) => word.charAt(0).toUpperCase() + word.slice(1))
|
|
63
|
+
.join(" ")
|
|
64
|
+
: "Unknown";
|
|
65
|
+
|
|
66
|
+
return (
|
|
67
|
+
<Chip
|
|
68
|
+
label={readableStatus}
|
|
69
|
+
color={
|
|
70
|
+
role === "enduser"
|
|
71
|
+
? enduserStatusColorArray.find((s) => s.status === status)?.color ||
|
|
72
|
+
"default"
|
|
73
|
+
: role === "dispatcher"
|
|
74
|
+
? dispatcherStatusColorArray.find((s) => s.status === status)
|
|
75
|
+
?.color || "default"
|
|
76
|
+
: statusColorArray.find((s) => s.status === status)?.color ||
|
|
77
|
+
"default"
|
|
78
|
+
}
|
|
79
|
+
/>
|
|
80
|
+
);
|
|
81
|
+
};
|