@zeyolabs/shopping 2026.11.40 → 2026.11.41
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 +101 -90
- package/bundles/admin/BundleForm.svelte +53 -30
- package/bundles/admin/BundlesPage.svelte +10 -10
- package/bundles/pages/Bundle.svelte +77 -72
- package/catalogue/admin/CategoriesPage.svelte +13 -7
- package/catalogue/admin/CategoryForm.svelte +3 -2
- package/catalogue/admin/ProductForm.svelte +66 -55
- package/catalogue/admin/ProductsPage.svelte +28 -26
- package/catalogue/admin.remote.ts +5 -2
- package/catalogue/admin.service.server.ts +6 -2
- package/catalogue/components/ProductCard.svelte +4 -4
- package/catalogue/pages/Product.svelte +46 -45
- package/catalogue/pages/Search.svelte +20 -16
- package/catalogue/pages/Shop.svelte +9 -8
- package/customers/pages/Account.svelte +17 -14
- package/fulfilment/admin/OrderPage.svelte +65 -55
- package/fulfilment/admin/OrdersPage.svelte +69 -58
- package/orders/pages/Order.svelte +23 -18
- package/package.json +3 -3
- package/reviews/admin/ReviewsPage.svelte +30 -26
- package/reviews/components/Reviews.svelte +7 -6
- package/stock/admin/StockPage.svelte +12 -9
- package/stock/admin/StockRow.svelte +9 -13
- package/ui/PageLinks.svelte +28 -22
- package/ui/Stars.svelte +12 -10
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
import { Form } from '@zeyolabs/ui/form';
|
|
8
8
|
import Button from '@zeyolabs/ui/form/Button.svelte';
|
|
9
9
|
import { Select } from '@zeyolabs/ui/form/primitives';
|
|
10
|
+
import Cluster from '@zeyolabs/ui/layout/Cluster.svelte';
|
|
11
|
+
import Stack from '@zeyolabs/ui/layout/Stack.svelte';
|
|
10
12
|
import SkeletonCard from '@zeyolabs/ui/skeleton/SkeletonCard.svelte';
|
|
11
13
|
import Span from '@zeyolabs/ui/text/Span.svelte';
|
|
12
14
|
import Text from '@zeyolabs/ui/text/Text.svelte';
|
|
@@ -55,105 +57,114 @@
|
|
|
55
57
|
{:else}
|
|
56
58
|
<ul class="divide-y divide-[var(--bd)]">
|
|
57
59
|
{#each summary.lines as line (line.id)}
|
|
58
|
-
<li class="
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
<div class="min-w-0 flex-1">
|
|
67
|
-
<a class="font-medium" href={resolve('/product/[slug]', { slug: line.slug })}>
|
|
68
|
-
{line.name}
|
|
69
|
-
</a>
|
|
70
|
-
<Text>{Money.format(line.pricePence)}</Text>
|
|
71
|
-
{#if line.available < line.quantity}
|
|
72
|
-
<Text class="text-[var(--danger)]">
|
|
73
|
-
{line.available === 0 ? 'Out of stock' : `Only ${line.available} available`}
|
|
74
|
-
</Text>
|
|
60
|
+
<li class="py-4">
|
|
61
|
+
<Cluster gap="md">
|
|
62
|
+
{#if line.cover}
|
|
63
|
+
<img
|
|
64
|
+
class="size-20 object-cover"
|
|
65
|
+
alt={line.cover.alt || line.name}
|
|
66
|
+
src={Images.url(context.imageBaseUrl, line.cover.src)}
|
|
67
|
+
/>
|
|
75
68
|
{/if}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
69
|
+
<div class="min-w-0 flex-1">
|
|
70
|
+
<a href={resolve('/product/[slug]', { slug: line.slug })}>
|
|
71
|
+
<Span bold>{line.name}</Span>
|
|
72
|
+
</a>
|
|
73
|
+
<Text>{Money.format(line.pricePence)}</Text>
|
|
74
|
+
{#if line.available < line.quantity}
|
|
75
|
+
<Text color="error">
|
|
76
|
+
{line.available === 0 ? 'Out of stock' : `Only ${line.available} available`}
|
|
77
|
+
</Text>
|
|
78
|
+
{/if}
|
|
79
|
+
</div>
|
|
80
|
+
{const form = basketQuantityForm.for(line.id)}
|
|
81
|
+
<Form
|
|
88
82
|
{form}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
83
|
+
hidden={{ productId: line.id }}
|
|
84
|
+
reset={false}
|
|
85
|
+
schema={BasketQuantitySchema}
|
|
92
86
|
>
|
|
93
|
-
<
|
|
94
|
-
|
|
95
|
-
|
|
87
|
+
<Cluster gap="xs" nowrap>
|
|
88
|
+
<Button
|
|
89
|
+
{...form.fields.quantity.as('submit', line.quantity - 1)}
|
|
90
|
+
aria-label="Decrease quantity of {line.name}"
|
|
91
|
+
{form}
|
|
92
|
+
icon
|
|
93
|
+
size="sm"
|
|
94
|
+
variant="secondary"
|
|
95
|
+
>
|
|
96
|
+
<Minus size={14} />
|
|
97
|
+
</Button>
|
|
98
|
+
<Span class="w-6" centered>{line.quantity}</Span>
|
|
99
|
+
<Button
|
|
100
|
+
{...form.fields.quantity.as('submit', line.quantity + 1)}
|
|
101
|
+
aria-label="Increase quantity of {line.name}"
|
|
102
|
+
disabled={line.quantity >= line.limit}
|
|
103
|
+
{form}
|
|
104
|
+
icon
|
|
105
|
+
size="sm"
|
|
106
|
+
variant="secondary"
|
|
107
|
+
>
|
|
108
|
+
<Plus size={14} />
|
|
109
|
+
</Button>
|
|
110
|
+
</Cluster>
|
|
111
|
+
</Form>
|
|
112
|
+
<Text class="w-20 text-right">{Money.format(line.lineTotalPence)}</Text>
|
|
113
|
+
</Cluster>
|
|
114
|
+
</li>
|
|
115
|
+
{/each}
|
|
116
|
+
{#each summary.bundles as bundle (bundle.index)}
|
|
117
|
+
<li class="py-4">
|
|
118
|
+
<Cluster gap="md">
|
|
119
|
+
{#if bundle.cover}
|
|
120
|
+
<img
|
|
121
|
+
class="size-20 object-cover"
|
|
122
|
+
alt={bundle.cover.alt || bundle.name}
|
|
123
|
+
src={Images.url(context.imageBaseUrl, bundle.cover.src)}
|
|
124
|
+
/>
|
|
125
|
+
{/if}
|
|
126
|
+
<div class="min-w-0 flex-1">
|
|
127
|
+
{#if bundle.slug}
|
|
128
|
+
<a href={resolve('/bundle/[slug]', { slug: bundle.slug })}>
|
|
129
|
+
<Span bold>{bundle.name}</Span>
|
|
130
|
+
</a>
|
|
131
|
+
{:else}
|
|
132
|
+
<Text bold>{bundle.name}</Text>
|
|
133
|
+
{/if}
|
|
134
|
+
{#if bundle.details.length > 0}
|
|
135
|
+
<ul class="mt-1">
|
|
136
|
+
{#each bundle.details as detail, i (i)}<li>
|
|
137
|
+
<Text color="secondary" size="sm">{detail}</Text>
|
|
138
|
+
</li>{/each}
|
|
139
|
+
</ul>
|
|
140
|
+
{/if}
|
|
141
|
+
{#if bundle.problem}
|
|
142
|
+
<Text class="mt-1" color="error">{bundle.problem}</Text>
|
|
143
|
+
{/if}
|
|
144
|
+
</div>
|
|
96
145
|
<Button
|
|
97
|
-
{
|
|
98
|
-
aria-label="Increase quantity of {line.name}"
|
|
99
|
-
disabled={line.quantity >= line.limit}
|
|
100
|
-
{form}
|
|
146
|
+
aria-label="Remove {bundle.name}"
|
|
101
147
|
icon
|
|
148
|
+
onclick={() => removeBundleFromBasket({ index: bundle.index })}
|
|
102
149
|
size="sm"
|
|
103
150
|
variant="secondary"
|
|
104
151
|
>
|
|
105
|
-
<
|
|
152
|
+
<Trash size={14} />
|
|
106
153
|
</Button>
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
alt={bundle.cover.alt || bundle.name}
|
|
117
|
-
src={Images.url(context.imageBaseUrl, bundle.cover.src)}
|
|
118
|
-
/>
|
|
119
|
-
{/if}
|
|
120
|
-
<div class="min-w-0 flex-1">
|
|
121
|
-
{#if bundle.slug}
|
|
122
|
-
<a class="font-medium" href={resolve('/bundle/[slug]', { slug: bundle.slug })}>
|
|
123
|
-
{bundle.name}
|
|
124
|
-
</a>
|
|
125
|
-
{:else}
|
|
126
|
-
<Text bold>{bundle.name}</Text>
|
|
127
|
-
{/if}
|
|
128
|
-
{#if bundle.details.length > 0}
|
|
129
|
-
<ul class="mt-1 text-sm text-[var(--txs)]">
|
|
130
|
-
{#each bundle.details as detail, i (i)}<li>{detail}</li>{/each}
|
|
131
|
-
</ul>
|
|
132
|
-
{/if}
|
|
133
|
-
{#if bundle.problem}
|
|
134
|
-
<Text class="mt-1 text-[var(--danger)]">{bundle.problem}</Text>
|
|
135
|
-
{/if}
|
|
136
|
-
</div>
|
|
137
|
-
<Button
|
|
138
|
-
aria-label="Remove {bundle.name}"
|
|
139
|
-
icon
|
|
140
|
-
onclick={() => removeBundleFromBasket({ index: bundle.index })}
|
|
141
|
-
size="sm"
|
|
142
|
-
variant="secondary"
|
|
143
|
-
>
|
|
144
|
-
<Trash size={14} />
|
|
145
|
-
</Button>
|
|
146
|
-
<Text class="w-20 text-right">
|
|
147
|
-
{Money.format(bundle.pricePence)}
|
|
148
|
-
{#if bundle.listPricePence > bundle.pricePence}
|
|
149
|
-
<s class="block text-xs text-[var(--txt)]">{Money.format(bundle.listPricePence)}</s>
|
|
150
|
-
{/if}
|
|
151
|
-
</Text>
|
|
154
|
+
<Text class="w-20 text-right">
|
|
155
|
+
{Money.format(bundle.pricePence)}
|
|
156
|
+
{#if bundle.listPricePence > bundle.pricePence}
|
|
157
|
+
<Span class="block" color="tertiary" size="xs"
|
|
158
|
+
><s>{Money.format(bundle.listPricePence)}</s></Span
|
|
159
|
+
>
|
|
160
|
+
{/if}
|
|
161
|
+
</Text>
|
|
162
|
+
</Cluster>
|
|
152
163
|
</li>
|
|
153
164
|
{/each}
|
|
154
165
|
</ul>
|
|
155
166
|
|
|
156
|
-
<
|
|
167
|
+
<Stack class="mt-6 ml-auto max-w-xs" gap="xs">
|
|
157
168
|
<label class="form-label" for="ship-to">Deliver to</label>
|
|
158
169
|
<Select
|
|
159
170
|
id="ship-to"
|
|
@@ -165,7 +176,7 @@
|
|
|
165
176
|
placeholder="Choose a country"
|
|
166
177
|
value={summary.country}
|
|
167
178
|
/>
|
|
168
|
-
</
|
|
179
|
+
</Stack>
|
|
169
180
|
|
|
170
181
|
<dl class="mt-4 ml-auto grid max-w-xs grid-cols-2 gap-y-1">
|
|
171
182
|
<dt>Subtotal</dt>
|
|
@@ -178,11 +189,11 @@
|
|
|
178
189
|
? 'Free'
|
|
179
190
|
: Money.format(summary.shippingPence)}
|
|
180
191
|
</dd>
|
|
181
|
-
<dt
|
|
182
|
-
<dd class="text-right
|
|
192
|
+
<dt><Span bold>Total</Span></dt>
|
|
193
|
+
<dd class="text-right"><Span bold>{Money.format(summary.totalPence)}</Span></dd>
|
|
183
194
|
</dl>
|
|
184
195
|
{#if summary.shipping === null}
|
|
185
|
-
<Text class="mt-2 text-right
|
|
196
|
+
<Text class="mt-2 text-right" color="error">
|
|
186
197
|
We cannot ship this order to the selected country.
|
|
187
198
|
</Text>
|
|
188
199
|
{:else}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import { resolve } from '$app/paths';
|
|
4
4
|
import { CheckboxField, Form, MessageField, NumberField, TextField } from '@zeyolabs/ui/form';
|
|
5
5
|
import Button from '@zeyolabs/ui/form/Button.svelte';
|
|
6
|
+
import Cluster from '@zeyolabs/ui/layout/Cluster.svelte';
|
|
6
7
|
import Title from '@zeyolabs/ui/text/Title.svelte';
|
|
7
8
|
|
|
8
9
|
import type { getAdminBundle } from '../admin.remote';
|
|
@@ -94,53 +95,75 @@
|
|
|
94
95
|
>
|
|
95
96
|
{/if}
|
|
96
97
|
</div>
|
|
97
|
-
<
|
|
98
|
-
Title, e.g. "Choose your switches"
|
|
99
|
-
<input {...steps[i].title.as('text')} class={input} />
|
|
100
|
-
</
|
|
101
|
-
<
|
|
102
|
-
Help text (optional)
|
|
103
|
-
<input {...steps[i].description.as('text')} class={input} />
|
|
104
|
-
</
|
|
98
|
+
<div>
|
|
99
|
+
<label class="form-label" for="step-{i}-title">Title, e.g. "Choose your switches"</label>
|
|
100
|
+
<input id="step-{i}-title" {...steps[i].title.as('text')} class={input} />
|
|
101
|
+
</div>
|
|
102
|
+
<div>
|
|
103
|
+
<label class="form-label" for="step-{i}-description">Help text (optional)</label>
|
|
104
|
+
<input id="step-{i}-description" {...steps[i].description.as('text')} class={input} />
|
|
105
|
+
</div>
|
|
105
106
|
<div class="grid gap-4 sm:grid-cols-2">
|
|
106
|
-
<
|
|
107
|
-
Kind of step
|
|
108
|
-
<select {...steps[i].role.as('select')} class={input}>
|
|
107
|
+
<div>
|
|
108
|
+
<label class="form-label" for="step-{i}-role">Kind of step</label>
|
|
109
|
+
<select id="step-{i}-role" {...steps[i].role.as('select')} class={input}>
|
|
109
110
|
{#each ROLES as role (role.value)}
|
|
110
111
|
<option value={role.value}>{role.label}</option>
|
|
111
112
|
{/each}
|
|
112
113
|
</select>
|
|
113
|
-
</
|
|
114
|
-
<
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
114
|
+
</div>
|
|
115
|
+
<div>
|
|
116
|
+
<label class="form-label" for="step-{i}-max-per-choice"
|
|
117
|
+
>Kit fill: most slots per product (blank = no limit)</label
|
|
118
|
+
>
|
|
119
|
+
<input
|
|
120
|
+
id="step-{i}-max-per-choice"
|
|
121
|
+
{...steps[i].maxPerChoice.as('text')}
|
|
122
|
+
class={input}
|
|
123
|
+
inputmode="numeric"
|
|
124
|
+
/>
|
|
125
|
+
</div>
|
|
118
126
|
</div>
|
|
119
127
|
<div class="grid gap-4 sm:grid-cols-2">
|
|
120
|
-
<
|
|
121
|
-
Fewest picks (0 = optional)
|
|
122
|
-
<input
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
+
<div>
|
|
129
|
+
<label class="form-label" for="step-{i}-min-choices">Fewest picks (0 = optional)</label>
|
|
130
|
+
<input
|
|
131
|
+
id="step-{i}-min-choices"
|
|
132
|
+
{...steps[i].minChoices.as('number')}
|
|
133
|
+
class={input}
|
|
134
|
+
min="0"
|
|
135
|
+
/>
|
|
136
|
+
</div>
|
|
137
|
+
<div>
|
|
138
|
+
<label class="form-label" for="step-{i}-max-choices">Most picks</label>
|
|
139
|
+
<input
|
|
140
|
+
id="step-{i}-max-choices"
|
|
141
|
+
{...steps[i].maxChoices.as('number')}
|
|
142
|
+
class={input}
|
|
143
|
+
min="1"
|
|
144
|
+
/>
|
|
145
|
+
</div>
|
|
146
|
+
</div>
|
|
147
|
+
<div>
|
|
148
|
+
<label class="form-label" for="step-{i}-skus"
|
|
149
|
+
>Products offered, one SKU per line (a kit base as SKU=slots, e.g. BASE44=16)</label
|
|
150
|
+
>
|
|
151
|
+
<textarea
|
|
152
|
+
id="step-{i}-skus"
|
|
153
|
+
{...steps[i].skus.as('text')}
|
|
154
|
+
class="{input} min-h-28 font-mono"></textarea>
|
|
128
155
|
</div>
|
|
129
|
-
<label class="text-sm font-medium">
|
|
130
|
-
Products offered, one SKU per line (a kit base as SKU=slots, e.g. BASE44=16)
|
|
131
|
-
<textarea {...steps[i].skus.as('text')} class="{input} min-h-28 font-mono"></textarea>
|
|
132
|
-
</label>
|
|
133
156
|
</section>
|
|
134
157
|
{/each}
|
|
135
158
|
<div>
|
|
136
159
|
<Button onclick={() => steps.set([...stepRows, newStep])} variant="secondary">Add step</Button>
|
|
137
160
|
</div>
|
|
138
161
|
|
|
139
|
-
<
|
|
162
|
+
<Cluster gap="md">
|
|
140
163
|
<Button {form} loadingMessage="Saving…">Save bundle</Button>
|
|
141
164
|
{#if b?.active}
|
|
142
165
|
<!-- eslint-disable-next-line svelte/no-navigation-without-resolve -- the shop's own domain -->
|
|
143
166
|
<a href="{context.siteUrl}/bundle/{b.slug}" rel="noopener" target="_blank">View in shop</a>
|
|
144
167
|
{/if}
|
|
145
|
-
</
|
|
168
|
+
</Cluster>
|
|
146
169
|
</Form>
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
import { resolve } from '$app/paths';
|
|
3
3
|
import Badge from '@zeyolabs/ui/badge/Badge.svelte';
|
|
4
4
|
import Boundary from '@zeyolabs/ui/boundary/Boundary.svelte';
|
|
5
|
+
import Button from '@zeyolabs/ui/form/Button.svelte';
|
|
6
|
+
import Cluster from '@zeyolabs/ui/layout/Cluster.svelte';
|
|
5
7
|
import Span from '@zeyolabs/ui/text/Span.svelte';
|
|
6
8
|
import Text from '@zeyolabs/ui/text/Text.svelte';
|
|
7
9
|
import Title from '@zeyolabs/ui/text/Title.svelte';
|
|
@@ -12,13 +14,10 @@
|
|
|
12
14
|
<svelte:head><title>Bundles · Admin</title></svelte:head>
|
|
13
15
|
|
|
14
16
|
<Text><a href={resolve('/products')}>← Products</a></Text>
|
|
15
|
-
<
|
|
17
|
+
<Cluster class="mt-2" gap="sm" justify="between">
|
|
16
18
|
<Title level={1} size="md">Bundles</Title>
|
|
17
|
-
<
|
|
18
|
-
|
|
19
|
-
href={resolve('/bundles/new')}>New bundle</a
|
|
20
|
-
>
|
|
21
|
-
</div>
|
|
19
|
+
<Button href={resolve('/bundles/new')}>New bundle</Button>
|
|
20
|
+
</Cluster>
|
|
22
21
|
<Text class="mt-1" color="secondary">
|
|
23
22
|
A bundle is built in steps; the customer's picks go into the basket as ordinary products at their
|
|
24
23
|
own prices. Use a Stripe promotion code for a bundle discount.
|
|
@@ -28,14 +27,15 @@
|
|
|
28
27
|
{let rows = $derived(await getAdminBundles())}
|
|
29
28
|
<ul class="mt-4 divide-y divide-[var(--bd)] rounded-xl border border-[var(--bd)] bg-white">
|
|
30
29
|
{#each rows as row (row.id)}
|
|
31
|
-
<li class="px-4 py-2
|
|
32
|
-
<a
|
|
30
|
+
<li class="px-4 py-2">
|
|
31
|
+
<a href={resolve('/bundles/[id]', { id: String(row.id) })}
|
|
32
|
+
><Span bold size="sm">{row.name}</Span></a
|
|
33
33
|
>
|
|
34
|
-
<Span color="secondary">/bundle/{row.slug}</Span>
|
|
34
|
+
<Span color="secondary" size="sm">/bundle/{row.slug}</Span>
|
|
35
35
|
{#if !row.active}<Badge color="neutral">inactive</Badge>{/if}
|
|
36
36
|
</li>
|
|
37
37
|
{:else}
|
|
38
|
-
<li class="px-4 py-6
|
|
38
|
+
<li class="px-4 py-6"><Text color="secondary">No bundles yet.</Text></li>
|
|
39
39
|
{/each}
|
|
40
40
|
</ul>
|
|
41
41
|
{#snippet pending()}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import Minus from '@lucide/svelte/icons/minus';
|
|
5
5
|
import Plus from '@lucide/svelte/icons/plus';
|
|
6
6
|
import Button from '@zeyolabs/ui/form/Button.svelte';
|
|
7
|
+
import Cluster from '@zeyolabs/ui/layout/Cluster.svelte';
|
|
7
8
|
import Span from '@zeyolabs/ui/text/Span.svelte';
|
|
8
9
|
import Text from '@zeyolabs/ui/text/Text.svelte';
|
|
9
10
|
import Title from '@zeyolabs/ui/text/Title.svelte';
|
|
@@ -211,52 +212,54 @@
|
|
|
211
212
|
{#if step.role === 'fill'}
|
|
212
213
|
{const n = $derived(counts(step.id).get(product.id) ?? 0)}
|
|
213
214
|
<div
|
|
214
|
-
class="
|
|
215
|
+
class="w-full rounded-xl border p-2 transition {n > 0
|
|
215
216
|
? 'border-[var(--primary-strong)] bg-[var(--primary-soft)]'
|
|
216
217
|
: 'border-[var(--bd)] bg-white'} {sold ? 'opacity-50' : ''}"
|
|
217
218
|
>
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
<
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
<
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
219
|
+
<Cluster gap="sm" nowrap>
|
|
220
|
+
{#if product.cover}
|
|
221
|
+
<img
|
|
222
|
+
class="size-14 shrink-0 rounded-md object-cover"
|
|
223
|
+
alt={product.cover.alt || product.name}
|
|
224
|
+
loading="lazy"
|
|
225
|
+
src={Images.url(context.imageBaseUrl, product.cover.src)}
|
|
226
|
+
/>
|
|
227
|
+
{/if}
|
|
228
|
+
<div class="min-w-0 flex-1">
|
|
229
|
+
<Span class="block" bold>{label}</Span>
|
|
230
|
+
<Span class="block" color="secondary" size="xs">
|
|
231
|
+
{sold ? 'Out of stock' : priceLabel(step, product)}
|
|
232
|
+
</Span>
|
|
233
|
+
</div>
|
|
234
|
+
<Cluster class="shrink-0" gap="xs" nowrap>
|
|
235
|
+
<Button
|
|
236
|
+
aria-label="One fewer {product.name}"
|
|
237
|
+
disabled={n === 0}
|
|
238
|
+
icon
|
|
239
|
+
onclick={() => adjust(step, product, -1)}
|
|
240
|
+
size="sm"
|
|
241
|
+
variant="secondary"
|
|
242
|
+
>
|
|
243
|
+
<Minus size={14} />
|
|
244
|
+
</Button>
|
|
245
|
+
<div class="w-6 text-center" aria-live="polite"><Span bold>{n}</Span></div>
|
|
246
|
+
<Button
|
|
247
|
+
aria-label="One more {product.name}"
|
|
248
|
+
disabled={sold || locked || !canAdd(step, product)}
|
|
249
|
+
icon
|
|
250
|
+
onclick={() => adjust(step, product, 1)}
|
|
251
|
+
size="sm"
|
|
252
|
+
variant="secondary"
|
|
253
|
+
>
|
|
254
|
+
<Plus size={14} />
|
|
255
|
+
</Button>
|
|
256
|
+
</Cluster>
|
|
257
|
+
</Cluster>
|
|
255
258
|
</div>
|
|
256
259
|
{:else}
|
|
257
260
|
{const on = $derived(chosen(step.id).has(product.id))}
|
|
258
261
|
<button
|
|
259
|
-
class="
|
|
262
|
+
class="w-full rounded-xl border p-2 text-left transition {on
|
|
260
263
|
? 'border-[var(--primary-strong)] bg-[var(--primary-soft)]'
|
|
261
264
|
: 'border-[var(--bd)] bg-white hover:border-[var(--primary-strong)]'} disabled:opacity-50 disabled:hover:border-[var(--bd)]"
|
|
262
265
|
aria-pressed={on}
|
|
@@ -264,20 +267,22 @@
|
|
|
264
267
|
onclick={() => toggle(step, product.id)}
|
|
265
268
|
type="button"
|
|
266
269
|
>
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
<Span class="
|
|
277
|
-
|
|
278
|
-
|
|
270
|
+
<Cluster gap="sm" nowrap>
|
|
271
|
+
{#if product.cover}
|
|
272
|
+
<img
|
|
273
|
+
class="size-14 shrink-0 rounded-md object-cover"
|
|
274
|
+
alt={product.cover.alt || product.name}
|
|
275
|
+
loading="lazy"
|
|
276
|
+
src={Images.url(context.imageBaseUrl, product.cover.src)}
|
|
277
|
+
/>
|
|
278
|
+
{/if}
|
|
279
|
+
<Span class="min-w-0">
|
|
280
|
+
<Span class="block" bold>{label}</Span>
|
|
281
|
+
<Span class="block" color="secondary" size="xs">
|
|
282
|
+
{sold ? 'Out of stock' : priceLabel(step, product)}
|
|
283
|
+
</Span>
|
|
279
284
|
</Span>
|
|
280
|
-
</
|
|
285
|
+
</Cluster>
|
|
281
286
|
</button>
|
|
282
287
|
{/if}
|
|
283
288
|
</li>
|
|
@@ -287,24 +292,24 @@
|
|
|
287
292
|
{/each}
|
|
288
293
|
</ol>
|
|
289
294
|
|
|
290
|
-
<div
|
|
291
|
-
|
|
292
|
-
>
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
</
|
|
309
|
-
</
|
|
295
|
+
<div class="sticky bottom-0 mt-10 border-t border-[var(--bd)] bg-white py-4">
|
|
296
|
+
<Cluster gap="sm" justify="between">
|
|
297
|
+
<Cluster gap="xs">
|
|
298
|
+
<Span color="secondary">Total</Span>
|
|
299
|
+
<Span bold size="xl">{Money.format(totalPence)}</Span>
|
|
300
|
+
{#if totalPence < listPence}
|
|
301
|
+
<Span color="tertiary" size="sm"><s>{Money.format(listPence)}</s></Span>
|
|
302
|
+
{/if}
|
|
303
|
+
</Cluster>
|
|
304
|
+
<Cluster gap="sm">
|
|
305
|
+
{#if missing}<Span color="secondary">{missing.title}: {rule(missing)}</Span>{/if}
|
|
306
|
+
<Button
|
|
307
|
+
disabled={busy || soldOut !== undefined || missing !== undefined || totalPence === 0}
|
|
308
|
+
onclick={add}
|
|
309
|
+
size="lg"
|
|
310
|
+
>
|
|
311
|
+
Add bundle to basket
|
|
312
|
+
</Button>
|
|
313
|
+
</Cluster>
|
|
314
|
+
</Cluster>
|
|
310
315
|
</div>
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { resolve } from '$app/paths';
|
|
3
3
|
import Boundary from '@zeyolabs/ui/boundary/Boundary.svelte';
|
|
4
4
|
import Button from '@zeyolabs/ui/form/Button.svelte';
|
|
5
|
+
import Cluster from '@zeyolabs/ui/layout/Cluster.svelte';
|
|
5
6
|
import Span from '@zeyolabs/ui/text/Span.svelte';
|
|
6
7
|
import Text from '@zeyolabs/ui/text/Text.svelte';
|
|
7
8
|
import Title from '@zeyolabs/ui/text/Title.svelte';
|
|
@@ -39,15 +40,20 @@
|
|
|
39
40
|
{let rows = $derived(await getAdminCategories())}
|
|
40
41
|
<ul class="mt-4 divide-y divide-[var(--bd)] rounded-xl border border-[var(--bd)] bg-white">
|
|
41
42
|
{#each rows as row (row.id)}
|
|
42
|
-
<li class="
|
|
43
|
-
<
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
43
|
+
<li class="px-4 py-2">
|
|
44
|
+
<Cluster gap="sm" justify="between">
|
|
45
|
+
<Span
|
|
46
|
+
><Span bold size="sm">{row.name}</Span>
|
|
47
|
+
<Span color="secondary" size="sm">/category/{row.slug} · {row.products} products</Span
|
|
48
|
+
></Span
|
|
49
|
+
>
|
|
50
|
+
<button class="underline" onclick={() => (editing = row)} type="button"
|
|
51
|
+
><Span size="sm">Edit</Span></button
|
|
52
|
+
>
|
|
53
|
+
</Cluster>
|
|
48
54
|
</li>
|
|
49
55
|
{:else}
|
|
50
|
-
<li class="px-4 py-6
|
|
56
|
+
<li class="px-4 py-6"><Text color="secondary">No categories yet.</Text></li>
|
|
51
57
|
{/each}
|
|
52
58
|
</ul>
|
|
53
59
|
{#snippet pending()}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { Form, MessageField, NumberField, TextField } from '@zeyolabs/ui/form';
|
|
3
3
|
import Button from '@zeyolabs/ui/form/Button.svelte';
|
|
4
|
+
import Cluster from '@zeyolabs/ui/layout/Cluster.svelte';
|
|
4
5
|
|
|
5
6
|
import { saveCategoryForm } from '../admin.remote';
|
|
6
7
|
import { CategoryFormSchema } from '../schema';
|
|
@@ -44,8 +45,8 @@
|
|
|
44
45
|
<TextField name="slug" {form} optional placeholder="made from the name">Slug (URL)</TextField>
|
|
45
46
|
<MessageField name="description" {form} optional>Description</MessageField>
|
|
46
47
|
<NumberField name="sortOrder" {form} inputmode="numeric">Sort order</NumberField>
|
|
47
|
-
<
|
|
48
|
+
<Cluster gap="sm">
|
|
48
49
|
<Button {form}>Save</Button>
|
|
49
50
|
<Button onclick={onDone} variant="secondary">Cancel</Button>
|
|
50
|
-
</
|
|
51
|
+
</Cluster>
|
|
51
52
|
</Form>
|