@isaiahiroko/tilmart-ngx-apps-admin 0.2.12 → 0.2.14
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/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-banners.module-sbSJXda_.mjs +92 -0
- package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-banners.module-sbSJXda_.mjs.map +1 -0
- package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-brands.module-EooAWVy_.mjs +73 -0
- package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-brands.module-EooAWVy_.mjs.map +1 -0
- package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-catalog.module-CnS35rup.mjs +605 -0
- package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-catalog.module-CnS35rup.mjs.map +1 -0
- package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-categories.module-u5VyaNWX.mjs +97 -0
- package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-categories.module-u5VyaNWX.mjs.map +1 -0
- package/fesm2022/{isaiahiroko-tilmart-ngx-apps-admin-claims.module-Dk9mz7Wj.mjs → isaiahiroko-tilmart-ngx-apps-admin-claims.module-CLtalsnJ.mjs} +3 -3
- package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-claims.module-CLtalsnJ.mjs.map +1 -0
- package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-coupons.module-BCkLIQta.mjs +88 -0
- package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-coupons.module-BCkLIQta.mjs.map +1 -0
- package/fesm2022/{isaiahiroko-tilmart-ngx-apps-admin-customers.module-CslGiOdq.mjs → isaiahiroko-tilmart-ngx-apps-admin-customers.module-BohEH2SB.mjs} +2 -2
- package/fesm2022/{isaiahiroko-tilmart-ngx-apps-admin-customers.module-CslGiOdq.mjs.map → isaiahiroko-tilmart-ngx-apps-admin-customers.module-BohEH2SB.mjs.map} +1 -1
- package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-flash-sales.module-z6apTF3A.mjs +86 -0
- package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-flash-sales.module-z6apTF3A.mjs.map +1 -0
- package/fesm2022/{isaiahiroko-tilmart-ngx-apps-admin-installation-requests.module-TryMzSXT.mjs → isaiahiroko-tilmart-ngx-apps-admin-installation-requests.module-Dnh9hEz_.mjs} +3 -3
- package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-installation-requests.module-Dnh9hEz_.mjs.map +1 -0
- package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-json-builder.component-BFroIYk9.mjs +1579 -0
- package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-json-builder.component-BFroIYk9.mjs.map +1 -0
- package/fesm2022/{isaiahiroko-tilmart-ngx-apps-admin-list-page.base-Cl7JZ-Tp.mjs → isaiahiroko-tilmart-ngx-apps-admin-list-page.base-ChfiBo_X.mjs} +29 -5
- package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-list-page.base-ChfiBo_X.mjs.map +1 -0
- package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-orders.module-aIW0jRhm.mjs +239 -0
- package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-orders.module-aIW0jRhm.mjs.map +1 -0
- package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-overview.module-C6gjcJ84.mjs +105 -0
- package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-overview.module-C6gjcJ84.mjs.map +1 -0
- package/fesm2022/{isaiahiroko-tilmart-ngx-apps-admin-payments.module-DstLDYM7.mjs → isaiahiroko-tilmart-ngx-apps-admin-payments.module-Bej9cdwM.mjs} +3 -3
- package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-payments.module-Bej9cdwM.mjs.map +1 -0
- package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-promotions.module-Dh7PTGG7.mjs +88 -0
- package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-promotions.module-Dh7PTGG7.mjs.map +1 -0
- package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-redirects.module-B8gaByYE.mjs +81 -0
- package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-redirects.module-B8gaByYE.mjs.map +1 -0
- package/fesm2022/{isaiahiroko-tilmart-ngx-apps-admin-referrals.module-BIAY4L_u.mjs → isaiahiroko-tilmart-ngx-apps-admin-referrals.module-7OLTrySw.mjs} +3 -3
- package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-referrals.module-7OLTrySw.mjs.map +1 -0
- package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-reports.module-fjoFzY6t.mjs +137 -0
- package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-reports.module-fjoFzY6t.mjs.map +1 -0
- package/fesm2022/{isaiahiroko-tilmart-ngx-apps-admin-returns.module-C9Iu9CX6.mjs → isaiahiroko-tilmart-ngx-apps-admin-returns.module-D0RKEzAr.mjs} +3 -3
- package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-returns.module-D0RKEzAr.mjs.map +1 -0
- package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-routes.module-BWZ9OBPH.mjs +84 -0
- package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-routes.module-BWZ9OBPH.mjs.map +1 -0
- package/fesm2022/{isaiahiroko-tilmart-ngx-apps-admin-settings.module-D8HLxbUb.mjs → isaiahiroko-tilmart-ngx-apps-admin-settings.module-DZWUhyJg.mjs} +14 -7
- package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-settings.module-DZWUhyJg.mjs.map +1 -0
- package/fesm2022/{isaiahiroko-tilmart-ngx-apps-admin-shipments.module-CWXgE2E_.mjs → isaiahiroko-tilmart-ngx-apps-admin-shipments.module-BG9DCmG-.mjs} +3 -3
- package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-shipments.module-BG9DCmG-.mjs.map +1 -0
- package/fesm2022/{isaiahiroko-tilmart-ngx-apps-admin-staff.module-YjJJe00X.mjs → isaiahiroko-tilmart-ngx-apps-admin-staff.module-Br80U5_k.mjs} +2 -2
- package/fesm2022/{isaiahiroko-tilmart-ngx-apps-admin-staff.module-YjJJe00X.mjs.map → isaiahiroko-tilmart-ngx-apps-admin-staff.module-Br80U5_k.mjs.map} +1 -1
- package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-status-badge-AXfNPKaS.mjs +66 -0
- package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-status-badge-AXfNPKaS.mjs.map +1 -0
- package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-stock.module-BFbm7118.mjs +178 -0
- package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-stock.module-BFbm7118.mjs.map +1 -0
- package/fesm2022/{isaiahiroko-tilmart-ngx-apps-admin-users.module-C31RJJJ_.mjs → isaiahiroko-tilmart-ngx-apps-admin-users.module-C8nNzJ5X.mjs} +2 -2
- package/fesm2022/{isaiahiroko-tilmart-ngx-apps-admin-users.module-C31RJJJ_.mjs.map → isaiahiroko-tilmart-ngx-apps-admin-users.module-C8nNzJ5X.mjs.map} +1 -1
- package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin.mjs +56 -46
- package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin.mjs.map +1 -1
- package/package.json +1 -1
- package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-banners.module-ClIiV2uK.mjs +0 -76
- package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-banners.module-ClIiV2uK.mjs.map +0 -1
- package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-brands.module-CSp0tWes.mjs +0 -70
- package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-brands.module-CSp0tWes.mjs.map +0 -1
- package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-catalog.module-BwjfFXDU.mjs +0 -562
- package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-catalog.module-BwjfFXDU.mjs.map +0 -1
- package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-categories.module-uKkUREjb.mjs +0 -94
- package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-categories.module-uKkUREjb.mjs.map +0 -1
- package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-claims.module-Dk9mz7Wj.mjs.map +0 -1
- package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-coupons.module-Dcu1nJBW.mjs +0 -85
- package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-coupons.module-Dcu1nJBW.mjs.map +0 -1
- package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-flash-sales.module-DF7iSJaN.mjs +0 -83
- package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-flash-sales.module-DF7iSJaN.mjs.map +0 -1
- package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-installation-requests.module-TryMzSXT.mjs.map +0 -1
- package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-list-page.base-Cl7JZ-Tp.mjs.map +0 -1
- package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-orders.module-vldWwcAr.mjs +0 -190
- package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-orders.module-vldWwcAr.mjs.map +0 -1
- package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-payments.module-DstLDYM7.mjs.map +0 -1
- package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-promotions.module-BO4zRytg.mjs +0 -94
- package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-promotions.module-BO4zRytg.mjs.map +0 -1
- package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-redirects.module-D8H6ujoy.mjs +0 -78
- package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-redirects.module-D8H6ujoy.mjs.map +0 -1
- package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-referrals.module-BIAY4L_u.mjs.map +0 -1
- package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-reports.module-DORiIVLQ.mjs +0 -104
- package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-reports.module-DORiIVLQ.mjs.map +0 -1
- package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-returns.module-C9Iu9CX6.mjs.map +0 -1
- package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-routes.module-fYKd3AOq.mjs +0 -81
- package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-routes.module-fYKd3AOq.mjs.map +0 -1
- package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-settings.module-D8HLxbUb.mjs.map +0 -1
- package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-shipments.module-CWXgE2E_.mjs.map +0 -1
- package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-simple-crud.base-C8SPw14H.mjs +0 -140
- package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-simple-crud.base-C8SPw14H.mjs.map +0 -1
- package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-stock.module-BSAe0CfZ.mjs +0 -102
- package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-stock.module-BSAe0CfZ.mjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isaiahiroko-tilmart-ngx-apps-admin-orders.module-aIW0jRhm.mjs","sources":["../../../projects/admin/src/lib/pages/orders/orders.component.ts","../../../projects/admin/src/lib/pages/orders/orders.component.html","../../../projects/admin/src/lib/pages/orders/orders.module.ts"],"sourcesContent":["import { Component, TemplateRef, ViewChild, inject } from '@angular/core';\nimport { ActivatedRoute } from '@angular/router';\nimport { notify, using } from '@thescaffold/ngx-core';\nimport { downloadBlob } from '@isaiahiroko/tilmart-ngx-ui';\nimport { FlyoutService } from '@thescaffold/ngx-ui';\nimport { catchError, firstValueFrom, of, takeUntil } from 'rxjs';\nimport { ListPageDirective } from '../_shared/list-page.base';\nimport { statusBadge, statusFilters } from '../_shared/status-badge';\n\nfunction naira(amount: number, currency = 'NGN'): string {\n return new Intl.NumberFormat('en-NG', { style: 'currency', currency, maximumFractionDigits: 0 }).format(\n Math.round(amount),\n );\n}\n\n// \"3 Nov, 14:05\" with the full timestamp on hover — ops scan by date, and\n// \"4 days ago\" on every row of a busy day says nothing.\nfunction placedLabel(date: Date): string {\n if (Number.isNaN(date.getTime())) return '—';\n const sameYear = date.getFullYear() === new Date().getFullYear();\n const short = date.toLocaleString('en-NG', {\n day: 'numeric',\n month: 'short',\n ...(sameYear ? {} : { year: 'numeric' }),\n hour: '2-digit',\n minute: '2-digit',\n });\n return `<span title=\"${date.toLocaleString('en-NG')}\">${short}</span>`;\n}\n\n// Ops action buttons per current status — each entry is a permitted\n// `OrderWorkflow.transition` target. Matches the PRD Appendix B matrix;\n// fulfilment-driven statuses (dispatched, delivered, …) are set by the\n// Shipments page, not here.\nconst ACTIONS: Record<string, { to: string; label: string }[]> = {\n payment_received: [{ to: 'confirmed', label: 'Confirm' }, { to: 'on_hold', label: 'Hold' }],\n on_hold: [{ to: 'confirmed', label: 'Release' }, { to: 'cancelled', label: 'Cancel' }],\n confirmed: [{ to: 'processing', label: 'Start preparing' }, { to: 'cancelled', label: 'Cancel' }],\n processing: [{ to: 'cancelled', label: 'Cancel' }],\n pending_payment: [{ to: 'cancelled', label: 'Cancel' }],\n};\n\n@Component({\n standalone: false,\n selector: 'x-orders',\n templateUrl: './orders.component.html',\n styleUrl: './orders.component.scss',\n})\nexport class OrdersComponent extends ListPageDirective {\n private readonly flyoutService = inject(FlyoutService);\n private readonly route = inject(ActivatedRoute);\n\n protected pluralName = 'orders';\n protected dataSource = this.apiService.on('apps/commerce/order');\n private readonly lineSource = this.apiService.on('apps/commerce/order-line');\n private readonly historySource = this.apiService.on('apps/commerce/order-status-history');\n private readonly paymentSource = this.apiService.on('apps/commerce/payment');\n private readonly shipmentSource = this.apiService.on('apps/commerce/shipment');\n\n protected columns = [\n { key: 'orderNumber', value: 'Order' },\n { key: 'customerLabel', value: 'Customer' },\n { key: 'statusHtml', value: 'Status' },\n { key: 'grandTotalLabel', value: 'Total' },\n { key: 'paidLabel', value: 'Paid' },\n { key: 'placedHtml', value: 'Placed' },\n ];\n\n protected override filters = statusFilters([\n 'pending_payment',\n 'payment_received',\n 'confirmed',\n 'processing',\n 'ready_to_ship',\n 'dispatched',\n 'delivered',\n 'cancelled',\n ]);\n\n private readonly customerSource = this.apiService.on('apps/commerce/customer');\n /** customerId → display name, cached across pages. */\n private readonly customers = new Map<string, string>();\n\n detail: any = null;\n detailActions: { to: string; label: string }[] = [];\n naira = naira;\n statusBadge = statusBadge;\n\n @ViewChild('detailFlyout', { read: TemplateRef, static: true })\n detailFlyout!: TemplateRef<any>;\n\n override init = () => {\n this.query = this.route.snapshot.queryParamMap.get('q') ?? '';\n this.list();\n };\n\n view(item: any) {\n this.detail = null;\n this.detailActions = ACTIONS[item.status] ?? [];\n this.flyoutService.open(this.detailFlyout);\n\n this.lineSource\n .getMany({ orderId: item.id, page: 1, perPage: 200 } as any)\n .pipe(takeUntil(this.$))\n .subscribe(\n using(({ data: lines }: { data: any[] }) => {\n this.detail = {\n id: item.id,\n orderNumber: item.orderNumber,\n status: item.status,\n currency: item.currency,\n businessName: item.businessName,\n recipientName: item.recipientName,\n recipientPhone: item.recipientPhone,\n subtotal: Number(item.subtotal ?? 0),\n deliveryTotal: Number(item.deliveryTotal ?? 0),\n taxTotal: Number(item.taxTotal ?? 0),\n grandTotal: Number(item.grandTotal ?? 0),\n amountPaid: Number(item.amountPaid ?? 0),\n codAmountDue: Number(item.codAmountDue ?? 0),\n lines: lines ?? [],\n history: [],\n payments: [],\n shipments: [],\n };\n\n this.historySource\n .getMany({ orderId: item.id, page: 1, perPage: 100 } as any)\n .pipe(takeUntil(this.$))\n .subscribe(using(({ data }: { data: any[] }) => {\n if (this.detail) this.detail.history = data ?? [];\n }));\n this.paymentSource\n .getMany({ orderId: item.id, page: 1, perPage: 20 } as any)\n .pipe(takeUntil(this.$))\n .subscribe(using(({ data }: { data: any[] }) => {\n if (this.detail) this.detail.payments = data ?? [];\n }));\n this.shipmentSource\n .getMany({ orderId: item.id, page: 1, perPage: 50 } as any)\n .pipe(takeUntil(this.$))\n .subscribe(using(({ data }: { data: any[] }) => {\n if (this.detail) this.detail.shipments = data ?? [];\n }));\n }),\n );\n }\n\n // ORD-11 — the order's VAT invoice as a PDF. Fetched as a Blob (auth\n // header, not a cookie) and saved under the invoice's document number.\n downloadingInvoice = false;\n downloadInvoice() {\n if (!this.detail || this.downloadingInvoice) return;\n const { id, orderNumber } = this.detail;\n this.downloadingInvoice = true;\n this.apiService.requestService\n .raw<Blob>(\n 'get',\n `apps/commerce/document/order/${id}/invoice`,\n { format: 'pdf' },\n { responseType: 'blob' },\n )\n .pipe(takeUntil(this.$))\n .subscribe({\n next: (blob) => {\n this.downloadingInvoice = false;\n downloadBlob(blob, `INV-${orderNumber}.pdf`);\n },\n error: () => {\n this.downloadingInvoice = false;\n notify('Could not generate the invoice PDF.', undefined, 'error');\n },\n });\n }\n\n transition(to: string) {\n if (!this.detail) return;\n this.apiService\n .post(`apps/commerce/order/${this.detail.id}/transition`, { toStatus: to })\n .pipe(takeUntil(this.$))\n .subscribe(\n using((res: any) => {\n if (res?.status === 'error') {\n notify(res.message || 'That transition is not allowed.', undefined, 'error');\n return;\n }\n notify(`Order moved to ${to.replace(/_/g, ' ')}.`, undefined, 'success');\n this.flyoutService.dismiss();\n this.list();\n }),\n );\n }\n\n // Orders carry only a customer id; resolve this page's names in one\n // parallel batch (cached), so the table shows who ordered.\n protected override async enrichRows(rows: any[]): Promise<void> {\n const missing = [...new Set(rows.map((r) => r.customerId).filter((id) => id && !this.customers.has(id)))];\n await Promise.all(\n missing.map(async (id: string) => {\n // Filtered list, not getOne: a deleted customer is an empty 200, not a 404.\n const res: any = await firstValueFrom(\n this.customerSource.getMany({ id, page: 1, perPage: 1 } as any).pipe(catchError(() => of(null))),\n );\n const c = (res?.data ?? []).find((row: any) => row.id === id);\n this.customers.set(id, c?.name || c?.email || c?.phone || '');\n }),\n );\n }\n\n protected override mapRow(order: any) {\n const placed = order.placedAt ?? order.createdAt;\n return {\n ...order,\n customerLabel:\n order.businessName ||\n (order.customerId && this.customers.get(order.customerId)) ||\n order.recipientName ||\n 'Guest',\n statusHtml: statusBadge(order.status),\n grandTotalLabel: naira(Number(order.grandTotal ?? 0), order.currency),\n paidLabel: naira(Number(order.amountPaid ?? 0), order.currency),\n placedHtml: placed ? placedLabel(new Date(placed)) : '—',\n };\n }\n\n protected override extraCollectionFields() {\n return {\n links: {\n secondary: [{ title: 'View', fn: (_link: any, item: any) => this.view(item) }],\n },\n };\n }\n}\n","<div class=\"x-page-head\">\n <div class=\"x-page-title\">Orders</div>\n <div class=\"x-page-subtitle\">Every order — search, drill in, move it forward.</div>\n</div>\n\n@if (list$ | async; as list) {\n <x-webget-collection [data]=\"list\"></x-webget-collection>\n} @else {\n <x-element-loader></x-element-loader>\n}\n\n<ng-template #detailFlyout>\n <x-webget-flyout [data]=\"{ title: 'Order detail' }\">\n <div class=\"p-4 d-flex flex-column gap-3\">\n @if (detail) {\n <div>\n <div class=\"fw-bold font-monospace\">\n {{ detail.orderNumber }}\n <a\n class=\"small ms-2\"\n [routerLink]=\"['/admin/trace']\"\n [queryParams]=\"{ ref: detail.orderNumber }\"\n >full trace →</a>\n </div>\n <span class=\"mt-1 d-inline-block\" [innerHTML]=\"statusBadge(detail.status)\"></span>\n @if (detail.businessName) {\n <div class=\"text-secondary small mt-1\">Invoice to: {{ detail.businessName }}</div>\n }\n @if (detail.recipientName) {\n <div class=\"text-secondary small\">Recipient: {{ detail.recipientName }} · {{ detail.recipientPhone }}</div>\n }\n </div>\n\n <div class=\"d-flex flex-wrap gap-2\">\n <button\n type=\"button\"\n class=\"btn btn-sm btn-outline-primary\"\n [disabled]=\"downloadingInvoice\"\n (click)=\"downloadInvoice()\"\n >\n {{ downloadingInvoice ? 'Preparing…' : 'Download invoice (PDF)' }}\n </button>\n </div>\n\n @if (detailActions.length) {\n <div class=\"d-flex flex-wrap gap-2\">\n @for (action of detailActions; track action.to) {\n <button type=\"button\" class=\"btn btn-sm btn-outline-dark\" (click)=\"transition(action.to)\">\n {{ action.label }}\n </button>\n }\n </div>\n }\n\n <table class=\"table table-sm\">\n <thead><tr><th>Item</th><th>Qty</th><th class=\"text-end\">Amount</th></tr></thead>\n <tbody>\n @for (line of detail.lines; track line.id) {\n <tr>\n <td>{{ line.nameSnapshot || line.variantId }}</td>\n <td>{{ line.quantity }}</td>\n <td class=\"text-end\">{{ naira(line.unitPrice * line.quantity, detail.currency) }}</td>\n </tr>\n } @empty {\n <tr><td colspan=\"3\" class=\"text-secondary\">No lines.</td></tr>\n }\n </tbody>\n </table>\n\n <div class=\"small\">\n <div class=\"d-flex justify-content-between\"><span>Subtotal</span><span>{{ naira(detail.subtotal, detail.currency) }}</span></div>\n <div class=\"d-flex justify-content-between\"><span>Delivery</span><span>{{ naira(detail.deliveryTotal, detail.currency) }}</span></div>\n <div class=\"d-flex justify-content-between\"><span>VAT (incl.)</span><span>{{ naira(detail.taxTotal, detail.currency) }}</span></div>\n <div class=\"d-flex justify-content-between fw-bold\"><span>Total</span><span>{{ naira(detail.grandTotal, detail.currency) }}</span></div>\n <div class=\"d-flex justify-content-between\"><span>Paid</span><span>{{ naira(detail.amountPaid, detail.currency) }}</span></div>\n @if (detail.codAmountDue > 0) {\n <div class=\"d-flex justify-content-between text-warning\"><span>Due on delivery</span><span>{{ naira(detail.codAmountDue, detail.currency) }}</span></div>\n }\n </div>\n\n <hr class=\"my-1\" />\n <div>\n <div class=\"fw-bold small mb-1\">Payments</div>\n @for (payment of detail.payments; track payment.id) {\n <div class=\"small text-secondary\">\n {{ payment.provider }} · {{ payment.method || 'card' }} · {{ payment.status }}\n · {{ naira(payment.amount, payment.currency) }}\n </div>\n } @empty {\n <div class=\"small text-secondary\">None.</div>\n }\n </div>\n\n <div>\n <div class=\"fw-bold small mb-1\">Shipments</div>\n @for (shipment of detail.shipments; track shipment.id) {\n <div class=\"small text-secondary\">\n {{ shipment.status }}@if (shipment.trackingRef) { · {{ shipment.trackingRef }} }\n </div>\n } @empty {\n <div class=\"small text-secondary\">None yet — create one on the Shipments page.</div>\n }\n </div>\n\n <div>\n <div class=\"fw-bold small mb-1\">History</div>\n @for (row of detail.history; track row.id) {\n <div class=\"small text-secondary\">\n {{ row.toStatus }} · {{ row.createdAt | date: 'MMM d, h:mm a' }}\n @if (row.reason) { — {{ row.reason }} }\n </div>\n } @empty {\n <div class=\"small text-secondary\">No transitions recorded.</div>\n }\n </div>\n } @else {\n <x-element-loader></x-element-loader>\n }\n </div>\n </x-webget-flyout>\n</ng-template>\n","import { NgModule } from '@angular/core';\nimport { RouterModule } from '@angular/router';\nimport { SharedModule } from '@thescaffold/ngx-core';\nimport { ElementsModule, WebgetsModule } from '@thescaffold/ngx-ui';\nimport { OrdersComponent } from './orders.component';\n\n@NgModule({\n declarations: [OrdersComponent],\n imports: [\n SharedModule,\n ElementsModule,\n WebgetsModule,\n RouterModule.forChild([{ path: '', component: OrdersComponent }]),\n ],\n})\nexport class OrdersModule {}\n"],"names":[],"mappings":";;;;;;;;;;;;;AASA,SAAS,KAAK,CAAC,MAAc,EAAE,QAAQ,GAAG,KAAK,EAAA;AAC7C,IAAA,OAAO,IAAI,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,qBAAqB,EAAE,CAAC,EAAE,CAAC,CAAC,MAAM,CACrG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CACnB;AACH;AAEA;AACA;AACA,SAAS,WAAW,CAAC,IAAU,EAAA;IAC7B,IAAI,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;AAAE,QAAA,OAAO,GAAG;AAC5C,IAAA,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,EAAE,KAAK,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;AAChE,IAAA,MAAM,KAAK,GAAG,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE;AACzC,QAAA,GAAG,E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AAY,EAAE,CAAC,eAAe,CAAC;AAC/B,oBAAA,OAAO,EAAE;wBACP,YAAY;wBACZ,cAAc;wBACd,aAAa;AACb,wBAAA,YAAY,CAAC,QAAQ,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,SAAS,EAAE,eAAe,EAAE,CAAC,CAAC;AAClE,qBAAA;AACF,iBAAA;;;;;"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Component, NgModule } from '@angular/core';
|
|
3
|
+
import * as i1 from '@angular/router';
|
|
4
|
+
import { RouterModule } from '@angular/router';
|
|
5
|
+
import { BaseDirective, SharedModule } from '@thescaffold/ngx-core';
|
|
6
|
+
import * as i2 from '@thescaffold/ngx-ui';
|
|
7
|
+
import { ElementsModule } from '@thescaffold/ngx-ui';
|
|
8
|
+
import { firstValueFrom, catchError, of } from 'rxjs';
|
|
9
|
+
import * as i3 from '@angular/common';
|
|
10
|
+
|
|
11
|
+
// `/admin` landing page: what needs doing now (counts per work queue, each
|
|
12
|
+
// linking to its list) and how the last 7 days went. Counts come from the
|
|
13
|
+
// `queues` read model (the same one behind the sidebar badges); the trend
|
|
14
|
+
// from the Reports commerce read model.
|
|
15
|
+
class OverviewComponent extends BaseDirective {
|
|
16
|
+
constructor() {
|
|
17
|
+
super(...arguments);
|
|
18
|
+
this.queues = [
|
|
19
|
+
{ label: 'Awaiting payment', hint: 'Orders placed, not yet paid', url: '/admin/orders', key: 'orders_awaiting_payment', tone: 'warn' },
|
|
20
|
+
{ label: 'Paid — to confirm', hint: 'Check stock and confirm', url: '/admin/orders', key: 'orders_to_confirm', tone: 'info' },
|
|
21
|
+
{ label: 'Ready to ship', hint: 'Packed, waiting for dispatch', url: '/admin/shipments', key: 'orders_ready_to_ship', tone: 'info' },
|
|
22
|
+
{ label: 'Return requests', hint: 'New returns to review', url: '/admin/returns', key: 'returns_requested', tone: 'warn' },
|
|
23
|
+
{ label: 'Warranty claims', hint: 'Submitted, not triaged', url: '/admin/claims', key: 'claims_submitted', tone: 'warn' },
|
|
24
|
+
{ label: 'Installation leads', hint: 'New requests to contact', url: '/admin/installation-requests', key: 'installation_new', tone: 'info' },
|
|
25
|
+
];
|
|
26
|
+
this.week = null;
|
|
27
|
+
this.today = null;
|
|
28
|
+
this.stock = null;
|
|
29
|
+
this.days = [];
|
|
30
|
+
this.loading = true;
|
|
31
|
+
this.init = () => {
|
|
32
|
+
void this.load();
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
async load() {
|
|
36
|
+
this.loading = true;
|
|
37
|
+
await Promise.all([this.loadQueues(), this.loadWeek()]);
|
|
38
|
+
this.loading = false;
|
|
39
|
+
}
|
|
40
|
+
async loadQueues() {
|
|
41
|
+
const res = await firstValueFrom(this.apiService.get('apps/admin/analytics/queues').pipe(catchError(() => of(null))));
|
|
42
|
+
const q = res?.data;
|
|
43
|
+
if (!q)
|
|
44
|
+
return;
|
|
45
|
+
for (const queue of this.queues)
|
|
46
|
+
queue.count = Number(q[queue.key] ?? 0);
|
|
47
|
+
this.stock = { out: Number(q.stock_out ?? 0), low: Number(q.stock_low ?? 0) };
|
|
48
|
+
}
|
|
49
|
+
async loadWeek() {
|
|
50
|
+
const res = await firstValueFrom(this.apiService.get('apps/admin/analytics/commerce', { days: 7 }).pipe(catchError(() => of(null))));
|
|
51
|
+
const data = res?.data;
|
|
52
|
+
if (!data)
|
|
53
|
+
return;
|
|
54
|
+
const summary = data.summary ?? {};
|
|
55
|
+
this.week = {
|
|
56
|
+
revenue: Number(summary.gross_revenue ?? summary.grossRevenue ?? 0),
|
|
57
|
+
orders: Number(summary.orders ?? 0),
|
|
58
|
+
aov: Number(summary.aov ?? 0),
|
|
59
|
+
};
|
|
60
|
+
this.days = (data.byDay ?? []).map((d) => ({
|
|
61
|
+
day: d.day,
|
|
62
|
+
revenue: Number(d.revenue) || 0,
|
|
63
|
+
orders: Number(d.orders) || 0,
|
|
64
|
+
}));
|
|
65
|
+
const todayKey = new Date().toISOString().slice(0, 10);
|
|
66
|
+
const t = this.days.find((d) => d.day === todayKey);
|
|
67
|
+
this.today = { revenue: t?.revenue ?? 0, orders: t?.orders ?? 0 };
|
|
68
|
+
}
|
|
69
|
+
money(n) {
|
|
70
|
+
return `₦${Math.round(n || 0).toLocaleString('en-NG')}`;
|
|
71
|
+
}
|
|
72
|
+
barHeight(revenue) {
|
|
73
|
+
const max = Math.max(...this.days.map((d) => d.revenue), 0);
|
|
74
|
+
return max > 0 ? Math.max(4, Math.round((revenue / max) * 100)) : 4;
|
|
75
|
+
}
|
|
76
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: OverviewComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
77
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.16", type: OverviewComponent, isStandalone: false, selector: "x-overview", usesInheritance: true, ngImport: i0, template: "<div class=\"x-page-head\">\n <div class=\"x-page-title\">Overview</div>\n <div class=\"x-page-subtitle\">What needs doing now, and how the last 7 days went.</div>\n</div>\n\n<div class=\"x-ov-section-label\">Needs attention</div>\n<div class=\"x-ov-queues\">\n @for (q of queues; track q.label) {\n <a [routerLink]=\"q.url\" [class]=\"'x-ov-queue x-ov-' + q.tone\" [class.x-ov-zero]=\"q.count === 0\">\n <span class=\"x-ov-queue-count\">{{ q.count ?? '\u2014' }}</span>\n <span class=\"x-ov-queue-label\">{{ q.label }}</span>\n <span class=\"x-ov-queue-hint\">{{ q.hint }}</span>\n </a>\n }\n @if (stock) {\n <a class=\"x-ov-queue x-ov-danger\" routerLink=\"/admin/stock\" [class.x-ov-zero]=\"!stock.out && !stock.low\">\n <span class=\"x-ov-queue-count\">{{ stock.out }}<small> out \u00B7 {{ stock.low }} low</small></span>\n <span class=\"x-ov-queue-label\">Stock</span>\n <span class=\"x-ov-queue-hint\">Stock rows sold out or under their threshold</span>\n </a>\n }\n</div>\n\n<div class=\"x-ov-section-label\">Sales</div>\n@if (loading && !week) {\n <x-element-loader></x-element-loader>\n} @else {\n <div class=\"x-ov-kpis\">\n <div class=\"x-ov-kpi\">\n <span class=\"x-ov-kpi-label\">Today</span>\n <span class=\"x-ov-kpi-value\">{{ money(today?.revenue ?? 0) }}</span>\n <span class=\"x-ov-kpi-sub\">{{ today?.orders ?? 0 }} {{ (today?.orders ?? 0) === 1 ? 'order' : 'orders' }}</span>\n </div>\n <div class=\"x-ov-kpi\">\n <span class=\"x-ov-kpi-label\">Last 7 days</span>\n <span class=\"x-ov-kpi-value\">{{ money(week?.revenue ?? 0) }}</span>\n <span class=\"x-ov-kpi-sub\">{{ week?.orders ?? 0 }} {{ (week?.orders ?? 0) === 1 ? 'order' : 'orders' }}</span>\n </div>\n <div class=\"x-ov-kpi\">\n <span class=\"x-ov-kpi-label\">Average order value</span>\n <span class=\"x-ov-kpi-value\">{{ money(week?.aov ?? 0) }}</span>\n <span class=\"x-ov-kpi-sub\">last 7 days</span>\n </div>\n </div>\n\n @if (days.length) {\n <div class=\"x-ov-chart\" role=\"img\" [attr.aria-label]=\"'Revenue for the last ' + days.length + ' days with sales'\">\n @for (d of days; track d.day) {\n <div class=\"x-ov-chart-col\" [title]=\"(d.day | date: 'EEE d MMM') + ': ' + money(d.revenue) + ' \u00B7 ' + d.orders + ' orders'\">\n <span class=\"x-ov-chart-bar\" [style.height.%]=\"barHeight(d.revenue)\"></span>\n <span class=\"x-ov-chart-day\">{{ d.day | date: 'EEE' }}</span>\n </div>\n }\n </div>\n } @else {\n <p class=\"x-ov-empty\">No orders in the last 7 days.</p>\n }\n <a class=\"x-ov-more\" routerLink=\"/admin/reports\">Full reports \u2192</a>\n}\n", styles: [".x-page-head{margin-bottom:20px}.x-page-title{font-size:24px;font-weight:800;color:var(--color-text)}.x-page-subtitle{font-size:13.5px;color:var(--color-text-muted);margin-top:2px}.x-ov-section-label{font-size:11.5px;text-transform:uppercase;letter-spacing:.04em;font-weight:700;color:var(--color-text-muted);margin:8px 0 10px}.x-ov-queues{display:grid;grid-template-columns:repeat(auto-fill,minmax(200px,1fr));gap:10px;margin-bottom:28px}.x-ov-queue{display:flex;flex-direction:column;gap:2px;padding:12px 14px;border:1px solid var(--color-border);border-left-width:4px;border-radius:10px;background:var(--color-surface);color:var(--color-text);text-decoration:none}.x-ov-queue:hover{border-color:var(--color-accent)}.x-ov-warn{border-left-color:var(--color-warn)}.x-ov-info{border-left-color:var(--color-info)}.x-ov-danger{border-left-color:var(--color-danger)}.x-ov-zero{border-left-color:var(--color-border);opacity:.75}.x-ov-queue-count{font-size:24px;font-weight:800;font-family:var(--font-mono)}.x-ov-queue-count small{font-size:12px;font-weight:600;color:var(--color-text-muted)}.x-ov-queue-label{font-weight:700;font-size:13.5px}.x-ov-queue-hint{font-size:12px;color:var(--color-text-muted)}.x-ov-kpis{display:grid;grid-template-columns:repeat(auto-fill,minmax(200px,1fr));gap:10px;margin-bottom:14px}.x-ov-kpi{display:flex;flex-direction:column;padding:12px 14px;border:1px solid var(--color-border);border-radius:10px}.x-ov-kpi-label{font-size:12px;color:var(--color-text-muted)}.x-ov-kpi-value{font-size:22px;font-weight:800;margin-top:2px}.x-ov-kpi-sub{font-size:12px;color:var(--color-text-muted)}.x-ov-chart{display:flex;align-items:flex-end;gap:8px;height:140px;padding:10px 12px 0;border:1px solid var(--color-border);border-radius:10px}.x-ov-chart-col{flex:1;height:100%;display:flex;flex-direction:column;justify-content:flex-end;align-items:center;gap:4px}.x-ov-chart-bar{width:100%;max-width:48px;border-radius:4px 4px 0 0;background:var(--color-accent)}.x-ov-chart-day{font-size:11px;color:var(--color-text-muted);padding-bottom:6px}.x-ov-empty{font-size:13px;color:var(--color-text-muted)}.x-ov-more{display:inline-block;margin-top:12px;font-size:13px;font-weight:600}\n"], dependencies: [{ kind: "directive", type: i1.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "component", type: i2.LoaderComponent, selector: "x-element-loader", inputs: ["data"] }, { kind: "pipe", type: i3.DatePipe, name: "date" }] }); }
|
|
78
|
+
}
|
|
79
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: OverviewComponent, decorators: [{
|
|
80
|
+
type: Component,
|
|
81
|
+
args: [{ standalone: false, selector: 'x-overview', template: "<div class=\"x-page-head\">\n <div class=\"x-page-title\">Overview</div>\n <div class=\"x-page-subtitle\">What needs doing now, and how the last 7 days went.</div>\n</div>\n\n<div class=\"x-ov-section-label\">Needs attention</div>\n<div class=\"x-ov-queues\">\n @for (q of queues; track q.label) {\n <a [routerLink]=\"q.url\" [class]=\"'x-ov-queue x-ov-' + q.tone\" [class.x-ov-zero]=\"q.count === 0\">\n <span class=\"x-ov-queue-count\">{{ q.count ?? '\u2014' }}</span>\n <span class=\"x-ov-queue-label\">{{ q.label }}</span>\n <span class=\"x-ov-queue-hint\">{{ q.hint }}</span>\n </a>\n }\n @if (stock) {\n <a class=\"x-ov-queue x-ov-danger\" routerLink=\"/admin/stock\" [class.x-ov-zero]=\"!stock.out && !stock.low\">\n <span class=\"x-ov-queue-count\">{{ stock.out }}<small> out \u00B7 {{ stock.low }} low</small></span>\n <span class=\"x-ov-queue-label\">Stock</span>\n <span class=\"x-ov-queue-hint\">Stock rows sold out or under their threshold</span>\n </a>\n }\n</div>\n\n<div class=\"x-ov-section-label\">Sales</div>\n@if (loading && !week) {\n <x-element-loader></x-element-loader>\n} @else {\n <div class=\"x-ov-kpis\">\n <div class=\"x-ov-kpi\">\n <span class=\"x-ov-kpi-label\">Today</span>\n <span class=\"x-ov-kpi-value\">{{ money(today?.revenue ?? 0) }}</span>\n <span class=\"x-ov-kpi-sub\">{{ today?.orders ?? 0 }} {{ (today?.orders ?? 0) === 1 ? 'order' : 'orders' }}</span>\n </div>\n <div class=\"x-ov-kpi\">\n <span class=\"x-ov-kpi-label\">Last 7 days</span>\n <span class=\"x-ov-kpi-value\">{{ money(week?.revenue ?? 0) }}</span>\n <span class=\"x-ov-kpi-sub\">{{ week?.orders ?? 0 }} {{ (week?.orders ?? 0) === 1 ? 'order' : 'orders' }}</span>\n </div>\n <div class=\"x-ov-kpi\">\n <span class=\"x-ov-kpi-label\">Average order value</span>\n <span class=\"x-ov-kpi-value\">{{ money(week?.aov ?? 0) }}</span>\n <span class=\"x-ov-kpi-sub\">last 7 days</span>\n </div>\n </div>\n\n @if (days.length) {\n <div class=\"x-ov-chart\" role=\"img\" [attr.aria-label]=\"'Revenue for the last ' + days.length + ' days with sales'\">\n @for (d of days; track d.day) {\n <div class=\"x-ov-chart-col\" [title]=\"(d.day | date: 'EEE d MMM') + ': ' + money(d.revenue) + ' \u00B7 ' + d.orders + ' orders'\">\n <span class=\"x-ov-chart-bar\" [style.height.%]=\"barHeight(d.revenue)\"></span>\n <span class=\"x-ov-chart-day\">{{ d.day | date: 'EEE' }}</span>\n </div>\n }\n </div>\n } @else {\n <p class=\"x-ov-empty\">No orders in the last 7 days.</p>\n }\n <a class=\"x-ov-more\" routerLink=\"/admin/reports\">Full reports \u2192</a>\n}\n", styles: [".x-page-head{margin-bottom:20px}.x-page-title{font-size:24px;font-weight:800;color:var(--color-text)}.x-page-subtitle{font-size:13.5px;color:var(--color-text-muted);margin-top:2px}.x-ov-section-label{font-size:11.5px;text-transform:uppercase;letter-spacing:.04em;font-weight:700;color:var(--color-text-muted);margin:8px 0 10px}.x-ov-queues{display:grid;grid-template-columns:repeat(auto-fill,minmax(200px,1fr));gap:10px;margin-bottom:28px}.x-ov-queue{display:flex;flex-direction:column;gap:2px;padding:12px 14px;border:1px solid var(--color-border);border-left-width:4px;border-radius:10px;background:var(--color-surface);color:var(--color-text);text-decoration:none}.x-ov-queue:hover{border-color:var(--color-accent)}.x-ov-warn{border-left-color:var(--color-warn)}.x-ov-info{border-left-color:var(--color-info)}.x-ov-danger{border-left-color:var(--color-danger)}.x-ov-zero{border-left-color:var(--color-border);opacity:.75}.x-ov-queue-count{font-size:24px;font-weight:800;font-family:var(--font-mono)}.x-ov-queue-count small{font-size:12px;font-weight:600;color:var(--color-text-muted)}.x-ov-queue-label{font-weight:700;font-size:13.5px}.x-ov-queue-hint{font-size:12px;color:var(--color-text-muted)}.x-ov-kpis{display:grid;grid-template-columns:repeat(auto-fill,minmax(200px,1fr));gap:10px;margin-bottom:14px}.x-ov-kpi{display:flex;flex-direction:column;padding:12px 14px;border:1px solid var(--color-border);border-radius:10px}.x-ov-kpi-label{font-size:12px;color:var(--color-text-muted)}.x-ov-kpi-value{font-size:22px;font-weight:800;margin-top:2px}.x-ov-kpi-sub{font-size:12px;color:var(--color-text-muted)}.x-ov-chart{display:flex;align-items:flex-end;gap:8px;height:140px;padding:10px 12px 0;border:1px solid var(--color-border);border-radius:10px}.x-ov-chart-col{flex:1;height:100%;display:flex;flex-direction:column;justify-content:flex-end;align-items:center;gap:4px}.x-ov-chart-bar{width:100%;max-width:48px;border-radius:4px 4px 0 0;background:var(--color-accent)}.x-ov-chart-day{font-size:11px;color:var(--color-text-muted);padding-bottom:6px}.x-ov-empty{font-size:13px;color:var(--color-text-muted)}.x-ov-more{display:inline-block;margin-top:12px;font-size:13px;font-weight:600}\n"] }]
|
|
82
|
+
}] });
|
|
83
|
+
|
|
84
|
+
class OverviewModule {
|
|
85
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: OverviewModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
86
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.2.16", ngImport: i0, type: OverviewModule, declarations: [OverviewComponent], imports: [SharedModule,
|
|
87
|
+
ElementsModule, i1.RouterModule] }); }
|
|
88
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: OverviewModule, imports: [SharedModule,
|
|
89
|
+
ElementsModule,
|
|
90
|
+
RouterModule.forChild([{ path: '', component: OverviewComponent }])] }); }
|
|
91
|
+
}
|
|
92
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: OverviewModule, decorators: [{
|
|
93
|
+
type: NgModule,
|
|
94
|
+
args: [{
|
|
95
|
+
declarations: [OverviewComponent],
|
|
96
|
+
imports: [
|
|
97
|
+
SharedModule,
|
|
98
|
+
ElementsModule,
|
|
99
|
+
RouterModule.forChild([{ path: '', component: OverviewComponent }]),
|
|
100
|
+
],
|
|
101
|
+
}]
|
|
102
|
+
}] });
|
|
103
|
+
|
|
104
|
+
export { OverviewModule };
|
|
105
|
+
//# sourceMappingURL=isaiahiroko-tilmart-ngx-apps-admin-overview.module-C6gjcJ84.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isaiahiroko-tilmart-ngx-apps-admin-overview.module-C6gjcJ84.mjs","sources":["../../../projects/admin/src/lib/pages/overview/overview.component.ts","../../../projects/admin/src/lib/pages/overview/overview.component.html","../../../projects/admin/src/lib/pages/overview/overview.module.ts"],"sourcesContent":["import { Component } from '@angular/core';\nimport { BaseDirective } from '@thescaffold/ngx-core';\nimport { catchError, firstValueFrom, of } from 'rxjs';\n\ninterface Queue {\n label: string;\n hint: string;\n url: string;\n /** Field of `apps/admin/analytics/queues`. */\n key: string;\n tone: 'warn' | 'info' | 'danger';\n count?: number | null;\n}\n\n// `/admin` landing page: what needs doing now (counts per work queue, each\n// linking to its list) and how the last 7 days went. Counts come from the\n// `queues` read model (the same one behind the sidebar badges); the trend\n// from the Reports commerce read model.\n@Component({\n standalone: false,\n selector: 'x-overview',\n templateUrl: './overview.component.html',\n styleUrl: './overview.component.scss',\n})\nexport class OverviewComponent extends BaseDirective {\n queues: Queue[] = [\n { label: 'Awaiting payment', hint: 'Orders placed, not yet paid', url: '/admin/orders', key: 'orders_awaiting_payment', tone: 'warn' },\n { label: 'Paid — to confirm', hint: 'Check stock and confirm', url: '/admin/orders', key: 'orders_to_confirm', tone: 'info' },\n { label: 'Ready to ship', hint: 'Packed, waiting for dispatch', url: '/admin/shipments', key: 'orders_ready_to_ship', tone: 'info' },\n { label: 'Return requests', hint: 'New returns to review', url: '/admin/returns', key: 'returns_requested', tone: 'warn' },\n { label: 'Warranty claims', hint: 'Submitted, not triaged', url: '/admin/claims', key: 'claims_submitted', tone: 'warn' },\n { label: 'Installation leads', hint: 'New requests to contact', url: '/admin/installation-requests', key: 'installation_new', tone: 'info' },\n ];\n\n week: { revenue: number; orders: number; aov: number } | null = null;\n today: { revenue: number; orders: number } | null = null;\n stock: { out: number; low: number } | null = null;\n days: { day: string; revenue: number; orders: number }[] = [];\n loading = true;\n\n override init = () => {\n void this.load();\n };\n\n async load(): Promise<void> {\n this.loading = true;\n await Promise.all([this.loadQueues(), this.loadWeek()]);\n this.loading = false;\n }\n\n private async loadQueues(): Promise<void> {\n const res: any = await firstValueFrom(\n this.apiService.get('apps/admin/analytics/queues').pipe(catchError(() => of(null))),\n );\n const q = res?.data;\n if (!q) return;\n for (const queue of this.queues) queue.count = Number(q[queue.key] ?? 0);\n this.stock = { out: Number(q.stock_out ?? 0), low: Number(q.stock_low ?? 0) };\n }\n\n private async loadWeek(): Promise<void> {\n const res: any = await firstValueFrom(\n this.apiService.get('apps/admin/analytics/commerce', { days: 7 }).pipe(catchError(() => of(null))),\n );\n const data = res?.data;\n if (!data) return;\n const summary = data.summary ?? {};\n this.week = {\n revenue: Number(summary.gross_revenue ?? summary.grossRevenue ?? 0),\n orders: Number(summary.orders ?? 0),\n aov: Number(summary.aov ?? 0),\n };\n this.days = (data.byDay ?? []).map((d: any) => ({\n day: d.day,\n revenue: Number(d.revenue) || 0,\n orders: Number(d.orders) || 0,\n }));\n const todayKey = new Date().toISOString().slice(0, 10);\n const t = this.days.find((d) => d.day === todayKey);\n this.today = { revenue: t?.revenue ?? 0, orders: t?.orders ?? 0 };\n }\n\n money(n: number): string {\n return `₦${Math.round(n || 0).toLocaleString('en-NG')}`;\n }\n\n barHeight(revenue: number): number {\n const max = Math.max(...this.days.map((d) => d.revenue), 0);\n return max > 0 ? Math.max(4, Math.round((revenue / max) * 100)) : 4;\n }\n}\n","<div class=\"x-page-head\">\n <div class=\"x-page-title\">Overview</div>\n <div class=\"x-page-subtitle\">What needs doing now, and how the last 7 days went.</div>\n</div>\n\n<div class=\"x-ov-section-label\">Needs attention</div>\n<div class=\"x-ov-queues\">\n @for (q of queues; track q.label) {\n <a [routerLink]=\"q.url\" [class]=\"'x-ov-queue x-ov-' + q.tone\" [class.x-ov-zero]=\"q.count === 0\">\n <span class=\"x-ov-queue-count\">{{ q.count ?? '—' }}</span>\n <span class=\"x-ov-queue-label\">{{ q.label }}</span>\n <span class=\"x-ov-queue-hint\">{{ q.hint }}</span>\n </a>\n }\n @if (stock) {\n <a class=\"x-ov-queue x-ov-danger\" routerLink=\"/admin/stock\" [class.x-ov-zero]=\"!stock.out && !stock.low\">\n <span class=\"x-ov-queue-count\">{{ stock.out }}<small> out · {{ stock.low }} low</small></span>\n <span class=\"x-ov-queue-label\">Stock</span>\n <span class=\"x-ov-queue-hint\">Stock rows sold out or under their threshold</span>\n </a>\n }\n</div>\n\n<div class=\"x-ov-section-label\">Sales</div>\n@if (loading && !week) {\n <x-element-loader></x-element-loader>\n} @else {\n <div class=\"x-ov-kpis\">\n <div class=\"x-ov-kpi\">\n <span class=\"x-ov-kpi-label\">Today</span>\n <span class=\"x-ov-kpi-value\">{{ money(today?.revenue ?? 0) }}</span>\n <span class=\"x-ov-kpi-sub\">{{ today?.orders ?? 0 }} {{ (today?.orders ?? 0) === 1 ? 'order' : 'orders' }}</span>\n </div>\n <div class=\"x-ov-kpi\">\n <span class=\"x-ov-kpi-label\">Last 7 days</span>\n <span class=\"x-ov-kpi-value\">{{ money(week?.revenue ?? 0) }}</span>\n <span class=\"x-ov-kpi-sub\">{{ week?.orders ?? 0 }} {{ (week?.orders ?? 0) === 1 ? 'order' : 'orders' }}</span>\n </div>\n <div class=\"x-ov-kpi\">\n <span class=\"x-ov-kpi-label\">Average order value</span>\n <span class=\"x-ov-kpi-value\">{{ money(week?.aov ?? 0) }}</span>\n <span class=\"x-ov-kpi-sub\">last 7 days</span>\n </div>\n </div>\n\n @if (days.length) {\n <div class=\"x-ov-chart\" role=\"img\" [attr.aria-label]=\"'Revenue for the last ' + days.length + ' days with sales'\">\n @for (d of days; track d.day) {\n <div class=\"x-ov-chart-col\" [title]=\"(d.day | date: 'EEE d MMM') + ': ' + money(d.revenue) + ' · ' + d.orders + ' orders'\">\n <span class=\"x-ov-chart-bar\" [style.height.%]=\"barHeight(d.revenue)\"></span>\n <span class=\"x-ov-chart-day\">{{ d.day | date: 'EEE' }}</span>\n </div>\n }\n </div>\n } @else {\n <p class=\"x-ov-empty\">No orders in the last 7 days.</p>\n }\n <a class=\"x-ov-more\" routerLink=\"/admin/reports\">Full reports →</a>\n}\n","import { NgModule } from '@angular/core';\nimport { RouterModule } from '@angular/router';\nimport { SharedModule } from '@thescaffold/ngx-core';\nimport { ElementsModule } from '@thescaffold/ngx-ui';\nimport { OverviewComponent } from './overview.component';\n\n@NgModule({\n declarations: [OverviewComponent],\n imports: [\n SharedModule,\n ElementsModule,\n RouterModule.forChild([{ path: '', component: OverviewComponent }]),\n ],\n})\nexport class OverviewModule {}\n"],"names":[],"mappings":";;;;;;;;;;AAcA;AACA;AACA;AACA;AAOM,MAAO,iBAAkB,SAAQ,aAAa,CAAA;AANpD,IAAA,WAAA,GAAA;;AAOE,QAAA,IAAA,CAAA,MAAM,GAAY;AAChB,YAAA,EAAE,KAAK,EAAE,kBAAkB,EAAE,IAAI,EAAE,6BAA6B,EAAE,GAAG,EAAE,eAAe,EAAE,GAAG,EAAE,yBAAyB,EAAE,IAAI,EAAE,MAAM,EAAE;AACtI,YAAA,EAAE,KAAK,EAAE,mBAAmB,EAAE,IAAI,EAAE,yBAAyB,EAAE,GAAG,EA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AAA,EAAA,CAAA,CAAA;AAIL,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,cAAc,YALvB,YAAY;YACZ,cAAc;AACd,YAAA,YAAY,CAAC,QAAQ,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,SAAS,EAAE,iBAAiB,EAAE,CAAC,CAAC,CAAA,EAAA,CAAA,CAAA;;4FAG1D,cAAc,EAAA,UAAA,EAAA,CAAA;kBAR1B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACR,YAAY,EAAE,CAAC,iBAAiB,CAAC;AACjC,oBAAA,OAAO,EAAE;wBACP,YAAY;wBACZ,cAAc;AACd,wBAAA,YAAY,CAAC,QAAQ,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,SAAS,EAAE,iBAAiB,EAAE,CAAC,CAAC;AACpE,qBAAA;AACF,iBAAA;;;;;"}
|
|
@@ -6,7 +6,7 @@ import { notify, SharedModule } from '@thescaffold/ngx-core';
|
|
|
6
6
|
import * as i2 from '@thescaffold/ngx-ui';
|
|
7
7
|
import { FlyoutService, ElementsModule, WebgetsModule } from '@thescaffold/ngx-ui';
|
|
8
8
|
import { firstValueFrom } from 'rxjs';
|
|
9
|
-
import { L as ListPageDirective } from './isaiahiroko-tilmart-ngx-apps-admin-list-page.base-
|
|
9
|
+
import { L as ListPageDirective } from './isaiahiroko-tilmart-ngx-apps-admin-list-page.base-ChfiBo_X.mjs';
|
|
10
10
|
import * as i3 from '@angular/common';
|
|
11
11
|
|
|
12
12
|
// R1 production-readiness pass — PAY-13. Was list-only with no drill-in
|
|
@@ -30,7 +30,7 @@ class PaymentsComponent extends ListPageDirective {
|
|
|
30
30
|
{ key: 'provider', value: 'Provider', type: 'class', class: 'badge text-bg-light border' },
|
|
31
31
|
{ key: 'amount', value: 'Amount' },
|
|
32
32
|
{ key: 'currency', value: 'Currency' },
|
|
33
|
-
{ key: '
|
|
33
|
+
{ key: 'statusHtml', value: 'Status' },
|
|
34
34
|
{ key: 'paidAt', value: 'Paid at', type: 'date' },
|
|
35
35
|
];
|
|
36
36
|
this.detail = null;
|
|
@@ -111,4 +111,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.16", ngImpo
|
|
|
111
111
|
}] });
|
|
112
112
|
|
|
113
113
|
export { PaymentsModule };
|
|
114
|
-
//# sourceMappingURL=isaiahiroko-tilmart-ngx-apps-admin-payments.module-
|
|
114
|
+
//# sourceMappingURL=isaiahiroko-tilmart-ngx-apps-admin-payments.module-Bej9cdwM.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isaiahiroko-tilmart-ngx-apps-admin-payments.module-Bej9cdwM.mjs","sources":["../../../projects/admin/src/lib/pages/payments/payments.component.ts","../../../projects/admin/src/lib/pages/payments/payments.component.html","../../../projects/admin/src/lib/pages/payments/payments.module.ts"],"sourcesContent":["import { Component, TemplateRef, ViewChild, inject } from '@angular/core';\nimport { notify } from '@thescaffold/ngx-core';\nimport { FlyoutService } from '@thescaffold/ngx-ui';\nimport { firstValueFrom } from 'rxjs';\nimport { ListPageDirective } from '../_shared/list-page.base';\n\n// R1 production-readiness pass — PAY-13. Was list-only with no drill-in\n// at all. Adds a detail flyout (attempts history, failure codes) and\n// wires the ops \"re-verify with provider\" action that already existed\n// server-side (`OrderWorkflow.verifyPayment`) but had no button.\n//\n// PAY-10 (refunds) is deliberately not touched here — there is no\n// refund workflow on the backend at all (no ledger entry, no provider\n// refund-API call, no reason-code/permission model), so a \"Refund\"\n// button in this pass would either no-op or move money with none of\n// that in place. That's real, separate scope, not a UI gap.\n@Component({\n standalone: false,\n selector: 'x-payments',\n templateUrl: './payments.component.html',\n styleUrl: './payments.component.scss',\n})\nexport class PaymentsComponent extends ListPageDirective {\n private readonly flyoutService = inject(FlyoutService);\n\n protected pluralName = 'payments';\n protected dataSource = this.apiService.on('apps/commerce/payment');\n private readonly attemptSource = this.apiService.on('apps/commerce/payment-attempt');\n\n protected columns = [\n { key: 'provider', value: 'Provider', type: 'class', class: 'badge text-bg-light border' },\n { key: 'amount', value: 'Amount' },\n { key: 'currency', value: 'Currency' },\n { key: 'statusHtml', value: 'Status' },\n { key: 'paidAt', value: 'Paid at', type: 'date' },\n ];\n\n detail: any = null;\n attempts: any[] = [];\n verifying = false;\n\n @ViewChild('detailFlyout', { read: TemplateRef, static: true })\n detailFlyout!: TemplateRef<any>;\n\n protected override extraCollectionFields() {\n return {\n links: {\n secondary: [{ title: 'View', fn: (_link: any, item: any) => this.view(item) }],\n },\n };\n }\n\n async view(item: any): Promise<void> {\n this.detail = null;\n this.attempts = [];\n this.flyoutService.open(this.detailFlyout);\n\n const [detailRes, attemptsRes]: any = await Promise.all([\n firstValueFrom(this.dataSource.getOne(item.id)),\n firstValueFrom(this.attemptSource.getMany({ paymentId: item.id, page: 1, perPage: 50 } as any)),\n ]);\n this.detail = detailRes?.data ?? item;\n this.attempts = attemptsRes?.data ?? [];\n }\n\n async reverify(): Promise<void> {\n if (!this.detail) return;\n this.verifying = true;\n try {\n const res: any = await firstValueFrom(\n this.apiService.post(`apps/commerce/payment/${this.detail.id}/verify`),\n );\n if (res?.status === 'error') {\n notify(res.message || 'Verification failed.', undefined, 'error');\n return;\n }\n notify('Re-verified with the provider.', undefined, 'success');\n await this.view(this.detail);\n this.list(this.page, this.perPage);\n } catch {\n notify('Verification failed.', undefined, 'error');\n } finally {\n this.verifying = false;\n }\n }\n}\n","<div class=\"x-page-head\">\n <div class=\"x-page-title\">Payments</div>\n <div class=\"x-page-subtitle\">Every cycle payment, across providers.</div>\n</div>\n\n@if (list$ | async; as list) {\n <x-webget-collection [data]=\"list\"></x-webget-collection>\n} @else {\n <x-element-loader></x-element-loader>\n}\n\n<ng-template #detailFlyout>\n <x-webget-flyout [data]=\"{ title: 'Payment detail' }\">\n <div class=\"p-4 d-flex flex-column gap-3\">\n @if (detail) {\n <div>\n <span class=\"badge text-bg-light border\">{{ detail.provider }}</span>\n <span class=\"badge text-bg-light border\">{{ detail.status }}</span>\n <span class=\"badge text-bg-light border\">{{ detail.method || 'card' }}</span>\n </div>\n <div class=\"small\">\n <div class=\"d-flex justify-content-between\"><span>Amount</span><span>{{ detail.currency }} {{ detail.amount }}</span></div>\n <div class=\"d-flex justify-content-between\"><span>Provider ref</span><span class=\"font-monospace\">{{ detail.providerRef }}</span></div>\n @if (detail.paidAt) {\n <div class=\"d-flex justify-content-between\"><span>Paid at</span><span>{{ detail.paidAt | date: 'MMM d, h:mm a' }}</span></div>\n }\n @if (detail.proofRef) {\n <div class=\"d-flex justify-content-between\"><span>Proof ref</span><span>{{ detail.proofRef }}</span></div>\n }\n </div>\n\n <button type=\"button\" class=\"btn btn-sm btn-outline-dark\" [disabled]=\"verifying\" (click)=\"reverify()\">\n {{ verifying ? 'Verifying…' : 'Re-verify with provider' }}\n </button>\n\n <hr class=\"my-1\" />\n\n <div>\n <div class=\"fw-bold small mb-1\">Attempts</div>\n @for (a of attempts; track a.id) {\n <div class=\"small text-secondary\">\n {{ a.status }} · {{ a.source || 'unknown' }}\n @if (a.failureCode) { — {{ a.failureCode }} }\n · {{ a.createdAt | date: 'MMM d, h:mm a' }}\n </div>\n } @empty {\n <div class=\"small text-secondary\">No attempts recorded.</div>\n }\n </div>\n } @else {\n <x-element-loader></x-element-loader>\n }\n </div>\n </x-webget-flyout>\n</ng-template>\n","import { NgModule } from '@angular/core';\nimport { RouterModule } from '@angular/router';\nimport { SharedModule } from '@thescaffold/ngx-core';\nimport { ElementsModule, WebgetsModule } from '@thescaffold/ngx-ui';\nimport { PaymentsComponent } from './payments.component';\n\n@NgModule({\n declarations: [PaymentsComponent],\n imports: [\n SharedModule,\n ElementsModule,\n WebgetsModule,\n RouterModule.forChild([{ path: '', component: PaymentsComponent }]),\n ],\n})\nexport class PaymentsModule {}\n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Y;wBACZ,cAAc;wBACd,aAAa;AACb,wBAAA,YAAY,CAAC,QAAQ,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,SAAS,EAAE,iBAAiB,EAAE,CAAC,CAAC;AACpE,qBAAA;AACF,iBAAA;;;;;"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Component, NgModule } from '@angular/core';
|
|
3
|
+
import * as i1$1 from '@angular/router';
|
|
4
|
+
import { RouterModule } from '@angular/router';
|
|
5
|
+
import { SharedModule } from '@thescaffold/ngx-core';
|
|
6
|
+
import { S as SimpleCrudDirective, J as JsonBuilderComponent } from './isaiahiroko-tilmart-ngx-apps-admin-json-builder.component-BFroIYk9.mjs';
|
|
7
|
+
import * as i2 from '@thescaffold/ngx-ui';
|
|
8
|
+
import { ElementsModule, WebgetsModule } from '@thescaffold/ngx-ui';
|
|
9
|
+
import * as i1 from '@angular/forms';
|
|
10
|
+
import * as i3 from '@angular/common';
|
|
11
|
+
|
|
12
|
+
// R1 production-readiness pass — PROMO-02. Was list-only; ops had no way
|
|
13
|
+
// to configure a discount rule. `conditions`/`actions` use the
|
|
14
|
+
// point-and-click builders (`_shared/rule-builders`), with an "Edit as JSON"
|
|
15
|
+
// switch for anything the builders don't cover.
|
|
16
|
+
class PromotionsComponent extends SimpleCrudDirective {
|
|
17
|
+
constructor() {
|
|
18
|
+
super(...arguments);
|
|
19
|
+
this.pageTitle = 'Promotions';
|
|
20
|
+
this.pageSubtitle = 'Automatic and coupon-gated discount rules evaluated at checkout.';
|
|
21
|
+
this.singularLabel = 'promotion';
|
|
22
|
+
this.pluralName = 'promotions';
|
|
23
|
+
this.dataSource = this.apiService.on('apps/commerce/promotion');
|
|
24
|
+
this.columns = [
|
|
25
|
+
{ key: 'name', value: 'Name' },
|
|
26
|
+
{ key: 'statusHtml', value: 'Status' },
|
|
27
|
+
{ key: 'priority', value: 'Priority' },
|
|
28
|
+
{ key: 'usageCount', value: 'Used' },
|
|
29
|
+
];
|
|
30
|
+
this.fields = [
|
|
31
|
+
{ key: 'name', label: 'Name', type: 'text', required: true },
|
|
32
|
+
{ key: 'description', label: 'Description', type: 'textarea' },
|
|
33
|
+
{
|
|
34
|
+
key: 'status',
|
|
35
|
+
label: 'Status',
|
|
36
|
+
type: 'select',
|
|
37
|
+
options: [
|
|
38
|
+
{ value: 'draft', label: 'Draft' },
|
|
39
|
+
{ value: 'active', label: 'Active' },
|
|
40
|
+
{ value: 'paused', label: 'Paused' },
|
|
41
|
+
{ value: 'expired', label: 'Expired' },
|
|
42
|
+
],
|
|
43
|
+
},
|
|
44
|
+
{ key: 'priority', label: 'Priority (lower runs first)', type: 'number' },
|
|
45
|
+
{ key: 'stackable', label: 'Stackable with other promotions', type: 'boolean' },
|
|
46
|
+
{ key: 'requiresCoupon', label: 'Requires a coupon code', type: 'boolean' },
|
|
47
|
+
{ key: 'startsAt', label: 'Starts at', type: 'date' },
|
|
48
|
+
{ key: 'endsAt', label: 'Ends at', type: 'date' },
|
|
49
|
+
{ key: 'conditions', label: 'When it applies', type: 'builder', builder: 'conditions' },
|
|
50
|
+
{ key: 'actions', label: 'What it does', type: 'builder', builder: 'actions' },
|
|
51
|
+
];
|
|
52
|
+
}
|
|
53
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: PromotionsComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
54
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.16", type: PromotionsComponent, isStandalone: false, selector: "x-promotions", usesInheritance: true, ngImport: i0, template: "<div class=\"x-page-head\">\n <div class=\"x-page-title\">{{ pageTitle }}</div>\n <div class=\"x-page-subtitle\">{{ pageSubtitle }}</div>\n</div>\n\n@if (!editing) {\n <div class=\"x-scrud-toolbar\">\n <button type=\"button\" class=\"x-scrud-btn x-scrud-btn-primary\" (click)=\"startCreate()\">+ New {{ singularLabel }}</button>\n </div>\n\n @if (list$ | async; as list) {\n <x-webget-collection [data]=\"list\"></x-webget-collection>\n } @else {\n <x-element-loader></x-element-loader>\n }\n} @else if (draft) {\n <div class=\"x-scrud-editor\">\n <div class=\"x-scrud-editor-head\">\n <div class=\"x-scrud-editor-title\">{{ draft['id'] ? 'Edit' : 'New' }} {{ singularLabel }}</div>\n <div class=\"x-scrud-editor-actions\">\n @if (draft['id'] && !hideDelete) {\n <button type=\"button\" class=\"x-scrud-btn x-scrud-danger\" (click)=\"remove(draft); cancelEdit()\">Delete</button>\n }\n <button type=\"button\" class=\"x-scrud-btn\" (click)=\"cancelEdit()\">Close</button>\n <button type=\"button\" class=\"x-scrud-btn x-scrud-btn-primary\" [disabled]=\"saving\" (click)=\"save()\">\n {{ saving ? 'Saving\u2026' : 'Save' }}\n </button>\n </div>\n </div>\n\n <div class=\"x-scrud-grid\">\n @for (f of fields; track f.key) {\n @if (f.type === 'builder') {\n <!-- a div, not a label: a label would forward every click inside the\n builder to its first checkbox -->\n <div class=\"x-scrud-f x-scrud-f-wide\" [attr.data-testid]=\"'field-' + f.key\">\n <span>{{ f.label }}</span>\n <x-json-builder [kind]=\"f.builder!\" [(value)]=\"draft[f.key]\"></x-json-builder>\n </div>\n } @else {\n <label class=\"x-scrud-f\" [class.x-scrud-f-wide]=\"f.type === 'textarea' || f.type === 'json'\">\n {{ f.label }}\n @if (f.required) {\n <span class=\"x-scrud-required\">*</span>\n }\n @switch (f.type) {\n @case ('boolean') {\n <input type=\"checkbox\" [(ngModel)]=\"draft[f.key]\" />\n }\n @case ('select') {\n @if (f.allowCustom) {\n <select [ngModel]=\"selectValue(f)\" (ngModelChange)=\"onSelect(f, $event)\" [attr.data-testid]=\"'select-' + f.key\">\n <option value=\"\">\u2014 choose \u2014</option>\n @for (opt of optionsFor(f); track opt.value) {\n <option [value]=\"opt.value\">{{ opt.label }}</option>\n }\n <option [value]=\"customOption\">Other\u2026</option>\n </select>\n @if (selectValue(f) === customOption) {\n <input type=\"text\" [(ngModel)]=\"draft[f.key]\" [placeholder]=\"f.placeholder || 'Type a name'\" [attr.data-testid]=\"'custom-' + f.key\" />\n }\n } @else {\n <select [(ngModel)]=\"draft[f.key]\">\n <option value=\"\">\u2014 choose \u2014</option>\n @for (opt of optionsFor(f); track opt.value) {\n <option [value]=\"opt.value\">{{ opt.label }}</option>\n }\n </select>\n }\n }\n @case ('textarea') {\n <textarea rows=\"3\" [(ngModel)]=\"draft[f.key]\" [placeholder]=\"f.placeholder || ''\"></textarea>\n }\n @case ('json') {\n <textarea rows=\"4\" class=\"x-scrud-json\" [(ngModel)]=\"draft[f.key]\" [placeholder]=\"f.placeholder || '{}'\"></textarea>\n }\n @case ('number') {\n <input type=\"number\" [(ngModel)]=\"draft[f.key]\" [placeholder]=\"f.placeholder || ''\" />\n }\n @case ('date') {\n <input type=\"datetime-local\" [(ngModel)]=\"draft[f.key]\" />\n }\n @default {\n <input type=\"text\" [(ngModel)]=\"draft[f.key]\" [placeholder]=\"f.placeholder || ''\" />\n }\n }\n </label>\n }\n }\n </div>\n </div>\n}\n", styles: [".x-page-head{margin-bottom:20px}.x-page-title{font-size:24px;font-weight:800;color:var(--color-text)}.x-page-subtitle{font-size:13.5px;color:var(--color-text-muted);margin-top:2px}.x-scrud-toolbar{display:flex;justify-content:flex-end;margin-bottom:14px}.x-scrud-btn{border:1px solid var(--color-border);background:transparent;border-radius:var(--radius-md);padding:6px 14px;font-size:12.5px;font-weight:700;cursor:pointer;color:var(--color-text-muted)}.x-scrud-btn:disabled{opacity:.5;cursor:default}.x-scrud-btn-primary{border-color:var(--color-accent);color:var(--color-accent-hover)}.x-scrud-danger{color:var(--color-danger, #c0362c)}.x-scrud-editor{background:var(--color-surface);border:1px solid var(--color-border);border-radius:var(--radius-lg);padding:16px;display:flex;flex-direction:column;gap:14px}.x-scrud-editor-head{display:flex;align-items:center;justify-content:space-between}.x-scrud-editor-title{font-size:16px;font-weight:800;color:var(--color-text)}.x-scrud-editor-actions{display:flex;gap:8px}.x-scrud-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:12px}.x-scrud-f{display:flex;flex-direction:column;gap:4px;font-size:11.5px;color:var(--color-text-muted);font-weight:700}.x-scrud-f-wide{grid-column:1/-1}.x-scrud-f input,.x-scrud-f select,.x-scrud-f textarea{border:1px solid var(--color-border);border-radius:var(--radius-md);padding:6px 10px;font-size:13px;background:var(--color-surface);color:var(--color-text);font-weight:400}.x-scrud-f input[type=checkbox]{width:18px;height:18px}.x-scrud-pwd{position:relative;display:flex}.x-scrud-pwd input{flex:1;padding-right:34px!important}.x-scrud-pwd-toggle{position:absolute;right:4px;top:50%;transform:translateY(-50%);border:none;background:transparent;color:var(--color-text-muted);padding:4px 6px;cursor:pointer}.x-scrud-pwd-toggle:hover{color:var(--color-text)}.x-scrud-json{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12px}.x-scrud-required{color:var(--color-danger, #c0362c)}\n"], dependencies: [{ kind: "directive", type: i1.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i1.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { kind: "directive", type: i1.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: JsonBuilderComponent, selector: "x-json-builder", inputs: ["kind", "value"], outputs: ["valueChange"] }, { kind: "component", type: i2.LoaderComponent, selector: "x-element-loader", inputs: ["data"] }, { kind: "component", type: i2.CollectionComponent, selector: "x-webget-collection", inputs: ["data"], outputs: ["search", "filter", "refresh", "select", "page", "show"] }, { kind: "pipe", type: i3.AsyncPipe, name: "async" }] }); }
|
|
55
|
+
}
|
|
56
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: PromotionsComponent, decorators: [{
|
|
57
|
+
type: Component,
|
|
58
|
+
args: [{ standalone: false, selector: 'x-promotions', template: "<div class=\"x-page-head\">\n <div class=\"x-page-title\">{{ pageTitle }}</div>\n <div class=\"x-page-subtitle\">{{ pageSubtitle }}</div>\n</div>\n\n@if (!editing) {\n <div class=\"x-scrud-toolbar\">\n <button type=\"button\" class=\"x-scrud-btn x-scrud-btn-primary\" (click)=\"startCreate()\">+ New {{ singularLabel }}</button>\n </div>\n\n @if (list$ | async; as list) {\n <x-webget-collection [data]=\"list\"></x-webget-collection>\n } @else {\n <x-element-loader></x-element-loader>\n }\n} @else if (draft) {\n <div class=\"x-scrud-editor\">\n <div class=\"x-scrud-editor-head\">\n <div class=\"x-scrud-editor-title\">{{ draft['id'] ? 'Edit' : 'New' }} {{ singularLabel }}</div>\n <div class=\"x-scrud-editor-actions\">\n @if (draft['id'] && !hideDelete) {\n <button type=\"button\" class=\"x-scrud-btn x-scrud-danger\" (click)=\"remove(draft); cancelEdit()\">Delete</button>\n }\n <button type=\"button\" class=\"x-scrud-btn\" (click)=\"cancelEdit()\">Close</button>\n <button type=\"button\" class=\"x-scrud-btn x-scrud-btn-primary\" [disabled]=\"saving\" (click)=\"save()\">\n {{ saving ? 'Saving\u2026' : 'Save' }}\n </button>\n </div>\n </div>\n\n <div class=\"x-scrud-grid\">\n @for (f of fields; track f.key) {\n @if (f.type === 'builder') {\n <!-- a div, not a label: a label would forward every click inside the\n builder to its first checkbox -->\n <div class=\"x-scrud-f x-scrud-f-wide\" [attr.data-testid]=\"'field-' + f.key\">\n <span>{{ f.label }}</span>\n <x-json-builder [kind]=\"f.builder!\" [(value)]=\"draft[f.key]\"></x-json-builder>\n </div>\n } @else {\n <label class=\"x-scrud-f\" [class.x-scrud-f-wide]=\"f.type === 'textarea' || f.type === 'json'\">\n {{ f.label }}\n @if (f.required) {\n <span class=\"x-scrud-required\">*</span>\n }\n @switch (f.type) {\n @case ('boolean') {\n <input type=\"checkbox\" [(ngModel)]=\"draft[f.key]\" />\n }\n @case ('select') {\n @if (f.allowCustom) {\n <select [ngModel]=\"selectValue(f)\" (ngModelChange)=\"onSelect(f, $event)\" [attr.data-testid]=\"'select-' + f.key\">\n <option value=\"\">\u2014 choose \u2014</option>\n @for (opt of optionsFor(f); track opt.value) {\n <option [value]=\"opt.value\">{{ opt.label }}</option>\n }\n <option [value]=\"customOption\">Other\u2026</option>\n </select>\n @if (selectValue(f) === customOption) {\n <input type=\"text\" [(ngModel)]=\"draft[f.key]\" [placeholder]=\"f.placeholder || 'Type a name'\" [attr.data-testid]=\"'custom-' + f.key\" />\n }\n } @else {\n <select [(ngModel)]=\"draft[f.key]\">\n <option value=\"\">\u2014 choose \u2014</option>\n @for (opt of optionsFor(f); track opt.value) {\n <option [value]=\"opt.value\">{{ opt.label }}</option>\n }\n </select>\n }\n }\n @case ('textarea') {\n <textarea rows=\"3\" [(ngModel)]=\"draft[f.key]\" [placeholder]=\"f.placeholder || ''\"></textarea>\n }\n @case ('json') {\n <textarea rows=\"4\" class=\"x-scrud-json\" [(ngModel)]=\"draft[f.key]\" [placeholder]=\"f.placeholder || '{}'\"></textarea>\n }\n @case ('number') {\n <input type=\"number\" [(ngModel)]=\"draft[f.key]\" [placeholder]=\"f.placeholder || ''\" />\n }\n @case ('date') {\n <input type=\"datetime-local\" [(ngModel)]=\"draft[f.key]\" />\n }\n @default {\n <input type=\"text\" [(ngModel)]=\"draft[f.key]\" [placeholder]=\"f.placeholder || ''\" />\n }\n }\n </label>\n }\n }\n </div>\n </div>\n}\n", styles: [".x-page-head{margin-bottom:20px}.x-page-title{font-size:24px;font-weight:800;color:var(--color-text)}.x-page-subtitle{font-size:13.5px;color:var(--color-text-muted);margin-top:2px}.x-scrud-toolbar{display:flex;justify-content:flex-end;margin-bottom:14px}.x-scrud-btn{border:1px solid var(--color-border);background:transparent;border-radius:var(--radius-md);padding:6px 14px;font-size:12.5px;font-weight:700;cursor:pointer;color:var(--color-text-muted)}.x-scrud-btn:disabled{opacity:.5;cursor:default}.x-scrud-btn-primary{border-color:var(--color-accent);color:var(--color-accent-hover)}.x-scrud-danger{color:var(--color-danger, #c0362c)}.x-scrud-editor{background:var(--color-surface);border:1px solid var(--color-border);border-radius:var(--radius-lg);padding:16px;display:flex;flex-direction:column;gap:14px}.x-scrud-editor-head{display:flex;align-items:center;justify-content:space-between}.x-scrud-editor-title{font-size:16px;font-weight:800;color:var(--color-text)}.x-scrud-editor-actions{display:flex;gap:8px}.x-scrud-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:12px}.x-scrud-f{display:flex;flex-direction:column;gap:4px;font-size:11.5px;color:var(--color-text-muted);font-weight:700}.x-scrud-f-wide{grid-column:1/-1}.x-scrud-f input,.x-scrud-f select,.x-scrud-f textarea{border:1px solid var(--color-border);border-radius:var(--radius-md);padding:6px 10px;font-size:13px;background:var(--color-surface);color:var(--color-text);font-weight:400}.x-scrud-f input[type=checkbox]{width:18px;height:18px}.x-scrud-pwd{position:relative;display:flex}.x-scrud-pwd input{flex:1;padding-right:34px!important}.x-scrud-pwd-toggle{position:absolute;right:4px;top:50%;transform:translateY(-50%);border:none;background:transparent;color:var(--color-text-muted);padding:4px 6px;cursor:pointer}.x-scrud-pwd-toggle:hover{color:var(--color-text)}.x-scrud-json{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12px}.x-scrud-required{color:var(--color-danger, #c0362c)}\n"] }]
|
|
59
|
+
}] });
|
|
60
|
+
|
|
61
|
+
class PromotionsModule {
|
|
62
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: PromotionsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
63
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.2.16", ngImport: i0, type: PromotionsModule, declarations: [PromotionsComponent], imports: [SharedModule,
|
|
64
|
+
JsonBuilderComponent,
|
|
65
|
+
ElementsModule,
|
|
66
|
+
WebgetsModule, i1$1.RouterModule] }); }
|
|
67
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: PromotionsModule, imports: [SharedModule,
|
|
68
|
+
JsonBuilderComponent,
|
|
69
|
+
ElementsModule,
|
|
70
|
+
WebgetsModule,
|
|
71
|
+
RouterModule.forChild([{ path: '', component: PromotionsComponent }])] }); }
|
|
72
|
+
}
|
|
73
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: PromotionsModule, decorators: [{
|
|
74
|
+
type: NgModule,
|
|
75
|
+
args: [{
|
|
76
|
+
declarations: [PromotionsComponent],
|
|
77
|
+
imports: [
|
|
78
|
+
SharedModule,
|
|
79
|
+
JsonBuilderComponent,
|
|
80
|
+
ElementsModule,
|
|
81
|
+
WebgetsModule,
|
|
82
|
+
RouterModule.forChild([{ path: '', component: PromotionsComponent }]),
|
|
83
|
+
],
|
|
84
|
+
}]
|
|
85
|
+
}] });
|
|
86
|
+
|
|
87
|
+
export { PromotionsModule };
|
|
88
|
+
//# sourceMappingURL=isaiahiroko-tilmart-ngx-apps-admin-promotions.module-Dh7PTGG7.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isaiahiroko-tilmart-ngx-apps-admin-promotions.module-Dh7PTGG7.mjs","sources":["../../../projects/admin/src/lib/pages/promotions/promotions.component.ts","../../../projects/admin/src/lib/pages/_shared/simple-crud.component.html","../../../projects/admin/src/lib/pages/promotions/promotions.module.ts"],"sourcesContent":["import { Component } from '@angular/core';\nimport { CrudFieldSpec, SimpleCrudDirective } from '../_shared/simple-crud.base';\n\n// R1 production-readiness pass — PROMO-02. Was list-only; ops had no way\n// to configure a discount rule. `conditions`/`actions` use the\n// point-and-click builders (`_shared/rule-builders`), with an \"Edit as JSON\"\n// switch for anything the builders don't cover.\n@Component({\n standalone: false,\n selector: 'x-promotions',\n templateUrl: '../_shared/simple-crud.component.html',\n styleUrl: '../_shared/simple-crud.component.scss',\n})\nexport class PromotionsComponent extends SimpleCrudDirective {\n protected pageTitle = 'Promotions';\n protected pageSubtitle = 'Automatic and coupon-gated discount rules evaluated at checkout.';\n protected singularLabel = 'promotion';\n protected pluralName = 'promotions';\n protected dataSource = this.apiService.on('apps/commerce/promotion');\n\n protected columns = [\n { key: 'name', value: 'Name' },\n { key: 'statusHtml', value: 'Status' },\n { key: 'priority', value: 'Priority' },\n { key: 'usageCount', value: 'Used' },\n ];\n\n protected fields: CrudFieldSpec[] = [\n { key: 'name', label: 'Name', type: 'text', required: true },\n { key: 'description', label: 'Description', type: 'textarea' },\n {\n key: 'status',\n label: 'Status',\n type: 'select',\n options: [\n { value: 'draft', label: 'Draft' },\n { value: 'active', label: 'Active' },\n { value: 'paused', label: 'Paused' },\n { value: 'expired', label: 'Expired' },\n ],\n },\n { key: 'priority', label: 'Priority (lower runs first)', type: 'number' },\n { key: 'stackable', label: 'Stackable with other promotions', type: 'boolean' },\n { key: 'requiresCoupon', label: 'Requires a coupon code', type: 'boolean' },\n { key: 'startsAt', label: 'Starts at', type: 'date' },\n { key: 'endsAt', label: 'Ends at', type: 'date' },\n { key: 'conditions', label: 'When it applies', type: 'builder', builder: 'conditions' },\n { key: 'actions', label: 'What it does', type: 'builder', builder: 'actions' },\n ];\n}\n","<div class=\"x-page-head\">\n <div class=\"x-page-title\">{{ pageTitle }}</div>\n <div class=\"x-page-subtitle\">{{ pageSubtitle }}</div>\n</div>\n\n@if (!editing) {\n <div class=\"x-scrud-toolbar\">\n <button type=\"button\" class=\"x-scrud-btn x-scrud-btn-primary\" (click)=\"startCreate()\">+ New {{ singularLabel }}</button>\n </div>\n\n @if (list$ | async; as list) {\n <x-webget-collection [data]=\"list\"></x-webget-collection>\n } @else {\n <x-element-loader></x-element-loader>\n }\n} @else if (draft) {\n <div class=\"x-scrud-editor\">\n <div class=\"x-scrud-editor-head\">\n <div class=\"x-scrud-editor-title\">{{ draft['id'] ? 'Edit' : 'New' }} {{ singularLabel }}</div>\n <div class=\"x-scrud-editor-actions\">\n @if (draft['id'] && !hideDelete) {\n <button type=\"button\" class=\"x-scrud-btn x-scrud-danger\" (click)=\"remove(draft); cancelEdit()\">Delete</button>\n }\n <button type=\"button\" class=\"x-scrud-btn\" (click)=\"cancelEdit()\">Close</button>\n <button type=\"button\" class=\"x-scrud-btn x-scrud-btn-primary\" [disabled]=\"saving\" (click)=\"save()\">\n {{ saving ? 'Saving…' : 'Save' }}\n </button>\n </div>\n </div>\n\n <div class=\"x-scrud-grid\">\n @for (f of fields; track f.key) {\n @if (f.type === 'builder') {\n <!-- a div, not a label: a label would forward every click inside the\n builder to its first checkbox -->\n <div class=\"x-scrud-f x-scrud-f-wide\" [attr.data-testid]=\"'field-' + f.key\">\n <span>{{ f.label }}</span>\n <x-json-builder [kind]=\"f.builder!\" [(value)]=\"draft[f.key]\"></x-json-builder>\n </div>\n } @else {\n <label class=\"x-scrud-f\" [class.x-scrud-f-wide]=\"f.type === 'textarea' || f.type === 'json'\">\n {{ f.label }}\n @if (f.required) {\n <span class=\"x-scrud-required\">*</span>\n }\n @switch (f.type) {\n @case ('boolean') {\n <input type=\"checkbox\" [(ngModel)]=\"draft[f.key]\" />\n }\n @case ('select') {\n @if (f.allowCustom) {\n <select [ngModel]=\"selectValue(f)\" (ngModelChange)=\"onSelect(f, $event)\" [attr.data-testid]=\"'select-' + f.key\">\n <option value=\"\">— choose —</option>\n @for (opt of optionsFor(f); track opt.value) {\n <option [value]=\"opt.value\">{{ opt.label }}</option>\n }\n <option [value]=\"customOption\">Other…</option>\n </select>\n @if (selectValue(f) === customOption) {\n <input type=\"text\" [(ngModel)]=\"draft[f.key]\" [placeholder]=\"f.placeholder || 'Type a name'\" [attr.data-testid]=\"'custom-' + f.key\" />\n }\n } @else {\n <select [(ngModel)]=\"draft[f.key]\">\n <option value=\"\">— choose —</option>\n @for (opt of optionsFor(f); track opt.value) {\n <option [value]=\"opt.value\">{{ opt.label }}</option>\n }\n </select>\n }\n }\n @case ('textarea') {\n <textarea rows=\"3\" [(ngModel)]=\"draft[f.key]\" [placeholder]=\"f.placeholder || ''\"></textarea>\n }\n @case ('json') {\n <textarea rows=\"4\" class=\"x-scrud-json\" [(ngModel)]=\"draft[f.key]\" [placeholder]=\"f.placeholder || '{}'\"></textarea>\n }\n @case ('number') {\n <input type=\"number\" [(ngModel)]=\"draft[f.key]\" [placeholder]=\"f.placeholder || ''\" />\n }\n @case ('date') {\n <input type=\"datetime-local\" [(ngModel)]=\"draft[f.key]\" />\n }\n @default {\n <input type=\"text\" [(ngModel)]=\"draft[f.key]\" [placeholder]=\"f.placeholder || ''\" />\n }\n }\n </label>\n }\n }\n </div>\n </div>\n}\n","import { NgModule } from '@angular/core';\nimport { RouterModule } from '@angular/router';\nimport { SharedModule } from '@thescaffold/ngx-core';\nimport { JsonBuilderComponent } from '../_shared/rule-builders/json-builder.component';\nimport { ElementsModule, WebgetsModule } from '@thescaffold/ngx-ui';\nimport { PromotionsComponent } from './promotions.component';\n\n@NgModule({\n declarations: [PromotionsComponent],\n imports: [\n SharedModule,\n JsonBuilderComponent,\n ElementsModule,\n WebgetsModule,\n RouterModule.forChild([{ path: '', component: PromotionsComponent }]),\n ],\n})\nexport class PromotionsModule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;4FAG5D,gBAAgB,EAAA,UAAA,EAAA,CAAA;kBAV5B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACR,YAAY,EAAE,CAAC,mBAAmB,CAAC;AACnC,oBAAA,OAAO,EAAE;wBACP,YAAY;wBACZ,oBAAoB;wBACpB,cAAc;wBACd,aAAa;AACb,wBAAA,YAAY,CAAC,QAAQ,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,SAAS,EAAE,mBAAmB,EAAE,CAAC,CAAC;AACtE,qBAAA;AACF,iBAAA;;;;;"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Component, NgModule } from '@angular/core';
|
|
3
|
+
import * as i1$1 from '@angular/router';
|
|
4
|
+
import { RouterModule } from '@angular/router';
|
|
5
|
+
import { SharedModule } from '@thescaffold/ngx-core';
|
|
6
|
+
import * as i2 from '@thescaffold/ngx-ui';
|
|
7
|
+
import { ElementsModule, WebgetsModule } from '@thescaffold/ngx-ui';
|
|
8
|
+
import { S as SimpleCrudDirective, J as JsonBuilderComponent } from './isaiahiroko-tilmart-ngx-apps-admin-json-builder.component-BFroIYk9.mjs';
|
|
9
|
+
import * as i1 from '@angular/forms';
|
|
10
|
+
import * as i3 from '@angular/common';
|
|
11
|
+
|
|
12
|
+
// R1 production-readiness pass — CMS-06. Auto-minted on a slug change;
|
|
13
|
+
// was list-only otherwise, with no way for ops to add one manually to
|
|
14
|
+
// fix a stray 404.
|
|
15
|
+
class RedirectsComponent extends SimpleCrudDirective {
|
|
16
|
+
constructor() {
|
|
17
|
+
super(...arguments);
|
|
18
|
+
this.pageTitle = 'Redirects';
|
|
19
|
+
this.pageSubtitle = 'Stored 301/302 path redirects — auto-minted on slug changes (CMS-06), or add one by hand.';
|
|
20
|
+
this.singularLabel = 'redirect';
|
|
21
|
+
this.pluralName = 'redirects';
|
|
22
|
+
this.dataSource = this.apiService.on('apps/commerce/redirect');
|
|
23
|
+
this.columns = [
|
|
24
|
+
{ key: 'fromPath', value: 'From' },
|
|
25
|
+
{ key: 'toPath', value: 'To' },
|
|
26
|
+
{ key: 'statusCode', value: 'Code' },
|
|
27
|
+
{ key: 'hitCount', value: 'Hits' },
|
|
28
|
+
];
|
|
29
|
+
this.fields = [
|
|
30
|
+
{ key: 'fromPath', label: 'From path', type: 'text', required: true, placeholder: '/p/old-slug' },
|
|
31
|
+
{ key: 'toPath', label: 'To path', type: 'text', required: true, placeholder: '/p/new-slug' },
|
|
32
|
+
{
|
|
33
|
+
key: 'statusCode',
|
|
34
|
+
label: 'Status code',
|
|
35
|
+
type: 'select',
|
|
36
|
+
numericSelect: true,
|
|
37
|
+
options: [
|
|
38
|
+
{ value: '301', label: '301 — Permanent' },
|
|
39
|
+
{ value: '302', label: '302 — Temporary' },
|
|
40
|
+
],
|
|
41
|
+
},
|
|
42
|
+
{ key: 'reason', label: 'Reason', type: 'text' },
|
|
43
|
+
{ key: 'enabled', label: 'Enabled', type: 'boolean' },
|
|
44
|
+
];
|
|
45
|
+
}
|
|
46
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: RedirectsComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
47
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.16", type: RedirectsComponent, isStandalone: false, selector: "x-redirects", usesInheritance: true, ngImport: i0, template: "<div class=\"x-page-head\">\n <div class=\"x-page-title\">{{ pageTitle }}</div>\n <div class=\"x-page-subtitle\">{{ pageSubtitle }}</div>\n</div>\n\n@if (!editing) {\n <div class=\"x-scrud-toolbar\">\n <button type=\"button\" class=\"x-scrud-btn x-scrud-btn-primary\" (click)=\"startCreate()\">+ New {{ singularLabel }}</button>\n </div>\n\n @if (list$ | async; as list) {\n <x-webget-collection [data]=\"list\"></x-webget-collection>\n } @else {\n <x-element-loader></x-element-loader>\n }\n} @else if (draft) {\n <div class=\"x-scrud-editor\">\n <div class=\"x-scrud-editor-head\">\n <div class=\"x-scrud-editor-title\">{{ draft['id'] ? 'Edit' : 'New' }} {{ singularLabel }}</div>\n <div class=\"x-scrud-editor-actions\">\n @if (draft['id'] && !hideDelete) {\n <button type=\"button\" class=\"x-scrud-btn x-scrud-danger\" (click)=\"remove(draft); cancelEdit()\">Delete</button>\n }\n <button type=\"button\" class=\"x-scrud-btn\" (click)=\"cancelEdit()\">Close</button>\n <button type=\"button\" class=\"x-scrud-btn x-scrud-btn-primary\" [disabled]=\"saving\" (click)=\"save()\">\n {{ saving ? 'Saving\u2026' : 'Save' }}\n </button>\n </div>\n </div>\n\n <div class=\"x-scrud-grid\">\n @for (f of fields; track f.key) {\n @if (f.type === 'builder') {\n <!-- a div, not a label: a label would forward every click inside the\n builder to its first checkbox -->\n <div class=\"x-scrud-f x-scrud-f-wide\" [attr.data-testid]=\"'field-' + f.key\">\n <span>{{ f.label }}</span>\n <x-json-builder [kind]=\"f.builder!\" [(value)]=\"draft[f.key]\"></x-json-builder>\n </div>\n } @else {\n <label class=\"x-scrud-f\" [class.x-scrud-f-wide]=\"f.type === 'textarea' || f.type === 'json'\">\n {{ f.label }}\n @if (f.required) {\n <span class=\"x-scrud-required\">*</span>\n }\n @switch (f.type) {\n @case ('boolean') {\n <input type=\"checkbox\" [(ngModel)]=\"draft[f.key]\" />\n }\n @case ('select') {\n @if (f.allowCustom) {\n <select [ngModel]=\"selectValue(f)\" (ngModelChange)=\"onSelect(f, $event)\" [attr.data-testid]=\"'select-' + f.key\">\n <option value=\"\">\u2014 choose \u2014</option>\n @for (opt of optionsFor(f); track opt.value) {\n <option [value]=\"opt.value\">{{ opt.label }}</option>\n }\n <option [value]=\"customOption\">Other\u2026</option>\n </select>\n @if (selectValue(f) === customOption) {\n <input type=\"text\" [(ngModel)]=\"draft[f.key]\" [placeholder]=\"f.placeholder || 'Type a name'\" [attr.data-testid]=\"'custom-' + f.key\" />\n }\n } @else {\n <select [(ngModel)]=\"draft[f.key]\">\n <option value=\"\">\u2014 choose \u2014</option>\n @for (opt of optionsFor(f); track opt.value) {\n <option [value]=\"opt.value\">{{ opt.label }}</option>\n }\n </select>\n }\n }\n @case ('textarea') {\n <textarea rows=\"3\" [(ngModel)]=\"draft[f.key]\" [placeholder]=\"f.placeholder || ''\"></textarea>\n }\n @case ('json') {\n <textarea rows=\"4\" class=\"x-scrud-json\" [(ngModel)]=\"draft[f.key]\" [placeholder]=\"f.placeholder || '{}'\"></textarea>\n }\n @case ('number') {\n <input type=\"number\" [(ngModel)]=\"draft[f.key]\" [placeholder]=\"f.placeholder || ''\" />\n }\n @case ('date') {\n <input type=\"datetime-local\" [(ngModel)]=\"draft[f.key]\" />\n }\n @default {\n <input type=\"text\" [(ngModel)]=\"draft[f.key]\" [placeholder]=\"f.placeholder || ''\" />\n }\n }\n </label>\n }\n }\n </div>\n </div>\n}\n", styles: [".x-page-head{margin-bottom:20px}.x-page-title{font-size:24px;font-weight:800;color:var(--color-text)}.x-page-subtitle{font-size:13.5px;color:var(--color-text-muted);margin-top:2px}.x-scrud-toolbar{display:flex;justify-content:flex-end;margin-bottom:14px}.x-scrud-btn{border:1px solid var(--color-border);background:transparent;border-radius:var(--radius-md);padding:6px 14px;font-size:12.5px;font-weight:700;cursor:pointer;color:var(--color-text-muted)}.x-scrud-btn:disabled{opacity:.5;cursor:default}.x-scrud-btn-primary{border-color:var(--color-accent);color:var(--color-accent-hover)}.x-scrud-danger{color:var(--color-danger, #c0362c)}.x-scrud-editor{background:var(--color-surface);border:1px solid var(--color-border);border-radius:var(--radius-lg);padding:16px;display:flex;flex-direction:column;gap:14px}.x-scrud-editor-head{display:flex;align-items:center;justify-content:space-between}.x-scrud-editor-title{font-size:16px;font-weight:800;color:var(--color-text)}.x-scrud-editor-actions{display:flex;gap:8px}.x-scrud-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:12px}.x-scrud-f{display:flex;flex-direction:column;gap:4px;font-size:11.5px;color:var(--color-text-muted);font-weight:700}.x-scrud-f-wide{grid-column:1/-1}.x-scrud-f input,.x-scrud-f select,.x-scrud-f textarea{border:1px solid var(--color-border);border-radius:var(--radius-md);padding:6px 10px;font-size:13px;background:var(--color-surface);color:var(--color-text);font-weight:400}.x-scrud-f input[type=checkbox]{width:18px;height:18px}.x-scrud-pwd{position:relative;display:flex}.x-scrud-pwd input{flex:1;padding-right:34px!important}.x-scrud-pwd-toggle{position:absolute;right:4px;top:50%;transform:translateY(-50%);border:none;background:transparent;color:var(--color-text-muted);padding:4px 6px;cursor:pointer}.x-scrud-pwd-toggle:hover{color:var(--color-text)}.x-scrud-json{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12px}.x-scrud-required{color:var(--color-danger, #c0362c)}\n"], dependencies: [{ kind: "component", type: JsonBuilderComponent, selector: "x-json-builder", inputs: ["kind", "value"], outputs: ["valueChange"] }, { kind: "directive", type: i1.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i1.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { kind: "directive", type: i1.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i2.LoaderComponent, selector: "x-element-loader", inputs: ["data"] }, { kind: "component", type: i2.CollectionComponent, selector: "x-webget-collection", inputs: ["data"], outputs: ["search", "filter", "refresh", "select", "page", "show"] }, { kind: "pipe", type: i3.AsyncPipe, name: "async" }] }); }
|
|
48
|
+
}
|
|
49
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: RedirectsComponent, decorators: [{
|
|
50
|
+
type: Component,
|
|
51
|
+
args: [{ standalone: false, selector: 'x-redirects', template: "<div class=\"x-page-head\">\n <div class=\"x-page-title\">{{ pageTitle }}</div>\n <div class=\"x-page-subtitle\">{{ pageSubtitle }}</div>\n</div>\n\n@if (!editing) {\n <div class=\"x-scrud-toolbar\">\n <button type=\"button\" class=\"x-scrud-btn x-scrud-btn-primary\" (click)=\"startCreate()\">+ New {{ singularLabel }}</button>\n </div>\n\n @if (list$ | async; as list) {\n <x-webget-collection [data]=\"list\"></x-webget-collection>\n } @else {\n <x-element-loader></x-element-loader>\n }\n} @else if (draft) {\n <div class=\"x-scrud-editor\">\n <div class=\"x-scrud-editor-head\">\n <div class=\"x-scrud-editor-title\">{{ draft['id'] ? 'Edit' : 'New' }} {{ singularLabel }}</div>\n <div class=\"x-scrud-editor-actions\">\n @if (draft['id'] && !hideDelete) {\n <button type=\"button\" class=\"x-scrud-btn x-scrud-danger\" (click)=\"remove(draft); cancelEdit()\">Delete</button>\n }\n <button type=\"button\" class=\"x-scrud-btn\" (click)=\"cancelEdit()\">Close</button>\n <button type=\"button\" class=\"x-scrud-btn x-scrud-btn-primary\" [disabled]=\"saving\" (click)=\"save()\">\n {{ saving ? 'Saving\u2026' : 'Save' }}\n </button>\n </div>\n </div>\n\n <div class=\"x-scrud-grid\">\n @for (f of fields; track f.key) {\n @if (f.type === 'builder') {\n <!-- a div, not a label: a label would forward every click inside the\n builder to its first checkbox -->\n <div class=\"x-scrud-f x-scrud-f-wide\" [attr.data-testid]=\"'field-' + f.key\">\n <span>{{ f.label }}</span>\n <x-json-builder [kind]=\"f.builder!\" [(value)]=\"draft[f.key]\"></x-json-builder>\n </div>\n } @else {\n <label class=\"x-scrud-f\" [class.x-scrud-f-wide]=\"f.type === 'textarea' || f.type === 'json'\">\n {{ f.label }}\n @if (f.required) {\n <span class=\"x-scrud-required\">*</span>\n }\n @switch (f.type) {\n @case ('boolean') {\n <input type=\"checkbox\" [(ngModel)]=\"draft[f.key]\" />\n }\n @case ('select') {\n @if (f.allowCustom) {\n <select [ngModel]=\"selectValue(f)\" (ngModelChange)=\"onSelect(f, $event)\" [attr.data-testid]=\"'select-' + f.key\">\n <option value=\"\">\u2014 choose \u2014</option>\n @for (opt of optionsFor(f); track opt.value) {\n <option [value]=\"opt.value\">{{ opt.label }}</option>\n }\n <option [value]=\"customOption\">Other\u2026</option>\n </select>\n @if (selectValue(f) === customOption) {\n <input type=\"text\" [(ngModel)]=\"draft[f.key]\" [placeholder]=\"f.placeholder || 'Type a name'\" [attr.data-testid]=\"'custom-' + f.key\" />\n }\n } @else {\n <select [(ngModel)]=\"draft[f.key]\">\n <option value=\"\">\u2014 choose \u2014</option>\n @for (opt of optionsFor(f); track opt.value) {\n <option [value]=\"opt.value\">{{ opt.label }}</option>\n }\n </select>\n }\n }\n @case ('textarea') {\n <textarea rows=\"3\" [(ngModel)]=\"draft[f.key]\" [placeholder]=\"f.placeholder || ''\"></textarea>\n }\n @case ('json') {\n <textarea rows=\"4\" class=\"x-scrud-json\" [(ngModel)]=\"draft[f.key]\" [placeholder]=\"f.placeholder || '{}'\"></textarea>\n }\n @case ('number') {\n <input type=\"number\" [(ngModel)]=\"draft[f.key]\" [placeholder]=\"f.placeholder || ''\" />\n }\n @case ('date') {\n <input type=\"datetime-local\" [(ngModel)]=\"draft[f.key]\" />\n }\n @default {\n <input type=\"text\" [(ngModel)]=\"draft[f.key]\" [placeholder]=\"f.placeholder || ''\" />\n }\n }\n </label>\n }\n }\n </div>\n </div>\n}\n", styles: [".x-page-head{margin-bottom:20px}.x-page-title{font-size:24px;font-weight:800;color:var(--color-text)}.x-page-subtitle{font-size:13.5px;color:var(--color-text-muted);margin-top:2px}.x-scrud-toolbar{display:flex;justify-content:flex-end;margin-bottom:14px}.x-scrud-btn{border:1px solid var(--color-border);background:transparent;border-radius:var(--radius-md);padding:6px 14px;font-size:12.5px;font-weight:700;cursor:pointer;color:var(--color-text-muted)}.x-scrud-btn:disabled{opacity:.5;cursor:default}.x-scrud-btn-primary{border-color:var(--color-accent);color:var(--color-accent-hover)}.x-scrud-danger{color:var(--color-danger, #c0362c)}.x-scrud-editor{background:var(--color-surface);border:1px solid var(--color-border);border-radius:var(--radius-lg);padding:16px;display:flex;flex-direction:column;gap:14px}.x-scrud-editor-head{display:flex;align-items:center;justify-content:space-between}.x-scrud-editor-title{font-size:16px;font-weight:800;color:var(--color-text)}.x-scrud-editor-actions{display:flex;gap:8px}.x-scrud-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:12px}.x-scrud-f{display:flex;flex-direction:column;gap:4px;font-size:11.5px;color:var(--color-text-muted);font-weight:700}.x-scrud-f-wide{grid-column:1/-1}.x-scrud-f input,.x-scrud-f select,.x-scrud-f textarea{border:1px solid var(--color-border);border-radius:var(--radius-md);padding:6px 10px;font-size:13px;background:var(--color-surface);color:var(--color-text);font-weight:400}.x-scrud-f input[type=checkbox]{width:18px;height:18px}.x-scrud-pwd{position:relative;display:flex}.x-scrud-pwd input{flex:1;padding-right:34px!important}.x-scrud-pwd-toggle{position:absolute;right:4px;top:50%;transform:translateY(-50%);border:none;background:transparent;color:var(--color-text-muted);padding:4px 6px;cursor:pointer}.x-scrud-pwd-toggle:hover{color:var(--color-text)}.x-scrud-json{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12px}.x-scrud-required{color:var(--color-danger, #c0362c)}\n"] }]
|
|
52
|
+
}] });
|
|
53
|
+
|
|
54
|
+
class RedirectsModule {
|
|
55
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: RedirectsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
56
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.2.16", ngImport: i0, type: RedirectsModule, declarations: [RedirectsComponent], imports: [JsonBuilderComponent,
|
|
57
|
+
SharedModule,
|
|
58
|
+
ElementsModule,
|
|
59
|
+
WebgetsModule, i1$1.RouterModule] }); }
|
|
60
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: RedirectsModule, imports: [JsonBuilderComponent,
|
|
61
|
+
SharedModule,
|
|
62
|
+
ElementsModule,
|
|
63
|
+
WebgetsModule,
|
|
64
|
+
RouterModule.forChild([{ path: '', component: RedirectsComponent }])] }); }
|
|
65
|
+
}
|
|
66
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: RedirectsModule, decorators: [{
|
|
67
|
+
type: NgModule,
|
|
68
|
+
args: [{
|
|
69
|
+
declarations: [RedirectsComponent],
|
|
70
|
+
imports: [
|
|
71
|
+
JsonBuilderComponent,
|
|
72
|
+
SharedModule,
|
|
73
|
+
ElementsModule,
|
|
74
|
+
WebgetsModule,
|
|
75
|
+
RouterModule.forChild([{ path: '', component: RedirectsComponent }]),
|
|
76
|
+
],
|
|
77
|
+
}]
|
|
78
|
+
}] });
|
|
79
|
+
|
|
80
|
+
export { RedirectsModule };
|
|
81
|
+
//# sourceMappingURL=isaiahiroko-tilmart-ngx-apps-admin-redirects.module-B8gaByYE.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isaiahiroko-tilmart-ngx-apps-admin-redirects.module-B8gaByYE.mjs","sources":["../../../projects/admin/src/lib/pages/redirects/redirects.component.ts","../../../projects/admin/src/lib/pages/_shared/simple-crud.component.html","../../../projects/admin/src/lib/pages/redirects/redirects.module.ts"],"sourcesContent":["import { Component } from '@angular/core';\nimport { CrudFieldSpec, SimpleCrudDirective } from '../_shared/simple-crud.base';\n\n// R1 production-readiness pass — CMS-06. Auto-minted on a slug change;\n// was list-only otherwise, with no way for ops to add one manually to\n// fix a stray 404.\n@Component({\n standalone: false,\n selector: 'x-redirects',\n templateUrl: '../_shared/simple-crud.component.html',\n styleUrl: '../_shared/simple-crud.component.scss',\n})\nexport class RedirectsComponent extends SimpleCrudDirective {\n protected pageTitle = 'Redirects';\n protected pageSubtitle = 'Stored 301/302 path redirects — auto-minted on slug changes (CMS-06), or add one by hand.';\n protected singularLabel = 'redirect';\n protected pluralName = 'redirects';\n protected dataSource = this.apiService.on('apps/commerce/redirect');\n\n protected columns = [\n { key: 'fromPath', value: 'From' },\n { key: 'toPath', value: 'To' },\n { key: 'statusCode', value: 'Code' },\n { key: 'hitCount', value: 'Hits' },\n ];\n\n protected fields: CrudFieldSpec[] = [\n { key: 'fromPath', label: 'From path', type: 'text', required: true, placeholder: '/p/old-slug' },\n { key: 'toPath', label: 'To path', type: 'text', required: true, placeholder: '/p/new-slug' },\n {\n key: 'statusCode',\n label: 'Status code',\n type: 'select',\n numericSelect: true,\n options: [\n { value: '301', label: '301 — Permanent' },\n { value: '302', label: '302 — Temporary' },\n ],\n },\n { key: 'reason', label: 'Reason', type: 'text' },\n { key: 'enabled', label: 'Enabled', type: 'boolean' },\n ];\n}\n","<div class=\"x-page-head\">\n <div class=\"x-page-title\">{{ pageTitle }}</div>\n <div class=\"x-page-subtitle\">{{ pageSubtitle }}</div>\n</div>\n\n@if (!editing) {\n <div class=\"x-scrud-toolbar\">\n <button type=\"button\" class=\"x-scrud-btn x-scrud-btn-primary\" (click)=\"startCreate()\">+ New {{ singularLabel }}</button>\n </div>\n\n @if (list$ | async; as list) {\n <x-webget-collection [data]=\"list\"></x-webget-collection>\n } @else {\n <x-element-loader></x-element-loader>\n }\n} @else if (draft) {\n <div class=\"x-scrud-editor\">\n <div class=\"x-scrud-editor-head\">\n <div class=\"x-scrud-editor-title\">{{ draft['id'] ? 'Edit' : 'New' }} {{ singularLabel }}</div>\n <div class=\"x-scrud-editor-actions\">\n @if (draft['id'] && !hideDelete) {\n <button type=\"button\" class=\"x-scrud-btn x-scrud-danger\" (click)=\"remove(draft); cancelEdit()\">Delete</button>\n }\n <button type=\"button\" class=\"x-scrud-btn\" (click)=\"cancelEdit()\">Close</button>\n <button type=\"button\" class=\"x-scrud-btn x-scrud-btn-primary\" [disabled]=\"saving\" (click)=\"save()\">\n {{ saving ? 'Saving…' : 'Save' }}\n </button>\n </div>\n </div>\n\n <div class=\"x-scrud-grid\">\n @for (f of fields; track f.key) {\n @if (f.type === 'builder') {\n <!-- a div, not a label: a label would forward every click inside the\n builder to its first checkbox -->\n <div class=\"x-scrud-f x-scrud-f-wide\" [attr.data-testid]=\"'field-' + f.key\">\n <span>{{ f.label }}</span>\n <x-json-builder [kind]=\"f.builder!\" [(value)]=\"draft[f.key]\"></x-json-builder>\n </div>\n } @else {\n <label class=\"x-scrud-f\" [class.x-scrud-f-wide]=\"f.type === 'textarea' || f.type === 'json'\">\n {{ f.label }}\n @if (f.required) {\n <span class=\"x-scrud-required\">*</span>\n }\n @switch (f.type) {\n @case ('boolean') {\n <input type=\"checkbox\" [(ngModel)]=\"draft[f.key]\" />\n }\n @case ('select') {\n @if (f.allowCustom) {\n <select [ngModel]=\"selectValue(f)\" (ngModelChange)=\"onSelect(f, $event)\" [attr.data-testid]=\"'select-' + f.key\">\n <option value=\"\">— choose —</option>\n @for (opt of optionsFor(f); track opt.value) {\n <option [value]=\"opt.value\">{{ opt.label }}</option>\n }\n <option [value]=\"customOption\">Other…</option>\n </select>\n @if (selectValue(f) === customOption) {\n <input type=\"text\" [(ngModel)]=\"draft[f.key]\" [placeholder]=\"f.placeholder || 'Type a name'\" [attr.data-testid]=\"'custom-' + f.key\" />\n }\n } @else {\n <select [(ngModel)]=\"draft[f.key]\">\n <option value=\"\">— choose —</option>\n @for (opt of optionsFor(f); track opt.value) {\n <option [value]=\"opt.value\">{{ opt.label }}</option>\n }\n </select>\n }\n }\n @case ('textarea') {\n <textarea rows=\"3\" [(ngModel)]=\"draft[f.key]\" [placeholder]=\"f.placeholder || ''\"></textarea>\n }\n @case ('json') {\n <textarea rows=\"4\" class=\"x-scrud-json\" [(ngModel)]=\"draft[f.key]\" [placeholder]=\"f.placeholder || '{}'\"></textarea>\n }\n @case ('number') {\n <input type=\"number\" [(ngModel)]=\"draft[f.key]\" [placeholder]=\"f.placeholder || ''\" />\n }\n @case ('date') {\n <input type=\"datetime-local\" [(ngModel)]=\"draft[f.key]\" />\n }\n @default {\n <input type=\"text\" [(ngModel)]=\"draft[f.key]\" [placeholder]=\"f.placeholder || ''\" />\n }\n }\n </label>\n }\n }\n </div>\n </div>\n}\n","import { NgModule } from '@angular/core';\nimport { RouterModule } from '@angular/router';\nimport { SharedModule } from '@thescaffold/ngx-core';\nimport { ElementsModule, WebgetsModule } from '@thescaffold/ngx-ui';\nimport { RedirectsComponent } from './redirects.component';\nimport { JsonBuilderComponent } from '../_shared/rule-builders/json-builder.component';\n\n@NgModule({\n declarations: [RedirectsComponent],\n imports: [\n JsonBuilderComponent,\n SharedModule,\n ElementsModule,\n WebgetsModule,\n RouterModule.forChild([{ path: '', component: RedirectsComponent }]),\n ],\n})\nexport class RedirectsModule {}\n"],"names":["i1.JsonBuilderComponent","i2","i3","i4","i1"],"mappings":";;;;;;;;;;;AAGA;AACA;AACA;AAOM,MAAO,kBAAmB,SAAQ,mBAAmB,CAAA;AAN3D,IAAA,WAAA,GAAA;;QAOY,IAAA,CAAA,SAAS,GAAG,WAAW;QACvB,IAAA,CAAA,YAAY,GAAG,2FAA2F;QAC1G,IAAA,CAAA,aAAa,GAAG,UAAU;QAC1B,IAAA,CAAA,UAAU,GAAG,WAAW;QACxB,IAAA,CAAA,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,EAAE,CA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