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
|
@@ -24,7 +24,7 @@ import Stack from "@mui/material/Stack";
|
|
|
24
24
|
import Divider from "@mui/material/Divider";
|
|
25
25
|
import Card from "@mui/material/Card";
|
|
26
26
|
import CardContent from "@mui/material/CardContent";
|
|
27
|
-
import { confirmationService } from "../../../data/services/
|
|
27
|
+
import { confirmationService } from "../../../data/services/common/confirmation-service";
|
|
28
28
|
|
|
29
29
|
const INITIAL_STATE = {
|
|
30
30
|
zodErrors: null,
|
|
@@ -22,9 +22,7 @@ import Box from "@mui/material/Box";
|
|
|
22
22
|
import Paper from "@mui/material/Paper";
|
|
23
23
|
import Stack from "@mui/material/Stack";
|
|
24
24
|
import Divider from "@mui/material/Divider";
|
|
25
|
-
import
|
|
26
|
-
import CardContent from "@mui/material/CardContent";
|
|
27
|
-
import { confirmationService } from "../../../data/services/logistics/ipo/confirmation-service";
|
|
25
|
+
import { confirmationService } from "../../../data/services/common/confirmation-service";
|
|
28
26
|
import { PreReport } from "../../../types/logistics/Report";
|
|
29
27
|
import { FormControlLabel, Checkbox } from "@mui/material";
|
|
30
28
|
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use server";
|
|
2
|
+
|
|
3
|
+
import { mutateData } from "../../../services/mutate-data";
|
|
4
|
+
import { flattenAttributes } from "../../../../lib/utils";
|
|
5
|
+
import { parseFormData } from "../../../../lib/parseFormData";
|
|
6
|
+
|
|
7
|
+
/** INFO
|
|
8
|
+
* This action is only used by the enduser to create a new Iro with a selected customer and products.
|
|
9
|
+
* It should not be used by the customer to create an iro
|
|
10
|
+
*/
|
|
11
|
+
export async function createIroAction(prevState: any, formData: FormData) {
|
|
12
|
+
const rawFormData = Object.fromEntries(formData);
|
|
13
|
+
|
|
14
|
+
const parsedFormData = parseFormData(formData);
|
|
15
|
+
|
|
16
|
+
const responseData = await mutateData(
|
|
17
|
+
"POST",
|
|
18
|
+
`/api/iros/createAdmin`, //TODO create in CMS
|
|
19
|
+
parsedFormData
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
if (!responseData) {
|
|
23
|
+
return {
|
|
24
|
+
...prevState,
|
|
25
|
+
strapiErrors: null,
|
|
26
|
+
message: "Ops! Something went wrong. Please try again.",
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (responseData.error) {
|
|
31
|
+
return {
|
|
32
|
+
...prevState,
|
|
33
|
+
strapiErrors: responseData.error,
|
|
34
|
+
message: "Failed to Create Iro.",
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const flattenedData = flattenAttributes(responseData);
|
|
39
|
+
|
|
40
|
+
return {
|
|
41
|
+
...prevState,
|
|
42
|
+
message: "Iro Created Successfully",
|
|
43
|
+
data: flattenedData,
|
|
44
|
+
strapiErrors: null,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use server";
|
|
2
|
+
|
|
3
|
+
import { mutateData } from "../../../services/mutate-data";
|
|
4
|
+
import { flattenAttributes } from "../../../../lib/utils";
|
|
5
|
+
import { parseFormData } from "../../../../lib/parseFormData";
|
|
6
|
+
|
|
7
|
+
export async function updateIroAction(prevState: any, formData: FormData) {
|
|
8
|
+
const rawFormData = Object.fromEntries(formData);
|
|
9
|
+
|
|
10
|
+
const parsedFormData = parseFormData(formData);
|
|
11
|
+
console.log("parsedFormData", parsedFormData);
|
|
12
|
+
|
|
13
|
+
const responseData = await mutateData(
|
|
14
|
+
"PUT",
|
|
15
|
+
`/api/iros/${rawFormData.id}`,
|
|
16
|
+
parsedFormData
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
if (!responseData) {
|
|
20
|
+
return {
|
|
21
|
+
...prevState,
|
|
22
|
+
strapiErrors: null,
|
|
23
|
+
message: "Ops! Something went wrong. Please try again.",
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
if (responseData.error) {
|
|
28
|
+
return {
|
|
29
|
+
...prevState,
|
|
30
|
+
strapiErrors: responseData.error,
|
|
31
|
+
message: "Failed to Update Iro.",
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const flattenedData = flattenAttributes(responseData);
|
|
36
|
+
|
|
37
|
+
return {
|
|
38
|
+
...prevState,
|
|
39
|
+
message: "Iro Updated",
|
|
40
|
+
data: flattenedData,
|
|
41
|
+
strapiErrors: null,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
@@ -8,7 +8,7 @@ import { getUserRole } from "../../services/get-user-me-loader";
|
|
|
8
8
|
|
|
9
9
|
const baseUrl = getStrapiURL();
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
async function getAllOpos(
|
|
12
12
|
currentPage: number,
|
|
13
13
|
rowsPerPage: number,
|
|
14
14
|
order: "asc" | "desc",
|
|
@@ -73,3 +73,5 @@ export async function getAllOpos(
|
|
|
73
73
|
|
|
74
74
|
return await fetchData(url.href);
|
|
75
75
|
}
|
|
76
|
+
|
|
77
|
+
export { getAllOpos };
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use server";
|
|
2
|
+
|
|
3
|
+
import qs from "qs";
|
|
4
|
+
import { fetchData } from "../../loaders";
|
|
5
|
+
import { getStrapiURL } from "../../../../lib/utils";
|
|
6
|
+
import { unstable_noStore as noStore } from "next/cache";
|
|
7
|
+
import { getUserRole } from "../../../services/get-user-me-loader";
|
|
8
|
+
|
|
9
|
+
const baseUrl = getStrapiURL();
|
|
10
|
+
|
|
11
|
+
async function getAllIros(
|
|
12
|
+
currentPage: number,
|
|
13
|
+
rowsPerPage: number,
|
|
14
|
+
order: "asc" | "desc",
|
|
15
|
+
orderBy: string,
|
|
16
|
+
is_archive: boolean[]
|
|
17
|
+
) {
|
|
18
|
+
noStore();
|
|
19
|
+
|
|
20
|
+
const user = await getUserRole();
|
|
21
|
+
const role = user?.data?.role?.type;
|
|
22
|
+
const isEnduser = role === "enduser";
|
|
23
|
+
|
|
24
|
+
const url = new URL(`/api/iros`, baseUrl);
|
|
25
|
+
|
|
26
|
+
url.search = qs.stringify({
|
|
27
|
+
filters: {
|
|
28
|
+
is_archive: {
|
|
29
|
+
$in: is_archive,
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
sort: `${orderBy || "id"}:${order || "desc"}`,
|
|
33
|
+
populate: {
|
|
34
|
+
iro_items: {
|
|
35
|
+
populate: {
|
|
36
|
+
product: {
|
|
37
|
+
populate: {
|
|
38
|
+
price: true,
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
reports: true,
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
customer: isEnduser
|
|
45
|
+
? {
|
|
46
|
+
populate: {
|
|
47
|
+
company_address: true,
|
|
48
|
+
delivery_address: true,
|
|
49
|
+
billing_address: true,
|
|
50
|
+
business_credentials: true,
|
|
51
|
+
},
|
|
52
|
+
}
|
|
53
|
+
: false,
|
|
54
|
+
},
|
|
55
|
+
pagination: {
|
|
56
|
+
pageSize: rowsPerPage || 10,
|
|
57
|
+
page: currentPage ? currentPage + 1 : 1, // because table pagination starts at 0 but strapi starts at 1
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
return await fetchData(url.href);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export { getAllIros };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use server";
|
|
2
|
+
|
|
3
|
+
import qs from "qs";
|
|
4
|
+
import { fetchData } from "../../loaders";
|
|
5
|
+
import { flattenAttributes, getStrapiURL } from "../../../../lib/utils";
|
|
6
|
+
import { unstable_noStore as noStore } from "next/cache";
|
|
7
|
+
|
|
8
|
+
const baseUrl = getStrapiURL();
|
|
9
|
+
|
|
10
|
+
async function getIroModel() {
|
|
11
|
+
noStore();
|
|
12
|
+
|
|
13
|
+
const url = new URL(`/api/iros/findModel`, baseUrl);
|
|
14
|
+
|
|
15
|
+
return await fetchData(url.href);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { getIroModel };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use server";
|
|
2
|
+
|
|
3
|
+
import qs from "qs";
|
|
4
|
+
import { fetchData } from "../../loaders";
|
|
5
|
+
import { flattenAttributes, getStrapiURL } from "../../../../lib/utils";
|
|
6
|
+
import { unstable_noStore as noStore } from "next/cache";
|
|
7
|
+
|
|
8
|
+
const baseUrl = getStrapiURL();
|
|
9
|
+
|
|
10
|
+
async function getSingleIro(id: number) {
|
|
11
|
+
// noStore();
|
|
12
|
+
|
|
13
|
+
const url = new URL(`/api/iros/${id}`, baseUrl);
|
|
14
|
+
|
|
15
|
+
url.search = qs.stringify({
|
|
16
|
+
populate: {
|
|
17
|
+
iro_items: {
|
|
18
|
+
populate: {
|
|
19
|
+
product: {
|
|
20
|
+
populate: {
|
|
21
|
+
image: true,
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
reports: {
|
|
25
|
+
populate: {
|
|
26
|
+
author: true,
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
customer: {
|
|
32
|
+
populate: ["business_credentials"],
|
|
33
|
+
},
|
|
34
|
+
notes: {
|
|
35
|
+
populate: {
|
|
36
|
+
author: {
|
|
37
|
+
populate: true,
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
return await fetchData(url.href);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export { getSingleIro };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use server";
|
|
2
|
+
|
|
3
|
+
import qs from "qs";
|
|
4
|
+
import { fetchData } from "../../loaders";
|
|
5
|
+
import { getStrapiURL } from "../../../../lib/utils";
|
|
6
|
+
import { unstable_noStore as noStore } from "next/cache";
|
|
7
|
+
|
|
8
|
+
const baseUrl = getStrapiURL();
|
|
9
|
+
|
|
10
|
+
async function queryAllIros(query: string) {
|
|
11
|
+
noStore();
|
|
12
|
+
|
|
13
|
+
const url = new URL(`/api/iros`, baseUrl);
|
|
14
|
+
|
|
15
|
+
console.log("query", query);
|
|
16
|
+
|
|
17
|
+
url.search = query;
|
|
18
|
+
|
|
19
|
+
const res = await fetchData(url.href);
|
|
20
|
+
|
|
21
|
+
// console.log("res", res);
|
|
22
|
+
|
|
23
|
+
return res;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export { queryAllIros };
|
|
@@ -127,6 +127,7 @@ async function getAllOrders(
|
|
|
127
127
|
admin_items: true,
|
|
128
128
|
},
|
|
129
129
|
},
|
|
130
|
+
return: true,
|
|
130
131
|
},
|
|
131
132
|
pagination: {
|
|
132
133
|
pageSize: rowsPerPage || 10,
|
|
@@ -141,5 +142,5 @@ export {
|
|
|
141
142
|
/* getAllProducts, */
|
|
142
143
|
getCustomerProfile,
|
|
143
144
|
getSingleOrderByUuid,
|
|
144
|
-
getAllOrders,
|
|
145
|
+
/* getAllOrders, */
|
|
145
146
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use server";
|
|
2
2
|
|
|
3
|
-
import { getAuthToken } from "
|
|
4
|
-
import { getStrapiURL } from "
|
|
3
|
+
import { getAuthToken } from "../get-token";
|
|
4
|
+
import { getStrapiURL } from "../../../lib/utils"; //"@/lib/utils";
|
|
5
5
|
|
|
6
6
|
// TODO move to common services
|
|
7
7
|
export async function confirmationService(path: string, ids: number[]) {
|
package/src/index.ts
CHANGED
|
@@ -125,8 +125,9 @@ export {
|
|
|
125
125
|
/* getAllProducts as getAllProducts, */
|
|
126
126
|
getCustomerProfile as getCustomerProfile,
|
|
127
127
|
getSingleOrderByUuid as getSingleOrderByUuid,
|
|
128
|
-
getAllOrders as getAllOrders,
|
|
128
|
+
//getAllOrders as getAllOrders,
|
|
129
129
|
} from "./data/loaders/e-commerce-loaders";
|
|
130
|
+
export { getAllOpos as getAllOpos } from "./data/loaders/e-commerce/getAllOpos";
|
|
130
131
|
export { getSingleCategory as getSingleCategory } from "./data/loaders/e-commerce/getSingleCategory";
|
|
131
132
|
export { getTableProducts as getTableProducts } from "./data/loaders/e-commerce/getTableProducts";
|
|
132
133
|
export { getAllCategoryNames as getAllCategoryNames } from "./data/loaders/e-commerce/getAllCategoryNames";
|
|
@@ -227,7 +228,7 @@ export { default as ManageOpoForm } from "./components/e-commerce/opo/ManageOpoF
|
|
|
227
228
|
export { default as ItemDisplay } from "./components/logistics/ipo/ItemDisplay";
|
|
228
229
|
export { updateOpoAction as updateOpoAction } from "./data/actions/e-commerce/opo/updateOpoAction";
|
|
229
230
|
export { getSingleOpo as getSingleOpo } from "./data/loaders/e-commerce/getSingleOpo";
|
|
230
|
-
export { confirmationService as confirmationService } from "./data/services/
|
|
231
|
+
export { confirmationService as confirmationService } from "./data/services/common/confirmation-service";
|
|
231
232
|
|
|
232
233
|
export { CreateInvoiceForm as CreateInvoiceForm } from "./components/e-commerce/invoice/CreateInvoiceForm";
|
|
233
234
|
export { createInvoiceAction as createInvoiceAction } from "./data/actions/e-commerce/invoices/createInvoiceAction";
|
|
@@ -301,3 +302,21 @@ export { default as TextualOpoItemUpdater } from "./components/e-commerce/opo/Te
|
|
|
301
302
|
export { default as TextualManageOPOForm } from "./components/e-commerce/opo/TextualManageOpoForm";
|
|
302
303
|
|
|
303
304
|
export { getShop as getShop } from "./data/loaders/e-commerce/getShop";
|
|
305
|
+
|
|
306
|
+
export { getAllIros as getAllIros } from "./data/loaders/e-commerce/iros/getAllIros";
|
|
307
|
+
export { getSingleIro as getSingleIro } from "./data/loaders/e-commerce/iros/getSingleIro";
|
|
308
|
+
export { getIroModel as getIroModel } from "./data/loaders/e-commerce/iros/getIroModel";
|
|
309
|
+
export { queryAllIros as queryAllIros } from "./data/loaders/e-commerce/iros/queryAllIros";
|
|
310
|
+
|
|
311
|
+
/* TODO check if all these IRO stuff is actually being used */
|
|
312
|
+
export { createIroAction as createIroAction } from "./data/actions/e-commerce/iro/createIroAction";
|
|
313
|
+
export { updateIroAction as updateIroAction } from "./data/actions/e-commerce/iro/updateIroAction";
|
|
314
|
+
export { default as IroItemDisplay } from "./components/e-commerce/iro/IroItemDisplay";
|
|
315
|
+
export { IROItemFields as IROItemFields } from "./components/e-commerce/iro/IROItemFields";
|
|
316
|
+
export { default as createIroForm } from "./components/e-commerce/iro/CreateIROForm";
|
|
317
|
+
export { default as IROItemUpdater } from "./components/e-commerce/iro/IROItemUpdater";
|
|
318
|
+
export { default as RmaForm } from "./components/e-commerce/iro/RmaForm";
|
|
319
|
+
export { IroStatusIndicator } from "./components/e-commerce/iro/IroStatusIndicator";
|
|
320
|
+
export { default as ManageIROForm } from "./components/e-commerce/iro/ManageIROForm";
|
|
321
|
+
export { default as TextualIROItemUpdater } from "./components/e-commerce/iro/TextualIROItemUpdater";
|
|
322
|
+
export { default as TextualManageIROForm } from "./components/e-commerce/iro/TextualManageIROForm";
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { CustomerProfileProps } from "../customer/types";
|
|
2
|
+
import { SxProps, Theme } from "@mui/system";
|
|
3
|
+
import { Product, ProductName } from "../product/types";
|
|
4
|
+
import { StrapiImageProps } from "../../StrapiImageProps";
|
|
5
|
+
import { CustomerLabel } from "../customer/types";
|
|
6
|
+
import { Note } from "../../logistics/Note";
|
|
7
|
+
import { Report, PreReport } from "../../logistics/Report";
|
|
8
|
+
import { Opo } from "../opo/types";
|
|
9
|
+
|
|
10
|
+
export type ReturnReason =
|
|
11
|
+
| "damaged"
|
|
12
|
+
| "not_as_described"
|
|
13
|
+
| "wrong_item"
|
|
14
|
+
| "other";
|
|
15
|
+
|
|
16
|
+
export interface IroItem {
|
|
17
|
+
id: number;
|
|
18
|
+
line_item_number?: string;
|
|
19
|
+
product?: Product;
|
|
20
|
+
reason: ReturnReason;
|
|
21
|
+
other_reason?: string;
|
|
22
|
+
returned_quantity: number;
|
|
23
|
+
received_quantity: number;
|
|
24
|
+
registered_quantity: number;
|
|
25
|
+
released_quantity: number;
|
|
26
|
+
reports: { data: (Report | PreReport)[] };
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface NewIroItem {
|
|
30
|
+
product?: Product;
|
|
31
|
+
reason: ReturnReason;
|
|
32
|
+
other_reason?: string;
|
|
33
|
+
returned_quantity: number;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// TODO
|
|
37
|
+
export type IroStatus =
|
|
38
|
+
| "requested"
|
|
39
|
+
| "returning"
|
|
40
|
+
| "logistics_operator_process"
|
|
41
|
+
| "finalising_process"
|
|
42
|
+
| "done"
|
|
43
|
+
| "cancelled"
|
|
44
|
+
| null;
|
|
45
|
+
|
|
46
|
+
export interface Iro {
|
|
47
|
+
id: number;
|
|
48
|
+
uuid: string;
|
|
49
|
+
is_archive: boolean;
|
|
50
|
+
return_date: string;
|
|
51
|
+
// confirmation_email_sent: boolean;
|
|
52
|
+
currency: string;
|
|
53
|
+
iro_number: string;
|
|
54
|
+
status: IroStatus;
|
|
55
|
+
items: { data: IroItem[] };
|
|
56
|
+
notes: {
|
|
57
|
+
data: Note[];
|
|
58
|
+
};
|
|
59
|
+
customer?: CustomerProfileProps;
|
|
60
|
+
customer_inhouse_reference: string;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export interface ManageIroFormProps {
|
|
64
|
+
data: Iro; // for sake of uniformity between forms it's way easier to call this data instead of iro
|
|
65
|
+
sx?: SxProps<Theme>;
|
|
66
|
+
revalidateCallback?: () => void;
|
|
67
|
+
handleClose?: () => void;
|
|
68
|
+
role?: "enduser" | "dispatcher";
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export interface CreateIroFormProps {
|
|
72
|
+
sx?: SxProps<Theme>;
|
|
73
|
+
revalidateCallback?: () => void;
|
|
74
|
+
handleClose?: () => void;
|
|
75
|
+
customerLabels: CustomerLabel[];
|
|
76
|
+
productLabels: ProductName[];
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export type IroItemUpdaterProps = {
|
|
80
|
+
item: IroItem;
|
|
81
|
+
index: number;
|
|
82
|
+
handleUpdateQuantity: Function;
|
|
83
|
+
image?: StrapiImageProps;
|
|
84
|
+
revalidateCallback?: () => void;
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
export type TextualIroItemUpdaterProps = {
|
|
88
|
+
item: IroItem;
|
|
89
|
+
index: number;
|
|
90
|
+
handleAddReport: (report: PreReport, itemID: number) => void;
|
|
91
|
+
handleUpdateQuantity: Function;
|
|
92
|
+
image?: StrapiImageProps;
|
|
93
|
+
handleRemoveReportAtIndex: (itemID: number, index: number) => void;
|
|
94
|
+
revalidateCallback?: () => void;
|
|
95
|
+
showing?: ("received" | "registered" | "released" | "reports")[];
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
export type IroItemDisplayProps = {
|
|
99
|
+
item: IroItem;
|
|
100
|
+
index: number;
|
|
101
|
+
image?: StrapiImageProps;
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
export type RMAFormProps = {
|
|
105
|
+
opo: Opo;
|
|
106
|
+
sx?: SxProps<Theme>;
|
|
107
|
+
revalidateCallback?: () => void;
|
|
108
|
+
handleClose?: () => void;
|
|
109
|
+
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use server";
|
|
2
|
-
/*
|
|
3
|
-
* UMWD-Components
|
|
4
|
-
* @copyright Jelle Paulus
|
|
5
|
-
* @license MIT
|
|
6
|
-
*/
|
|
7
|
-
import{__awaiter as o,__generator as e,__spreadArray as t,__read as r}from"../../../../../node_modules/tslib/tslib.es6.js";import{getAuthToken as n}from"../../get-token.js";import{getStrapiURL as s}from"../../../../lib/utils.js";function i(i,a){return o(this,void 0,void 0,(function(){var o,c,l,u,d,f;return e(this,(function(e){switch(e.label){case 0:return[4,n()];case 1:if(o=e.sent(),c=s(),l=new URL("api/".concat(i,"/confirm"),c),!o)throw new Error("No auth token found");u=JSON.stringify({data:{selectedIds:t([],r(a),!1)}}),console.log("payload",u),console.log("url",l),e.label=2;case 2:return e.trys.push([2,5,,6]),[4,fetch(l,{method:"PUT",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(o)},body:u})];case 3:return d=e.sent(),console.log(d),[4,d.json()];case 4:return[2,e.sent()];case 5:throw f=e.sent(),console.log("error",f),f;case 6:return[2]}}))}))}export{i as confirmationService};
|
|
File without changes
|