@stacksjs/defaults 0.75.529 → 0.75.537
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 +1 -1
- package/ai/skills/stacks-build/SKILL.md +1 -1
- package/ai/skills/stacks-dashboard/SKILL.md +2 -2
- package/ai/skills/stacks-database/SKILL.md +1 -1
- package/ai/skills/stacks-migrations/SKILL.md +2 -2
- package/ai/skills/stacks-native/CATALOG.md +6 -6
- package/app/Actions/Dashboard/Commerce/CommerceCouponsAction.ts +27 -15
- package/app/Actions/Dashboard/Commerce/CommerceCouponsExportAction.ts +45 -0
- package/app/Actions/Dashboard/Commerce/CommerceCustomersAction.ts +22 -12
- package/app/Actions/Dashboard/Commerce/CommerceCustomersExportAction.ts +44 -0
- package/app/Actions/Dashboard/Commerce/CommercePosCheckoutAction.ts +9 -29
- package/app/Actions/Dashboard/Commerce/CommercePrintDevicesAction.ts +7 -9
- package/app/Actions/Dashboard/Commerce/CommerceProductDetailAction.ts +9 -8
- package/app/Actions/Dashboard/Commerce/CommerceTaxesAction.ts +7 -9
- package/app/Actions/Dashboard/Commerce/ManufacturerIndexAction.ts +8 -20
- package/app/Actions/Dashboard/Commerce/commerce-coupon-list.test.ts +203 -0
- package/app/Actions/Dashboard/Commerce/commerce-coupon-list.ts +248 -0
- package/app/Actions/Dashboard/Commerce/commerce-customer-list.test.ts +183 -0
- package/app/Actions/Dashboard/Commerce/commerce-customer-list.ts +186 -0
- package/app/Actions/Dashboard/Commerce/commerce-customer-records.test.ts +1 -34
- package/app/Actions/Dashboard/Commerce/commerce-customer-records.ts +0 -11
- package/app/Actions/Dashboard/Commerce/commerce-manufacturer-list.test.ts +118 -0
- package/app/Actions/Dashboard/Commerce/commerce-manufacturer-list.ts +41 -0
- package/app/Actions/Dashboard/Commerce/commerce-pos-catalog.test.ts +17 -5
- package/app/Actions/Dashboard/Commerce/commerce-pos-catalog.ts +17 -3
- package/app/Actions/Dashboard/Commerce/commerce-print-device-list.test.ts +99 -0
- package/app/Actions/Dashboard/Commerce/commerce-print-device-list.ts +18 -0
- package/app/Actions/Dashboard/Commerce/commerce-product-list.ts +5 -5
- package/app/Actions/Dashboard/Commerce/commerce-product-options.test.ts +81 -0
- package/app/Actions/Dashboard/Commerce/commerce-tax-rate-list.test.ts +99 -0
- package/app/Actions/Dashboard/Commerce/commerce-tax-rate-list.ts +18 -0
- package/app/Actions/Dashboard/Commerce/coupon-records.test.ts +1 -16
- package/app/Actions/Dashboard/Commerce/coupon-records.ts +6 -10
- package/app/Actions/Dashboard/Commerce/manufacturer-records.test.ts +5 -17
- package/app/Actions/Dashboard/Commerce/manufacturer-records.ts +0 -29
- package/app/Actions/Dashboard/Email/captured-mail.test.ts +16 -0
- package/app/Actions/Dashboard/Email/captured-mail.ts +9 -1
- package/app/Actions/Dashboard/Models/model-write.ts +36 -3
- package/app/Actions/Dashboard/Notifications/NotificationDeliveryHistoryAction.ts +13 -58
- package/app/Actions/Dashboard/Notifications/notification-delivery-history.ts +74 -0
- package/app/Actions/SitemapAction.ts +3 -1
- package/app/Models/Notification.ts +3 -1
- package/app/Models/NotificationDelivery.ts +4 -0
- package/app/Models/User.ts +10 -1
- package/bootstrap.ts +10 -2
- package/functions/commerce/tax-types.ts +21 -0
- package/functions/dashboard-list.test.ts +16 -0
- package/functions/dashboard-list.ts +14 -6
- package/functions/dashboard-model-record.test.ts +139 -0
- package/functions/dashboard-model-record.ts +353 -0
- package/functions/monitoring/errors.ts +22 -103
- package/functions/notifications/deliveries.ts +7 -38
- package/functions/queries.ts +7 -10
- package/ide/vscode/package.json +1 -1
- package/package.json +5 -5
- package/resources/components/Dashboard/Analytics/AnalyticsHub.stx +2 -2
- package/resources/components/Dashboard/Analytics/CampaignAnalytics.stx +22 -28
- package/resources/components/Dashboard/Analytics/EventAnalytics.stx +26 -34
- package/resources/components/Dashboard/Analytics/SalesAnalytics.stx +29 -37
- package/resources/components/Dashboard/Analytics/WebAnalyticsBreakdown.stx +12 -16
- package/resources/components/Dashboard/Analytics/WebAnalyticsDashboard.stx +43 -53
- package/resources/components/Dashboard/App/RequestsOverview.stx +2 -1
- package/resources/components/Dashboard/App/SourceInventory.stx +2 -1
- package/resources/components/Dashboard/Auth/AccessTokens.stx +3 -5
- package/resources/components/Dashboard/Billing/BillingPaymentMethodsPanel.stx +9 -11
- package/resources/components/Dashboard/Billing/BillingSettings.stx +1 -1
- package/resources/components/Dashboard/Buddy/BuddyAssistant.stx +4 -6
- package/resources/components/Dashboard/Commerce/CommerceCategoriesDashboard.stx +2 -2
- package/resources/components/Dashboard/Commerce/CommerceCategoriesTable.stx +3 -3
- package/resources/components/Dashboard/Commerce/CommerceCategoryDialog.stx +2 -2
- package/resources/components/Dashboard/Commerce/CommerceCategoryHierarchy.stx +3 -5
- package/resources/components/Dashboard/Commerce/CommerceCouponBreakdown.stx +17 -13
- package/resources/components/Dashboard/Commerce/CommerceCouponDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/CommerceCouponsDashboard.stx +57 -85
- package/resources/components/Dashboard/Commerce/CommerceCouponsTable.stx +32 -9
- package/resources/components/Dashboard/Commerce/CommerceCustomerDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/CommerceCustomersDashboard.stx +49 -83
- package/resources/components/Dashboard/Commerce/CommerceCustomersTable.stx +32 -9
- package/resources/components/Dashboard/Commerce/CommerceGiftCardBreakdown.stx +9 -15
- package/resources/components/Dashboard/Commerce/CommerceGiftCardDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/CommerceGiftCardsDashboard.stx +35 -119
- package/resources/components/Dashboard/Commerce/CommerceGiftCardsTable.stx +3 -3
- package/resources/components/Dashboard/Commerce/CommerceManufacturerDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/CommerceManufacturersDashboard.stx +3 -5
- package/resources/components/Dashboard/Commerce/CommerceManufacturersTable.stx +2 -2
- package/resources/components/Dashboard/Commerce/CommerceOrderDialog.stx +4 -4
- package/resources/components/Dashboard/Commerce/CommerceOrdersDashboard.stx +42 -129
- package/resources/components/Dashboard/Commerce/CommerceOrdersTable.stx +3 -3
- package/resources/components/Dashboard/Commerce/CommerceOverviewDashboard.stx +1 -1
- package/resources/components/Dashboard/Commerce/CommerceOverviewOrdersTable.stx +9 -11
- package/resources/components/Dashboard/Commerce/CommerceOverviewProductsTable.stx +5 -7
- package/resources/components/Dashboard/Commerce/CommerceOverviewStats.stx +14 -16
- package/resources/components/Dashboard/Commerce/CommercePaymentsBreakdown.stx +12 -18
- package/resources/components/Dashboard/Commerce/CommercePaymentsDashboard.stx +41 -120
- package/resources/components/Dashboard/Commerce/CommercePaymentsTable.stx +1 -1
- package/resources/components/Dashboard/Commerce/CommercePosCart.stx +13 -15
- package/resources/components/Dashboard/Commerce/CommercePosCatalog.stx +17 -19
- package/resources/components/Dashboard/Commerce/CommercePosCheckoutDialog.stx +2 -2
- package/resources/components/Dashboard/Commerce/CommercePosDashboard.stx +1 -1
- package/resources/components/Dashboard/Commerce/CommercePosReceiptDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/CommerceProductDetailDashboard.stx +5 -5
- package/resources/components/Dashboard/Commerce/CommerceProductDialog.stx +3 -3
- package/resources/components/Dashboard/Commerce/CommerceProductsDashboard.stx +41 -122
- package/resources/components/Dashboard/Commerce/CommerceProductsTable.stx +3 -3
- package/resources/components/Dashboard/Commerce/CommerceReviewEditDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/CommerceReviewsDashboard.stx +38 -122
- package/resources/components/Dashboard/Commerce/CommerceReviewsTable.stx +2 -2
- package/resources/components/Dashboard/Commerce/CommerceTaxDialog.stx +3 -3
- package/resources/components/Dashboard/Commerce/CommerceTaxesDashboard.stx +5 -4
- package/resources/components/Dashboard/Commerce/CommerceTaxesTable.stx +4 -3
- package/resources/components/Dashboard/Commerce/CommerceUnitDialog.stx +3 -7
- package/resources/components/Dashboard/Commerce/CommerceUnitsDashboard.stx +3 -5
- package/resources/components/Dashboard/Commerce/CommerceUnitsTable.stx +2 -2
- package/resources/components/Dashboard/Commerce/CommerceVariantDialog.stx +3 -3
- package/resources/components/Dashboard/Commerce/CommerceVariantsDashboard.stx +4 -4
- package/resources/components/Dashboard/Commerce/CommerceVariantsTable.stx +3 -5
- package/resources/components/Dashboard/Commerce/Delivery/CourierDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/Delivery/CouriersDashboard.stx +1 -1
- package/resources/components/Dashboard/Commerce/Delivery/CouriersTable.stx +2 -2
- package/resources/components/Dashboard/Commerce/Delivery/DeliveryOverviewDashboard.stx +44 -52
- package/resources/components/Dashboard/Commerce/Delivery/DeliveryPagination.stx +2 -2
- package/resources/components/Dashboard/Commerce/Delivery/DeliveryRouteDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/Delivery/DeliveryRoutesDashboard.stx +1 -1
- package/resources/components/Dashboard/Commerce/Delivery/DeliveryRoutesTable.stx +2 -2
- package/resources/components/Dashboard/Commerce/Delivery/DigitalDeliveriesDashboard.stx +1 -1
- package/resources/components/Dashboard/Commerce/Delivery/DigitalDeliveryTable.stx +2 -2
- package/resources/components/Dashboard/Commerce/Delivery/LicenseKeyDialog.stx +3 -3
- package/resources/components/Dashboard/Commerce/Delivery/LicenseKeysDashboard.stx +1 -1
- package/resources/components/Dashboard/Commerce/Delivery/LicenseKeysTable.stx +2 -2
- package/resources/components/Dashboard/Commerce/Delivery/ShippingMethodsDashboard.stx +1 -1
- package/resources/components/Dashboard/Commerce/Delivery/ShippingMethodsTable.stx +2 -2
- package/resources/components/Dashboard/Commerce/Delivery/ShippingRateDialog.stx +2 -2
- package/resources/components/Dashboard/Commerce/Delivery/ShippingRatesDashboard.stx +1 -1
- package/resources/components/Dashboard/Commerce/Delivery/ShippingRatesTable.stx +2 -2
- package/resources/components/Dashboard/Commerce/Delivery/ShippingZoneDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/Delivery/ShippingZonesDashboard.stx +1 -1
- package/resources/components/Dashboard/Commerce/Delivery/ShippingZonesTable.stx +4 -8
- package/resources/components/Dashboard/Commerce/PaymentDetailsDialog.stx +1 -3
- package/resources/components/Dashboard/Commerce/PrintDeviceBreakdown.stx +9 -15
- package/resources/components/Dashboard/Commerce/PrintDeviceDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/PrintDevicesDashboard.stx +3 -3
- package/resources/components/Dashboard/Commerce/PrintDevicesTable.stx +3 -3
- package/resources/components/Dashboard/Commerce/PrintLogBreakdown.stx +3 -9
- package/resources/components/Dashboard/Commerce/PrintLogDetailsDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/PrintLogsDashboard.stx +4 -4
- package/resources/components/Dashboard/Commerce/PrintLogsTable.stx +8 -10
- package/resources/components/Dashboard/Commerce/ProductWaitlistDashboard.stx +37 -109
- package/resources/components/Dashboard/Commerce/ProductWaitlistEntryDialog.stx +3 -3
- package/resources/components/Dashboard/Commerce/ProductWaitlistTable.stx +2 -2
- package/resources/components/Dashboard/Commerce/RestaurantWaitlistDashboard.stx +38 -112
- package/resources/components/Dashboard/Commerce/RestaurantWaitlistEntryDialog.stx +2 -2
- package/resources/components/Dashboard/Commerce/RestaurantWaitlistTable.stx +2 -2
- package/resources/components/Dashboard/Content/AuthorsDashboard.stx +4 -4
- package/resources/components/Dashboard/Content/BlogDashboard.stx +4 -4
- package/resources/components/Dashboard/Content/CommentsDashboard.stx +36 -83
- package/resources/components/Dashboard/Content/ContentDashboard.stx +12 -14
- package/resources/components/Dashboard/Content/ContentTaxonomyDashboard.stx +2 -2
- package/resources/components/Dashboard/Content/FileManagerDashboard.stx +8 -12
- package/resources/components/Dashboard/Content/FileStoragePanel.stx +6 -10
- package/resources/components/Dashboard/Content/FileUploadDialog.stx +1 -3
- package/resources/components/Dashboard/Content/PagesDashboard.stx +39 -78
- package/resources/components/Dashboard/Content/PostEditorDialog.stx +4 -8
- package/resources/components/Dashboard/Content/PostsDashboard.stx +44 -85
- package/resources/components/Dashboard/Content/SeoDashboard.stx +5 -4
- package/resources/components/Dashboard/Data/DataRecords.stx +140 -12
- package/resources/components/Dashboard/Deployments/DeploymentList.stx +4 -4
- package/resources/components/Dashboard/Deployments/DeploymentTable.stx +3 -1
- package/resources/components/Dashboard/Elements/DropdownNavigation.stx +5 -7
- package/resources/components/Dashboard/Email/CapturedMailDashboard.stx +1 -3
- package/resources/components/Dashboard/Email/CapturedMailList.stx +18 -20
- package/resources/components/Dashboard/Email/EmailActivityDashboard.stx +24 -28
- package/resources/components/Dashboard/Email/EmailSettingsList.stx +6 -8
- package/resources/components/Dashboard/Email/EmailSettingsNavigation.stx +10 -12
- package/resources/components/Dashboard/Email/EmailSidebar.stx +33 -37
- package/resources/components/Dashboard/Email/InboxMessageDetail.stx +1 -1
- package/resources/components/Dashboard/Email/InboxMessageList.stx +16 -18
- package/resources/components/Dashboard/Email/InboxSettingsDashboard.stx +1 -1
- package/resources/components/Dashboard/Environment/EnvironmentDashboard.stx +2 -2
- package/resources/components/Dashboard/GlobalSearch.stx +19 -21
- package/resources/components/Dashboard/Home/DashboardHome.stx +8 -1
- package/resources/components/Dashboard/Infrastructure/CloudDashboard.stx +1 -1
- package/resources/components/Dashboard/Infrastructure/DnsDashboard.stx +27 -13
- package/resources/components/Dashboard/Infrastructure/LogsDashboard.stx +1 -1
- package/resources/components/Dashboard/Infrastructure/MailboxesDashboard.stx +46 -8
- package/resources/components/Dashboard/Infrastructure/ServerlessDashboard.stx +1 -1
- package/resources/components/Dashboard/Infrastructure/ServersDashboard.stx +1 -1
- package/resources/components/Dashboard/Jobs/JobDetail.stx +1 -1
- package/resources/components/Dashboard/Jobs/JobHistory.stx +44 -57
- package/resources/components/Dashboard/Jobs/JobTable.stx +23 -25
- package/resources/components/Dashboard/Kanban/KanbanCardDialog.stx +1 -1
- package/resources/components/Dashboard/Library/ComponentsDashboard.stx +1 -1
- package/resources/components/Dashboard/Management/AssignmentDrawer.stx +5 -7
- package/resources/components/Dashboard/Management/PermissionsDashboard.stx +35 -43
- package/resources/components/Dashboard/Marketing/AbandonedCartsDashboard.stx +11 -13
- package/resources/components/Dashboard/Marketing/CampaignDialog.stx +1 -3
- package/resources/components/Dashboard/Marketing/CampaignsDashboard.stx +2 -2
- package/resources/components/Dashboard/Marketing/CampaignsTable.stx +2 -2
- package/resources/components/Dashboard/Marketing/MarketingListsDashboard.stx +1 -1
- package/resources/components/Dashboard/Marketing/MarketingListsTable.stx +2 -2
- package/resources/components/Dashboard/Marketing/SocialPostDialog.stx +1 -3
- package/resources/components/Dashboard/Marketing/SocialPostsDashboard.stx +2 -2
- package/resources/components/Dashboard/Marketing/SocialPostsTable.stx +2 -2
- package/resources/components/Dashboard/Models/ModelRecordActions.stx +11 -2
- package/resources/components/Dashboard/Models/ModelRecordCreate.stx +193 -0
- package/resources/components/Dashboard/Models/ModelRecordDetail.stx +144 -0
- package/resources/components/Dashboard/Models/ModelRecordEdit.stx +176 -0
- package/resources/components/Dashboard/Models/ModelRecordsDashboard.stx +52 -186
- package/resources/components/Dashboard/Models/ModelsOverview.stx +2 -4
- package/resources/components/Dashboard/Monitoring/ErrorDashboard.stx +47 -81
- package/resources/components/Dashboard/Monitoring/ErrorTable.stx +4 -2
- package/resources/components/Dashboard/NotFoundDashboard.stx +4 -4
- package/resources/components/Dashboard/Notifications/NotificationDeliveryHistory.stx +43 -77
- package/resources/components/Dashboard/Notifications/NotificationDeliveryOverview.stx +15 -17
- package/resources/components/Dashboard/Notifications/NotificationDeliveryTable.stx +1 -1
- package/resources/components/Dashboard/Operations/AuditDashboard.stx +1 -1
- package/resources/components/Dashboard/Operations/ChangeDashboard.stx +1 -1
- package/resources/components/Dashboard/Operations/IncidentDashboard.stx +1 -1
- package/resources/components/Dashboard/Operations/MigrationDashboard.stx +2 -2
- package/resources/components/Dashboard/Operations/RecoveryDashboard.stx +1 -1
- package/resources/components/Dashboard/Operations/SchedulerDashboard.stx +1 -1
- package/resources/components/Dashboard/Queries/QueryDashboard.stx +60 -86
- package/resources/components/Dashboard/Queries/QueryDetail.stx +5 -9
- package/resources/components/Dashboard/Realtime/RealtimeDashboard.stx +6 -8
- package/resources/components/Dashboard/Remote/RemoteConsole.stx +14 -20
- package/resources/components/Dashboard/Settings/AppearanceSettingsDashboard.stx +48 -54
- package/resources/components/Dashboard/Settings/MailSettingsDashboard.stx +8 -8
- package/resources/components/Dashboard/Settings/SettingsDashboard.stx +43 -47
- package/resources/components/Dashboard/Teams/TeamInvitationDashboard.stx +2 -2
- package/resources/components/Dashboard/UI/ActivityTable.stx +2 -1
- package/resources/components/Dashboard/UI/Button.stx +15 -0
- package/resources/components/Dashboard/UI/MetricCards.stx +5 -7
- package/resources/components/Dashboard/UI/Pagination.stx +3 -5
- package/resources/components/Dashboard/UI/QuickLinks.stx +2 -2
- package/resources/components/Dashboard/UI/Select.stx +1 -0
- package/resources/components/Dashboard/UI/Table.stx +139 -96
- package/resources/components/Dashboard/UI/Tabs.stx +18 -20
- package/routes/dashboard-api.ts +2 -0
- package/routes/dashboard.ts +246 -253
- package/routes/storefront.ts +31 -0
- package/stx-components-plugin.ts +12 -1
- package/views/dashboard/content/categories/index.stx +1 -1
- package/views/dashboard/content/tags/index.stx +1 -1
- package/views/dashboard/layouts/default.stx +27 -12
- package/views/dashboard/models/[model]/[id]/edit.stx +8 -0
- package/views/dashboard/models/[model]/[id].stx +8 -0
- package/views/dashboard/models/[model]/create.stx +8 -0
- package/resources/components/Dashboard/CreateRecordModal.stx +0 -138
- package/resources/components/Dashboard/Models/EditRecordModal.stx +0 -81
|
@@ -46,12 +46,10 @@ function volumeWidth(count: number): string {
|
|
|
46
46
|
<article class="p-4 bg-white dark:bg-neutral-800 border border-gray-200 rounded-lg dark:border-neutral-700">
|
|
47
47
|
<h2 class="font-semibold text-gray-900 text-sm dark:text-white">Device status</h2>
|
|
48
48
|
<div class="mt-4 space-y-3">
|
|
49
|
-
<
|
|
50
|
-
<div>
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
</div>
|
|
54
|
-
</template>
|
|
49
|
+
<div :for="item in statusCounts()" :key="item.status">
|
|
50
|
+
<div class="flex justify-between text-xs"><span class="text-gray-500 dark:text-neutral-400">{{ item.label }}</span><span class="font-mono text-gray-700 dark:text-neutral-200">{{ item.count }}</span></div>
|
|
51
|
+
<div class="mt-1 h-1.5 bg-gray-100 dark:bg-neutral-700 rounded-full"><div :class="'h-full rounded-full ' + item.color" :style="'width: ' + statusWidth(item.count)"></div></div>
|
|
52
|
+
</div>
|
|
55
53
|
</div>
|
|
56
54
|
</article>
|
|
57
55
|
|
|
@@ -59,9 +57,7 @@ function volumeWidth(count: number): string {
|
|
|
59
57
|
<h2 class="font-semibold text-gray-900 text-sm dark:text-white">Devices by location</h2>
|
|
60
58
|
<div :if="locationCounts().length === 0" class="mt-4 text-gray-500 text-sm dark:text-neutral-400">No locations recorded.</div>
|
|
61
59
|
<ol :else class="mt-3 divide-gray-100 divide-y dark:divide-neutral-700">
|
|
62
|
-
<
|
|
63
|
-
<li class="flex items-center justify-between py-2 text-sm"><span class="text-gray-600 truncate dark:text-neutral-300">{{ item.name }}</span><span class="ml-3 font-mono text-gray-900 dark:text-white">{{ item.count }}</span></li>
|
|
64
|
-
</template>
|
|
60
|
+
<li :for="item in locationCounts()" :key="item.name" class="flex items-center justify-between py-2 text-sm"><span class="text-gray-600 truncate dark:text-neutral-300">{{ item.name }}</span><span class="ml-3 font-mono text-gray-900 dark:text-white">{{ item.count }}</span></li>
|
|
65
61
|
</ol>
|
|
66
62
|
</article>
|
|
67
63
|
|
|
@@ -69,12 +65,10 @@ function volumeWidth(count: number): string {
|
|
|
69
65
|
<h2 class="font-semibold text-gray-900 text-sm dark:text-white">Highest print volume</h2>
|
|
70
66
|
<div :if="printVolumes().length === 0" class="mt-4 text-gray-500 text-sm dark:text-neutral-400">No print volume recorded.</div>
|
|
71
67
|
<div :else class="mt-4 space-y-3">
|
|
72
|
-
<
|
|
73
|
-
<div>
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
</div>
|
|
77
|
-
</template>
|
|
68
|
+
<div :for="record in printVolumes()" :key="record.id">
|
|
69
|
+
<div class="flex gap-3 justify-between text-xs"><span class="text-gray-500 truncate dark:text-neutral-400">{{ record.name }}</span><span class="font-mono text-gray-700 dark:text-neutral-200">{{ record.printCount.toLocaleString() }}</span></div>
|
|
70
|
+
<div class="mt-1 h-1.5 bg-gray-100 dark:bg-neutral-700 rounded-full"><div class="h-full bg-blue-500 rounded-full" :style="'width: ' + volumeWidth(record.printCount)"></div></div>
|
|
71
|
+
</div>
|
|
78
72
|
</div>
|
|
79
73
|
</article>
|
|
80
74
|
</section>
|
|
@@ -65,7 +65,7 @@ function errorMessages(): string[] {
|
|
|
65
65
|
>
|
|
66
66
|
<form id="print-device-form" @submit.prevent="submit">
|
|
67
67
|
<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">
|
|
68
|
-
<
|
|
68
|
+
<li :for="message in errorMessages()" :key="message">{{ message }}</li>
|
|
69
69
|
</ul>
|
|
70
70
|
<div class="grid gap-4 grid-cols-1 sm:grid-cols-2">
|
|
71
71
|
<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>
|
|
@@ -227,7 +227,7 @@ onMount(() => {
|
|
|
227
227
|
})
|
|
228
228
|
</script>
|
|
229
229
|
|
|
230
|
-
<div class="
|
|
230
|
+
<div class="flex flex-col gap-6">
|
|
231
231
|
<PageHeader title="Receipt printers" description="Manage native PrintDevice records and inspect their persisted operational state.">
|
|
232
232
|
<div class="flex flex-wrap gap-2">
|
|
233
233
|
<Button variant="secondary" :loading="loading()" @click="loadPrintDevices"><span :if="!loading()" class="h-4 w-4 i-hugeicons-refresh"></span>Refresh</Button>
|
|
@@ -242,7 +242,7 @@ onMount(() => {
|
|
|
242
242
|
|
|
243
243
|
<PrintDeviceBreakdown :records="records()" />
|
|
244
244
|
|
|
245
|
-
<section class="
|
|
245
|
+
<section class="flex flex-col gap-3">
|
|
246
246
|
<div class="grid gap-3 grid-cols-1 sm:grid-cols-2 xl:grid-cols-5">
|
|
247
247
|
<label class="relative sm:col-span-2">
|
|
248
248
|
<span class="sr-only">Search print devices</span>
|
|
@@ -250,7 +250,7 @@ onMount(() => {
|
|
|
250
250
|
<input x-model="search" type="search" placeholder="Search printers, locations, or terminals" 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
251
|
</label>
|
|
252
252
|
<label><span class="sr-only">Printer 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 value="online">Online</option><option value="warning">Warning</option><option value="offline">Offline</option></select></label>
|
|
253
|
-
<label><span class="sr-only">Printer location</span><select x-model="locationFilter" 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 locations</option><
|
|
253
|
+
<label><span class="sr-only">Printer location</span><select x-model="locationFilter" 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 locations</option><option :for="location in locations()" :key="location" :value="location">{{ location }}</option></select></label>
|
|
254
254
|
<label><span class="sr-only">Sort print devices</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="name">Name</option><option value="prints">Most prints</option><option value="heartbeat">Recent heartbeat</option><option value="status">Status</option></select></label>
|
|
255
255
|
</div>
|
|
256
256
|
|
|
@@ -51,9 +51,9 @@ const COLUMNS = [
|
|
|
51
51
|
]
|
|
52
52
|
|
|
53
53
|
const ROW_ACTIONS = [
|
|
54
|
-
{ action: 'view', label: 'View'
|
|
55
|
-
{ action: 'edit', label: 'Edit'
|
|
56
|
-
{ action: 'delete', label: 'Delete'
|
|
54
|
+
{ action: 'view', label: 'View' },
|
|
55
|
+
{ action: 'edit', label: 'Edit' },
|
|
56
|
+
{ action: 'delete', label: 'Delete' },
|
|
57
57
|
]
|
|
58
58
|
|
|
59
59
|
const rows = derived(() => records().map(record => ({
|
|
@@ -53,9 +53,7 @@ function hourlyRows(): CountRow[] {
|
|
|
53
53
|
<article class="p-4 bg-white dark:bg-neutral-800 border border-gray-200 rounded-lg dark:border-neutral-700">
|
|
54
54
|
<h2 class="font-semibold text-gray-900 text-sm dark:text-white">Outcomes</h2>
|
|
55
55
|
<div class="mt-4 space-y-3">
|
|
56
|
-
<
|
|
57
|
-
<div><div class="flex items-center justify-between text-xs"><span class="capitalize text-gray-600 dark:text-neutral-300">{{ item.key }}</span><span class="text-gray-500 dark:text-neutral-400">{{ item.count }} · {{ item.percentage }}%</span></div><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></div>
|
|
58
|
-
</template>
|
|
56
|
+
<div :for="item in countRows('status')" :key="item.key"><div class="flex items-center justify-between text-xs"><span class="capitalize text-gray-600 dark:text-neutral-300">{{ item.key }}</span><span class="text-gray-500 dark:text-neutral-400">{{ item.count }} · {{ item.percentage }}%</span></div><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></div>
|
|
59
57
|
<p :if="countRows('status').length === 0" class="py-8 text-center text-gray-500 text-sm dark:text-neutral-400">No outcomes in this view.</p>
|
|
60
58
|
</div>
|
|
61
59
|
</article>
|
|
@@ -63,9 +61,7 @@ function hourlyRows(): CountRow[] {
|
|
|
63
61
|
<article class="p-4 bg-white dark:bg-neutral-800 border border-gray-200 rounded-lg dark:border-neutral-700">
|
|
64
62
|
<h2 class="font-semibold text-gray-900 text-sm dark:text-white">Printers</h2>
|
|
65
63
|
<div class="mt-4 space-y-3">
|
|
66
|
-
<
|
|
67
|
-
<div><div class="flex items-center justify-between text-xs"><span class="max-w-48 text-gray-600 truncate dark:text-neutral-300">{{ item.key }}</span><span class="text-gray-500 dark:text-neutral-400">{{ item.count }} · {{ item.percentage }}%</span></div><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></div>
|
|
68
|
-
</template>
|
|
64
|
+
<div :for="item in countRows('printer')" :key="item.key"><div class="flex items-center justify-between text-xs"><span class="max-w-48 text-gray-600 truncate dark:text-neutral-300">{{ item.key }}</span><span class="text-gray-500 dark:text-neutral-400">{{ item.count }} · {{ item.percentage }}%</span></div><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></div>
|
|
69
65
|
<p :if="countRows('printer').length === 0" class="py-8 text-center text-gray-500 text-sm dark:text-neutral-400">No printers in this view.</p>
|
|
70
66
|
</div>
|
|
71
67
|
</article>
|
|
@@ -73,9 +69,7 @@ function hourlyRows(): CountRow[] {
|
|
|
73
69
|
<article class="p-4 bg-white dark:bg-neutral-800 border border-gray-200 rounded-lg dark:border-neutral-700">
|
|
74
70
|
<div class="flex items-start justify-between"><h2 class="font-semibold text-gray-900 text-sm dark:text-white">Prints by hour</h2><span class="text-gray-500 text-xs dark:text-neutral-500">Local time</span></div>
|
|
75
71
|
<div class="mt-4 space-y-3">
|
|
76
|
-
<
|
|
77
|
-
<div class="grid gap-3 grid-cols-[4rem_1fr_auto] items-center"><span class="text-gray-500 text-xs dark:text-neutral-400">{{ item.key }}</span><div class="h-1.5 bg-gray-100 dark:bg-neutral-700 rounded-full"><div :style="'width:' + item.percentage + '%'" class="h-1.5 bg-violet-500 rounded-full"></div></div><span class="text-gray-500 text-xs dark:text-neutral-400">{{ item.count }}</span></div>
|
|
78
|
-
</template>
|
|
72
|
+
<div :for="item in hourlyRows()" :key="item.key" class="grid gap-3 grid-cols-[4rem_1fr_auto] items-center"><span class="text-gray-500 text-xs dark:text-neutral-400">{{ item.key }}</span><div class="h-1.5 bg-gray-100 dark:bg-neutral-700 rounded-full"><div :style="'width:' + item.percentage + '%'" class="h-1.5 bg-violet-500 rounded-full"></div></div><span class="text-gray-500 text-xs dark:text-neutral-400">{{ item.count }}</span></div>
|
|
79
73
|
<p :if="hourlyRows().length === 0" class="py-8 text-center text-gray-500 text-sm dark:text-neutral-400">No timestamped jobs in this view.</p>
|
|
80
74
|
</div>
|
|
81
75
|
</article>
|
|
@@ -39,7 +39,7 @@ function details(): Array<{ label: string, value: string }> {
|
|
|
39
39
|
<template #header-trailing>
|
|
40
40
|
<span class="px-2 py-1 capitalize font-medium text-gray-700 text-xs dark:text-neutral-200 bg-gray-100 dark:bg-neutral-700 rounded-full">{{ record()?.status }}</span>
|
|
41
41
|
</template>
|
|
42
|
-
<dl class="grid gap-x-6 gap-y-4 sm:grid-cols-2"><
|
|
42
|
+
<dl class="grid gap-x-6 gap-y-4 sm:grid-cols-2"><div :for="item in details()" :key="item.label"><dt class="text-gray-500 text-xs dark:text-neutral-500">{{ item.label }}</dt><dd class="mt-1 break-all text-gray-800 text-sm dark:text-neutral-100">{{ item.value }}</dd></div></dl>
|
|
43
43
|
<div :if="record()?.metadata && record()?.metadata !== '{}'" class="mt-5"><p class="text-gray-500 text-xs dark:text-neutral-500">Metadata</p><pre class="overflow-x-auto mt-1 p-3 text-gray-700 text-xs whitespace-pre-wrap dark:text-neutral-200 bg-gray-50 dark:bg-neutral-900/60 rounded-lg">{{ record()?.metadata }}</pre></div>
|
|
44
44
|
<template #footer><Button variant="secondary" @click="emit('close')">Close</Button></template>
|
|
45
45
|
</Modal>
|
|
@@ -189,7 +189,7 @@ onMount(() => {
|
|
|
189
189
|
})
|
|
190
190
|
</script>
|
|
191
191
|
|
|
192
|
-
<div class="
|
|
192
|
+
<div class="flex flex-col gap-6">
|
|
193
193
|
<PageHeader title="Print logs" description="Inspect native Receipt records from configured print devices.">
|
|
194
194
|
<div class="flex flex-wrap gap-2">
|
|
195
195
|
<Button variant="secondary" :loading="loading()" @click="loadPrintLogs"><span :if="!loading()" class="h-4 w-4 i-hugeicons-refresh"></span>Refresh</Button>
|
|
@@ -203,15 +203,15 @@ onMount(() => {
|
|
|
203
203
|
|
|
204
204
|
<PrintLogBreakdown :breakdown="breakdown()" />
|
|
205
205
|
|
|
206
|
-
<section class="
|
|
206
|
+
<section class="flex flex-col gap-3">
|
|
207
207
|
<div class="grid gap-3 grid-cols-1 sm:grid-cols-2 xl:grid-cols-6">
|
|
208
208
|
<label class="relative sm:col-span-2">
|
|
209
209
|
<span class="sr-only">Search print logs</span>
|
|
210
210
|
<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>
|
|
211
211
|
<input x-model="search" type="search" placeholder="Search documents, printers, or outcomes" 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" @input="loadSearch()" />
|
|
212
212
|
</label>
|
|
213
|
-
<label><span class="sr-only">Printer</span><select x-model="printerFilter" 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="reloadFilters()"><option value="all">All printers</option><
|
|
214
|
-
<label><span class="sr-only">Print 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" @change="reloadFilters()"><option value="all">All statuses</option><
|
|
213
|
+
<label><span class="sr-only">Printer</span><select x-model="printerFilter" 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="reloadFilters()"><option value="all">All printers</option><option :for="printer in printers()" :key="printer" :value="printer">{{ printer }}</option></select></label>
|
|
214
|
+
<label><span class="sr-only">Print 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" @change="reloadFilters()"><option value="all">All statuses</option><option :for="status in statuses()" :key="status" :value="status">{{ status }}</option></select></label>
|
|
215
215
|
<label><span class="sr-only">Print log 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" @change="reloadFilters()"><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="all">All time</option></select></label>
|
|
216
216
|
<label><span class="sr-only">Sort print logs</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" @change="reloadFilters()"><option value="newest">Newest</option><option value="oldest">Oldest</option><option value="printer">Printer</option><option value="duration">Longest duration</option></select></label>
|
|
217
217
|
</div>
|
|
@@ -29,16 +29,14 @@ function statusClass(status: string): string {
|
|
|
29
29
|
<table class="min-w-full divide-gray-200 divide-y dark:divide-neutral-700">
|
|
30
30
|
<thead class="bg-gray-50 dark:bg-neutral-900/50"><tr><th scope="col" class="px-4 py-3 font-semibold text-gray-600 text-left text-xs dark:text-neutral-300">Document</th><th scope="col" class="px-4 py-3 font-semibold text-gray-600 text-left text-xs dark:text-neutral-300">Printer</th><th scope="col" class="px-4 py-3 font-semibold text-gray-600 text-left text-xs dark:text-neutral-300">Outcome</th><th scope="col" class="px-4 py-3 font-semibold text-gray-600 text-left text-xs dark:text-neutral-300">Output</th><th scope="col" class="px-4 py-3 font-semibold text-gray-600 text-left text-xs dark:text-neutral-300">Printed</th><th scope="col" class="px-4 py-3 font-semibold text-gray-600 text-right text-xs dark:text-neutral-300"><span class="sr-only">Actions</span></th></tr></thead>
|
|
31
31
|
<tbody class="divide-gray-200 divide-y dark:divide-neutral-700">
|
|
32
|
-
<
|
|
33
|
-
<
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
</tr>
|
|
41
|
-
</template>
|
|
32
|
+
<tr :for="record in records()" :key="record.id">
|
|
33
|
+
<td class="px-4 py-4"><p class="font-medium text-gray-900 text-sm dark:text-white">{{ record.document || 'Untitled print job' }}</p><p class="mt-1 text-gray-500 text-xs dark:text-neutral-500">Log #{{ record.id }}</p></td>
|
|
34
|
+
<td class="px-4 py-4"><p class="text-gray-700 text-sm dark:text-neutral-200">{{ record.printer || 'Unknown printer' }}</p><p class="mt-1 text-gray-500 text-xs dark:text-neutral-500">{{ record.printDeviceId ? 'Device #' + record.printDeviceId : 'No linked device' }}</p></td>
|
|
35
|
+
<td class="px-4 py-4"><span :class="'inline-flex px-2 py-1 font-medium text-xs capitalize rounded-full ' + statusClass(record.status)">{{ record.status || 'unknown' }}</span></td>
|
|
36
|
+
<td class="px-4 py-4"><p class="text-gray-700 text-sm dark:text-neutral-200">{{ record.pages }} pages</p><p class="mt-1 text-gray-500 text-xs dark:text-neutral-500">{{ record.sizeKb }} KB · {{ record.durationSeconds }}s</p></td>
|
|
37
|
+
<td class="px-4 py-4 text-gray-500 text-sm whitespace-nowrap dark:text-neutral-400">{{ date(record.timestamp) }}</td>
|
|
38
|
+
<td class="px-4 py-4"><div class="flex gap-1 justify-end"><Button variant="ghost" size="sm" iconOnly :ariaLabel="'View print log ' + record.id" @click="emit('view', record)"><span class="block h-4 w-4 text-neutral-500 dark:text-neutral-400 i-hugeicons-view"></span></Button><Button variant="ghost" size="sm" iconOnly :ariaLabel="'Delete print log ' + record.id" @click="emit('delete', record)"><span class="block h-4 w-4 text-red-500 i-hugeicons-delete-02"></span></Button></div></td>
|
|
39
|
+
</tr>
|
|
42
40
|
</tbody>
|
|
43
41
|
</table>
|
|
44
42
|
</div>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script client>
|
|
2
2
|
import type { ProductWaitlistRecord, ProductWaitlistSummary, ProductWaitlistWritePayload } from '../../../../app/Actions/Dashboard/Commerce/product-waitlist-records'
|
|
3
3
|
import { DashboardApiError, dashboardApi } from '../../../../functions/dashboard-api'
|
|
4
|
+
import { useServerList } from '../../../../functions/dashboard-list'
|
|
4
5
|
import { pushToast } from '../../../../functions/toasts'
|
|
5
6
|
|
|
6
7
|
interface ProductWaitlistResponse {
|
|
@@ -11,23 +12,10 @@ interface ProductWaitlistResponse {
|
|
|
11
12
|
summary: ProductWaitlistSummary
|
|
12
13
|
}
|
|
13
14
|
|
|
14
|
-
const records = state<ProductWaitlistRecord[]>([])
|
|
15
15
|
const summary = state<ProductWaitlistSummary>({ total: 0, waiting: 0, notified: 0, purchased: 0, conversionRate: 0 })
|
|
16
16
|
/** Whether any product exists, so an entry can be added at all. */
|
|
17
17
|
const hasProducts = state(true)
|
|
18
|
-
const search = state('')
|
|
19
18
|
const status = state('all')
|
|
20
|
-
// The server searches, filters, sorts and pages (stacksjs/stacks#3218), where
|
|
21
|
-
// this page used to do all of that with the newest 500.
|
|
22
|
-
const matchingTotal = state(0)
|
|
23
|
-
const page = state(1)
|
|
24
|
-
const perPage = state(25)
|
|
25
|
-
const appliedSearch = state('')
|
|
26
|
-
const headerSort = state<{ sort: string, direction: string } | null>(null)
|
|
27
|
-
let listRequest = 0
|
|
28
|
-
let searchTimer: ReturnType<typeof setTimeout> | null = null
|
|
29
|
-
const isLoading = state(true)
|
|
30
|
-
const loadError = state('')
|
|
31
19
|
const entryDialogOpen = state(false)
|
|
32
20
|
const entryDialogMode = state<'add' | 'edit'>('add')
|
|
33
21
|
const editingRecord = state<ProductWaitlistRecord | null>(null)
|
|
@@ -53,9 +41,35 @@ const COLUMN_SORTS: Record<string, string> = {
|
|
|
53
41
|
createdAt: 'created',
|
|
54
42
|
}
|
|
55
43
|
|
|
44
|
+
// The server searches, filters, sorts and pages (stacksjs/stacks#3218);
|
|
45
|
+
// useServerList keeps the request order, paging, header sort and search
|
|
46
|
+
// debounce this page used to keep itself.
|
|
47
|
+
const {
|
|
48
|
+
records,
|
|
49
|
+
total,
|
|
50
|
+
page,
|
|
51
|
+
perPage,
|
|
52
|
+
search,
|
|
53
|
+
loading: isLoading,
|
|
54
|
+
loadError,
|
|
55
|
+
load,
|
|
56
|
+
changePage,
|
|
57
|
+
changePageSize,
|
|
58
|
+
changeSort,
|
|
59
|
+
} = useServerList<ProductWaitlistRecord>({
|
|
60
|
+
fetch: query => dashboardApi<ProductWaitlistResponse>(`/api/dashboard/commerce/waitlist-products?${query}`),
|
|
61
|
+
defaultSort: { sort: 'created', direction: 'desc' },
|
|
62
|
+
columnSorts: COLUMN_SORTS,
|
|
63
|
+
filters: () => ({ status: status() }),
|
|
64
|
+
onLoad: (result) => {
|
|
65
|
+
summary.set((result as ProductWaitlistResponse).summary ?? { total: 0, waiting: 0, notified: 0, purchased: 0, conversionRate: 0 })
|
|
66
|
+
},
|
|
67
|
+
onError: error => pushToast('error', 'Could not load product waitlist', { detail: error instanceof Error ? error.message : String(error) }),
|
|
68
|
+
})
|
|
69
|
+
|
|
56
70
|
function matchingLabel(): string {
|
|
57
|
-
const count =
|
|
58
|
-
return `${count} matching ${count === 1 ? 'entry' : 'entries'}`
|
|
71
|
+
const count = total()
|
|
72
|
+
return `${count.toLocaleString()} matching ${count === 1 ? 'entry' : 'entries'}`
|
|
59
73
|
}
|
|
60
74
|
|
|
61
75
|
function openAddDialog(): void {
|
|
@@ -89,42 +103,8 @@ function closeDeleteDialog(): void {
|
|
|
89
103
|
deleteRecord.set(null)
|
|
90
104
|
}
|
|
91
105
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
isLoading.set(true)
|
|
95
|
-
loadError.set('')
|
|
96
|
-
try {
|
|
97
|
-
const params = new URLSearchParams()
|
|
98
|
-
const order = headerSort() ?? { sort: 'created', direction: 'desc' }
|
|
99
|
-
params.set('sort', order.sort)
|
|
100
|
-
params.set('direction', order.direction)
|
|
101
|
-
if (appliedSearch())
|
|
102
|
-
params.set('q', appliedSearch())
|
|
103
|
-
if (status() !== 'all')
|
|
104
|
-
params.set('status', status())
|
|
105
|
-
params.set('page', String(page()))
|
|
106
|
-
params.set('per_page', String(perPage()))
|
|
107
|
-
const result = await dashboardApi<ProductWaitlistResponse>(`/api/dashboard/commerce/waitlist-products?${params}`)
|
|
108
|
-
// Only the newest request lands.
|
|
109
|
-
if (request !== listRequest)
|
|
110
|
-
return
|
|
111
|
-
records.set(Array.isArray(result.records) ? result.records : [])
|
|
112
|
-
matchingTotal.set(Number(result.total) || 0)
|
|
113
|
-
page.set(Number(result.page) || 1)
|
|
114
|
-
summary.set(result.summary ?? { total: 0, waiting: 0, notified: 0, purchased: 0, conversionRate: 0 })
|
|
115
|
-
}
|
|
116
|
-
catch (error) {
|
|
117
|
-
if (request !== listRequest)
|
|
118
|
-
return
|
|
119
|
-
loadError.set('Product waitlist records could not be loaded.')
|
|
120
|
-
pushToast('error', 'Could not load product waitlist', {
|
|
121
|
-
detail: error instanceof Error ? error.message : String(error),
|
|
122
|
-
})
|
|
123
|
-
}
|
|
124
|
-
finally {
|
|
125
|
-
if (request === listRequest)
|
|
126
|
-
isLoading.set(false)
|
|
127
|
-
}
|
|
106
|
+
function loadRecords(): Promise<void> {
|
|
107
|
+
return load()
|
|
128
108
|
}
|
|
129
109
|
|
|
130
110
|
/** Whether there is any product to make an entry for: one choice is enough to know. */
|
|
@@ -139,56 +119,6 @@ async function loadHasProducts(): Promise<void> {
|
|
|
139
119
|
}
|
|
140
120
|
}
|
|
141
121
|
|
|
142
|
-
function eventValue<T>(value: T | CustomEvent<T>): T {
|
|
143
|
-
return value instanceof CustomEvent ? value.detail : value
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
function changePage(value: number | CustomEvent<number>): void {
|
|
147
|
-
page.set(Number(eventValue(value)) || 1)
|
|
148
|
-
void loadRecords()
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
function changePageSize(value: number | CustomEvent<number>): void {
|
|
152
|
-
perPage.set(Number(eventValue(value)) || 25)
|
|
153
|
-
page.set(1)
|
|
154
|
-
void loadRecords()
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
function changeColumnSort(value: { key: string, direction: string } | CustomEvent<{ key: string, direction: string }>): void {
|
|
158
|
-
const column = eventValue(value)
|
|
159
|
-
const serverSort = COLUMN_SORTS[column.key]
|
|
160
|
-
headerSort.set(serverSort ? { sort: serverSort, direction: column.direction === 'asc' ? 'asc' : 'desc' } : null)
|
|
161
|
-
page.set(1)
|
|
162
|
-
void loadRecords()
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
// The status filter asks the server for page 1 when it changes, and the
|
|
166
|
-
// search once typing pauses.
|
|
167
|
-
let shownStatus = status()
|
|
168
|
-
effect(() => {
|
|
169
|
-
const current = status()
|
|
170
|
-
if (current === shownStatus)
|
|
171
|
-
return
|
|
172
|
-
shownStatus = current
|
|
173
|
-
page.set(1)
|
|
174
|
-
void loadRecords()
|
|
175
|
-
})
|
|
176
|
-
|
|
177
|
-
let shownSearch = search().trim()
|
|
178
|
-
effect(() => {
|
|
179
|
-
const term = search().trim()
|
|
180
|
-
if (term === shownSearch)
|
|
181
|
-
return
|
|
182
|
-
shownSearch = term
|
|
183
|
-
if (searchTimer)
|
|
184
|
-
clearTimeout(searchTimer)
|
|
185
|
-
searchTimer = setTimeout(() => {
|
|
186
|
-
appliedSearch.set(term)
|
|
187
|
-
page.set(1)
|
|
188
|
-
void loadRecords()
|
|
189
|
-
}, 250)
|
|
190
|
-
})
|
|
191
|
-
|
|
192
122
|
async function saveRecord(payload: ProductWaitlistWritePayload): Promise<void> {
|
|
193
123
|
const current = editingRecord()
|
|
194
124
|
const isEditing = entryDialogMode() === 'edit' && current !== null
|
|
@@ -266,15 +196,13 @@ onMount(() => {
|
|
|
266
196
|
</div>
|
|
267
197
|
|
|
268
198
|
<section class="grid gap-3 grid-cols-2 lg:grid-cols-5">
|
|
269
|
-
<
|
|
270
|
-
<
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
</div>
|
|
274
|
-
</template>
|
|
199
|
+
<div :for="item in metrics()" class="p-4 bg-white dark:bg-neutral-800 border border-gray-200 rounded-lg dark:border-neutral-700">
|
|
200
|
+
<p class="text-gray-500 text-xs uppercase dark:text-neutral-400">{{ item.label }}</p>
|
|
201
|
+
<p class="mt-2 font-semibold text-2xl text-gray-900 dark:text-white">{{ item.value }}</p>
|
|
202
|
+
</div>
|
|
275
203
|
</section>
|
|
276
204
|
|
|
277
|
-
<section class="
|
|
205
|
+
<section class="flex flex-col gap-3">
|
|
278
206
|
<div class="flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between">
|
|
279
207
|
<div>
|
|
280
208
|
<h2 class="font-semibold text-gray-900 dark:text-white">Waitlist entries</h2>
|
|
@@ -294,7 +222,7 @@ onMount(() => {
|
|
|
294
222
|
</div>
|
|
295
223
|
</div>
|
|
296
224
|
|
|
297
|
-
<ProductWaitlistTable :records="records()" :total="
|
|
225
|
+
<ProductWaitlistTable :records="records()" :total="total()" :current-page="page()" :per-page="perPage()" :loading="isLoading()" @edit="openEditDialog" @delete="openDeleteDialog" @page-change="changePage" @page-size-change="changePageSize" @sort="changeSort" />
|
|
298
226
|
</section>
|
|
299
227
|
</div>
|
|
300
228
|
|
|
@@ -189,7 +189,7 @@ function errorMessages(): string[] {
|
|
|
189
189
|
>
|
|
190
190
|
<form id="product-waitlist-entry-form" @submit.prevent="submitForm()">
|
|
191
191
|
<ul :if="errorMessages().length > 0" class="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">
|
|
192
|
-
<
|
|
192
|
+
<li :for="message in errorMessages()" :key="message">{{ message }}</li>
|
|
193
193
|
</ul>
|
|
194
194
|
|
|
195
195
|
<div class="grid gap-4 sm:grid-cols-2 mt-6">
|
|
@@ -200,7 +200,7 @@ function errorMessages(): string[] {
|
|
|
200
200
|
<div class="sm:col-span-2 -mt-2">
|
|
201
201
|
<select x-model="productId" required aria-label="Product" class="block px-3 py-2 w-full text-gray-900 text-sm dark:text-white bg-white dark:bg-neutral-700 border border-gray-300 rounded-md dark:border-neutral-600">
|
|
202
202
|
<option value="">Select a product</option>
|
|
203
|
-
<
|
|
203
|
+
<option :for="option in products()" :key="option.id" :value="option.id" :selected="option.id === String(productId())">{{ option.label }}{{ option.detail ? ' · ' + option.detail : '' }}</option>
|
|
204
204
|
</select>
|
|
205
205
|
<p :if="moreLabel(productChoices().length, productMatches(), 'products')" class="mt-1 text-gray-500 text-xs dark:text-neutral-400" :text="moreLabel(productChoices().length, productMatches(), 'products')"></p>
|
|
206
206
|
</div>
|
|
@@ -212,7 +212,7 @@ function errorMessages(): string[] {
|
|
|
212
212
|
<div class="sm:col-span-2 -mt-2">
|
|
213
213
|
<select x-model="customerId" aria-label="Existing customer" class="block px-3 py-2 w-full text-gray-900 text-sm dark:text-white bg-white dark:bg-neutral-700 border border-gray-300 rounded-md dark:border-neutral-600" @change="hydrateCustomer($event)">
|
|
214
214
|
<option value="">No linked customer</option>
|
|
215
|
-
<
|
|
215
|
+
<option :for="option in customers()" :key="option.id" :value="option.id" :selected="option.id === String(customerId())">{{ option.label }}{{ option.detail ? ' · ' + option.detail : '' }}</option>
|
|
216
216
|
</select>
|
|
217
217
|
<p :if="moreLabel(customerChoices().length, customerMatches(), 'customers')" class="mt-1 text-gray-500 text-xs dark:text-neutral-400" :text="moreLabel(customerChoices().length, customerMatches(), 'customers')"></p>
|
|
218
218
|
</div>
|
|
@@ -30,8 +30,8 @@ const COLUMNS = [
|
|
|
30
30
|
]
|
|
31
31
|
|
|
32
32
|
const ROW_ACTIONS = [
|
|
33
|
-
{ action: 'edit', label: 'Edit waitlist entry for'
|
|
34
|
-
{ action: 'delete', label: 'Delete waitlist entry for'
|
|
33
|
+
{ action: 'edit', label: 'Edit waitlist entry for' },
|
|
34
|
+
{ action: 'delete', label: 'Delete waitlist entry for' },
|
|
35
35
|
]
|
|
36
36
|
|
|
37
37
|
/**
|