updates on the fix
This commit is contained in:
@@ -85,7 +85,7 @@ const soft = (c) => a(c, '18');
|
||||
const ring = (c) => a(c, '26');
|
||||
const edge = (c) => a(c, '55');
|
||||
|
||||
const BRAND = '#662582';
|
||||
const BRAND = '#C01227';
|
||||
const VEHICLE_TYPES = ['Bike', 'Scooter', 'Bicycle', 'Car', 'Van'];
|
||||
|
||||
const SoftPaper = (props) => (
|
||||
@@ -199,20 +199,30 @@ const ClientsPricing = () => {
|
||||
|
||||
const tenantMap = useMemo(() => new Map((tenants || []).map((t) => [t.tenantid, t])), [tenants]);
|
||||
const locationMap = useMemo(
|
||||
() => new Map((locations || []).filter((l) => l.applocationid).map((l) => [l.applocationid, l])),
|
||||
() => new Map((locations || []).filter((l) => l.applocationid).map((l) => [String(l.applocationid), l])),
|
||||
[locations]
|
||||
);
|
||||
const locationOptions = useMemo(() => (locations || []).filter((l) => l.applocationid), [locations]);
|
||||
|
||||
const tenantName = (row) => row.tenantname || tenantMap.get(row.tenantid)?.tenantname || (row.tenantid ? `Tenant #${row.tenantid}` : '—');
|
||||
const zoneName = (row) =>
|
||||
row.applocation || locationMap.get(row.applocationid)?.locationname || (row.applocationid ? `Zone #${row.applocationid}` : '—');
|
||||
row.applocation ||
|
||||
locationMap.get(String(row.applocationid))?.locationname ||
|
||||
(row.applocationid ? `Zone #${row.applocationid}` : '—');
|
||||
|
||||
// getallpricing() takes no zone arg (see api.js) — the LocationAutocomplete
|
||||
// only ever changed the header subtitle text, not which rows were shown.
|
||||
// Filter client-side instead; pricing rows already carry applocationid
|
||||
// (used by zoneName above), so this is the same real field, just applied.
|
||||
const zonePricing = useMemo(() => (appId ? pricing.filter((r) => r.applocationid === appId) : pricing), [pricing, appId]);
|
||||
// Compared as strings — applocationid on a pricing row (GET /admin/pricing)
|
||||
// and on a hub/location (GET /admin/hubs, what the picker's appId comes
|
||||
// from) are two independently-serialized resources with no guarantee they
|
||||
// agree on number-vs-string; a raw === silently zeroed out every row
|
||||
// whenever they didn't match, making the table look empty for any zone.
|
||||
const zonePricing = useMemo(
|
||||
() => (appId ? pricing.filter((r) => String(r.applocationid) === String(appId)) : pricing),
|
||||
[pricing, appId]
|
||||
);
|
||||
|
||||
const rows = useMemo(() => {
|
||||
if (!debouncedSearch) return zonePricing;
|
||||
|
||||
Reference in New Issue
Block a user