@stacksjs/defaults 0.75.528 → 0.75.535

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.
Files changed (248) hide show
  1. package/ai/skills/stacks-actions/SKILL.md +1 -1
  2. package/ai/skills/stacks-build/SKILL.md +1 -1
  3. package/ai/skills/stacks-dashboard/SKILL.md +2 -2
  4. package/ai/skills/stacks-database/SKILL.md +1 -1
  5. package/ai/skills/stacks-migrations/SKILL.md +2 -2
  6. package/ai/skills/stacks-native/CATALOG.md +4 -4
  7. package/app/Actions/Dashboard/Commerce/CommerceCouponsAction.ts +27 -15
  8. package/app/Actions/Dashboard/Commerce/CommerceCouponsExportAction.ts +45 -0
  9. package/app/Actions/Dashboard/Commerce/CommerceCustomersAction.ts +22 -12
  10. package/app/Actions/Dashboard/Commerce/CommerceCustomersExportAction.ts +44 -0
  11. package/app/Actions/Dashboard/Commerce/CommercePosCheckoutAction.ts +9 -29
  12. package/app/Actions/Dashboard/Commerce/CommercePrintDevicesAction.ts +7 -9
  13. package/app/Actions/Dashboard/Commerce/CommerceProductDetailAction.ts +9 -8
  14. package/app/Actions/Dashboard/Commerce/CommerceTaxesAction.ts +7 -9
  15. package/app/Actions/Dashboard/Commerce/ManufacturerIndexAction.ts +8 -20
  16. package/app/Actions/Dashboard/Commerce/commerce-coupon-list.test.ts +203 -0
  17. package/app/Actions/Dashboard/Commerce/commerce-coupon-list.ts +248 -0
  18. package/app/Actions/Dashboard/Commerce/commerce-customer-list.test.ts +183 -0
  19. package/app/Actions/Dashboard/Commerce/commerce-customer-list.ts +186 -0
  20. package/app/Actions/Dashboard/Commerce/commerce-customer-records.test.ts +1 -34
  21. package/app/Actions/Dashboard/Commerce/commerce-customer-records.ts +0 -11
  22. package/app/Actions/Dashboard/Commerce/commerce-manufacturer-list.test.ts +118 -0
  23. package/app/Actions/Dashboard/Commerce/commerce-manufacturer-list.ts +41 -0
  24. package/app/Actions/Dashboard/Commerce/commerce-pos-catalog.test.ts +17 -5
  25. package/app/Actions/Dashboard/Commerce/commerce-pos-catalog.ts +17 -3
  26. package/app/Actions/Dashboard/Commerce/commerce-print-device-list.test.ts +99 -0
  27. package/app/Actions/Dashboard/Commerce/commerce-print-device-list.ts +18 -0
  28. package/app/Actions/Dashboard/Commerce/commerce-product-list.ts +5 -5
  29. package/app/Actions/Dashboard/Commerce/commerce-product-options.test.ts +81 -0
  30. package/app/Actions/Dashboard/Commerce/commerce-tax-rate-list.test.ts +99 -0
  31. package/app/Actions/Dashboard/Commerce/commerce-tax-rate-list.ts +18 -0
  32. package/app/Actions/Dashboard/Commerce/coupon-records.test.ts +1 -16
  33. package/app/Actions/Dashboard/Commerce/coupon-records.ts +6 -10
  34. package/app/Actions/Dashboard/Commerce/manufacturer-records.test.ts +5 -17
  35. package/app/Actions/Dashboard/Commerce/manufacturer-records.ts +0 -29
  36. package/app/Actions/Dashboard/Email/captured-mail.test.ts +16 -0
  37. package/app/Actions/Dashboard/Email/captured-mail.ts +9 -1
  38. package/app/Actions/Dashboard/Models/model-write.ts +36 -3
  39. package/app/Actions/Dashboard/Notifications/NotificationDeliveryHistoryAction.ts +13 -58
  40. package/app/Actions/Dashboard/Notifications/notification-delivery-history.ts +74 -0
  41. package/app/Actions/SitemapAction.ts +3 -1
  42. package/app/Models/Notification.ts +3 -1
  43. package/app/Models/NotificationDelivery.ts +4 -0
  44. package/app/Models/User.ts +10 -1
  45. package/bootstrap.ts +10 -2
  46. package/functions/commerce/tax-types.ts +21 -0
  47. package/functions/dashboard-list.test.ts +16 -0
  48. package/functions/dashboard-list.ts +14 -6
  49. package/functions/dashboard-model-record.test.ts +139 -0
  50. package/functions/dashboard-model-record.ts +353 -0
  51. package/functions/monitoring/errors.ts +22 -103
  52. package/functions/notifications/deliveries.ts +7 -38
  53. package/functions/queries.ts +7 -10
  54. package/ide/vscode/package.json +1 -1
  55. package/package.json +5 -5
  56. package/resources/components/Dashboard/Analytics/AnalyticsHub.stx +2 -2
  57. package/resources/components/Dashboard/Analytics/CampaignAnalytics.stx +22 -28
  58. package/resources/components/Dashboard/Analytics/EventAnalytics.stx +26 -34
  59. package/resources/components/Dashboard/Analytics/SalesAnalytics.stx +29 -37
  60. package/resources/components/Dashboard/Analytics/WebAnalyticsBreakdown.stx +12 -16
  61. package/resources/components/Dashboard/Analytics/WebAnalyticsDashboard.stx +43 -53
  62. package/resources/components/Dashboard/App/RequestsOverview.stx +2 -1
  63. package/resources/components/Dashboard/App/SourceInventory.stx +2 -1
  64. package/resources/components/Dashboard/Auth/AccessTokens.stx +3 -5
  65. package/resources/components/Dashboard/Billing/BillingPaymentMethodsPanel.stx +9 -11
  66. package/resources/components/Dashboard/Billing/BillingSettings.stx +1 -1
  67. package/resources/components/Dashboard/Buddy/BuddyAssistant.stx +4 -6
  68. package/resources/components/Dashboard/Commerce/CommerceCategoriesDashboard.stx +2 -2
  69. package/resources/components/Dashboard/Commerce/CommerceCategoriesTable.stx +3 -3
  70. package/resources/components/Dashboard/Commerce/CommerceCategoryDialog.stx +2 -2
  71. package/resources/components/Dashboard/Commerce/CommerceCategoryHierarchy.stx +3 -5
  72. package/resources/components/Dashboard/Commerce/CommerceCouponBreakdown.stx +17 -13
  73. package/resources/components/Dashboard/Commerce/CommerceCouponDialog.stx +1 -1
  74. package/resources/components/Dashboard/Commerce/CommerceCouponsDashboard.stx +57 -85
  75. package/resources/components/Dashboard/Commerce/CommerceCouponsTable.stx +32 -9
  76. package/resources/components/Dashboard/Commerce/CommerceCustomerDialog.stx +1 -1
  77. package/resources/components/Dashboard/Commerce/CommerceCustomersDashboard.stx +49 -83
  78. package/resources/components/Dashboard/Commerce/CommerceCustomersTable.stx +32 -9
  79. package/resources/components/Dashboard/Commerce/CommerceGiftCardBreakdown.stx +9 -15
  80. package/resources/components/Dashboard/Commerce/CommerceGiftCardDialog.stx +1 -1
  81. package/resources/components/Dashboard/Commerce/CommerceGiftCardsDashboard.stx +35 -119
  82. package/resources/components/Dashboard/Commerce/CommerceGiftCardsTable.stx +3 -3
  83. package/resources/components/Dashboard/Commerce/CommerceManufacturerDialog.stx +1 -1
  84. package/resources/components/Dashboard/Commerce/CommerceManufacturersDashboard.stx +3 -5
  85. package/resources/components/Dashboard/Commerce/CommerceManufacturersTable.stx +2 -2
  86. package/resources/components/Dashboard/Commerce/CommerceOrderDialog.stx +4 -4
  87. package/resources/components/Dashboard/Commerce/CommerceOrdersDashboard.stx +42 -129
  88. package/resources/components/Dashboard/Commerce/CommerceOrdersTable.stx +3 -3
  89. package/resources/components/Dashboard/Commerce/CommerceOverviewDashboard.stx +1 -1
  90. package/resources/components/Dashboard/Commerce/CommerceOverviewOrdersTable.stx +9 -11
  91. package/resources/components/Dashboard/Commerce/CommerceOverviewProductsTable.stx +5 -7
  92. package/resources/components/Dashboard/Commerce/CommerceOverviewStats.stx +14 -16
  93. package/resources/components/Dashboard/Commerce/CommercePaymentsBreakdown.stx +12 -18
  94. package/resources/components/Dashboard/Commerce/CommercePaymentsDashboard.stx +41 -120
  95. package/resources/components/Dashboard/Commerce/CommercePaymentsTable.stx +1 -1
  96. package/resources/components/Dashboard/Commerce/CommercePosCart.stx +13 -15
  97. package/resources/components/Dashboard/Commerce/CommercePosCatalog.stx +17 -19
  98. package/resources/components/Dashboard/Commerce/CommercePosCheckoutDialog.stx +2 -2
  99. package/resources/components/Dashboard/Commerce/CommercePosDashboard.stx +1 -1
  100. package/resources/components/Dashboard/Commerce/CommercePosReceiptDialog.stx +1 -1
  101. package/resources/components/Dashboard/Commerce/CommerceProductDetailDashboard.stx +5 -5
  102. package/resources/components/Dashboard/Commerce/CommerceProductDialog.stx +3 -3
  103. package/resources/components/Dashboard/Commerce/CommerceProductsDashboard.stx +41 -122
  104. package/resources/components/Dashboard/Commerce/CommerceProductsTable.stx +3 -3
  105. package/resources/components/Dashboard/Commerce/CommerceReviewEditDialog.stx +1 -1
  106. package/resources/components/Dashboard/Commerce/CommerceReviewsDashboard.stx +38 -122
  107. package/resources/components/Dashboard/Commerce/CommerceReviewsTable.stx +2 -2
  108. package/resources/components/Dashboard/Commerce/CommerceTaxDialog.stx +3 -3
  109. package/resources/components/Dashboard/Commerce/CommerceTaxesDashboard.stx +5 -4
  110. package/resources/components/Dashboard/Commerce/CommerceTaxesTable.stx +4 -3
  111. package/resources/components/Dashboard/Commerce/CommerceUnitDialog.stx +3 -7
  112. package/resources/components/Dashboard/Commerce/CommerceUnitsDashboard.stx +3 -5
  113. package/resources/components/Dashboard/Commerce/CommerceUnitsTable.stx +2 -2
  114. package/resources/components/Dashboard/Commerce/CommerceVariantDialog.stx +3 -3
  115. package/resources/components/Dashboard/Commerce/CommerceVariantsDashboard.stx +4 -4
  116. package/resources/components/Dashboard/Commerce/CommerceVariantsTable.stx +3 -5
  117. package/resources/components/Dashboard/Commerce/Delivery/CourierDialog.stx +1 -1
  118. package/resources/components/Dashboard/Commerce/Delivery/CouriersDashboard.stx +1 -1
  119. package/resources/components/Dashboard/Commerce/Delivery/CouriersTable.stx +2 -2
  120. package/resources/components/Dashboard/Commerce/Delivery/DeliveryOverviewDashboard.stx +44 -52
  121. package/resources/components/Dashboard/Commerce/Delivery/DeliveryPagination.stx +2 -2
  122. package/resources/components/Dashboard/Commerce/Delivery/DeliveryRouteDialog.stx +1 -1
  123. package/resources/components/Dashboard/Commerce/Delivery/DeliveryRoutesDashboard.stx +1 -1
  124. package/resources/components/Dashboard/Commerce/Delivery/DeliveryRoutesTable.stx +2 -2
  125. package/resources/components/Dashboard/Commerce/Delivery/DigitalDeliveriesDashboard.stx +1 -1
  126. package/resources/components/Dashboard/Commerce/Delivery/DigitalDeliveryTable.stx +2 -2
  127. package/resources/components/Dashboard/Commerce/Delivery/LicenseKeyDialog.stx +3 -3
  128. package/resources/components/Dashboard/Commerce/Delivery/LicenseKeysDashboard.stx +1 -1
  129. package/resources/components/Dashboard/Commerce/Delivery/LicenseKeysTable.stx +2 -2
  130. package/resources/components/Dashboard/Commerce/Delivery/ShippingMethodsDashboard.stx +1 -1
  131. package/resources/components/Dashboard/Commerce/Delivery/ShippingMethodsTable.stx +2 -2
  132. package/resources/components/Dashboard/Commerce/Delivery/ShippingRateDialog.stx +2 -2
  133. package/resources/components/Dashboard/Commerce/Delivery/ShippingRatesDashboard.stx +1 -1
  134. package/resources/components/Dashboard/Commerce/Delivery/ShippingRatesTable.stx +2 -2
  135. package/resources/components/Dashboard/Commerce/Delivery/ShippingZoneDialog.stx +1 -1
  136. package/resources/components/Dashboard/Commerce/Delivery/ShippingZonesDashboard.stx +1 -1
  137. package/resources/components/Dashboard/Commerce/Delivery/ShippingZonesTable.stx +4 -8
  138. package/resources/components/Dashboard/Commerce/PaymentDetailsDialog.stx +1 -3
  139. package/resources/components/Dashboard/Commerce/PrintDeviceBreakdown.stx +9 -15
  140. package/resources/components/Dashboard/Commerce/PrintDeviceDialog.stx +1 -1
  141. package/resources/components/Dashboard/Commerce/PrintDevicesDashboard.stx +3 -3
  142. package/resources/components/Dashboard/Commerce/PrintDevicesTable.stx +3 -3
  143. package/resources/components/Dashboard/Commerce/PrintLogBreakdown.stx +3 -9
  144. package/resources/components/Dashboard/Commerce/PrintLogDetailsDialog.stx +1 -1
  145. package/resources/components/Dashboard/Commerce/PrintLogsDashboard.stx +4 -4
  146. package/resources/components/Dashboard/Commerce/PrintLogsTable.stx +8 -10
  147. package/resources/components/Dashboard/Commerce/ProductWaitlistDashboard.stx +37 -109
  148. package/resources/components/Dashboard/Commerce/ProductWaitlistEntryDialog.stx +3 -3
  149. package/resources/components/Dashboard/Commerce/ProductWaitlistTable.stx +2 -2
  150. package/resources/components/Dashboard/Commerce/RestaurantWaitlistDashboard.stx +38 -112
  151. package/resources/components/Dashboard/Commerce/RestaurantWaitlistEntryDialog.stx +2 -2
  152. package/resources/components/Dashboard/Commerce/RestaurantWaitlistTable.stx +2 -2
  153. package/resources/components/Dashboard/Content/AuthorsDashboard.stx +4 -4
  154. package/resources/components/Dashboard/Content/BlogDashboard.stx +4 -4
  155. package/resources/components/Dashboard/Content/CommentsDashboard.stx +36 -83
  156. package/resources/components/Dashboard/Content/ContentDashboard.stx +12 -14
  157. package/resources/components/Dashboard/Content/ContentTaxonomyDashboard.stx +2 -2
  158. package/resources/components/Dashboard/Content/FileManagerDashboard.stx +8 -12
  159. package/resources/components/Dashboard/Content/FileStoragePanel.stx +6 -10
  160. package/resources/components/Dashboard/Content/FileUploadDialog.stx +1 -3
  161. package/resources/components/Dashboard/Content/PagesDashboard.stx +39 -78
  162. package/resources/components/Dashboard/Content/PostEditorDialog.stx +4 -8
  163. package/resources/components/Dashboard/Content/PostsDashboard.stx +44 -85
  164. package/resources/components/Dashboard/Content/SeoDashboard.stx +5 -4
  165. package/resources/components/Dashboard/Data/DataRecords.stx +140 -12
  166. package/resources/components/Dashboard/Deployments/DeploymentList.stx +4 -4
  167. package/resources/components/Dashboard/Deployments/DeploymentTable.stx +3 -1
  168. package/resources/components/Dashboard/Elements/DropdownNavigation.stx +5 -7
  169. package/resources/components/Dashboard/Email/CapturedMailDashboard.stx +1 -3
  170. package/resources/components/Dashboard/Email/CapturedMailList.stx +18 -20
  171. package/resources/components/Dashboard/Email/EmailActivityDashboard.stx +24 -28
  172. package/resources/components/Dashboard/Email/EmailSettingsList.stx +6 -8
  173. package/resources/components/Dashboard/Email/EmailSettingsNavigation.stx +10 -12
  174. package/resources/components/Dashboard/Email/EmailSidebar.stx +33 -37
  175. package/resources/components/Dashboard/Email/InboxMessageDetail.stx +1 -1
  176. package/resources/components/Dashboard/Email/InboxMessageList.stx +16 -18
  177. package/resources/components/Dashboard/Email/InboxSettingsDashboard.stx +1 -1
  178. package/resources/components/Dashboard/Environment/EnvironmentDashboard.stx +2 -2
  179. package/resources/components/Dashboard/GlobalSearch.stx +19 -21
  180. package/resources/components/Dashboard/Home/DashboardHome.stx +8 -1
  181. package/resources/components/Dashboard/Infrastructure/CloudDashboard.stx +1 -1
  182. package/resources/components/Dashboard/Infrastructure/DnsDashboard.stx +27 -13
  183. package/resources/components/Dashboard/Infrastructure/LogsDashboard.stx +1 -1
  184. package/resources/components/Dashboard/Infrastructure/MailboxesDashboard.stx +46 -8
  185. package/resources/components/Dashboard/Infrastructure/ServerlessDashboard.stx +1 -1
  186. package/resources/components/Dashboard/Infrastructure/ServersDashboard.stx +1 -1
  187. package/resources/components/Dashboard/Jobs/JobDetail.stx +1 -1
  188. package/resources/components/Dashboard/Jobs/JobHistory.stx +44 -57
  189. package/resources/components/Dashboard/Jobs/JobTable.stx +23 -25
  190. package/resources/components/Dashboard/Kanban/KanbanCardDialog.stx +1 -1
  191. package/resources/components/Dashboard/Library/ComponentsDashboard.stx +1 -1
  192. package/resources/components/Dashboard/Management/AssignmentDrawer.stx +5 -7
  193. package/resources/components/Dashboard/Management/PermissionsDashboard.stx +35 -43
  194. package/resources/components/Dashboard/Marketing/AbandonedCartsDashboard.stx +11 -13
  195. package/resources/components/Dashboard/Marketing/CampaignDialog.stx +1 -3
  196. package/resources/components/Dashboard/Marketing/CampaignsDashboard.stx +2 -2
  197. package/resources/components/Dashboard/Marketing/CampaignsTable.stx +2 -2
  198. package/resources/components/Dashboard/Marketing/MarketingListsDashboard.stx +1 -1
  199. package/resources/components/Dashboard/Marketing/MarketingListsTable.stx +2 -2
  200. package/resources/components/Dashboard/Marketing/SocialPostDialog.stx +1 -3
  201. package/resources/components/Dashboard/Marketing/SocialPostsDashboard.stx +2 -2
  202. package/resources/components/Dashboard/Marketing/SocialPostsTable.stx +2 -2
  203. package/resources/components/Dashboard/Models/ModelRecordActions.stx +11 -2
  204. package/resources/components/Dashboard/Models/ModelRecordCreate.stx +193 -0
  205. package/resources/components/Dashboard/Models/ModelRecordDetail.stx +144 -0
  206. package/resources/components/Dashboard/Models/ModelRecordEdit.stx +176 -0
  207. package/resources/components/Dashboard/Models/ModelRecordsDashboard.stx +52 -186
  208. package/resources/components/Dashboard/Models/ModelsOverview.stx +2 -4
  209. package/resources/components/Dashboard/Monitoring/ErrorDashboard.stx +47 -81
  210. package/resources/components/Dashboard/Monitoring/ErrorTable.stx +4 -2
  211. package/resources/components/Dashboard/NotFoundDashboard.stx +4 -4
  212. package/resources/components/Dashboard/Notifications/NotificationDeliveryHistory.stx +43 -77
  213. package/resources/components/Dashboard/Notifications/NotificationDeliveryOverview.stx +15 -17
  214. package/resources/components/Dashboard/Notifications/NotificationDeliveryTable.stx +1 -1
  215. package/resources/components/Dashboard/Operations/AuditDashboard.stx +1 -1
  216. package/resources/components/Dashboard/Operations/ChangeDashboard.stx +1 -1
  217. package/resources/components/Dashboard/Operations/IncidentDashboard.stx +1 -1
  218. package/resources/components/Dashboard/Operations/MigrationDashboard.stx +2 -2
  219. package/resources/components/Dashboard/Operations/RecoveryDashboard.stx +1 -1
  220. package/resources/components/Dashboard/Operations/SchedulerDashboard.stx +1 -1
  221. package/resources/components/Dashboard/Queries/QueryDashboard.stx +60 -86
  222. package/resources/components/Dashboard/Queries/QueryDetail.stx +5 -9
  223. package/resources/components/Dashboard/Realtime/RealtimeDashboard.stx +6 -8
  224. package/resources/components/Dashboard/Remote/RemoteConsole.stx +14 -20
  225. package/resources/components/Dashboard/Settings/AppearanceSettingsDashboard.stx +48 -54
  226. package/resources/components/Dashboard/Settings/MailSettingsDashboard.stx +8 -8
  227. package/resources/components/Dashboard/Settings/SettingsDashboard.stx +43 -47
  228. package/resources/components/Dashboard/Teams/TeamInvitationDashboard.stx +2 -2
  229. package/resources/components/Dashboard/UI/ActivityTable.stx +2 -1
  230. package/resources/components/Dashboard/UI/Button.stx +15 -0
  231. package/resources/components/Dashboard/UI/MetricCards.stx +5 -7
  232. package/resources/components/Dashboard/UI/Pagination.stx +3 -5
  233. package/resources/components/Dashboard/UI/QuickLinks.stx +2 -2
  234. package/resources/components/Dashboard/UI/Select.stx +1 -0
  235. package/resources/components/Dashboard/UI/Table.stx +139 -96
  236. package/resources/components/Dashboard/UI/Tabs.stx +18 -20
  237. package/routes/dashboard-api.ts +2 -0
  238. package/routes/dashboard.ts +246 -253
  239. package/routes/storefront.ts +31 -0
  240. package/stx-components-plugin.ts +12 -1
  241. package/views/dashboard/content/categories/index.stx +1 -1
  242. package/views/dashboard/content/tags/index.stx +1 -1
  243. package/views/dashboard/layouts/default.stx +27 -12
  244. package/views/dashboard/models/[model]/[id]/edit.stx +8 -0
  245. package/views/dashboard/models/[model]/[id].stx +8 -0
  246. package/views/dashboard/models/[model]/create.stx +8 -0
  247. package/resources/components/Dashboard/CreateRecordModal.stx +0 -138
  248. package/resources/components/Dashboard/Models/EditRecordModal.stx +0 -81
