@stacksjs/defaults 0.75.317 → 0.75.320
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-browse/SKILL.md +8 -0
- package/ai/skills/stacks-browse/scripts/browse.ts +16 -6
- package/ai/skills/stacks-browse/scripts/chrome.ts +4 -0
- 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/Cms/AuthorUpdateAction.ts +4 -4
- package/app/Actions/Cms/CategorizableUpdateAction.ts +4 -4
- package/app/Actions/Cms/PostUpdateAction.ts +4 -5
- package/app/Actions/Cms/TaggableUpdateAction.ts +4 -2
- package/app/Actions/Commerce/CustomerStoreAction.ts +4 -6
- package/app/Actions/Commerce/CustomerUpdateAction.ts +4 -6
- package/app/Actions/Commerce/PaymentStoreAction.ts +5 -8
- package/app/Actions/Commerce/PaymentUpdateAction.ts +20 -17
- package/app/Actions/Dashboard/Commerce/commerce-product-records.test.ts +7 -0
- package/app/Actions/Dashboard/Commerce/commerce-product-records.ts +14 -3
- package/app/Actions/Dashboard/Commerce/review-records.test.ts +12 -0
- package/app/Actions/Dashboard/Commerce/review-records.ts +10 -5
- package/app/Actions/Dashboard/Content/AuthorStoreAction.ts +2 -0
- package/app/Actions/Dashboard/Content/CategoryStoreAction.ts +4 -1
- package/app/Actions/Dashboard/Content/PageStoreAction.ts +2 -0
- package/app/Actions/Dashboard/Content/PostStoreAction.ts +2 -0
- package/app/Actions/Dashboard/Content/TagStoreAction.ts +2 -0
- package/app/Actions/Dashboard/Content/content-input.ts +9 -4
- package/app/Actions/Dashboard/Content/content-record-input.test.ts +20 -1
- package/app/Actions/Dashboard/Marketing/CampaignIndexAction.ts +1 -1
- package/app/Actions/Dashboard/Marketing/ListIndexAction.ts +1 -1
- package/app/Actions/Dashboard/Models/ModelStoreAction.ts +5 -1
- package/app/Actions/Dashboard/Models/ModelUpdateAction.ts +5 -1
- package/app/Actions/Dashboard/Notifications/NotificationDeliveryOverviewAction.ts +1 -1
- package/app/Actions/Storefront/AddToCartAction.ts +5 -2
- package/app/Actions/Storefront/PlaceOrderAction.ts +6 -11
- package/app/Actions/Storefront/SubmitReviewAction.ts +6 -5
- package/app/Models/Activity.ts +1 -0
- package/app/Models/AnalyticsEvent.ts +1 -0
- package/app/Models/AutomationRun.ts +1 -1
- package/app/Models/BoardColumn.ts +0 -1
- package/app/Models/Campaign.ts +1 -1
- package/app/Models/CampaignSend.ts +3 -3
- package/app/Models/Card.ts +0 -1
- package/app/Models/CardComment.ts +0 -2
- package/app/Models/Content/Author.ts +2 -0
- package/app/Models/Content/Categorizable.ts +1 -0
- package/app/Models/Content/Menu.ts +2 -0
- package/app/Models/Content/MenuItem.ts +2 -0
- package/app/Models/Content/PageRevision.ts +2 -0
- package/app/Models/Content/Post.ts +2 -0
- package/app/Models/Content/Redirect.ts +2 -0
- package/app/Models/EmailListSubscriber.ts +2 -2
- package/app/Models/Error.ts +5 -0
- package/app/Models/Forms/Form.ts +2 -0
- package/app/Models/Forms/FormField.ts +2 -0
- package/app/Models/Forms/FormSubmission.ts +2 -0
- package/app/Models/Label.ts +0 -1
- package/app/Models/Log.ts +3 -1
- package/app/Models/MagicLinkToken.ts +0 -7
- package/app/Models/PaymentProduct.ts +1 -0
- package/app/Models/PaymentTransaction.ts +1 -0
- package/app/Models/Release.ts +3 -0
- package/app/Models/Request.ts +1 -0
- package/app/Models/SenderDomain.ts +2 -0
- package/app/Models/SmsOptOut.ts +0 -7
- package/app/Models/Subscription.ts +2 -0
- package/app/Models/commerce/Auction.ts +1 -0
- package/app/Models/commerce/AuctionItem.ts +1 -0
- package/app/Models/commerce/Cart.ts +83 -2
- package/app/Models/commerce/Category.ts +5 -1
- package/app/Models/commerce/Coupon.ts +4 -1
- package/app/Models/commerce/DigitalDelivery.ts +1 -0
- package/app/Models/commerce/GiftCard.ts +1 -0
- package/app/Models/commerce/LoyaltyPoint.ts +1 -0
- package/app/Models/commerce/LoyaltyReward.ts +3 -1
- package/app/Models/commerce/Order.ts +4 -1
- package/app/Models/commerce/OrderItem.ts +1 -0
- package/app/Models/commerce/Payment.ts +1 -0
- package/app/Models/commerce/Product.ts +15 -0
- package/app/Models/commerce/ProductVariant.ts +2 -0
- package/app/Models/commerce/Receipt.ts +1 -0
- package/app/Models/commerce/Review.ts +3 -1
- package/app/Models/commerce/Transaction.ts +1 -0
- package/app/Models/realtime/Websocket.ts +4 -1
- package/functions/dashboard-form.test.ts +10 -1
- package/functions/dashboard-form.ts +17 -0
- package/ide/vscode/package.json +1 -1
- package/package.json +4 -4
- package/resources/components/Dashboard/Analytics/AnalyticsPageHeader.stx +1 -1
- package/resources/components/Dashboard/App/RequestDetailsDialog.stx +1 -1
- package/resources/components/Dashboard/Auth/AccessTokenCreateDialog.stx +1 -1
- package/resources/components/Dashboard/Auth/ForgotPassword.stx +1 -1
- package/resources/components/Dashboard/Auth/Login.stx +1 -1
- package/resources/components/Dashboard/Auth/Register.stx +1 -1
- package/resources/components/Dashboard/Auth/ResetPassword.stx +1 -1
- package/resources/components/Dashboard/Auth/TwoFactorLogin.stx +1 -1
- package/resources/components/Dashboard/CodeEditor.stx +1 -1
- package/resources/components/Dashboard/Commerce/CommerceCategoriesDashboard.stx +1 -1
- package/resources/components/Dashboard/Commerce/CommerceCategoriesTable.stx +1 -1
- package/resources/components/Dashboard/Commerce/CommerceCategoryDeleteDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/CommerceCategoryDetailsDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/CommerceCategoryDialog.stx +4 -13
- package/resources/components/Dashboard/Commerce/CommerceCouponDeleteDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/CommerceCouponDetailsDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/CommerceCouponDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/CommerceCouponsTable.stx +1 -1
- package/resources/components/Dashboard/Commerce/CommerceCustomerDeleteDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/CommerceCustomerDetailsDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/CommerceCustomerDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/CommerceCustomersTable.stx +1 -1
- package/resources/components/Dashboard/Commerce/CommerceGiftCardDeleteDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/CommerceGiftCardDetailsDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/CommerceGiftCardDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/CommerceGiftCardsTable.stx +1 -1
- package/resources/components/Dashboard/Commerce/CommerceManufacturerDeleteDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/CommerceManufacturerDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/CommerceManufacturersTable.stx +1 -1
- package/resources/components/Dashboard/Commerce/CommerceOrderDeleteDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/CommerceOrderDetailsDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/CommerceOrderDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/CommerceOrdersTable.stx +1 -1
- package/resources/components/Dashboard/Commerce/CommercePaymentsTable.stx +1 -1
- package/resources/components/Dashboard/Commerce/CommercePosCart.stx +1 -1
- package/resources/components/Dashboard/Commerce/CommercePosCatalog.stx +1 -1
- package/resources/components/Dashboard/Commerce/CommercePosCheckoutDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/CommercePosReceiptDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/CommerceProductDeleteDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/CommerceProductDialog.stx +27 -2
- package/resources/components/Dashboard/Commerce/CommerceProductsTable.stx +1 -1
- package/resources/components/Dashboard/Commerce/CommerceReviewDeleteDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/CommerceReviewEditDialog.stx +7 -5
- package/resources/components/Dashboard/Commerce/CommerceReviewsDashboard.stx +12 -4
- package/resources/components/Dashboard/Commerce/CommerceReviewsTable.stx +3 -3
- package/resources/components/Dashboard/Commerce/CommerceTaxDeleteDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/CommerceTaxDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/CommerceTaxesTable.stx +1 -1
- package/resources/components/Dashboard/Commerce/CommerceUnitDeleteDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/CommerceUnitDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/CommerceUnitsTable.stx +1 -1
- package/resources/components/Dashboard/Commerce/CommerceVariantDeleteDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/CommerceVariantDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/CommerceVariantsTable.stx +1 -1
- package/resources/components/Dashboard/Commerce/Delivery/CourierDeleteDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/Delivery/CourierDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/Delivery/CouriersTable.stx +1 -1
- package/resources/components/Dashboard/Commerce/Delivery/DeliveryPagination.stx +1 -1
- package/resources/components/Dashboard/Commerce/Delivery/DeliveryRouteDeleteDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/Delivery/DeliveryRouteDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/Delivery/DeliveryRoutesTable.stx +1 -1
- package/resources/components/Dashboard/Commerce/Delivery/DigitalDeliveryDeleteDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/Delivery/DigitalDeliveryDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/Delivery/DigitalDeliveryTable.stx +1 -1
- package/resources/components/Dashboard/Commerce/Delivery/LicenseKeyDeleteDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/Delivery/LicenseKeyDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/Delivery/LicenseKeysTable.stx +1 -1
- package/resources/components/Dashboard/Commerce/Delivery/ShippingMethodDeleteDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/Delivery/ShippingMethodDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/Delivery/ShippingMethodsTable.stx +1 -1
- package/resources/components/Dashboard/Commerce/Delivery/ShippingRateDeleteDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/Delivery/ShippingRateDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/Delivery/ShippingRatesTable.stx +1 -1
- package/resources/components/Dashboard/Commerce/Delivery/ShippingZoneDeleteDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/Delivery/ShippingZoneDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/Delivery/ShippingZonesTable.stx +1 -1
- package/resources/components/Dashboard/Commerce/PaymentDetailsDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/PaymentRefundDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/PrintDeviceDeleteDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/PrintDeviceDetailsDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/PrintDeviceDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/PrintDevicesTable.stx +1 -1
- package/resources/components/Dashboard/Commerce/PrintLogDeleteDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/PrintLogDetailsDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/PrintLogsTable.stx +1 -1
- package/resources/components/Dashboard/Commerce/ProductWaitlistDeleteDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/ProductWaitlistEntryDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/ProductWaitlistTable.stx +1 -1
- package/resources/components/Dashboard/Commerce/RestaurantWaitlistDeleteDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/RestaurantWaitlistEntryDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/RestaurantWaitlistTable.stx +1 -1
- package/resources/components/Dashboard/Content/AuthorEditorDialog.stx +1 -1
- package/resources/components/Dashboard/Content/BlogPostEditorDialog.stx +1 -1
- package/resources/components/Dashboard/Content/CreateFolderDialog.stx +1 -1
- package/resources/components/Dashboard/Content/FileDetailsDrawer.stx +1 -1
- package/resources/components/Dashboard/Content/FileUploadDialog.stx +1 -1
- package/resources/components/Dashboard/Content/PageEditorDialog.stx +1 -1
- package/resources/components/Dashboard/Content/PostEditorDialog.stx +1 -1
- package/resources/components/Dashboard/Content/SeoEditorDialog.stx +1 -1
- package/resources/components/Dashboard/Content/TaxonomyEditorDialog.stx +1 -1
- package/resources/components/Dashboard/CreateRecordModal.stx +1 -1
- package/resources/components/Dashboard/Deployments/DeploymentPreviewDialog.stx +1 -1
- package/resources/components/Dashboard/Elements/DropdownNavigation.stx +1 -1
- package/resources/components/Dashboard/Email/CapturedMailList.stx +1 -1
- package/resources/components/Dashboard/Email/EmailSettingsList.stx +1 -1
- package/resources/components/Dashboard/Email/EmailSettingsNavigation.stx +1 -1
- package/resources/components/Dashboard/Email/EmailSidebar.stx +1 -1
- package/resources/components/Dashboard/Email/InboxComposer.stx +1 -1
- package/resources/components/Dashboard/Email/InboxMessageDetail.stx +1 -1
- package/resources/components/Dashboard/Email/InboxMessageList.stx +1 -1
- package/resources/components/Dashboard/Infrastructure/CloudDetailsDialog.stx +1 -1
- package/resources/components/Dashboard/Infrastructure/CloudResourceButton.stx +1 -1
- package/resources/components/Dashboard/Infrastructure/DnsRecordDialog.stx +1 -1
- package/resources/components/Dashboard/Infrastructure/LogDetailsDialog.stx +1 -1
- package/resources/components/Dashboard/Infrastructure/MailboxDetailsDialog.stx +1 -1
- package/resources/components/Dashboard/Infrastructure/ServerInspectorDialog.stx +1 -1
- package/resources/components/Dashboard/Jobs/JobTable.stx +1 -1
- package/resources/components/Dashboard/Library/SourceScaffoldDialog.stx +1 -1
- package/resources/components/Dashboard/Management/AssignmentDrawer.stx +1 -1
- package/resources/components/Dashboard/Marketing/CampaignDeleteDialog.stx +1 -1
- package/resources/components/Dashboard/Marketing/CampaignDeliveryDialog.stx +1 -1
- package/resources/components/Dashboard/Marketing/CampaignDialog.stx +1 -1
- package/resources/components/Dashboard/Marketing/CampaignsTable.stx +1 -1
- package/resources/components/Dashboard/Marketing/MarketingListDeleteDialog.stx +1 -1
- package/resources/components/Dashboard/Marketing/MarketingListDialog.stx +1 -1
- package/resources/components/Dashboard/Marketing/MarketingListsTable.stx +1 -1
- package/resources/components/Dashboard/Marketing/RecoveryCampaignDialog.stx +1 -1
- package/resources/components/Dashboard/Marketing/SocialPostDeleteDialog.stx +1 -1
- package/resources/components/Dashboard/Marketing/SocialPostDialog.stx +1 -1
- package/resources/components/Dashboard/Marketing/SocialPostsTable.stx +1 -1
- package/resources/components/Dashboard/MobileSidebar.stx +1 -1
- package/resources/components/Dashboard/Modals/BaseModal.stx +1 -1
- package/resources/components/Dashboard/Modals/Popups/Alert.stx +1 -1
- package/resources/components/Dashboard/Modals/Popups/Toast.stx +1 -1
- package/resources/components/Dashboard/Modals/ToastWrapper.stx +1 -1
- package/resources/components/Dashboard/Models/EditRecordModal.stx +1 -1
- package/resources/components/Dashboard/Models/ModelRecordActions.stx +1 -1
- package/resources/components/Dashboard/Monitoring/ErrorTable.stx +1 -1
- package/resources/components/Dashboard/Notifications/NotificationDeliveryDialog.stx +1 -1
- package/resources/components/Dashboard/Notifications/NotificationDeliveryTable.stx +1 -1
- package/resources/components/Dashboard/Operations/RecoveryDestinationDialog.stx +1 -1
- package/resources/components/Dashboard/Operations/RecoveryPointTable.stx +1 -1
- package/resources/components/Dashboard/Operations/RecoveryPolicyDialog.stx +1 -1
- package/resources/components/Dashboard/Operations/RecoveryRestoreDialog.stx +1 -1
- package/resources/components/Dashboard/Operations/SchedulerTaskTable.stx +1 -1
- package/resources/components/Dashboard/UI/Checkbox.stx +1 -1
- package/resources/components/Dashboard/UI/ConfirmDialog.stx +1 -1
- package/resources/components/Dashboard/UI/Drawer.stx +1 -1
- package/resources/components/Dashboard/UI/Dropdown.stx +1 -1
- package/resources/components/Dashboard/UI/Input.stx +1 -1
- package/resources/components/Dashboard/UI/Modal.stx +1 -1
- package/resources/components/Dashboard/UI/Pagination.stx +1 -1
- package/resources/components/Dashboard/UI/SearchFilter.stx +1 -1
- package/resources/components/Dashboard/UI/Select.stx +1 -1
- package/resources/components/Dashboard/UI/Table.stx +1 -1
- package/resources/components/Dashboard/UI/Tabs.stx +1 -1
- package/resources/components/Dashboard/UI/Textarea.stx +1 -1
- package/resources/components/Dashboard/UI/Toggle.stx +1 -1
- package/resources/components/Dashboard/UI/WindowControls.stx +1 -1
- package/resources/components/NativeActionSheet.stx +1 -1
- package/resources/components/NativeContextMenu.stx +1 -1
- package/resources/components/NativeHealthButton.stx +1 -1
- package/resources/components/NativePermissionButton.stx +1 -1
- package/resources/components/NativePullToRefresh.stx +1 -1
- package/resources/components/NativeSegmentedControl.stx +1 -1
- package/resources/components/NativeSheet.stx +1 -1
|
@@ -4,7 +4,7 @@ import type { GiftCardRecord } from '../../../../app/Actions/Dashboard/Commerce/
|
|
|
4
4
|
const open = useReactiveProp('open', false)
|
|
5
5
|
const record = useReactiveProp('record', null as GiftCardRecord | null)
|
|
6
6
|
const busy = useReactiveProp('busy', false)
|
|
7
|
-
const emit = defineEmits()
|
|
7
|
+
const emit = defineEmits(['close', 'confirm'])
|
|
8
8
|
const description = derived(() => `Delete "${record()?.code || 'Unnamed gift card'}" permanently? Recorded customer or order relationships may prevent deletion.`)
|
|
9
9
|
</script>
|
|
10
10
|
|
|
@@ -4,7 +4,7 @@ import { formatCurrency } from '@stacksjs/commerce/money'
|
|
|
4
4
|
|
|
5
5
|
const open = useReactiveProp('open', false)
|
|
6
6
|
const record = useReactiveProp('record', null as GiftCardRecord | null)
|
|
7
|
-
const emit = defineEmits()
|
|
7
|
+
const emit = defineEmits(['edit', 'close', 'delete'])
|
|
8
8
|
|
|
9
9
|
function money(value: number, currency: string): string {
|
|
10
10
|
return formatCurrency(value, currency)
|
|
@@ -8,7 +8,7 @@ const mode = useReactiveProp('mode', 'add')
|
|
|
8
8
|
const record = useReactiveProp('record', null as GiftCardRecord | null)
|
|
9
9
|
const busy = useReactiveProp('busy', false)
|
|
10
10
|
const errors = useReactiveProp('errors', {} as Record<string, string>)
|
|
11
|
-
const emit = defineEmits()
|
|
11
|
+
const emit = defineEmits(['submit', 'close'])
|
|
12
12
|
const code = state('')
|
|
13
13
|
// Balances as typed, in major units. Stored as integer minor units.
|
|
14
14
|
const initialBalance = state('50.00')
|
|
@@ -10,7 +10,7 @@ const loading = useReactiveProp('loading', false)
|
|
|
10
10
|
const sortResetKey = useReactiveProp<unknown>('sortResetKey', '')
|
|
11
11
|
/** The parent's search and filters: a change returns to the first page. */
|
|
12
12
|
const pageResetKey = useReactiveProp<unknown>('pageResetKey', '')
|
|
13
|
-
const emit = defineEmits()
|
|
13
|
+
const emit = defineEmits(['view', 'edit', 'delete'])
|
|
14
14
|
|
|
15
15
|
function statusLabel(status: GiftCardStatus): string {
|
|
16
16
|
return status.charAt(0) + status.slice(1).toLowerCase()
|
|
@@ -4,7 +4,7 @@ import type { ManufacturerRecord } from '../../../../app/Actions/Dashboard/Comme
|
|
|
4
4
|
const open = useReactiveProp('open', false)
|
|
5
5
|
const record = useReactiveProp('record', null as ManufacturerRecord | null)
|
|
6
6
|
const busy = useReactiveProp('busy', false)
|
|
7
|
-
const emit = defineEmits()
|
|
7
|
+
const emit = defineEmits(['close', 'confirm'])
|
|
8
8
|
const description = derived(() => `Delete "${record()?.name || 'Unnamed manufacturer'}" permanently?`)
|
|
9
9
|
const warning = derived(() => record()?.productCount
|
|
10
10
|
? `It is linked to ${record()?.productCount} products and deletion may be rejected.`
|
|
@@ -7,7 +7,7 @@ const mode = useReactiveProp('mode', 'add')
|
|
|
7
7
|
const record = useReactiveProp('record', null as ManufacturerRecord | null)
|
|
8
8
|
const busy = useReactiveProp('busy', false)
|
|
9
9
|
const errors = useReactiveProp('errors', {} as Record<string, string>)
|
|
10
|
-
const emit = defineEmits()
|
|
10
|
+
const emit = defineEmits(['submit', 'close'])
|
|
11
11
|
const name = state('')
|
|
12
12
|
const description = state('')
|
|
13
13
|
const country = state('')
|
|
@@ -7,7 +7,7 @@ const records = useReactiveProp('records', [] as ManufacturerRecord[])
|
|
|
7
7
|
const loading = useReactiveProp('loading', false)
|
|
8
8
|
/** The parent's sort select; a change hands the order back from a header sort. */
|
|
9
9
|
const sortResetKey = useReactiveProp<unknown>('sortResetKey', '')
|
|
10
|
-
const emit = defineEmits()
|
|
10
|
+
const emit = defineEmits(['edit', 'delete'])
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* `featured` becomes a flag badge beside the name rather than the starred line
|
|
@@ -4,7 +4,7 @@ import type { CommerceOrderRecord } from '../../../../app/Actions/Dashboard/Comm
|
|
|
4
4
|
const open = useReactiveProp('open', false)
|
|
5
5
|
const record = useReactiveProp('record', null as CommerceOrderRecord | null)
|
|
6
6
|
const busy = useReactiveProp('busy', false)
|
|
7
|
-
const emit = defineEmits()
|
|
7
|
+
const emit = defineEmits(['close', 'confirm'])
|
|
8
8
|
const description = derived(() => `Delete order ${record()?.id || 'not recorded'} permanently? Linked items, payments, and license keys may prevent deletion.`)
|
|
9
9
|
</script>
|
|
10
10
|
|
|
@@ -4,7 +4,7 @@ import { formatCurrency } from '@stacksjs/commerce/money'
|
|
|
4
4
|
|
|
5
5
|
const open = useReactiveProp('open', false)
|
|
6
6
|
const record = useReactiveProp('record', null as CommerceOrderRecord | null)
|
|
7
|
-
const emit = defineEmits()
|
|
7
|
+
const emit = defineEmits(['edit', 'close', 'delete'])
|
|
8
8
|
|
|
9
9
|
function label(value: string): string {
|
|
10
10
|
return value.replaceAll('_', ' ').toLowerCase().replace(/\b\w/g, letter => letter.toUpperCase())
|
|
@@ -15,7 +15,7 @@ const orderTypes = useReactiveProp('orderTypes', [] as string[])
|
|
|
15
15
|
const defaultCurrency = useReactiveProp('defaultCurrency', 'USD')
|
|
16
16
|
const busy = useReactiveProp('busy', false)
|
|
17
17
|
const errors = useReactiveProp('errors', {} as Record<string, string>)
|
|
18
|
-
const emit = defineEmits()
|
|
18
|
+
const emit = defineEmits(['submit', 'close'])
|
|
19
19
|
const customerId = state('')
|
|
20
20
|
const couponId = state('')
|
|
21
21
|
const status = state('PENDING')
|
|
@@ -9,7 +9,7 @@ const loading = useReactiveProp('loading', false)
|
|
|
9
9
|
const sortResetKey = useReactiveProp<unknown>('sortResetKey', '')
|
|
10
10
|
/** The parent's search and filters: a change returns to the first page. */
|
|
11
11
|
const pageResetKey = useReactiveProp<unknown>('pageResetKey', '')
|
|
12
|
-
const emit = defineEmits()
|
|
12
|
+
const emit = defineEmits(['view', 'edit', 'delete'])
|
|
13
13
|
|
|
14
14
|
function label(value: string): string {
|
|
15
15
|
return value.replaceAll('_', ' ').toLowerCase().replace(/\b\w/g, letter => letter.toUpperCase())
|
|
@@ -8,7 +8,7 @@ const records = useReactiveProp('records', [] as PaymentRecord[])
|
|
|
8
8
|
const loading = useReactiveProp('loading', false)
|
|
9
9
|
/** The parent's sort select; a change hands the order back from a header sort. */
|
|
10
10
|
const sortResetKey = useReactiveProp<unknown>('sortResetKey', '')
|
|
11
|
-
const emit = defineEmits()
|
|
11
|
+
const emit = defineEmits(['view'])
|
|
12
12
|
|
|
13
13
|
/** `partiallyRefunded` and `bank_transfer` as words, each capitalized. */
|
|
14
14
|
function label(value: string): string {
|
|
@@ -15,7 +15,7 @@ const subtotal = useReactiveProp('subtotal', 0)
|
|
|
15
15
|
const taxRate = useReactiveProp('taxRate', 0)
|
|
16
16
|
const taxAmount = useReactiveProp('taxAmount', 0)
|
|
17
17
|
const totalAmount = useReactiveProp('totalAmount', 0)
|
|
18
|
-
const emit = defineEmits()
|
|
18
|
+
const emit = defineEmits(['clear', 'remove', 'decrease', 'increase', 'instructions', 'checkout'])
|
|
19
19
|
|
|
20
20
|
function formatMoney(value: number): string {
|
|
21
21
|
return formatCurrency(value, currency())
|
|
@@ -10,7 +10,7 @@ const category = useReactiveProp('category', 'all')
|
|
|
10
10
|
const availability = useReactiveProp('availability', 'sellable')
|
|
11
11
|
const currency = useReactiveProp('currency', 'USD')
|
|
12
12
|
const loading = useReactiveProp('loading', false)
|
|
13
|
-
const emit = defineEmits()
|
|
13
|
+
const emit = defineEmits(['search', 'category', 'availability', 'add'])
|
|
14
14
|
|
|
15
15
|
function initials(name: string): string {
|
|
16
16
|
return name.split(/\s+/).filter(Boolean).slice(0, 2).map(part => part[0]?.toUpperCase() || '').join('') || 'PR'
|
|
@@ -17,7 +17,7 @@ const totalAmount = useReactiveProp('totalAmount', 0)
|
|
|
17
17
|
const unitCount = useReactiveProp('unitCount', 0)
|
|
18
18
|
const busy = useReactiveProp('busy', false)
|
|
19
19
|
const error = useReactiveProp('error', '')
|
|
20
|
-
const emit = defineEmits()
|
|
20
|
+
const emit = defineEmits(['submit', 'close'])
|
|
21
21
|
const customerId = state('')
|
|
22
22
|
const orderType = state('TAKEOUT')
|
|
23
23
|
const paymentMethod = state('cash')
|
|
@@ -23,7 +23,7 @@ interface PosReceipt {
|
|
|
23
23
|
|
|
24
24
|
const open = useReactiveProp('open', false)
|
|
25
25
|
const receipt = useReactiveProp('receipt', null as PosReceipt | null)
|
|
26
|
-
const emit = defineEmits()
|
|
26
|
+
const emit = defineEmits(['close'])
|
|
27
27
|
|
|
28
28
|
function formatMoney(value: number): string {
|
|
29
29
|
return formatCurrency(value, receipt()?.currency || 'USD')
|
|
@@ -4,7 +4,7 @@ import type { CommerceProductRecord } from '../../../../app/Actions/Dashboard/Co
|
|
|
4
4
|
const open = useReactiveProp('open', false)
|
|
5
5
|
const record = useReactiveProp('record', null as CommerceProductRecord | null)
|
|
6
6
|
const busy = useReactiveProp('busy', false)
|
|
7
|
-
const emit = defineEmits()
|
|
7
|
+
const emit = defineEmits(['close', 'confirm'])
|
|
8
8
|
const description = derived(() => `Delete "${record()?.name || 'Unnamed product'}" permanently?`)
|
|
9
9
|
const warning = derived(() => record()?.variantCount || record()?.unitCount || record()?.reviewCount
|
|
10
10
|
? 'Related variants, units, or reviews may cause deletion to be rejected.'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script client>
|
|
2
|
-
import { formErrorMessages } from '../../../../functions/dashboard-form'
|
|
2
|
+
import { formErrorMessages, slugify } from '../../../../functions/dashboard-form'
|
|
3
3
|
import type {
|
|
4
4
|
CommerceProductRecord,
|
|
5
5
|
ProductOption,
|
|
@@ -18,8 +18,9 @@ const manufacturers = useReactiveProp('manufacturers', [] as ProductOption[])
|
|
|
18
18
|
const currency = useReactiveProp('currency', 'USD')
|
|
19
19
|
const busy = useReactiveProp('busy', false)
|
|
20
20
|
const errors = useReactiveProp('errors', {} as Record<string, string>)
|
|
21
|
-
const emit = defineEmits()
|
|
21
|
+
const emit = defineEmits(['submit', 'close'])
|
|
22
22
|
const name = state('')
|
|
23
|
+
const slug = state('')
|
|
23
24
|
const description = state('')
|
|
24
25
|
// The price as typed, in major units ("19.99"). It is stored as integer
|
|
25
26
|
// minor units (1999), converted once in `productWritePayload`.
|
|
@@ -33,6 +34,9 @@ const manufacturerId = state('')
|
|
|
33
34
|
const allergens = state('')
|
|
34
35
|
const nutritionalInfo = state('{}')
|
|
35
36
|
let hydrationKey = ''
|
|
37
|
+
// The slug follows the name until someone edits it, and an existing product
|
|
38
|
+
// keeps the one it has: changing it would break links to it.
|
|
39
|
+
let slugTouched = false
|
|
36
40
|
|
|
37
41
|
effect(() => {
|
|
38
42
|
if (!open()) {
|
|
@@ -45,6 +49,8 @@ effect(() => {
|
|
|
45
49
|
return
|
|
46
50
|
hydrationKey = key
|
|
47
51
|
name.set(current?.name || '')
|
|
52
|
+
slug.set(current?.slug || '')
|
|
53
|
+
slugTouched = Boolean(current?.slug)
|
|
48
54
|
description.set(current?.description || '')
|
|
49
55
|
price.set(current ? minorToInput(current.price, currency()) : '')
|
|
50
56
|
imageUrl.set(current?.imageUrl || '')
|
|
@@ -57,6 +63,22 @@ effect(() => {
|
|
|
57
63
|
nutritionalInfo.set(current?.nutritionalInfoRaw || '{}')
|
|
58
64
|
})
|
|
59
65
|
|
|
66
|
+
effect(() => {
|
|
67
|
+
if (!open() || slugTouched)
|
|
68
|
+
return
|
|
69
|
+
slug.set(slugify(name()))
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
function markSlugTouched(): void {
|
|
73
|
+
slugTouched = true
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function normalizeSlug(): void {
|
|
77
|
+
const normalized = slugify(slug())
|
|
78
|
+
if (normalized !== slug())
|
|
79
|
+
slug.set(normalized)
|
|
80
|
+
}
|
|
81
|
+
|
|
60
82
|
function nutritionValid(): boolean {
|
|
61
83
|
const raw = nutritionalInfo().trim()
|
|
62
84
|
if (!raw)
|
|
@@ -79,6 +101,7 @@ function valid(): boolean {
|
|
|
79
101
|
const parsedPreparation = Number(preparationTime())
|
|
80
102
|
return Boolean(
|
|
81
103
|
name().trim()
|
|
104
|
+
&& slugify(slug())
|
|
82
105
|
&& !priceError()
|
|
83
106
|
&& Number.isFinite(parsedInventory)
|
|
84
107
|
&& parsedInventory >= 0
|
|
@@ -95,6 +118,7 @@ function submit(): void {
|
|
|
95
118
|
return
|
|
96
119
|
emit('submit', productWritePayload({
|
|
97
120
|
name: name(),
|
|
121
|
+
slug: slugify(slug()),
|
|
98
122
|
description: description(),
|
|
99
123
|
price: price(),
|
|
100
124
|
imageUrl: imageUrl(),
|
|
@@ -126,6 +150,7 @@ function errorMessages(): string[] {
|
|
|
126
150
|
</ul>
|
|
127
151
|
<div class="grid gap-4 grid-cols-1 sm:grid-cols-2">
|
|
128
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>
|
|
153
|
+
<label class="block sm:col-span-2"><span class="font-medium text-gray-700 text-sm dark:text-neutral-200">Slug</span><input x-model="slug" type="text" maxlength="255" required spellcheck="false" 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" @input="markSlugTouched" @blur="normalizeSlug" /><span class="block mt-1 text-gray-400 text-xs dark:text-neutral-500">The storefront address, /products/{{ slug() || 'slug' }}.</span></label>
|
|
129
154
|
<label class="block sm:col-span-2"><span class="font-medium text-gray-700 text-sm dark:text-neutral-200">Description</span><textarea x-model="description" rows="3" class="mt-1 px-3 py-2 w-full text-gray-900 text-sm dark:text-white bg-white dark:bg-neutral-900 border border-gray-300 rounded-md dark:border-neutral-700"></textarea></label>
|
|
130
155
|
<label class="block"><span class="font-medium text-gray-700 text-sm dark:text-neutral-200">Price ({{ currency() }})</span><input x-model="price" type="number" min="0" :step="moneyInputStep(currency())" inputmode="decimal" required :aria-invalid="price() !== '' && priceError() !== ''" 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" /><span :if="price() !== '' && priceError()" class="block mt-1 text-red-600 text-xs dark:text-red-400">{{ priceError() }}</span></label>
|
|
131
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>
|
|
@@ -10,7 +10,7 @@ const sortResetKey = useReactiveProp<unknown>('sortResetKey', '')
|
|
|
10
10
|
/** The parent's search and filters: a change returns to the first page. */
|
|
11
11
|
const pageResetKey = useReactiveProp<unknown>('pageResetKey', '')
|
|
12
12
|
const currency = useReactiveProp('currency', 'USD')
|
|
13
|
-
const emit = defineEmits()
|
|
13
|
+
const emit = defineEmits(['view', 'edit', 'delete'])
|
|
14
14
|
|
|
15
15
|
function initials(name: string): string {
|
|
16
16
|
return name.split(/\s+/).filter(Boolean).slice(0, 2).map(part => part[0]?.toUpperCase() || '').join('') || 'PR'
|
|
@@ -4,7 +4,7 @@ import type { ReviewRecord } from '../../../../app/Actions/Dashboard/Commerce/re
|
|
|
4
4
|
const open = useReactiveProp('open', false)
|
|
5
5
|
const review = useReactiveProp('review', null as ReviewRecord | null)
|
|
6
6
|
const busy = useReactiveProp('busy', false)
|
|
7
|
-
const emit = defineEmits()
|
|
7
|
+
const emit = defineEmits(['close', 'confirm'])
|
|
8
8
|
const description = derived(() => `Delete "${review()?.title || 'Untitled review'}" permanently? This cannot be undone.`)
|
|
9
9
|
</script>
|
|
10
10
|
|
|
@@ -6,10 +6,11 @@ const open = useReactiveProp('open', false)
|
|
|
6
6
|
const review = useReactiveProp('review', null as ReviewRecord | null)
|
|
7
7
|
const busy = useReactiveProp('busy', false)
|
|
8
8
|
const errors = useReactiveProp('errors', {} as Record<string, string>)
|
|
9
|
-
const emit = defineEmits()
|
|
9
|
+
const emit = defineEmits(['submit', 'close'])
|
|
10
10
|
const title = state('')
|
|
11
11
|
const content = state('')
|
|
12
|
-
|
|
12
|
+
// A string, so the select can hold "no rating" as well as 1 to 5.
|
|
13
|
+
const rating = state('5')
|
|
13
14
|
const approved = state(false)
|
|
14
15
|
const featured = state(false)
|
|
15
16
|
let hydratedId = ''
|
|
@@ -25,7 +26,7 @@ effect(() => {
|
|
|
25
26
|
hydratedId = current.id
|
|
26
27
|
title.set(current.title)
|
|
27
28
|
content.set(current.content)
|
|
28
|
-
rating.set(current.rating)
|
|
29
|
+
rating.set(current.rating === null ? '' : String(current.rating))
|
|
29
30
|
approved.set(current.approved)
|
|
30
31
|
featured.set(current.featured)
|
|
31
32
|
})
|
|
@@ -36,7 +37,7 @@ function submit(): void {
|
|
|
36
37
|
emit('submit', {
|
|
37
38
|
title: title().trim(),
|
|
38
39
|
content: content().trim(),
|
|
39
|
-
rating: rating(),
|
|
40
|
+
rating: rating() === '' ? null : Number(rating()),
|
|
40
41
|
isApproved: approved(),
|
|
41
42
|
isFeatured: featured(),
|
|
42
43
|
})
|
|
@@ -70,12 +71,13 @@ function errorMessages(): string[] {
|
|
|
70
71
|
</label>
|
|
71
72
|
<label class="block">
|
|
72
73
|
<span class="font-medium text-gray-700 text-sm dark:text-neutral-200">Rating</span>
|
|
73
|
-
<select x-model
|
|
74
|
+
<select x-model="rating" class="mt-1 px-3 py-2 w-full text-gray-900 text-sm dark:text-white bg-white dark:bg-neutral-900 border border-gray-300 rounded-md dark:border-neutral-700">
|
|
74
75
|
<option value="5">5 stars</option>
|
|
75
76
|
<option value="4">4 stars</option>
|
|
76
77
|
<option value="3">3 stars</option>
|
|
77
78
|
<option value="2">2 stars</option>
|
|
78
79
|
<option value="1">1 star</option>
|
|
80
|
+
<option value="">No rating</option>
|
|
79
81
|
</select>
|
|
80
82
|
</label>
|
|
81
83
|
<div class="grid gap-3 grid-cols-1 sm:grid-cols-2">
|
|
@@ -16,7 +16,7 @@ interface ReviewIndexResponse {
|
|
|
16
16
|
interface ReviewEditPayload {
|
|
17
17
|
title: string
|
|
18
18
|
content: string
|
|
19
|
-
rating: number
|
|
19
|
+
rating: number | null
|
|
20
20
|
isApproved: boolean
|
|
21
21
|
isFeatured: boolean
|
|
22
22
|
}
|
|
@@ -67,6 +67,13 @@ function timestamp(value: string): number {
|
|
|
67
67
|
return Number.isFinite(result) ? result : 0
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
+
/** Rated reviews in `direction` order, unrated ones last either way. */
|
|
71
|
+
function byRating(left: ReviewRecord, right: ReviewRecord, direction: 1 | -1): number {
|
|
72
|
+
if (left.rating === null || right.rating === null)
|
|
73
|
+
return Number(left.rating === null) - Number(right.rating === null)
|
|
74
|
+
return (left.rating - right.rating) * direction
|
|
75
|
+
}
|
|
76
|
+
|
|
70
77
|
function filteredRecords(): ReviewRecord[] {
|
|
71
78
|
const query = search().trim().toLowerCase()
|
|
72
79
|
const product = productFilter()
|
|
@@ -76,7 +83,7 @@ function filteredRecords(): ReviewRecord[] {
|
|
|
76
83
|
.filter((review) => {
|
|
77
84
|
if (product !== 'all' && review.productId !== product)
|
|
78
85
|
return false
|
|
79
|
-
if (rating !== 'all' && String(review.rating) !== rating)
|
|
86
|
+
if (rating !== 'all' && String(review.rating ?? 'none') !== rating)
|
|
80
87
|
return false
|
|
81
88
|
if (moderation === 'approved' && !review.approved)
|
|
82
89
|
return false
|
|
@@ -98,9 +105,9 @@ function filteredRecords(): ReviewRecord[] {
|
|
|
98
105
|
if (sort() === 'oldest')
|
|
99
106
|
return timestamp(left.createdAt) - timestamp(right.createdAt)
|
|
100
107
|
if (sort() === 'rating-high')
|
|
101
|
-
return right
|
|
108
|
+
return byRating(left, right, -1) || timestamp(right.createdAt) - timestamp(left.createdAt)
|
|
102
109
|
if (sort() === 'rating-low')
|
|
103
|
-
return left
|
|
110
|
+
return byRating(left, right, 1) || timestamp(right.createdAt) - timestamp(left.createdAt)
|
|
104
111
|
if (sort() === 'helpful')
|
|
105
112
|
return right.helpfulVotes - left.helpfulVotes || timestamp(right.createdAt) - timestamp(left.createdAt)
|
|
106
113
|
return timestamp(right.createdAt) - timestamp(left.createdAt)
|
|
@@ -296,6 +303,7 @@ onMount(() => {
|
|
|
296
303
|
<option value="3">3 stars</option>
|
|
297
304
|
<option value="2">2 stars</option>
|
|
298
305
|
<option value="1">1 star</option>
|
|
306
|
+
<option value="none">No rating</option>
|
|
299
307
|
</select>
|
|
300
308
|
</label>
|
|
301
309
|
<label>
|
|
@@ -11,7 +11,7 @@ const busyId = useReactiveProp('busyId', '')
|
|
|
11
11
|
const sortResetKey = useReactiveProp<unknown>('sortResetKey', '')
|
|
12
12
|
/** The parent's search and filters: a change returns to the first page. */
|
|
13
13
|
const pageResetKey = useReactiveProp<unknown>('pageResetKey', '')
|
|
14
|
-
const emit = defineEmits()
|
|
14
|
+
const emit = defineEmits(['approve', 'feature', 'edit', 'delete'])
|
|
15
15
|
|
|
16
16
|
/** Epoch seconds or milliseconds as well as stored timestamps, as the API sends either. */
|
|
17
17
|
function formatDate(value: string): string {
|
|
@@ -64,8 +64,8 @@ const rows = derived(() => reviews().map(review => ({
|
|
|
64
64
|
productLabel: review.productName || 'Unlinked product',
|
|
65
65
|
titleLabel: review.title || 'Untitled review',
|
|
66
66
|
contentLabel: review.content || 'No review content recorded.',
|
|
67
|
-
stars: `${'★'.repeat(review.rating)}${'☆'.repeat(5 - review.rating)}`,
|
|
68
|
-
starsLabel: `${review.rating} out of 5 stars`,
|
|
67
|
+
stars: review.rating === null ? 'No rating' : `${'★'.repeat(review.rating)}${'☆'.repeat(5 - review.rating)}`,
|
|
68
|
+
starsLabel: review.rating === null ? 'No star rating' : `${review.rating} out of 5 stars`,
|
|
69
69
|
helpfulLabel: `${review.helpfulVotes} helpful`,
|
|
70
70
|
unhelpfulLabel: `${review.unhelpfulVotes} not helpful`,
|
|
71
71
|
dateLabel: formatDate(review.createdAt),
|
|
@@ -4,7 +4,7 @@ import type { TaxRateRecord } from '../../../../app/Actions/Dashboard/Commerce/t
|
|
|
4
4
|
const open = useReactiveProp('open', false)
|
|
5
5
|
const record = useReactiveProp('record', null as TaxRateRecord | null)
|
|
6
6
|
const busy = useReactiveProp('busy', false)
|
|
7
|
-
const emit = defineEmits()
|
|
7
|
+
const emit = defineEmits(['close', 'confirm'])
|
|
8
8
|
const description = derived(() => `${record()?.name || 'This tax rate'} will be permanently removed.`)
|
|
9
9
|
const warning = derived(() => record()?.isDefault
|
|
10
10
|
? 'This rate is marked as default. No replacement is selected automatically.'
|
|
@@ -8,7 +8,7 @@ const record = useReactiveProp('record', null as TaxRateRecord | null)
|
|
|
8
8
|
const types = useReactiveProp('types', [] as string[])
|
|
9
9
|
const busy = useReactiveProp('busy', false)
|
|
10
10
|
const errors = useReactiveProp('errors', {} as Record<string, string>)
|
|
11
|
-
const emit = defineEmits()
|
|
11
|
+
const emit = defineEmits(['submit', 'close'])
|
|
12
12
|
const name = state('')
|
|
13
13
|
const rate = state(0)
|
|
14
14
|
const type = state('')
|
|
@@ -7,7 +7,7 @@ const records = useReactiveProp('records', [] as TaxRateRecord[])
|
|
|
7
7
|
const loading = useReactiveProp('loading', false)
|
|
8
8
|
/** The parent's sort select; a change hands the order back from a header sort. */
|
|
9
9
|
const sortResetKey = useReactiveProp<unknown>('sortResetKey', '')
|
|
10
|
-
const emit = defineEmits()
|
|
10
|
+
const emit = defineEmits(['edit', 'delete'])
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* The name cell is slotted: the default, code and exemptible badges sit
|
|
@@ -4,7 +4,7 @@ import type { ProductUnitRecord } from '../../../../app/Actions/Dashboard/Commer
|
|
|
4
4
|
const open = useReactiveProp('open', false)
|
|
5
5
|
const record = useReactiveProp('record', null as ProductUnitRecord | null)
|
|
6
6
|
const busy = useReactiveProp('busy', false)
|
|
7
|
-
const emit = defineEmits()
|
|
7
|
+
const emit = defineEmits(['close', 'confirm'])
|
|
8
8
|
const description = derived(() => `${record()?.name || 'This product unit'} will be permanently removed.${record()?.productName ? ` The linked product ${record()?.productName} will remain.` : ''}`)
|
|
9
9
|
const warning = derived(() => record()?.isDefault
|
|
10
10
|
? `This is the current default for ${record()?.type || 'this unit type'}. No replacement is selected automatically.`
|
|
@@ -12,7 +12,7 @@ const products = useReactiveProp('products', [] as ProductUnitOption[])
|
|
|
12
12
|
const types = useReactiveProp('types', [] as string[])
|
|
13
13
|
const busy = useReactiveProp('busy', false)
|
|
14
14
|
const errors = useReactiveProp('errors', {} as Record<string, string>)
|
|
15
|
-
const emit = defineEmits()
|
|
15
|
+
const emit = defineEmits(['submit', 'close'])
|
|
16
16
|
const name = state('')
|
|
17
17
|
const abbreviation = state('')
|
|
18
18
|
const type = state('')
|
|
@@ -7,7 +7,7 @@ const records = useReactiveProp('records', [] as ProductUnitRecord[])
|
|
|
7
7
|
const loading = useReactiveProp('loading', false)
|
|
8
8
|
/** The parent's sort select; a change hands the order back from a header sort. */
|
|
9
9
|
const sortResetKey = useReactiveProp<unknown>('sortResetKey', '')
|
|
10
|
-
const emit = defineEmits()
|
|
10
|
+
const emit = defineEmits(['edit', 'delete'])
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* No slots. `UI/Table`'s `cell` and `actions` slots cannot be used yet -
|
|
@@ -4,7 +4,7 @@ import type { ProductVariantRecord } from '../../../../app/Actions/Dashboard/Com
|
|
|
4
4
|
const open = useReactiveProp('open', false)
|
|
5
5
|
const record = useReactiveProp('record', null as ProductVariantRecord | null)
|
|
6
6
|
const busy = useReactiveProp('busy', false)
|
|
7
|
-
const emit = defineEmits()
|
|
7
|
+
const emit = defineEmits(['close', 'confirm'])
|
|
8
8
|
const description = derived(() => `${record()?.variant || 'This product variant'} will be permanently removed.${record()?.productName ? ` The linked product ${record()?.productName} will remain.` : ''}`)
|
|
9
9
|
</script>
|
|
10
10
|
|
|
@@ -9,7 +9,7 @@ const products = useReactiveProp('products', [] as ProductVariantOption[])
|
|
|
9
9
|
const types = useReactiveProp('types', [] as string[])
|
|
10
10
|
const busy = useReactiveProp('busy', false)
|
|
11
11
|
const errors = useReactiveProp('errors', {} as Record<string, string>)
|
|
12
|
-
const emit = defineEmits()
|
|
12
|
+
const emit = defineEmits(['submit', 'close'])
|
|
13
13
|
const variant = state('')
|
|
14
14
|
const type = state('')
|
|
15
15
|
const description = state('')
|
|
@@ -7,7 +7,7 @@ const records = useReactiveProp('records', [] as ProductVariantRecord[])
|
|
|
7
7
|
const loading = useReactiveProp('loading', false)
|
|
8
8
|
/** The parent's sort select; a change hands the order back from a header sort. */
|
|
9
9
|
const sortResetKey = useReactiveProp<unknown>('sortResetKey', '')
|
|
10
|
-
const emit = defineEmits()
|
|
10
|
+
const emit = defineEmits(['edit', 'delete'])
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Two slotted columns, dispatched on `column.key`: the variant with its type
|
|
@@ -8,7 +8,7 @@ const open = useReactiveProp('open', false)
|
|
|
8
8
|
const record = useReactiveProp('record', null as CourierRecord | null)
|
|
9
9
|
const busy = useReactiveProp('busy', false)
|
|
10
10
|
const error = useReactiveProp('error', '')
|
|
11
|
-
const emit = defineEmits()
|
|
11
|
+
const emit = defineEmits(['close', 'confirm'])
|
|
12
12
|
const description = derived(() => `Delete ${record()?.name || 'the selected courier'} permanently. Couriers referenced by delivery routes may be protected by the database.`)
|
|
13
13
|
</script>
|
|
14
14
|
|
|
@@ -23,7 +23,7 @@ const record = useReactiveProp('record', null as CourierRecord | null)
|
|
|
23
23
|
const users = useReactiveProp('users', [] as UserOption[])
|
|
24
24
|
const busy = useReactiveProp('busy', false)
|
|
25
25
|
const error = useReactiveProp('error', '')
|
|
26
|
-
const emit = defineEmits()
|
|
26
|
+
const emit = defineEmits(['invalid', 'submit', 'close'])
|
|
27
27
|
const name = state('')
|
|
28
28
|
const phone = state('')
|
|
29
29
|
const vehicleNumber = state('')
|
|
@@ -18,7 +18,7 @@ const couriers = useReactiveProp('couriers', [] as CourierRow[])
|
|
|
18
18
|
const loading = useReactiveProp('loading', false)
|
|
19
19
|
/** The parent's search: a change returns to the first page. */
|
|
20
20
|
const pageResetKey = useReactiveProp<unknown>('pageResetKey', '')
|
|
21
|
-
const emit = defineEmits()
|
|
21
|
+
const emit = defineEmits(['edit', 'delete'])
|
|
22
22
|
|
|
23
23
|
const COLUMNS = [
|
|
24
24
|
{ key: 'name', label: 'Courier', sortable: true, class: 'font-medium text-stone-800 whitespace-nowrap dark:text-white' },
|
|
@@ -3,7 +3,7 @@ const currentPage = useReactiveProp('current-page', 1)
|
|
|
3
3
|
const totalItems = useReactiveProp('total-items', 0)
|
|
4
4
|
const itemsPerPage = useReactiveProp('items-per-page', 10)
|
|
5
5
|
const maxDisplayedPages = useReactiveProp('max-displayed-pages', 5)
|
|
6
|
-
const emit = defineEmits()
|
|
6
|
+
const emit = defineEmits(['select', 'prev', 'next', 'page'])
|
|
7
7
|
|
|
8
8
|
const totalPages = derived(() => Math.ceil(totalItems() / Math.max(1, itemsPerPage())))
|
|
9
9
|
const startItem = derived(() => totalItems() === 0 ? 0 : ((currentPage() - 1) * itemsPerPage()) + 1)
|
|
@@ -8,7 +8,7 @@ const open = useReactiveProp('open', false)
|
|
|
8
8
|
const record = useReactiveProp('record', null as DeliveryRouteRecord | null)
|
|
9
9
|
const busy = useReactiveProp('busy', false)
|
|
10
10
|
const error = useReactiveProp('error', '')
|
|
11
|
-
const emit = defineEmits()
|
|
11
|
+
const emit = defineEmits(['close', 'confirm'])
|
|
12
12
|
const description = derived(() => `Delete route #${record()?.id} for ${record()?.courier || 'the selected courier'} permanently.`)
|
|
13
13
|
</script>
|
|
14
14
|
|
|
@@ -23,7 +23,7 @@ const record = useReactiveProp('record', null as DeliveryRouteRecord | null)
|
|
|
23
23
|
const couriers = useReactiveProp('couriers', [] as CourierOption[])
|
|
24
24
|
const busy = useReactiveProp('busy', false)
|
|
25
25
|
const error = useReactiveProp('error', '')
|
|
26
|
-
const emit = defineEmits()
|
|
26
|
+
const emit = defineEmits(['invalid', 'submit', 'close'])
|
|
27
27
|
const courierId = state('')
|
|
28
28
|
const stops = state('0')
|
|
29
29
|
const deliveryTime = state('0')
|
|
@@ -17,7 +17,7 @@ const routes = useReactiveProp('routes', [] as DeliveryRouteRow[])
|
|
|
17
17
|
const loading = useReactiveProp('loading', false)
|
|
18
18
|
/** The parent's search: a change returns to the first page. */
|
|
19
19
|
const pageResetKey = useReactiveProp<unknown>('pageResetKey', '')
|
|
20
|
-
const emit = defineEmits()
|
|
20
|
+
const emit = defineEmits(['edit', 'delete'])
|
|
21
21
|
|
|
22
22
|
function formatNumber(value: number): string {
|
|
23
23
|
return new Intl.NumberFormat('en-US', { maximumFractionDigits: 2 }).format(value)
|
|
@@ -8,7 +8,7 @@ const open = useReactiveProp('open', false)
|
|
|
8
8
|
const record = useReactiveProp('record', null as DigitalDeliveryRecord | null)
|
|
9
9
|
const busy = useReactiveProp('busy', false)
|
|
10
10
|
const error = useReactiveProp('error', '')
|
|
11
|
-
const emit = defineEmits()
|
|
11
|
+
const emit = defineEmits(['close', 'confirm'])
|
|
12
12
|
const description = derived(() => `Delete ${record()?.name || 'the selected digital delivery'} permanently.`)
|
|
13
13
|
</script>
|
|
14
14
|
|
|
@@ -17,7 +17,7 @@ const mode = useReactiveProp('mode', 'create')
|
|
|
17
17
|
const record = useReactiveProp('record', null as DigitalDeliveryRecord | null)
|
|
18
18
|
const busy = useReactiveProp('busy', false)
|
|
19
19
|
const error = useReactiveProp('error', '')
|
|
20
|
-
const emit = defineEmits()
|
|
20
|
+
const emit = defineEmits(['invalid', 'submit', 'close'])
|
|
21
21
|
const name = state('')
|
|
22
22
|
const description = state('')
|
|
23
23
|
const downloadLimit = state('')
|
|
@@ -18,7 +18,7 @@ const methods = useReactiveProp('methods', [] as DigitalDeliveryRow[])
|
|
|
18
18
|
const loading = useReactiveProp('loading', false)
|
|
19
19
|
/** The parent's search: a change returns to the first page. */
|
|
20
20
|
const pageResetKey = useReactiveProp<unknown>('pageResetKey', '')
|
|
21
|
-
const emit = defineEmits()
|
|
21
|
+
const emit = defineEmits(['edit', 'delete'])
|
|
22
22
|
|
|
23
23
|
/** Expiry keeps its unit and sorts by the number of days. */
|
|
24
24
|
const COLUMNS = [
|
|
@@ -8,7 +8,7 @@ const open = useReactiveProp('open', false)
|
|
|
8
8
|
const record = useReactiveProp('record', null as LicenseKeyRecord | null)
|
|
9
9
|
const busy = useReactiveProp('busy', false)
|
|
10
10
|
const error = useReactiveProp('error', '')
|
|
11
|
-
const emit = defineEmits()
|
|
11
|
+
const emit = defineEmits(['close', 'confirm'])
|
|
12
12
|
const description = derived(() => `Delete ${record()?.key || 'the selected license key'} permanently.`)
|
|
13
13
|
</script>
|
|
14
14
|
|
|
@@ -34,7 +34,7 @@ const options = useReactiveProp('options', {
|
|
|
34
34
|
} as LicenseKeyOptions)
|
|
35
35
|
const busy = useReactiveProp('busy', false)
|
|
36
36
|
const error = useReactiveProp('error', '')
|
|
37
|
-
const emit = defineEmits()
|
|
37
|
+
const emit = defineEmits(['invalid', 'submit', 'close'])
|
|
38
38
|
const keyValue = state('')
|
|
39
39
|
const templateValue = state('Standard License')
|
|
40
40
|
const customerId = state('')
|