@isaiahiroko/tilmart-ngx-apps-admin 0.2.0 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. package/fesm2022/{isaiahiroko-tilmart-ngx-apps-admin-articles.module-OeLRnPwN.mjs → isaiahiroko-tilmart-ngx-apps-admin-articles.module-Cpx9BZcg.mjs} +5 -5
  2. package/fesm2022/{isaiahiroko-tilmart-ngx-apps-admin-articles.module-OeLRnPwN.mjs.map → isaiahiroko-tilmart-ngx-apps-admin-articles.module-Cpx9BZcg.mjs.map} +1 -1
  3. package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-attribute-templates.module-CwQnW1cH.mjs +239 -0
  4. package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-attribute-templates.module-CwQnW1cH.mjs.map +1 -0
  5. package/fesm2022/{isaiahiroko-tilmart-ngx-apps-admin-audit.module-C9gvw8X2.mjs → isaiahiroko-tilmart-ngx-apps-admin-audit.module-D5YaCThD.mjs} +6 -6
  6. package/fesm2022/{isaiahiroko-tilmart-ngx-apps-admin-audit.module-C9gvw8X2.mjs.map → isaiahiroko-tilmart-ngx-apps-admin-audit.module-D5YaCThD.mjs.map} +1 -1
  7. package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-banners.module-KSapnx6Y.mjs +76 -0
  8. package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-banners.module-KSapnx6Y.mjs.map +1 -0
  9. package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-brands.module-7I0ni-tQ.mjs +70 -0
  10. package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-brands.module-7I0ni-tQ.mjs.map +1 -0
  11. package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-bulk-upload.module-BGTbsYUP.mjs +370 -0
  12. package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-bulk-upload.module-BGTbsYUP.mjs.map +1 -0
  13. package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-catalog.module-BwjfFXDU.mjs +562 -0
  14. package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-catalog.module-BwjfFXDU.mjs.map +1 -0
  15. package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-categories.module-OTUfenf0.mjs +94 -0
  16. package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-categories.module-OTUfenf0.mjs.map +1 -0
  17. package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-claims.module-Dk9mz7Wj.mjs +137 -0
  18. package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-claims.module-Dk9mz7Wj.mjs.map +1 -0
  19. package/fesm2022/{isaiahiroko-tilmart-ngx-apps-admin-compatibility-rules.module-xN-JUWwp.mjs → isaiahiroko-tilmart-ngx-apps-admin-compatibility-rules.module-JiFnNJj_.mjs} +6 -6
  20. package/fesm2022/{isaiahiroko-tilmart-ngx-apps-admin-compatibility-rules.module-xN-JUWwp.mjs.map → isaiahiroko-tilmart-ngx-apps-admin-compatibility-rules.module-JiFnNJj_.mjs.map} +1 -1
  21. package/fesm2022/{isaiahiroko-tilmart-ngx-apps-admin-content.module-DLdKAUqc.mjs → isaiahiroko-tilmart-ngx-apps-admin-content.module-Bx6Zj0WX.mjs} +5 -5
  22. package/fesm2022/{isaiahiroko-tilmart-ngx-apps-admin-content.module-DLdKAUqc.mjs.map → isaiahiroko-tilmart-ngx-apps-admin-content.module-Bx6Zj0WX.mjs.map} +1 -1
  23. package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-coupons.module-CoRh6Hxq.mjs +85 -0
  24. package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-coupons.module-CoRh6Hxq.mjs.map +1 -0
  25. package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-customers.module-CslGiOdq.mjs +123 -0
  26. package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-customers.module-CslGiOdq.mjs.map +1 -0
  27. package/fesm2022/{isaiahiroko-tilmart-ngx-apps-admin-data-quality.module-Bfgh3zE5.mjs → isaiahiroko-tilmart-ngx-apps-admin-data-quality.module-CvFmMoJe.mjs} +6 -6
  28. package/fesm2022/{isaiahiroko-tilmart-ngx-apps-admin-data-quality.module-Bfgh3zE5.mjs.map → isaiahiroko-tilmart-ngx-apps-admin-data-quality.module-CvFmMoJe.mjs.map} +1 -1
  29. package/fesm2022/{isaiahiroko-tilmart-ngx-apps-admin-data-requests.module-C6tPNlup.mjs → isaiahiroko-tilmart-ngx-apps-admin-data-requests.module-CuZwNVPO.mjs} +6 -6
  30. package/fesm2022/{isaiahiroko-tilmart-ngx-apps-admin-data-requests.module-C6tPNlup.mjs.map → isaiahiroko-tilmart-ngx-apps-admin-data-requests.module-CuZwNVPO.mjs.map} +1 -1
  31. package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-flash-sales.module-BPRnC17l.mjs +83 -0
  32. package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-flash-sales.module-BPRnC17l.mjs.map +1 -0
  33. package/fesm2022/{isaiahiroko-tilmart-ngx-apps-admin-homepage.module-BZ3UmxE3.mjs → isaiahiroko-tilmart-ngx-apps-admin-homepage.module-vtAoIwSu.mjs} +5 -5
  34. package/fesm2022/{isaiahiroko-tilmart-ngx-apps-admin-homepage.module-BZ3UmxE3.mjs.map → isaiahiroko-tilmart-ngx-apps-admin-homepage.module-vtAoIwSu.mjs.map} +1 -1
  35. package/fesm2022/{isaiahiroko-tilmart-ngx-apps-admin-inbox.module-BZDTa1L-.mjs → isaiahiroko-tilmart-ngx-apps-admin-inbox.module-CRkfjWQT.mjs} +6 -6
  36. package/fesm2022/{isaiahiroko-tilmart-ngx-apps-admin-inbox.module-BZDTa1L-.mjs.map → isaiahiroko-tilmart-ngx-apps-admin-inbox.module-CRkfjWQT.mjs.map} +1 -1
  37. package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-list-page.base-Cl7JZ-Tp.mjs +66 -0
  38. package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-list-page.base-Cl7JZ-Tp.mjs.map +1 -0
  39. package/fesm2022/{isaiahiroko-tilmart-ngx-apps-admin-macros.module-BO4bdER2.mjs → isaiahiroko-tilmart-ngx-apps-admin-macros.module-CElxL9W4.mjs} +5 -5
  40. package/fesm2022/{isaiahiroko-tilmart-ngx-apps-admin-macros.module-BO4bdER2.mjs.map → isaiahiroko-tilmart-ngx-apps-admin-macros.module-CElxL9W4.mjs.map} +1 -1
  41. package/fesm2022/{isaiahiroko-tilmart-ngx-apps-admin-moderation.module-CZOCrias.mjs → isaiahiroko-tilmart-ngx-apps-admin-moderation.module-PGmFX7nk.mjs} +6 -6
  42. package/fesm2022/{isaiahiroko-tilmart-ngx-apps-admin-moderation.module-CZOCrias.mjs.map → isaiahiroko-tilmart-ngx-apps-admin-moderation.module-PGmFX7nk.mjs.map} +1 -1
  43. package/fesm2022/{isaiahiroko-tilmart-ngx-apps-admin-navigation.module-DoKzzRgn.mjs → isaiahiroko-tilmart-ngx-apps-admin-navigation.module-De1Cvqqa.mjs} +6 -6
  44. package/fesm2022/{isaiahiroko-tilmart-ngx-apps-admin-navigation.module-DoKzzRgn.mjs.map → isaiahiroko-tilmart-ngx-apps-admin-navigation.module-De1Cvqqa.mjs.map} +1 -1
  45. package/fesm2022/{isaiahiroko-tilmart-ngx-apps-admin-order-board.module-DIOjhptn.mjs → isaiahiroko-tilmart-ngx-apps-admin-order-board.module-CmLNiEEP.mjs} +4 -4
  46. package/fesm2022/{isaiahiroko-tilmart-ngx-apps-admin-order-board.module-DIOjhptn.mjs.map → isaiahiroko-tilmart-ngx-apps-admin-order-board.module-CmLNiEEP.mjs.map} +1 -1
  47. package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-orders.module-vldWwcAr.mjs +190 -0
  48. package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-orders.module-vldWwcAr.mjs.map +1 -0
  49. package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-payments.module-DstLDYM7.mjs +114 -0
  50. package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-payments.module-DstLDYM7.mjs.map +1 -0
  51. package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-promotions.module-DG03OY1q.mjs +94 -0
  52. package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-promotions.module-DG03OY1q.mjs.map +1 -0
  53. package/fesm2022/{isaiahiroko-tilmart-ngx-apps-admin-queues.module-K-zYYVFy.mjs → isaiahiroko-tilmart-ngx-apps-admin-queues.module-D7iLwX0A.mjs} +6 -6
  54. package/fesm2022/{isaiahiroko-tilmart-ngx-apps-admin-queues.module-K-zYYVFy.mjs.map → isaiahiroko-tilmart-ngx-apps-admin-queues.module-D7iLwX0A.mjs.map} +1 -1
  55. package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-redirects.module-oQw5Xo5T.mjs +78 -0
  56. package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-redirects.module-oQw5Xo5T.mjs.map +1 -0
  57. package/fesm2022/{isaiahiroko-tilmart-ngx-apps-admin-referrals.module-QLNhuh7q.mjs → isaiahiroko-tilmart-ngx-apps-admin-referrals.module-BIAY4L_u.mjs} +9 -34
  58. package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-referrals.module-BIAY4L_u.mjs.map +1 -0
  59. package/fesm2022/{isaiahiroko-tilmart-ngx-apps-admin-reports.module-DBZov0We.mjs → isaiahiroko-tilmart-ngx-apps-admin-reports.module-DORiIVLQ.mjs} +5 -5
  60. package/fesm2022/{isaiahiroko-tilmart-ngx-apps-admin-reports.module-DBZov0We.mjs.map → isaiahiroko-tilmart-ngx-apps-admin-reports.module-DORiIVLQ.mjs.map} +1 -1
  61. package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-returns.module-C9Iu9CX6.mjs +163 -0
  62. package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-returns.module-C9Iu9CX6.mjs.map +1 -0
  63. package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-routes.module-CGBBHwId.mjs +81 -0
  64. package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-routes.module-CGBBHwId.mjs.map +1 -0
  65. package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-settings.module-Cz6xPNwB.mjs +318 -0
  66. package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-settings.module-Cz6xPNwB.mjs.map +1 -0
  67. package/fesm2022/{isaiahiroko-tilmart-ngx-apps-admin-shipments.module-XuaOKr8v.mjs → isaiahiroko-tilmart-ngx-apps-admin-shipments.module-Cs5CLamm.mjs} +13 -32
  68. package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-shipments.module-Cs5CLamm.mjs.map +1 -0
  69. package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-simple-crud.base-C8SPw14H.mjs +140 -0
  70. package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-simple-crud.base-C8SPw14H.mjs.map +1 -0
  71. package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-stock.module-Bt9W1oGR.mjs +102 -0
  72. package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-stock.module-Bt9W1oGR.mjs.map +1 -0
  73. package/fesm2022/{isaiahiroko-tilmart-ngx-apps-admin-trace.module-Pwr-82Rc.mjs → isaiahiroko-tilmart-ngx-apps-admin-trace.module-9sRlGZCC.mjs} +6 -6
  74. package/fesm2022/{isaiahiroko-tilmart-ngx-apps-admin-trace.module-Pwr-82Rc.mjs.map → isaiahiroko-tilmart-ngx-apps-admin-trace.module-9sRlGZCC.mjs.map} +1 -1
  75. package/fesm2022/{isaiahiroko-tilmart-ngx-apps-admin-users.module-Bx_7fI2g.mjs → isaiahiroko-tilmart-ngx-apps-admin-users.module-C31RJJJ_.mjs} +9 -34
  76. package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-users.module-C31RJJJ_.mjs.map +1 -0
  77. package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin.mjs +104 -72
  78. package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin.mjs.map +1 -1
  79. package/package.json +1 -1
  80. package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-baskets.module-_lHPl1dT.mjs +0 -294
  81. package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-baskets.module-_lHPl1dT.mjs.map +0 -1
  82. package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-catalog.module-Bvx2tVOi.mjs +0 -224
  83. package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-catalog.module-Bvx2tVOi.mjs.map +0 -1
  84. package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-claims.module-Ccsd8Yx3.mjs +0 -106
  85. package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-claims.module-Ccsd8Yx3.mjs.map +0 -1
  86. package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-coupons.module-CQNCSlsd.mjs +0 -106
  87. package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-coupons.module-CQNCSlsd.mjs.map +0 -1
  88. package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-customers.module-12XdV9zo.mjs +0 -106
  89. package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-customers.module-12XdV9zo.mjs.map +0 -1
  90. package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-orders.module-Ddw49QW0.mjs +0 -185
  91. package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-orders.module-Ddw49QW0.mjs.map +0 -1
  92. package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-payments.module-BhqAtTZs.mjs +0 -106
  93. package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-payments.module-BhqAtTZs.mjs.map +0 -1
  94. package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-procurement.module-qXW-g0pf.mjs +0 -274
  95. package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-procurement.module-qXW-g0pf.mjs.map +0 -1
  96. package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-promotions.module-DG9uTDqX.mjs +0 -106
  97. package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-promotions.module-DG9uTDqX.mjs.map +0 -1
  98. package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-redirects.module-Hm2dO_bC.mjs +0 -106
  99. package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-redirects.module-Hm2dO_bC.mjs.map +0 -1
  100. package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-referrals.module-QLNhuh7q.mjs.map +0 -1
  101. package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-returns.module-Bd2gdo6_.mjs +0 -106
  102. package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-returns.module-Bd2gdo6_.mjs.map +0 -1
  103. package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-routes.module-BkVY06ci.mjs +0 -105
  104. package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-routes.module-BkVY06ci.mjs.map +0 -1
  105. package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-settings.module-DKeZTldO.mjs +0 -222
  106. package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-settings.module-DKeZTldO.mjs.map +0 -1
  107. package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-shipments.module-XuaOKr8v.mjs.map +0 -1
  108. package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-stock.module-DYiAkF7E.mjs +0 -107
  109. package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-stock.module-DYiAkF7E.mjs.map +0 -1
  110. package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-users.module-Bx_7fI2g.mjs.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"isaiahiroko-tilmart-ngx-apps-admin-orders.module-Ddw49QW0.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 { BaseDirective, notify, titleCase, using } from '@thescaffold/ngx-core';\nimport { FlyoutService } from '@thescaffold/ngx-ui';\nimport { BehaviorSubject, map, takeUntil } from 'rxjs';\n\nfunction naira(amount: number, currency = 'NGN'): string {\n return `${currency} ${Math.round(amount).toLocaleString('en-US')}`;\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 BaseDirective {\n private readonly flyoutService = inject(FlyoutService);\n private readonly route = inject(ActivatedRoute);\n\n private readonly orderSource = 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 columns = [\n { key: 'orderNumber', value: 'Order' },\n { key: 'status', value: 'Status', type: 'class', class: 'badge text-bg-light border' },\n { key: 'grandTotalLabel', value: 'Total' },\n { key: 'paidLabel', value: 'Paid' },\n { key: 'placedAt', value: 'Placed', type: 'date' },\n ];\n\n page = 1;\n perPage = 25;\n query = '';\n\n list$ = new BehaviorSubject<any>(null);\n detail: any = null;\n detailActions: { to: string; label: string }[] = [];\n naira = naira;\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 list(page = this.page, perPage = this.perPage) {\n const params: any = { page, perPage };\n if (this.query) params.query = this.query;\n this.orderSource\n .getMany(params)\n .pipe(\n takeUntil(this.$),\n map((response) => this.toCollection(response)),\n )\n .subscribe(using((data) => this.list$.next(data)));\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 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 private toCollection(response: any) {\n const rows = (response?.data ?? []).map((order: any) => ({\n ...order,\n grandTotalLabel: naira(Number(order.grandTotal ?? 0), order.currency),\n paidLabel: naira(Number(order.amountPaid ?? 0), order.currency),\n }));\n\n return {\n title: titleCase('orders'),\n columns: this.columns,\n rows,\n hasHeaders: true,\n hasTextFilter: true,\n page: response?.meta?.current_page,\n perPage: response?.meta?.per_page,\n total: response?.meta?.total,\n onPage: (page: number) => this.list(page),\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=\"badge text-bg-light border mt-1\">{{ 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 @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":["i2","i3"],"mappings":";;;;;;;;;;AAMA,SAAS,KAAK,CAAC,MAAc,EAAE,QAAQ,GAAG,KAAK,EAAA;AAC7C,IAAA,OAAO,CAAA,EAAG,QAAQ,CAAA,CAAA,EAAI,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE;AACpE;AAEA;AACA;AACA;AACA;AACA,MAAM,OAAO,GAAoD;IAC/D,gBAAgB,EAAE,CAAC,EAAE,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;IAC3F,OAAO,EAAE,CAAC,EAAE,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,EAAE,EAAE,WAAW,EAAE,KAAK,EAA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AE5B,YAAY;YACZ,cAAc;YACd,aAAa,EAAA,EAAA,CAAA,YAAA,CAAA,EAAA,CAAA,CAAA;AAIJ,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,YAAY,YANrB,YAAY;YACZ,cAAc;YACd,aAAa;AACb,YAAA,YAAY,CAAC,QAAQ,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,SAAS,EAAE,eAAe,EAAE,CAAC,CAAC,CAAA,EAAA,CAAA,CAAA;;4FAGxD,YAAY,EAAA,UAAA,EAAA,CAAA;kBATxB,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACR,YAAY,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;;;;;"}
