@stacksjs/defaults 0.75.612 → 0.75.613
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/ai/skills/stacks-actions/SKILL.md +208 -0
- package/ai/skills/stacks-api/SKILL.md +1 -1
- package/ai/skills/stacks-buddy/SKILL.md +1 -1
- package/ai/skills/stacks-dashboard/SKILL.md +79 -0
- package/ai/skills/stacks-middleware/SKILL.md +4 -1
- package/ai/skills/stacks-native/CATALOG.md +12 -12
- package/ai/skills/stacks-validation/SKILL.md +7 -0
- package/app/Actions/Storefront/AddToCartAction.ts +12 -15
- package/app/Actions/Storefront/CheckoutContactAction.ts +18 -10
- package/app/Actions/Storefront/CheckoutShippingAction.ts +20 -10
- package/app/Actions/Storefront/PlaceOrderAction.ts +9 -12
- package/app/Actions/Storefront/UpdateCartItemAction.ts +11 -9
- package/app/Middleware/Abilities.ts +4 -3
- package/app/Middleware/Csrf.ts +10 -1
- package/app/Middleware/Throttle.ts +4 -4
- package/ide/vscode/package.json +1 -1
- package/package.json +5 -5
- package/resources/components/Dashboard/Analytics/AnalyticsPageHeader.stx +3 -13
- package/resources/components/Dashboard/App/RequestsOverview.stx +3 -20
- package/resources/components/Dashboard/App/SourceInventory.stx +1 -5
- package/resources/components/Dashboard/Auth/AccessTokenCreateDialog.stx +11 -28
- package/resources/components/Dashboard/Commerce/CommerceCategoriesDashboard.stx +4 -8
- package/resources/components/Dashboard/Commerce/CommerceCategoryDialog.stx +9 -9
- package/resources/components/Dashboard/Commerce/CommerceCouponDialog.stx +14 -14
- package/resources/components/Dashboard/Commerce/CommerceCouponsDashboard.stx +5 -9
- package/resources/components/Dashboard/Commerce/CommerceCustomerDialog.stx +7 -7
- package/resources/components/Dashboard/Commerce/CommerceCustomersDashboard.stx +3 -7
- package/resources/components/Dashboard/Commerce/CommerceGiftCardDialog.stx +15 -15
- package/resources/components/Dashboard/Commerce/CommerceGiftCardsDashboard.stx +5 -9
- package/resources/components/Dashboard/Commerce/CommerceManufacturerDialog.stx +12 -15
- package/resources/components/Dashboard/Commerce/CommerceManufacturersDashboard.stx +4 -28
- package/resources/components/Dashboard/Commerce/CommerceOrderDialog.stx +15 -15
- package/resources/components/Dashboard/Commerce/CommerceOrdersDashboard.stx +4 -8
- package/resources/components/Dashboard/Commerce/CommerceOverviewDashboard.stx +3 -11
- package/resources/components/Dashboard/Commerce/CommercePaymentsDashboard.stx +8 -9
- package/resources/components/Dashboard/Commerce/CommercePosCatalog.stx +3 -20
- package/resources/components/Dashboard/Commerce/CommercePosCheckoutDialog.stx +4 -4
- package/resources/components/Dashboard/Commerce/CommerceProductDialog.stx +14 -14
- package/resources/components/Dashboard/Commerce/CommerceProductsDashboard.stx +4 -8
- package/resources/components/Dashboard/Commerce/CommerceReviewEditDialog.stx +14 -24
- package/resources/components/Dashboard/Commerce/CommerceReviewsDashboard.stx +5 -43
- package/resources/components/Dashboard/Commerce/CommerceTaxDialog.stx +22 -38
- package/resources/components/Dashboard/Commerce/CommerceTaxesDashboard.stx +5 -33
- package/resources/components/Dashboard/Commerce/CommerceUnitDialog.stx +16 -30
- package/resources/components/Dashboard/Commerce/CommerceUnitsDashboard.stx +4 -28
- package/resources/components/Dashboard/Commerce/CommerceVariantDialog.stx +15 -9
- package/resources/components/Dashboard/Commerce/CommerceVariantsDashboard.stx +8 -9
- package/resources/components/Dashboard/Commerce/Delivery/CourierDialog.stx +14 -12
- package/resources/components/Dashboard/Commerce/Delivery/DeliveryRouteDialog.stx +9 -11
- package/resources/components/Dashboard/Commerce/Delivery/DigitalDeliveryDialog.stx +15 -9
- package/resources/components/Dashboard/Commerce/Delivery/LicenseKeyDialog.stx +11 -7
- package/resources/components/Dashboard/Commerce/Delivery/ShippingMethodDialog.stx +14 -8
- package/resources/components/Dashboard/Commerce/Delivery/ShippingRateDialog.stx +11 -17
- package/resources/components/Dashboard/Commerce/Delivery/ShippingZoneDialog.stx +18 -12
- package/resources/components/Dashboard/Commerce/PaymentRefundDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/PrintDeviceDialog.stx +5 -5
- package/resources/components/Dashboard/Commerce/PrintDevicesDashboard.stx +4 -8
- package/resources/components/Dashboard/Commerce/PrintLogsDashboard.stx +5 -9
- package/resources/components/Dashboard/Commerce/ProductWaitlistDashboard.stx +2 -10
- package/resources/components/Dashboard/Commerce/ProductWaitlistEntryDialog.stx +14 -67
- package/resources/components/Dashboard/Commerce/RestaurantWaitlistDashboard.stx +3 -18
- package/resources/components/Dashboard/Commerce/RestaurantWaitlistEntryDialog.stx +23 -69
- package/resources/components/Dashboard/Content/AuthorEditorDialog.stx +4 -16
- package/resources/components/Dashboard/Content/BlogDashboard.stx +2 -19
- package/resources/components/Dashboard/Content/BlogPostEditorDialog.stx +31 -51
- package/resources/components/Dashboard/Content/CommentsDashboard.stx +1 -1
- package/resources/components/Dashboard/Content/ContentDashboard.stx +1 -11
- package/resources/components/Dashboard/Content/CreateFolderDialog.stx +1 -4
- package/resources/components/Dashboard/Content/FileManagerDashboard.stx +2 -2
- package/resources/components/Dashboard/Content/PageEditorDialog.stx +8 -17
- package/resources/components/Dashboard/Content/PostEditorDialog.stx +35 -45
- package/resources/components/Dashboard/Content/PostsDashboard.stx +1 -13
- package/resources/components/Dashboard/Content/SeoDashboard.stx +2 -20
- package/resources/components/Dashboard/Content/SeoEditorDialog.stx +4 -38
- package/resources/components/Dashboard/Content/TaxonomyEditorDialog.stx +8 -15
- package/resources/components/Dashboard/Data/ActivityLog.stx +1 -5
- package/resources/components/Dashboard/Deployments/DeploymentList.stx +2 -11
- package/resources/components/Dashboard/Email/InboxMessageList.stx +1 -5
- package/resources/components/Dashboard/Infrastructure/DnsDashboard.stx +2 -16
- package/resources/components/Dashboard/Infrastructure/LogsDashboard.stx +6 -10
- package/resources/components/Dashboard/Infrastructure/MailboxesDashboard.stx +1 -5
- package/resources/components/Dashboard/Infrastructure/ServersDashboard.stx +1 -5
- package/resources/components/Dashboard/Jobs/JobHistory.stx +3 -12
- package/resources/components/Dashboard/Kanban/KanbanCardDialog.stx +57 -51
- package/resources/components/Dashboard/Library/ComponentsDashboard.stx +4 -14
- package/resources/components/Dashboard/Library/DependenciesDashboard.stx +2 -15
- package/resources/components/Dashboard/Library/PackagesDashboard.stx +1 -8
- package/resources/components/Dashboard/Library/SourceScaffoldDialog.stx +1 -12
- package/resources/components/Dashboard/Management/PermissionsDashboard.stx +3 -3
- package/resources/components/Dashboard/Marketing/AbandonedCartsDashboard.stx +4 -4
- package/resources/components/Dashboard/Marketing/CampaignDeliveryDialog.stx +3 -5
- package/resources/components/Dashboard/Marketing/CampaignDialog.stx +59 -93
- package/resources/components/Dashboard/Marketing/CampaignsDashboard.stx +5 -5
- package/resources/components/Dashboard/Marketing/MarketingListDialog.stx +12 -26
- package/resources/components/Dashboard/Marketing/MarketingListsDashboard.stx +4 -4
- package/resources/components/Dashboard/Marketing/RecoveryCampaignDialog.stx +12 -43
- package/resources/components/Dashboard/Marketing/SocialPostDialog.stx +7 -41
- package/resources/components/Dashboard/Marketing/SocialPostsDashboard.stx +5 -5
- package/resources/components/Dashboard/Models/ModelRecordsDashboard.stx +7 -23
- package/resources/components/Dashboard/Models/ModelsOverview.stx +2 -12
- package/resources/components/Dashboard/Notifications/NotificationDeliveries.stx +4 -27
- package/resources/components/Dashboard/Notifications/NotificationDeliveryHistory.stx +4 -36
- package/resources/components/Dashboard/Operations/RecoveryDestinationDialog.stx +18 -47
- package/resources/components/Dashboard/Operations/RecoveryPolicyDialog.stx +24 -78
- package/resources/components/Dashboard/Operations/RecoveryRestoreDialog.stx +8 -19
- package/resources/components/Dashboard/Queries/QueryDashboard.stx +3 -21
- package/resources/components/Dashboard/Releases/ReleaseDashboard.stx +2 -9
- package/resources/components/Dashboard/Settings/SettingsDashboard.stx +1 -11
- package/resources/components/Dashboard/UI/Input.stx +50 -1
- package/resources/components/Dashboard/UI/SearchFilter.stx +27 -17
- package/resources/components/Dashboard/UI/Select.stx +4 -1
- package/resources/components/Dashboard/UI/Textarea.stx +16 -1
- package/resources/views/cart.stx +14 -0
- package/resources/views/checkout/contact.stx +15 -1
- package/resources/views/checkout/payment.stx +7 -0
- package/resources/views/checkout/shipping.stx +39 -5
|
@@ -21,7 +21,7 @@ const errors = useReactiveProp('errors', {} as Record<string, string>)
|
|
|
21
21
|
const emit = defineEmits(['submit', 'close'])
|
|
22
22
|
const name = state('')
|
|
23
23
|
const slug = state('')
|
|
24
|
-
const
|
|
24
|
+
const descriptionText = state('')
|
|
25
25
|
// The price as typed, in major units ("19.99"). It is stored as integer
|
|
26
26
|
// minor units (1999), converted once in `productWritePayload`.
|
|
27
27
|
const price = state('')
|
|
@@ -51,7 +51,7 @@ effect(() => {
|
|
|
51
51
|
name.set(current?.name || '')
|
|
52
52
|
slug.set(current?.slug || '')
|
|
53
53
|
slugTouched = Boolean(current?.slug)
|
|
54
|
-
|
|
54
|
+
descriptionText.set(current?.description || '')
|
|
55
55
|
price.set(current ? minorToInput(current.price, currency()) : '')
|
|
56
56
|
imageUrl.set(current?.imageUrl || '')
|
|
57
57
|
isAvailable.set(current?.isAvailable ?? true)
|
|
@@ -119,7 +119,7 @@ function submit(): void {
|
|
|
119
119
|
emit('submit', productWritePayload({
|
|
120
120
|
name: name(),
|
|
121
121
|
slug: slugify(slug()),
|
|
122
|
-
description:
|
|
122
|
+
description: descriptionText(),
|
|
123
123
|
price: price(),
|
|
124
124
|
imageUrl: imageUrl(),
|
|
125
125
|
isAvailable: isAvailable(),
|
|
@@ -149,20 +149,20 @@ function errorMessages(): string[] {
|
|
|
149
149
|
<li :for="message in errorMessages()" :key="message">{{ message }}</li>
|
|
150
150
|
</ul>
|
|
151
151
|
<div class="grid gap-4 grid-cols-1 sm:grid-cols-2">
|
|
152
|
-
<
|
|
153
|
-
<
|
|
154
|
-
<
|
|
155
|
-
<
|
|
156
|
-
<
|
|
157
|
-
<
|
|
152
|
+
<div class="sm:col-span-2"><Input v-model:value="name" label="Name" :maxLength="100" :required="true" /></div>
|
|
153
|
+
<div class="sm:col-span-2"><Input v-model:value="slug" label="Slug" :maxLength="255" :required="true" :spellcheck="false" :monospace="true" :hint="'The storefront address, /products/' + (slug() || 'slug') + '.'" @input="markSlugTouched" @blur="normalizeSlug" /></div>
|
|
154
|
+
<div class="sm:col-span-2"><Textarea v-model:value="descriptionText" label="Description" :rows="3" /></div>
|
|
155
|
+
<Input v-model:value="price" :label="'Price (' + currency() + ')'" type="number" min="0" :step="moneyInputStep(currency())" inputmode="decimal" :required="true" :error="price() !== '' ? priceError() : ''" />
|
|
156
|
+
<Input v-model:value="inventoryCount" label="Inventory count" type="number" min="0" step="1" :required="true" />
|
|
157
|
+
<Input v-model:value="preparationTime" label="Preparation time (minutes)" type="number" min="1" step="1" :required="true" />
|
|
158
158
|
<div class="self-end px-3 py-2 min-h-10 bg-gray-50 dark:bg-neutral-900/60 border border-gray-200 rounded-md dark:border-neutral-700">
|
|
159
159
|
<Toggle v-model:checked="isAvailable" label="Available for commerce" labelPosition="left" />
|
|
160
160
|
</div>
|
|
161
|
-
<
|
|
162
|
-
<
|
|
163
|
-
<
|
|
164
|
-
<
|
|
165
|
-
<
|
|
161
|
+
<Select v-model:value="categoryId" label="Category" placeholder="" :options="[{ value: '', label: 'Unassigned category' }, ...categories().map(option => ({ value: option.id, label: option.label }))]" />
|
|
162
|
+
<Select v-model:value="manufacturerId" label="Manufacturer" placeholder="" :options="[{ value: '', label: 'Unassigned manufacturer' }, ...manufacturers().map(option => ({ value: option.id, label: option.label }))]" />
|
|
163
|
+
<div class="sm:col-span-2"><Input v-model:value="imageUrl" label="Image URL" type="url" placeholder="Optional persisted asset URL" /></div>
|
|
164
|
+
<div class="sm:col-span-2"><Input v-model:value="allergens" label="Allergens" placeholder="Comma-separated, for example: Gluten, Soy" /></div>
|
|
165
|
+
<div class="sm:col-span-2"><Textarea v-model:value="nutritionalInfo" label="Nutritional information (JSON object)" :rows="4" :spellcheck="false" :monospace="true" :error="nutritionValid() ? '' : 'Enter a valid JSON object.'" /></div>
|
|
166
166
|
</div>
|
|
167
167
|
</form>
|
|
168
168
|
<template #footer>
|
|
@@ -220,14 +220,10 @@ onMount(() => {
|
|
|
220
220
|
|
|
221
221
|
<section class="flex flex-col gap-3">
|
|
222
222
|
<div class="grid gap-3 grid-cols-1 sm:grid-cols-2 lg:grid-cols-5">
|
|
223
|
-
<
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
</label>
|
|
228
|
-
<label><span class="sr-only">Product category</span><select x-model="categoryFilter" class="px-3 py-2 w-full text-gray-900 text-sm dark:text-white bg-white dark:bg-neutral-800 border border-gray-300 rounded-md dark:border-neutral-700"><option value="all">Any category</option><option :for="option in categories()" :key="option.id" :value="option.id">{{ option.label }}</option></select></label>
|
|
229
|
-
<label><span class="sr-only">Product availability</span><select x-model="availabilityFilter" class="px-3 py-2 w-full text-gray-900 text-sm dark:text-white bg-white dark:bg-neutral-800 border border-gray-300 rounded-md dark:border-neutral-700"><option value="all">Any availability</option><option value="available">Available</option><option value="unavailable">Unavailable</option><option value="out-of-stock">Out of stock</option></select></label>
|
|
230
|
-
<label><span class="sr-only">Sort products</span><select x-model="sort" class="px-3 py-2 w-full text-gray-900 text-sm dark:text-white bg-white dark:bg-neutral-800 border border-gray-300 rounded-md dark:border-neutral-700"><option value="newest">Newest first</option><option value="oldest">Oldest first</option><option value="name">Name</option><option value="price-high">Highest price</option><option value="price-low">Lowest price</option><option value="inventory-high">Highest inventory</option></select></label>
|
|
223
|
+
<div class="sm:col-span-2"><SearchFilter v-model:searchValue="search" placeholder="Search name, category, manufacturer, or allergen" ariaLabel="Search products" /></div>
|
|
224
|
+
<Select v-model:value="categoryFilter" ariaLabel="Product category" placeholder="" :options="[{ value: 'all', label: 'Any category' }, ...categories().map(option => ({ value: option.id, label: option.label }))]" />
|
|
225
|
+
<Select v-model:value="availabilityFilter" ariaLabel="Product availability" placeholder="" :options="[{ value: 'all', label: 'Any availability' }, { value: 'available', label: 'Available' }, { value: 'unavailable', label: 'Unavailable' }, { value: 'out-of-stock', label: 'Out of stock' }]" />
|
|
226
|
+
<Select v-model:value="sort" ariaLabel="Sort products" placeholder="" :options="[{ value: 'newest', label: 'Newest first' }, { value: 'oldest', label: 'Oldest first' }, { value: 'name', label: 'Name' }, { value: 'price-high', label: 'Highest price' }, { value: 'price-low', label: 'Lowest price' }, { value: 'inventory-high', label: 'Highest inventory' }]" />
|
|
231
227
|
</div>
|
|
232
228
|
|
|
233
229
|
<div class="flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between">
|
|
@@ -7,7 +7,7 @@ const review = useReactiveProp('review', null as ReviewRecord | null)
|
|
|
7
7
|
const busy = useReactiveProp('busy', false)
|
|
8
8
|
const errors = useReactiveProp('errors', {} as Record<string, string>)
|
|
9
9
|
const emit = defineEmits(['submit', 'close'])
|
|
10
|
-
const
|
|
10
|
+
const reviewTitle = state('')
|
|
11
11
|
const content = state('')
|
|
12
12
|
// A string, so the select can hold "no rating" as well as 1 to 5.
|
|
13
13
|
const rating = state('5')
|
|
@@ -24,7 +24,7 @@ effect(() => {
|
|
|
24
24
|
if (hydratedId === current.id)
|
|
25
25
|
return
|
|
26
26
|
hydratedId = current.id
|
|
27
|
-
|
|
27
|
+
reviewTitle.set(current.title)
|
|
28
28
|
content.set(current.content)
|
|
29
29
|
rating.set(current.rating === null ? '' : String(current.rating))
|
|
30
30
|
approved.set(current.approved)
|
|
@@ -32,10 +32,10 @@ effect(() => {
|
|
|
32
32
|
})
|
|
33
33
|
|
|
34
34
|
function submit(): void {
|
|
35
|
-
if (!
|
|
35
|
+
if (!reviewTitle().trim() || !content().trim())
|
|
36
36
|
return
|
|
37
37
|
emit('submit', {
|
|
38
|
-
title:
|
|
38
|
+
title: reviewTitle().trim(),
|
|
39
39
|
content: content().trim(),
|
|
40
40
|
rating: rating() === '' ? null : Number(rating()),
|
|
41
41
|
isApproved: approved(),
|
|
@@ -61,25 +61,15 @@ function errorMessages(): string[] {
|
|
|
61
61
|
</ul>
|
|
62
62
|
|
|
63
63
|
<div class="space-y-4">
|
|
64
|
-
<
|
|
65
|
-
<
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
<span class="font-medium text-gray-700 text-sm dark:text-neutral-200">Rating</span>
|
|
74
|
-
<select x-model="rating" class="mt-1 px-3 py-2 w-full text-gray-900 text-sm dark:text-white bg-white dark:bg-neutral-900 border border-gray-300 rounded-md dark:border-neutral-700">
|
|
75
|
-
<option value="5">5 stars</option>
|
|
76
|
-
<option value="4">4 stars</option>
|
|
77
|
-
<option value="3">3 stars</option>
|
|
78
|
-
<option value="2">2 stars</option>
|
|
79
|
-
<option value="1">1 star</option>
|
|
80
|
-
<option value="">No rating</option>
|
|
81
|
-
</select>
|
|
82
|
-
</label>
|
|
64
|
+
<div>
|
|
65
|
+
<Input v-model:value="reviewTitle" label="Title" :maxLength="100" :required="true" />
|
|
66
|
+
</div>
|
|
67
|
+
<div>
|
|
68
|
+
<Textarea v-model:value="content" label="Review" :rows="6" :maxLength="2000" :required="true" />
|
|
69
|
+
</div>
|
|
70
|
+
<div>
|
|
71
|
+
<Select v-model:value="rating" label="Rating" placeholder="" :options="[{ value: '5', label: '5 stars' }, { value: '4', label: '4 stars' }, { value: '3', label: '3 stars' }, { value: '2', label: '2 stars' }, { value: '1', label: '1 star' }, { value: '', label: 'No rating' }]" />
|
|
72
|
+
</div>
|
|
83
73
|
<div class="grid gap-3 grid-cols-1 sm:grid-cols-2">
|
|
84
74
|
<div class="p-3 border border-gray-200 rounded-lg dark:border-neutral-700">
|
|
85
75
|
<Toggle v-model:checked="approved" label="Approved" labelPosition="left" />
|
|
@@ -93,7 +83,7 @@ function errorMessages(): string[] {
|
|
|
93
83
|
<template #footer>
|
|
94
84
|
<div class="flex gap-2 justify-end w-full">
|
|
95
85
|
<Button variant="secondary" :disabled="busy()" @click="emit('close')">Cancel</Button>
|
|
96
|
-
<Button type="submit" form="review-form" :loading="busy()" :disabled="!
|
|
86
|
+
<Button type="submit" form="review-form" :loading="busy()" :disabled="!reviewTitle().trim() || !content().trim()">Save review</Button>
|
|
97
87
|
</div>
|
|
98
88
|
</template>
|
|
99
89
|
</Modal>
|
|
@@ -242,42 +242,10 @@ onMount(() => {
|
|
|
242
242
|
|
|
243
243
|
<section class="flex flex-col gap-3">
|
|
244
244
|
<div class="grid gap-3 grid-cols-1 md:grid-cols-2 xl:grid-cols-5">
|
|
245
|
-
<div class="
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
</span>
|
|
250
|
-
<input id="review-search" x-model="search" type="search" placeholder="Search reviews" class="pl-9 pr-3 py-2 w-full text-gray-900 text-sm dark:text-white bg-white dark:bg-neutral-800 border border-gray-300 rounded-md dark:border-neutral-700" />
|
|
251
|
-
</div>
|
|
252
|
-
<label>
|
|
253
|
-
<span class="sr-only">Product</span>
|
|
254
|
-
<select x-model="productFilter" class="px-3 py-2 w-full text-gray-900 text-sm dark:text-white bg-white dark:bg-neutral-800 border border-gray-300 rounded-md dark:border-neutral-700">
|
|
255
|
-
<option value="all">All products</option>
|
|
256
|
-
<option :for="product in products()" :key="product.id" :value="product.id">{{ product.label }}</option>
|
|
257
|
-
</select>
|
|
258
|
-
</label>
|
|
259
|
-
<label>
|
|
260
|
-
<span class="sr-only">Rating</span>
|
|
261
|
-
<select x-model="ratingFilter" class="px-3 py-2 w-full text-gray-900 text-sm dark:text-white bg-white dark:bg-neutral-800 border border-gray-300 rounded-md dark:border-neutral-700">
|
|
262
|
-
<option value="all">All ratings</option>
|
|
263
|
-
<option value="5">5 stars</option>
|
|
264
|
-
<option value="4">4 stars</option>
|
|
265
|
-
<option value="3">3 stars</option>
|
|
266
|
-
<option value="2">2 stars</option>
|
|
267
|
-
<option value="1">1 star</option>
|
|
268
|
-
<option value="none">No rating</option>
|
|
269
|
-
</select>
|
|
270
|
-
</label>
|
|
271
|
-
<label>
|
|
272
|
-
<span class="sr-only">Moderation state</span>
|
|
273
|
-
<select x-model="moderationFilter" class="px-3 py-2 w-full text-gray-900 text-sm dark:text-white bg-white dark:bg-neutral-800 border border-gray-300 rounded-md dark:border-neutral-700">
|
|
274
|
-
<option value="all">All states</option>
|
|
275
|
-
<option value="approved">Approved</option>
|
|
276
|
-
<option value="pending">Pending</option>
|
|
277
|
-
<option value="featured">Featured</option>
|
|
278
|
-
<option value="verified">Verified purchase</option>
|
|
279
|
-
</select>
|
|
280
|
-
</label>
|
|
245
|
+
<div class="xl:col-span-2"><SearchFilter v-model:searchValue="search" placeholder="Search reviews" ariaLabel="Search reviews" /></div>
|
|
246
|
+
<Select v-model:value="productFilter" ariaLabel="Product" placeholder="" :options="[{ value: 'all', label: 'All products' }, ...products().map(product => ({ value: product.id, label: product.label }))]" />
|
|
247
|
+
<Select v-model:value="ratingFilter" ariaLabel="Rating" placeholder="" :options="[{ value: 'all', label: 'All ratings' }, { value: '5', label: '5 stars' }, { value: '4', label: '4 stars' }, { value: '3', label: '3 stars' }, { value: '2', label: '2 stars' }, { value: '1', label: '1 star' }, { value: 'none', label: 'No rating' }]" />
|
|
248
|
+
<Select v-model:value="moderationFilter" ariaLabel="Moderation state" placeholder="" :options="[{ value: 'all', label: 'All states' }, { value: 'approved', label: 'Approved' }, { value: 'pending', label: 'Pending' }, { value: 'featured', label: 'Featured' }, { value: 'verified', label: 'Verified purchase' }]" />
|
|
281
249
|
</div>
|
|
282
250
|
|
|
283
251
|
<div class="flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between">
|
|
@@ -286,13 +254,7 @@ onMount(() => {
|
|
|
286
254
|
</p>
|
|
287
255
|
<label class="flex gap-2 items-center text-gray-500 text-sm dark:text-neutral-400">
|
|
288
256
|
Sort
|
|
289
|
-
<
|
|
290
|
-
<option value="newest">Newest first</option>
|
|
291
|
-
<option value="oldest">Oldest first</option>
|
|
292
|
-
<option value="rating-high">Highest rating</option>
|
|
293
|
-
<option value="rating-low">Lowest rating</option>
|
|
294
|
-
<option value="helpful">Most helpful</option>
|
|
295
|
-
</select>
|
|
257
|
+
<Select v-model:value="sort" ariaLabel="Sort" size="sm" placeholder="" :options="[{ value: 'newest', label: 'Newest first' }, { value: 'oldest', label: 'Oldest first' }, { value: 'rating-high', label: 'Highest rating' }, { value: 'rating-low', label: 'Lowest rating' }, { value: 'helpful', label: 'Most helpful' }]" />
|
|
296
258
|
</label>
|
|
297
259
|
</div>
|
|
298
260
|
|
|
@@ -10,7 +10,10 @@ const busy = useReactiveProp('busy', false)
|
|
|
10
10
|
const errors = useReactiveProp('errors', {} as Record<string, string>)
|
|
11
11
|
const emit = defineEmits(['submit', 'close'])
|
|
12
12
|
const name = state('')
|
|
13
|
-
const rate = state(0)
|
|
13
|
+
const rate = state<number | string>(0)
|
|
14
|
+
/** The rate as a number: the input reports what was typed, as text. Not a number while it is empty. */
|
|
15
|
+
const rateValue = derived(() => rate() === '' ? Number.NaN : Number(rate()))
|
|
16
|
+
const rateValid = derived(() => rateValue() >= 0 && rateValue() <= 100)
|
|
14
17
|
const type = state('')
|
|
15
18
|
const country = state('')
|
|
16
19
|
const region = state('North America')
|
|
@@ -44,11 +47,11 @@ effect(() => {
|
|
|
44
47
|
})
|
|
45
48
|
|
|
46
49
|
function submit(): void {
|
|
47
|
-
if (!name().trim() || !type().trim() || !country().trim() ||
|
|
50
|
+
if (!name().trim() || !type().trim() || !country().trim() || !rateValid())
|
|
48
51
|
return
|
|
49
52
|
emit('submit', {
|
|
50
53
|
name: name().trim(),
|
|
51
|
-
rate:
|
|
54
|
+
rate: rateValue(),
|
|
52
55
|
type: type().trim(),
|
|
53
56
|
country: country().trim(),
|
|
54
57
|
region: region(),
|
|
@@ -76,45 +79,26 @@ function errorMessages(): string[] {
|
|
|
76
79
|
<li :for="message in errorMessages()" :key="message">{{ message }}</li>
|
|
77
80
|
</ul>
|
|
78
81
|
<div class="space-y-4">
|
|
79
|
-
<
|
|
80
|
-
<
|
|
81
|
-
|
|
82
|
-
</label>
|
|
82
|
+
<div>
|
|
83
|
+
<Input v-model:value="name" label="Name" :maxLength="255" :required="true" />
|
|
84
|
+
</div>
|
|
83
85
|
<div class="grid gap-4 sm:grid-cols-2">
|
|
84
|
-
<label
|
|
85
|
-
|
|
86
|
-
<
|
|
87
|
-
</label>
|
|
88
|
-
<label class="block">
|
|
89
|
-
<span class="font-medium text-gray-700 text-sm dark:text-neutral-200">Type</span>
|
|
90
|
-
<input x-model="type" type="text" list="tax-rate-types" maxlength="100" required class="mt-1 px-3 py-2 w-full text-gray-900 text-sm dark:text-white bg-white dark:bg-neutral-900 border border-gray-300 rounded-md dark:border-neutral-700" />
|
|
86
|
+
<Input v-model:value="rate" label="Rate (%)" type="number" min="0" max="100" step="0.01" :required="true" />
|
|
87
|
+
<div>
|
|
88
|
+
<Input v-model:value="type" label="Type" list="tax-rate-types" :maxLength="100" :required="true" />
|
|
91
89
|
<datalist id="tax-rate-types"><option :for="taxType in types()" :key="taxType" :value="taxType"></option></datalist>
|
|
92
|
-
</
|
|
90
|
+
</div>
|
|
91
|
+
</div>
|
|
92
|
+
<div>
|
|
93
|
+
<Input v-model:value="country" label="Country" :maxLength="100" :required="true" />
|
|
93
94
|
</div>
|
|
94
|
-
<label class="block">
|
|
95
|
-
<span class="font-medium text-gray-700 text-sm dark:text-neutral-200">Country</span>
|
|
96
|
-
<input x-model="country" type="text" maxlength="100" required class="mt-1 px-3 py-2 w-full text-gray-900 text-sm dark:text-white bg-white dark:bg-neutral-900 border border-gray-300 rounded-md dark:border-neutral-700" />
|
|
97
|
-
</label>
|
|
98
95
|
<div class="grid gap-4 sm:grid-cols-2">
|
|
99
|
-
<label
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
</label>
|
|
105
|
-
<label class="block">
|
|
106
|
-
<span class="font-medium text-gray-700 text-sm dark:text-neutral-200">Status</span>
|
|
107
|
-
<select x-model="status" class="mt-1 px-3 py-2 w-full text-gray-900 text-sm dark:text-white bg-white dark:bg-neutral-900 border border-gray-300 rounded-md dark:border-neutral-700">
|
|
108
|
-
<option value="active">Active</option>
|
|
109
|
-
<option value="inactive">Inactive</option>
|
|
110
|
-
</select>
|
|
111
|
-
</label>
|
|
96
|
+
<Select v-model:value="region" label="Region" placeholder="" :options="[...regions.map(regionOption => ({ value: regionOption, label: regionOption }))]" />
|
|
97
|
+
<Select v-model:value="status" label="Status" placeholder="" :options="[{ value: 'active', label: 'Active' }, { value: 'inactive', label: 'Inactive' }]" />
|
|
98
|
+
</div>
|
|
99
|
+
<div>
|
|
100
|
+
<Input v-model:value="code" label="Code" placeholder="sales" :monospace="true" hint="What the application matches on. Renaming the rate above does not change what is charged; changing this can." />
|
|
112
101
|
</div>
|
|
113
|
-
<label class="block">
|
|
114
|
-
<span class="font-medium text-gray-700 text-sm dark:text-neutral-200">Code</span>
|
|
115
|
-
<input x-model="code" type="text" placeholder="sales" class="mt-1 px-3 py-2 w-full font-mono text-gray-900 text-sm dark:text-white bg-white dark:bg-neutral-900 border border-gray-300 rounded-md dark:border-neutral-700" />
|
|
116
|
-
<span class="block mt-1 text-gray-500 text-xs dark:text-neutral-400">What the application matches on. Renaming the rate above does not change what is charged; changing this can.</span>
|
|
117
|
-
</label>
|
|
118
102
|
<div class="p-3 border border-gray-200 rounded-lg dark:border-neutral-700">
|
|
119
103
|
<Toggle v-model:checked="isDefault" label="Default tax rate" description="Selecting this clears the default flag from every other rate." labelPosition="left" />
|
|
120
104
|
</div>
|
|
@@ -131,7 +115,7 @@ function errorMessages(): string[] {
|
|
|
131
115
|
<template #footer>
|
|
132
116
|
<div class="flex gap-2 justify-end w-full">
|
|
133
117
|
<Button variant="secondary" :disabled="busy()" @click="emit('close')">Cancel</Button>
|
|
134
|
-
<Button type="submit" form="tax-rate-form" :loading="busy()" :disabled="!name().trim() || !type().trim() || !country().trim() ||
|
|
118
|
+
<Button type="submit" form="tax-rate-form" :loading="busy()" :disabled="!name().trim() || !type().trim() || !country().trim() || !rateValid()">
|
|
135
119
|
{{ mode() === 'edit' ? 'Save tax rate' : 'Add tax rate' }}
|
|
136
120
|
</Button>
|
|
137
121
|
</div>
|
|
@@ -227,45 +227,17 @@ onMount(() => {
|
|
|
227
227
|
|
|
228
228
|
<section class="flex flex-col gap-3">
|
|
229
229
|
<div class="grid gap-3 grid-cols-1 sm:grid-cols-2 xl:grid-cols-5">
|
|
230
|
-
<
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
</label>
|
|
235
|
-
<label>
|
|
236
|
-
<span class="sr-only">Tax status</span>
|
|
237
|
-
<select x-model="statusFilter" class="px-3 py-2 w-full text-gray-900 text-sm dark:text-white bg-white dark:bg-neutral-800 border border-gray-300 rounded-md dark:border-neutral-700">
|
|
238
|
-
<option value="all">All statuses</option>
|
|
239
|
-
<option value="active">Active</option>
|
|
240
|
-
<option value="inactive">Inactive</option>
|
|
241
|
-
</select>
|
|
242
|
-
</label>
|
|
243
|
-
<label>
|
|
244
|
-
<span class="sr-only">Tax country</span>
|
|
245
|
-
<select x-model="countryFilter" class="px-3 py-2 w-full text-gray-900 text-sm dark:text-white bg-white dark:bg-neutral-800 border border-gray-300 rounded-md dark:border-neutral-700">
|
|
246
|
-
<option value="all">All countries</option>
|
|
247
|
-
<option :for="country in countries()" :key="country" :value="country">{{ country }}</option>
|
|
248
|
-
</select>
|
|
249
|
-
</label>
|
|
250
|
-
<label>
|
|
251
|
-
<span class="sr-only">Tax type</span>
|
|
252
|
-
<select x-model="typeFilter" class="px-3 py-2 w-full text-gray-900 text-sm dark:text-white bg-white dark:bg-neutral-800 border border-gray-300 rounded-md dark:border-neutral-700">
|
|
253
|
-
<option value="all">All tax types</option>
|
|
254
|
-
<option :for="type in taxTypes()" :key="type" :value="type">{{ taxTypeLabel(type) }}</option>
|
|
255
|
-
</select>
|
|
256
|
-
</label>
|
|
230
|
+
<div class="sm:col-span-2"><SearchFilter v-model:searchValue="search" placeholder="Search tax rates" ariaLabel="Search tax rates" /></div>
|
|
231
|
+
<Select v-model:value="statusFilter" ariaLabel="Tax status" placeholder="" :options="[{ value: 'all', label: 'All statuses' }, { value: 'active', label: 'Active' }, { value: 'inactive', label: 'Inactive' }]" />
|
|
232
|
+
<Select v-model:value="countryFilter" ariaLabel="Tax country" placeholder="" :options="[{ value: 'all', label: 'All countries' }, ...countries().map(country => ({ value: country, label: country }))]" />
|
|
233
|
+
<Select v-model:value="typeFilter" ariaLabel="Tax type" placeholder="" :options="[{ value: 'all', label: 'All tax types' }, ...taxTypes().map(type => ({ value: type, label: taxTypeLabel(type) }))]" />
|
|
257
234
|
</div>
|
|
258
235
|
|
|
259
236
|
<div class="flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between">
|
|
260
237
|
<p class="text-gray-500 text-sm dark:text-neutral-400">{{ visibleRecords().length }} matching tax rates</p>
|
|
261
238
|
<label class="flex gap-2 items-center text-gray-500 text-sm dark:text-neutral-400">
|
|
262
239
|
Sort
|
|
263
|
-
<
|
|
264
|
-
<option value="name">Name</option>
|
|
265
|
-
<option value="rate">Highest rate</option>
|
|
266
|
-
<option value="country">Country</option>
|
|
267
|
-
<option value="newest">Newest</option>
|
|
268
|
-
</select>
|
|
240
|
+
<Select v-model:value="sort" ariaLabel="Sort" size="sm" placeholder="" :options="[{ value: 'name', label: 'Name' }, { value: 'rate', label: 'Highest rate' }, { value: 'country', label: 'Country' }, { value: 'newest', label: 'Newest' }]" />
|
|
269
241
|
</label>
|
|
270
242
|
</div>
|
|
271
243
|
|
|
@@ -14,7 +14,7 @@ const emit = defineEmits(['submit', 'close'])
|
|
|
14
14
|
const name = state('')
|
|
15
15
|
const abbreviation = state('')
|
|
16
16
|
const type = state('')
|
|
17
|
-
const
|
|
17
|
+
const descriptionText = state('')
|
|
18
18
|
const productId = state('')
|
|
19
19
|
const isDefault = state(false)
|
|
20
20
|
let hydrationKey = ''
|
|
@@ -83,7 +83,7 @@ effect(() => {
|
|
|
83
83
|
name.set(current?.name || '')
|
|
84
84
|
abbreviation.set(current?.abbreviation || '')
|
|
85
85
|
type.set(current?.type || '')
|
|
86
|
-
|
|
86
|
+
descriptionText.set(current?.description || '')
|
|
87
87
|
productId.set(current?.productId || '')
|
|
88
88
|
isDefault.set(current?.isDefault || false)
|
|
89
89
|
productQuery.set('')
|
|
@@ -97,7 +97,7 @@ function submit(): void {
|
|
|
97
97
|
name: name().trim(),
|
|
98
98
|
abbreviation: abbreviation().trim(),
|
|
99
99
|
type: type().trim(),
|
|
100
|
-
description:
|
|
100
|
+
description: descriptionText().trim(),
|
|
101
101
|
productId: productId() ? Number(productId()) : null,
|
|
102
102
|
isDefault: isDefault(),
|
|
103
103
|
})
|
|
@@ -121,37 +121,23 @@ function errorMessages(): string[] {
|
|
|
121
121
|
</ul>
|
|
122
122
|
<div class="space-y-4">
|
|
123
123
|
<div class="grid gap-4 sm:grid-cols-2">
|
|
124
|
-
<label
|
|
125
|
-
|
|
126
|
-
<input x-model="name" type="text" maxlength="100" required class="mt-1 px-3 py-2 w-full text-gray-900 text-sm dark:text-white bg-white dark:bg-neutral-900 border border-gray-300 rounded-md dark:border-neutral-700" />
|
|
127
|
-
</label>
|
|
128
|
-
<label class="block">
|
|
129
|
-
<span class="font-medium text-gray-700 text-sm dark:text-neutral-200">Abbreviation</span>
|
|
130
|
-
<input x-model="abbreviation" type="text" maxlength="10" required class="mt-1 px-3 py-2 w-full text-gray-900 text-sm dark:text-white bg-white dark:bg-neutral-900 border border-gray-300 rounded-md dark:border-neutral-700" />
|
|
131
|
-
</label>
|
|
124
|
+
<Input v-model:value="name" label="Name" :maxLength="100" :required="true" />
|
|
125
|
+
<Input v-model:value="abbreviation" label="Abbreviation" :maxLength="10" :required="true" />
|
|
132
126
|
</div>
|
|
133
|
-
<label class="block">
|
|
134
|
-
<span class="font-medium text-gray-700 text-sm dark:text-neutral-200">Type</span>
|
|
135
|
-
<input x-model="type" type="text" list="product-unit-types" required class="mt-1 px-3 py-2 w-full text-gray-900 text-sm dark:text-white bg-white dark:bg-neutral-900 border border-gray-300 rounded-md dark:border-neutral-700" />
|
|
136
|
-
<datalist id="product-unit-types">
|
|
137
|
-
<option :for="unitType in types()" :key="unitType" :value="unitType"></option>
|
|
138
|
-
</datalist>
|
|
139
|
-
</label>
|
|
140
|
-
<label class="block">
|
|
141
|
-
<span class="font-medium text-gray-700 text-sm dark:text-neutral-200">Product</span>
|
|
142
|
-
<input x-model="productQuery" @input="searchProductsSoon()" type="search" name="product_search" aria-label="Search products by name or id" placeholder="Search by name or id" class="mt-1 px-3 py-2 w-full text-gray-900 text-sm dark:text-white bg-white dark:bg-neutral-900 border border-gray-300 rounded-md dark:border-neutral-700" />
|
|
143
|
-
</label>
|
|
144
127
|
<div>
|
|
145
|
-
<
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
128
|
+
<Input v-model:value="type" label="Type" list="product-unit-types" :required="true" />
|
|
129
|
+
<datalist id="product-unit-types"><option :for="unitType in types()" :key="unitType" :value="unitType"></option></datalist>
|
|
130
|
+
</div>
|
|
131
|
+
<div>
|
|
132
|
+
<Input v-model:value="productQuery" label="Product" type="search" name="product_search" ariaLabel="Search products by name or id" placeholder="Search by name or id" @input="searchProductsSoon()" />
|
|
133
|
+
</div>
|
|
134
|
+
<div>
|
|
135
|
+
<Select v-model:value="productId" ariaLabel="Product" placeholder="" :options="[{ value: '', label: 'Unassigned' }, ...products().map(product => ({ value: product.id, label: product.label }))]" />
|
|
149
136
|
<p :if="moreProductsLabel()" class="mt-1 text-gray-500 text-xs dark:text-neutral-400" :text="moreProductsLabel()"></p>
|
|
150
137
|
</div>
|
|
151
|
-
<
|
|
152
|
-
<
|
|
153
|
-
|
|
154
|
-
</label>
|
|
138
|
+
<div>
|
|
139
|
+
<Textarea v-model:value="descriptionText" label="Description" :rows="3" :maxLength="255" />
|
|
140
|
+
</div>
|
|
155
141
|
<div class="p-3 border border-gray-200 rounded-lg dark:border-neutral-700">
|
|
156
142
|
<Toggle v-model:checked="isDefault" label="Default for this type" description="Selecting this clears any other default in the same unit type." labelPosition="left" />
|
|
157
143
|
</div>
|
|
@@ -215,40 +215,16 @@ onMount(() => {
|
|
|
215
215
|
|
|
216
216
|
<section class="flex flex-col gap-3">
|
|
217
217
|
<div class="grid gap-3 grid-cols-1 sm:grid-cols-2 xl:grid-cols-4">
|
|
218
|
-
<
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
<span class="h-4 w-4 i-hugeicons-search-01"></span>
|
|
222
|
-
</span>
|
|
223
|
-
<input x-model="search" type="search" placeholder="Search product units" class="pl-9 pr-3 py-2 w-full text-gray-900 text-sm dark:text-white bg-white dark:bg-neutral-800 border border-gray-300 rounded-md dark:border-neutral-700" />
|
|
224
|
-
</label>
|
|
225
|
-
<label>
|
|
226
|
-
<span class="sr-only">Unit type</span>
|
|
227
|
-
<select x-model="typeFilter" class="px-3 py-2 w-full text-gray-900 text-sm dark:text-white bg-white dark:bg-neutral-800 border border-gray-300 rounded-md dark:border-neutral-700">
|
|
228
|
-
<option value="all">All unit types</option>
|
|
229
|
-
<option :for="type in unitTypes()" :key="type" :value="type">{{ type }}</option>
|
|
230
|
-
</select>
|
|
231
|
-
</label>
|
|
232
|
-
<label>
|
|
233
|
-
<span class="sr-only">Default state</span>
|
|
234
|
-
<select x-model="defaultFilter" class="px-3 py-2 w-full text-gray-900 text-sm dark:text-white bg-white dark:bg-neutral-800 border border-gray-300 rounded-md dark:border-neutral-700">
|
|
235
|
-
<option value="all">All units</option>
|
|
236
|
-
<option value="default">Defaults only</option>
|
|
237
|
-
<option value="not-default">Not default</option>
|
|
238
|
-
</select>
|
|
239
|
-
</label>
|
|
218
|
+
<div class="sm:col-span-2"><SearchFilter v-model:searchValue="search" placeholder="Search product units" ariaLabel="Search product units" /></div>
|
|
219
|
+
<Select v-model:value="typeFilter" ariaLabel="Unit type" placeholder="" :options="[{ value: 'all', label: 'All unit types' }, ...unitTypes().map(type => ({ value: type, label: type }))]" />
|
|
220
|
+
<Select v-model:value="defaultFilter" ariaLabel="Default state" placeholder="" :options="[{ value: 'all', label: 'All units' }, { value: 'default', label: 'Defaults only' }, { value: 'not-default', label: 'Not default' }]" />
|
|
240
221
|
</div>
|
|
241
222
|
|
|
242
223
|
<div class="flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between">
|
|
243
224
|
<p class="text-gray-500 text-sm dark:text-neutral-400">{{ matchingLabel() }}</p>
|
|
244
225
|
<label class="flex gap-2 items-center text-gray-500 text-sm dark:text-neutral-400">
|
|
245
226
|
Sort
|
|
246
|
-
<
|
|
247
|
-
<option value="name">Name</option>
|
|
248
|
-
<option value="type">Type</option>
|
|
249
|
-
<option value="product">Product</option>
|
|
250
|
-
<option value="newest">Newest</option>
|
|
251
|
-
</select>
|
|
227
|
+
<Select v-model:value="sort" ariaLabel="Sort" size="sm" placeholder="" :options="[{ value: 'name', label: 'Name' }, { value: 'type', label: 'Type' }, { value: 'product', label: 'Product' }, { value: 'newest', label: 'Newest' }]" />
|
|
252
228
|
</label>
|
|
253
229
|
</div>
|
|
254
230
|
|
|
@@ -13,7 +13,7 @@ const errors = useReactiveProp('errors', {} as Record<string, string>)
|
|
|
13
13
|
const emit = defineEmits(['submit', 'close'])
|
|
14
14
|
const variant = state('')
|
|
15
15
|
const type = state('')
|
|
16
|
-
const
|
|
16
|
+
const descriptionText = state('')
|
|
17
17
|
const options = state('')
|
|
18
18
|
const status = state<'active' | 'inactive' | 'draft'>('active')
|
|
19
19
|
const productId = state('')
|
|
@@ -82,7 +82,7 @@ effect(() => {
|
|
|
82
82
|
hydrationKey = key
|
|
83
83
|
variant.set(current?.variant || '')
|
|
84
84
|
type.set(current?.type || '')
|
|
85
|
-
|
|
85
|
+
descriptionText.set(current?.description || '')
|
|
86
86
|
options.set(current?.options.join(', ') || '')
|
|
87
87
|
status.set(current?.status || 'active')
|
|
88
88
|
productId.set(current?.productId || '')
|
|
@@ -96,7 +96,7 @@ function submit(): void {
|
|
|
96
96
|
emit('submit', {
|
|
97
97
|
variant: variant().trim(),
|
|
98
98
|
type: type().trim(),
|
|
99
|
-
description:
|
|
99
|
+
description: descriptionText().trim(),
|
|
100
100
|
options: options().split(/[,\n]/).map(option => option.trim()).filter(Boolean),
|
|
101
101
|
status: status(),
|
|
102
102
|
productId: productId() ? Number(productId()) : null,
|
|
@@ -121,13 +121,19 @@ function errorMessages(): string[] {
|
|
|
121
121
|
</ul>
|
|
122
122
|
<div class="space-y-4">
|
|
123
123
|
<div class="grid gap-4 sm:grid-cols-2">
|
|
124
|
-
<
|
|
125
|
-
<
|
|
124
|
+
<Input v-model:value="variant" label="Variant" :maxLength="100" :required="true" />
|
|
125
|
+
<div><Input v-model:value="type" label="Type" list="product-variant-types" :maxLength="50" :required="true" /><datalist id="product-variant-types"><option :for="variantType in types()" :key="variantType" :value="variantType"></option></datalist></div>
|
|
126
|
+
</div>
|
|
127
|
+
<div><Input v-model:value="productQuery" label="Product" type="search" name="product_search" ariaLabel="Search products by name or id" placeholder="Search by name or id" @input="searchProductsSoon()" /><div class="mt-2"><Select v-model:value="productId" ariaLabel="Product" placeholder="" :options="[{ value: '', label: 'Unassigned' }, ...products().map(product => ({ value: product.id, label: product.label }))]" /></div><p :if="moreProductsLabel()" class="mt-1 text-gray-500 text-xs dark:text-neutral-400" :text="moreProductsLabel()"></p></div>
|
|
128
|
+
<div>
|
|
129
|
+
<Textarea v-model:value="descriptionText" label="Description" :rows="3" />
|
|
130
|
+
</div>
|
|
131
|
+
<div>
|
|
132
|
+
<Textarea v-model:value="options" label="Options" :rows="3" placeholder="Small, Medium, Large" hint="Separate options with commas or new lines." />
|
|
133
|
+
</div>
|
|
134
|
+
<div>
|
|
135
|
+
<Select v-model:value="status" label="Status" placeholder="" :options="[{ value: 'active', label: 'Active' }, { value: 'inactive', label: 'Inactive' }, { value: 'draft', label: 'Draft' }]" />
|
|
126
136
|
</div>
|
|
127
|
-
<div><label class="block"><span class="font-medium text-gray-700 text-sm dark:text-neutral-200">Product</span><input x-model="productQuery" @input="searchProductsSoon()" type="search" name="product_search" aria-label="Search products by name or id" placeholder="Search by name or id" class="mt-1 px-3 py-2 w-full text-gray-900 text-sm dark:text-white bg-white dark:bg-neutral-900 border border-gray-300 rounded-md dark:border-neutral-700" /></label><select x-model="productId" aria-label="Product" class="mt-2 px-3 py-2 w-full text-gray-900 text-sm dark:text-white bg-white dark:bg-neutral-900 border border-gray-300 rounded-md dark:border-neutral-700"><option value="">Unassigned</option><option :for="product in products()" :key="product.id" :value="product.id" :selected="product.id === productId()">{{ product.label }}</option></select><p :if="moreProductsLabel()" class="mt-1 text-gray-500 text-xs dark:text-neutral-400" :text="moreProductsLabel()"></p></div>
|
|
128
|
-
<label class="block"><span class="font-medium text-gray-700 text-sm dark:text-neutral-200">Description</span><textarea x-model="description" rows="3" class="mt-1 px-3 py-2 w-full text-gray-900 text-sm dark:text-white bg-white dark:bg-neutral-900 border border-gray-300 rounded-md dark:border-neutral-700"></textarea></label>
|
|
129
|
-
<label class="block"><span class="font-medium text-gray-700 text-sm dark:text-neutral-200">Options</span><textarea x-model="options" rows="3" placeholder="Small, Medium, Large" class="mt-1 px-3 py-2 w-full text-gray-900 text-sm dark:text-white bg-white dark:bg-neutral-900 border border-gray-300 rounded-md dark:border-neutral-700"></textarea><span class="block mt-1 text-gray-500 text-xs dark:text-neutral-400">Separate options with commas or new lines.</span></label>
|
|
130
|
-
<label class="block"><span class="font-medium text-gray-700 text-sm dark:text-neutral-200">Status</span><select x-model="status" class="mt-1 px-3 py-2 w-full text-gray-900 text-sm dark:text-white bg-white dark:bg-neutral-900 border border-gray-300 rounded-md dark:border-neutral-700"><option value="active">Active</option><option value="inactive">Inactive</option><option value="draft">Draft</option></select></label>
|
|
131
137
|
</div>
|
|
132
138
|
</form>
|
|
133
139
|
<template #footer>
|