@@ -22,24 +22,22 @@ function changeIcon(change: string): string {
22
22
  </script>
23
23
 
24
24
  <section aria-label="Commerce metrics" class="grid gap-4 grid-cols-1 sm:grid-cols-2 lg:grid-cols-4">
25
- <template :if="loading() && stats().length === 0" :for="index in [1, 2, 3, 4]">
26
- <div :key="index" class="p-5 bg-white dark:bg-neutral-800 border border-gray-200 rounded-xl dark:border-neutral-700">
25
+ <div :if="loading() && stats().length === 0" class="contents">
26
+ <div :for="index in [1, 2, 3, 4]" :key="index" class="p-5 bg-white dark:bg-neutral-800 border border-gray-200 rounded-xl dark:border-neutral-700">
27
27
  <div class="h-4 w-28 bg-gray-100 dark:bg-neutral-700 rounded animate-pulse"></div>
28
28
  <div class="mt-3 h-8 w-36 bg-gray-100 dark:bg-neutral-700 rounded animate-pulse"></div>
29
29
  <div class="mt-3 h-3 w-24 bg-gray-100 dark:bg-neutral-700 rounded animate-pulse"></div>
30
30
  </div>
31
- </template>
32
- <template :for="stat in stats()" :key="stat.label">
33
- <article class="p-5 bg-white dark:bg-neutral-800 border border-gray-200 rounded-xl dark:border-neutral-700">
34
- <p class="font-medium text-gray-500 text-sm dark:text-neutral-400">{{ stat.label }}</p>
35
- <p class="mt-2 font-semibold text-2xl text-gray-900 tracking-tight dark:text-white">{{ stat.value }}</p>
36
- <div class="flex gap-2 items-center mt-2 min-h-5 text-xs">
37
- <span :if="stat.change" :class="'inline-flex items-center font-semibold ' + changeClass(stat.change)">
38
- <span :class="'mr-1 h-3.5 w-3.5 ' + changeIcon(stat.change)"></span>
39
- {{ stat.change }}
40
- </span>
41
- <span class="text-gray-500 truncate dark:text-neutral-400">{{ stat.detail }}</span>
42
- </div>
43
- </article>
44
- </template>
31
+ </div>
32
+ <article :for="stat in stats()" :key="stat.label" class="p-5 bg-white dark:bg-neutral-800 border border-gray-200 rounded-xl dark:border-neutral-700">
33
+ <p class="font-medium text-gray-500 text-sm dark:text-neutral-400">{{ stat.label }}</p>
34
+ <p class="mt-2 font-semibold text-2xl text-gray-900 tracking-tight dark:text-white">{{ stat.value }}</p>
35
+ <div class="flex gap-2 items-center mt-2 min-h-5 text-xs">
36
+ <span :if="stat.change" :class="'inline-flex items-center font-semibold ' + changeClass(stat.change)">
37
+ <span :class="'mr-1 h-3.5 w-3.5 ' + changeIcon(stat.change)"></span>
38
+ {{ stat.change }}
39
+ </span>
40
+ <span class="text-gray-500 truncate dark:text-neutral-400">{{ stat.detail }}</span>
41
+ </div>
42
+ </article>
45
43
  </section>
@@ -47,24 +47,20 @@ function money(value: number, currency: string): string {
47
47
  <article class="p-4 bg-white dark:bg-neutral-800 border border-gray-200 rounded-lg dark:border-neutral-700">
48
48
  <h2 class="font-semibold text-gray-900 text-sm dark:text-white">Statuses</h2>
49
49
  <div class="mt-4 space-y-3">
50
- <template :for="item in countRows('status')" :key="item.key">
51
- <div>
52
- <div class="flex items-center justify-between text-xs"><span class="capitalize text-gray-600 dark:text-neutral-300">{{ label(item.key) }}</span><span class="text-gray-500 dark:text-neutral-400">{{ item.count }} · {{ item.percentage }}%</span></div>
53
- <div class="mt-1 h-1.5 bg-gray-100 dark:bg-neutral-700 rounded-full"><div :style="'width:' + item.percentage + '%'" class="h-1.5 bg-blue-500 rounded-full"></div></div>
54
- </div>
55
- </template>
50
+ <div :for="item in countRows('status')" :key="item.key">
51
+ <div class="flex items-center justify-between text-xs"><span class="capitalize text-gray-600 dark:text-neutral-300">{{ label(item.key) }}</span><span class="text-gray-500 dark:text-neutral-400">{{ item.count }} · {{ item.percentage }}%</span></div>
52
+ <div class="mt-1 h-1.5 bg-gray-100 dark:bg-neutral-700 rounded-full"><div :style="'width:' + item.percentage + '%'" class="h-1.5 bg-blue-500 rounded-full"></div></div>
53
+ </div>
56
54
  </div>
57
55
  </article>
58
56
 
59
57
  <article class="p-4 bg-white dark:bg-neutral-800 border border-gray-200 rounded-lg dark:border-neutral-700">
60
58
  <h2 class="font-semibold text-gray-900 text-sm dark:text-white">Methods</h2>
61
59
  <div class="mt-4 space-y-3">
62
- <template :for="item in countRows('method')" :key="item.key">
63
- <div>
64
- <div class="flex items-center justify-between text-xs"><span class="capitalize text-gray-600 dark:text-neutral-300">{{ label(item.key) }}</span><span class="text-gray-500 dark:text-neutral-400">{{ item.count }} · {{ item.percentage }}%</span></div>
65
- <div class="mt-1 h-1.5 bg-gray-100 dark:bg-neutral-700 rounded-full"><div :style="'width:' + item.percentage + '%'" class="h-1.5 bg-emerald-500 rounded-full"></div></div>
66
- </div>
67
- </template>
60
+ <div :for="item in countRows('method')" :key="item.key">
61
+ <div class="flex items-center justify-between text-xs"><span class="capitalize text-gray-600 dark:text-neutral-300">{{ label(item.key) }}</span><span class="text-gray-500 dark:text-neutral-400">{{ item.count }} · {{ item.percentage }}%</span></div>
62
+ <div class="mt-1 h-1.5 bg-gray-100 dark:bg-neutral-700 rounded-full"><div :style="'width:' + item.percentage + '%'" class="h-1.5 bg-emerald-500 rounded-full"></div></div>
63
+ </div>
68
64
  </div>
69
65
  </article>
70
66
 
@@ -74,12 +70,10 @@ function money(value: number, currency: string): string {
74
70
  <span class="text-gray-500 text-xs dark:text-neutral-500">Current view</span>
75
71
  </div>
76
72
  <div class="mt-4 divide-gray-100 divide-y dark:divide-neutral-700">
77
- <template :for="item in currencyRows()" :key="item.currency">
78
- <div class="flex items-center justify-between py-2 first:pt-0 last:pb-0">
79
- <div><p class="font-medium text-gray-900 text-sm dark:text-white">{{ item.currency }}</p><p class="text-gray-500 text-xs dark:text-neutral-500">Refunded {{ money(item.refunded, item.currency) }}</p></div>
80
- <p class="font-semibold text-gray-700 text-sm dark:text-neutral-200">{{ money(item.captured, item.currency) }}</p>
81
- </div>
82
- </template>
73
+ <div :for="item in currencyRows()" :key="item.currency" class="flex items-center justify-between py-2 first:pt-0 last:pb-0">
74
+ <div><p class="font-medium text-gray-900 text-sm dark:text-white">{{ item.currency }}</p><p class="text-gray-500 text-xs dark:text-neutral-500">Refunded {{ money(item.refunded, item.currency) }}</p></div>
75
+ <p class="font-semibold text-gray-700 text-sm dark:text-neutral-200">{{ money(item.captured, item.currency) }}</p>
76
+ </div>
83
77
  <p :if="currencyRows().length === 0" class="py-8 text-center text-gray-500 text-sm dark:text-neutral-400">No completed volume in this view.</p>
84
78
  </div>
85
79
  </article>
@@ -2,6 +2,7 @@
2
2
  import type { PaymentBreakdown } from '../../../../app/Actions/Dashboard/Commerce/commerce-payment-list'
3
3
  import type { PaymentRecord, PaymentSummary } from '../../../../app/Actions/Dashboard/Commerce/payment-records'
4
4
  import { dashboardApi } from '../../../../functions/dashboard-api'
5
+ import { useServerList } from '../../../../functions/dashboard-list'
5
6
  import { pushToast } from '../../../../functions/toasts'
6
7
 
7
8
  interface CommercePaymentsResponse {
@@ -16,34 +17,23 @@ interface CommercePaymentsResponse {
16
17
  }
17
18
 
18
19
  const emptySummary: PaymentSummary = { total: 0, successful: 0, currencies: [], capturedByCurrency: {}, refundedByCurrency: {}, successRate: 0 }
19
- const records = state<PaymentRecord[]>([])
20
20
  // The server's answer for the current search, filters and range
21
21
  // (stacksjs/stacks#3218): it searches, filters, sorts, pages and summarises
22
22
  // every payment, where this page used to do all of that with the newest 500.
23
23
  const summary = state<PaymentSummary>({ ...emptySummary })
24
24
  const breakdown = state<PaymentBreakdown>({ statuses: [], methods: [], currencies: [] })
25
- const matchingTotal = state(0)
26
- const page = state(1)
27
- const perPage = state(25)
28
25
  const statusChoices = state<string[]>([])
29
26
  const methodChoices = state<string[]>([])
30
- const appliedSearch = state('')
31
- const headerSort = state<{ sort: string, direction: string } | null>(null)
32
- let listRequest = 0
33
- let searchTimer: ReturnType<typeof setTimeout> | null = null
34
- const search = state('')
35
27
  const statusFilter = state('all')
36
28
  const methodFilter = state('all')
37
29
  const timeRange = state('30')
38
30
  const sort = state('newest')
39
- const loading = state(true)
40
- const loadError = state('')
41
31
  const detailsRecord = state<PaymentRecord | null>(null)
42
32
  const refundRecord = state<PaymentRecord | null>(null)
43
33
  const refunding = state(false)
44
34
 
45
35
  /** The select's four orders, as the server's sort and direction. */
46
- const SELECT_SORTS: Record<string, { sort: string, direction: string }> = {
36
+ const SELECT_SORTS: Record<string, { sort: string, direction: 'asc' | 'desc' }> = {
47
37
  newest: { sort: 'created', direction: 'desc' },
48
38
  oldest: { sort: 'created', direction: 'asc' },
49
39
  amount: { sort: 'amount', direction: 'desc' },
@@ -68,24 +58,39 @@ function methods(): string[] {
68
58
  return methodChoices()
69
59
  }
70
60
 
71
- /** The search, filters, range and order, as the query the server takes. */
72
- function filterParams(): URLSearchParams {
73
- const params = new URLSearchParams()
74
- const order = headerSort() ?? SELECT_SORTS[sort()] ?? SELECT_SORTS.newest
75
- params.set('sort', order.sort)
76
- params.set('direction', order.direction)
77
- params.set('days', timeRange())
78
- if (appliedSearch())
79
- params.set('q', appliedSearch())
80
- if (statusFilter() !== 'all')
81
- params.set('status', statusFilter())
82
- if (methodFilter() !== 'all')
83
- params.set('method', methodFilter())
84
- return params
85
- }
61
+ // The server searches, filters, sorts and pages (stacksjs/stacks#3218). The
62
+ // range is a filter like the others; "all" is left out, which the server
63
+ // reads as every payment, as it reads days=all.
64
+ const {
65
+ records,
66
+ total,
67
+ page,
68
+ perPage,
69
+ search,
70
+ loading,
71
+ loadError,
72
+ params,
73
+ load,
74
+ changePage,
75
+ changePageSize,
76
+ changeSort,
77
+ } = useServerList<PaymentRecord>({
78
+ fetch: query => dashboardApi<CommercePaymentsResponse>(`/api/dashboard/commerce/payments?${query}`),
79
+ defaultSort: () => SELECT_SORTS[sort()] ?? SELECT_SORTS.newest!,
80
+ columnSorts: COLUMN_SORTS,
81
+ filters: () => ({ days: timeRange(), status: statusFilter(), method: methodFilter() }),
82
+ onLoad: (result) => {
83
+ const data = result as CommercePaymentsResponse
84
+ summary.set(data.summary ?? { ...emptySummary })
85
+ breakdown.set(data.breakdown ?? { statuses: [], methods: [], currencies: [] })
86
+ statusChoices.set(Array.isArray(data.statuses) ? data.statuses : [])
87
+ methodChoices.set(Array.isArray(data.methods) ? data.methods : [])
88
+ },
89
+ onError: error => pushToast('error', 'Could not load payments', { detail: error instanceof Error ? error.message : String(error) }),
90
+ })
86
91
 
87
92
  function matchingLabel(): string {
88
- const count = matchingTotal()
93
+ const count = total()
89
94
  return `${count.toLocaleString()} matching ${count === 1 ? 'payment' : 'payments'}`
90
95
  }
91
96
 
@@ -105,97 +110,13 @@ function metricCards(): Array<{ label: string, value: string, detail: string }>
105
110
 
106
111
  /** Every matching payment as CSV, built by the server, not just the page shown. */
107
112
  function exportHref(): string {
108
- return `/api/dashboard/commerce/payments/export?${filterParams()}`
109
- }
110
-
111
- async function loadPayments(): Promise<void> {
112
- const request = ++listRequest
113
- loading.set(true)
114
- loadError.set('')
115
- try {
116
- const params = filterParams()
117
- params.set('page', String(page()))
118
- params.set('per_page', String(perPage()))
119
- const data = await dashboardApi<CommercePaymentsResponse>(`/api/dashboard/commerce/payments?${params}`)
120
- // Only the newest request lands.
121
- if (request !== listRequest)
122
- return
123
- records.set(Array.isArray(data.records) ? data.records : [])
124
- summary.set(data.summary ?? { ...emptySummary })
125
- breakdown.set(data.breakdown ?? { statuses: [], methods: [], currencies: [] })
126
- matchingTotal.set(Number(data.total) || 0)
127
- page.set(Number(data.page) || 1)
128
- statusChoices.set(Array.isArray(data.statuses) ? data.statuses : [])
129
- methodChoices.set(Array.isArray(data.methods) ? data.methods : [])
130
- }
131
- catch (error) {
132
- if (request !== listRequest)
133
- return
134
- loadError.set('Payment records could not be loaded.')
135
- pushToast('error', 'Could not load payments', {
136
- detail: error instanceof Error ? error.message : String(error),
137
- })
138
- }
139
- finally {
140
- if (request === listRequest)
141
- loading.set(false)
142
- }
143
- }
144
-
145
- function eventValue<T>(value: T | CustomEvent<T>): T {
146
- return value instanceof CustomEvent ? value.detail : value
147
- }
148
-
149
- function changePage(value: number | CustomEvent<number>): void {
150
- page.set(Number(eventValue(value)) || 1)
151
- void loadPayments()
152
- }
153
-
154
- function changePageSize(value: number | CustomEvent<number>): void {
155
- perPage.set(Number(eventValue(value)) || 25)
156
- page.set(1)
157
- void loadPayments()
113
+ return `/api/dashboard/commerce/payments/export?${params()}`
158
114
  }
159
115
 
160
- function changeColumnSort(value: { key: string, direction: string } | CustomEvent<{ key: string, direction: string }>): void {
161
- const column = eventValue(value)
162
- const serverSort = COLUMN_SORTS[column.key]
163
- headerSort.set(serverSort ? { sort: serverSort, direction: column.direction === 'asc' ? 'asc' : 'desc' } : null)
164
- page.set(1)
165
- void loadPayments()
116
+ function loadPayments(): Promise<void> {
117
+ return load()
166
118
  }
167
119
 
168
- // The filters, range and select ask the server for page 1 when they change, and
169
- // the search once typing pauses. A select change hands the order back from a
170
- // column header.
171
- let shownFilters = JSON.stringify([statusFilter(), methodFilter(), timeRange(), sort()])
172
- effect(() => {
173
- const filters = JSON.stringify([statusFilter(), methodFilter(), timeRange(), sort()])
174
- if (filters === shownFilters)
175
- return
176
- const sortChanged = JSON.parse(shownFilters)[3] !== sort()
177
- shownFilters = filters
178
- if (sortChanged)
179
- headerSort.set(null)
180
- page.set(1)
181
- void loadPayments()
182
- })
183
-
184
- let shownSearch = search().trim()
185
- effect(() => {
186
- const term = search().trim()
187
- if (term === shownSearch)
188
- return
189
- shownSearch = term
190
- if (searchTimer)
191
- clearTimeout(searchTimer)
192
- searchTimer = setTimeout(() => {
193
- appliedSearch.set(term)
194
- page.set(1)
195
- void loadPayments()
196
- }, 250)
197
- })
198
-
199
120
  function openDetails(record: PaymentRecord): void {
200
121
  detailsRecord.set(record)
201
122
  }
@@ -248,7 +169,7 @@ onMount(() => {
248
169
  })
249
170
  </script>
250
171
 
251
- <div class="space-y-6">
172
+ <div class="flex flex-col gap-6">
252
173
  <PageHeader title="Payments" description="Inspect native Payment records, export the current view, and record confirmed refunds.">
253
174
  <div class="flex flex-wrap gap-2">
254
175
  <Button variant="secondary" :loading="loading()" @click="loadPayments"><span :if="!loading()" class="h-4 w-4 i-hugeicons-refresh"></span>Refresh</Button>
@@ -262,15 +183,15 @@ onMount(() => {
262
183
 
263
184
  <CommercePaymentsBreakdown :breakdown="breakdown()" />
264
185
 
265
- <section class="space-y-3">
186
+ <section class="flex flex-col gap-3">
266
187
  <div class="grid gap-3 grid-cols-1 sm:grid-cols-2 xl:grid-cols-5">
267
188
  <label class="relative sm:col-span-2">
268
189
  <span class="sr-only">Search payments</span>
269
190
  <span class="flex absolute inset-y-0 left-0 items-center pl-3 text-gray-400 pointer-events-none"><span class="h-4 w-4 i-hugeicons-search-01"></span></span>
270
191
  <input x-model="search" type="search" placeholder="Search payments" 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" />
271
192
  </label>
272
- <label><span class="sr-only">Payment status</span><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"><option value="all">All statuses</option><template :for="status in statuses()" :key="status"><option :value="status">{{ status }}</option></template></select></label>
273
- <label><span class="sr-only">Payment method</span><select x-model="methodFilter" 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">All methods</option><template :for="method in methods()" :key="method"><option :value="method">{{ method }}</option></template></select></label>
193
+ <label><span class="sr-only">Payment status</span><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"><option value="all">All statuses</option><option :for="status in statuses()" :key="status" :value="status">{{ status }}</option></select></label>
194
+ <label><span class="sr-only">Payment method</span><select x-model="methodFilter" 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">All methods</option><option :for="method in methods()" :key="method" :value="method">{{ method }}</option></select></label>
274
195
  <label><span class="sr-only">Payment time range</span><select x-model="timeRange" 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="1">Last 24 hours</option><option value="7">Last 7 days</option><option value="30">Last 30 days</option><option value="90">Last 90 days</option><option value="365">Last year</option><option value="all">All time</option></select></label>
275
196
  </div>
276
197
 
@@ -279,7 +200,7 @@ onMount(() => {
279
200
  <label class="flex gap-2 items-center text-gray-500 text-sm dark:text-neutral-400">Sort<select x-model="sort" class="px-3 py-1.5 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</option><option value="oldest">Oldest</option><option value="amount">Highest amount</option><option value="status">Status</option></select></label>
280
201
  </div>
281
202
 
282
- <CommercePaymentsTable :sort-reset-key="sort()" :records="records()" :total="matchingTotal()" :current-page="page()" :per-page="perPage()" :loading="loading()" @view="openDetails" @page-change="changePage" @page-size-change="changePageSize" @sort="changeColumnSort" />
203
+ <CommercePaymentsTable :sort-reset-key="sort()" :records="records()" :total="total()" :current-page="page()" :per-page="perPage()" :loading="loading()" @view="openDetails" @page-change="changePage" @page-size-change="changePageSize" @sort="changeSort" />
283
204
  </section>
284
205
  </div>
285
206
 
@@ -65,7 +65,7 @@ const COLUMNS = [
65
65
  ]
66
66
 
67
67
  const ROW_ACTIONS = [
68
- { action: 'view', label: 'View payment', icon: 'i-hugeicons-view' },
68
+ { action: 'view', label: 'View payment' },
69
69
  ]
70
70
 
71
71
  const rows = derived(() => records().map(record => ({
@@ -38,21 +38,19 @@ function formatMoney(value: number): string {
38
38
  </div>
39
39
 
40
40
  <ul :if="lines().length > 0" class="overflow-y-auto max-h-[52dvh] divide-gray-100 divide-y dark:divide-neutral-700">
41
- <template :for="line in lines()" :key="line.productId">
42
- <li class="p-4">
43
- <div class="flex gap-3 items-start justify-between">
44
- <div class="min-w-0"><p class="font-medium text-gray-900 text-sm truncate dark:text-white">{{ line.name }}</p><p class="mt-1 text-gray-500 text-xs dark:text-neutral-400">{{ formatMoney(line.unitPrice) }} each · {{ formatMoney(line.unitPrice * line.quantity) }}</p></div>
45
- <Button variant="ghost" size="xs" iconOnly :ariaLabel="'Remove ' + line.name" @click="emit('remove', line.productId)"><span class="block h-4 w-4 text-red-500 i-hugeicons-delete-02"></span></Button>
46
- </div>
47
- <div class="flex gap-2 items-center mt-3">
48
- <Button variant="secondary" size="xs" iconOnly :ariaLabel="'Decrease ' + line.name + ' quantity'" @click="emit('decrease', line.productId)"><span class="block h-3.5 w-3.5 i-hugeicons-minus-sign"></span></Button>
49
- <span class="min-w-8 font-semibold text-center text-gray-800 text-sm dark:text-neutral-100">{{ line.quantity }}</span>
50
- <Button variant="secondary" size="xs" iconOnly :disabled="line.quantity >= line.inventoryCount" :ariaLabel="'Increase ' + line.name + ' quantity'" @click="emit('increase', line.productId)"><span class="block h-3.5 w-3.5 i-hugeicons-plus-sign"></span></Button>
51
- <span class="ml-auto text-gray-500 text-xs dark:text-neutral-500">{{ line.inventoryCount }} available</span>
52
- </div>
53
- <label class="block mt-3"><span class="sr-only">Instructions for {{ line.name }}</span><input :value="line.specialInstructions" type="text" maxlength="500" placeholder="Optional line instructions" class="px-3 py-1.5 w-full text-gray-900 text-xs dark:text-white bg-gray-50 dark:bg-neutral-900 border border-gray-200 rounded-md dark:border-neutral-700" @input="emit('instructions', { productId: line.productId, event: $event })" /></label>
54
- </li>
55
- </template>
41
+ <li :for="line in lines()" :key="line.productId" class="p-4">
42
+ <div class="flex gap-3 items-start justify-between">
43
+ <div class="min-w-0"><p class="font-medium text-gray-900 text-sm truncate dark:text-white">{{ line.name }}</p><p class="mt-1 text-gray-500 text-xs dark:text-neutral-400">{{ formatMoney(line.unitPrice) }} each · {{ formatMoney(line.unitPrice * line.quantity) }}</p></div>
44
+ <Button variant="ghost" size="xs" iconOnly :ariaLabel="'Remove ' + line.name" @click="emit('remove', line.productId)"><span class="block h-4 w-4 text-red-500 i-hugeicons-delete-02"></span></Button>
45
+ </div>
46
+ <div class="flex gap-2 items-center mt-3">
47
+ <Button variant="secondary" size="xs" iconOnly :ariaLabel="'Decrease ' + line.name + ' quantity'" @click="emit('decrease', line.productId)"><span class="block h-3.5 w-3.5 i-hugeicons-minus-sign"></span></Button>
48
+ <span class="min-w-8 font-semibold text-center text-gray-800 text-sm dark:text-neutral-100">{{ line.quantity }}</span>
49
+ <Button variant="secondary" size="xs" iconOnly :disabled="line.quantity >= line.inventoryCount" :ariaLabel="'Increase ' + line.name + ' quantity'" @click="emit('increase', line.productId)"><span class="block h-3.5 w-3.5 i-hugeicons-plus-sign"></span></Button>
50
+ <span class="ml-auto text-gray-500 text-xs dark:text-neutral-500">{{ line.inventoryCount }} available</span>
51
+ </div>
52
+ <label class="block mt-3"><span class="sr-only">Instructions for {{ line.name }}</span><input :value="line.specialInstructions" type="text" maxlength="500" placeholder="Optional line instructions" class="px-3 py-1.5 w-full text-gray-900 text-xs dark:text-white bg-gray-50 dark:bg-neutral-900 border border-gray-200 rounded-md dark:border-neutral-700" @input="emit('instructions', { productId: line.productId, event: $event })" /></label>
53
+ </li>
56
54
  </ul>
57
55
 
58
56
  <footer class="p-4 bg-gray-50 dark:bg-neutral-900/50 border-gray-200 border-t dark:border-neutral-700">
@@ -49,7 +49,7 @@ function sellable(product: CommercePosProduct): boolean {
49
49
  <span class="sr-only">Product category</span>
50
50
  <select x-model="category" 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" @change="emit('category', $event.target.value)">
51
51
  <option value="all">Any category</option>
52
- <template :for="option in categories()" :key="option.id"><option :value="option.id">{{ option.label }}</option></template>
52
+ <option :for="option in categories()" :key="option.id" :value="option.id">{{ option.label }}</option>
53
53
  </select>
54
54
  </label>
55
55
  <label>
@@ -70,26 +70,24 @@ function sellable(product: CommercePosProduct): boolean {
70
70
  </div>
71
71
 
72
72
  <div :if="!loading() && products().length > 0" class="grid gap-3 grid-cols-1 sm:grid-cols-2 2xl:grid-cols-3 mt-4">
73
- <template :for="product in products()" :key="product.id">
74
- <article :class="'flex flex-col p-4 bg-white dark:bg-neutral-800 border rounded-lg ' + (sellable(product) ? 'border-gray-200 dark:border-neutral-700' : 'border-gray-200 dark:border-neutral-700 opacity-65')">
75
- <div class="flex gap-3 items-start">
76
- <div class="flex flex-none items-center justify-center h-10 w-10 font-semibold text-blue-700 text-xs dark:text-blue-300 bg-blue-50 dark:bg-blue-950/40 rounded-md">{{ initials(product.name) }}</div>
77
- <div class="min-w-0">
78
- <h2 class="font-semibold text-gray-900 text-sm truncate dark:text-white">{{ product.name || 'Unnamed product' }}</h2>
79
- <p class="mt-1 text-gray-500 text-xs dark:text-neutral-400">{{ product.categoryName }}</p>
80
- </div>
73
+ <article :for="product in products()" :key="product.id" :class="'flex flex-col p-4 bg-white dark:bg-neutral-800 border rounded-lg ' + (sellable(product) ? 'border-gray-200 dark:border-neutral-700' : 'border-gray-200 dark:border-neutral-700 opacity-65')">
74
+ <div class="flex gap-3 items-start">
75
+ <div class="flex flex-none items-center justify-center h-10 w-10 font-semibold text-blue-700 text-xs dark:text-blue-300 bg-blue-50 dark:bg-blue-950/40 rounded-md">{{ initials(product.name) }}</div>
76
+ <div class="min-w-0">
77
+ <h2 class="font-semibold text-gray-900 text-sm truncate dark:text-white">{{ product.name || 'Unnamed product' }}</h2>
78
+ <p class="mt-1 text-gray-500 text-xs dark:text-neutral-400">{{ product.categoryName }}</p>
81
79
  </div>
82
- <p class="mt-3 min-h-10 line-clamp-2 text-gray-500 text-xs dark:text-neutral-400">{{ product.description || 'No description recorded.' }}</p>
83
- <div :if="product.allergens.length > 0" class="flex flex-wrap gap-1 mt-3"><template :for="allergen in product.allergens" :key="allergen"><span class="px-2 py-0.5 text-amber-700 text-xs dark:text-amber-300 bg-amber-50 dark:bg-amber-950/40 rounded-full">{{ allergen }}</span></template></div>
84
- <div class="flex items-end justify-between mt-auto pt-4">
85
- <div>
86
- <p class="font-semibold text-gray-900 dark:text-white">{{ formatMoney(product.price) }}</p>
87
- <p :class="'mt-1 text-xs ' + (product.inventoryCount > 0 ? 'text-gray-500 dark:text-neutral-500' : 'text-red-600 dark:text-red-400')">{{ product.inventoryCount.toLocaleString() }} in stock<span :if="product.preparationTime > 0"> · {{ product.preparationTime }} min</span></p>
88
- </div>
89
- <Button size="sm" :disabled="!sellable(product)" :ariaLabel="'Add ' + product.name + ' to cart'" @click="emit('add', product)"><span class="h-4 w-4 i-hugeicons-add-01"></span>Add</Button>
80
+ </div>
81
+ <p class="mt-3 min-h-10 line-clamp-2 text-gray-500 text-xs dark:text-neutral-400">{{ product.description || 'No description recorded.' }}</p>
82
+ <div :if="product.allergens.length > 0" class="flex flex-wrap gap-1 mt-3"><span :for="allergen in product.allergens" :key="allergen" class="px-2 py-0.5 text-amber-700 text-xs dark:text-amber-300 bg-amber-50 dark:bg-amber-950/40 rounded-full">{{ allergen }}</span></div>
83
+ <div class="flex items-end justify-between mt-auto pt-4">
84
+ <div>
85
+ <p class="font-semibold text-gray-900 dark:text-white">{{ formatMoney(product.price) }}</p>
86
+ <p :class="'mt-1 text-xs ' + (product.inventoryCount > 0 ? 'text-gray-500 dark:text-neutral-500' : 'text-red-600 dark:text-red-400')">{{ product.inventoryCount.toLocaleString() }} in stock<span :if="product.preparationTime > 0"> · {{ product.preparationTime }} min</span></p>
90
87
  </div>
91
- </article>
92
- </template>
88
+ <Button size="sm" :disabled="!sellable(product)" :ariaLabel="'Add ' + product.name + ' to cart'" @click="emit('add', product)"><span class="h-4 w-4 i-hugeicons-add-01"></span>Add</Button>
89
+ </div>
90
+ </article>
93
91
  </div>
94
92
  <div :if="!loading() && total() > 0" class="mt-4">
95
93
  <Pagination :currentPage="currentPage()" :totalItems="total()" :itemsPerPage="perPage()" showTotalItems @page="changePage" />
@@ -107,9 +107,9 @@ function submit(): void {
107
107
  <div :if="error()" class="mb-4 p-3 text-red-700 text-sm dark:text-red-300 bg-red-50 dark:bg-red-950/30 border border-red-200 rounded-lg dark:border-red-900">{{ error() }}</div>
108
108
 
109
109
  <div class="grid gap-4 grid-cols-1 sm:grid-cols-2">
110
- <div class="sm:col-span-2"><label class="block"><span class="font-medium text-gray-700 text-sm dark:text-neutral-200">Customer</span><input x-model="customerQuery" @input="searchCustomersSoon()" type="search" name="customer_search" aria-label="Search customers by name, email or phone" placeholder="Search by name, email or phone" 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="customerId" aria-label="Customer" 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="">Guest sale</option><template :for="customer in customers()" :key="customer.id"><option :value="customer.id" :selected="customer.id === customerId()">{{ customer.label }}{{ customer.email ? ' · ' + customer.email : '' }}</option></template></select><p :if="moreCustomersLabel()" class="mt-1 text-gray-500 text-xs dark:text-neutral-400" :text="moreCustomersLabel()"></p></div>
110
+ <div class="sm:col-span-2"><label class="block"><span class="font-medium text-gray-700 text-sm dark:text-neutral-200">Customer</span><input x-model="customerQuery" @input="searchCustomersSoon()" type="search" name="customer_search" aria-label="Search customers by name, email or phone" placeholder="Search by name, email or phone" 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="customerId" aria-label="Customer" 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="">Guest sale</option><option :for="customer in customers()" :key="customer.id" :value="customer.id" :selected="customer.id === customerId()">{{ customer.label }}{{ customer.email ? ' · ' + customer.email : '' }}</option></select><p :if="moreCustomersLabel()" class="mt-1 text-gray-500 text-xs dark:text-neutral-400" :text="moreCustomersLabel()"></p></div>
111
111
  <label class="block"><span class="font-medium text-gray-700 text-sm dark:text-neutral-200">Order type</span><select x-model="orderType" 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="TAKEOUT">Takeout</option><option value="DINE_IN">Dine in</option></select></label>
112
- <label class="block"><span class="font-medium text-gray-700 text-sm dark:text-neutral-200">Payment</span><select x-model="paymentMethod" 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"><template :for="method in paymentMethods()" :key="method.id"><option :value="method.id">{{ method.label }}</option></template></select></label>
112
+ <label class="block"><span class="font-medium text-gray-700 text-sm dark:text-neutral-200">Payment</span><select x-model="paymentMethod" 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 :for="method in paymentMethods()" :key="method.id" :value="method.id">{{ method.label }}</option></select></label>
113
113
  <label class="block sm:col-span-2"><span class="font-medium text-gray-700 text-sm dark:text-neutral-200">Order instructions</span><textarea x-model="specialInstructions" rows="3" maxlength="1000" placeholder="Optional instructions for the whole sale" 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>
114
114
  </div>
115
115
 
@@ -323,7 +323,7 @@ onMount(() => {
323
323
  })
324
324
  </script>
325
325
 
326
- <div class="space-y-6">
326
+ <div class="flex flex-col gap-6">
327
327
  <PageHeader title="Point of sale" description="Create server-priced cash sales from native Product, Order, OrderItem, Payment, Customer, and TaxRate records.">
328
328
  <Button variant="secondary" :loading="loading()" @click="loadPos()"><span :if="!loading()" class="h-4 w-4 i-hugeicons-refresh"></span>Refresh</Button>
329
329
  </PageHeader>
@@ -54,7 +54,7 @@ function formatDate(value: string): string {
54
54
  <p :if="receipt()?.referenceNumber" class="font-mono text-gray-500 text-xs dark:text-neutral-500">{{ receipt()?.referenceNumber }}</p>
55
55
 
56
56
  <ul class="mt-5 divide-gray-100 divide-y dark:divide-neutral-700">
57
- <template :for="line in (receipt()?.lines || [])" :key="line.productId"><li class="py-3"><div class="flex gap-3 items-start justify-between"><div><p class="font-medium text-gray-900 text-sm dark:text-white">{{ line.quantity }} × {{ line.name }}</p><p :if="line.specialInstructions" class="mt-1 text-gray-500 text-xs dark:text-neutral-400">{{ line.specialInstructions }}</p></div><p class="font-medium text-gray-700 text-sm whitespace-nowrap dark:text-neutral-200">{{ formatMoney(line.lineTotal) }}</p></div></li></template>
57
+ <li :for="line in (receipt()?.lines || [])" :key="line.productId" class="py-3"><div class="flex gap-3 items-start justify-between"><div><p class="font-medium text-gray-900 text-sm dark:text-white">{{ line.quantity }} × {{ line.name }}</p><p :if="line.specialInstructions" class="mt-1 text-gray-500 text-xs dark:text-neutral-400">{{ line.specialInstructions }}</p></div><p class="font-medium text-gray-700 text-sm whitespace-nowrap dark:text-neutral-200">{{ formatMoney(line.lineTotal) }}</p></div></li>
58
58
  </ul>
59
59
 
60
60
  <dl class="mt-4 p-4 space-y-2 bg-gray-50 dark:bg-neutral-900/60 rounded-lg">
@@ -177,7 +177,7 @@ onMount(() => {
177
177
  </div>
178
178
  <div :if="record()" class="flex flex-wrap gap-2">
179
179
  <Button variant="secondary" :loading="loading()" @click="loadProduct()"><span :if="!loading()" class="h-4 w-4 i-hugeicons-refresh"></span>Refresh</Button>
180
- <Button @click="openEdit()"><span class="h-4 w-4 i-hugeicons-edit-02"></span>Edit product</Button>
180
+ <Button @click="openEdit()"><span class="h-4 w-4 i-hugeicons-pencil-edit-02"></span>Edit product</Button>
181
181
  <Button variant="danger" @click="deleteOpen.set(true)"><span class="h-4 w-4 i-hugeicons-delete-02"></span>Delete</Button>
182
182
  </div>
183
183
  </header>
@@ -227,7 +227,7 @@ onMount(() => {
227
227
  <header class="px-5 py-4 border-b border-gray-200 dark:border-neutral-700"><h2 class="font-semibold text-gray-900 dark:text-white">Product variants</h2><p class="mt-1 text-gray-500 text-xs dark:text-neutral-400">Persisted ProductVariant relationships.</p></header>
228
228
  <div :if="variants().length === 0" class="px-5 py-10 text-center text-gray-500 text-sm dark:text-neutral-400">No variants are linked to this product.</div>
229
229
  <ul :if="variants().length > 0" class="divide-gray-100 divide-y dark:divide-neutral-700">
230
- <template :for="variant in variants()" :key="variant.id"><li class="px-5 py-4"><div class="flex gap-3 items-start justify-between"><div><p class="font-medium text-gray-900 text-sm dark:text-white">{{ variant.name || 'Unnamed variant' }}</p><p class="mt-1 text-gray-500 text-xs dark:text-neutral-400">{{ variant.type || 'No type' }}<span :if="variant.description"> · {{ variant.description }}</span></p></div><span :if="variant.status" class="px-2 py-1 font-medium text-gray-600 text-xs dark:text-neutral-300 bg-gray-100 dark:bg-neutral-700 rounded-full">{{ variant.status }}</span></div><div :if="variant.options.length > 0" class="flex flex-wrap gap-1.5 mt-3"><template :for="option in variant.options" :key="option"><span class="px-2 py-1 text-blue-700 text-xs dark:text-blue-300 bg-blue-50 dark:bg-blue-950/40 rounded">{{ option }}</span></template></div></li></template>
230
+ <li :for="variant in variants()" :key="variant.id" class="px-5 py-4"><div class="flex gap-3 items-start justify-between"><div><p class="font-medium text-gray-900 text-sm dark:text-white">{{ variant.name || 'Unnamed variant' }}</p><p class="mt-1 text-gray-500 text-xs dark:text-neutral-400">{{ variant.type || 'No type' }}<span :if="variant.description"> · {{ variant.description }}</span></p></div><span :if="variant.status" class="px-2 py-1 font-medium text-gray-600 text-xs dark:text-neutral-300 bg-gray-100 dark:bg-neutral-700 rounded-full">{{ variant.status }}</span></div><div :if="variant.options.length > 0" class="flex flex-wrap gap-1.5 mt-3"><span :for="option in variant.options" :key="option" class="px-2 py-1 text-blue-700 text-xs dark:text-blue-300 bg-blue-50 dark:bg-blue-950/40 rounded">{{ option }}</span></div></li>
231
231
  </ul>
232
232
  </section>
233
233
 
@@ -235,14 +235,14 @@ onMount(() => {
235
235
  <header class="px-5 py-4 border-b border-gray-200 dark:border-neutral-700"><h2 class="font-semibold text-gray-900 dark:text-white">Product units</h2><p class="mt-1 text-gray-500 text-xs dark:text-neutral-400">Persisted ProductUnit relationships.</p></header>
236
236
  <div :if="units().length === 0" class="px-5 py-10 text-center text-gray-500 text-sm dark:text-neutral-400">No units are linked to this product.</div>
237
237
  <ul :if="units().length > 0" class="divide-gray-100 divide-y dark:divide-neutral-700">
238
- <template :for="unit in units()" :key="unit.id"><li class="flex gap-3 items-start justify-between px-5 py-4"><div><div class="flex gap-2 items-center"><p class="font-medium text-gray-900 text-sm dark:text-white">{{ unit.name || 'Unnamed unit' }}</p><span :if="unit.isDefault" class="px-2 py-0.5 font-medium text-green-700 text-xs dark:text-green-300 bg-green-50 dark:bg-green-950/40 rounded-full">Default</span></div><p class="mt-1 text-gray-500 text-xs dark:text-neutral-400">{{ unit.type || 'No type' }}<span :if="unit.description"> · {{ unit.description }}</span></p></div><span class="font-mono text-gray-500 text-xs dark:text-neutral-400">{{ unit.abbreviation || 'n/a' }}</span></li></template>
238
+ <li :for="unit in units()" :key="unit.id" class="flex gap-3 items-start justify-between px-5 py-4"><div><div class="flex gap-2 items-center"><p class="font-medium text-gray-900 text-sm dark:text-white">{{ unit.name || 'Unnamed unit' }}</p><span :if="unit.isDefault" class="px-2 py-0.5 font-medium text-green-700 text-xs dark:text-green-300 bg-green-50 dark:bg-green-950/40 rounded-full">Default</span></div><p class="mt-1 text-gray-500 text-xs dark:text-neutral-400">{{ unit.type || 'No type' }}<span :if="unit.description"> · {{ unit.description }}</span></p></div><span class="font-mono text-gray-500 text-xs dark:text-neutral-400">{{ unit.abbreviation || 'n/a' }}</span></li>
239
239
  </ul>
240
240
  </section>
241
241
  </div>
242
242
 
243
243
  <div class="grid gap-6 grid-cols-1 xl:grid-cols-2">
244
- <section class="p-5 bg-white dark:bg-neutral-800 border border-gray-200 rounded-lg dark:border-neutral-700"><h2 class="font-semibold text-gray-900 dark:text-white">Allergens</h2><div :if="(record()?.allergens || []).length > 0" class="flex flex-wrap gap-2 mt-4"><template :for="allergen in (record()?.allergens || [])" :key="allergen"><span class="px-2.5 py-1 font-medium text-amber-700 text-xs dark:text-amber-300 bg-amber-50 dark:bg-amber-950/40 rounded-full">{{ allergen }}</span></template></div><p :if="(record()?.allergens || []).length === 0" class="mt-4 text-gray-500 text-sm dark:text-neutral-400">No allergens recorded.</p></section>
245
- <section class="p-5 bg-white dark:bg-neutral-800 border border-gray-200 rounded-lg dark:border-neutral-700"><h2 class="font-semibold text-gray-900 dark:text-white">Nutritional information</h2><dl :if="nutritionEntries().length > 0" class="grid gap-3 grid-cols-2 mt-4"><template :for="item in nutritionEntries()" :key="item.label"><div class="p-3 bg-gray-50 dark:bg-neutral-900/50 rounded-md"><dt class="text-gray-500 text-xs dark:text-neutral-500">{{ item.label }}</dt><dd class="mt-1 font-medium text-gray-800 text-sm dark:text-neutral-100">{{ item.value }}</dd></div></template></dl><p :if="nutritionEntries().length === 0" class="mt-4 text-gray-500 text-sm dark:text-neutral-400">No nutritional information recorded.</p></section>
244
+ <section class="p-5 bg-white dark:bg-neutral-800 border border-gray-200 rounded-lg dark:border-neutral-700"><h2 class="font-semibold text-gray-900 dark:text-white">Allergens</h2><div :if="(record()?.allergens || []).length > 0" class="flex flex-wrap gap-2 mt-4"><span :for="allergen in (record()?.allergens || [])" :key="allergen" class="px-2.5 py-1 font-medium text-amber-700 text-xs dark:text-amber-300 bg-amber-50 dark:bg-amber-950/40 rounded-full">{{ allergen }}</span></div><p :if="(record()?.allergens || []).length === 0" class="mt-4 text-gray-500 text-sm dark:text-neutral-400">No allergens recorded.</p></section>
245
+ <section class="p-5 bg-white dark:bg-neutral-800 border border-gray-200 rounded-lg dark:border-neutral-700"><h2 class="font-semibold text-gray-900 dark:text-white">Nutritional information</h2><dl :if="nutritionEntries().length > 0" class="grid gap-3 grid-cols-2 mt-4"><div :for="item in nutritionEntries()" :key="item.label" class="p-3 bg-gray-50 dark:bg-neutral-900/50 rounded-md"><dt class="text-gray-500 text-xs dark:text-neutral-500">{{ item.label }}</dt><dd class="mt-1 font-medium text-gray-800 text-sm dark:text-neutral-100">{{ item.value }}</dd></div></dl><p :if="nutritionEntries().length === 0" class="mt-4 text-gray-500 text-sm dark:text-neutral-400">No nutritional information recorded.</p></section>
246
246
  </div>
247
247
  </template>
248
248
  </div>
@@ -146,7 +146,7 @@ function errorMessages(): string[] {
146
146
  >
147
147
  <form id="product-form" @submit.prevent="submit">
148
148
  <ul :if="errorMessages().length > 0" class="mb-5 p-3 space-y-1 text-red-700 text-sm dark:text-red-300 bg-red-50 dark:bg-red-950/30 border border-red-200 rounded-lg dark:border-red-900">
149
- <template :for="message in errorMessages()" :key="message"><li>{{ message }}</li></template>
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
152
  <label class="block sm:col-span-2"><span class="font-medium text-gray-700 text-sm dark:text-neutral-200">Name</span><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" /></label>
@@ -156,8 +156,8 @@ function errorMessages(): string[] {
156
156
  <label class="block"><span class="font-medium text-gray-700 text-sm dark:text-neutral-200">Inventory count</span><input x-model="inventoryCount" type="number" min="0" step="1" 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" /></label>
157
157
  <label class="block"><span class="font-medium text-gray-700 text-sm dark:text-neutral-200">Preparation time (minutes)</span><input x-model="preparationTime" type="number" min="1" step="1" 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" /></label>
158
158
  <label class="flex gap-3 items-center 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"><input x-model="isAvailable" type="checkbox" class="h-4 w-4 text-blue-600 border-gray-300 rounded" /><span class="font-medium text-gray-700 text-sm dark:text-neutral-200">Available for commerce</span></label>
159
- <label class="block"><span class="font-medium text-gray-700 text-sm dark:text-neutral-200">Category</span><select x-model="categoryId" 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="">Unassigned category</option><template :for="option in categories()" :key="option.id"><option :value="option.id">{{ option.label }}</option></template></select></label>
160
- <label class="block"><span class="font-medium text-gray-700 text-sm dark:text-neutral-200">Manufacturer</span><select x-model="manufacturerId" 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="">Unassigned manufacturer</option><template :for="option in manufacturers()" :key="option.id"><option :value="option.id">{{ option.label }}</option></template></select></label>
159
+ <label class="block"><span class="font-medium text-gray-700 text-sm dark:text-neutral-200">Category</span><select x-model="categoryId" 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="">Unassigned category</option><option :for="option in categories()" :key="option.id" :value="option.id">{{ option.label }}</option></select></label>
160
+ <label class="block"><span class="font-medium text-gray-700 text-sm dark:text-neutral-200">Manufacturer</span><select x-model="manufacturerId" 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="">Unassigned manufacturer</option><option :for="option in manufacturers()" :key="option.id" :value="option.id">{{ option.label }}</option></select></label>
161
161
  <label class="block sm:col-span-2"><span class="font-medium text-gray-700 text-sm dark:text-neutral-200">Image URL</span><input x-model="imageUrl" type="url" placeholder="Optional persisted asset URL" 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>
162
162
  <label class="block sm:col-span-2"><span class="font-medium text-gray-700 text-sm dark:text-neutral-200">Allergens</span><input x-model="allergens" type="text" placeholder="Comma-separated, for example: Gluten, Soy" 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>
163
163
  <label class="block sm:col-span-2"><span class="font-medium text-gray-700 text-sm dark:text-neutral-200">Nutritional information (JSON object)</span><textarea x-model="nutritionalInfo" rows="4" spellcheck="false" :aria-invalid="!nutritionValid()" 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"></textarea><span :if="!nutritionValid()" class="block mt-1 text-red-600 text-xs dark:text-red-400">Enter a valid JSON object.</span></label>