@@ -1,106 +0,0 @@
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 { BaseDirective, using, titleCase, SharedModule } from '@thescaffold/ngx-core';
6
- import * as i1 from '@thescaffold/ngx-ui';
7
- import { ElementsModule, WebgetsModule } from '@thescaffold/ngx-ui';
8
- import { BehaviorSubject, takeUntil, map } from 'rxjs';
9
- import * as i2 from '@angular/common';
10
-
11
- // Payment reconciliation (docs/TRD.md §7) — backed by grocery's own Payment
12
- // entity, not ntx-apps-capital.
13
- class PaymentsComponent extends BaseDirective {
14
- constructor() {
15
- super(...arguments);
16
- this.name = 'payment';
17
- this.pluralName = 'payments';
18
- this.dataSource = this.apiService.on('apps/commerce/payment');
19
- this.columns = [
20
- { key: 'provider', value: 'Provider', type: 'class', class: 'badge text-bg-light border' },
21
- { key: 'amount', value: 'Amount' },
22
- { key: 'currency', value: 'Currency' },
23
- { key: 'status', value: 'Status', type: 'class', class: 'badge text-bg-light border' },
24
- { key: 'paidAt', value: 'Paid at', type: 'date' },
25
- ];
26
- this.page = 1;
27
- this.perPage = 25;
28
- this.list$ = new BehaviorSubject(null);
29
- this.init = () => {
30
- this.list();
31
- };
32
- }
33
- list(page = this.page, perPage = this.perPage) {
34
- this.dataSource
35
- .getMany({ page, perPage })
36
- .pipe(takeUntil(this.$), map((response) => this.toCollection(response)))
37
- .subscribe(using((data) => this.list$.next(data)));
38
- }
39
- toCollection(response) {
40
- return {
41
- title: titleCase(this.pluralName),
42
- columns: this.columns,
43
- rows: response?.data,
44
- hasHeaders: true,
45
- hasTextFilter: true,
46
- page: response?.meta?.current_page,
47
- perPage: response?.meta?.per_page,
48
- total: response?.meta?.total,
49
- onPage: (page) => this.list(page),
50
- };
51
- }
52
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: PaymentsComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
53
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.16", type: PaymentsComponent, isStandalone: false, selector: "x-payments", usesInheritance: true, ngImport: i0, template: `
54
- <div class="x-page-head">
55
- <div class="x-page-title">Payments</div>
56
- <div class="x-page-subtitle">Every cycle payment, across providers.</div>
57
- </div>
58
-
59
- @if (list$ | async; as list) {
60
- <x-webget-collection [data]="list"></x-webget-collection>
61
- } @else {
62
- <x-element-loader></x-element-loader>
63
- }
64
- `, isInline: true, 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}\n"], dependencies: [{ kind: "component", type: i1.LoaderComponent, selector: "x-element-loader", inputs: ["data"] }, { kind: "component", type: i1.CollectionComponent, selector: "x-webget-collection", inputs: ["data"], outputs: ["search", "filter", "refresh", "select", "page", "show"] }, { kind: "pipe", type: i2.AsyncPipe, name: "async" }] }); }
65
- }
66
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: PaymentsComponent, decorators: [{
67
- type: Component,
68
- args: [{ standalone: false, selector: 'x-payments', template: `
69
- <div class="x-page-head">
70
- <div class="x-page-title">Payments</div>
71
- <div class="x-page-subtitle">Every cycle payment, across providers.</div>
72
- </div>
73
-
74
- @if (list$ | async; as list) {
75
- <x-webget-collection [data]="list"></x-webget-collection>
76
- } @else {
77
- <x-element-loader></x-element-loader>
78
- }
79
- `, 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}\n"] }]
80
- }] });
81
-
82
- class PaymentsModule {
83
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: PaymentsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
84
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.2.16", ngImport: i0, type: PaymentsModule, declarations: [PaymentsComponent], imports: [SharedModule,
85
- ElementsModule,
86
- WebgetsModule, i1$1.RouterModule] }); }
87
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: PaymentsModule, imports: [SharedModule,
88
- ElementsModule,
89
- WebgetsModule,
90
- RouterModule.forChild([{ path: '', component: PaymentsComponent }])] }); }
91
- }
92
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: PaymentsModule, decorators: [{
93
- type: NgModule,
94
- args: [{
95
- declarations: [PaymentsComponent],
96
- imports: [
97
- SharedModule,
98
- ElementsModule,
99
- WebgetsModule,
100
- RouterModule.forChild([{ path: '', component: PaymentsComponent }]),
101
- ],
102
- }]
103
- }] });
104
-
105
- export { PaymentsModule };
106
- //# sourceMappingURL=isaiahiroko-tilmart-ngx-apps-admin-payments.module-BhqAtTZs.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"isaiahiroko-tilmart-ngx-apps-admin-payments.module-BhqAtTZs.mjs","sources":["../../../projects/admin/src/lib/pages/payments/payments.component.ts","../../../projects/admin/src/lib/pages/payments/payments.module.ts"],"sourcesContent":["import { Component } from '@angular/core';\nimport { BaseDirective, titleCase, using } from '@thescaffold/ngx-core';\nimport { BehaviorSubject, takeUntil, map } from 'rxjs';\n\n// Payment reconciliation (docs/TRD.md §7) — backed by grocery's own Payment\n// entity, not ntx-apps-capital.\n@Component({\n standalone: false,\n selector: 'x-payments',\n template: `\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 styles: [\n `\n .x-page-head {\n margin-bottom: 20px;\n }\n .x-page-title {\n font-size: 24px;\n font-weight: 800;\n color: var(--color-text);\n }\n .x-page-subtitle {\n font-size: 13.5px;\n color: var(--color-text-muted);\n margin-top: 2px;\n }\n `,\n ],\n})\nexport class PaymentsComponent extends BaseDirective {\n name = 'payment';\n pluralName = 'payments';\n dataSource = this.apiService.on('apps/commerce/payment');\n\n 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: 'status', value: 'Status', type: 'class', class: 'badge text-bg-light border' },\n { key: 'paidAt', value: 'Paid at', type: 'date' },\n ];\n\n page = 1;\n perPage = 25;\n\n list$ = new BehaviorSubject<any>(null);\n\n override init = () => {\n this.list();\n };\n\n list(page = this.page, perPage = this.perPage) {\n this.dataSource\n .getMany({ page, perPage })\n .pipe(\n takeUntil(this.$),\n map((response) => this.toCollection(response)),\n )\n .subscribe(using((data) => this.list$.next(data)));\n }\n\n private toCollection(response: any) {\n return {\n title: titleCase(this.pluralName),\n columns: this.columns,\n rows: response?.data,\n hasHeaders: true,\n hasTextFilter: true,\n page: response?.meta?.current_page,\n perPage: response?.meta?.per_page,\n total: response?.meta?.total,\n onPage: (page: number) => this.list(page),\n };\n }\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 { 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"],"names":["i1"],"mappings":";;;;;;;;;;AAIA;AACA;AAkCM,MAAO,iBAAkB,SAAQ,aAAa,CAAA;AAjCpD,IAAA,WAAA,GAAA;;QAkCE,IAAA,CAAA,IAAI,GAAG,SAAS;QAChB,IAAA,CAAA,UAAU,GAAG,UAAU;QACvB,IAAA,CAAA,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,uBAAuB,CAAC;AAExD,QAAA,IAAA,CAAA,OAAO,GAAG;AACR,YAAA,EAAE,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,4BAA4B,EAAE;AAC1F,YAAA,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE;AAClC,YAAA,EAAE,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE;AACtC,YAAA,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,4BA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,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;gHAAd,cAAc,EAAA,YAAA,EAAA,CARV,iBAAiB,CAAA,EAAA,OAAA,EAAA,CAE9B,YAAY;YACZ,cAAc;YACd,aAAa,EAAAA,IAAA,CAAA,YAAA,CAAA,EAAA,CAAA,CAAA;AAIJ,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,YANvB,YAAY;YACZ,cAAc;YACd,aAAa;AACb,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;kBAT1B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACR,YAAY,EAAE,CAAC,iBAAiB,CAAC;AACjC,oBAAA,OAAO,EAAE;wBACP,YAAY;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;;;;;"}
@@ -1,274 +0,0 @@
1
- import * as i0 from '@angular/core';
2
- import { inject, ChangeDetectorRef, Component, NgModule } from '@angular/core';
3
- import * as i1$2 from '@angular/router';
4
- import { RouterModule } from '@angular/router';
5
- import { BaseDirective, using, getEnv, notify, SharedModule } from '@thescaffold/ngx-core';
6
- import * as i1$1 from '@thescaffold/ngx-ui';
7
- import { ElementsModule, WebgetsModule } from '@thescaffold/ngx-ui';
8
- import { HttpClient } from '@angular/common/http';
9
- import { firstValueFrom, takeUntil } from 'rxjs';
10
- import * as i1 from '@angular/forms';
11
-
12
- // Cross-basket aggregation, not a per-entity CRUD list (docs/PLAN_2.md
13
- // Phase 11): merges every committed cycle's line items for a shared period
14
- // into one buy-list, grouped by product, with a done/pending toggle so the
15
- // ops team can track what's already been sourced. Net-new end to end - no
16
- // existing UI or backend to build on (confirmed against index/PITCH.md,
17
- // which has one aspirational sentence about this and nothing else).
18
- class ProcurementComponent extends BaseDirective {
19
- constructor() {
20
- super(...arguments);
21
- this.http = inject(HttpClient);
22
- this.cdr = inject(ChangeDetectorRef);
23
- this.periods = [];
24
- this.periodStart = null;
25
- this.rows = [];
26
- this.loading = true;
27
- this.exporting = false;
28
- this.init = () => {
29
- this.bootstrap();
30
- };
31
- }
32
- async bootstrap() {
33
- try {
34
- const res = await firstValueFrom(this.apiService.get('apps/grocery/procurement/periods'));
35
- this.periods = res?.data ?? [];
36
- this.periodStart = this.periods[0] ?? null;
37
- if (this.periodStart) {
38
- await this.load();
39
- }
40
- else {
41
- this.loading = false;
42
- }
43
- }
44
- catch {
45
- this.loading = false;
46
- }
47
- this.cdr.markForCheck();
48
- }
49
- async onPeriodChange(periodStart) {
50
- this.periodStart = periodStart;
51
- await this.load();
52
- this.cdr.markForCheck();
53
- }
54
- async load() {
55
- if (!this.periodStart) {
56
- return;
57
- }
58
- this.loading = true;
59
- this.cdr.markForCheck();
60
- try {
61
- const res = await firstValueFrom(this.apiService.get('apps/grocery/procurement', {
62
- periodStart: this.periodStart,
63
- }));
64
- this.rows = res?.data ?? [];
65
- }
66
- finally {
67
- this.loading = false;
68
- this.cdr.markForCheck();
69
- }
70
- }
71
- toggle(row) {
72
- this.apiService
73
- .patch('apps/grocery/procurement/toggle', {
74
- periodStart: this.periodStart,
75
- productId: row.productId,
76
- })
77
- .pipe(takeUntil(this.$))
78
- .subscribe(using(({ data }) => {
79
- row.status = data.status;
80
- this.cdr.markForCheck();
81
- }));
82
- }
83
- print() {
84
- window.print();
85
- }
86
- // Bypasses ApiService/RequestService: that wrapper always expects the
87
- // {status,title,message,data} JSON envelope and throws "Network Error"
88
- // on anything else, so a raw binary file response can't go through it.
89
- // The global JwtInterceptor still attaches auth headers to this request
90
- // regardless, since it intercepts every HttpClient call, not just ones
91
- // made through ApiService.
92
- async exportExcel() {
93
- if (!this.periodStart || this.exporting) {
94
- return;
95
- }
96
- this.exporting = true;
97
- this.cdr.markForCheck();
98
- try {
99
- const base = getEnv('API_BASE_URL');
100
- const blob = await firstValueFrom(this.http.get(`${base}/apps/grocery/procurement/export?periodStart=${this.periodStart}`, { responseType: 'blob' }));
101
- const url = URL.createObjectURL(blob);
102
- const link = document.createElement('a');
103
- link.href = url;
104
- link.download = `procurement-${this.periodStart}.xlsx`;
105
- link.click();
106
- URL.revokeObjectURL(url);
107
- }
108
- catch {
109
- notify('Could not export this period. Please try again.');
110
- }
111
- finally {
112
- this.exporting = false;
113
- this.cdr.markForCheck();
114
- }
115
- }
116
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: ProcurementComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
117
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.16", type: ProcurementComponent, isStandalone: false, selector: "x-procurement", usesInheritance: true, ngImport: i0, template: `
118
- <div class="x-page-head x-no-print">
119
- <div class="x-page-title">Procurement</div>
120
- <div class="x-page-subtitle">
121
- What to buy for a period, aggregated across every committed basket.
122
- </div>
123
- </div>
124
-
125
- <div class="x-toolbar x-no-print">
126
- <select class="form-select x-period-select" [ngModel]="periodStart" (ngModelChange)="onPeriodChange($event)">
127
- @if (!periods.length) {
128
- <option [ngValue]="null">No periods yet</option>
129
- }
130
- @for (p of periods; track p) {
131
- <option [value]="p">{{ p }}</option>
132
- }
133
- </select>
134
- <button type="button" class="btn btn-outline-secondary" (click)="print()">Print</button>
135
- <button type="button" class="btn btn-success" [disabled]="!periodStart || exporting" (click)="exportExcel()">
136
- {{ exporting ? 'Exporting…' : 'Export to Excel' }}
137
- </button>
138
- </div>
139
-
140
- <div class="x-print-header">
141
- <div class="x-print-title">Procurement list — {{ periodStart }}</div>
142
- </div>
143
-
144
- @if (loading) {
145
- <x-element-loader></x-element-loader>
146
- } @else if (!rows.length) {
147
- <p class="text-secondary">Nothing to procure for this period.</p>
148
- } @else {
149
- <table class="table">
150
- <thead>
151
- <tr>
152
- <th>Product</th>
153
- <th>Category</th>
154
- <th>Unit</th>
155
- <th>Quantity</th>
156
- <th>Status</th>
157
- <th class="x-no-print"></th>
158
- </tr>
159
- </thead>
160
- <tbody>
161
- @for (row of rows; track row.productId) {
162
- <tr [class.x-row-done]="row.status === 'done'">
163
- <td>{{ row.productName }}</td>
164
- <td>{{ row.category }}</td>
165
- <td>{{ row.unit }}</td>
166
- <td>{{ row.qty }}</td>
167
- <td>
168
- <span class="badge text-bg-light border">{{ row.status }}</span>
169
- </td>
170
- <td class="x-no-print">
171
- <button type="button" class="btn btn-sm btn-outline-secondary" (click)="toggle(row)">
172
- Mark {{ row.status === 'done' ? 'pending' : 'done' }}
173
- </button>
174
- </td>
175
- </tr>
176
- }
177
- </tbody>
178
- </table>
179
- }
180
- `, isInline: true, 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-toolbar{display:flex;gap:12px;align-items:center;margin-bottom:20px}.x-period-select{max-width:220px}.x-row-done{opacity:.55}.x-print-header{display:none}@media print{.x-no-print{display:none!important}.x-print-header{display:block;margin-bottom:16px}.x-print-title{font-size:18px;font-weight:800}}\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.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: i1$1.LoaderComponent, selector: "x-element-loader", inputs: ["data"] }] }); }
181
- }
182
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: ProcurementComponent, decorators: [{
183
- type: Component,
184
- args: [{ standalone: false, selector: 'x-procurement', template: `
185
- <div class="x-page-head x-no-print">
186
- <div class="x-page-title">Procurement</div>
187
- <div class="x-page-subtitle">
188
- What to buy for a period, aggregated across every committed basket.
189
- </div>
190
- </div>
191
-
192
- <div class="x-toolbar x-no-print">
193
- <select class="form-select x-period-select" [ngModel]="periodStart" (ngModelChange)="onPeriodChange($event)">
194
- @if (!periods.length) {
195
- <option [ngValue]="null">No periods yet</option>
196
- }
197
- @for (p of periods; track p) {
198
- <option [value]="p">{{ p }}</option>
199
- }
200
- </select>
201
- <button type="button" class="btn btn-outline-secondary" (click)="print()">Print</button>
202
- <button type="button" class="btn btn-success" [disabled]="!periodStart || exporting" (click)="exportExcel()">
203
- {{ exporting ? 'Exporting…' : 'Export to Excel' }}
204
- </button>
205
- </div>
206
-
207
- <div class="x-print-header">
208
- <div class="x-print-title">Procurement list — {{ periodStart }}</div>
209
- </div>
210
-
211
- @if (loading) {
212
- <x-element-loader></x-element-loader>
213
- } @else if (!rows.length) {
214
- <p class="text-secondary">Nothing to procure for this period.</p>
215
- } @else {
216
- <table class="table">
217
- <thead>
218
- <tr>
219
- <th>Product</th>
220
- <th>Category</th>
221
- <th>Unit</th>
222
- <th>Quantity</th>
223
- <th>Status</th>
224
- <th class="x-no-print"></th>
225
- </tr>
226
- </thead>
227
- <tbody>
228
- @for (row of rows; track row.productId) {
229
- <tr [class.x-row-done]="row.status === 'done'">
230
- <td>{{ row.productName }}</td>
231
- <td>{{ row.category }}</td>
232
- <td>{{ row.unit }}</td>
233
- <td>{{ row.qty }}</td>
234
- <td>
235
- <span class="badge text-bg-light border">{{ row.status }}</span>
236
- </td>
237
- <td class="x-no-print">
238
- <button type="button" class="btn btn-sm btn-outline-secondary" (click)="toggle(row)">
239
- Mark {{ row.status === 'done' ? 'pending' : 'done' }}
240
- </button>
241
- </td>
242
- </tr>
243
- }
244
- </tbody>
245
- </table>
246
- }
247
- `, 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-toolbar{display:flex;gap:12px;align-items:center;margin-bottom:20px}.x-period-select{max-width:220px}.x-row-done{opacity:.55}.x-print-header{display:none}@media print{.x-no-print{display:none!important}.x-print-header{display:block;margin-bottom:16px}.x-print-title{font-size:18px;font-weight:800}}\n"] }]
248
- }] });
249
-
250
- class ProcurementModule {
251
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: ProcurementModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
252
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.2.16", ngImport: i0, type: ProcurementModule, declarations: [ProcurementComponent], imports: [SharedModule,
253
- ElementsModule,
254
- WebgetsModule, i1$2.RouterModule] }); }
255
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: ProcurementModule, imports: [SharedModule,
256
- ElementsModule,
257
- WebgetsModule,
258
- RouterModule.forChild([{ path: '', component: ProcurementComponent }])] }); }
259
- }
260
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: ProcurementModule, decorators: [{
261
- type: NgModule,
262
- args: [{
263
- declarations: [ProcurementComponent],
264
- imports: [
265
- SharedModule,
266
- ElementsModule,
267
- WebgetsModule,
268
- RouterModule.forChild([{ path: '', component: ProcurementComponent }]),
269
- ],
270
- }]
271
- }] });
272
-
273
- export { ProcurementModule };
274
- //# sourceMappingURL=isaiahiroko-tilmart-ngx-apps-admin-procurement.module-qXW-g0pf.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"isaiahiroko-tilmart-ngx-apps-admin-procurement.module-qXW-g0pf.mjs","sources":["../../../projects/admin/src/lib/pages/procurement/procurement.component.ts","../../../projects/admin/src/lib/pages/procurement/procurement.module.ts"],"sourcesContent":["import { HttpClient } from '@angular/common/http';\nimport { ChangeDetectorRef, Component, inject } from '@angular/core';\nimport { BaseDirective, getEnv, notify, using } from '@thescaffold/ngx-core';\nimport { firstValueFrom, takeUntil } from 'rxjs';\n\ninterface ProcurementRowVm {\n productId: string;\n productName: string;\n category: string;\n unit: string;\n qty: number;\n status: 'pending' | 'done';\n}\n\n// Cross-basket aggregation, not a per-entity CRUD list (docs/PLAN_2.md\n// Phase 11): merges every committed cycle's line items for a shared period\n// into one buy-list, grouped by product, with a done/pending toggle so the\n// ops team can track what's already been sourced. Net-new end to end - no\n// existing UI or backend to build on (confirmed against index/PITCH.md,\n// which has one aspirational sentence about this and nothing else).\n@Component({\n standalone: false,\n selector: 'x-procurement',\n template: `\n <div class=\"x-page-head x-no-print\">\n <div class=\"x-page-title\">Procurement</div>\n <div class=\"x-page-subtitle\">\n What to buy for a period, aggregated across every committed basket.\n </div>\n </div>\n\n <div class=\"x-toolbar x-no-print\">\n <select class=\"form-select x-period-select\" [ngModel]=\"periodStart\" (ngModelChange)=\"onPeriodChange($event)\">\n @if (!periods.length) {\n <option [ngValue]=\"null\">No periods yet</option>\n }\n @for (p of periods; track p) {\n <option [value]=\"p\">{{ p }}</option>\n }\n </select>\n <button type=\"button\" class=\"btn btn-outline-secondary\" (click)=\"print()\">Print</button>\n <button type=\"button\" class=\"btn btn-success\" [disabled]=\"!periodStart || exporting\" (click)=\"exportExcel()\">\n {{ exporting ? 'Exporting…' : 'Export to Excel' }}\n </button>\n </div>\n\n <div class=\"x-print-header\">\n <div class=\"x-print-title\">Procurement list — {{ periodStart }}</div>\n </div>\n\n @if (loading) {\n <x-element-loader></x-element-loader>\n } @else if (!rows.length) {\n <p class=\"text-secondary\">Nothing to procure for this period.</p>\n } @else {\n <table class=\"table\">\n <thead>\n <tr>\n <th>Product</th>\n <th>Category</th>\n <th>Unit</th>\n <th>Quantity</th>\n <th>Status</th>\n <th class=\"x-no-print\"></th>\n </tr>\n </thead>\n <tbody>\n @for (row of rows; track row.productId) {\n <tr [class.x-row-done]=\"row.status === 'done'\">\n <td>{{ row.productName }}</td>\n <td>{{ row.category }}</td>\n <td>{{ row.unit }}</td>\n <td>{{ row.qty }}</td>\n <td>\n <span class=\"badge text-bg-light border\">{{ row.status }}</span>\n </td>\n <td class=\"x-no-print\">\n <button type=\"button\" class=\"btn btn-sm btn-outline-secondary\" (click)=\"toggle(row)\">\n Mark {{ row.status === 'done' ? 'pending' : 'done' }}\n </button>\n </td>\n </tr>\n }\n </tbody>\n </table>\n }\n `,\n styles: [\n `\n .x-page-head {\n margin-bottom: 20px;\n }\n .x-page-title {\n font-size: 24px;\n font-weight: 800;\n color: var(--color-text);\n }\n .x-page-subtitle {\n font-size: 13.5px;\n color: var(--color-text-muted);\n margin-top: 2px;\n }\n .x-toolbar {\n display: flex;\n gap: 12px;\n align-items: center;\n margin-bottom: 20px;\n }\n .x-period-select {\n max-width: 220px;\n }\n .x-row-done {\n opacity: 0.55;\n }\n .x-print-header {\n display: none;\n }\n\n @media print {\n .x-no-print {\n display: none !important;\n }\n .x-print-header {\n display: block;\n margin-bottom: 16px;\n }\n .x-print-title {\n font-size: 18px;\n font-weight: 800;\n }\n }\n `,\n ],\n})\nexport class ProcurementComponent extends BaseDirective {\n private readonly http = inject(HttpClient);\n private readonly cdr = inject(ChangeDetectorRef);\n\n periods: string[] = [];\n periodStart: string | null = null;\n rows: ProcurementRowVm[] = [];\n loading = true;\n exporting = false;\n\n override init = () => {\n this.bootstrap();\n };\n\n private async bootstrap() {\n try {\n const res: any = await firstValueFrom(\n this.apiService.get('apps/grocery/procurement/periods'),\n );\n this.periods = res?.data ?? [];\n this.periodStart = this.periods[0] ?? null;\n if (this.periodStart) {\n await this.load();\n } else {\n this.loading = false;\n }\n } catch {\n this.loading = false;\n }\n this.cdr.markForCheck();\n }\n\n async onPeriodChange(periodStart: string) {\n this.periodStart = periodStart;\n await this.load();\n this.cdr.markForCheck();\n }\n\n async load() {\n if (!this.periodStart) {\n return;\n }\n this.loading = true;\n this.cdr.markForCheck();\n try {\n const res: any = await firstValueFrom(\n this.apiService.get('apps/grocery/procurement', {\n periodStart: this.periodStart,\n } as any),\n );\n this.rows = res?.data ?? [];\n } finally {\n this.loading = false;\n this.cdr.markForCheck();\n }\n }\n\n toggle(row: ProcurementRowVm) {\n this.apiService\n .patch('apps/grocery/procurement/toggle', {\n periodStart: this.periodStart,\n productId: row.productId,\n })\n .pipe(takeUntil(this.$))\n .subscribe(\n using(({ data }: any) => {\n row.status = data.status;\n this.cdr.markForCheck();\n }),\n );\n }\n\n print() {\n window.print();\n }\n\n // Bypasses ApiService/RequestService: that wrapper always expects the\n // {status,title,message,data} JSON envelope and throws \"Network Error\"\n // on anything else, so a raw binary file response can't go through it.\n // The global JwtInterceptor still attaches auth headers to this request\n // regardless, since it intercepts every HttpClient call, not just ones\n // made through ApiService.\n async exportExcel() {\n if (!this.periodStart || this.exporting) {\n return;\n }\n this.exporting = true;\n this.cdr.markForCheck();\n\n try {\n const base = getEnv('API_BASE_URL');\n const blob = await firstValueFrom(\n this.http.get(\n `${base}/apps/grocery/procurement/export?periodStart=${this.periodStart}`,\n { responseType: 'blob' },\n ),\n );\n const url = URL.createObjectURL(blob);\n const link = document.createElement('a');\n link.href = url;\n link.download = `procurement-${this.periodStart}.xlsx`;\n link.click();\n URL.revokeObjectURL(url);\n } catch {\n notify('Could not export this period. Please try again.');\n } finally {\n this.exporting = false;\n this.cdr.markForCheck();\n }\n }\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 { ProcurementComponent } from './procurement.component';\n\n@NgModule({\n declarations: [ProcurementComponent],\n imports: [\n SharedModule,\n ElementsModule,\n WebgetsModule,\n RouterModule.forChild([{ path: '', component: ProcurementComponent }]),\n ],\n})\nexport class ProcurementModule {}\n"],"names":["i2","i1"],"mappings":";;;;;;;;;;;AAcA;AACA;AACA;AACA;AACA;AACA;AAmHM,MAAO,oBAAqB,SAAQ,aAAa,CAAA;AAlHvD,IAAA,WAAA,GAAA;;AAmHmB,QAAA,IAAA,CAAA,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC;AACzB,QAAA,IAAA,CAAA,GAAG,GAAG,MAAM,CAAC,iBAAiB,CAAC;QAEhD,IAAA,CAAA,OAAO,GAAa,EAAE;QACtB,IAAA,CAAA,WAAW,GAAkB,IAAI;QACjC,IAAA,CAAA,IAAI,GAAuB,EAAE;QAC7B,IAAA,CAAA,OAAO,GAAG,IAAI;QACd,IAAA,CAAA,SAAS,GAAG,KAAK;QAER,IAAA,CAAA,IAAI,GAAG,MAAK;YACnB,IAAI,CAAC,SAAS,EAAE;AAClB,QAAA,CAAC;AAkGF,IAAA;AAhGS,IAAA,MAAM,SAAS,GAAA;AACrB,QAAA,IAAI;AACF,YAAA,MAAM,GAAG,GAAQ,MAAM,cAAc,CACnC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,kCAAkC,CAAC,CACxD;YACD,IAAI,CAAC,OAAO,GAAG,GAAG,EAAE,IAAI,IAAI,EAAE;YAC9B,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,IAAI;AAC1C,YAAA,IAAI,IAAI,CAAC,WAAW,EAAE;AACpB,gBAAA,MAAM,IAAI,CAAC,IAAI,EAAE;YACnB;iBAAO;AACL,gBAAA,IAAI,CAAC,OAA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;"}
@@ -1,106 +0,0 @@
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 { BaseDirective, using, titleCase, SharedModule } from '@thescaffold/ngx-core';
6
- import * as i1 from '@thescaffold/ngx-ui';
7
- import { ElementsModule, WebgetsModule } from '@thescaffold/ngx-ui';
8
- import { BehaviorSubject, takeUntil, map } from 'rxjs';
9
- import * as i2 from '@angular/common';
10
-
11
- // P7.1 — ops console section pass (PRD 6.2, TRD 9.2). A standard list
12
- // view on `x-webget-collection` over `apps/commerce/promotion`, matching the
13
- // established admin pattern (users, routes, inbox). ops CRUD is covered
14
- // by `admin:*:apps:commerce:*`.
15
- class PromotionsComponent extends BaseDirective {
16
- constructor() {
17
- super(...arguments);
18
- this.pluralName = 'promotions';
19
- this.dataSource = this.apiService.on('apps/commerce/promotion');
20
- this.columns = [
21
- { key: 'name', value: 'Name' },
22
- { key: 'status', value: 'Status', type: 'class', class: 'badge text-bg-light border' },
23
- { key: 'priority', value: 'Priority' },
24
- { key: 'usageCount', value: 'Used' },
25
- ];
26
- this.page = 1;
27
- this.perPage = 25;
28
- this.list$ = new BehaviorSubject(null);
29
- this.init = () => {
30
- this.list();
31
- };
32
- }
33
- list(page = this.page, perPage = this.perPage) {
34
- this.dataSource
35
- .getMany({ page, perPage })
36
- .pipe(takeUntil(this.$), map((response) => this.toCollection(response)))
37
- .subscribe(using((data) => this.list$.next(data)));
38
- }
39
- toCollection(response) {
40
- return {
41
- title: titleCase(this.pluralName),
42
- columns: this.columns,
43
- rows: response?.data,
44
- hasHeaders: true,
45
- hasTextFilter: true,
46
- page: response?.meta?.current_page,
47
- perPage: response?.meta?.per_page,
48
- total: response?.meta?.total,
49
- onPage: (page) => this.list(page),
50
- };
51
- }
52
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: PromotionsComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
53
- 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: `
54
- <div class="x-page-head">
55
- <div class="x-page-title">Promotions</div>
56
- <div class="x-page-subtitle">Automatic and coupon-gated discount rules evaluated at checkout.</div>
57
- </div>
58
-
59
- @if (list$ | async; as list) {
60
- <x-webget-collection [data]="list"></x-webget-collection>
61
- } @else {
62
- <x-element-loader></x-element-loader>
63
- }
64
- `, isInline: true, 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}\n"], dependencies: [{ kind: "component", type: i1.LoaderComponent, selector: "x-element-loader", inputs: ["data"] }, { kind: "component", type: i1.CollectionComponent, selector: "x-webget-collection", inputs: ["data"], outputs: ["search", "filter", "refresh", "select", "page", "show"] }, { kind: "pipe", type: i2.AsyncPipe, name: "async" }] }); }
65
- }
66
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: PromotionsComponent, decorators: [{
67
- type: Component,
68
- args: [{ standalone: false, selector: 'x-promotions', template: `
69
- <div class="x-page-head">
70
- <div class="x-page-title">Promotions</div>
71
- <div class="x-page-subtitle">Automatic and coupon-gated discount rules evaluated at checkout.</div>
72
- </div>
73
-
74
- @if (list$ | async; as list) {
75
- <x-webget-collection [data]="list"></x-webget-collection>
76
- } @else {
77
- <x-element-loader></x-element-loader>
78
- }
79
- `, 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}\n"] }]
80
- }] });
81
-
82
- class PromotionsModule {
83
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: PromotionsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
84
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.2.16", ngImport: i0, type: PromotionsModule, declarations: [PromotionsComponent], imports: [SharedModule,
85
- ElementsModule,
86
- WebgetsModule, i1$1.RouterModule] }); }
87
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: PromotionsModule, imports: [SharedModule,
88
- ElementsModule,
89
- WebgetsModule,
90
- RouterModule.forChild([{ path: '', component: PromotionsComponent }])] }); }
91
- }
92
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: PromotionsModule, decorators: [{
93
- type: NgModule,
94
- args: [{
95
- declarations: [PromotionsComponent],
96
- imports: [
97
- SharedModule,
98
- ElementsModule,
99
- WebgetsModule,
100
- RouterModule.forChild([{ path: '', component: PromotionsComponent }]),
101
- ],
102
- }]
103
- }] });
104
-
105
- export { PromotionsModule };
106
- //# sourceMappingURL=isaiahiroko-tilmart-ngx-apps-admin-promotions.module-DG9uTDqX.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"isaiahiroko-tilmart-ngx-apps-admin-promotions.module-DG9uTDqX.mjs","sources":["../../../projects/admin/src/lib/pages/promotions/promotions.component.ts","../../../projects/admin/src/lib/pages/promotions/promotions.module.ts"],"sourcesContent":["import { Component } from '@angular/core';\nimport { BaseDirective, titleCase, using } from '@thescaffold/ngx-core';\nimport { BehaviorSubject, map, takeUntil } from 'rxjs';\n\n// P7.1 — ops console section pass (PRD 6.2, TRD 9.2). A standard list\n// view on `x-webget-collection` over `apps/commerce/promotion`, matching the\n// established admin pattern (users, routes, inbox). ops CRUD is covered\n// by `admin:*:apps:commerce:*`.\n@Component({\n standalone: false,\n selector: 'x-promotions',\n template: `\n <div class=\"x-page-head\">\n <div class=\"x-page-title\">Promotions</div>\n <div class=\"x-page-subtitle\">Automatic and coupon-gated discount rules evaluated at checkout.</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 styles: [\n `\n .x-page-head {\n margin-bottom: 20px;\n }\n .x-page-title {\n font-size: 24px;\n font-weight: 800;\n color: var(--color-text);\n }\n .x-page-subtitle {\n font-size: 13.5px;\n color: var(--color-text-muted);\n margin-top: 2px;\n }\n `,\n ],\n})\nexport class PromotionsComponent extends BaseDirective {\n pluralName = 'promotions';\n dataSource = this.apiService.on('apps/commerce/promotion');\n\n columns = [\n { key: 'name', value: 'Name' },\n { key: 'status', value: 'Status', type: 'class', class: 'badge text-bg-light border' },\n { key: 'priority', value: 'Priority' },\n { key: 'usageCount', value: 'Used' },\n ];\n\n page = 1;\n perPage = 25;\n\n list$ = new BehaviorSubject<any>(null);\n\n override init = () => {\n this.list();\n };\n\n list(page = this.page, perPage = this.perPage) {\n this.dataSource\n .getMany({ page, perPage })\n .pipe(\n takeUntil(this.$),\n map((response) => this.toCollection(response)),\n )\n .subscribe(using((data) => this.list$.next(data)));\n }\n\n private toCollection(response: any) {\n return {\n title: titleCase(this.pluralName),\n columns: this.columns,\n rows: response?.data,\n hasHeaders: true,\n hasTextFilter: true,\n page: response?.meta?.current_page,\n perPage: response?.meta?.per_page,\n total: response?.meta?.total,\n onPage: (page: number) => this.list(page),\n };\n }\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 { PromotionsComponent } from './promotions.component';\n\n@NgModule({\n declarations: [PromotionsComponent],\n imports: [\n SharedModule,\n ElementsModule,\n WebgetsModule,\n RouterModule.forChild([{ path: '', component: PromotionsComponent }]),\n ],\n})\nexport class PromotionsModule {}\n"],"names":["i1"],"mappings":";;;;;;;;;;AAIA;AACA;AACA;AACA;AAkCM,MAAO,mBAAoB,SAAQ,aAAa,CAAA;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