@isaiahiroko/tilmart-ngx-apps-admin 0.2.12 → 0.2.13
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-DrKEqPkW.mjs +605 -0
- package/fesm2022/isaiahiroko-tilmart-ngx-apps-admin-catalog.module-DrKEqPkW.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,178 @@
|
|
|
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 { using, notify, SharedModule } from '@thescaffold/ngx-core';
|
|
6
|
+
import * as i2 from '@thescaffold/ngx-ui';
|
|
7
|
+
import { ElementsModule, WebgetsModule } from '@thescaffold/ngx-ui';
|
|
8
|
+
import { takeUntil, firstValueFrom, catchError, of } from 'rxjs';
|
|
9
|
+
import { S as SimpleCrudDirective, J as JsonBuilderComponent } from './isaiahiroko-tilmart-ngx-apps-admin-json-builder.component-BFroIYk9.mjs';
|
|
10
|
+
import * as i1 from '@angular/forms';
|
|
11
|
+
import * as i3 from '@angular/common';
|
|
12
|
+
|
|
13
|
+
const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
14
|
+
// R1 production-readiness pass — CAT-08 (partial). Was a flat read-only
|
|
15
|
+
// table; this makes available/reserved/incoming/threshold/policy
|
|
16
|
+
// editable directly. Reason-coded adjustment history, transfers between
|
|
17
|
+
// locations and serial-number registers are real, separate scope (no
|
|
18
|
+
// `StockAdjustment`-style entity exists yet — that's a new audit-trail
|
|
19
|
+
// feature, not a form to add) — most new variant/location stock rows
|
|
20
|
+
// still get created from the Catalogue product editor, which has proper
|
|
21
|
+
// variant/location pickers; this page is for adjusting an existing row.
|
|
22
|
+
class StockComponent extends SimpleCrudDirective {
|
|
23
|
+
constructor() {
|
|
24
|
+
super(...arguments);
|
|
25
|
+
this.locationSource = this.apiService.on('apps/commerce/stock-location');
|
|
26
|
+
this.variantSource = this.apiService.on('apps/commerce/product-variant');
|
|
27
|
+
this.productSource = this.apiService.on('apps/commerce/product');
|
|
28
|
+
// Rows reference a variant and a location by id; these caches turn them
|
|
29
|
+
// into "Product · SKU" and the location's name.
|
|
30
|
+
this.variants = new Map();
|
|
31
|
+
this.products = new Map();
|
|
32
|
+
this.locations = new Map();
|
|
33
|
+
this.pageTitle = 'Stock';
|
|
34
|
+
this.pageSubtitle = 'Per-variant, per-location levels — available, reserved and incoming.';
|
|
35
|
+
this.singularLabel = 'stock level';
|
|
36
|
+
this.pluralName = 'stock';
|
|
37
|
+
this.dataSource = this.apiService.on('apps/commerce/stock-level');
|
|
38
|
+
this.columns = [
|
|
39
|
+
{ key: 'productLabel', value: 'Product' },
|
|
40
|
+
{ key: 'skuLabel', value: 'SKU' },
|
|
41
|
+
{ key: 'locationLabel', value: 'Location' },
|
|
42
|
+
{ key: 'available', value: 'Available' },
|
|
43
|
+
{ key: 'reserved', value: 'Reserved' },
|
|
44
|
+
{ key: 'incoming', value: 'Incoming' },
|
|
45
|
+
{ key: 'levelHtml', value: 'Level' },
|
|
46
|
+
];
|
|
47
|
+
this.fields = [
|
|
48
|
+
{ key: 'variantId', label: 'Variant SKU (or id)', type: 'text', required: true, placeholder: 'e.g. MUST-PV18-5548' },
|
|
49
|
+
{ key: 'locationId', label: 'Location', type: 'select', optionsKey: 'locations', required: true },
|
|
50
|
+
{ key: 'available', label: 'Available', type: 'number' },
|
|
51
|
+
{ key: 'reserved', label: 'Reserved', type: 'number' },
|
|
52
|
+
{ key: 'incoming', label: 'Incoming', type: 'number' },
|
|
53
|
+
{ key: 'lowStockThreshold', label: 'Low-stock threshold', type: 'number' },
|
|
54
|
+
{ key: 'leadTimeDays', label: 'Lead time (days)', type: 'number' },
|
|
55
|
+
{
|
|
56
|
+
key: 'outOfStockPolicy',
|
|
57
|
+
label: 'Out-of-stock policy',
|
|
58
|
+
type: 'select',
|
|
59
|
+
options: [
|
|
60
|
+
{ value: 'hide', label: 'Hide' },
|
|
61
|
+
{ value: 'show', label: 'Show (sold out)' },
|
|
62
|
+
{ value: 'backorder', label: 'Backorder' },
|
|
63
|
+
{ value: 'preorder', label: 'Preorder' },
|
|
64
|
+
],
|
|
65
|
+
},
|
|
66
|
+
];
|
|
67
|
+
this.init = () => {
|
|
68
|
+
this.list();
|
|
69
|
+
this.locationSource
|
|
70
|
+
.getMany({ page: 1, perPage: 100 })
|
|
71
|
+
.pipe(takeUntil(this.$))
|
|
72
|
+
.subscribe(using((response) => {
|
|
73
|
+
const rows = response?.data ?? [];
|
|
74
|
+
rows.forEach((l) => this.locations.set(l.id, l.name));
|
|
75
|
+
this.dynamicOptions['locations'] = rows.map((l) => ({
|
|
76
|
+
value: l.id,
|
|
77
|
+
label: l.name,
|
|
78
|
+
}));
|
|
79
|
+
// Location names may arrive after the first page rendered.
|
|
80
|
+
if (this.list$.value)
|
|
81
|
+
this.list(this.page, this.perPage, this.query);
|
|
82
|
+
}));
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
async enrichRows(rows) {
|
|
86
|
+
const variantIds = [...new Set(rows.map((r) => r.variantId).filter((id) => id && !this.variants.has(id)))];
|
|
87
|
+
await Promise.all(variantIds.map(async (id) => {
|
|
88
|
+
const v = await this.byId(this.variantSource, id);
|
|
89
|
+
this.variants.set(id, { sku: v?.sku, productId: v?.productId });
|
|
90
|
+
}));
|
|
91
|
+
const productIds = [
|
|
92
|
+
...new Set(rows
|
|
93
|
+
.map((r) => this.variants.get(r.variantId)?.productId)
|
|
94
|
+
.filter((id) => !!id && !this.products.has(id))),
|
|
95
|
+
];
|
|
96
|
+
await Promise.all(productIds.map(async (id) => {
|
|
97
|
+
this.products.set(id, (await this.byId(this.productSource, id))?.name ?? '');
|
|
98
|
+
}));
|
|
99
|
+
// The picker list holds the first 100 sites; look up any others.
|
|
100
|
+
const locationIds = [...new Set(rows.map((r) => r.locationId).filter((id) => id && !this.locations.has(id)))];
|
|
101
|
+
await Promise.all(locationIds.map(async (id) => {
|
|
102
|
+
this.locations.set(id, (await this.byId(this.locationSource, id))?.name ?? '');
|
|
103
|
+
}));
|
|
104
|
+
}
|
|
105
|
+
// A list call filtered by id answers 200 with no rows for a deleted
|
|
106
|
+
// record, where `getOne` would 404 (and log a console error) for each.
|
|
107
|
+
async byId(source, id) {
|
|
108
|
+
const res = await firstValueFrom(source.getMany({ id, page: 1, perPage: 1 }).pipe(catchError(() => of(null))));
|
|
109
|
+
return (res?.data ?? []).find((r) => r.id === id) ?? null;
|
|
110
|
+
}
|
|
111
|
+
mapRow(row) {
|
|
112
|
+
const variant = this.variants.get(row.variantId);
|
|
113
|
+
const free = Number(row.available ?? 0) - Number(row.reserved ?? 0);
|
|
114
|
+
const threshold = row.lowStockThreshold != null ? Number(row.lowStockThreshold) : 5;
|
|
115
|
+
const level = free <= 0
|
|
116
|
+
? '<span class="x-status x-status-danger">Out</span>'
|
|
117
|
+
: free <= threshold
|
|
118
|
+
? '<span class="x-status x-status-warn">Low</span>'
|
|
119
|
+
: '<span class="x-status x-status-success">OK</span>';
|
|
120
|
+
return {
|
|
121
|
+
...row,
|
|
122
|
+
// Empty name = the record was deleted (stock rows outlive their product / site).
|
|
123
|
+
productLabel: (variant?.productId && this.products.get(variant.productId)) || 'Removed product',
|
|
124
|
+
skuLabel: variant?.sku || '—',
|
|
125
|
+
locationLabel: this.locations.get(row.locationId) || 'Removed location',
|
|
126
|
+
levelHtml: level,
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
// New rows can name the variant by SKU; it's swapped for the id here.
|
|
130
|
+
async save() {
|
|
131
|
+
const ref = `${this.draft?.['variantId'] ?? ''}`.trim();
|
|
132
|
+
if (this.draft && ref && !UUID.test(ref)) {
|
|
133
|
+
const res = await firstValueFrom(this.variantSource.getMany({ sku: ref, page: 1, perPage: 1 }).pipe(catchError(() => of(null))));
|
|
134
|
+
const match = (res?.data ?? []).find((v) => v.sku === ref);
|
|
135
|
+
if (!match) {
|
|
136
|
+
notify(`No variant has the SKU "${ref}".`, undefined, 'error');
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
this.draft['variantId'] = match.id;
|
|
140
|
+
}
|
|
141
|
+
return super.save();
|
|
142
|
+
}
|
|
143
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: StockComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
144
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.16", type: StockComponent, isStandalone: false, selector: "x-stock", 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" }] }); }
|
|
145
|
+
}
|
|
146
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: StockComponent, decorators: [{
|
|
147
|
+
type: Component,
|
|
148
|
+
args: [{ standalone: false, selector: 'x-stock', 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"] }]
|
|
149
|
+
}] });
|
|
150
|
+
|
|
151
|
+
class StockModule {
|
|
152
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: StockModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
153
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.2.16", ngImport: i0, type: StockModule, declarations: [StockComponent], imports: [JsonBuilderComponent,
|
|
154
|
+
SharedModule,
|
|
155
|
+
ElementsModule,
|
|
156
|
+
WebgetsModule, i1$1.RouterModule] }); }
|
|
157
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: StockModule, imports: [JsonBuilderComponent,
|
|
158
|
+
SharedModule,
|
|
159
|
+
ElementsModule,
|
|
160
|
+
WebgetsModule,
|
|
161
|
+
RouterModule.forChild([{ path: '', component: StockComponent }])] }); }
|
|
162
|
+
}
|
|
163
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: StockModule, decorators: [{
|
|
164
|
+
type: NgModule,
|
|
165
|
+
args: [{
|
|
166
|
+
declarations: [StockComponent],
|
|
167
|
+
imports: [
|
|
168
|
+
JsonBuilderComponent,
|
|
169
|
+
SharedModule,
|
|
170
|
+
ElementsModule,
|
|
171
|
+
WebgetsModule,
|
|
172
|
+
RouterModule.forChild([{ path: '', component: StockComponent }]),
|
|
173
|
+
],
|
|
174
|
+
}]
|
|
175
|
+
}] });
|
|
176
|
+
|
|
177
|
+
export { StockModule };
|
|
178
|
+
//# sourceMappingURL=isaiahiroko-tilmart-ngx-apps-admin-stock.module-BFbm7118.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isaiahiroko-tilmart-ngx-apps-admin-stock.module-BFbm7118.mjs","sources":["../../../projects/admin/src/lib/pages/stock/stock.component.ts","../../../projects/admin/src/lib/pages/_shared/simple-crud.component.html","../../../projects/admin/src/lib/pages/stock/stock.module.ts"],"sourcesContent":["import { Component } from '@angular/core';\nimport { notify, using } from '@thescaffold/ngx-core';\nimport { catchError, firstValueFrom, of, takeUntil } from 'rxjs';\nimport { CrudFieldSpec, SimpleCrudDirective } from '../_shared/simple-crud.base';\n\nconst UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;\n\n// R1 production-readiness pass — CAT-08 (partial). Was a flat read-only\n// table; this makes available/reserved/incoming/threshold/policy\n// editable directly. Reason-coded adjustment history, transfers between\n// locations and serial-number registers are real, separate scope (no\n// `StockAdjustment`-style entity exists yet — that's a new audit-trail\n// feature, not a form to add) — most new variant/location stock rows\n// still get created from the Catalogue product editor, which has proper\n// variant/location pickers; this page is for adjusting an existing row.\n@Component({\n standalone: false,\n selector: 'x-stock',\n templateUrl: '../_shared/simple-crud.component.html',\n styleUrl: '../_shared/simple-crud.component.scss',\n})\nexport class StockComponent extends SimpleCrudDirective {\n private readonly locationSource = this.apiService.on('apps/commerce/stock-location');\n private readonly variantSource = this.apiService.on('apps/commerce/product-variant');\n private readonly productSource = this.apiService.on('apps/commerce/product');\n\n // Rows reference a variant and a location by id; these caches turn them\n // into \"Product · SKU\" and the location's name.\n private readonly variants = new Map<string, { sku?: string; productId?: string }>();\n private readonly products = new Map<string, string>();\n private readonly locations = new Map<string, string>();\n\n protected pageTitle = 'Stock';\n protected pageSubtitle = 'Per-variant, per-location levels — available, reserved and incoming.';\n protected singularLabel = 'stock level';\n protected pluralName = 'stock';\n protected dataSource = this.apiService.on('apps/commerce/stock-level');\n\n protected columns = [\n { key: 'productLabel', value: 'Product' },\n { key: 'skuLabel', value: 'SKU' },\n { key: 'locationLabel', value: 'Location' },\n { key: 'available', value: 'Available' },\n { key: 'reserved', value: 'Reserved' },\n { key: 'incoming', value: 'Incoming' },\n { key: 'levelHtml', value: 'Level' },\n ];\n\n protected fields: CrudFieldSpec[] = [\n { key: 'variantId', label: 'Variant SKU (or id)', type: 'text', required: true, placeholder: 'e.g. MUST-PV18-5548' },\n { key: 'locationId', label: 'Location', type: 'select', optionsKey: 'locations', required: true },\n { key: 'available', label: 'Available', type: 'number' },\n { key: 'reserved', label: 'Reserved', type: 'number' },\n { key: 'incoming', label: 'Incoming', type: 'number' },\n { key: 'lowStockThreshold', label: 'Low-stock threshold', type: 'number' },\n { key: 'leadTimeDays', label: 'Lead time (days)', type: 'number' },\n {\n key: 'outOfStockPolicy',\n label: 'Out-of-stock policy',\n type: 'select',\n options: [\n { value: 'hide', label: 'Hide' },\n { value: 'show', label: 'Show (sold out)' },\n { value: 'backorder', label: 'Backorder' },\n { value: 'preorder', label: 'Preorder' },\n ],\n },\n ];\n\n override init = () => {\n this.list();\n this.locationSource\n .getMany({ page: 1, perPage: 100 } as any)\n .pipe(takeUntil(this.$))\n .subscribe(\n using((response: any) => {\n const rows: any[] = response?.data ?? [];\n rows.forEach((l) => this.locations.set(l.id, l.name));\n this.dynamicOptions['locations'] = rows.map((l: any) => ({\n value: l.id,\n label: l.name,\n }));\n // Location names may arrive after the first page rendered.\n if (this.list$.value) this.list(this.page, this.perPage, this.query);\n }),\n );\n };\n\n protected override async enrichRows(rows: any[]): Promise<void> {\n const variantIds = [...new Set(rows.map((r) => r.variantId).filter((id) => id && !this.variants.has(id)))];\n await Promise.all(\n variantIds.map(async (id: string) => {\n const v = await this.byId(this.variantSource, id);\n this.variants.set(id, { sku: v?.sku, productId: v?.productId });\n }),\n );\n const productIds = [\n ...new Set(\n rows\n .map((r) => this.variants.get(r.variantId)?.productId)\n .filter((id): id is string => !!id && !this.products.has(id)),\n ),\n ];\n await Promise.all(\n productIds.map(async (id) => {\n this.products.set(id, (await this.byId(this.productSource, id))?.name ?? '');\n }),\n );\n // The picker list holds the first 100 sites; look up any others.\n const locationIds = [...new Set(rows.map((r) => r.locationId).filter((id) => id && !this.locations.has(id)))];\n await Promise.all(\n locationIds.map(async (id: string) => {\n this.locations.set(id, (await this.byId(this.locationSource, id))?.name ?? '');\n }),\n );\n }\n\n // A list call filtered by id answers 200 with no rows for a deleted\n // record, where `getOne` would 404 (and log a console error) for each.\n private async byId(source: any, id: string): Promise<any | null> {\n const res: any = await firstValueFrom(\n source.getMany({ id, page: 1, perPage: 1 } as any).pipe(catchError(() => of(null))),\n );\n return (res?.data ?? []).find((r: any) => r.id === id) ?? null;\n }\n\n protected override mapRow(row: any): any {\n const variant = this.variants.get(row.variantId);\n const free = Number(row.available ?? 0) - Number(row.reserved ?? 0);\n const threshold = row.lowStockThreshold != null ? Number(row.lowStockThreshold) : 5;\n const level =\n free <= 0\n ? '<span class=\"x-status x-status-danger\">Out</span>'\n : free <= threshold\n ? '<span class=\"x-status x-status-warn\">Low</span>'\n : '<span class=\"x-status x-status-success\">OK</span>';\n return {\n ...row,\n // Empty name = the record was deleted (stock rows outlive their product / site).\n productLabel: (variant?.productId && this.products.get(variant.productId)) || 'Removed product',\n skuLabel: variant?.sku || '—',\n locationLabel: this.locations.get(row.locationId) || 'Removed location',\n levelHtml: level,\n };\n }\n\n // New rows can name the variant by SKU; it's swapped for the id here.\n override async save(): Promise<void> {\n const ref = `${this.draft?.['variantId'] ?? ''}`.trim();\n if (this.draft && ref && !UUID.test(ref)) {\n const res: any = await firstValueFrom(\n this.variantSource.getMany({ sku: ref, page: 1, perPage: 1 } as any).pipe(catchError(() => of(null))),\n );\n const match = (res?.data ?? []).find((v: any) => v.sku === ref);\n if (!match) {\n notify(`No variant has the SKU \"${ref}\".`, undefined, 'error');\n return;\n }\n this.draft['variantId'] = match.id;\n }\n return super.save();\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 { StockComponent } from './stock.component';\nimport { JsonBuilderComponent } from '../_shared/rule-builders/json-builder.component';\n\n@NgModule({\n declarations: [StockComponent],\n imports: [\n JsonBuilderComponent,\n SharedModule,\n ElementsModule,\n WebgetsModule,\n RouterModule.forChild([{ path: '', component: StockComponent }]),\n ],\n})\nexport class StockModule {}\n"],"names":["i1.JsonBuilderComponent","i2","i3","i4","i1"],"mappings":";;;;;;;;;;;;AAKA,MAAM,IAAI,GAAG,iEAAiE;AAE9E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAOM,MAAO,cAAe,SAAQ,mBAAmB,CAAA;AANvD,IAAA,WAAA,GAAA;;QAOmB,IAAA,CAAA,cAAc,GAAG,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,8BAA8B,CAAC;QACnE,IAAA,CAAA,aAAa,GAAG,IAAI,CAAC,UAAU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A,EAAA,CAAA;kBAVvB,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACR,YAAY,EAAE,CAAC,cAAc,CAAC;AAC9B,oBAAA,OAAO,EAAE;wBACP,oBAAoB;wBACpB,YAAY;wBACZ,cAAc;wBACd,aAAa;AACb,wBAAA,YAAY,CAAC,QAAQ,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC,CAAC;AACjE,qBAAA;AACF,iBAAA;;;;;"}
|
|
@@ -5,7 +5,7 @@ import { RouterModule } from '@angular/router';
|
|
|
5
5
|
import { SharedModule } from '@thescaffold/ngx-core';
|
|
6
6
|
import * as i2 from '@thescaffold/ngx-ui';
|
|
7
7
|
import { ElementsModule, WebgetsModule } from '@thescaffold/ngx-ui';
|
|
8
|
-
import { L as ListPageDirective } from './isaiahiroko-tilmart-ngx-apps-admin-list-page.base-
|
|
8
|
+
import { L as ListPageDirective } from './isaiahiroko-tilmart-ngx-apps-admin-list-page.base-ChfiBo_X.mjs';
|
|
9
9
|
import * as i3 from '@angular/common';
|
|
10
10
|
|
|
11
11
|
// Read-only, searchable User browser (docs/PLAN_2.md Phase 10 req #25) - no
|
|
@@ -83,4 +83,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.16", ngImpo
|
|
|
83
83
|
}] });
|
|
84
84
|
|
|
85
85
|
export { UsersModule };
|
|
86
|
-
//# sourceMappingURL=isaiahiroko-tilmart-ngx-apps-admin-users.module-
|
|
86
|
+
//# sourceMappingURL=isaiahiroko-tilmart-ngx-apps-admin-users.module-C8nNzJ5X.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isaiahiroko-tilmart-ngx-apps-admin-users.module-
|
|
1
|
+
{"version":3,"file":"isaiahiroko-tilmart-ngx-apps-admin-users.module-C8nNzJ5X.mjs","sources":["../../../projects/admin/src/lib/pages/users/users.component.ts","../../../projects/admin/src/lib/pages/users/users.module.ts"],"sourcesContent":["import { Component } from '@angular/core';\nimport { ListPageDirective } from '../_shared/list-page.base';\n\n// Read-only, searchable User browser (docs/PLAN_2.md Phase 10 req #25) - no\n// list/detail existed anywhere in Tilmart's admin before this. Deliberately\n// thin: identity's own vendor \"people\" Angular pages (ngx-apps/projects/\n// identity/src/lib/pages/people/) are workspace-team-membership management\n// (\"invite a teammate to my workspace\", backed by apps/identity/role-type),\n// the wrong shape entirely for \"browse every registered buyer platform-\n// wide\" - so this is a fresh page against apps/identity/user directly,\n// matching this app's established x-webget-collection pattern (routes,\n// inbox, payments) rather than pulling in that vendor module.\n@Component({\n standalone: false,\n selector: 'x-users',\n template: `\n <div class=\"x-page-head\">\n <div class=\"x-page-title\">Users</div>\n <div class=\"x-page-subtitle\">Every registered account, across all workspaces.</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 UsersComponent extends ListPageDirective {\n name = 'user';\n protected pluralName = 'users';\n protected dataSource = this.apiService.on('apps/identity/user');\n\n protected columns = [\n { key: 'ref', value: 'Email / phone' },\n { key: 'type', value: 'Type', type: 'class', class: 'badge text-bg-light border' },\n { key: 'createdAt', value: 'Joined', type: 'date' },\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 { UsersComponent } from './users.component';\n\n@NgModule({\n declarations: [UsersComponent],\n imports: [\n SharedModule,\n ElementsModule,\n WebgetsModule,\n RouterModule.forChild([{ path: '', component: UsersComponent }]),\n ],\n})\nexport class UsersModule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