@akinon/projectzero 1.89.0-rc.6 → 1.89.0-rc.8
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/CHANGELOG.md +4 -0
- package/app-template/CHANGELOG.md +46 -0
- package/app-template/package.json +18 -18
- package/app-template/src/app/[commerce]/[locale]/[currency]/account/orders/[id]/cancellation/page.tsx +7 -4
- package/app-template/src/app/[commerce]/[locale]/[currency]/account/orders/[id]/page.tsx +47 -44
- package/app-template/src/views/account/order.tsx +10 -8
- package/app-template/src/views/anonymous-tracking/order-detail/index.tsx +44 -37
- package/app-template/src/views/product/price-wrapper.tsx +7 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,51 @@
|
|
|
1
1
|
# projectzeronext
|
|
2
2
|
|
|
3
|
+
## 1.89.0-rc.8
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [d8fad39]
|
|
8
|
+
- Updated dependencies [943a239]
|
|
9
|
+
- Updated dependencies [0cabbda]
|
|
10
|
+
- @akinon/next@1.89.0-rc.8
|
|
11
|
+
- @akinon/pz-akifast@1.89.0-rc.8
|
|
12
|
+
- @akinon/pz-b2b@1.89.0-rc.8
|
|
13
|
+
- @akinon/pz-basket-gift-pack@1.89.0-rc.8
|
|
14
|
+
- @akinon/pz-bkm@1.89.0-rc.8
|
|
15
|
+
- @akinon/pz-checkout-gift-pack@1.89.0-rc.8
|
|
16
|
+
- @akinon/pz-click-collect@1.89.0-rc.8
|
|
17
|
+
- @akinon/pz-credit-payment@1.89.0-rc.8
|
|
18
|
+
- @akinon/pz-gpay@1.89.0-rc.8
|
|
19
|
+
- @akinon/pz-masterpass@1.89.0-rc.8
|
|
20
|
+
- @akinon/pz-one-click-checkout@1.89.0-rc.8
|
|
21
|
+
- @akinon/pz-otp@1.89.0-rc.8
|
|
22
|
+
- @akinon/pz-pay-on-delivery@1.89.0-rc.8
|
|
23
|
+
- @akinon/pz-saved-card@1.89.0-rc.8
|
|
24
|
+
- @akinon/pz-tabby-extension@1.89.0-rc.8
|
|
25
|
+
- @akinon/pz-tamara-extension@1.89.0-rc.8
|
|
26
|
+
|
|
27
|
+
## 1.89.0-rc.7
|
|
28
|
+
|
|
29
|
+
### Patch Changes
|
|
30
|
+
|
|
31
|
+
- Updated dependencies [dfaceff]
|
|
32
|
+
- @akinon/next@1.89.0-rc.7
|
|
33
|
+
- @akinon/pz-akifast@1.89.0-rc.7
|
|
34
|
+
- @akinon/pz-b2b@1.89.0-rc.7
|
|
35
|
+
- @akinon/pz-basket-gift-pack@1.89.0-rc.7
|
|
36
|
+
- @akinon/pz-bkm@1.89.0-rc.7
|
|
37
|
+
- @akinon/pz-checkout-gift-pack@1.89.0-rc.7
|
|
38
|
+
- @akinon/pz-click-collect@1.89.0-rc.7
|
|
39
|
+
- @akinon/pz-credit-payment@1.89.0-rc.7
|
|
40
|
+
- @akinon/pz-gpay@1.89.0-rc.7
|
|
41
|
+
- @akinon/pz-masterpass@1.89.0-rc.7
|
|
42
|
+
- @akinon/pz-one-click-checkout@1.89.0-rc.7
|
|
43
|
+
- @akinon/pz-otp@1.89.0-rc.7
|
|
44
|
+
- @akinon/pz-pay-on-delivery@1.89.0-rc.7
|
|
45
|
+
- @akinon/pz-saved-card@1.89.0-rc.7
|
|
46
|
+
- @akinon/pz-tabby-extension@1.89.0-rc.7
|
|
47
|
+
- @akinon/pz-tamara-extension@1.89.0-rc.7
|
|
48
|
+
|
|
3
49
|
## 1.89.0-rc.6
|
|
4
50
|
|
|
5
51
|
### Minor Changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "projectzeronext",
|
|
3
|
-
"version": "1.89.0-rc.
|
|
3
|
+
"version": "1.89.0-rc.8",
|
|
4
4
|
"private": true,
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"scripts": {
|
|
@@ -24,22 +24,22 @@
|
|
|
24
24
|
"test:middleware": "jest middleware-matcher.test.ts --bail"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@akinon/next": "1.89.0-rc.
|
|
28
|
-
"@akinon/pz-akifast": "1.89.0-rc.
|
|
29
|
-
"@akinon/pz-b2b": "1.89.0-rc.
|
|
30
|
-
"@akinon/pz-basket-gift-pack": "1.89.0-rc.
|
|
31
|
-
"@akinon/pz-bkm": "1.89.0-rc.
|
|
32
|
-
"@akinon/pz-checkout-gift-pack": "1.89.0-rc.
|
|
33
|
-
"@akinon/pz-click-collect": "1.89.0-rc.
|
|
34
|
-
"@akinon/pz-credit-payment": "1.89.0-rc.
|
|
35
|
-
"@akinon/pz-gpay": "1.89.0-rc.
|
|
36
|
-
"@akinon/pz-masterpass": "1.89.0-rc.
|
|
37
|
-
"@akinon/pz-one-click-checkout": "1.89.0-rc.
|
|
38
|
-
"@akinon/pz-otp": "1.89.0-rc.
|
|
39
|
-
"@akinon/pz-pay-on-delivery": "1.89.0-rc.
|
|
40
|
-
"@akinon/pz-saved-card": "1.89.0-rc.
|
|
41
|
-
"@akinon/pz-tabby-extension": "1.89.0-rc.
|
|
42
|
-
"@akinon/pz-tamara-extension": "1.89.0-rc.
|
|
27
|
+
"@akinon/next": "1.89.0-rc.8",
|
|
28
|
+
"@akinon/pz-akifast": "1.89.0-rc.8",
|
|
29
|
+
"@akinon/pz-b2b": "1.89.0-rc.8",
|
|
30
|
+
"@akinon/pz-basket-gift-pack": "1.89.0-rc.8",
|
|
31
|
+
"@akinon/pz-bkm": "1.89.0-rc.8",
|
|
32
|
+
"@akinon/pz-checkout-gift-pack": "1.89.0-rc.8",
|
|
33
|
+
"@akinon/pz-click-collect": "1.89.0-rc.8",
|
|
34
|
+
"@akinon/pz-credit-payment": "1.89.0-rc.8",
|
|
35
|
+
"@akinon/pz-gpay": "1.89.0-rc.8",
|
|
36
|
+
"@akinon/pz-masterpass": "1.89.0-rc.8",
|
|
37
|
+
"@akinon/pz-one-click-checkout": "1.89.0-rc.8",
|
|
38
|
+
"@akinon/pz-otp": "1.89.0-rc.8",
|
|
39
|
+
"@akinon/pz-pay-on-delivery": "1.89.0-rc.8",
|
|
40
|
+
"@akinon/pz-saved-card": "1.89.0-rc.8",
|
|
41
|
+
"@akinon/pz-tabby-extension": "1.89.0-rc.8",
|
|
42
|
+
"@akinon/pz-tamara-extension": "1.89.0-rc.8",
|
|
43
43
|
"@hookform/resolvers": "2.9.0",
|
|
44
44
|
"@next/third-parties": "14.1.0",
|
|
45
45
|
"@react-google-maps/api": "2.17.1",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"yup": "0.32.11"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
|
-
"@akinon/eslint-plugin-projectzero": "1.89.0-rc.
|
|
65
|
+
"@akinon/eslint-plugin-projectzero": "1.89.0-rc.8",
|
|
66
66
|
"@semantic-release/changelog": "6.0.2",
|
|
67
67
|
"@semantic-release/exec": "6.0.3",
|
|
68
68
|
"@semantic-release/git": "10.0.1",
|
|
@@ -235,13 +235,13 @@ const AccountOrderCancellation = ({ params }) => {
|
|
|
235
235
|
<div>
|
|
236
236
|
<div className="pb-2 mb-3 text-lg border-gray border-b">
|
|
237
237
|
<span data-testid="account-orders-return-order-count">
|
|
238
|
-
{order
|
|
238
|
+
{order?.orderitem_set?.length}
|
|
239
239
|
</span>{' '}
|
|
240
240
|
<span>{t('account.my_orders.detail.products')}</span>
|
|
241
241
|
</div>
|
|
242
242
|
|
|
243
243
|
<form onSubmit={handleSubmit(onSubmit)}>
|
|
244
|
-
{order
|
|
244
|
+
{order?.orderitem_set?.map((item, index: number) => (
|
|
245
245
|
<Controller
|
|
246
246
|
defaultValue={[]}
|
|
247
247
|
control={control}
|
|
@@ -252,7 +252,7 @@ const AccountOrderCancellation = ({ params }) => {
|
|
|
252
252
|
return cancelItem.order_item === item.id;
|
|
253
253
|
});
|
|
254
254
|
|
|
255
|
-
const cancellationType = item
|
|
255
|
+
const cancellationType = item?.is_refundable
|
|
256
256
|
? 'refund'
|
|
257
257
|
: 'cancel';
|
|
258
258
|
|
|
@@ -268,7 +268,10 @@ const AccountOrderCancellation = ({ params }) => {
|
|
|
268
268
|
onChange={onChange}
|
|
269
269
|
value={value}
|
|
270
270
|
selectOption={selectOption}
|
|
271
|
-
fileInput={fileInputCondition(
|
|
271
|
+
fileInput={fileInputCondition(
|
|
272
|
+
item,
|
|
273
|
+
item?.product?.name
|
|
274
|
+
)}
|
|
272
275
|
/>
|
|
273
276
|
);
|
|
274
277
|
}}
|
|
@@ -31,14 +31,15 @@ const AccountOrderDetail = ({ params: { id } }) => {
|
|
|
31
31
|
const groupedOrder = [];
|
|
32
32
|
|
|
33
33
|
if (order) {
|
|
34
|
-
const groupedData =
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
groups[tracking_number]
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
34
|
+
const groupedData =
|
|
35
|
+
order?.orderitem_set?.reduce((groups, item) => {
|
|
36
|
+
const { tracking_number } = item;
|
|
37
|
+
if (!groups[tracking_number]) {
|
|
38
|
+
groups[tracking_number] = [];
|
|
39
|
+
}
|
|
40
|
+
groups[tracking_number].push(item);
|
|
41
|
+
return groups;
|
|
42
|
+
}, {}) || {};
|
|
42
43
|
|
|
43
44
|
const result = Object.values(groupedData);
|
|
44
45
|
|
|
@@ -75,8 +76,8 @@ const AccountOrderDetail = ({ params: { id } }) => {
|
|
|
75
76
|
|
|
76
77
|
<div>
|
|
77
78
|
<span className="text-base font-bold">
|
|
78
|
-
{order?.orderitem_set
|
|
79
|
-
{t('account.my_orders.detail.products')} {groupedOrder
|
|
79
|
+
{order?.orderitem_set?.length}{' '}
|
|
80
|
+
{t('account.my_orders.detail.products')} {groupedOrder?.length}{' '}
|
|
80
81
|
{t('account.my_orders.detail.packages')}
|
|
81
82
|
</span>
|
|
82
83
|
</div>
|
|
@@ -86,16 +87,17 @@ const AccountOrderDetail = ({ params: { id } }) => {
|
|
|
86
87
|
className="break-words"
|
|
87
88
|
>
|
|
88
89
|
<span>{t('account.my_orders.detail.delivery_address')}</span>:{' '}
|
|
89
|
-
{order
|
|
90
|
-
{order
|
|
91
|
-
{order
|
|
90
|
+
{order?.shipping_address?.line}{' '}
|
|
91
|
+
{order?.shipping_address?.district?.name}{' '}
|
|
92
|
+
{order?.shipping_address?.township?.name}{' '}
|
|
93
|
+
{order?.shipping_address?.city?.name}
|
|
92
94
|
</div>
|
|
93
95
|
</OrderDetailHeader>
|
|
94
96
|
|
|
95
97
|
<div>
|
|
96
98
|
{groupedOrder.map((group, i) => {
|
|
97
99
|
const orderStatus = getOrderStatus(
|
|
98
|
-
group[0]
|
|
100
|
+
group[0]?.status?.value?.toString(),
|
|
99
101
|
t
|
|
100
102
|
);
|
|
101
103
|
|
|
@@ -119,8 +121,8 @@ const AccountOrderDetail = ({ params: { id } }) => {
|
|
|
119
121
|
<div className="flex justify-between items-center lg:gap-x-12">
|
|
120
122
|
<div className="text-base">{orderStatus.label}</div>
|
|
121
123
|
|
|
122
|
-
{group[0]
|
|
123
|
-
<Link href={group[0]
|
|
124
|
+
{group[0]?.tracking_number && group[0]?.tracking_url && (
|
|
125
|
+
<Link href={group[0]?.tracking_url}>
|
|
124
126
|
<Button className="px-7" appearance="filled">
|
|
125
127
|
{t('account.my_orders.detail.track_shipment')}
|
|
126
128
|
</Button>
|
|
@@ -132,7 +134,7 @@ const AccountOrderDetail = ({ params: { id } }) => {
|
|
|
132
134
|
<div className="px-4 lg:px-7">
|
|
133
135
|
{group.map((item, index) => {
|
|
134
136
|
const itemStatus = getOrderStatus(
|
|
135
|
-
item
|
|
137
|
+
item?.status?.value?.toString(),
|
|
136
138
|
t
|
|
137
139
|
);
|
|
138
140
|
|
|
@@ -145,15 +147,15 @@ const AccountOrderDetail = ({ params: { id } }) => {
|
|
|
145
147
|
<div className="flex-shrink-0">
|
|
146
148
|
<Link
|
|
147
149
|
className="block"
|
|
148
|
-
href={item
|
|
150
|
+
href={item?.product?.absolute_url}
|
|
149
151
|
>
|
|
150
152
|
<Image
|
|
151
153
|
src={
|
|
152
|
-
item
|
|
154
|
+
item?.product?.image
|
|
153
155
|
? item.product.image
|
|
154
156
|
: '/noimage.jpg'
|
|
155
157
|
}
|
|
156
|
-
alt={item
|
|
158
|
+
alt={item?.product?.name}
|
|
157
159
|
width={112}
|
|
158
160
|
height={150}
|
|
159
161
|
/>
|
|
@@ -162,33 +164,33 @@ const AccountOrderDetail = ({ params: { id } }) => {
|
|
|
162
164
|
|
|
163
165
|
<div className="flex flex-col justify-between lg:max-w-48">
|
|
164
166
|
<div className="text-sm">
|
|
165
|
-
<Link href={item
|
|
166
|
-
{item
|
|
167
|
+
<Link href={item?.product?.absolute_url}>
|
|
168
|
+
{item?.product?.name}
|
|
167
169
|
</Link>
|
|
168
170
|
</div>
|
|
169
171
|
|
|
170
172
|
<div className="text-gray-900 text-xs">
|
|
171
|
-
{item
|
|
173
|
+
{item?.product?.attributes?.filterable_color && (
|
|
172
174
|
<div>
|
|
173
175
|
<span>
|
|
174
176
|
{t('account.my_orders.detail.color')}
|
|
175
177
|
</span>
|
|
176
|
-
: {item
|
|
178
|
+
: {item?.product?.attributes?.filterable_color}
|
|
177
179
|
</div>
|
|
178
180
|
)}
|
|
179
181
|
|
|
180
|
-
{item
|
|
182
|
+
{item?.product?.attributes?.size && (
|
|
181
183
|
<div>
|
|
182
184
|
<span>
|
|
183
185
|
{t('account.my_orders.detail.size')}
|
|
184
186
|
</span>
|
|
185
|
-
:{item
|
|
187
|
+
:{item?.product?.attributes?.size}
|
|
186
188
|
</div>
|
|
187
189
|
)}
|
|
188
190
|
|
|
189
191
|
<div>
|
|
190
192
|
<span>{t('account.my_orders.detail.code')}</span>:{' '}
|
|
191
|
-
{item
|
|
193
|
+
{item?.product?.base_code}
|
|
192
194
|
</div>
|
|
193
195
|
</div>
|
|
194
196
|
</div>
|
|
@@ -205,11 +207,11 @@ const AccountOrderDetail = ({ params: { id } }) => {
|
|
|
205
207
|
{itemStatus.label}
|
|
206
208
|
</div>
|
|
207
209
|
|
|
208
|
-
{(item
|
|
209
|
-
order
|
|
210
|
+
{(item?.is_cancellable || item?.is_refundable) &&
|
|
211
|
+
order?.is_cancellable && (
|
|
210
212
|
<div className="lg:ml-24">
|
|
211
213
|
<Link
|
|
212
|
-
href={`${ROUTES.ACCOUNT_ORDERS}/${order
|
|
214
|
+
href={`${ROUTES.ACCOUNT_ORDERS}/${order?.id}/cancellation`}
|
|
213
215
|
>
|
|
214
216
|
<Button
|
|
215
217
|
className="px-4 uppercase font-bold h-7"
|
|
@@ -225,21 +227,21 @@ const AccountOrderDetail = ({ params: { id } }) => {
|
|
|
225
227
|
)}
|
|
226
228
|
</div>
|
|
227
229
|
<div className="flex flex-col justify-center items-end lg:ml-6 lg:min-w-[7rem]">
|
|
228
|
-
{parseFloat(item
|
|
229
|
-
parseFloat(item
|
|
230
|
+
{parseFloat(item?.retail_price || '0') >
|
|
231
|
+
parseFloat(item?.price || '0') && (
|
|
230
232
|
<Price
|
|
231
233
|
className="font-normal line-through"
|
|
232
|
-
value={item
|
|
234
|
+
value={item?.retail_price}
|
|
233
235
|
/>
|
|
234
236
|
)}
|
|
235
237
|
|
|
236
238
|
<Price
|
|
237
239
|
className={clsx('font-normal', {
|
|
238
240
|
'text-secondary-600':
|
|
239
|
-
parseFloat(item
|
|
240
|
-
parseFloat(item
|
|
241
|
+
parseFloat(item?.retail_price || '0') >
|
|
242
|
+
parseFloat(item?.price || '0')
|
|
241
243
|
})}
|
|
242
|
-
value={item
|
|
244
|
+
value={item?.price}
|
|
243
245
|
/>
|
|
244
246
|
</div>
|
|
245
247
|
</div>
|
|
@@ -323,29 +325,29 @@ const AccountOrderDetail = ({ params: { id } }) => {
|
|
|
323
325
|
<div className="flex justify-between text-sm text-black-700 mb-2">
|
|
324
326
|
<p>
|
|
325
327
|
<span>{t('account.my_orders.detail.subtotal')}</span> (
|
|
326
|
-
{order
|
|
328
|
+
{order?.orderitem_set?.length}{' '}
|
|
327
329
|
<span>{t('account.my_orders.detail.items')}</span>)
|
|
328
330
|
</p>
|
|
329
331
|
|
|
330
332
|
<Price
|
|
331
333
|
className="font-normal min-w-max"
|
|
332
334
|
value={
|
|
333
|
-
parseFloat(order
|
|
334
|
-
parseFloat(order
|
|
335
|
+
parseFloat(order?.amount_without_discount || '0') -
|
|
336
|
+
parseFloat(order?.shipping_amount || '0')
|
|
335
337
|
}
|
|
336
338
|
/>
|
|
337
339
|
</div>
|
|
338
340
|
|
|
339
|
-
{order
|
|
340
|
-
order
|
|
341
|
+
{order?.discountitem_set &&
|
|
342
|
+
order?.discountitem_set?.map((item, index) => (
|
|
341
343
|
<div
|
|
342
344
|
className="flex justify-between text-sm text-black-700 mb-2"
|
|
343
345
|
key={index}
|
|
344
346
|
>
|
|
345
|
-
<p>{item
|
|
347
|
+
<p>{item?.name}</p>
|
|
346
348
|
<Price
|
|
347
349
|
className="font-normal min-w-max"
|
|
348
|
-
value={item
|
|
350
|
+
value={item?.amount}
|
|
349
351
|
useNegative
|
|
350
352
|
/>
|
|
351
353
|
</div>
|
|
@@ -358,7 +360,8 @@ const AccountOrderDetail = ({ params: { id } }) => {
|
|
|
358
360
|
className="font-normal min-w-max"
|
|
359
361
|
data-testid="account-orders-detail-total"
|
|
360
362
|
value={
|
|
361
|
-
parseFloat(order
|
|
363
|
+
parseFloat(order?.amount || '0') -
|
|
364
|
+
parseFloat(order?.shipping_amount || '0')
|
|
362
365
|
}
|
|
363
366
|
/>
|
|
364
367
|
</div>
|
|
@@ -13,7 +13,7 @@ export const Order = (props) => {
|
|
|
13
13
|
.reverse()
|
|
14
14
|
.join(' ');
|
|
15
15
|
|
|
16
|
-
const orderStatus = getOrderStatus(props
|
|
16
|
+
const orderStatus = getOrderStatus(props?.status?.value?.toString(), t);
|
|
17
17
|
|
|
18
18
|
return (
|
|
19
19
|
<div className="border border-gray px-5 py-4 text-sm mb-4 last:mb-0">
|
|
@@ -58,30 +58,32 @@ export const Order = (props) => {
|
|
|
58
58
|
|
|
59
59
|
<div className="w-full flex flex-col justify-between mt-6 mb-2 order-3 md:items-center md:flex-row md:order-none md:gap-20 lg:gap-40">
|
|
60
60
|
<ul className="flex flex-wrap gap-3.5 mb-6 items-center md:mb-0">
|
|
61
|
-
{props
|
|
61
|
+
{props?.orderitem_set?.slice(0, 3).map((item, index) => (
|
|
62
62
|
// TODO: Static image will change (TR)
|
|
63
63
|
<li className="flex-shrink-0" key={index}>
|
|
64
64
|
<Image
|
|
65
|
-
src={
|
|
66
|
-
|
|
65
|
+
src={
|
|
66
|
+
item?.product?.image ? item.product.image : '/noimage.jpg'
|
|
67
|
+
}
|
|
68
|
+
alt={item?.product?.name}
|
|
67
69
|
width={64}
|
|
68
70
|
height={96}
|
|
69
71
|
/>
|
|
70
72
|
</li>
|
|
71
73
|
))}
|
|
72
|
-
{props
|
|
73
|
-
<div>+ {props
|
|
74
|
+
{props?.orderitem_set?.length > 3 && (
|
|
75
|
+
<div>+ {props?.orderitem_set?.length - 3}</div>
|
|
74
76
|
)}
|
|
75
77
|
</ul>
|
|
76
78
|
|
|
77
|
-
<span className={orderStatus
|
|
79
|
+
<span className={orderStatus?.className}>{orderStatus?.label}</span>
|
|
78
80
|
</div>
|
|
79
81
|
|
|
80
82
|
<div
|
|
81
83
|
className="order-2 flex items-end md:order-none"
|
|
82
84
|
data-testid="account-orders-count"
|
|
83
85
|
>
|
|
84
|
-
{props
|
|
86
|
+
{props?.orderitem_set?.length} {t('account.my_orders.order.items')}
|
|
85
87
|
</div>
|
|
86
88
|
</div>
|
|
87
89
|
</div>
|
|
@@ -22,14 +22,15 @@ export const AnonymousTrackingOrderDetail = ({ order }) => {
|
|
|
22
22
|
const groupedOrder = [];
|
|
23
23
|
|
|
24
24
|
if (order) {
|
|
25
|
-
const groupedData =
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
groups[tracking_number]
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
25
|
+
const groupedData =
|
|
26
|
+
order?.orderitem_set?.reduce((groups, item) => {
|
|
27
|
+
const { tracking_number } = item;
|
|
28
|
+
if (!groups[tracking_number]) {
|
|
29
|
+
groups[tracking_number] = [];
|
|
30
|
+
}
|
|
31
|
+
groups[tracking_number].push(item);
|
|
32
|
+
return groups;
|
|
33
|
+
}, {}) || {};
|
|
33
34
|
|
|
34
35
|
const result = Object.values(groupedData);
|
|
35
36
|
|
|
@@ -67,8 +68,8 @@ export const AnonymousTrackingOrderDetail = ({ order }) => {
|
|
|
67
68
|
|
|
68
69
|
<div>
|
|
69
70
|
<span className="text-base font-bold">
|
|
70
|
-
{order
|
|
71
|
-
{t('account.my_orders.detail.products')} {groupedOrder
|
|
71
|
+
{order?.orderitem_set?.length}{' '}
|
|
72
|
+
{t('account.my_orders.detail.products')} {groupedOrder?.length}{' '}
|
|
72
73
|
{t('account.my_orders.detail.packages')}
|
|
73
74
|
</span>
|
|
74
75
|
</div>
|
|
@@ -78,17 +79,17 @@ export const AnonymousTrackingOrderDetail = ({ order }) => {
|
|
|
78
79
|
className="break-words"
|
|
79
80
|
>
|
|
80
81
|
<span>{t('account.my_orders.detail.delivery_address')}</span>:{' '}
|
|
81
|
-
{order?.shipping_address
|
|
82
|
-
{order?.shipping_address
|
|
83
|
-
{order?.shipping_address
|
|
84
|
-
{order?.shipping_address
|
|
82
|
+
{order?.shipping_address?.line}{' '}
|
|
83
|
+
{order?.shipping_address?.district?.name}{' '}
|
|
84
|
+
{order?.shipping_address?.township?.name}{' '}
|
|
85
|
+
{order?.shipping_address?.city?.name}
|
|
85
86
|
</div>
|
|
86
87
|
</OrderDetailHeader>
|
|
87
88
|
|
|
88
89
|
<div>
|
|
89
90
|
{groupedOrder.map((group, i) => {
|
|
90
91
|
const orderStatus = getOrderStatus(
|
|
91
|
-
group[0]
|
|
92
|
+
group[0]?.status?.value?.toString(),
|
|
92
93
|
t
|
|
93
94
|
);
|
|
94
95
|
|
|
@@ -112,8 +113,8 @@ export const AnonymousTrackingOrderDetail = ({ order }) => {
|
|
|
112
113
|
<div className="flex justify-between items-center lg:gap-x-12">
|
|
113
114
|
<div className="text-base">{orderStatus.label}</div>
|
|
114
115
|
|
|
115
|
-
{group[0]
|
|
116
|
-
<Link href={group[0]
|
|
116
|
+
{group[0]?.tracking_number && group[0]?.tracking_url && (
|
|
117
|
+
<Link href={group[0]?.tracking_url}>
|
|
117
118
|
<Button className="px-7" appearance="filled">
|
|
118
119
|
{t('account.my_orders.detail.track_shipment')}
|
|
119
120
|
</Button>
|
|
@@ -125,7 +126,7 @@ export const AnonymousTrackingOrderDetail = ({ order }) => {
|
|
|
125
126
|
<div className="px-4 lg:px-7">
|
|
126
127
|
{group.map((item, index) => {
|
|
127
128
|
const itemStatus = getOrderStatus(
|
|
128
|
-
item
|
|
129
|
+
item?.status?.value?.toString(),
|
|
129
130
|
t
|
|
130
131
|
);
|
|
131
132
|
|
|
@@ -138,15 +139,15 @@ export const AnonymousTrackingOrderDetail = ({ order }) => {
|
|
|
138
139
|
<div className="flex-shrink-0">
|
|
139
140
|
<Link
|
|
140
141
|
className="block"
|
|
141
|
-
href={item
|
|
142
|
+
href={item?.product?.absolute_url}
|
|
142
143
|
>
|
|
143
144
|
<Image
|
|
144
145
|
src={
|
|
145
|
-
item
|
|
146
|
+
item?.product?.image
|
|
146
147
|
? item.product.image
|
|
147
148
|
: '/noimage.jpg'
|
|
148
149
|
}
|
|
149
|
-
alt={item
|
|
150
|
+
alt={item?.product?.name}
|
|
150
151
|
width={112}
|
|
151
152
|
height={150}
|
|
152
153
|
/>
|
|
@@ -155,27 +156,32 @@ export const AnonymousTrackingOrderDetail = ({ order }) => {
|
|
|
155
156
|
|
|
156
157
|
<div className="flex flex-col justify-between lg:max-w-48">
|
|
157
158
|
<div className="text-sm">
|
|
158
|
-
<Link href={item
|
|
159
|
-
{item
|
|
159
|
+
<Link href={item?.product?.absolute_url}>
|
|
160
|
+
{item?.product?.name}
|
|
160
161
|
</Link>
|
|
161
162
|
</div>
|
|
162
163
|
|
|
163
164
|
<div className="text-gray-900 text-xs">
|
|
164
|
-
{item
|
|
165
|
+
{item?.product?.attributes
|
|
166
|
+
?.filterable_color && (
|
|
165
167
|
<div>
|
|
166
168
|
<span>
|
|
167
169
|
{t('account.my_orders.detail.color')}
|
|
168
170
|
</span>
|
|
169
|
-
:
|
|
171
|
+
:{' '}
|
|
172
|
+
{
|
|
173
|
+
item?.product?.attributes
|
|
174
|
+
?.filterable_color
|
|
175
|
+
}
|
|
170
176
|
</div>
|
|
171
177
|
)}
|
|
172
178
|
|
|
173
|
-
{item
|
|
179
|
+
{item?.product?.attributes?.size && (
|
|
174
180
|
<div>
|
|
175
181
|
<span>
|
|
176
182
|
{t('account.my_orders.detail.size')}
|
|
177
183
|
</span>
|
|
178
|
-
:{item
|
|
184
|
+
:{item?.product?.attributes?.size}
|
|
179
185
|
</div>
|
|
180
186
|
)}
|
|
181
187
|
|
|
@@ -183,7 +189,7 @@ export const AnonymousTrackingOrderDetail = ({ order }) => {
|
|
|
183
189
|
<span>
|
|
184
190
|
{t('account.my_orders.detail.code')}
|
|
185
191
|
</span>
|
|
186
|
-
: {item
|
|
192
|
+
: {item?.product?.base_code}
|
|
187
193
|
</div>
|
|
188
194
|
</div>
|
|
189
195
|
</div>
|
|
@@ -202,7 +208,7 @@ export const AnonymousTrackingOrderDetail = ({ order }) => {
|
|
|
202
208
|
|
|
203
209
|
{(item.is_cancellable || item.is_refundable) &&
|
|
204
210
|
order.is_cancellable &&
|
|
205
|
-
item
|
|
211
|
+
item?.status?.value == '400' && (
|
|
206
212
|
<div className="lg:ml-24">
|
|
207
213
|
<Link
|
|
208
214
|
href={`${ROUTES.ACCOUNT_ORDERS}/${order.id}/cancellation`}
|
|
@@ -256,29 +262,29 @@ export const AnonymousTrackingOrderDetail = ({ order }) => {
|
|
|
256
262
|
<div className="flex justify-between text-sm text-black-700 mb-2">
|
|
257
263
|
<p>
|
|
258
264
|
<span>{t('account.my_orders.detail.subtotal')}</span> (
|
|
259
|
-
{order?.orderitem_set
|
|
265
|
+
{order?.orderitem_set?.length}{' '}
|
|
260
266
|
<span>{t('account.my_orders.detail.items')}</span>)
|
|
261
267
|
</p>
|
|
262
268
|
|
|
263
269
|
<Price
|
|
264
270
|
className="font-normal min-w-max"
|
|
265
271
|
value={
|
|
266
|
-
parseFloat(order
|
|
267
|
-
parseFloat(order
|
|
272
|
+
parseFloat(order?.amount_without_discount || '0') -
|
|
273
|
+
parseFloat(order?.shipping_amount || '0')
|
|
268
274
|
}
|
|
269
275
|
/>
|
|
270
276
|
</div>
|
|
271
277
|
|
|
272
|
-
{order
|
|
273
|
-
order
|
|
278
|
+
{order?.discountitem_set &&
|
|
279
|
+
order?.discountitem_set?.map((item, index) => (
|
|
274
280
|
<div
|
|
275
281
|
className="flex justify-between text-sm text-black-700 mb-2"
|
|
276
282
|
key={index}
|
|
277
283
|
>
|
|
278
|
-
<p>{item
|
|
284
|
+
<p>{item?.name}</p>
|
|
279
285
|
<Price
|
|
280
286
|
className="font-normal min-w-max"
|
|
281
|
-
value={item
|
|
287
|
+
value={item?.amount}
|
|
282
288
|
useNegative
|
|
283
289
|
/>
|
|
284
290
|
</div>
|
|
@@ -291,7 +297,8 @@ export const AnonymousTrackingOrderDetail = ({ order }) => {
|
|
|
291
297
|
className="font-normal min-w-max"
|
|
292
298
|
data-testid="account-orders-detail-total"
|
|
293
299
|
value={
|
|
294
|
-
parseFloat(order
|
|
300
|
+
parseFloat(order?.amount || '0') -
|
|
301
|
+
parseFloat(order?.shipping_amount || '0')
|
|
295
302
|
}
|
|
296
303
|
/>
|
|
297
304
|
</div>
|
|
@@ -13,7 +13,8 @@ export interface PriceProps {
|
|
|
13
13
|
export default function PriceWrapper(props: PriceProps) {
|
|
14
14
|
const { t } = useLocalization();
|
|
15
15
|
const { price, retailPrice } = props;
|
|
16
|
-
const hasRetailPrice =
|
|
16
|
+
const hasRetailPrice =
|
|
17
|
+
parseFloat(retailPrice || '0') > parseFloat(price || '0');
|
|
17
18
|
|
|
18
19
|
return (
|
|
19
20
|
<div className="flex items-center gap-3 justify-center h-full">
|
|
@@ -31,7 +32,11 @@ export default function PriceWrapper(props: PriceProps) {
|
|
|
31
32
|
{hasRetailPrice && (
|
|
32
33
|
<div className="flex flex-col items-center w-9 py-0.5 text-xs text-white bg-secondary">
|
|
33
34
|
<span className="font-bold">
|
|
34
|
-
{Math.round(
|
|
35
|
+
{Math.round(
|
|
36
|
+
100 -
|
|
37
|
+
(parseInt(price || '0') / parseInt(retailPrice || '1')) * 100
|
|
38
|
+
)}
|
|
39
|
+
%
|
|
35
40
|
</span>
|
|
36
41
|
<span>{t('product.off')}</span>
|
|
37
42
|
</div>
|