umwd-components 0.1.687 → 0.1.688
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/src/components/e-commerce/products/EditStockForm.js +1 -1
- package/dist/src/components/logistics/note/NoteTakingComponent.js +1 -1
- package/dist/src/components/logistics/report/ReportMakingComponent.js +1 -1
- package/dist/src/data/actions/logistics/note/createNoteAction.js +1 -1
- package/dist/src/data/loaders/e-commerce/getAllOpos.js +1 -1
- package/dist/src/data/loaders/e-commerce/getPaginatedCategories.js +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/components/logistics/report/ReportMakingComponent.d.ts +1 -1
- package/dist/types/data/loaders/e-commerce/getAllOpos.d.ts +1 -1
- package/dist/types/data/loaders/e-commerce/getPaginatedCategories.d.ts +1 -1
- package/dist/types/types/logistics/Report.d.ts +1 -0
- package/package.json +1 -1
- package/src/components/e-commerce/products/EditStockForm.tsx +5 -2
- package/src/components/logistics/note/NoteTakingComponent.tsx +28 -23
- package/src/components/logistics/report/ReportMakingComponent.tsx +25 -8
- package/src/data/actions/logistics/note/createNoteAction.ts +3 -0
- package/src/data/loaders/e-commerce/getAllOpos.ts +1 -1
- package/src/data/loaders/e-commerce/getPaginatedCategories.ts +9 -2
- package/src/types/logistics/Report.ts +1 -0
|
@@ -2,4 +2,4 @@ import React from "react";
|
|
|
2
2
|
import { ReportMakingComponentProps } from "../../../types/logistics/Report";
|
|
3
3
|
/** INFO Reports can only be created with entities that already excist,
|
|
4
4
|
* this is because the report has to be saved with a relation to the parent entity */
|
|
5
|
-
export default function ReportMakingComponent({ content, related, type, minValue, maxValue, revalidateCallback, }: ReportMakingComponentProps): React.JSX.Element;
|
|
5
|
+
export default function ReportMakingComponent({ content, related, type, minValue, maxValue, revalidateCallback, biggerButton, }: ReportMakingComponentProps): React.JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare function getAllOpos(currentPage: number, rowsPerPage: number, order: "asc" | "desc", orderBy: string, is_archive
|
|
1
|
+
declare function getAllOpos(currentPage: number, rowsPerPage: number, order: "asc" | "desc", orderBy: string, is_archive?: boolean[]): Promise<any>;
|
|
2
2
|
export { getAllOpos };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function getPaginatedCategories(currentPage?: number, rowsPerPage?: number, order?: "asc" | "desc", orderBy?: string): Promise<any>;
|
|
1
|
+
export declare function getPaginatedCategories(currentPage?: number, rowsPerPage?: number, order?: "asc" | "desc", orderBy?: string, is_archive?: boolean[]): Promise<any>;
|
package/package.json
CHANGED
|
@@ -392,6 +392,7 @@ export function EditStockForm({
|
|
|
392
392
|
type="stock"
|
|
393
393
|
related={[{ id: id, __type: "api::e-commerce.product" }]}
|
|
394
394
|
revalidateCallback={revalidateCallback}
|
|
395
|
+
biggerButton={true}
|
|
395
396
|
/>
|
|
396
397
|
</Stack>
|
|
397
398
|
</Stack>
|
|
@@ -399,7 +400,7 @@ export function EditStockForm({
|
|
|
399
400
|
<Grid item xs={12}>
|
|
400
401
|
<Stack
|
|
401
402
|
direction="row"
|
|
402
|
-
justifyContent="
|
|
403
|
+
justifyContent="flex-end"
|
|
403
404
|
alignItems="center"
|
|
404
405
|
sx={{ py: 1 }}
|
|
405
406
|
>
|
|
@@ -408,11 +409,13 @@ export function EditStockForm({
|
|
|
408
409
|
Close
|
|
409
410
|
</Button>
|
|
410
411
|
)}
|
|
412
|
+
{/*
|
|
413
|
+
Nothing to submit here, the form is just for the reports
|
|
411
414
|
<SubmitButton
|
|
412
415
|
text="Update Stock"
|
|
413
416
|
loadingText="Updating..."
|
|
414
417
|
variant="contained"
|
|
415
|
-
/>
|
|
418
|
+
/> */}
|
|
416
419
|
</Stack>
|
|
417
420
|
</Grid>
|
|
418
421
|
</Grid>
|
|
@@ -17,12 +17,14 @@ import { useFormState } from "react-dom";
|
|
|
17
17
|
import { createNoteAction } from "../../../data/actions/logistics/note/createNoteAction";
|
|
18
18
|
import { NoteTakingComponentProps } from "../../../types/logistics/Note";
|
|
19
19
|
import MarkdownEditor from "../../../components/common/markdown/MarkdownEditor";
|
|
20
|
+
import { useSnackbar } from "../../../context/common/SnackbarContext";
|
|
20
21
|
|
|
21
22
|
const INITIAL_STATE = {
|
|
22
23
|
zodErrors: null,
|
|
23
24
|
strapiErrors: null,
|
|
24
25
|
data: null,
|
|
25
26
|
message: null,
|
|
27
|
+
severity: null,
|
|
26
28
|
};
|
|
27
29
|
|
|
28
30
|
/** INFO Notes can only be created with entities that already excist,
|
|
@@ -41,11 +43,28 @@ export default function NoteTakingComponent({
|
|
|
41
43
|
INITIAL_STATE
|
|
42
44
|
);
|
|
43
45
|
|
|
46
|
+
const { handleAddMessage } = useSnackbar();
|
|
47
|
+
|
|
44
48
|
useEffect(() => {
|
|
45
|
-
if (formState?.
|
|
46
|
-
|
|
49
|
+
if (formState?.strapiErrors) {
|
|
50
|
+
handleAddMessage({
|
|
51
|
+
message: formState.strapiErrors,
|
|
52
|
+
severity: formState.severity || "error",
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
if (formState?.message) {
|
|
56
|
+
handleAddMessage({
|
|
57
|
+
message: formState.message,
|
|
58
|
+
severity: formState.severity || "success",
|
|
59
|
+
});
|
|
60
|
+
if (formState?.severity === "success") {
|
|
61
|
+
setOpen(false);
|
|
62
|
+
if (revalidateCallback) {
|
|
63
|
+
revalidateCallback();
|
|
64
|
+
}
|
|
65
|
+
}
|
|
47
66
|
}
|
|
48
|
-
}, [formState
|
|
67
|
+
}, [formState]);
|
|
49
68
|
|
|
50
69
|
return (
|
|
51
70
|
<>
|
|
@@ -60,7 +79,12 @@ export default function NoteTakingComponent({
|
|
|
60
79
|
<NoteAltIcon fontSize="large" />
|
|
61
80
|
</IconButton>
|
|
62
81
|
|
|
63
|
-
<Dialog
|
|
82
|
+
<Dialog
|
|
83
|
+
open={open}
|
|
84
|
+
fullWidth={true}
|
|
85
|
+
maxWidth={"lg"}
|
|
86
|
+
onClose={() => setOpen(false)}
|
|
87
|
+
>
|
|
64
88
|
<form action={formAction}>
|
|
65
89
|
<DialogContent sx={{ p: 1 }}>
|
|
66
90
|
<Paper
|
|
@@ -75,22 +99,7 @@ export default function NoteTakingComponent({
|
|
|
75
99
|
<Stack spacing={2}>
|
|
76
100
|
<Typography variant="body1" textAlign={"right"}>
|
|
77
101
|
{dayjs(Date.now()).format("DD-MM-YYYY")}
|
|
78
|
-
{/* format(Date.now(), "dd-MM-yyyy")} */}
|
|
79
102
|
</Typography>
|
|
80
|
-
{/* <TextField
|
|
81
|
-
id="content"
|
|
82
|
-
name="content"
|
|
83
|
-
sx={{
|
|
84
|
-
color: "black",
|
|
85
|
-
label: { color: "black" },
|
|
86
|
-
input: { color: "black" },
|
|
87
|
-
div: { color: "black" },
|
|
88
|
-
}}
|
|
89
|
-
label="The note"
|
|
90
|
-
multiline
|
|
91
|
-
rows={12}
|
|
92
|
-
defaultValue={content}
|
|
93
|
-
/> */}
|
|
94
103
|
<MarkdownEditor
|
|
95
104
|
name={"content"}
|
|
96
105
|
label="The note"
|
|
@@ -108,10 +117,6 @@ export default function NoteTakingComponent({
|
|
|
108
117
|
<DialogActions>
|
|
109
118
|
<Button onClick={() => setOpen(false)}>Cancel</Button>
|
|
110
119
|
<SubmitButton text="Submit" loadingText="Loading..." />
|
|
111
|
-
<StrapiErrors error={formState?.strapiErrors} />
|
|
112
|
-
{formState?.message && (
|
|
113
|
-
<Alert severity="error">{formState?.message}</Alert>
|
|
114
|
-
)}
|
|
115
120
|
</DialogActions>
|
|
116
121
|
</form>
|
|
117
122
|
</Dialog>
|
|
@@ -38,6 +38,7 @@ export default function ReportMakingComponent({
|
|
|
38
38
|
minValue,
|
|
39
39
|
maxValue,
|
|
40
40
|
revalidateCallback,
|
|
41
|
+
biggerButton = false, // if true, the button will be bigger
|
|
41
42
|
}: ReportMakingComponentProps) {
|
|
42
43
|
const [open, setOpen] = useState(false);
|
|
43
44
|
|
|
@@ -92,14 +93,30 @@ export default function ReportMakingComponent({
|
|
|
92
93
|
return (
|
|
93
94
|
<>
|
|
94
95
|
<Box sx={{ display: "block", position: "relative" }}>
|
|
95
|
-
|
|
96
|
-
<
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
96
|
+
{biggerButton ? (
|
|
97
|
+
<Button
|
|
98
|
+
variant="contained"
|
|
99
|
+
onClick={() => setOpen(true)}
|
|
100
|
+
startIcon={<AnnouncementIcon />}
|
|
101
|
+
>
|
|
102
|
+
Create Report
|
|
103
|
+
</Button>
|
|
104
|
+
) : (
|
|
105
|
+
<Tooltip title="Create a report">
|
|
106
|
+
<IconButton onClick={() => setOpen(true)}>
|
|
107
|
+
<AnnouncementIcon fontSize="large" />
|
|
108
|
+
</IconButton>
|
|
109
|
+
</Tooltip>
|
|
110
|
+
)}
|
|
100
111
|
</Box>
|
|
101
112
|
|
|
102
|
-
<Dialog
|
|
113
|
+
<Dialog
|
|
114
|
+
open={open}
|
|
115
|
+
fullWidth={true}
|
|
116
|
+
maxWidth={"lg"}
|
|
117
|
+
sx={{ marginX: 1 }}
|
|
118
|
+
onClose={() => setOpen(false)}
|
|
119
|
+
>
|
|
103
120
|
<form action={formAction}>
|
|
104
121
|
<DialogContent sx={{ p: 1 }}>
|
|
105
122
|
{" "}
|
|
@@ -159,10 +176,10 @@ export default function ReportMakingComponent({
|
|
|
159
176
|
<DialogActions>
|
|
160
177
|
<Button onClick={() => setOpen(false)}>Cancel</Button>
|
|
161
178
|
<SubmitButton text="Submit" loadingText="Loading..." />
|
|
162
|
-
<StrapiErrors error={formState?.strapiErrors} />
|
|
179
|
+
{/* <StrapiErrors error={formState?.strapiErrors} />
|
|
163
180
|
{formState?.message && (
|
|
164
181
|
<Alert severity="error">{formState?.message}</Alert>
|
|
165
|
-
)}
|
|
182
|
+
)} */}
|
|
166
183
|
</DialogActions>
|
|
167
184
|
</form>
|
|
168
185
|
</Dialog>
|
|
@@ -28,6 +28,7 @@ export async function createNoteAction(
|
|
|
28
28
|
...prevState,
|
|
29
29
|
strapiErrors: null,
|
|
30
30
|
message: "Ops! Something went wrong. Please try again.",
|
|
31
|
+
severity: "error",
|
|
31
32
|
};
|
|
32
33
|
}
|
|
33
34
|
|
|
@@ -36,6 +37,7 @@ export async function createNoteAction(
|
|
|
36
37
|
...prevState,
|
|
37
38
|
strapiErrors: responseData.error,
|
|
38
39
|
message: "Failed to Create Note.",
|
|
40
|
+
severity: "error",
|
|
39
41
|
};
|
|
40
42
|
}
|
|
41
43
|
|
|
@@ -44,6 +46,7 @@ export async function createNoteAction(
|
|
|
44
46
|
return {
|
|
45
47
|
...prevState,
|
|
46
48
|
message: "New Note Created",
|
|
49
|
+
severity: "success",
|
|
47
50
|
data: flattenedData,
|
|
48
51
|
strapiErrors: null,
|
|
49
52
|
};
|
|
@@ -10,7 +10,8 @@ export async function getPaginatedCategories(
|
|
|
10
10
|
currentPage?: number,
|
|
11
11
|
rowsPerPage?: number,
|
|
12
12
|
order?: "asc" | "desc",
|
|
13
|
-
orderBy?: string
|
|
13
|
+
orderBy?: string,
|
|
14
|
+
is_archive: boolean[] = [false] // default to both archived and non-archived categories
|
|
14
15
|
) {
|
|
15
16
|
const url = new URL(`/api/product-categories`, baseUrl);
|
|
16
17
|
|
|
@@ -19,10 +20,16 @@ export async function getPaginatedCategories(
|
|
|
19
20
|
currentPage,
|
|
20
21
|
rowsPerPage,
|
|
21
22
|
order,
|
|
22
|
-
orderBy
|
|
23
|
+
orderBy,
|
|
24
|
+
is_archive
|
|
23
25
|
);
|
|
24
26
|
|
|
25
27
|
url.search = qs.stringify({
|
|
28
|
+
filters: {
|
|
29
|
+
is_archive: {
|
|
30
|
+
$in: is_archive,
|
|
31
|
+
},
|
|
32
|
+
},
|
|
26
33
|
populate: {
|
|
27
34
|
products: {
|
|
28
35
|
populate: {
|
|
@@ -42,6 +42,7 @@ export interface ReportMakingComponentProps {
|
|
|
42
42
|
type: ReportType;
|
|
43
43
|
related?: PolymorphicRelation[]; // polymorphic relation to the parent entity
|
|
44
44
|
revalidateCallback?: () => void;
|
|
45
|
+
biggerButton?: boolean; // if true, the button will be bigger
|
|
45
46
|
}
|
|
46
47
|
|
|
47
48
|
export interface SimpleReportFieldsProps {
|