@o2vend/theme-cli 1.0.37 → 1.0.38
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/lib/lib/dev-server.js +309 -40
- package/lib/lib/liquid-engine.js +3 -1
- package/lib/lib/mock-data.js +36 -124
- package/lib/lib/widget-service.js +12 -4
- package/package.json +1 -1
- package/test-theme/assets/async-sections.js +32 -24
- package/test-theme/assets/cart-drawer.js +20 -22
- package/test-theme/assets/cart-manager.js +1 -15
- package/test-theme/assets/checkout-price-handler.js +12 -11
- package/test-theme/assets/checkout.css +1415 -0
- package/test-theme/assets/checkout.js +3174 -0
- package/test-theme/assets/components.css +178 -29
- package/test-theme/assets/delivery-zone.js +1 -1
- package/test-theme/assets/product-detail.css +1050 -0
- package/test-theme/assets/product-detail.js +2940 -0
- package/test-theme/assets/theme.css +95 -120
- package/test-theme/assets/theme.js +781 -186
- package/test-theme/layout/theme.liquid +91 -17
- package/test-theme/sections/content.liquid +64 -57
- package/test-theme/sections/footer-fallback.liquid +57 -7
- package/test-theme/sections/footer.liquid +63 -12
- package/test-theme/sections/header-fallback.liquid +41 -41
- package/test-theme/sections/header.liquid +41 -51
- package/test-theme/sections/hero-fallback.liquid +1 -1
- package/test-theme/sections/hero.liquid +159 -136
- package/test-theme/snippets/account-sidebar.liquid +121 -29
- package/test-theme/snippets/add-to-cart-modal.liquid +258 -206
- package/test-theme/snippets/breadcrumbs.liquid +98 -11
- package/test-theme/snippets/cart-drawer.liquid +93 -0
- package/test-theme/snippets/delivery-zone-city-selector.liquid +101 -15
- package/test-theme/snippets/delivery-zone-modal.liquid +529 -84
- package/test-theme/snippets/delivery-zone-search.liquid +104 -18
- package/test-theme/snippets/login-modal.liquid +269 -82
- package/test-theme/snippets/mega-menu.liquid +130 -43
- package/test-theme/snippets/news-thumbnail.liquid +120 -28
- package/test-theme/snippets/pagination.liquid +1 -1
- package/test-theme/snippets/price.liquid +100 -9
- package/test-theme/snippets/product-card-related.liquid +22 -4
- package/test-theme/snippets/product-card-simple.liquid +521 -25
- package/test-theme/snippets/product-card.liquid +145 -232
- package/test-theme/snippets/rating.liquid +100 -9
- package/test-theme/snippets/skeleton-collection-grid.liquid +94 -8
- package/test-theme/snippets/skeleton-product-card.liquid +102 -16
- package/test-theme/snippets/skeleton-product-grid.liquid +87 -1
- package/test-theme/snippets/social-sharing.liquid +133 -32
- package/test-theme/templates/account/dashboard.liquid +30 -0
- package/test-theme/templates/account/loyalty-redemption.liquid +29 -28
- package/test-theme/templates/account/loyalty.liquid +45 -43
- package/test-theme/templates/account/order-detail.liquid +15 -8
- package/test-theme/templates/account/orders.liquid +189 -35
- package/test-theme/templates/account/profile.liquid +509 -114
- package/test-theme/templates/account/register.liquid +18 -8
- package/test-theme/templates/account/return-orders.liquid +31 -30
- package/test-theme/templates/account/store-credit.liquid +27 -26
- package/test-theme/templates/account/subscriptions.liquid +22 -5
- package/test-theme/templates/account/wishlist.liquid +88 -19
- package/test-theme/templates/address-book.liquid +166 -69
- package/test-theme/templates/categories.liquid +90 -30
- package/test-theme/templates/checkout.liquid +137 -3834
- package/test-theme/templates/error.liquid +23 -21
- package/test-theme/templates/index.liquid +29 -0
- package/test-theme/templates/login.liquid +33 -6
- package/test-theme/templates/order-confirmation.liquid +67 -9
- package/test-theme/templates/page.liquid +418 -206
- package/test-theme/templates/product-detail.liquid +124 -3878
- package/test-theme/templates/products.liquid +155 -30
- package/test-theme/templates/search.liquid +739 -225
- package/test-theme/widgets/brand-carousel.liquid +102 -82
- package/test-theme/widgets/brand.liquid +78 -50
- package/test-theme/widgets/carousel.liquid +253 -121
- package/test-theme/widgets/category-list-carousel.liquid +32 -8
- package/test-theme/widgets/category-list.liquid +21 -6
- package/test-theme/widgets/category.liquid +104 -37
- package/test-theme/widgets/discount-time.liquid +326 -119
- package/test-theme/widgets/footer-menu.liquid +115 -23
- package/test-theme/widgets/footer.liquid +118 -5
- package/test-theme/widgets/gallery.liquid +29 -5
- package/test-theme/widgets/header-menu.liquid +25 -13
- package/test-theme/widgets/header.liquid +64 -26
- package/test-theme/widgets/html.liquid +29 -6
- package/test-theme/widgets/news.liquid +6 -0
- package/test-theme/widgets/product-canvas.liquid +20 -12
- package/test-theme/widgets/product-carousel.liquid +118 -56
- package/test-theme/widgets/shared/product-grid.liquid +12 -0
- package/test-theme/widgets/single-product.liquid +688 -250
- package/test-theme/widgets/spacebar-carousel.liquid +39 -10
- package/test-theme/widgets/spacebar.liquid +77 -6
- package/test-theme/widgets/splash.liquid +40 -30
- package/test-theme/widgets/testimonial-carousel.liquid +111 -67
|
@@ -84,32 +84,33 @@
|
|
|
84
84
|
|
|
85
85
|
<style>
|
|
86
86
|
:root {
|
|
87
|
-
--color-primary: #
|
|
88
|
-
--color-primary-hover: #
|
|
89
|
-
--color-primary-light: #
|
|
90
|
-
--color-success: #
|
|
91
|
-
--color-success-light: #
|
|
92
|
-
--color-success-dark: #
|
|
93
|
-
--color-danger: #ef4444;
|
|
94
|
-
--color-danger-light: #
|
|
95
|
-
--color-danger-dark: #
|
|
96
|
-
--color-text: #
|
|
97
|
-
--color-text-light: #
|
|
98
|
-
--color-background: #
|
|
99
|
-
--color-card-bg: #
|
|
100
|
-
--color-border: #
|
|
101
|
-
--color-border-light: #
|
|
102
|
-
--
|
|
103
|
-
--shadow-
|
|
104
|
-
--shadow-
|
|
105
|
-
--
|
|
106
|
-
--radius-
|
|
107
|
-
--radius-
|
|
108
|
-
--
|
|
109
|
-
--spacing-
|
|
110
|
-
--spacing-
|
|
111
|
-
--spacing-
|
|
112
|
-
--spacing-
|
|
87
|
+
--color-primary: {{ settings.color_primary | default: '#000000' }};
|
|
88
|
+
--color-primary-hover: {{ settings.color_primary_dark | default: '#333333' }};
|
|
89
|
+
--color-primary-light: {{ settings.color_primary_light | default: '#666666' }};
|
|
90
|
+
--color-success: {{ settings.color_success | default: '#22c55e' }};
|
|
91
|
+
--color-success-light: {{ settings.color_success | default: '#22c55e' }};
|
|
92
|
+
--color-success-dark: {{ settings.color_success | default: '#22c55e' }};
|
|
93
|
+
--color-danger: {{ settings.color_error | default: '#ef4444' }};
|
|
94
|
+
--color-danger-light: {{ settings.color_error | default: '#ef4444' }};
|
|
95
|
+
--color-danger-dark: {{ settings.color_error | default: '#ef4444' }};
|
|
96
|
+
--color-text: {{ settings.color_text | default: '#000000' }};
|
|
97
|
+
--color-text-light: {{ settings.color_text_light | default: '#999999' }};
|
|
98
|
+
--color-background: {{ settings.color_background | default: '#ffffff' }};
|
|
99
|
+
--color-card-bg: {{ settings.color_surface | default: '#f5f5f5' }};
|
|
100
|
+
--color-border: {{ settings.color_border | default: '#cccccc' }};
|
|
101
|
+
--color-border-light: {{ settings.color_surface | default: '#f5f5f5' }};
|
|
102
|
+
--color-white: #ffffff;
|
|
103
|
+
--shadow-sm: var(--shadow-sm);
|
|
104
|
+
--shadow-md: var(--shadow-md);
|
|
105
|
+
--shadow-lg: var(--shadow-lg);
|
|
106
|
+
--radius-sm: var(--radius-md);
|
|
107
|
+
--radius-md: var(--radius-lg);
|
|
108
|
+
--radius-lg: var(--radius-xl);
|
|
109
|
+
--spacing-xs: var(--space-2);
|
|
110
|
+
--spacing-sm: var(--space-4);
|
|
111
|
+
--spacing-md: var(--space-6);
|
|
112
|
+
--spacing-lg: var(--space-8);
|
|
113
|
+
--spacing-xl: var(--space-12);
|
|
113
114
|
}
|
|
114
115
|
|
|
115
116
|
.account-page {
|
|
@@ -196,7 +197,7 @@
|
|
|
196
197
|
border-radius: var(--radius-lg);
|
|
197
198
|
padding: var(--spacing-xl);
|
|
198
199
|
text-align: center;
|
|
199
|
-
color: white;
|
|
200
|
+
color: var(--color-white);
|
|
200
201
|
box-shadow: var(--shadow-lg);
|
|
201
202
|
position: relative;
|
|
202
203
|
overflow: hidden;
|
|
@@ -353,7 +354,7 @@
|
|
|
353
354
|
|
|
354
355
|
.btn-primary {
|
|
355
356
|
background: var(--color-primary);
|
|
356
|
-
color: white;
|
|
357
|
+
color: var(--color-white);
|
|
357
358
|
border: 2px solid var(--color-primary);
|
|
358
359
|
}
|
|
359
360
|
|
|
@@ -145,32 +145,34 @@
|
|
|
145
145
|
|
|
146
146
|
<style>
|
|
147
147
|
:root {
|
|
148
|
-
--color-primary: #
|
|
149
|
-
--color-primary-hover: #
|
|
150
|
-
--color-primary-light: #
|
|
151
|
-
--color-success: #
|
|
152
|
-
--color-success-light: #
|
|
153
|
-
--color-success-dark: #
|
|
154
|
-
--color-danger: #ef4444;
|
|
155
|
-
--color-danger-light: #
|
|
156
|
-
--color-danger-dark: #
|
|
157
|
-
--color-text: #
|
|
158
|
-
--color-text-light: #
|
|
159
|
-
--color-
|
|
160
|
-
--color-
|
|
161
|
-
--color-
|
|
162
|
-
--color-border
|
|
163
|
-
--
|
|
164
|
-
--
|
|
165
|
-
--shadow-
|
|
166
|
-
--
|
|
167
|
-
--
|
|
168
|
-
--radius-
|
|
169
|
-
--
|
|
170
|
-
--
|
|
171
|
-
--spacing-
|
|
172
|
-
--spacing-
|
|
173
|
-
--spacing-
|
|
148
|
+
--color-primary: {{ settings.color_primary | default: '#000000' }};
|
|
149
|
+
--color-primary-hover: {{ settings.color_primary_dark | default: '#333333' }};
|
|
150
|
+
--color-primary-light: {{ settings.color_primary_light | default: '#666666' }};
|
|
151
|
+
--color-success: {{ settings.color_success | default: '#22c55e' }};
|
|
152
|
+
--color-success-light: {{ settings.color_success | default: '#22c55e' }};
|
|
153
|
+
--color-success-dark: {{ settings.color_success | default: '#22c55e' }};
|
|
154
|
+
--color-danger: {{ settings.color_error | default: '#ef4444' }};
|
|
155
|
+
--color-danger-light: {{ settings.color_error | default: '#ef4444' }};
|
|
156
|
+
--color-danger-dark: {{ settings.color_error | default: '#ef4444' }};
|
|
157
|
+
--color-text: {{ settings.color_text | default: '#000000' }};
|
|
158
|
+
--color-text-light: {{ settings.color_text_light | default: '#999999' }};
|
|
159
|
+
--color-text-muted: {{ settings.color_text_muted | default: '#666666' }};
|
|
160
|
+
--color-background: {{ settings.color_background | default: '#ffffff' }};
|
|
161
|
+
--color-card-bg: {{ settings.color_surface | default: '#f5f5f5' }};
|
|
162
|
+
--color-border: {{ settings.color_border | default: '#cccccc' }};
|
|
163
|
+
--color-border-light: {{ settings.color_surface | default: '#f5f5f5' }};
|
|
164
|
+
--color-white: #ffffff;
|
|
165
|
+
--shadow-sm: var(--shadow-sm);
|
|
166
|
+
--shadow-md: var(--shadow-md);
|
|
167
|
+
--shadow-lg: var(--shadow-lg);
|
|
168
|
+
--radius-sm: var(--radius-md);
|
|
169
|
+
--radius-md: var(--radius-lg);
|
|
170
|
+
--radius-lg: var(--radius-xl);
|
|
171
|
+
--spacing-xs: var(--space-2);
|
|
172
|
+
--spacing-sm: var(--space-4);
|
|
173
|
+
--spacing-md: var(--space-6);
|
|
174
|
+
--spacing-lg: var(--space-8);
|
|
175
|
+
--spacing-xl: var(--space-12);
|
|
174
176
|
}
|
|
175
177
|
|
|
176
178
|
.account-page {
|
|
@@ -190,11 +192,11 @@
|
|
|
190
192
|
display: grid;
|
|
191
193
|
grid-template-columns: 1fr 1fr;
|
|
192
194
|
gap: 2rem;
|
|
193
|
-
background:
|
|
194
|
-
border: 1px solid
|
|
195
|
+
background: var(--color-surface);
|
|
196
|
+
border: 1px solid var(--color-border);
|
|
195
197
|
border-radius: 14px;
|
|
196
198
|
padding: 2rem;
|
|
197
|
-
box-shadow:
|
|
199
|
+
box-shadow: var(--shadow-md);
|
|
198
200
|
max-width: 900px;
|
|
199
201
|
}
|
|
200
202
|
|
|
@@ -206,7 +208,7 @@
|
|
|
206
208
|
}
|
|
207
209
|
|
|
208
210
|
.points-icon {
|
|
209
|
-
color:
|
|
211
|
+
color: var(--color-primary);
|
|
210
212
|
flex-shrink: 0;
|
|
211
213
|
}
|
|
212
214
|
|
|
@@ -214,36 +216,36 @@
|
|
|
214
216
|
font-size: 3rem;
|
|
215
217
|
font-weight: 700;
|
|
216
218
|
margin: 0;
|
|
217
|
-
color:
|
|
219
|
+
color: var(--color-text);
|
|
218
220
|
}
|
|
219
221
|
|
|
220
222
|
.points-label {
|
|
221
223
|
font-size: 1rem;
|
|
222
|
-
color:
|
|
224
|
+
color: var(--color-text-light);
|
|
223
225
|
margin-top: 0.25rem;
|
|
224
226
|
}
|
|
225
227
|
|
|
226
228
|
.points-expiry {
|
|
227
229
|
font-size: 0.95rem;
|
|
228
|
-
color:
|
|
230
|
+
color: var(--color-text);
|
|
229
231
|
margin-top: 0.75rem;
|
|
230
232
|
}
|
|
231
233
|
|
|
232
234
|
.muted {
|
|
233
|
-
color:
|
|
235
|
+
color: var(--color-text-muted);
|
|
234
236
|
}
|
|
235
237
|
|
|
236
238
|
/* RIGHT SIDE */
|
|
237
239
|
.loyalty-right {
|
|
238
240
|
padding-left: 2rem;
|
|
239
|
-
border-left: 1px solid
|
|
241
|
+
border-left: 1px solid var(--color-border);
|
|
240
242
|
}
|
|
241
243
|
|
|
242
244
|
.breakdown-title {
|
|
243
245
|
font-size: 1.15rem;
|
|
244
246
|
font-weight: 600;
|
|
245
247
|
margin-bottom: 1.25rem;
|
|
246
|
-
color:
|
|
248
|
+
color: var(--color-text);
|
|
247
249
|
}
|
|
248
250
|
|
|
249
251
|
.points-breakdown {
|
|
@@ -257,7 +259,7 @@
|
|
|
257
259
|
justify-content: space-between;
|
|
258
260
|
align-items: center;
|
|
259
261
|
padding: 0.75rem 0;
|
|
260
|
-
border-bottom: 1px dashed
|
|
262
|
+
border-bottom: 1px dashed var(--color-border);
|
|
261
263
|
font-size: 1rem;
|
|
262
264
|
}
|
|
263
265
|
|
|
@@ -266,18 +268,18 @@
|
|
|
266
268
|
}
|
|
267
269
|
|
|
268
270
|
.points-breakdown .type {
|
|
269
|
-
color:
|
|
271
|
+
color: var(--color-text);
|
|
270
272
|
font-weight: 500;
|
|
271
273
|
}
|
|
272
274
|
|
|
273
275
|
.points-breakdown .points {
|
|
274
276
|
font-weight: 600;
|
|
275
|
-
color:
|
|
277
|
+
color: var(--color-primary);
|
|
276
278
|
}
|
|
277
279
|
|
|
278
280
|
.empty-text {
|
|
279
281
|
font-size: 0.95rem;
|
|
280
|
-
color:
|
|
282
|
+
color: var(--color-text-muted);
|
|
281
283
|
}
|
|
282
284
|
|
|
283
285
|
/* ===============================
|
|
@@ -292,7 +294,7 @@
|
|
|
292
294
|
.loyalty-right {
|
|
293
295
|
border-left: none;
|
|
294
296
|
padding-left: 0;
|
|
295
|
-
border-top: 1px solid
|
|
297
|
+
border-top: 1px solid var(--color-border);
|
|
296
298
|
padding-top: 1.5rem;
|
|
297
299
|
}
|
|
298
300
|
|
|
@@ -374,7 +376,7 @@
|
|
|
374
376
|
border-radius: var(--radius-lg);
|
|
375
377
|
padding: 10px;
|
|
376
378
|
text-align: center;
|
|
377
|
-
color: white;
|
|
379
|
+
color: var(--color-white);
|
|
378
380
|
box-shadow: var(--shadow-lg);
|
|
379
381
|
position: relative;
|
|
380
382
|
overflow: hidden;
|
|
@@ -537,7 +539,7 @@
|
|
|
537
539
|
|
|
538
540
|
.btn-primary {
|
|
539
541
|
background: var(--color-primary);
|
|
540
|
-
color: white;
|
|
542
|
+
color: var(--color-white);
|
|
541
543
|
border: 2px solid var(--color-primary);
|
|
542
544
|
}
|
|
543
545
|
|
|
@@ -61,6 +61,12 @@
|
|
|
61
61
|
<span>Order Total</span>
|
|
62
62
|
<span>{{ order.orderTotal | money_with_settings: shop.settings }}</span>
|
|
63
63
|
</div>
|
|
64
|
+
{% if order.paymentMethod %}
|
|
65
|
+
<div class="payment-row">
|
|
66
|
+
<span>Payment Method</span>
|
|
67
|
+
<span>{{ order.paymentMethod }}</span>
|
|
68
|
+
</div>
|
|
69
|
+
{% endif %}
|
|
64
70
|
</div>
|
|
65
71
|
|
|
66
72
|
<!-- ITEMS -->
|
|
@@ -137,14 +143,15 @@
|
|
|
137
143
|
|
|
138
144
|
<style>
|
|
139
145
|
:root {
|
|
140
|
-
--color-primary
|
|
141
|
-
--color-border
|
|
142
|
-
--color-border-light
|
|
143
|
-
--color-text
|
|
144
|
-
--color-text-light
|
|
145
|
-
--color-bg
|
|
146
|
-
--card
|
|
147
|
-
--radius:
|
|
146
|
+
--color-primary: {{ settings.color_primary | default: '#000000' }};
|
|
147
|
+
--color-border: {{ settings.color_border | default: '#cccccc' }};
|
|
148
|
+
--color-border-light: {{ settings.color_surface | default: '#f5f5f5' }};
|
|
149
|
+
--color-text: {{ settings.color_text | default: '#000000' }};
|
|
150
|
+
--color-text-light: {{ settings.color_text_light | default: '#999999' }};
|
|
151
|
+
--color-bg: {{ settings.color_background | default: '#ffffff' }};
|
|
152
|
+
--card: {{ settings.color_surface | default: '#f5f5f5' }};
|
|
153
|
+
--radius: var(--radius-lg);
|
|
154
|
+
--color-white: #ffffff;
|
|
148
155
|
}
|
|
149
156
|
|
|
150
157
|
/* Layout */
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
|
|
40
40
|
<div class="order-meta">
|
|
41
41
|
<span class="order-date">
|
|
42
|
-
|
|
42
|
+
{{ order.createdOn | date: '%d-%m-%Y %H:%M' }}
|
|
43
43
|
</span>
|
|
44
44
|
<span class="order-items">
|
|
45
45
|
{{ order.itemCount }} item{{ order.itemCount | pluralize }}
|
|
@@ -65,6 +65,15 @@
|
|
|
65
65
|
>
|
|
66
66
|
View Details
|
|
67
67
|
</a>
|
|
68
|
+
|
|
69
|
+
<button
|
|
70
|
+
type="button"
|
|
71
|
+
class="btn btn-sm btn-outline return-order-btn"
|
|
72
|
+
data-order-id="{{ order.id }}"
|
|
73
|
+
aria-label="Return order {{ order.orderNumber }}"
|
|
74
|
+
>
|
|
75
|
+
Return Order
|
|
76
|
+
</button>
|
|
68
77
|
</div>
|
|
69
78
|
</article>
|
|
70
79
|
|
|
@@ -83,6 +92,150 @@
|
|
|
83
92
|
{% include 'snippets/pagination', pagination: pagination %}
|
|
84
93
|
</div>
|
|
85
94
|
|
|
95
|
+
<!-- Return Modal -->
|
|
96
|
+
<div id="return-modal" class="return-modal" style="display:none;">
|
|
97
|
+
<div class="return-modal-backdrop"></div>
|
|
98
|
+
<div class="return-modal-content">
|
|
99
|
+
<button class="return-modal-close" aria-label="Close">×</button>
|
|
100
|
+
<h3>Return items for Order <span id="return-order-number"></span></h3>
|
|
101
|
+
<div class="return-items-table-wrapper">
|
|
102
|
+
<table class="return-items-table">
|
|
103
|
+
<thead>
|
|
104
|
+
<tr>
|
|
105
|
+
<th>Product Name</th>
|
|
106
|
+
<th>Quantity</th>
|
|
107
|
+
<th>Price</th>
|
|
108
|
+
<th>Return Qty</th>
|
|
109
|
+
<th>Action</th>
|
|
110
|
+
</tr>
|
|
111
|
+
</thead>
|
|
112
|
+
<tbody id="return-items-container"></tbody>
|
|
113
|
+
</table>
|
|
114
|
+
</div>
|
|
115
|
+
</div>
|
|
116
|
+
</div>
|
|
117
|
+
|
|
118
|
+
<style>
|
|
119
|
+
.return-modal { position:fixed; inset:0; display:flex; align-items:center; justify-content:center; z-index:1200; }
|
|
120
|
+
.return-modal-backdrop { position:fixed; inset:0; background:rgba(0,0,0,0.5); }
|
|
121
|
+
.return-modal-content { position:relative; background:#fff; padding:1.25rem; border-radius:8px; max-width:720px; width:90%; max-height:90vh; overflow:auto; box-shadow:0 8px 24px rgba(0,0,0,0.2); z-index:1201; }
|
|
122
|
+
.return-modal-close { position:absolute; top:8px; right:10px; background:transparent; border:none; font-size:20px; cursor:pointer; }
|
|
123
|
+
|
|
124
|
+
.return-items-table-wrapper { overflow-x:auto; margin-top:1rem; }
|
|
125
|
+
.return-items-table { width:100%; border-collapse:collapse; min-width:500px; }
|
|
126
|
+
.return-items-table th { background:#f5f5f5; padding:0.75rem 0.5rem; text-align:left; font-weight:600; border-bottom:2px solid #ddd; white-space:nowrap; }
|
|
127
|
+
.return-items-table td { padding:0.75rem 0.5rem; border-bottom:1px solid #eee; vertical-align:middle; }
|
|
128
|
+
.return-items-table tbody tr:hover { background:#f9f9f9; }
|
|
129
|
+
|
|
130
|
+
.return-item-row { display:table-row; }
|
|
131
|
+
.return-item-name { font-weight:600; }
|
|
132
|
+
.return-item-meta, .return-item-price { white-space:nowrap; }
|
|
133
|
+
.return-qty-input { width:70px; padding:0.4rem; border:1px solid #ddd; border-radius:4px; }
|
|
134
|
+
|
|
135
|
+
@media (max-width: 768px) {
|
|
136
|
+
.return-modal-content { width:95%; padding:1rem; }
|
|
137
|
+
.return-items-table { min-width:100%; font-size:0.9rem; }
|
|
138
|
+
.return-items-table th, .return-items-table td { padding:0.5rem 0.25rem; }
|
|
139
|
+
.return-qty-input { width:60px; padding:0.3rem; }
|
|
140
|
+
.btn-sm { font-size:0.8rem; padding:0.3rem 0.5rem; }
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
@media (max-width: 480px) {
|
|
144
|
+
.return-items-table { font-size:0.85rem; }
|
|
145
|
+
.return-items-table th, .return-items-table td { padding:0.4rem 0.2rem; font-size:0.85rem; }
|
|
146
|
+
.return-qty-input { width:50px; }
|
|
147
|
+
}
|
|
148
|
+
</style>
|
|
149
|
+
|
|
150
|
+
<script>
|
|
151
|
+
(() => {
|
|
152
|
+
function formatMoney(amount){
|
|
153
|
+
if (amount === null || amount === undefined || isNaN(Number(amount))) return String(amount ?? '0.00');
|
|
154
|
+
const num = Number(amount);
|
|
155
|
+
const currencySymbol = document.body?.dataset?.shopCurrencySymbol || window.__SHOP_CURRENCY_SYMBOL__ || '$';
|
|
156
|
+
const decimals = 2;
|
|
157
|
+
let formatted = num.toFixed(decimals);
|
|
158
|
+
// thousand separators
|
|
159
|
+
formatted = formatted.replace(/\B(?=(\d{3})+(?!\d))/g, ',');
|
|
160
|
+
return currencySymbol + formatted;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
document.addEventListener('click', (e) => {
|
|
164
|
+
if(e.target.matches('.return-order-btn')){
|
|
165
|
+
const orderId = e.target.dataset.orderId;
|
|
166
|
+
openReturnModal(orderId);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
if(e.target.matches('.return-modal-close') || e.target.matches('.return-modal-backdrop')) closeModal();
|
|
170
|
+
|
|
171
|
+
if(e.target.matches('.return-item-btn')){
|
|
172
|
+
const el = e.target;
|
|
173
|
+
const orderItemId = el.dataset.orderItemId;
|
|
174
|
+
const productId = el.dataset.productId;
|
|
175
|
+
const orderId = el.dataset.orderId;
|
|
176
|
+
const qtyEl = document.querySelector('#qty-' + orderItemId);
|
|
177
|
+
const qty = Number(qtyEl?.value || 1);
|
|
178
|
+
|
|
179
|
+
el.disabled = true;
|
|
180
|
+
fetch('/webstoreapi/customer/returns', {
|
|
181
|
+
method: 'POST',
|
|
182
|
+
headers: { 'Content-Type': 'application/json' },
|
|
183
|
+
body: JSON.stringify({ orderItemId: Number(orderItemId), productId: Number(productId), quantity: qty })
|
|
184
|
+
}).then(r=>r.json()).then(data=>{
|
|
185
|
+
if(data && data.success){
|
|
186
|
+
alert('Return request submitted');
|
|
187
|
+
closeModal();
|
|
188
|
+
location.reload();
|
|
189
|
+
} else {
|
|
190
|
+
alert(data.error || 'Unable to submit return');
|
|
191
|
+
}
|
|
192
|
+
}).catch(err=>{
|
|
193
|
+
alert('Error: ' + err.message);
|
|
194
|
+
}).finally(()=>{ el.disabled = false; });
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
async function openReturnModal(orderId){
|
|
199
|
+
try{
|
|
200
|
+
const res = await fetch('/webstoreapi/customer/orders/' + orderId);
|
|
201
|
+
const json = await res.json();
|
|
202
|
+
if(!json.success) throw new Error(json.error || 'Unable to fetch order');
|
|
203
|
+
const order = json.data;
|
|
204
|
+
document.getElementById('return-order-number').textContent = order.orderNumber || order.orderNo || '';
|
|
205
|
+
const container = document.getElementById('return-items-container');
|
|
206
|
+
container.innerHTML = '';
|
|
207
|
+
if(order.items && order.items.length){
|
|
208
|
+
order.items.forEach(item=>{
|
|
209
|
+
const orderItemId = item.orderItemId || item.id || item.orderItemId;
|
|
210
|
+
const productId = item.productId || (item.product && item.product.productId) || item.productId || 0;
|
|
211
|
+
const maxQty = item.quantity || 1;
|
|
212
|
+
const tr = document.createElement('tr');
|
|
213
|
+
tr.className = 'return-item-row';
|
|
214
|
+
tr.innerHTML = `\
|
|
215
|
+
<td class="return-item-name">${item.productName}</td>\
|
|
216
|
+
<td class="return-item-meta">${maxQty}</td>\
|
|
217
|
+
<td class="return-item-price">${formatMoney(item.productPrice)}</td>\
|
|
218
|
+
<td><input type="number" id="qty-${orderItemId}" class="return-qty-input" min="1" max="${maxQty}" value="1" /></td>\
|
|
219
|
+
<td><button class="btn btn-sm btn-primary return-item-btn" data-order-id="${orderId}" data-order-item-id="${orderItemId}" data-product-id="${productId}">Return</button></td>`;
|
|
220
|
+
container.appendChild(tr);
|
|
221
|
+
});
|
|
222
|
+
} else {
|
|
223
|
+
container.innerHTML = '<tr><td colspan="5" style="text-align:center; padding:1rem;">No items found</td></tr>';
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
document.getElementById('return-modal').style.display = 'flex';
|
|
227
|
+
}catch(err){
|
|
228
|
+
alert('Error: ' + err.message);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
function closeModal()
|
|
233
|
+
{
|
|
234
|
+
document.getElementById('return-modal').style.display = 'none';
|
|
235
|
+
}
|
|
236
|
+
})();
|
|
237
|
+
</script>
|
|
238
|
+
|
|
86
239
|
{% hook 'account_orders_after' %}
|
|
87
240
|
</main>
|
|
88
241
|
|
|
@@ -95,35 +248,36 @@
|
|
|
95
248
|
=============================== */
|
|
96
249
|
|
|
97
250
|
:root {
|
|
98
|
-
--color-primary: #
|
|
99
|
-
--color-primary-hover: #
|
|
100
|
-
--color-primary-light: #
|
|
101
|
-
--color-success: #
|
|
102
|
-
--color-success-light: #
|
|
103
|
-
--color-success-dark: #
|
|
104
|
-
--color-warning: #f59e0b;
|
|
105
|
-
--color-warning-light: #
|
|
106
|
-
--color-warning-dark: #
|
|
107
|
-
--color-danger: #ef4444;
|
|
108
|
-
--color-danger-light: #
|
|
109
|
-
--color-danger-dark: #
|
|
110
|
-
--color-info: #3b82f6;
|
|
111
|
-
--color-info-light: #
|
|
112
|
-
--color-info-dark: #
|
|
113
|
-
--color-text: #
|
|
114
|
-
--color-text-light: #
|
|
115
|
-
--color-background: #
|
|
116
|
-
--color-card-bg: #
|
|
117
|
-
--color-border: #
|
|
118
|
-
--
|
|
119
|
-
--shadow-
|
|
120
|
-
--shadow-
|
|
121
|
-
--
|
|
122
|
-
--radius-
|
|
123
|
-
--
|
|
124
|
-
--spacing-
|
|
125
|
-
--spacing-
|
|
126
|
-
--spacing-
|
|
251
|
+
--color-primary: {{ settings.color_primary | default: '#000000' }};
|
|
252
|
+
--color-primary-hover: {{ settings.color_primary_dark | default: '#333333' }};
|
|
253
|
+
--color-primary-light: {{ settings.color_primary_light | default: '#666666' }};
|
|
254
|
+
--color-success: {{ settings.color_success | default: '#22c55e' }};
|
|
255
|
+
--color-success-light: {{ settings.color_success | default: '#22c55e' }};
|
|
256
|
+
--color-success-dark: {{ settings.color_success | default: '#22c55e' }};
|
|
257
|
+
--color-warning: {{ settings.color_warning | default: '#f59e0b' }};
|
|
258
|
+
--color-warning-light: {{ settings.color_warning | default: '#f59e0b' }};
|
|
259
|
+
--color-warning-dark: {{ settings.color_warning | default: '#f59e0b' }};
|
|
260
|
+
--color-danger: {{ settings.color_error | default: '#ef4444' }};
|
|
261
|
+
--color-danger-light: {{ settings.color_error | default: '#ef4444' }};
|
|
262
|
+
--color-danger-dark: {{ settings.color_error | default: '#ef4444' }};
|
|
263
|
+
--color-info: {{ settings.color_info | default: '#3b82f6' }};
|
|
264
|
+
--color-info-light: {{ settings.color_info | default: '#3b82f6' }};
|
|
265
|
+
--color-info-dark: {{ settings.color_info | default: '#3b82f6' }};
|
|
266
|
+
--color-text: {{ settings.color_text | default: '#000000' }};
|
|
267
|
+
--color-text-light: {{ settings.color_text_light | default: '#999999' }};
|
|
268
|
+
--color-background: {{ settings.color_background | default: '#ffffff' }};
|
|
269
|
+
--color-card-bg: {{ settings.color_surface | default: '#f5f5f5' }};
|
|
270
|
+
--color-border: {{ settings.color_border | default: '#cccccc' }};
|
|
271
|
+
--color-white: #ffffff;
|
|
272
|
+
--shadow-sm: var(--shadow-sm);
|
|
273
|
+
--shadow-md: var(--shadow-md);
|
|
274
|
+
--shadow-lg: var(--shadow-lg);
|
|
275
|
+
--radius-md: var(--radius-lg);
|
|
276
|
+
--radius-lg: var(--radius-xl);
|
|
277
|
+
--spacing-sm: var(--space-4);
|
|
278
|
+
--spacing-md: var(--space-6);
|
|
279
|
+
--spacing-lg: var(--space-8);
|
|
280
|
+
--spacing-xl: var(--space-12);
|
|
127
281
|
}
|
|
128
282
|
|
|
129
283
|
.account-page {
|
|
@@ -223,7 +377,7 @@
|
|
|
223
377
|
align-items: center;
|
|
224
378
|
padding: 1.25rem 1.5rem;
|
|
225
379
|
border-radius: 12px;
|
|
226
|
-
border: 1px solid
|
|
380
|
+
border: 1px solid var(--color-border);
|
|
227
381
|
box-sizing: border-box;
|
|
228
382
|
}
|
|
229
383
|
|
|
@@ -252,10 +406,10 @@
|
|
|
252
406
|
}
|
|
253
407
|
|
|
254
408
|
.order-card-right {
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
409
|
+
display: flex;
|
|
410
|
+
flex-direction: row;
|
|
411
|
+
align-items: center;
|
|
412
|
+
gap: 1rem;
|
|
259
413
|
}
|
|
260
414
|
|
|
261
415
|
.order-total {
|