umwd-components 0.1.700 → 0.1.701

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.
@@ -7,6 +7,12 @@ interface CustomerProfileDisplayProps extends CustomerProfileProps {
7
7
  editProfileUrl?: string;
8
8
  completeEnough?: boolean;
9
9
  }
10
+ /** INFO
11
+ * CustomerProfileDisplay is a component that displays customer profile information.
12
+ * This component is used in the frontend to display customer profile information
13
+ * but is also used to display user information in the admin panel.
14
+ * Only a logged in frontend customer role can edit their profile.
15
+ */
10
16
  export default function CustomerProfileDisplay({ data, }: {
11
17
  readonly data: CustomerProfileDisplayProps;
12
18
  }): React.JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "umwd-components",
3
- "version": "0.1.700",
3
+ "version": "0.1.701",
4
4
  "description": "UMWD Component library",
5
5
  "main": "dist/src/index.js",
6
6
  "module": "dist/src/index.js",
@@ -35,6 +35,12 @@ interface CustomerProfileDisplayProps extends CustomerProfileProps {
35
35
  completeEnough?: boolean;
36
36
  }
37
37
 
38
+ /** INFO
39
+ * CustomerProfileDisplay is a component that displays customer profile information.
40
+ * This component is used in the frontend to display customer profile information
41
+ * but is also used to display user information in the admin panel.
42
+ * Only a logged in frontend customer role can edit their profile.
43
+ */
38
44
  export default function CustomerProfileDisplay({
39
45
  data,
40
46
  }: {
@@ -81,24 +87,28 @@ export default function CustomerProfileDisplay({
81
87
  </Typography>
82
88
  )}
83
89
  </Stack>
84
- {isCustomer && !Boolean(completeEnough) ? (
85
- <Alert
86
- severity="warning"
87
- action={
88
- <StyledLink href={editProfileUrl} target="_self">
89
- <Button variant="contained">complete profile</Button>
90
- </StyledLink>
91
- }
92
- >
93
- After completion of your profile you can enjoy all the benefits
94
- of your services.
95
- </Alert>
96
- ) : (
97
- <Stack direction={"row"} justifyContent={"flex-end"}>
98
- <StyledLink href={editProfileUrl} target="_self">
99
- <Button variant="contained">edit profile</Button>
100
- </StyledLink>
101
- </Stack>
90
+ {isCustomer && (
91
+ <>
92
+ {!Boolean(completeEnough) ? (
93
+ <Alert
94
+ severity="warning"
95
+ action={
96
+ <StyledLink href={editProfileUrl} target="_self">
97
+ <Button variant="contained">complete profile</Button>
98
+ </StyledLink>
99
+ }
100
+ >
101
+ After completion of your profile you can enjoy all the
102
+ benefits of your services.
103
+ </Alert>
104
+ ) : (
105
+ <Stack direction={"row"} justifyContent={"flex-end"}>
106
+ <StyledLink href={editProfileUrl} target="_self">
107
+ <Button variant="contained">edit profile</Button>
108
+ </StyledLink>
109
+ </Stack>
110
+ )}
111
+ </>
102
112
  )}
103
113
  </Stack>
104
114
  <Divider />
@@ -202,11 +212,25 @@ export default function CustomerProfileDisplay({
202
212
  {order.total_incl_vat} {order.order_currency}
203
213
  </TableCell>
204
214
  <TableCell align="right">
205
- <StyledLink href={`/orders/${order.uuid}`} target="_self">
206
- <Button variant="contained" size="small">
207
- View
208
- </Button>
209
- </StyledLink>
215
+ {isCustomer ? (
216
+ <StyledLink
217
+ href={`/user/orders?selectedOrder=${order.id}`}
218
+ target="_self"
219
+ >
220
+ <Button variant="contained" size="small">
221
+ View
222
+ </Button>
223
+ </StyledLink>
224
+ ) : (
225
+ <StyledLink
226
+ href={`/dashboard/admin/e-commerce/opos?selectedOrder=${order.id}`}
227
+ target="_self"
228
+ >
229
+ <Button variant="contained" size="small">
230
+ View
231
+ </Button>
232
+ </StyledLink>
233
+ )}
210
234
  </TableCell>
211
235
  </TableRow>
212
236
  ))}
@@ -241,23 +265,34 @@ export default function CustomerProfileDisplay({
241
265
  </TableRow>
242
266
  </TableHead>
243
267
  <TableBody>
244
- {returns.data.map((returnItem, index) => (
268
+ {returns.data.map((iro, index) => (
245
269
  <TableRow key={index}>
246
- <TableCell>{returnItem.return_number}</TableCell>
247
- <TableCell>{returnItem.rma_number}</TableCell>
270
+ <TableCell>{iro.return_number}</TableCell>
271
+ <TableCell>{iro.rma_number}</TableCell>
248
272
  <TableCell>
249
- {new Date(returnItem.return_date).toLocaleDateString()}
273
+ {new Date(iro.return_date).toLocaleDateString()}
250
274
  </TableCell>
251
- <TableCell>{returnItem.status}</TableCell>
275
+ <TableCell>{iro.status}</TableCell>
252
276
  <TableCell align="right">
253
- <StyledLink
254
- href={`/returns/${returnItem.uuid}`}
255
- target="_self"
256
- >
257
- <Button variant="contained" size="small">
258
- View
259
- </Button>
260
- </StyledLink>
277
+ {isCustomer ? (
278
+ <StyledLink
279
+ href={`/user/returns/selectedIro=${iro.id}`}
280
+ target="_self"
281
+ >
282
+ <Button variant="contained" size="small">
283
+ View
284
+ </Button>
285
+ </StyledLink>
286
+ ) : (
287
+ <StyledLink
288
+ href={`/dashboard/admin/e-commerce/iros?selectedIro=${iro.id}`}
289
+ target="_self"
290
+ >
291
+ <Button variant="contained" size="small">
292
+ View
293
+ </Button>
294
+ </StyledLink>
295
+ )}
261
296
  </TableCell>
262
297
  </TableRow>
263
298
  ))}