umwd-components 0.1.665 → 0.1.666
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/enduser/EnduserProfileDisplay.js +1 -1
- package/dist/src/components/e-commerce/enduser/EnduserProfileEditForm.js +1 -1
- package/dist/src/components/logistics/dispatcher/DispatcherProfileDisplay.js +1 -1
- package/dist/src/components/logistics/dispatcher/DispatcherProfileEditForm.js +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/types/e-commerce/enduser/types.d.ts +0 -1
- package/dist/types/types/logistics/dispatcher/types.d.ts +5 -1
- package/package.json +1 -1
- package/src/components/e-commerce/enduser/EnduserProfileDisplay.tsx +41 -17
- package/src/components/e-commerce/enduser/EnduserProfileEditForm.tsx +40 -21
- package/src/components/logistics/dispatcher/DispatcherProfileDisplay.tsx +43 -15
- package/src/components/logistics/dispatcher/DispatcherProfileEditForm.tsx +41 -17
- package/src/types/e-commerce/enduser/types.ts +0 -1
- package/src/types/logistics/dispatcher/types.ts +6 -18
|
@@ -4,6 +4,10 @@ export interface DispatcherProfileProps {
|
|
|
4
4
|
id: string;
|
|
5
5
|
uuid: string;
|
|
6
6
|
dispatcher_number: string;
|
|
7
|
-
|
|
7
|
+
first_name: string;
|
|
8
|
+
last_name: string;
|
|
9
|
+
email: string;
|
|
10
|
+
phone: string;
|
|
11
|
+
company_address: AddressProps;
|
|
8
12
|
business_credentials: BusinessCredentialsWithJSONProps;
|
|
9
13
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import React from "react";
|
|
4
|
+
|
|
4
5
|
import Paper from "@mui/material/Paper";
|
|
5
6
|
import Stack from "@mui/material/Stack";
|
|
6
7
|
import Typography from "@mui/material/Typography";
|
|
@@ -10,6 +11,9 @@ import Grid from "@mui/material/Grid";
|
|
|
10
11
|
import Alert from "@mui/material/Alert";
|
|
11
12
|
|
|
12
13
|
import { SxProps, Theme } from "@mui/material/styles";
|
|
14
|
+
import PersonIcon from "@mui/icons-material/Person";
|
|
15
|
+
import EmailIcon from "@mui/icons-material/Email";
|
|
16
|
+
import PhoneIcon from "@mui/icons-material/Phone";
|
|
13
17
|
import Address from "../../common/Address";
|
|
14
18
|
import BusinessCredentials from "../../e-commerce/customer/BusinessCredentials";
|
|
15
19
|
import { StyledLink } from "../../StyledLink";
|
|
@@ -30,7 +34,10 @@ export default function EnduserProfileDisplay({
|
|
|
30
34
|
readonly data: EnduserProfileDisplayProps;
|
|
31
35
|
}) {
|
|
32
36
|
const {
|
|
33
|
-
|
|
37
|
+
first_name,
|
|
38
|
+
last_name,
|
|
39
|
+
email,
|
|
40
|
+
phone,
|
|
34
41
|
company_address,
|
|
35
42
|
business_credentials,
|
|
36
43
|
editProfileUrl = "/dashboard/enduser/user/profile/edit",
|
|
@@ -38,7 +45,8 @@ export default function EnduserProfileDisplay({
|
|
|
38
45
|
} = data;
|
|
39
46
|
|
|
40
47
|
const pathname = usePathname();
|
|
41
|
-
|
|
48
|
+
// Check if the current path is for an enduser profile
|
|
49
|
+
const isEnduser = pathname.includes("enduser/user/");
|
|
42
50
|
|
|
43
51
|
return (
|
|
44
52
|
<Paper sx={{ p: 2 }}>
|
|
@@ -66,31 +74,47 @@ export default function EnduserProfileDisplay({
|
|
|
66
74
|
)}
|
|
67
75
|
</>
|
|
68
76
|
)}
|
|
77
|
+
|
|
69
78
|
{business_credentials ? (
|
|
70
79
|
<BusinessCredentials data={business_credentials} />
|
|
71
80
|
) : (
|
|
72
81
|
<Typography>Business credentials not available</Typography>
|
|
73
82
|
)}
|
|
74
|
-
|
|
83
|
+
|
|
84
|
+
<Divider />
|
|
85
|
+
|
|
75
86
|
<Grid container spacing={2} sx={{ width: "100%" }}>
|
|
76
|
-
<Grid item xs={12} md={
|
|
77
|
-
<Typography variant="h6"
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
87
|
+
<Grid item xs={12} md={4}>
|
|
88
|
+
<Typography variant="h6">Personal Information</Typography>
|
|
89
|
+
<Stack spacing={1} sx={{ mt: 2 }}>
|
|
90
|
+
<Stack direction="row" alignItems="center">
|
|
91
|
+
<PersonIcon />
|
|
92
|
+
<Typography>{`${first_name} ${last_name}`}</Typography>
|
|
93
|
+
</Stack>
|
|
94
|
+
<Stack direction="row" alignItems="center">
|
|
95
|
+
<EmailIcon />
|
|
96
|
+
<Typography>{email}</Typography>
|
|
97
|
+
</Stack>
|
|
98
|
+
<Stack direction="row" alignItems="center">
|
|
99
|
+
<PhoneIcon />
|
|
100
|
+
<Typography>{phone}</Typography>
|
|
101
|
+
</Stack>
|
|
102
|
+
</Stack>
|
|
103
|
+
</Grid>
|
|
104
|
+
<Grid item xs={12} md={4}>
|
|
105
|
+
<Typography variant="h6">Business Credentials</Typography>
|
|
106
|
+
{business_credentials ? (
|
|
107
|
+
<BusinessCredentials data={business_credentials} />
|
|
82
108
|
) : (
|
|
83
|
-
<Typography>
|
|
109
|
+
<Typography>Business credentials not available</Typography>
|
|
84
110
|
)}
|
|
85
111
|
</Grid>
|
|
86
|
-
<Grid item xs={12} md={
|
|
87
|
-
<Typography variant="h6"
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
{private_address ? (
|
|
91
|
-
<Address data={private_address} />
|
|
112
|
+
<Grid item xs={12} md={4}>
|
|
113
|
+
<Typography variant="h6">Company Address</Typography>
|
|
114
|
+
{company_address ? (
|
|
115
|
+
<Address data={{ ...company_address }} />
|
|
92
116
|
) : (
|
|
93
|
-
<Typography>
|
|
117
|
+
<Typography>Company address not available</Typography>
|
|
94
118
|
)}
|
|
95
119
|
</Grid>
|
|
96
120
|
</Grid>
|
|
@@ -5,14 +5,15 @@ import Paper from "@mui/material/Paper";
|
|
|
5
5
|
import Box from "@mui/material/Box";
|
|
6
6
|
import Stack from "@mui/material/Stack";
|
|
7
7
|
import Grid from "@mui/material/Grid";
|
|
8
|
-
import
|
|
8
|
+
import TextField from "@mui/material/TextField";
|
|
9
9
|
import Typography from "@mui/material/Typography";
|
|
10
|
+
import Button from "@mui/material/Button";
|
|
10
11
|
|
|
11
12
|
import { AddressFields } from "../../common/Address";
|
|
12
|
-
import { BusinessCredentialsFields } from "../customer/BusinessCredentials";
|
|
13
13
|
import { SubmitButton } from "../../SubmitButton";
|
|
14
14
|
import { useFormState } from "react-dom";
|
|
15
15
|
import { updateEnduserProfileAction } from "../../../data/actions/e-commerce/enduser/profile-actions";
|
|
16
|
+
import { BusinessCredentialsFields } from "../../e-commerce/customer/BusinessCredentials";
|
|
16
17
|
import { useSession } from "../../../context/auth/SessionContext";
|
|
17
18
|
import { useSnackbar } from "../../../context/common/SnackbarContext";
|
|
18
19
|
import React, { useEffect } from "react";
|
|
@@ -38,7 +39,15 @@ export default function EnduserProfileEditForm({
|
|
|
38
39
|
revalidateCallback?: () => void;
|
|
39
40
|
handleClose?: () => void;
|
|
40
41
|
}) {
|
|
41
|
-
const {
|
|
42
|
+
const {
|
|
43
|
+
id,
|
|
44
|
+
first_name,
|
|
45
|
+
last_name,
|
|
46
|
+
email,
|
|
47
|
+
phone,
|
|
48
|
+
company_address,
|
|
49
|
+
business_credentials,
|
|
50
|
+
} = data;
|
|
42
51
|
const boundAction = updateEnduserProfileAction.bind(null, parseInt(id));
|
|
43
52
|
const [formState, formAction] = useFormState(boundAction, INITIAL_STATE);
|
|
44
53
|
const { handleAddMessage } = useSnackbar();
|
|
@@ -74,24 +83,32 @@ export default function EnduserProfileEditForm({
|
|
|
74
83
|
<Grid container spacing={2}>
|
|
75
84
|
<Grid item xs={12}>
|
|
76
85
|
<Stack spacing={2}>
|
|
77
|
-
<Typography variant="h3" component="h1"
|
|
86
|
+
<Typography variant="h3" component="h1">
|
|
78
87
|
Edit Profile
|
|
79
88
|
</Typography>
|
|
89
|
+
<Typography variant="body1">
|
|
90
|
+
Update your profile information
|
|
91
|
+
</Typography>
|
|
80
92
|
</Stack>
|
|
81
93
|
</Grid>
|
|
94
|
+
|
|
82
95
|
<Grid item xs={12}>
|
|
83
|
-
<
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
96
|
+
<TextField
|
|
97
|
+
id="email"
|
|
98
|
+
name="email"
|
|
99
|
+
label="Email"
|
|
100
|
+
type="email"
|
|
101
|
+
defaultValue={email}
|
|
102
|
+
/>
|
|
103
|
+
<TextField
|
|
104
|
+
id="phone"
|
|
105
|
+
name="phone"
|
|
106
|
+
label="Phone"
|
|
107
|
+
type="tel"
|
|
108
|
+
defaultValue={phone}
|
|
109
|
+
/>
|
|
110
|
+
</Grid>
|
|
111
|
+
|
|
95
112
|
<Grid item xs={12}>
|
|
96
113
|
<Paper sx={{ p: 2 }}>
|
|
97
114
|
<Typography variant="h6" gutterBottom>
|
|
@@ -105,19 +122,21 @@ export default function EnduserProfileEditForm({
|
|
|
105
122
|
/>
|
|
106
123
|
</Paper>
|
|
107
124
|
</Grid>
|
|
125
|
+
|
|
108
126
|
<Grid item xs={12}>
|
|
109
127
|
<Paper sx={{ p: 2 }}>
|
|
110
128
|
<Typography variant="h6" gutterBottom>
|
|
111
|
-
|
|
129
|
+
Business Credentials
|
|
112
130
|
</Typography>
|
|
113
131
|
<Divider sx={{ mb: 2 }} />
|
|
114
|
-
<
|
|
115
|
-
componentName="
|
|
116
|
-
componentReference="
|
|
117
|
-
data={
|
|
132
|
+
<BusinessCredentialsFields
|
|
133
|
+
componentName="business_credentials"
|
|
134
|
+
componentReference="business.credentials"
|
|
135
|
+
data={business_credentials}
|
|
118
136
|
/>
|
|
119
137
|
</Paper>
|
|
120
138
|
</Grid>
|
|
139
|
+
|
|
121
140
|
<Grid item xs={12}>
|
|
122
141
|
<Stack
|
|
123
142
|
direction="row"
|
|
@@ -4,11 +4,11 @@ import React from "react";
|
|
|
4
4
|
|
|
5
5
|
import Paper from "@mui/material/Paper";
|
|
6
6
|
import Stack from "@mui/material/Stack";
|
|
7
|
-
import Box from "@mui/material/Box";
|
|
8
7
|
import Typography from "@mui/material/Typography";
|
|
9
8
|
import Button from "@mui/material/Button";
|
|
10
9
|
import Divider from "@mui/material/Divider";
|
|
11
10
|
import Grid from "@mui/material/Grid";
|
|
11
|
+
import Alert from "@mui/material/Alert";
|
|
12
12
|
|
|
13
13
|
import { SxProps, Theme } from "@mui/material/styles";
|
|
14
14
|
import PersonIcon from "@mui/icons-material/Person";
|
|
@@ -18,7 +18,6 @@ import Address from "../../common/Address";
|
|
|
18
18
|
import BusinessCredentials from "../../../components/e-commerce/customer/BusinessCredentials";
|
|
19
19
|
import { StyledLink } from "../../../components/StyledLink";
|
|
20
20
|
import { DispatcherProfileProps } from "../../../types/logistics/dispatcher/types";
|
|
21
|
-
import { Alert } from "@mui/material";
|
|
22
21
|
|
|
23
22
|
import { usePathname } from "next/navigation";
|
|
24
23
|
|
|
@@ -35,14 +34,19 @@ export default function DispatcherProfileDisplay({
|
|
|
35
34
|
readonly data: DispatcherProfileDisplayProps;
|
|
36
35
|
}) {
|
|
37
36
|
const {
|
|
38
|
-
|
|
37
|
+
first_name,
|
|
38
|
+
last_name,
|
|
39
|
+
email,
|
|
40
|
+
phone,
|
|
41
|
+
company_address,
|
|
39
42
|
business_credentials,
|
|
40
43
|
editProfileUrl = "/dashboard/dispatcher/user/profile/edit",
|
|
41
44
|
completeEnough = false,
|
|
42
45
|
} = data;
|
|
43
46
|
|
|
44
47
|
const pathname = usePathname();
|
|
45
|
-
|
|
48
|
+
// Check if the current path is for a dispatcher profile
|
|
49
|
+
const isDispatcher = pathname.includes("dispatcher/user/");
|
|
46
50
|
|
|
47
51
|
return (
|
|
48
52
|
<Paper sx={{ p: 2 }}>
|
|
@@ -76,19 +80,43 @@ export default function DispatcherProfileDisplay({
|
|
|
76
80
|
) : (
|
|
77
81
|
<Typography>Business credentials not available</Typography>
|
|
78
82
|
)}
|
|
83
|
+
|
|
79
84
|
<Divider />
|
|
80
85
|
|
|
81
|
-
<Grid container sx={{ width: "100%" }}>
|
|
82
|
-
{
|
|
83
|
-
<
|
|
84
|
-
|
|
85
|
-
<
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
<
|
|
90
|
-
|
|
91
|
-
|
|
86
|
+
<Grid container spacing={2} sx={{ width: "100%" }}>
|
|
87
|
+
<Grid item xs={12} md={4}>
|
|
88
|
+
<Typography variant="h6">Personal Information</Typography>
|
|
89
|
+
<Stack spacing={1} sx={{ mt: 2 }}>
|
|
90
|
+
<Stack direction="row" alignItems="center">
|
|
91
|
+
<PersonIcon />
|
|
92
|
+
<Typography>{`${first_name} ${last_name}`}</Typography>
|
|
93
|
+
</Stack>
|
|
94
|
+
<Stack direction="row" alignItems="center">
|
|
95
|
+
<EmailIcon />
|
|
96
|
+
<Typography>{email}</Typography>
|
|
97
|
+
</Stack>
|
|
98
|
+
<Stack direction="row" alignItems="center">
|
|
99
|
+
<PhoneIcon />
|
|
100
|
+
<Typography>{phone}</Typography>
|
|
101
|
+
</Stack>
|
|
102
|
+
</Stack>
|
|
103
|
+
</Grid>
|
|
104
|
+
<Grid item xs={12} md={4}>
|
|
105
|
+
<Typography variant="h6">Business Credentials</Typography>
|
|
106
|
+
{business_credentials ? (
|
|
107
|
+
<BusinessCredentials data={business_credentials} />
|
|
108
|
+
) : (
|
|
109
|
+
<Typography>Business credentials not available</Typography>
|
|
110
|
+
)}
|
|
111
|
+
</Grid>
|
|
112
|
+
<Grid item xs={12} md={4}>
|
|
113
|
+
<Typography variant="h6">Company Address</Typography>
|
|
114
|
+
{company_address ? (
|
|
115
|
+
<Address data={{ ...company_address }} />
|
|
116
|
+
) : (
|
|
117
|
+
<Typography>Company address not available</Typography>
|
|
118
|
+
)}
|
|
119
|
+
</Grid>
|
|
92
120
|
</Grid>
|
|
93
121
|
</Stack>
|
|
94
122
|
</Paper>
|
|
@@ -5,22 +5,18 @@ import Paper from "@mui/material/Paper";
|
|
|
5
5
|
import Box from "@mui/material/Box";
|
|
6
6
|
import Stack from "@mui/material/Stack";
|
|
7
7
|
import Grid from "@mui/material/Grid";
|
|
8
|
-
import Alert from "@mui/material/Alert";
|
|
9
8
|
import TextField from "@mui/material/TextField";
|
|
10
9
|
import Typography from "@mui/material/Typography";
|
|
11
|
-
import Checkbox from "@mui/material/Checkbox";
|
|
12
10
|
import Button from "@mui/material/Button";
|
|
13
11
|
|
|
14
12
|
import { AddressFields } from "../../common/Address";
|
|
15
|
-
import { AddressProps } from "@/types/AddressProps";
|
|
16
|
-
import { BusinessCredentialsProps } from "@/types/e-commerce/BusinessCredentialsProps";
|
|
17
13
|
import { SubmitButton } from "../../SubmitButton";
|
|
18
14
|
import { useFormState } from "react-dom";
|
|
19
15
|
import { updateDispatcherProfileAction } from "../../../data/actions/logistics/dispatcher/profile-actions"; //"@/data/actions/profile-actions";
|
|
20
16
|
import { BusinessCredentialsFields } from "../../e-commerce/customer/BusinessCredentials";
|
|
21
17
|
import { useSession } from "../../../context/auth/SessionContext";
|
|
22
18
|
import { useSnackbar } from "../../../context/common/SnackbarContext";
|
|
23
|
-
import React, { useEffect
|
|
19
|
+
import React, { useEffect } from "react";
|
|
24
20
|
import { DispatcherProfileProps } from "../../../types/logistics/dispatcher/types";
|
|
25
21
|
import { SxProps } from "@mui/material";
|
|
26
22
|
|
|
@@ -43,7 +39,15 @@ export default function DispatcherProfileEditForm({
|
|
|
43
39
|
revalidateCallback?: () => void;
|
|
44
40
|
handleClose?: () => void;
|
|
45
41
|
}) {
|
|
46
|
-
const {
|
|
42
|
+
const {
|
|
43
|
+
id,
|
|
44
|
+
first_name,
|
|
45
|
+
last_name,
|
|
46
|
+
email,
|
|
47
|
+
phone,
|
|
48
|
+
company_address,
|
|
49
|
+
business_credentials,
|
|
50
|
+
} = data;
|
|
47
51
|
const boundAction = updateDispatcherProfileAction.bind(null, parseInt(id));
|
|
48
52
|
const [formState, formAction] = useFormState(boundAction, INITIAL_STATE);
|
|
49
53
|
const { handleAddMessage } = useSnackbar();
|
|
@@ -79,22 +83,42 @@ export default function DispatcherProfileEditForm({
|
|
|
79
83
|
<Grid container spacing={2}>
|
|
80
84
|
<Grid item xs={12}>
|
|
81
85
|
<Stack spacing={2}>
|
|
82
|
-
<Typography variant="h3" component="h1"
|
|
86
|
+
<Typography variant="h3" component="h1">
|
|
83
87
|
Edit Profile
|
|
84
88
|
</Typography>
|
|
89
|
+
<Typography variant="body1">
|
|
90
|
+
Update your profile information
|
|
91
|
+
</Typography>
|
|
85
92
|
</Stack>
|
|
86
93
|
</Grid>
|
|
87
94
|
|
|
95
|
+
<Grid item xs={12}>
|
|
96
|
+
<TextField
|
|
97
|
+
id="email"
|
|
98
|
+
name="email"
|
|
99
|
+
label="Email"
|
|
100
|
+
type="email"
|
|
101
|
+
defaultValue={email}
|
|
102
|
+
/>
|
|
103
|
+
<TextField
|
|
104
|
+
id="phone"
|
|
105
|
+
name="phone"
|
|
106
|
+
label="Phone"
|
|
107
|
+
type="tel"
|
|
108
|
+
defaultValue={phone}
|
|
109
|
+
/>
|
|
110
|
+
</Grid>
|
|
111
|
+
|
|
88
112
|
<Grid item xs={12}>
|
|
89
113
|
<Paper sx={{ p: 2 }}>
|
|
90
114
|
<Typography variant="h6" gutterBottom>
|
|
91
|
-
|
|
115
|
+
Company Address
|
|
92
116
|
</Typography>
|
|
93
117
|
<Divider sx={{ mb: 2 }} />
|
|
94
|
-
<
|
|
95
|
-
componentName="
|
|
96
|
-
componentReference="
|
|
97
|
-
data={
|
|
118
|
+
<AddressFields
|
|
119
|
+
componentName="company_address"
|
|
120
|
+
componentReference="common.address"
|
|
121
|
+
data={company_address}
|
|
98
122
|
/>
|
|
99
123
|
</Paper>
|
|
100
124
|
</Grid>
|
|
@@ -102,13 +126,13 @@ export default function DispatcherProfileEditForm({
|
|
|
102
126
|
<Grid item xs={12}>
|
|
103
127
|
<Paper sx={{ p: 2 }}>
|
|
104
128
|
<Typography variant="h6" gutterBottom>
|
|
105
|
-
|
|
129
|
+
Business Credentials
|
|
106
130
|
</Typography>
|
|
107
131
|
<Divider sx={{ mb: 2 }} />
|
|
108
|
-
<
|
|
109
|
-
componentName="
|
|
110
|
-
componentReference="
|
|
111
|
-
data={
|
|
132
|
+
<BusinessCredentialsFields
|
|
133
|
+
componentName="business_credentials"
|
|
134
|
+
componentReference="business.credentials"
|
|
135
|
+
data={business_credentials}
|
|
112
136
|
/>
|
|
113
137
|
</Paper>
|
|
114
138
|
</Grid>
|
|
@@ -1,26 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
BusinessCredentialsProps,
|
|
3
|
-
BusinessCredentialsWithJSONProps,
|
|
4
|
-
} from "../../e-commerce/BusinessCredentialsProps";
|
|
1
|
+
import { BusinessCredentialsWithJSONProps } from "../../e-commerce/BusinessCredentialsProps";
|
|
5
2
|
import { AddressProps } from "../../AddressProps";
|
|
6
3
|
|
|
7
|
-
// export type DispatcherLabel = {
|
|
8
|
-
// id: number;
|
|
9
|
-
// title: string;
|
|
10
|
-
// slug?: string;
|
|
11
|
-
// };
|
|
12
|
-
|
|
13
|
-
// export interface DispatcherSelectorProps {
|
|
14
|
-
// dispatcherLabels: DispatcherLabel[];
|
|
15
|
-
// currentValue?: number[];
|
|
16
|
-
// multiple?: boolean;
|
|
17
|
-
// onChangeCallback?: (value: number[]) => void;
|
|
18
|
-
// }
|
|
19
|
-
|
|
20
4
|
export interface DispatcherProfileProps {
|
|
21
5
|
id: string;
|
|
22
6
|
uuid: string;
|
|
23
7
|
dispatcher_number: string;
|
|
24
|
-
|
|
8
|
+
first_name: string;
|
|
9
|
+
last_name: string;
|
|
10
|
+
email: string;
|
|
11
|
+
phone: string;
|
|
12
|
+
company_address: AddressProps;
|
|
25
13
|
business_credentials: BusinessCredentialsWithJSONProps;
|
|
26
14
|
}
|