@zeyolabs/shopping 2026.11.38 → 2026.11.39
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/basket/pages/Basket.svelte +36 -33
- package/bundles/admin/BundleEditPage.svelte +7 -4
- package/bundles/admin/BundleForm.svelte +10 -7
- package/bundles/admin/BundlesPage.svelte +14 -10
- package/bundles/pages/Bundle.svelte +44 -41
- package/catalogue/admin/CategoriesPage.svelte +13 -10
- package/catalogue/admin/CategoryForm.svelte +4 -3
- package/catalogue/admin/ProductEditPage.svelte +7 -4
- package/catalogue/admin/ProductForm.svelte +31 -29
- package/catalogue/admin/ProductsPage.svelte +16 -14
- package/catalogue/components/ProductCard.svelte +22 -14
- package/catalogue/pages/Category.svelte +10 -7
- package/catalogue/pages/Product.svelte +37 -30
- package/catalogue/pages/Search.svelte +12 -7
- package/catalogue/pages/Shop.svelte +6 -3
- package/checkout/pages/CheckoutSuccess.svelte +10 -8
- package/customers/pages/Account.svelte +19 -15
- package/fulfilment/admin/OrderPage.svelte +60 -56
- package/fulfilment/admin/OrdersPage.svelte +26 -22
- package/orders/pages/Order.svelte +35 -29
- package/package.json +5 -4
- package/reviews/admin/ReviewsPage.svelte +23 -19
- package/reviews/components/ReviewForm.svelte +3 -2
- package/reviews/components/Reviews.svelte +17 -13
- package/stock/admin/StockPage.svelte +12 -9
- package/stock/admin/StockRow.svelte +3 -2
- package/ui/PageLinks.svelte +3 -3
- package/ui/PageTitle.svelte +2 -1
- package/ui/Stars.svelte +3 -1
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
3
|
|
|
4
|
-
import PageTitle from '../../ui/PageTitle.svelte';
|
|
5
|
-
import { getMyOrders } from '../client.remote';
|
|
6
|
-
import { Money } from '../../utils/money';
|
|
7
4
|
import Boundary from '@zeyolabs/ui/boundary/Boundary.svelte';
|
|
8
5
|
import SkeletonCard from '@zeyolabs/ui/skeleton/SkeletonCard.svelte';
|
|
6
|
+
import Span from '@zeyolabs/ui/text/Span.svelte';
|
|
7
|
+
import Text from '@zeyolabs/ui/text/Text.svelte';
|
|
8
|
+
import Title from '@zeyolabs/ui/text/Title.svelte';
|
|
9
|
+
|
|
10
|
+
import PageTitle from '../../ui/PageTitle.svelte';
|
|
11
|
+
import { Money } from '../../utils/money';
|
|
12
|
+
import { getMyOrders } from '../client.remote';
|
|
9
13
|
|
|
10
14
|
let {
|
|
11
15
|
children,
|
|
@@ -32,32 +36,32 @@
|
|
|
32
36
|
|
|
33
37
|
<Boundary message="Could not load your orders.">
|
|
34
38
|
{let data = $derived(await getMyOrders())}
|
|
35
|
-
<
|
|
39
|
+
<Text color="secondary">
|
|
36
40
|
Signed in as <strong class="text-[var(--tx)]">{data.email}</strong>
|
|
37
|
-
</
|
|
41
|
+
</Text>
|
|
38
42
|
|
|
39
|
-
<
|
|
43
|
+
<Title class="mt-8" level={2} size="sm">Orders</Title>
|
|
40
44
|
{#if data.orders.length === 0}
|
|
41
|
-
<
|
|
45
|
+
<Text class="mt-2" color="secondary">
|
|
42
46
|
No orders yet. Orders placed with this email address, signed in or not, show here.
|
|
43
|
-
</
|
|
47
|
+
</Text>
|
|
44
48
|
{:else}
|
|
45
49
|
<ul class="mt-2 divide-y divide-[var(--bd)] border-y border-[var(--bd)]">
|
|
46
50
|
{#each data.orders as order (order.number)}
|
|
47
51
|
<li class="flex flex-wrap items-center justify-between gap-2 py-3">
|
|
48
|
-
<
|
|
52
|
+
<Span>
|
|
49
53
|
{#if order.path}
|
|
50
54
|
<!-- eslint-disable-next-line svelte/no-navigation-without-resolve -- the order's private path -->
|
|
51
55
|
<a class="font-medium underline" href={order.path}>{order.number}</a>
|
|
52
56
|
{:else}
|
|
53
|
-
<
|
|
57
|
+
<Span bold>{order.number}</Span>
|
|
54
58
|
{/if}
|
|
55
|
-
<
|
|
56
|
-
</
|
|
57
|
-
<
|
|
58
|
-
<
|
|
59
|
+
<Span color="secondary">· {date.format(order.createdAt)}</Span>
|
|
60
|
+
</Span>
|
|
61
|
+
<Span>
|
|
62
|
+
<Span color="secondary">{STATUS[order.status] ?? order.status}</Span>
|
|
59
63
|
· {Money.format(order.totalPence)}
|
|
60
|
-
</
|
|
64
|
+
</Span>
|
|
61
65
|
</li>
|
|
62
66
|
{/each}
|
|
63
67
|
</ul>
|
|
@@ -1,7 +1,20 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { ErrorMessage } from '../../utils/errors';
|
|
3
2
|
import { resolve } from '$app/paths';
|
|
4
3
|
import { page } from '$app/state';
|
|
4
|
+
import Badge from '@zeyolabs/ui/badge/Badge.svelte';
|
|
5
|
+
import Boundary from '@zeyolabs/ui/boundary/Boundary.svelte';
|
|
6
|
+
import { CheckboxField, Form, NumberField, SelectField, TextField } from '@zeyolabs/ui/form';
|
|
7
|
+
import Button from '@zeyolabs/ui/form/Button.svelte';
|
|
8
|
+
import Span from '@zeyolabs/ui/text/Span.svelte';
|
|
9
|
+
import Text from '@zeyolabs/ui/text/Text.svelte';
|
|
10
|
+
import Title from '@zeyolabs/ui/text/Title.svelte';
|
|
11
|
+
import { toast } from 'svelte-sonner';
|
|
12
|
+
|
|
13
|
+
import { PACKAGE_FORMATS } from '../../db/schema';
|
|
14
|
+
import { Orders } from '../../orders/library';
|
|
15
|
+
import { ErrorMessage } from '../../utils/errors';
|
|
16
|
+
import { FormInput } from '../../utils/form-input';
|
|
17
|
+
import { Money } from '../../utils/money';
|
|
5
18
|
import {
|
|
6
19
|
createOrderLabel,
|
|
7
20
|
detailsForm,
|
|
@@ -12,6 +25,7 @@
|
|
|
12
25
|
shipForm,
|
|
13
26
|
updateOrderForm,
|
|
14
27
|
} from '../admin.remote';
|
|
28
|
+
import { Packing } from '../library';
|
|
15
29
|
import {
|
|
16
30
|
OrderDetailsSchema,
|
|
17
31
|
OrderStepSchema,
|
|
@@ -19,16 +33,6 @@
|
|
|
19
33
|
RefundSchema,
|
|
20
34
|
ShipSchema,
|
|
21
35
|
} from '../schema';
|
|
22
|
-
import { Money } from '../../utils/money';
|
|
23
|
-
import { FormInput } from '../../utils/form-input';
|
|
24
|
-
import { Orders } from '../../orders/library';
|
|
25
|
-
import { toast } from 'svelte-sonner';
|
|
26
|
-
import { PACKAGE_FORMATS } from '../../db/schema';
|
|
27
|
-
import { Packing } from '../library';
|
|
28
|
-
import Badge from '@zeyolabs/ui/badge/Badge.svelte';
|
|
29
|
-
import Boundary from '@zeyolabs/ui/boundary/Boundary.svelte';
|
|
30
|
-
import { CheckboxField, Form, NumberField, SelectField, TextField } from '@zeyolabs/ui/form';
|
|
31
|
-
import Button from '@zeyolabs/ui/form/Button.svelte';
|
|
32
36
|
|
|
33
37
|
const number = $derived(page.params.number ?? '');
|
|
34
38
|
|
|
@@ -56,12 +60,12 @@
|
|
|
56
60
|
|
|
57
61
|
<svelte:head><title>{number} · Admin</title></svelte:head>
|
|
58
62
|
|
|
59
|
-
<
|
|
63
|
+
<Text><a href={resolve('/orders')}>← Orders</a></Text>
|
|
60
64
|
|
|
61
65
|
<Boundary message="Could not load this order." statusMessages={{ 404: 'Order not found.' }}>
|
|
62
66
|
{let order = $derived(await getOrder(number))}
|
|
63
67
|
<div class="mt-4 flex flex-wrap items-center gap-3">
|
|
64
|
-
<
|
|
68
|
+
<Title level={1} size="md">{order.number}</Title>
|
|
65
69
|
<Badge
|
|
66
70
|
color={order.status === 'paid'
|
|
67
71
|
? 'warning'
|
|
@@ -72,15 +76,15 @@
|
|
|
72
76
|
{order.status === 'paid' ? 'To ship' : order.status}
|
|
73
77
|
</Badge>
|
|
74
78
|
</div>
|
|
75
|
-
<
|
|
79
|
+
<Text class="mt-1" color="secondary">
|
|
76
80
|
Placed {date.format(order.createdAt)}{order.paidAt
|
|
77
81
|
? ` · paid ${date.format(order.paidAt)}`
|
|
78
82
|
: ''}
|
|
79
|
-
</
|
|
83
|
+
</Text>
|
|
80
84
|
|
|
81
85
|
<div class="mt-6 grid gap-6 md:grid-cols-2">
|
|
82
|
-
<section class="rounded-xl border border-[var(--
|
|
83
|
-
<
|
|
86
|
+
<section class="rounded-xl border border-[var(--bd)] bg-white p-5">
|
|
87
|
+
<Title level={2} size="sm">Ship to</Title>
|
|
84
88
|
<address class="mt-2 not-italic select-all">
|
|
85
89
|
{order.address.name}<br />
|
|
86
90
|
{order.address.line1}<br />
|
|
@@ -89,24 +93,24 @@
|
|
|
89
93
|
{order.address.postcode}<br />
|
|
90
94
|
{order.address.country}
|
|
91
95
|
</address>
|
|
92
|
-
<
|
|
96
|
+
<Text class="mt-3">
|
|
93
97
|
<a href="mailto:{order.email}">{order.email}</a>{order.address.phone
|
|
94
98
|
? ` · ${order.address.phone}`
|
|
95
99
|
: ''}
|
|
96
|
-
</
|
|
97
|
-
<
|
|
100
|
+
</Text>
|
|
101
|
+
<Text class="mt-3" color="secondary">
|
|
98
102
|
Service: {order.shippingService ?? 'n/a'}
|
|
99
103
|
{#if order.royalMailOrderId}· Click & Drop order {order.royalMailOrderId}{/if}
|
|
100
|
-
</
|
|
104
|
+
</Text>
|
|
101
105
|
</section>
|
|
102
106
|
|
|
103
|
-
<section class="rounded-xl border border-[var(--
|
|
104
|
-
<
|
|
105
|
-
<ul class="mt-2 divide-y divide-[var(--
|
|
107
|
+
<section class="rounded-xl border border-[var(--bd)] bg-white p-5">
|
|
108
|
+
<Title level={2} size="sm">Items</Title>
|
|
109
|
+
<ul class="mt-2 divide-y divide-[var(--bd)]">
|
|
106
110
|
{#each order.items as item (item.id)}
|
|
107
111
|
<li class="flex justify-between gap-4 py-2">
|
|
108
|
-
<
|
|
109
|
-
<
|
|
112
|
+
<Span>{item.name} <Span color="secondary">× {item.quantity}</Span></Span>
|
|
113
|
+
<Span>{Money.format(item.quantity * item.unitPricePence)}</Span>
|
|
110
114
|
</li>
|
|
111
115
|
{/each}
|
|
112
116
|
</ul>
|
|
@@ -141,17 +145,17 @@
|
|
|
141
145
|
|
|
142
146
|
{#if order.status === 'paid'}
|
|
143
147
|
{let stage = $derived(Packing.stage(order))}
|
|
144
|
-
<section class="mt-6 max-w-xl rounded-xl border border-[var(--
|
|
148
|
+
<section class="mt-6 max-w-xl rounded-xl border border-[var(--bd)] bg-white p-5">
|
|
145
149
|
<div class="flex flex-wrap items-center gap-3">
|
|
146
|
-
<
|
|
150
|
+
<Title level={2} size="sm">Packing</Title>
|
|
147
151
|
<Badge color={Packing.STAGE_COLORS[stage]}>{Packing.STAGE_LABELS[stage]}</Badge>
|
|
148
152
|
</div>
|
|
149
|
-
<
|
|
153
|
+
<Text class="mt-1" color="secondary">
|
|
150
154
|
{#if order.heldAt}On hold since {date.format(order.heldAt)}.{/if}
|
|
151
155
|
{#if order.packingStartedAt}Packing started {date.format(order.packingStartedAt)}.{/if}
|
|
152
156
|
{#if order.packedAt}Packed {date.format(order.packedAt)}.{/if}
|
|
153
157
|
{#if order.labelCreatedAt}Label created {date.format(order.labelCreatedAt)}.{/if}
|
|
154
|
-
</
|
|
158
|
+
</Text>
|
|
155
159
|
<Form
|
|
156
160
|
class="mt-4 flex flex-wrap gap-2"
|
|
157
161
|
form={updateOrderForm}
|
|
@@ -194,18 +198,18 @@
|
|
|
194
198
|
{/if}
|
|
195
199
|
</Form>
|
|
196
200
|
|
|
197
|
-
<
|
|
201
|
+
<Text class="mt-3" color="secondary">
|
|
198
202
|
Printing the label sends the saved parcel details to Royal Mail and marks the order packed.
|
|
199
203
|
{#if order.labelCreatedAt}A label is already made, so later parcel changes will not change
|
|
200
204
|
it.{/if}
|
|
201
|
-
</
|
|
205
|
+
</Text>
|
|
202
206
|
|
|
203
|
-
<
|
|
204
|
-
<
|
|
207
|
+
<Title class="mt-6" level={3} size="sm">Parcel</Title>
|
|
208
|
+
<Text class="mt-1" color="secondary">
|
|
205
209
|
{order.weightGrams === null
|
|
206
210
|
? `Estimated ${order.estimatedWeightGrams} g from the items. Weigh the parcel and correct it.`
|
|
207
211
|
: 'Weight and size go on the Royal Mail label.'}
|
|
208
|
-
</
|
|
212
|
+
</Text>
|
|
209
213
|
<Form
|
|
210
214
|
class="mt-3 grid gap-4"
|
|
211
215
|
defaults={{
|
|
@@ -248,14 +252,14 @@
|
|
|
248
252
|
|
|
249
253
|
{#if order.status === 'paid' || order.status === 'shipped'}
|
|
250
254
|
{let services = $derived(await getShippingServices())}
|
|
251
|
-
<section class="mt-6 max-w-xl rounded-xl border border-[var(--
|
|
255
|
+
<section class="mt-6 max-w-xl rounded-xl border border-[var(--bd)] bg-white p-5">
|
|
252
256
|
<details>
|
|
253
257
|
<summary class="cursor-pointer font-semibold">Edit contact, address and postage</summary>
|
|
254
|
-
<
|
|
258
|
+
<Text class="mt-2" color="secondary">
|
|
255
259
|
For fixing a typo or a customer's request. If you change the country, check the postage
|
|
256
260
|
service still fits. {#if order.status === 'paid' && order.labelCreatedAt}The label is
|
|
257
261
|
already made, so after a change you need to print it again.{/if}
|
|
258
|
-
</
|
|
262
|
+
</Text>
|
|
259
263
|
<Form
|
|
260
264
|
class="mt-4 grid gap-4"
|
|
261
265
|
defaults={{
|
|
@@ -312,13 +316,13 @@
|
|
|
312
316
|
|
|
313
317
|
{#if (order.status === 'paid' || order.status === 'shipped') && order.stripePaymentIntentId && order.refundedPence < order.totalPence}
|
|
314
318
|
{let left = $derived(order.totalPence - order.refundedPence)}
|
|
315
|
-
<section class="mt-6 max-w-xl rounded-xl border border-[var(--
|
|
316
|
-
<
|
|
317
|
-
<
|
|
319
|
+
<section class="mt-6 max-w-xl rounded-xl border border-[var(--bd)] bg-white p-5">
|
|
320
|
+
<Title level={2} size="sm">Refund</Title>
|
|
321
|
+
<Text class="mt-1" color="secondary">
|
|
318
322
|
Up to {Money.format(left)} can be refunded to the customer's card through Stripe. A full refund
|
|
319
323
|
marks the order refunded, even if it had shipped, and does not cancel a Royal Mail label. Stock
|
|
320
324
|
is not put back; do that on the stock page if the goods come back.
|
|
321
|
-
</
|
|
325
|
+
</Text>
|
|
322
326
|
<Form
|
|
323
327
|
class="mt-4 grid gap-4"
|
|
324
328
|
defaults={{ amount: FormInput.penceToPounds(left) }}
|
|
@@ -333,23 +337,23 @@
|
|
|
333
337
|
</section>
|
|
334
338
|
{/if}
|
|
335
339
|
|
|
336
|
-
<section class="mt-6 max-w-xl rounded-xl border border-[var(--
|
|
337
|
-
<
|
|
340
|
+
<section class="mt-6 max-w-xl rounded-xl border border-[var(--bd)] bg-white p-5">
|
|
341
|
+
<Title level={2} size="sm">Dispatch</Title>
|
|
338
342
|
{#if order.status === 'paid' || order.status === 'shipped'}
|
|
339
343
|
{#if order.shippedAt}
|
|
340
|
-
<
|
|
344
|
+
<Text class="mt-1" color="secondary">
|
|
341
345
|
Dispatched {date.format(order.shippedAt)}.
|
|
342
346
|
{#if order.dispatchEmailedAt}
|
|
343
347
|
Customer emailed {date.format(order.dispatchEmailedAt)}.
|
|
344
348
|
{:else}
|
|
345
349
|
The customer has <strong>not</strong> been emailed.
|
|
346
350
|
{/if}
|
|
347
|
-
</
|
|
351
|
+
</Text>
|
|
348
352
|
{:else}
|
|
349
|
-
<
|
|
353
|
+
<Text class="mt-1" color="secondary">
|
|
350
354
|
Enter the Royal Mail tracking number (leave blank if untracked), then mark it dispatched.
|
|
351
355
|
The customer is emailed straight away and their order page updates.
|
|
352
|
-
</
|
|
356
|
+
</Text>
|
|
353
357
|
{/if}
|
|
354
358
|
<Form
|
|
355
359
|
class="mt-4 grid gap-4"
|
|
@@ -370,31 +374,31 @@
|
|
|
370
374
|
</div>
|
|
371
375
|
</Form>
|
|
372
376
|
{:else}
|
|
373
|
-
<
|
|
377
|
+
<Text class="mt-1">This order is {order.status}, so it cannot be dispatched.</Text>
|
|
374
378
|
{/if}
|
|
375
379
|
|
|
376
380
|
{#if order.trackingNumber}
|
|
377
|
-
<
|
|
381
|
+
<Text class="mt-4">
|
|
378
382
|
<!-- eslint-disable-next-line svelte/no-navigation-without-resolve -- external Royal Mail URL -->
|
|
379
383
|
<a href={Orders.trackingUrl(order.trackingNumber)} rel="noopener" target="_blank"
|
|
380
384
|
>Track {order.trackingNumber} on Royal Mail</a
|
|
381
385
|
>
|
|
382
|
-
</
|
|
386
|
+
</Text>
|
|
383
387
|
{/if}
|
|
384
388
|
{#if order.stripeInvoiceId}
|
|
385
|
-
<
|
|
389
|
+
<Text class="mt-2">
|
|
386
390
|
<!-- eslint-disable-next-line svelte/no-navigation-without-resolve -- server route, opens Stripe's PDF -->
|
|
387
391
|
<a href="/orders/{order.number}/invoice" rel="external" target="_blank">Invoice (PDF)</a>
|
|
388
|
-
</
|
|
392
|
+
</Text>
|
|
389
393
|
{/if}
|
|
390
394
|
{#if order.customerUrl}
|
|
391
|
-
<
|
|
395
|
+
<Text class="mt-2">
|
|
392
396
|
<!-- eslint-disable-next-line svelte/no-navigation-without-resolve -- absolute URL on the shop domain -->
|
|
393
397
|
<a href={order.customerUrl} rel="noopener" target="_blank">Customer's order page</a>
|
|
394
|
-
</
|
|
398
|
+
</Text>
|
|
395
399
|
{/if}
|
|
396
400
|
</section>
|
|
397
401
|
{#snippet pending()}
|
|
398
|
-
<
|
|
402
|
+
<Text class="mt-6" color="secondary">Loading…</Text>
|
|
399
403
|
{/snippet}
|
|
400
404
|
</Boundary>
|
|
@@ -2,16 +2,20 @@
|
|
|
2
2
|
import { goto } from '$app/navigation';
|
|
3
3
|
import { resolve } from '$app/paths';
|
|
4
4
|
import { page } from '$app/state';
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import { ErrorMessage } from '../../utils/errors';
|
|
8
|
-
import { toast } from 'svelte-sonner';
|
|
5
|
+
import Badge from '@zeyolabs/ui/badge/Badge.svelte';
|
|
6
|
+
import Boundary from '@zeyolabs/ui/boundary/Boundary.svelte';
|
|
9
7
|
import Button from '@zeyolabs/ui/form/Button.svelte';
|
|
10
|
-
import
|
|
8
|
+
import Span from '@zeyolabs/ui/text/Span.svelte';
|
|
9
|
+
import Text from '@zeyolabs/ui/text/Text.svelte';
|
|
10
|
+
import Title from '@zeyolabs/ui/text/Title.svelte';
|
|
11
|
+
import { toast } from 'svelte-sonner';
|
|
11
12
|
import { SvelteSet, SvelteURLSearchParams } from 'svelte/reactivity';
|
|
13
|
+
|
|
14
|
+
import { ErrorMessage } from '../../utils/errors';
|
|
15
|
+
import { Money } from '../../utils/money';
|
|
16
|
+
import { dispatchOrders, getOrderCounts, getOrders, getReadyByService } from '../admin.remote';
|
|
17
|
+
import { BULK_DISPATCH_LIMIT, FILTER_LABELS, ORDER_FILTERS, type OrderFilter } from '../filters';
|
|
12
18
|
import { Packing } from '../library';
|
|
13
|
-
import Badge from '@zeyolabs/ui/badge/Badge.svelte';
|
|
14
|
-
import Boundary from '@zeyolabs/ui/boundary/Boundary.svelte';
|
|
15
19
|
|
|
16
20
|
const filter = $derived.by((): OrderFilter => {
|
|
17
21
|
const value = page.url.searchParams.get('filter');
|
|
@@ -80,15 +84,15 @@
|
|
|
80
84
|
|
|
81
85
|
<svelte:head><title>Orders · Admin</title></svelte:head>
|
|
82
86
|
|
|
83
|
-
<
|
|
87
|
+
<Title level={1} size="md">Orders</Title>
|
|
84
88
|
|
|
85
89
|
<nav class="mt-4 flex flex-wrap items-center gap-2" aria-label="Order filter">
|
|
86
90
|
{#each ORDER_FILTERS as f (f)}
|
|
87
91
|
<!-- eslint-disable svelte/no-navigation-without-resolve -- href() resolves the path -->
|
|
88
92
|
<a
|
|
89
93
|
class="rounded-full border px-3 py-1 text-sm no-underline {f === filter
|
|
90
|
-
? 'border-[var(--
|
|
91
|
-
: 'border-[var(--
|
|
94
|
+
? 'border-[var(--acc)] bg-[var(--acc)] text-white'
|
|
95
|
+
: 'border-[var(--bd)] bg-white text-[var(--tx)]'}"
|
|
92
96
|
aria-current={f === filter ? 'page' : undefined}
|
|
93
97
|
href={href({ filter: f })}
|
|
94
98
|
>
|
|
@@ -99,8 +103,10 @@
|
|
|
99
103
|
{/each}
|
|
100
104
|
<Boundary message="Could not load ready counts.">
|
|
101
105
|
{#each Object.entries(await getReadyByService()) as [service, n] (service)}
|
|
102
|
-
<
|
|
106
|
+
<Span color="secondary">{service}: {n} ready</Span>
|
|
103
107
|
{/each}
|
|
108
|
+
|
|
109
|
+
{#snippet pending()}{/snippet}
|
|
104
110
|
</Boundary>
|
|
105
111
|
<form
|
|
106
112
|
class="ml-auto"
|
|
@@ -113,7 +119,7 @@
|
|
|
113
119
|
>
|
|
114
120
|
<input
|
|
115
121
|
name="q"
|
|
116
|
-
class="w-56 rounded-md border border-[var(--
|
|
122
|
+
class="w-56 rounded-md border border-[var(--bd)] px-3 py-1.5 text-sm"
|
|
117
123
|
placeholder="Order, email or name"
|
|
118
124
|
type="search"
|
|
119
125
|
value={q}
|
|
@@ -126,9 +132,9 @@
|
|
|
126
132
|
<!-- Only orders still on screen: a search or tab change must not dispatch hidden ticks. -->
|
|
127
133
|
{let chosen = $derived(rows.map((r) => r.number).filter((n) => selected.has(n)))}
|
|
128
134
|
{#if rows.length === 0}
|
|
129
|
-
<
|
|
135
|
+
<Text class="mt-6" color="secondary">
|
|
130
136
|
{filter === 'to-ship' && !q ? 'Nothing to ship. All caught up.' : 'No orders match.'}
|
|
131
|
-
</
|
|
137
|
+
</Text>
|
|
132
138
|
{:else}
|
|
133
139
|
{#if filter === 'ready'}
|
|
134
140
|
<div class="mt-4 flex flex-wrap items-center gap-4 text-sm">
|
|
@@ -146,7 +152,7 @@
|
|
|
146
152
|
Select {Math.min(rows.length, BULK_DISPATCH_LIMIT)}
|
|
147
153
|
</label>
|
|
148
154
|
<label class="flex items-center gap-2">
|
|
149
|
-
<input bind:checked={sendEmail}
|
|
155
|
+
<input type="checkbox" bind:checked={sendEmail} />
|
|
150
156
|
Email the customers
|
|
151
157
|
</label>
|
|
152
158
|
<Button
|
|
@@ -157,9 +163,9 @@
|
|
|
157
163
|
</Button>
|
|
158
164
|
</div>
|
|
159
165
|
{/if}
|
|
160
|
-
<div class="mt-4 overflow-x-auto rounded-xl border border-[var(--
|
|
166
|
+
<div class="mt-4 overflow-x-auto rounded-xl border border-[var(--bd)] bg-white">
|
|
161
167
|
<table class="w-full text-left text-sm">
|
|
162
|
-
<thead class="border-b border-[var(--
|
|
168
|
+
<thead class="border-b border-[var(--bd)] text-[var(--txs)]">
|
|
163
169
|
<tr>
|
|
164
170
|
{#if filter === 'ready'}<th class="w-8 px-4 py-2"></th>{/if}
|
|
165
171
|
<th class="px-4 py-2 font-medium">Order</th>
|
|
@@ -169,7 +175,7 @@
|
|
|
169
175
|
<th class="px-4 py-2 font-medium">Status</th>
|
|
170
176
|
</tr>
|
|
171
177
|
</thead>
|
|
172
|
-
<tbody class="divide-y divide-[var(--
|
|
178
|
+
<tbody class="divide-y divide-[var(--bd)]">
|
|
173
179
|
{#each rows as row (row.number)}
|
|
174
180
|
<tr>
|
|
175
181
|
{#if filter === 'ready'}
|
|
@@ -192,9 +198,7 @@
|
|
|
192
198
|
<td class="px-4 py-2 whitespace-nowrap">{date.format(row.createdAt)}</td>
|
|
193
199
|
<td class="px-4 py-2">
|
|
194
200
|
{row.name}
|
|
195
|
-
<
|
|
196
|
-
>{row.email} · {row.country}</span
|
|
197
|
-
>
|
|
201
|
+
<Span class="block" color="secondary" size="sm">{row.email} · {row.country}</Span>
|
|
198
202
|
</td>
|
|
199
203
|
<td class="px-4 py-2 text-right whitespace-nowrap">{Money.format(row.totalPence)}</td>
|
|
200
204
|
<td class="px-4 py-2">
|
|
@@ -212,6 +216,6 @@
|
|
|
212
216
|
</div>
|
|
213
217
|
{/if}
|
|
214
218
|
{#snippet pending()}
|
|
215
|
-
<
|
|
219
|
+
<Text class="mt-6" color="secondary">Loading…</Text>
|
|
216
220
|
{/snippet}
|
|
217
221
|
</Boundary>
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { page } from '$app/state';
|
|
3
|
-
import
|
|
4
|
-
import
|
|
3
|
+
import Boundary from '@zeyolabs/ui/boundary/Boundary.svelte';
|
|
4
|
+
import SkeletonCard from '@zeyolabs/ui/skeleton/SkeletonCard.svelte';
|
|
5
|
+
import Span from '@zeyolabs/ui/text/Span.svelte';
|
|
6
|
+
import Text from '@zeyolabs/ui/text/Text.svelte';
|
|
7
|
+
import Title from '@zeyolabs/ui/text/Title.svelte';
|
|
8
|
+
|
|
9
|
+
import { shopContext } from '../../context';
|
|
5
10
|
import { getOrderReviews } from '../../reviews/client.remote';
|
|
6
11
|
import ReviewForm from '../../reviews/components/ReviewForm.svelte';
|
|
7
|
-
import
|
|
12
|
+
import PageTitle from '../../ui/PageTitle.svelte';
|
|
8
13
|
import { Money } from '../../utils/money';
|
|
14
|
+
import { getOrderPage } from '../client.remote';
|
|
9
15
|
import { Orders } from '../library';
|
|
10
|
-
import Boundary from '@zeyolabs/ui/boundary/Boundary.svelte';
|
|
11
|
-
import SkeletonCard from '@zeyolabs/ui/skeleton/SkeletonCard.svelte';
|
|
12
16
|
|
|
13
17
|
const context = shopContext();
|
|
14
18
|
const date = new Intl.DateTimeFormat('en-GB', { dateStyle: 'long', timeZone: 'Europe/London' });
|
|
@@ -32,54 +36,56 @@
|
|
|
32
36
|
{ done: order.shippedAt !== null, label: 'Dispatched', when: order.shippedAt },
|
|
33
37
|
])}
|
|
34
38
|
|
|
35
|
-
<
|
|
39
|
+
<Text color="secondary">Order <strong class="text-[var(--tx)]">{order.number}</strong></Text>
|
|
36
40
|
|
|
37
41
|
{#if cancelled}
|
|
38
|
-
<
|
|
42
|
+
<Text class="mt-4 rounded-2xl border border-[var(--bd)] p-4">
|
|
39
43
|
This order was {order.status}. Email
|
|
40
44
|
<a class="underline" href="mailto:{context.supportEmail}">{context.supportEmail}</a> if you have
|
|
41
45
|
any questions.
|
|
42
|
-
</
|
|
46
|
+
</Text>
|
|
43
47
|
{:else}
|
|
44
48
|
<ol class="mt-6 space-y-3">
|
|
45
49
|
{#each steps as step (step.label)}
|
|
46
50
|
<li class="flex items-center gap-3">
|
|
47
|
-
<
|
|
51
|
+
<div
|
|
48
52
|
class="grid size-6 place-items-center rounded-full text-xs {step.done
|
|
49
53
|
? 'bg-[var(--primary-strong)] text-white'
|
|
50
54
|
: 'border border-[var(--bd)] text-[var(--txs)]'}"
|
|
51
|
-
aria-hidden="true"
|
|
55
|
+
aria-hidden="true"
|
|
52
56
|
>
|
|
53
|
-
|
|
57
|
+
{step.done ? '✓' : ''}
|
|
58
|
+
</div>
|
|
59
|
+
<Span bold={step.done} color={step.done ? undefined : 'secondary'}>
|
|
54
60
|
{step.label}{step.done && step.when ? `: ${date.format(step.when)}` : ''}
|
|
55
|
-
</
|
|
61
|
+
</Span>
|
|
56
62
|
</li>
|
|
57
63
|
{/each}
|
|
58
64
|
</ol>
|
|
59
65
|
|
|
60
66
|
{#if order.shippedAt && tracking}
|
|
61
|
-
<
|
|
67
|
+
<Text class="mt-4">
|
|
62
68
|
Tracking number:
|
|
63
69
|
<!-- eslint-disable-next-line svelte/no-navigation-without-resolve -- external Royal Mail URL -->
|
|
64
70
|
<a class="underline" href={tracking} rel="noopener" target="_blank"
|
|
65
71
|
>{order.trackingNumber}</a
|
|
66
72
|
>
|
|
67
|
-
</
|
|
73
|
+
</Text>
|
|
68
74
|
{:else if order.shippedAt}
|
|
69
|
-
<
|
|
75
|
+
<Text class="mt-4" color="secondary">This parcel is sent untracked.</Text>
|
|
70
76
|
{:else}
|
|
71
|
-
<
|
|
77
|
+
<Text class="mt-4" color="secondary">
|
|
72
78
|
We will dispatch your order soon. This page updates as soon as it is on its way.
|
|
73
|
-
</
|
|
79
|
+
</Text>
|
|
74
80
|
{/if}
|
|
75
81
|
{/if}
|
|
76
82
|
|
|
77
|
-
<
|
|
83
|
+
<Title class="mt-8" level={2} size="sm">Items</Title>
|
|
78
84
|
<ul class="mt-2 divide-y divide-[var(--bd)] border-y border-[var(--bd)]">
|
|
79
85
|
{#each data.items as item (item.name)}
|
|
80
86
|
<li class="flex justify-between gap-4 py-3">
|
|
81
|
-
<
|
|
82
|
-
<
|
|
87
|
+
<Span>{item.name} <Span color="secondary">× {item.quantity}</Span></Span>
|
|
88
|
+
<Span>{Money.format(item.quantity * item.unitPricePence)}</Span>
|
|
83
89
|
</li>
|
|
84
90
|
{/each}
|
|
85
91
|
</ul>
|
|
@@ -106,15 +112,15 @@
|
|
|
106
112
|
</dl>
|
|
107
113
|
|
|
108
114
|
{#if order.hasInvoice}
|
|
109
|
-
<
|
|
115
|
+
<Text class="mt-3 text-right">
|
|
110
116
|
<!-- eslint-disable-next-line svelte/no-navigation-without-resolve -- server route, opens Stripe's PDF -->
|
|
111
117
|
<a class="underline" href="{page.url.pathname}/invoice" rel="external"
|
|
112
118
|
>Download invoice (PDF)</a
|
|
113
119
|
>
|
|
114
|
-
</
|
|
120
|
+
</Text>
|
|
115
121
|
{/if}
|
|
116
122
|
|
|
117
|
-
<
|
|
123
|
+
<Title class="mt-8" level={2} size="sm">Delivering to</Title>
|
|
118
124
|
<address class="mt-2 not-italic">
|
|
119
125
|
{data.address.name}<br />
|
|
120
126
|
{data.address.line1}<br />
|
|
@@ -128,20 +134,20 @@
|
|
|
128
134
|
await getOrderReviews({ number: order.number, token: page.params.token ?? '' })
|
|
129
135
|
)}
|
|
130
136
|
{#if reviewable.items.length > 0}
|
|
131
|
-
<
|
|
137
|
+
<Title class="mt-8" level={2} size="sm">Review your items</Title>
|
|
132
138
|
<ul class="mt-2 space-y-6">
|
|
133
139
|
{#each reviewable.items as item (item.productId)}
|
|
134
140
|
<li class="rounded-2xl border border-[var(--bd)] p-4">
|
|
135
|
-
<
|
|
141
|
+
<Text bold>{item.name}</Text>
|
|
136
142
|
{#if item.review}
|
|
137
|
-
<
|
|
143
|
+
<Text class="mt-1" color="secondary">
|
|
138
144
|
Reviewed, {item.review.rating} of 5.
|
|
139
145
|
{item.review.status === 'pending'
|
|
140
146
|
? 'It will appear once we have checked it.'
|
|
141
147
|
: item.review.status === 'approved'
|
|
142
148
|
? 'It is on the product page.'
|
|
143
149
|
: ''}
|
|
144
|
-
</
|
|
150
|
+
</Text>
|
|
145
151
|
{:else}
|
|
146
152
|
<ReviewForm
|
|
147
153
|
name={item.name}
|
|
@@ -155,11 +161,11 @@
|
|
|
155
161
|
</ul>
|
|
156
162
|
{/if}
|
|
157
163
|
|
|
158
|
-
<
|
|
164
|
+
<Text class="mt-8" color="secondary">
|
|
159
165
|
Need help? Email <a class="underline" href="mailto:{context.supportEmail}"
|
|
160
166
|
>{context.supportEmail}</a
|
|
161
167
|
>, quoting {order.number}.
|
|
162
|
-
</
|
|
168
|
+
</Text>
|
|
163
169
|
|
|
164
170
|
{#snippet pending()}
|
|
165
171
|
<SkeletonCard lines={4} />
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeyolabs/shopping",
|
|
3
|
-
"version": "2026.11.
|
|
3
|
+
"version": "2026.11.39",
|
|
4
4
|
"description": "Shop and order fulfilment for SvelteKit 3 on Cloudflare: catalogue, basket, Stripe Checkout, orders, Royal Mail Click & Drop, order emails, packing, pages and admin.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"lint": "eslint . --cache --cache-location .cache/.eslintcache --cache-strategy content",
|
|
43
43
|
"test": "vitest run",
|
|
44
44
|
"fmt": "prettier --write .",
|
|
45
|
-
"check": "prettier --check . && pnpm lint && pnpm test"
|
|
45
|
+
"check": "prettier --check . && pnpm lint && svelte-check --tsconfig ./tsconfig.json && pnpm test"
|
|
46
46
|
},
|
|
47
47
|
"exports": {
|
|
48
48
|
"./*.svelte": "./*.svelte",
|
|
@@ -67,8 +67,8 @@
|
|
|
67
67
|
"@eslint/compat": "2.1.1",
|
|
68
68
|
"@eslint/js": "10.0.1",
|
|
69
69
|
"@sveltejs/kit": "3.2.0",
|
|
70
|
-
"@zeyolabs/kit": "2026.11.
|
|
71
|
-
"@zeyolabs/ui": "2026.11.
|
|
70
|
+
"@zeyolabs/kit": "2026.11.36",
|
|
71
|
+
"@zeyolabs/ui": "2026.11.32",
|
|
72
72
|
"drizzle-orm": "0.45.4",
|
|
73
73
|
"eslint": "10.15.0",
|
|
74
74
|
"eslint-config-prettier": "10.1.8",
|
|
@@ -80,6 +80,7 @@
|
|
|
80
80
|
"prettier": "3.10.1",
|
|
81
81
|
"prettier-plugin-svelte": "4.1.1",
|
|
82
82
|
"svelte": "5.57.3",
|
|
83
|
+
"svelte-check": "4.7.8",
|
|
83
84
|
"svelte-eslint-parser": "1.10.1",
|
|
84
85
|
"typescript": "6.0.3",
|
|
85
86
|
"typescript-eslint": "8.72.2",
|