@voyant-travel/operations-react 0.19.0 → 0.19.2
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/dist/availability/components/availability-rule-detail-page.d.ts +5 -5
- package/dist/availability/components/availability-slot-detail-page.d.ts +5 -5
- package/dist/availability/components/availability-start-time-detail-page.d.ts +5 -5
- package/dist/availability/hooks/use-availability-batch-mutations.d.ts +2 -2
- package/dist/availability/hooks/use-availability-overview.d.ts +1 -1
- package/dist/availability/hooks/use-availability-slot-mutation.d.ts +3 -3
- package/dist/availability/hooks/use-slots.d.ts +1 -1
- package/dist/availability/query-options.d.ts +12 -12
- package/dist/availability/schemas.d.ts +6 -6
- package/dist/places/hooks/use-facilities.d.ts +1 -1
- package/dist/places/hooks/use-facility-feature-mutation.d.ts +2 -2
- package/dist/places/hooks/use-facility-features.d.ts +1 -1
- package/dist/places/hooks/use-facility-mutation.d.ts +4 -4
- package/dist/places/hooks/use-facility.d.ts +1 -1
- package/dist/places/hooks/use-property-group-mutation.d.ts +6 -6
- package/dist/places/hooks/use-property-group.d.ts +2 -2
- package/dist/places/hooks/use-property-groups.d.ts +2 -2
- package/dist/places/query-options.d.ts +32 -32
- package/dist/resources/admin/detail-hosts.d.ts.map +1 -1
- package/dist/resources/admin/detail-hosts.js +97 -22
- package/dist/resources/admin/resources-dialogs-ops.d.ts +3 -2
- package/dist/resources/admin/resources-dialogs-ops.d.ts.map +1 -1
- package/dist/resources/admin/resources-dialogs-ops.js +44 -6
- package/dist/resources/admin/resources-dialogs.d.ts.map +1 -1
- package/dist/resources/admin/resources-dialogs.js +1 -1
- package/dist/resources/components/resource-allocation-detail-page.d.ts +2 -1
- package/dist/resources/components/resource-allocation-detail-page.d.ts.map +1 -1
- package/dist/resources/components/resource-allocation-detail-page.js +2 -2
- package/dist/resources/components/resource-assignment-detail-page.d.ts +2 -1
- package/dist/resources/components/resource-assignment-detail-page.d.ts.map +1 -1
- package/dist/resources/components/resource-assignment-detail-page.js +4 -3
- package/dist/resources/components/resource-detail-page.d.ts +2 -1
- package/dist/resources/components/resource-detail-page.d.ts.map +1 -1
- package/dist/resources/components/resource-detail-page.js +6 -3
- package/dist/resources/components/resource-detail-shared.d.ts +2 -1
- package/dist/resources/components/resource-detail-shared.d.ts.map +1 -1
- package/dist/resources/components/resource-detail-shared.js +3 -3
- package/dist/resources/components/resource-pool-detail-page.d.ts +5 -1
- package/dist/resources/components/resource-pool-detail-page.d.ts.map +1 -1
- package/dist/resources/components/resource-pool-detail-page.js +38 -8
- package/dist/resources/components/resources-overview.d.ts +3 -2
- package/dist/resources/components/resources-overview.d.ts.map +1 -1
- package/dist/resources/components/resources-overview.js +2 -1
- package/dist/resources/components/resources-page.d.ts.map +1 -1
- package/dist/resources/components/resources-page.js +45 -9
- package/dist/resources/components/resources-tabs-primary.d.ts.map +1 -1
- package/dist/resources/components/resources-tabs-primary.js +28 -19
- package/dist/resources/components/resources-tabs-secondary.d.ts +2 -1
- package/dist/resources/components/resources-tabs-secondary.d.ts.map +1 -1
- package/dist/resources/components/resources-tabs-secondary.js +22 -9
- package/dist/resources/hooks/use-assignment.d.ts +1 -2
- package/dist/resources/hooks/use-assignment.d.ts.map +1 -1
- package/dist/resources/hooks/use-assignments.d.ts +1 -0
- package/dist/resources/hooks/use-assignments.d.ts.map +1 -1
- package/dist/resources/hooks/use-pool.d.ts +1 -1
- package/dist/resources/hooks/use-pools.d.ts +1 -1
- package/dist/resources/hooks/use-resource.d.ts +1 -1
- package/dist/resources/hooks/use-resources.d.ts +1 -1
- package/dist/resources/i18n/en.d.ts.map +1 -1
- package/dist/resources/i18n/en.js +8 -0
- package/dist/resources/i18n/messages.d.ts +8 -0
- package/dist/resources/i18n/messages.d.ts.map +1 -1
- package/dist/resources/i18n/ro.d.ts.map +1 -1
- package/dist/resources/i18n/ro.js +8 -0
- package/dist/resources/i18n/utils.d.ts +2 -1
- package/dist/resources/i18n/utils.d.ts.map +1 -1
- package/dist/resources/i18n/utils.js +3 -1
- package/dist/resources/query-options.d.ts +24 -24
- package/dist/resources/query-options.d.ts.map +1 -1
- package/dist/resources/schemas.d.ts +13 -13
- package/dist/resources/schemas.d.ts.map +1 -1
- package/dist/resources/schemas.js +2 -4
- package/package.json +10 -10
|
@@ -8,9 +8,10 @@ export interface ResourceAssignmentDetailPageProps {
|
|
|
8
8
|
deleting?: boolean;
|
|
9
9
|
onBack?: () => void;
|
|
10
10
|
onDelete?: (assignment: ResourceSlotAssignmentDetail) => Promise<void> | void;
|
|
11
|
+
onEdit?: (assignment: ResourceSlotAssignmentDetail) => void;
|
|
11
12
|
onOpenResource?: (resourceId: string) => void;
|
|
12
13
|
onOpenSlot?: (slotId: string) => void;
|
|
13
14
|
confirmAction?: ConfirmAction;
|
|
14
15
|
}
|
|
15
|
-
export declare function ResourceAssignmentDetailPage({ className, confirmAction, deleting, id, onBack, onDelete, onOpenResource, onOpenSlot, }: ResourceAssignmentDetailPageProps): import("react").JSX.Element;
|
|
16
|
+
export declare function ResourceAssignmentDetailPage({ className, confirmAction, deleting, id, onBack, onDelete, onEdit, onOpenResource, onOpenSlot, }: ResourceAssignmentDetailPageProps): import("react").JSX.Element;
|
|
16
17
|
//# sourceMappingURL=resource-assignment-detail-page.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resource-assignment-detail-page.d.ts","sourceRoot":"","sources":["../../../src/resources/components/resource-assignment-detail-page.tsx"],"names":[],"mappings":"AAMA,OAAO,EAEL,KAAK,4BAA4B,EAOlC,MAAM,aAAa,CAAA;AACpB,OAAO,EACL,KAAK,aAAa,EAKnB,MAAM,6BAA6B,CAAA;AACpC,OAAO,EAAE,gCAAgC,EAAE,MAAM,gCAAgC,CAAA;AAMjF,OAAO,EAAE,gCAAgC,EAAE,CAAA;AAE3C,MAAM,WAAW,iCAAiC;IAChD,EAAE,EAAE,MAAM,CAAA;IACV,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAA;IACnB,QAAQ,CAAC,EAAE,CAAC,UAAU,EAAE,4BAA4B,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;IAC7E,cAAc,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAA;IAC7C,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAA;IACrC,aAAa,CAAC,EAAE,aAAa,CAAA;CAC9B;AAED,wBAAgB,4BAA4B,CAAC,EAC3C,SAAS,EACT,aAAa,EACb,QAAQ,EACR,EAAE,EACF,MAAM,EACN,QAAQ,EACR,cAAc,EACd,UAAU,GACX,EAAE,iCAAiC,+
|
|
1
|
+
{"version":3,"file":"resource-assignment-detail-page.d.ts","sourceRoot":"","sources":["../../../src/resources/components/resource-assignment-detail-page.tsx"],"names":[],"mappings":"AAMA,OAAO,EAEL,KAAK,4BAA4B,EAOlC,MAAM,aAAa,CAAA;AACpB,OAAO,EACL,KAAK,aAAa,EAKnB,MAAM,6BAA6B,CAAA;AACpC,OAAO,EAAE,gCAAgC,EAAE,MAAM,gCAAgC,CAAA;AAMjF,OAAO,EAAE,gCAAgC,EAAE,CAAA;AAE3C,MAAM,WAAW,iCAAiC;IAChD,EAAE,EAAE,MAAM,CAAA;IACV,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAA;IACnB,QAAQ,CAAC,EAAE,CAAC,UAAU,EAAE,4BAA4B,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;IAC7E,MAAM,CAAC,EAAE,CAAC,UAAU,EAAE,4BAA4B,KAAK,IAAI,CAAA;IAC3D,cAAc,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAA;IAC7C,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAA;IACrC,aAAa,CAAC,EAAE,aAAa,CAAA;CAC9B;AAED,wBAAgB,4BAA4B,CAAC,EAC3C,SAAS,EACT,aAAa,EACb,QAAQ,EACR,EAAE,EACF,MAAM,EACN,QAAQ,EACR,MAAM,EACN,cAAc,EACd,UAAU,GACX,EAAE,iCAAiC,+BAiInC"}
|
|
@@ -12,7 +12,7 @@ import { ResourceAssignmentDetailSkeleton } from "./resource-detail-skeletons.js
|
|
|
12
12
|
// `pendingComponent` without pinning this page module into the workspace
|
|
13
13
|
// chrome chunk. Re-exported here for backwards compatibility.
|
|
14
14
|
export { ResourceAssignmentDetailSkeleton };
|
|
15
|
-
export function ResourceAssignmentDetailPage({ className, confirmAction, deleting, id, onBack, onDelete, onOpenResource, onOpenSlot, }) {
|
|
15
|
+
export function ResourceAssignmentDetailPage({ className, confirmAction, deleting, id, onBack, onDelete, onEdit, onOpenResource, onOpenSlot, }) {
|
|
16
16
|
const i18n = useResourcesUiI18nOrDefault();
|
|
17
17
|
const m = i18n.messages;
|
|
18
18
|
const page = m.detailPages;
|
|
@@ -37,14 +37,15 @@ export function ResourceAssignmentDetailPage({ className, confirmAction, deletin
|
|
|
37
37
|
? formatResourceSlotLabel(slot, {
|
|
38
38
|
template: m.common.slotLabel,
|
|
39
39
|
formatDate: i18n.formatDate,
|
|
40
|
+
products: productsQuery.data?.data ?? [],
|
|
40
41
|
})
|
|
41
42
|
: assignment.slotId;
|
|
42
|
-
return (_jsxs("div", { "data-slot": "resource-assignment-detail-page", className: cn("flex flex-col gap-6 p-6", className), children: [_jsx(ResourceDetailHeader, { title: page.assignment.pageTitle, deleteConfirmName: assignment.id, deleteConfirmTemplate: page.assignment.deleteConfirm, deleteErrorMessage: page.assignment.deleteFailed, deleting: deleting, confirmAction: confirmAction, onBack: onBack, onDelete: onDelete ? () => onDelete(assignment) : undefined, badges: _jsxs(_Fragment, { children: [_jsx(Badge, { variant: "outline", children: m.common.assignmentStatusLabels[assignment.status] }), _jsx(Badge, { variant: "secondary", children: slotLabel })] }), actions: _jsxs(_Fragment, { children: [onOpenSlot ? (_jsxs(Button, { type: "button", variant: "outline", onClick: () => onOpenSlot(assignment.slotId), children: [_jsx(CalendarDays, { "data-icon": "inline-start", "aria-hidden": "true" }), page.common.openSlot] })) : null, assignment.resourceId && onOpenResource ? (_jsxs(Button, { type: "button", variant: "outline", onClick: () => onOpenResource(assignment.resourceId), children: [_jsx(Wrench, { "data-icon": "inline-start", "aria-hidden": "true" }), page.common.openResource] })) : null] }) }), _jsx(ResourceDetailCard, { title: page.assignment.detailsTitle, children: _jsxs("div", { className: "grid gap-3 md:grid-cols-2", children: [_jsx(ResourceDetailField, { label: page.common.slot, children: slotLabel }), _jsx(ResourceDetailField, { label: page.common.product, children: slot?.productId
|
|
43
|
+
return (_jsxs("div", { "data-slot": "resource-assignment-detail-page", className: cn("flex flex-col gap-6 p-6", className), children: [_jsx(ResourceDetailHeader, { title: page.assignment.pageTitle, deleteConfirmName: assignment.id, deleteConfirmTemplate: page.assignment.deleteConfirm, deleteErrorMessage: page.assignment.deleteFailed, deleting: deleting, confirmAction: confirmAction, onBack: onBack, onDelete: onDelete ? () => onDelete(assignment) : undefined, onEdit: onEdit ? () => onEdit(assignment) : undefined, badges: _jsxs(_Fragment, { children: [_jsx(Badge, { variant: "outline", children: m.common.assignmentStatusLabels[assignment.status] }), _jsx(Badge, { variant: "secondary", children: slotLabel })] }), actions: _jsxs(_Fragment, { children: [onOpenSlot ? (_jsxs(Button, { type: "button", variant: "outline", onClick: () => onOpenSlot(assignment.slotId), children: [_jsx(CalendarDays, { "data-icon": "inline-start", "aria-hidden": "true" }), page.common.openSlot] })) : null, assignment.resourceId && onOpenResource ? (_jsxs(Button, { type: "button", variant: "outline", onClick: () => onOpenResource(assignment.resourceId), children: [_jsx(Wrench, { "data-icon": "inline-start", "aria-hidden": "true" }), page.common.openResource] })) : null] }) }), _jsx(ResourceDetailCard, { title: page.assignment.detailsTitle, children: _jsxs("div", { className: "grid gap-3 md:grid-cols-2", children: [_jsx(ResourceDetailField, { label: page.common.slot, children: slotLabel }), _jsx(ResourceDetailField, { label: page.common.product, children: slot?.productId
|
|
43
44
|
? labelById(productsQuery.data?.data ?? [], slot.productId)
|
|
44
45
|
: page.common.noValue }), _jsx(ResourceDetailField, { label: page.common.pool, children: poolQuery.data?.name ?? assignment.poolId ?? page.common.noPool }), _jsx(ResourceDetailField, { label: page.common.resource, children: resourceQuery.data?.name ?? assignment.resourceId ?? page.common.noResource }), _jsx(ResourceDetailField, { label: page.common.booking, children: assignment.bookingId
|
|
45
46
|
? labelById(bookingsQuery.data?.data ?? [], assignment.bookingId)
|
|
46
47
|
: page.common.noBooking }), _jsx(ResourceDetailField, { label: page.assignment.assignedBy, children: assignment.assignedBy ?? page.common.noValue }), _jsx(ResourceDetailField, { label: page.assignment.released, children: formatDateTimeOrFallback(assignment.releasedAt, {
|
|
47
48
|
fallback: page.common.noValue,
|
|
48
49
|
formatDateTime: i18n.formatDateTime,
|
|
49
|
-
}) }), _jsx(ResourceDetailField, { label: page.
|
|
50
|
+
}) }), _jsx(ResourceDetailField, { label: page.assignment.assignedAt, children: i18n.formatDateTime(assignment.assignedAt) })] }) }), assignment.notes ? (_jsx(ResourceDetailCard, { title: page.common.notes, children: _jsx("p", { className: "whitespace-pre-wrap", children: assignment.notes }) })) : null] }));
|
|
50
51
|
}
|
|
@@ -8,11 +8,12 @@ export interface ResourceDetailPageProps {
|
|
|
8
8
|
deleting?: boolean;
|
|
9
9
|
onBack?: () => void;
|
|
10
10
|
onDelete?: (resource: ResourceDetail) => Promise<void> | void;
|
|
11
|
+
onEdit?: (resource: ResourceDetail) => void;
|
|
11
12
|
onOpenSupplier?: (supplierId: string) => void;
|
|
12
13
|
onOpenAssignment?: (assignmentId: string) => void;
|
|
13
14
|
confirmAction?: ConfirmAction;
|
|
14
15
|
}
|
|
15
|
-
export declare function ResourceDetailPage({ className, confirmAction, deleting, id, onBack, onDelete, onOpenAssignment, onOpenSupplier, }: ResourceDetailPageProps): import("react").JSX.Element;
|
|
16
|
+
export declare function ResourceDetailPage({ className, confirmAction, deleting, id, onBack, onDelete, onEdit, onOpenAssignment, onOpenSupplier, }: ResourceDetailPageProps): import("react").JSX.Element;
|
|
16
17
|
export declare function ResourceAssignmentSummary({ assignment, bookingLabel, noValue, onOpenAssignment, pool, slotLabel, }: {
|
|
17
18
|
assignment: ResourceSlotAssignmentRow;
|
|
18
19
|
bookingLabel: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resource-detail-page.d.ts","sourceRoot":"","sources":["../../../src/resources/components/resource-detail-page.tsx"],"names":[],"mappings":"AAcA,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,yBAAyB,
|
|
1
|
+
{"version":3,"file":"resource-detail-page.d.ts","sourceRoot":"","sources":["../../../src/resources/components/resource-detail-page.tsx"],"names":[],"mappings":"AAcA,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,yBAAyB,EAS/B,MAAM,aAAa,CAAA;AAEpB,OAAO,EACL,KAAK,aAAa,EAKnB,MAAM,6BAA6B,CAAA;AACpC,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAA;AAMvE,OAAO,EAAE,sBAAsB,EAAE,CAAA;AAEjC,MAAM,WAAW,uBAAuB;IACtC,EAAE,EAAE,MAAM,CAAA;IACV,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAA;IACnB,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,cAAc,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;IAC7D,MAAM,CAAC,EAAE,CAAC,QAAQ,EAAE,cAAc,KAAK,IAAI,CAAA;IAC3C,cAAc,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAA;IAC7C,gBAAgB,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,IAAI,CAAA;IACjD,aAAa,CAAC,EAAE,aAAa,CAAA;CAC9B;AAED,wBAAgB,kBAAkB,CAAC,EACjC,SAAS,EACT,aAAa,EACb,QAAQ,EACR,EAAE,EACF,MAAM,EACN,QAAQ,EACR,MAAM,EACN,gBAAgB,EAChB,cAAc,GACf,EAAE,uBAAuB,+BAuMzB;AAMD,wBAAgB,yBAAyB,CAAC,EACxC,UAAU,EACV,YAAY,EACZ,OAAO,EACP,gBAAgB,EAChB,IAAI,EACJ,SAAS,GACV,EAAE;IACD,UAAU,EAAE,yBAAyB,CAAA;IACrC,YAAY,EAAE,MAAM,CAAA;IACpB,OAAO,EAAE,MAAM,CAAA;IACf,gBAAgB,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,IAAI,CAAA;IACjD,IAAI,CAAC,EAAE,eAAe,GAAG,SAAS,CAAA;IAClC,SAAS,EAAE,MAAM,CAAA;CAClB,+BA4CA"}
|
|
@@ -4,7 +4,7 @@ import { Badge, Button, Card, CardContent, CardHeader, CardTitle, cn, } from "@v
|
|
|
4
4
|
import { Package, Users, Wrench } from "lucide-react";
|
|
5
5
|
import { useResourcesUiI18nOrDefault } from "../i18n/index.js";
|
|
6
6
|
import { formatDateTimeOrFallback, formatResourceSlotLabel } from "../i18n/utils.js";
|
|
7
|
-
import { labelById, useAssignments, useBookings, useCloseouts, usePools, useResource, useSlots, useSuppliers, } from "../index.js";
|
|
7
|
+
import { labelById, useAssignments, useBookings, useCloseouts, usePools, useProducts, useResource, useSlots, useSuppliers, } from "../index.js";
|
|
8
8
|
import { useResourcePoolMembers } from "./resource-detail-data.js";
|
|
9
9
|
import { ResourceDetailCard, ResourceDetailField, ResourceDetailHeader, ResourceDetailState, } from "./resource-detail-shared.js";
|
|
10
10
|
import { ResourceDetailSkeleton } from "./resource-detail-skeletons.js";
|
|
@@ -13,7 +13,7 @@ import { ResourceDetailSkeleton } from "./resource-detail-skeletons.js";
|
|
|
13
13
|
// `pendingComponent` without pinning this page module into the workspace
|
|
14
14
|
// chrome chunk. Re-exported here for backwards compatibility.
|
|
15
15
|
export { ResourceDetailSkeleton };
|
|
16
|
-
export function ResourceDetailPage({ className, confirmAction, deleting, id, onBack, onDelete, onOpenAssignment, onOpenSupplier, }) {
|
|
16
|
+
export function ResourceDetailPage({ className, confirmAction, deleting, id, onBack, onDelete, onEdit, onOpenAssignment, onOpenSupplier, }) {
|
|
17
17
|
const i18n = useResourcesUiI18nOrDefault();
|
|
18
18
|
const m = i18n.messages;
|
|
19
19
|
const page = m.detailPages;
|
|
@@ -24,6 +24,7 @@ export function ResourceDetailPage({ className, confirmAction, deleting, id, onB
|
|
|
24
24
|
const assignmentsQuery = useAssignmentsByResource(id);
|
|
25
25
|
const slotsQuery = useSlots({ limit: 25 });
|
|
26
26
|
const bookingsQuery = useBookings({ limit: 25 });
|
|
27
|
+
const productsQuery = useProducts({ limit: 25 });
|
|
27
28
|
const closeoutsQuery = useCloseouts({ resourceId: id, limit: 25 });
|
|
28
29
|
if (resourceQuery.isPending) {
|
|
29
30
|
return _jsx(ResourceDetailSkeleton, {});
|
|
@@ -38,19 +39,21 @@ export function ResourceDetailPage({ className, confirmAction, deleting, id, onB
|
|
|
38
39
|
const pools = poolsQuery.data?.data ?? [];
|
|
39
40
|
const slots = slotsQuery.data?.data ?? [];
|
|
40
41
|
const bookings = bookingsQuery.data?.data ?? [];
|
|
42
|
+
const products = productsQuery.data?.data ?? [];
|
|
41
43
|
const poolsById = new Map(pools.map((pool) => [pool.id, pool]));
|
|
42
44
|
const slotsById = new Map(slots.map((slot) => [slot.id, slot]));
|
|
43
45
|
const bookingsById = new Map(bookings.map((booking) => [booking.id, booking]));
|
|
44
46
|
const supplierLabel = resource.supplierId
|
|
45
47
|
? labelById(suppliersQuery.data?.data ?? [], resource.supplierId)
|
|
46
48
|
: page.resource.noSupplierAssigned;
|
|
47
|
-
return (_jsxs("div", { "data-slot": "resource-detail-page", className: cn("flex flex-col gap-6 p-6", className), children: [_jsx(ResourceDetailHeader, { title: resource.name, deleteConfirmName: resource.name, deleteConfirmTemplate: page.resource.deleteConfirm, deleteErrorMessage: page.resource.deleteFailed, deleting: deleting, confirmAction: confirmAction, onBack: onBack, onDelete: onDelete ? () => onDelete(resource) : undefined, badges: _jsxs(_Fragment, { children: [_jsx(Badge, { variant: "outline", children: m.common.resourceKindLabels[resource.kind] }), _jsx(Badge, { variant: resource.active ? "default" : "secondary", children: resource.active ? m.common.active : m.common.inactive })] }), actions: resource.supplierId && onOpenSupplier ? (_jsxs(Button, { type: "button", variant: "outline", onClick: () => onOpenSupplier(resource.supplierId), children: [_jsx(Users, { "data-icon": "inline-start", "aria-hidden": "true" }), page.common.openSupplier] })) : null }), _jsxs("div", { className: "grid gap-6 md:grid-cols-2", children: [_jsxs(ResourceDetailCard, { title: page.resource.detailsTitle, children: [_jsx(ResourceDetailField, { label: page.common.supplier, children: supplierLabel }), _jsx(ResourceDetailField, { label: page.common.code, children: resource.code ?? page.common.noValue }), _jsx(ResourceDetailField, { label: page.common.capacity, children: resource.capacity ?? page.common.noValue }), _jsx(ResourceDetailField, { label: page.common.created, children: i18n.formatDateTime(resource.createdAt) }), _jsx(ResourceDetailField, { label: page.common.updated, children: i18n.formatDateTime(resource.updatedAt) })] }), resource.notes ? (_jsx(ResourceDetailCard, { title: page.common.notes, children: _jsx("p", { className: "whitespace-pre-wrap", children: resource.notes }) })) : null] }), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "flex flex-row items-center gap-2", children: [_jsx(Package, { className: "size-4", "aria-hidden": "true" }), _jsx(CardTitle, { children: page.resource.poolMembershipsTitle })] }), _jsx(CardContent, { className: "flex flex-col gap-3 text-sm", children: (poolMembersQuery.data?.data.length ?? 0) === 0 ? (_jsx("p", { className: "text-muted-foreground", children: page.resource.poolMembershipsEmpty })) : (poolMembersQuery.data?.data.map((member) => {
|
|
49
|
+
return (_jsxs("div", { "data-slot": "resource-detail-page", className: cn("flex flex-col gap-6 p-6", className), children: [_jsx(ResourceDetailHeader, { title: resource.name, deleteConfirmName: resource.name, deleteConfirmTemplate: page.resource.deleteConfirm, deleteErrorMessage: page.resource.deleteFailed, deleting: deleting, confirmAction: confirmAction, onBack: onBack, onDelete: onDelete ? () => onDelete(resource) : undefined, onEdit: onEdit ? () => onEdit(resource) : undefined, badges: _jsxs(_Fragment, { children: [_jsx(Badge, { variant: "outline", children: m.common.resourceKindLabels[resource.kind] }), _jsx(Badge, { variant: resource.active ? "default" : "secondary", children: resource.active ? m.common.active : m.common.inactive })] }), actions: resource.supplierId && onOpenSupplier ? (_jsxs(Button, { type: "button", variant: "outline", onClick: () => onOpenSupplier(resource.supplierId), children: [_jsx(Users, { "data-icon": "inline-start", "aria-hidden": "true" }), page.common.openSupplier] })) : null }), _jsxs("div", { className: "grid gap-6 md:grid-cols-2", children: [_jsxs(ResourceDetailCard, { title: page.resource.detailsTitle, children: [_jsx(ResourceDetailField, { label: page.common.supplier, children: supplierLabel }), _jsx(ResourceDetailField, { label: page.common.code, children: resource.code ?? page.common.noValue }), _jsx(ResourceDetailField, { label: page.common.capacity, children: resource.capacity ?? page.common.noValue }), _jsx(ResourceDetailField, { label: page.common.created, children: i18n.formatDateTime(resource.createdAt) }), _jsx(ResourceDetailField, { label: page.common.updated, children: i18n.formatDateTime(resource.updatedAt) })] }), resource.notes ? (_jsx(ResourceDetailCard, { title: page.common.notes, children: _jsx("p", { className: "whitespace-pre-wrap", children: resource.notes }) })) : null] }), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "flex flex-row items-center gap-2", children: [_jsx(Package, { className: "size-4", "aria-hidden": "true" }), _jsx(CardTitle, { children: page.resource.poolMembershipsTitle })] }), _jsx(CardContent, { className: "flex flex-col gap-3 text-sm", children: (poolMembersQuery.data?.data.length ?? 0) === 0 ? (_jsx("p", { className: "text-muted-foreground", children: page.resource.poolMembershipsEmpty })) : (poolMembersQuery.data?.data.map((member) => {
|
|
48
50
|
const pool = poolsById.get(member.poolId);
|
|
49
51
|
return (_jsxs("div", { className: "rounded-md border p-3", children: [_jsx("div", { className: "font-medium", children: pool?.name ?? member.poolId }), _jsxs("div", { className: "text-muted-foreground", children: [page.common.product, ": ", pool?.productId ?? page.common.noValue] })] }, member.id));
|
|
50
52
|
})) })] }), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "flex flex-row items-center gap-2", children: [_jsx(Wrench, { className: "size-4", "aria-hidden": "true" }), _jsx(CardTitle, { children: page.resource.assignmentsTitle })] }), _jsx(CardContent, { className: "flex flex-col gap-3 text-sm", children: (assignmentsQuery.data?.data.length ?? 0) === 0 ? (_jsx("p", { className: "text-muted-foreground", children: page.resource.assignmentsEmpty })) : (assignmentsQuery.data?.data.map((assignment) => (_jsx(ResourceAssignmentSummary, { assignment: assignment, pool: undefined, slotLabel: slotsById.get(assignment.slotId)
|
|
51
53
|
? formatResourceSlotLabel(slotsById.get(assignment.slotId), {
|
|
52
54
|
template: m.common.slotLabel,
|
|
53
55
|
formatDate: i18n.formatDate,
|
|
56
|
+
products,
|
|
54
57
|
})
|
|
55
58
|
: assignment.slotId, bookingLabel: bookingsById.get(assignment.bookingId ?? "")?.bookingNumber ??
|
|
56
59
|
assignment.bookingId ??
|
|
@@ -15,7 +15,7 @@ export declare function ResourceDetailCard({ children, className, title, }: {
|
|
|
15
15
|
className?: string;
|
|
16
16
|
title: string;
|
|
17
17
|
}): import("react").JSX.Element;
|
|
18
|
-
export declare function ResourceDetailHeader({ actions, badges, className, confirmAction, deleteConfirmName, deleteConfirmTemplate, deleteErrorMessage, deleting: deletingProp, onBack, onDelete, title, }: {
|
|
18
|
+
export declare function ResourceDetailHeader({ actions, badges, className, confirmAction, deleteConfirmName, deleteConfirmTemplate, deleteErrorMessage, deleting: deletingProp, onBack, onDelete, onEdit, title, }: {
|
|
19
19
|
actions?: ReactNode;
|
|
20
20
|
badges?: ReactNode;
|
|
21
21
|
className?: string;
|
|
@@ -26,6 +26,7 @@ export declare function ResourceDetailHeader({ actions, badges, className, confi
|
|
|
26
26
|
deleting?: boolean;
|
|
27
27
|
onBack?: () => void;
|
|
28
28
|
onDelete?: () => Promise<void> | void;
|
|
29
|
+
onEdit?: () => void;
|
|
29
30
|
title: string;
|
|
30
31
|
}): import("react").JSX.Element;
|
|
31
32
|
export declare function ResourceDetailSkeleton({ actionCount, detailRows, showNotes, stackedCards, }: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resource-detail-shared.d.ts","sourceRoot":"","sources":["../../../src/resources/components/resource-detail-shared.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAKtC,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAA;AAExD,eAAO,MAAM,oBAAoB,EAAE,aACI,CAAA;AAEvC,wBAAgB,mBAAmB,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,SAAS,CAAA;CAAE,+BAO9F;AAED,wBAAgB,mBAAmB,CAAC,EAClC,SAAS,EACT,OAAO,EACP,MAAM,GACP,EAAE;IACD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,CAAC,EAAE,MAAM,IAAI,CAAA;CACpB,+BAaA;AAED,wBAAgB,kBAAkB,CAAC,EACjC,QAAQ,EACR,SAAS,EACT,KAAK,GACN,EAAE;IACD,QAAQ,EAAE,SAAS,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,KAAK,EAAE,MAAM,CAAA;CACd,+BASA;AAED,wBAAgB,oBAAoB,CAAC,EACnC,OAAO,EACP,MAAM,EACN,SAAS,EACT,aAAoC,EACpC,iBAAiB,EACjB,qBAAqB,EACrB,kBAAkB,EAClB,QAAQ,EAAE,YAAY,EACtB,MAAM,EACN,QAAQ,EACR,KAAK,GACN,EAAE;IACD,OAAO,CAAC,EAAE,SAAS,CAAA;IACnB,MAAM,CAAC,EAAE,SAAS,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,aAAa,CAAC,EAAE,aAAa,CAAA;IAC7B,iBAAiB,EAAE,MAAM,CAAA;IACzB,qBAAqB,EAAE,MAAM,CAAA;IAC7B,kBAAkB,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAA;IACnB,QAAQ,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;IACrC,KAAK,EAAE,MAAM,CAAA;CACd,+
|
|
1
|
+
{"version":3,"file":"resource-detail-shared.d.ts","sourceRoot":"","sources":["../../../src/resources/components/resource-detail-shared.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAKtC,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAA;AAExD,eAAO,MAAM,oBAAoB,EAAE,aACI,CAAA;AAEvC,wBAAgB,mBAAmB,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,SAAS,CAAA;CAAE,+BAO9F;AAED,wBAAgB,mBAAmB,CAAC,EAClC,SAAS,EACT,OAAO,EACP,MAAM,GACP,EAAE;IACD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,CAAC,EAAE,MAAM,IAAI,CAAA;CACpB,+BAaA;AAED,wBAAgB,kBAAkB,CAAC,EACjC,QAAQ,EACR,SAAS,EACT,KAAK,GACN,EAAE;IACD,QAAQ,EAAE,SAAS,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,KAAK,EAAE,MAAM,CAAA;CACd,+BASA;AAED,wBAAgB,oBAAoB,CAAC,EACnC,OAAO,EACP,MAAM,EACN,SAAS,EACT,aAAoC,EACpC,iBAAiB,EACjB,qBAAqB,EACrB,kBAAkB,EAClB,QAAQ,EAAE,YAAY,EACtB,MAAM,EACN,QAAQ,EACR,MAAM,EACN,KAAK,GACN,EAAE;IACD,OAAO,CAAC,EAAE,SAAS,CAAA;IACnB,MAAM,CAAC,EAAE,SAAS,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,aAAa,CAAC,EAAE,aAAa,CAAA;IAC7B,iBAAiB,EAAE,MAAM,CAAA;IACzB,qBAAqB,EAAE,MAAM,CAAA;IAC7B,kBAAkB,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAA;IACnB,QAAQ,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;IACrC,MAAM,CAAC,EAAE,MAAM,IAAI,CAAA;IACnB,KAAK,EAAE,MAAM,CAAA;CACd,+BAmEA;AAED,wBAAgB,sBAAsB,CAAC,EACrC,WAAW,EACX,UAAU,EACV,SAAgB,EAChB,YAAgB,GACjB,EAAE;IACD,WAAW,EAAE,MAAM,CAAA;IACnB,UAAU,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB,+BA8EA"}
|
|
@@ -3,7 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import { formatMessage } from "@voyant-travel/i18n";
|
|
4
4
|
import { Button, Card, CardContent, CardHeader, CardTitle, cn } from "@voyant-travel/ui/components";
|
|
5
5
|
import { Skeleton } from "@voyant-travel/ui/components/skeleton";
|
|
6
|
-
import { ArrowLeft, Loader2, Trash2 } from "lucide-react";
|
|
6
|
+
import { ArrowLeft, Loader2, Pencil, Trash2 } from "lucide-react";
|
|
7
7
|
import { useState } from "react";
|
|
8
8
|
import { useResourcesUiMessagesOrDefault } from "../i18n/index.js";
|
|
9
9
|
export const defaultConfirmAction = (message) => globalThis.confirm?.(message) ?? true;
|
|
@@ -17,7 +17,7 @@ export function ResourceDetailState({ className, message, onBack, }) {
|
|
|
17
17
|
export function ResourceDetailCard({ children, className, title, }) {
|
|
18
18
|
return (_jsxs(Card, { className: className, children: [_jsx(CardHeader, { children: _jsx(CardTitle, { children: title }) }), _jsx(CardContent, { className: "flex flex-col gap-3 text-sm", children: children })] }));
|
|
19
19
|
}
|
|
20
|
-
export function ResourceDetailHeader({ actions, badges, className, confirmAction = defaultConfirmAction, deleteConfirmName, deleteConfirmTemplate, deleteErrorMessage, deleting: deletingProp, onBack, onDelete, title, }) {
|
|
20
|
+
export function ResourceDetailHeader({ actions, badges, className, confirmAction = defaultConfirmAction, deleteConfirmName, deleteConfirmTemplate, deleteErrorMessage, deleting: deletingProp, onBack, onDelete, onEdit, title, }) {
|
|
21
21
|
const messages = useResourcesUiMessagesOrDefault();
|
|
22
22
|
const [deletingState, setDeletingState] = useState(false);
|
|
23
23
|
const [deleteError, setDeleteError] = useState(null);
|
|
@@ -40,7 +40,7 @@ export function ResourceDetailHeader({ actions, badges, className, confirmAction
|
|
|
40
40
|
setDeletingState(false);
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
|
-
return (_jsxs("div", { className: cn("flex flex-col gap-3", className), children: [_jsxs("div", { className: "flex flex-col gap-4 md:flex-row md:items-start md:justify-between", children: [_jsxs("div", { className: "flex min-w-0 items-start gap-3", children: [onBack ? (_jsxs(Button, { type: "button", variant: "ghost", size: "icon", onClick: onBack, children: [_jsx(ArrowLeft, { "aria-hidden": "true" }), _jsx("span", { className: "sr-only", children: messages.detailPages.common.backToResources })] })) : null, _jsxs("div", { className: "min-w-0 flex-1", children: [_jsx("h1", { className: "truncate text-2xl font-bold tracking-tight", children: title }), badges ? _jsx("div", { className: "mt-1 flex flex-wrap items-center gap-2", children: badges }) : null] })] }), _jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [actions, onDelete ? (_jsxs(Button, { type: "button", variant: "destructive", onClick: () => void handleDelete(), disabled: deleting, children: [deleting ? (_jsx(Loader2, { "data-icon": "inline-start", className: "animate-spin", "aria-hidden": "true" })) : (_jsx(Trash2, { "data-icon": "inline-start", "aria-hidden": "true" })), messages.detailPages.common.delete] })) : null] })] }), deleteError ? _jsx("p", { className: "text-sm text-destructive", children: deleteError }) : null] }));
|
|
43
|
+
return (_jsxs("div", { className: cn("flex flex-col gap-3", className), children: [_jsxs("div", { className: "flex flex-col gap-4 md:flex-row md:items-start md:justify-between", children: [_jsxs("div", { className: "flex min-w-0 items-start gap-3", children: [onBack ? (_jsxs(Button, { type: "button", variant: "ghost", size: "icon", onClick: onBack, children: [_jsx(ArrowLeft, { "aria-hidden": "true" }), _jsx("span", { className: "sr-only", children: messages.detailPages.common.backToResources })] })) : null, _jsxs("div", { className: "min-w-0 flex-1", children: [_jsx("h1", { className: "truncate text-2xl font-bold tracking-tight", children: title }), badges ? _jsx("div", { className: "mt-1 flex flex-wrap items-center gap-2", children: badges }) : null] })] }), _jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [actions, onEdit ? (_jsxs(Button, { type: "button", variant: "outline", onClick: onEdit, children: [_jsx(Pencil, { "data-icon": "inline-start", "aria-hidden": "true" }), messages.detailPages.common.edit] })) : null, onDelete ? (_jsxs(Button, { type: "button", variant: "destructive", onClick: () => void handleDelete(), disabled: deleting, children: [deleting ? (_jsx(Loader2, { "data-icon": "inline-start", className: "animate-spin", "aria-hidden": "true" })) : (_jsx(Trash2, { "data-icon": "inline-start", "aria-hidden": "true" })), messages.detailPages.common.delete] })) : null] })] }), deleteError ? _jsx("p", { className: "text-sm text-destructive", children: deleteError }) : null] }));
|
|
44
44
|
}
|
|
45
45
|
export function ResourceDetailSkeleton({ actionCount, detailRows, showNotes = true, stackedCards = 2, }) {
|
|
46
46
|
return (_jsxs("div", { className: "flex flex-col gap-6 p-6", children: [_jsxs("div", { className: "flex items-center gap-4", children: [_jsx(Skeleton, { className: "size-9 rounded-md" }), _jsxs("div", { className: "flex flex-1 flex-col gap-2", children: [_jsx(Skeleton, { className: "h-7 w-56" }), _jsxs("div", { className: "flex gap-2", children: [_jsx(Skeleton, { className: "h-5 w-16 rounded-full" }), _jsx(Skeleton, { className: "h-5 w-20 rounded-full" })] })] }), Array.from({ length: actionCount }).map((_, index) => (_jsx(Skeleton
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type ResourceAllocationRow, type ResourcePoolDetail } from "../index.js";
|
|
2
|
+
import type { ResourcePoolMemberRow } from "./resource-detail-data.js";
|
|
2
3
|
import { type ConfirmAction } from "./resource-detail-shared.js";
|
|
3
4
|
import { ResourcePoolDetailSkeleton } from "./resource-detail-skeletons.js";
|
|
4
5
|
export { ResourcePoolDetailSkeleton };
|
|
@@ -8,13 +9,16 @@ export interface ResourcePoolDetailPageProps {
|
|
|
8
9
|
deleting?: boolean;
|
|
9
10
|
onBack?: () => void;
|
|
10
11
|
onDelete?: (pool: ResourcePoolDetail) => Promise<void> | void;
|
|
12
|
+
onEdit?: (pool: ResourcePoolDetail) => void;
|
|
13
|
+
onAddMember?: (pool: ResourcePoolDetail, resourceId: string) => Promise<void> | void;
|
|
14
|
+
onRemoveMember?: (member: ResourcePoolMemberRow) => Promise<void> | void;
|
|
11
15
|
onOpenAllocation?: (allocationId: string) => void;
|
|
12
16
|
onOpenProduct?: (productId: string) => void;
|
|
13
17
|
onOpenResource?: (resourceId: string) => void;
|
|
14
18
|
onOpenAssignment?: (assignmentId: string) => void;
|
|
15
19
|
confirmAction?: ConfirmAction;
|
|
16
20
|
}
|
|
17
|
-
export declare function ResourcePoolDetailPage({ className, confirmAction, deleting, id, onBack, onDelete, onOpenAllocation, onOpenAssignment, onOpenProduct, onOpenResource, }: ResourcePoolDetailPageProps): import("react").JSX.Element;
|
|
21
|
+
export declare function ResourcePoolDetailPage({ className, confirmAction, deleting, id, onBack, onDelete, onEdit, onAddMember, onOpenAllocation, onOpenAssignment, onOpenProduct, onOpenResource, onRemoveMember, }: ResourcePoolDetailPageProps): import("react").JSX.Element;
|
|
18
22
|
export declare function PoolAllocationSummary({ allocation, onOpenAllocation, }: {
|
|
19
23
|
allocation: ResourceAllocationRow;
|
|
20
24
|
onOpenAllocation?: (allocationId: string) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resource-pool-detail-page.d.ts","sourceRoot":"","sources":["../../../src/resources/components/resource-pool-detail-page.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"resource-pool-detail-page.d.ts","sourceRoot":"","sources":["../../../src/resources/components/resource-pool-detail-page.tsx"],"names":[],"mappings":"AAoBA,OAAO,EAEL,KAAK,qBAAqB,EAC1B,KAAK,kBAAkB,EAQxB,MAAM,aAAa,CAAA;AACpB,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAA;AAGtE,OAAO,EACL,KAAK,aAAa,EAKnB,MAAM,6BAA6B,CAAA;AACpC,OAAO,EAAE,0BAA0B,EAAE,MAAM,gCAAgC,CAAA;AAM3E,OAAO,EAAE,0BAA0B,EAAE,CAAA;AAErC,MAAM,WAAW,2BAA2B;IAC1C,EAAE,EAAE,MAAM,CAAA;IACV,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAA;IACnB,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,kBAAkB,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;IAC7D,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,kBAAkB,KAAK,IAAI,CAAA;IAC3C,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;IACpF,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,qBAAqB,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;IACxE,gBAAgB,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,IAAI,CAAA;IACjD,aAAa,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAA;IAC3C,cAAc,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAA;IAC7C,gBAAgB,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,IAAI,CAAA;IACjD,aAAa,CAAC,EAAE,aAAa,CAAA;CAC9B;AAED,wBAAgB,sBAAsB,CAAC,EACrC,SAAS,EACT,aAAa,EACb,QAAQ,EACR,EAAE,EACF,MAAM,EACN,QAAQ,EACR,MAAM,EACN,WAAW,EACX,gBAAgB,EAChB,gBAAgB,EAChB,aAAa,EACb,cAAc,EACd,cAAc,GACf,EAAE,2BAA2B,+BAgR7B;AAED,wBAAgB,qBAAqB,CAAC,EACpC,UAAU,EACV,gBAAgB,GACjB,EAAE;IACD,UAAU,EAAE,qBAAqB,CAAA;IACjC,gBAAgB,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,IAAI,CAAA;CAClD,+BAsCA"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { Badge, Button, Card, CardContent, CardHeader, CardTitle, cn, } from "@voyant-travel/ui/components";
|
|
4
|
-
import { Package, Users, Wrench } from "lucide-react";
|
|
3
|
+
import { Badge, Button, Card, CardContent, CardHeader, CardTitle, cn, Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from "@voyant-travel/ui/components";
|
|
4
|
+
import { Loader2, Package, Plus, Trash2, Users, Wrench } from "lucide-react";
|
|
5
|
+
import { useState } from "react";
|
|
5
6
|
import { useResourcesUiI18nOrDefault } from "../i18n/index.js";
|
|
6
7
|
import { formatResourceSlotLabel } from "../i18n/utils.js";
|
|
7
8
|
import { labelById, useAllocations, useAssignments, useBookings, usePool, useProducts, useResources, useSlots, } from "../index.js";
|
|
@@ -14,7 +15,7 @@ import { ResourcePoolDetailSkeleton } from "./resource-detail-skeletons.js";
|
|
|
14
15
|
// `pendingComponent` without pinning this page module into the workspace
|
|
15
16
|
// chrome chunk. Re-exported here for backwards compatibility.
|
|
16
17
|
export { ResourcePoolDetailSkeleton };
|
|
17
|
-
export function ResourcePoolDetailPage({ className, confirmAction, deleting, id, onBack, onDelete, onOpenAllocation, onOpenAssignment, onOpenProduct, onOpenResource, }) {
|
|
18
|
+
export function ResourcePoolDetailPage({ className, confirmAction, deleting, id, onBack, onDelete, onEdit, onAddMember, onOpenAllocation, onOpenAssignment, onOpenProduct, onOpenResource, onRemoveMember, }) {
|
|
18
19
|
const i18n = useResourcesUiI18nOrDefault();
|
|
19
20
|
const m = i18n.messages;
|
|
20
21
|
const page = m.detailPages;
|
|
@@ -26,6 +27,8 @@ export function ResourcePoolDetailPage({ className, confirmAction, deleting, id,
|
|
|
26
27
|
const assignmentsQuery = useAssignments({ poolId: id, limit: 25 });
|
|
27
28
|
const slotsQuery = useSlots({ limit: 25 });
|
|
28
29
|
const bookingsQuery = useBookings({ limit: 25 });
|
|
30
|
+
const [selectedResourceId, setSelectedResourceId] = useState("");
|
|
31
|
+
const [memberMutationId, setMemberMutationId] = useState(null);
|
|
29
32
|
if (poolQuery.isPending) {
|
|
30
33
|
return _jsx(ResourcePoolDetailSkeleton, {});
|
|
31
34
|
}
|
|
@@ -43,16 +46,43 @@ export function ResourcePoolDetailPage({ className, confirmAction, deleting, id,
|
|
|
43
46
|
const resourcesById = new Map(resources.map((resource) => [resource.id, resource]));
|
|
44
47
|
const slotsById = new Map(slots.map((slot) => [slot.id, slot]));
|
|
45
48
|
const bookingsById = new Map(bookings.map((booking) => [booking.id, booking]));
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
const members = membersQuery.data?.data ?? [];
|
|
50
|
+
const memberResourceIds = new Set(members.map((member) => member.resourceId));
|
|
51
|
+
const addableResources = resources.filter((resource) => !memberResourceIds.has(resource.id));
|
|
52
|
+
async function handleAddMember() {
|
|
53
|
+
if (!onAddMember || !selectedResourceId)
|
|
54
|
+
return;
|
|
55
|
+
setMemberMutationId("add");
|
|
56
|
+
try {
|
|
57
|
+
await onAddMember(pool, selectedResourceId);
|
|
58
|
+
setSelectedResourceId("");
|
|
59
|
+
}
|
|
60
|
+
finally {
|
|
61
|
+
setMemberMutationId(null);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
async function handleRemoveMember(member) {
|
|
65
|
+
if (!onRemoveMember)
|
|
66
|
+
return;
|
|
67
|
+
setMemberMutationId(member.id);
|
|
68
|
+
try {
|
|
69
|
+
await onRemoveMember(member);
|
|
70
|
+
}
|
|
71
|
+
finally {
|
|
72
|
+
setMemberMutationId(null);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return (_jsxs("div", { "data-slot": "resource-pool-detail-page", className: cn("flex flex-col gap-6 p-6", className), children: [_jsx(ResourceDetailHeader, { title: pool.name, deleteConfirmName: pool.name, deleteConfirmTemplate: page.pool.deleteConfirm, deleteErrorMessage: page.pool.deleteFailed, deleting: deleting, confirmAction: confirmAction, onBack: onBack, onDelete: onDelete ? () => onDelete(pool) : undefined, onEdit: onEdit ? () => onEdit(pool) : undefined, badges: _jsxs(_Fragment, { children: [_jsx(Badge, { variant: "outline", children: m.common.resourceKindLabels[pool.kind] }), _jsx(Badge, { variant: pool.active ? "default" : "secondary", children: pool.active ? m.common.active : m.common.inactive })] }), actions: pool.productId && onOpenProduct ? (_jsxs(Button, { type: "button", variant: "outline", onClick: () => onOpenProduct(pool.productId), children: [_jsx(Package, { "data-icon": "inline-start", "aria-hidden": "true" }), page.common.openProduct] })) : null }), _jsxs("div", { className: "grid gap-6 md:grid-cols-2", children: [_jsxs(ResourceDetailCard, { title: page.pool.detailsTitle, children: [_jsx(ResourceDetailField, { label: page.common.product, children: pool.productId ? labelById(products, pool.productId) : page.common.noValue }), _jsx(ResourceDetailField, { label: page.pool.sharedCapacity, children: pool.sharedCapacity ?? page.common.noValue }), _jsx(ResourceDetailField, { label: page.common.created, children: i18n.formatDateTime(pool.createdAt) }), _jsx(ResourceDetailField, { label: page.common.updated, children: i18n.formatDateTime(pool.updatedAt) })] }), pool.notes ? (_jsx(ResourceDetailCard, { title: page.common.notes, children: _jsx("p", { className: "whitespace-pre-wrap", children: pool.notes }) })) : null] }), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "flex flex-row items-center gap-2", children: [_jsx(Users, { className: "size-4", "aria-hidden": "true" }), _jsx(CardTitle, { children: page.pool.membersTitle })] }), _jsxs(CardContent, { className: "flex flex-col gap-3 text-sm", children: [onAddMember ? (_jsxs("div", { className: "flex flex-col gap-2 rounded-md border p-3 sm:flex-row sm:items-center", children: [_jsxs(Select, { value: selectedResourceId, onValueChange: (value) => setSelectedResourceId(value ?? ""), children: [_jsx(SelectTrigger, { className: "min-w-0 flex-1", children: _jsx(SelectValue, { placeholder: page.pool.addMemberPlaceholder }) }), _jsx(SelectContent, { children: addableResources.length === 0 ? (_jsx(SelectItem, { value: "__none", disabled: true, children: page.pool.memberAlreadyAssigned })) : (addableResources.map((resource) => (_jsx(SelectItem, { value: resource.id, children: resource.name }, resource.id)))) })] }), _jsxs(Button, { type: "button", onClick: () => void handleAddMember(), disabled: !selectedResourceId || memberMutationId === "add", children: [memberMutationId === "add" ? (_jsx(Loader2, { "data-icon": "inline-start", className: "animate-spin", "aria-hidden": "true" })) : (_jsx(Plus, { "data-icon": "inline-start", "aria-hidden": "true" })), page.pool.addMember] })] })) : null, members.length === 0 ? (_jsx("p", { className: "text-muted-foreground", children: page.pool.membersEmpty })) : (members.map((member) => {
|
|
76
|
+
const resource = resourcesById.get(member.resourceId);
|
|
77
|
+
const body = (_jsxs(_Fragment, { children: [_jsx("div", { className: "font-medium", children: resource?.name ?? member.resourceId }), _jsxs("div", { className: "text-muted-foreground", children: [resource ? m.common.resourceKindLabels[resource.kind] : page.pool.noResource, " · ", resource?.active ? m.common.active : m.common.inactive] })] }));
|
|
78
|
+
return (_jsxs("div", { className: "flex items-start gap-2 rounded-md border p-3", children: [onOpenResource && resource ? (_jsx("button", { type: "button", className: "min-w-0 flex-1 text-left hover:text-primary", onClick: () => onOpenResource(resource.id), children: body })) : (_jsx("div", { className: "min-w-0 flex-1", children: body })), onRemoveMember ? (_jsxs(Button, { type: "button", variant: "ghost", size: "sm", onClick: () => void handleRemoveMember(member), disabled: memberMutationId === member.id, children: [memberMutationId === member.id ? (_jsx(Loader2, { "data-icon": "inline-start", className: "animate-spin", "aria-hidden": "true" })) : (_jsx(Trash2, { "data-icon": "inline-start", "aria-hidden": "true" })), page.pool.removeMember] })) : null] }, member.id));
|
|
79
|
+
}))] })] }), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "flex flex-row items-center gap-2", children: [_jsx(Package, { className: "size-4", "aria-hidden": "true" }), _jsx(CardTitle, { children: page.pool.allocationsTitle })] }), _jsx(CardContent, { className: "flex flex-col gap-3 text-sm", children: (allocationsQuery.data?.data.length ?? 0) === 0 ? (_jsx("p", { className: "text-muted-foreground", children: page.pool.allocationsEmpty })) : (allocationsQuery.data?.data.map((allocation) => (_jsx(PoolAllocationSummary, { allocation: allocation, onOpenAllocation: onOpenAllocation }, allocation.id)))) })] }), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "flex flex-row items-center gap-2", children: [_jsx(Wrench, { className: "size-4", "aria-hidden": "true" }), _jsx(CardTitle, { children: page.pool.liveAssignmentsTitle })] }), _jsx(CardContent, { className: "flex flex-col gap-3 text-sm", children: (assignmentsQuery.data?.data.length ?? 0) === 0 ? (_jsx("p", { className: "text-muted-foreground", children: page.pool.liveAssignmentsEmpty })) : (assignmentsQuery.data?.data.map((assignment) => (_jsx(ResourceAssignmentSummary, { assignment: assignment, bookingLabel: bookingsById.get(assignment.bookingId ?? "")?.bookingNumber ??
|
|
51
80
|
assignment.bookingId ??
|
|
52
81
|
page.common.noBooking, noValue: page.common.noValue, slotLabel: slotsById.get(assignment.slotId)
|
|
53
82
|
? formatResourceSlotLabel(slotsById.get(assignment.slotId), {
|
|
54
83
|
template: m.common.slotLabel,
|
|
55
84
|
formatDate: i18n.formatDate,
|
|
85
|
+
products,
|
|
56
86
|
})
|
|
57
87
|
: assignment.slotId, onOpenAssignment: onOpenAssignment }, assignment.id)))) })] })] }));
|
|
58
88
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type { BookingOption, ResourceCloseoutRow, ResourceRow, ResourceSlotAssignmentRow, SlotOption } from "../index.js";
|
|
2
|
-
export declare function ResourcesOverview({ bookings, slots, closeouts, filteredResources, filteredPools, liveAssignments, resourcesWithoutSupplier, unassignedReservations, search, setSearch, kindFilter, setKindFilter, hasFilters, onClearFilters, onOpenAssignment, onOpenResource, showFilters, }: {
|
|
1
|
+
import type { BookingOption, ProductOption, ResourceCloseoutRow, ResourceRow, ResourceSlotAssignmentRow, SlotOption } from "../index.js";
|
|
2
|
+
export declare function ResourcesOverview({ bookings, products, slots, closeouts, filteredResources, filteredPools, liveAssignments, resourcesWithoutSupplier, unassignedReservations, search, setSearch, kindFilter, setKindFilter, hasFilters, onClearFilters, onOpenAssignment, onOpenResource, showFilters, }: {
|
|
3
3
|
bookings: BookingOption[];
|
|
4
|
+
products?: ProductOption[];
|
|
4
5
|
slots: SlotOption[];
|
|
5
6
|
closeouts: ResourceCloseoutRow[];
|
|
6
7
|
filteredResources: ResourceRow[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resources-overview.d.ts","sourceRoot":"","sources":["../../../src/resources/components/resources-overview.tsx"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EACV,aAAa,EACb,mBAAmB,EACnB,WAAW,EACX,yBAAyB,EACzB,UAAU,EACX,MAAM,aAAa,CAAA;AAGpB,wBAAgB,iBAAiB,CAAC,EAChC,QAAQ,EACR,KAAK,EACL,SAAS,EACT,iBAAiB,EACjB,aAAa,EACb,eAAe,EACf,wBAAwB,EACxB,sBAAsB,EACtB,MAAM,EACN,SAAS,EACT,UAAU,EACV,aAAa,EACb,UAAU,EACV,cAAc,EACd,gBAAgB,EAChB,cAAc,EACd,WAAkB,GACnB,EAAE;IACD,QAAQ,EAAE,aAAa,EAAE,CAAA;IACzB,KAAK,EAAE,UAAU,EAAE,CAAA;IACnB,SAAS,EAAE,mBAAmB,EAAE,CAAA;IAChC,iBAAiB,EAAE,WAAW,EAAE,CAAA;IAChC,aAAa,EAAE,KAAK,CAAC;QAAE,MAAM,EAAE,OAAO,CAAA;KAAE,CAAC,CAAA;IACzC,eAAe,EAAE,yBAAyB,EAAE,CAAA;IAC5C,wBAAwB,EAAE,WAAW,EAAE,CAAA;IACvC,sBAAsB,EAAE,yBAAyB,EAAE,CAAA;IACnD,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IAClC,UAAU,EAAE,MAAM,CAAA;IAClB,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACtC,UAAU,EAAE,OAAO,CAAA;IACnB,cAAc,EAAE,MAAM,IAAI,CAAA;IAC1B,gBAAgB,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,IAAI,CAAA;IAChD,cAAc,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAA;IAC5C;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB,+
|
|
1
|
+
{"version":3,"file":"resources-overview.d.ts","sourceRoot":"","sources":["../../../src/resources/components/resources-overview.tsx"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EACV,aAAa,EACb,aAAa,EACb,mBAAmB,EACnB,WAAW,EACX,yBAAyB,EACzB,UAAU,EACX,MAAM,aAAa,CAAA;AAGpB,wBAAgB,iBAAiB,CAAC,EAChC,QAAQ,EACR,QAAa,EACb,KAAK,EACL,SAAS,EACT,iBAAiB,EACjB,aAAa,EACb,eAAe,EACf,wBAAwB,EACxB,sBAAsB,EACtB,MAAM,EACN,SAAS,EACT,UAAU,EACV,aAAa,EACb,UAAU,EACV,cAAc,EACd,gBAAgB,EAChB,cAAc,EACd,WAAkB,GACnB,EAAE;IACD,QAAQ,EAAE,aAAa,EAAE,CAAA;IACzB,QAAQ,CAAC,EAAE,aAAa,EAAE,CAAA;IAC1B,KAAK,EAAE,UAAU,EAAE,CAAA;IACnB,SAAS,EAAE,mBAAmB,EAAE,CAAA;IAChC,iBAAiB,EAAE,WAAW,EAAE,CAAA;IAChC,aAAa,EAAE,KAAK,CAAC;QAAE,MAAM,EAAE,OAAO,CAAA;KAAE,CAAC,CAAA;IACzC,eAAe,EAAE,yBAAyB,EAAE,CAAA;IAC5C,wBAAwB,EAAE,WAAW,EAAE,CAAA;IACvC,sBAAsB,EAAE,yBAAyB,EAAE,CAAA;IACnD,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IAClC,UAAU,EAAE,MAAM,CAAA;IAClB,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACtC,UAAU,EAAE,OAAO,CAAA;IACnB,cAAc,EAAE,MAAM,IAAI,CAAA;IAC1B,gBAAgB,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,IAAI,CAAA;IAChD,cAAc,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAA;IAC5C;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB,+BAmJA"}
|
|
@@ -5,7 +5,7 @@ import { CalendarDays, ExternalLink, Search, Users, Wrench } from "lucide-react"
|
|
|
5
5
|
import { useResourcesUiI18nOrDefault } from "../i18n/index.js";
|
|
6
6
|
import { formatResourceSlotLabel, RESOURCE_KIND_VALUES } from "../i18n/utils.js";
|
|
7
7
|
import { labelById } from "../index.js";
|
|
8
|
-
export function ResourcesOverview({ bookings, slots, closeouts, filteredResources, filteredPools, liveAssignments, resourcesWithoutSupplier, unassignedReservations, search, setSearch, kindFilter, setKindFilter, hasFilters, onClearFilters, onOpenAssignment, onOpenResource, showFilters = true, }) {
|
|
8
|
+
export function ResourcesOverview({ bookings, products = [], slots, closeouts, filteredResources, filteredPools, liveAssignments, resourcesWithoutSupplier, unassignedReservations, search, setSearch, kindFilter, setKindFilter, hasFilters, onClearFilters, onOpenAssignment, onOpenResource, showFilters = true, }) {
|
|
9
9
|
const i18n = useResourcesUiI18nOrDefault();
|
|
10
10
|
const m = i18n.messages;
|
|
11
11
|
const activeResourcesCount = filteredResources.filter((resource) => resource.active).length;
|
|
@@ -22,6 +22,7 @@ export function ResourcesOverview({ bookings, slots, closeouts, filteredResource
|
|
|
22
22
|
}, {
|
|
23
23
|
template: m.common.slotLabel,
|
|
24
24
|
formatDate: i18n.formatDate,
|
|
25
|
+
products,
|
|
25
26
|
}) }), _jsx("div", { className: "text-muted-foreground", children: formatMessage(m.overview.assignmentGaps.statusBooking, {
|
|
26
27
|
status: m.common.assignmentStatusLabels[assignment.status],
|
|
27
28
|
booking: labelById(bookings, assignment.bookingId),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resources-page.d.ts","sourceRoot":"","sources":["../../../src/resources/components/resources-page.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAItC,OAAO,EAGL,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,KAAK,yBAAyB,EAE9B,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC1B,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,eAAe,EAC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AAU,EAAE,qBAAqB,KAAK,IAAI,CAAA;IAC9D,kBAAkB,CAAC,EAAE,MAAM,IAAI,CAAA;IAC/B,gBAAgB,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,IAAI,CAAA;IACjD,gBAAgB,CAAC,EAAE,CAAC,UAAU,EAAE,yBAAyB,KAAK,IAAI,CAAA;IAClE,gBAAgB,CAAC,EAAE,MAAM,IAAI,CAAA;IAC7B,cAAc,CAAC,EAAE,CAAC,QAAQ,EAAE,mBAAmB,KAAK,IAAI,CAAA;IACxD,KAAK,CAAC,EAAE,kBAAkB,CAAA;IAC1B,4FAA4F;IAC5F,YAAY,CAAC,EAAE,yBAAyB,CAAA;IACxC,mFAAmF;IACnF,eAAe,CAAC,EAAE,SAAS,CAAA;CAC5B;
|
|
1
|
+
{"version":3,"file":"resources-page.d.ts","sourceRoot":"","sources":["../../../src/resources/components/resources-page.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAItC,OAAO,EAGL,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,KAAK,yBAAyB,EAE9B,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC1B,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EAYzB,MAAM,aAAa,CAAA;AAMpB,MAAM,MAAM,gBAAgB,GAAG,WAAW,GAAG,OAAO,GAAG,aAAa,GAAG,aAAa,GAAG,WAAW,CAAA;AAElG,MAAM,MAAM,yBAAyB,GAAG,KAAK,GAAG,QAAQ,GAAG,UAAU,CAAA;AAErE,MAAM,MAAM,2BAA2B,GAAG;IACxC,GAAG,EAAE,MAAM,EAAE,CAAA;IACb,QA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C1B,4FAA4F;IAC5F,YAAY,CAAC,EAAE,yBAAyB,CAAA;IACxC,mFAAmF;IACnF,eAAe,CAAC,EAAE,SAAS,CAAA;CAC5B;AA4BD,wBAAgB,aAAa,CAAC,EAC5B,SAAS,EACT,UAAwB,EACxB,gBAAuB,EACvB,YAAY,EACZ,YAAY,EACZ,gBAAuB,EACvB,cAAuB,EACvB,cAAwB,EACxB,YAAmB,EACnB,UAAmB,EACnB,UAAoB,EACpB,kBAAyB,EACzB,gBAAyB,EACzB,gBAA0B,EAC1B,kBAAyB,EACzB,gBAAyB,EACzB,gBAA0B,EAC1B,gBAAuB,EACvB,cAAwB,EACxB,KAAK,EACL,YAAY,EACZ,eAAe,GAChB,EAAE,kBAAkB,+BA6ZpB"}
|
|
@@ -5,7 +5,7 @@ import { Popover, PopoverContent, PopoverTrigger } from "@voyant-travel/ui/compo
|
|
|
5
5
|
import { Select, SelectContent, SelectGroup, SelectItem, SelectTrigger, SelectValue, } from "@voyant-travel/ui/components/select";
|
|
6
6
|
import { Tabs, TabsList, TabsTrigger } from "@voyant-travel/ui/components/tabs";
|
|
7
7
|
import { ListFilter, Search, X } from "lucide-react";
|
|
8
|
-
import { useMemo, useState } from "react";
|
|
8
|
+
import { useEffect, useMemo, useState } from "react";
|
|
9
9
|
import { useResourcesUiI18nOrDefault } from "../i18n/index.js";
|
|
10
10
|
import { formatResourceSlotLabel, RESOURCE_KIND_VALUES } from "../i18n/utils.js";
|
|
11
11
|
import { labelById, useAllocations, useAssignments, useBookings, useCloseouts, usePools, useProducts, useResources, useRules, useSlots, useStartTimes, useSuppliers, } from "../index.js";
|
|
@@ -16,20 +16,33 @@ import { AssignmentsTab, CloseoutsTab } from "./resources-tabs-secondary.js";
|
|
|
16
16
|
const noop = () => undefined;
|
|
17
17
|
const noopId = (_id) => undefined;
|
|
18
18
|
const noopRow = (_row) => undefined;
|
|
19
|
+
const RESOURCE_PAGE_STATE_KEY = "voyant.resources.pageState";
|
|
20
|
+
function loadPersistedPageState() {
|
|
21
|
+
if (typeof window === "undefined")
|
|
22
|
+
return {};
|
|
23
|
+
try {
|
|
24
|
+
const raw = window.sessionStorage.getItem(RESOURCE_PAGE_STATE_KEY);
|
|
25
|
+
return raw ? JSON.parse(raw) : {};
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
return {};
|
|
29
|
+
}
|
|
30
|
+
}
|
|
19
31
|
export function ResourcesPage({ className, defaultTab = "resources", bulkActionTarget = null, onBulkUpdate, onBulkDelete, onResourceCreate = noop, onResourceOpen = noopId, onResourceEdit = noopRow, onPoolCreate = noop, onPoolOpen = noopId, onPoolEdit = noopRow, onAllocationCreate = noop, onAllocationOpen = noopId, onAllocationEdit = noopRow, onAssignmentCreate = noop, onAssignmentOpen = noopId, onAssignmentEdit = noopRow, onCloseoutCreate = noop, onCloseoutEdit = noopRow, slots, queryFilters, loadingFallback, }) {
|
|
20
32
|
const i18n = useResourcesUiI18nOrDefault();
|
|
21
33
|
const m = i18n.messages;
|
|
22
34
|
const page = m.resourcesPage;
|
|
23
|
-
const [
|
|
24
|
-
const [
|
|
25
|
-
const [
|
|
35
|
+
const [persistedPageState] = useState(loadPersistedPageState);
|
|
36
|
+
const [search, setSearch] = useState(persistedPageState.search ?? "");
|
|
37
|
+
const [kindFilter, setKindFilter] = useState(persistedPageState.kindFilter ?? "all");
|
|
38
|
+
const [activeTab, setActiveTab] = useState(persistedPageState.activeTab ?? defaultTab);
|
|
26
39
|
const [filterPopoverOpen, setFilterPopoverOpen] = useState(false);
|
|
27
|
-
const [supplierFilter, setSupplierFilter] = useState(null);
|
|
40
|
+
const [supplierFilter, setSupplierFilter] = useState(persistedPageState.supplierFilter ?? null);
|
|
28
41
|
const [selectedSupplierOption, setSelectedSupplierOption] = useState(null);
|
|
29
|
-
const [productFilter, setProductFilter] = useState(null);
|
|
42
|
+
const [productFilter, setProductFilter] = useState(persistedPageState.productFilter ?? null);
|
|
30
43
|
const [selectedProductOption, setSelectedProductOption] = useState(null);
|
|
31
|
-
const [activeFilter, setActiveFilter] = useState("all");
|
|
32
|
-
const [assignmentStatusFilter, setAssignmentStatusFilter] = useState("all");
|
|
44
|
+
const [activeFilter, setActiveFilter] = useState(persistedPageState.activeFilter ?? "all");
|
|
45
|
+
const [assignmentStatusFilter, setAssignmentStatusFilter] = useState(persistedPageState.assignmentStatusFilter ?? "all");
|
|
33
46
|
const [resourceSelection, setResourceSelectionState] = useState({});
|
|
34
47
|
const [poolSelection, setPoolSelectionState] = useState({});
|
|
35
48
|
const [allocationSelection, setAllocationSelectionState] = useState({});
|
|
@@ -57,6 +70,28 @@ export function ResourcesPage({ className, defaultTab = "resources", bulkActionT
|
|
|
57
70
|
const allocations = allocationsQuery.data?.data ?? [];
|
|
58
71
|
const assignments = assignmentsQuery.data?.data ?? [];
|
|
59
72
|
const closeouts = closeoutsQuery.data?.data ?? [];
|
|
73
|
+
useEffect(() => {
|
|
74
|
+
if (typeof window === "undefined")
|
|
75
|
+
return;
|
|
76
|
+
const nextState = {
|
|
77
|
+
activeTab,
|
|
78
|
+
search,
|
|
79
|
+
kindFilter,
|
|
80
|
+
activeFilter,
|
|
81
|
+
supplierFilter,
|
|
82
|
+
productFilter,
|
|
83
|
+
assignmentStatusFilter,
|
|
84
|
+
};
|
|
85
|
+
window.sessionStorage.setItem(RESOURCE_PAGE_STATE_KEY, JSON.stringify(nextState));
|
|
86
|
+
}, [
|
|
87
|
+
activeFilter,
|
|
88
|
+
activeTab,
|
|
89
|
+
assignmentStatusFilter,
|
|
90
|
+
kindFilter,
|
|
91
|
+
productFilter,
|
|
92
|
+
search,
|
|
93
|
+
supplierFilter,
|
|
94
|
+
]);
|
|
60
95
|
const kindOptions = useMemo(() => RESOURCE_KIND_VALUES.map((value) => ({
|
|
61
96
|
value,
|
|
62
97
|
label: m.common.resourceKindLabels[value],
|
|
@@ -95,6 +130,7 @@ export function ResourcesPage({ className, defaultTab = "resources", bulkActionT
|
|
|
95
130
|
}, {
|
|
96
131
|
template: m.common.slotLabel,
|
|
97
132
|
formatDate: i18n.formatDate,
|
|
133
|
+
products,
|
|
98
134
|
})));
|
|
99
135
|
});
|
|
100
136
|
const filteredCloseouts = closeouts.filter((closeout) => {
|
|
@@ -136,5 +172,5 @@ export function ResourcesPage({ className, defaultTab = "resources", bulkActionT
|
|
|
136
172
|
];
|
|
137
173
|
const isLoading = queries.some((query) => query.isPending);
|
|
138
174
|
const isError = queries.some((query) => query.isError);
|
|
139
|
-
return (_jsxs("div", { className: cn("flex flex-col gap-6 p-6", className), children: [_jsxs("div", { className: "flex flex-col gap-3 md:flex-row md:items-start md:justify-between", children: [_jsxs("div", { children: [_jsx("h1", { className: "text-2xl font-bold tracking-tight", children: page.title }), _jsx("p", { className: "text-sm text-muted-foreground", children: page.description })] }), slots?.headerEnd] }), _jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [_jsxs("div", { className: "relative min-w-[14rem] flex-1", children: [_jsx(Label, { htmlFor: "resources-search", className: "sr-only", children: page.filters.searchPlaceholder }), _jsx(Search, { className: "pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-muted-foreground", "aria-hidden": "true" }), _jsx(Input, { id: "resources-search", placeholder: page.filters.searchPlaceholder, value: search, onChange: (event) => setSearch(event.target.value), className: "pl-9" })] }), _jsxs(Select, { value: kindFilter, onValueChange: (value) => setKindFilter(value ?? "all"), children: [_jsx(SelectTrigger, { className: "w-44", children: _jsx(SelectValue, {}) }), _jsx(SelectContent, { children: _jsxs(SelectGroup, { children: [_jsx(SelectItem, { value: "all", children: m.common.allKinds }), kindOptions.map((option) => (_jsx(SelectItem, { value: option.value, children: option.label }, option.value)))] }) })] }), _jsxs(Popover, { open: filterPopoverOpen, onOpenChange: setFilterPopoverOpen, children: [_jsx(PopoverTrigger, { render: _jsxs(Button, { variant: "outline", children: [_jsx(ListFilter, { "data-icon": "inline-start", "aria-hidden": "true" }), page.filters.button, activeFilterCount > 0 ? (_jsx(Badge, { variant: "secondary", className: "ml-1 px-1.5", children: activeFilterCount })) : null] }) }), _jsx(PopoverContent, { align: "end", className: "w-[22rem] p-4", children: _jsx(ResourcesFilterPopover, { activeTab: activeTab, suppliers: suppliers, products: products, supplierFilter: supplierFilter, setSupplierFilter: setSupplierFilter, selectedSupplierOption: selectedSupplierOption, setSelectedSupplierOption: setSelectedSupplierOption, productFilter: productFilter, setProductFilter: setProductFilter, selectedProductOption: selectedProductOption, setSelectedProductOption: setSelectedProductOption, activeFilter: activeFilter, setActiveFilter: setActiveFilter, assignmentStatusFilter: assignmentStatusFilter, setAssignmentStatusFilter: setAssignmentStatusFilter }) })] }), hasFilters ? (_jsxs(Button, { variant: "ghost", size: "sm", onClick: clearAllFilters, children: [_jsx(X, { "data-icon": "inline-start", "aria-hidden": "true" }), page.filters.clear] })) : null] }), isLoading ? ((loadingFallback ?? (_jsx("div", { className: "rounded-md border p-6 text-sm text-muted-foreground", children: page.loading })))) : isError ? (_jsx("div", { className: "rounded-md border p-6 text-sm text-muted-foreground", children: page.loadFailed })) : (_jsxs(_Fragment, { children: [_jsx(ResourcesOverview, { bookings: bookings, slots: slotsData, closeouts: closeouts, filteredResources: filteredResources, filteredPools: filteredPools, liveAssignments: liveAssignments, resourcesWithoutSupplier: resourcesWithoutSupplier, unassignedReservations: unassignedReservations, search: search, setSearch: setSearch, kindFilter: kindFilter, setKindFilter: setKindFilter, hasFilters: hasFilters, onClearFilters: clearAllFilters, onOpenAssignment: onAssignmentOpen, onOpenResource: onResourceOpen, showFilters: false }), slots?.afterOverview, slots?.beforeTabs, _jsxs(Tabs, { value: activeTab, onValueChange: (value) => setActiveTab((value ?? "resources")), children: [_jsxs(TabsList, { className: "flex w-full justify-start overflow-x-auto overflow-y-hidden", children: [_jsx(TabsTrigger, { value: "resources", children: page.tabs.resources }), _jsx(TabsTrigger, { value: "pools", children: page.tabs.pools }), _jsx(TabsTrigger, { value: "allocations", children: page.tabs.allocations }), _jsx(TabsTrigger, { value: "assignments", children: page.tabs.assignments }), _jsx(TabsTrigger, { value: "closeouts", children: page.tabs.closeouts })] }), _jsx(ResourcesTab, { suppliers: suppliers, filteredResources: filteredResources, resourceSelection: resourceSelection, setResourceSelection: setResourceSelectionState, bulkActionTarget: bulkActionTarget, handleBulkUpdate: onBulkUpdate, handleBulkDelete: onBulkDelete, onCreate: onResourceCreate, onOpenRoute: onResourceOpen, onEdit: (row) => onResourceEdit(row) }), _jsx(PoolsTab, { products: products, filteredPools: filteredPools, poolSelection: poolSelection, setPoolSelection: setPoolSelectionState, bulkActionTarget: bulkActionTarget, handleBulkUpdate: onBulkUpdate, handleBulkDelete: onBulkDelete, onCreate: onPoolCreate, onOpenRoute: onPoolOpen, onEdit: (row) => onPoolEdit(row) }), _jsx(AllocationsTab, { pools: pools, products: products, filteredAllocations: filteredAllocations, allocationSelection: allocationSelection, setAllocationSelection: setAllocationSelectionState, bulkActionTarget: bulkActionTarget, handleBulkDelete: onBulkDelete, onCreate: onAllocationCreate, onOpenRoute: onAllocationOpen, onEdit: (row) => onAllocationEdit(row) }), _jsx(AssignmentsTab, { slots: slotsData, resources: resources, bookings: bookings, filteredAssignments: filteredAssignments, assignmentSelection: assignmentSelection, setAssignmentSelection: setAssignmentSelectionState, bulkActionTarget: bulkActionTarget, handleBulkUpdate: onBulkUpdate, handleBulkDelete: onBulkDelete, onCreate: onAssignmentCreate, onOpenRoute: onAssignmentOpen, onEdit: (row) => onAssignmentEdit(row) }), _jsx(CloseoutsTab, { resources: resources, filteredCloseouts: filteredCloseouts, closeoutSelection: closeoutSelection, setCloseoutSelection: setCloseoutSelectionState, bulkActionTarget: bulkActionTarget, handleBulkDelete: onBulkDelete, onCreate: onCloseoutCreate, onEdit: (row) => onCloseoutEdit(row) })] }), slots?.afterTabs] })), slots?.dialogs] }));
|
|
175
|
+
return (_jsxs("div", { className: cn("flex flex-col gap-6 p-6", className), children: [_jsxs("div", { className: "flex flex-col gap-3 md:flex-row md:items-start md:justify-between", children: [_jsxs("div", { children: [_jsx("h1", { className: "text-2xl font-bold tracking-tight", children: page.title }), _jsx("p", { className: "text-sm text-muted-foreground", children: page.description })] }), slots?.headerEnd] }), _jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [_jsxs("div", { className: "relative min-w-[14rem] flex-1", children: [_jsx(Label, { htmlFor: "resources-search", className: "sr-only", children: page.filters.searchPlaceholder }), _jsx(Search, { className: "pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-muted-foreground", "aria-hidden": "true" }), _jsx(Input, { id: "resources-search", placeholder: page.filters.searchPlaceholder, value: search, onChange: (event) => setSearch(event.target.value), className: "pl-9" })] }), _jsxs(Select, { value: kindFilter, onValueChange: (value) => setKindFilter(value ?? "all"), children: [_jsx(SelectTrigger, { className: "w-44", children: _jsx(SelectValue, {}) }), _jsx(SelectContent, { children: _jsxs(SelectGroup, { children: [_jsx(SelectItem, { value: "all", children: m.common.allKinds }), kindOptions.map((option) => (_jsx(SelectItem, { value: option.value, children: option.label }, option.value)))] }) })] }), _jsxs(Popover, { open: filterPopoverOpen, onOpenChange: setFilterPopoverOpen, children: [_jsx(PopoverTrigger, { render: _jsxs(Button, { variant: "outline", children: [_jsx(ListFilter, { "data-icon": "inline-start", "aria-hidden": "true" }), page.filters.button, activeFilterCount > 0 ? (_jsx(Badge, { variant: "secondary", className: "ml-1 px-1.5", children: activeFilterCount })) : null] }) }), _jsx(PopoverContent, { align: "end", className: "w-[22rem] p-4", children: _jsx(ResourcesFilterPopover, { activeTab: activeTab, suppliers: suppliers, products: products, supplierFilter: supplierFilter, setSupplierFilter: setSupplierFilter, selectedSupplierOption: selectedSupplierOption, setSelectedSupplierOption: setSelectedSupplierOption, productFilter: productFilter, setProductFilter: setProductFilter, selectedProductOption: selectedProductOption, setSelectedProductOption: setSelectedProductOption, activeFilter: activeFilter, setActiveFilter: setActiveFilter, assignmentStatusFilter: assignmentStatusFilter, setAssignmentStatusFilter: setAssignmentStatusFilter }) })] }), hasFilters ? (_jsxs(Button, { variant: "ghost", size: "sm", onClick: clearAllFilters, children: [_jsx(X, { "data-icon": "inline-start", "aria-hidden": "true" }), page.filters.clear] })) : null] }), isLoading ? ((loadingFallback ?? (_jsx("div", { className: "rounded-md border p-6 text-sm text-muted-foreground", children: page.loading })))) : isError ? (_jsx("div", { className: "rounded-md border p-6 text-sm text-muted-foreground", children: page.loadFailed })) : (_jsxs(_Fragment, { children: [_jsx(ResourcesOverview, { bookings: bookings, products: products, slots: slotsData, closeouts: closeouts, filteredResources: filteredResources, filteredPools: filteredPools, liveAssignments: liveAssignments, resourcesWithoutSupplier: resourcesWithoutSupplier, unassignedReservations: unassignedReservations, search: search, setSearch: setSearch, kindFilter: kindFilter, setKindFilter: setKindFilter, hasFilters: hasFilters, onClearFilters: clearAllFilters, onOpenAssignment: onAssignmentOpen, onOpenResource: onResourceOpen, showFilters: false }), slots?.afterOverview, slots?.beforeTabs, _jsxs(Tabs, { value: activeTab, onValueChange: (value) => setActiveTab((value ?? "resources")), children: [_jsxs(TabsList, { className: "flex w-full justify-start overflow-x-auto overflow-y-hidden", children: [_jsx(TabsTrigger, { value: "resources", children: page.tabs.resources }), _jsx(TabsTrigger, { value: "pools", children: page.tabs.pools }), _jsx(TabsTrigger, { value: "allocations", children: page.tabs.allocations }), _jsx(TabsTrigger, { value: "assignments", children: page.tabs.assignments }), _jsx(TabsTrigger, { value: "closeouts", children: page.tabs.closeouts })] }), _jsx(ResourcesTab, { suppliers: suppliers, filteredResources: filteredResources, resourceSelection: resourceSelection, setResourceSelection: setResourceSelectionState, bulkActionTarget: bulkActionTarget, handleBulkUpdate: onBulkUpdate, handleBulkDelete: onBulkDelete, onCreate: onResourceCreate, onOpenRoute: onResourceOpen, onEdit: (row) => onResourceEdit(row) }), _jsx(PoolsTab, { products: products, filteredPools: filteredPools, poolSelection: poolSelection, setPoolSelection: setPoolSelectionState, bulkActionTarget: bulkActionTarget, handleBulkUpdate: onBulkUpdate, handleBulkDelete: onBulkDelete, onCreate: onPoolCreate, onOpenRoute: onPoolOpen, onEdit: (row) => onPoolEdit(row) }), _jsx(AllocationsTab, { pools: pools, products: products, filteredAllocations: filteredAllocations, allocationSelection: allocationSelection, setAllocationSelection: setAllocationSelectionState, bulkActionTarget: bulkActionTarget, handleBulkDelete: onBulkDelete, onCreate: onAllocationCreate, onOpenRoute: onAllocationOpen, onEdit: (row) => onAllocationEdit(row) }), _jsx(AssignmentsTab, { slots: slotsData, products: products, resources: resources, bookings: bookings, filteredAssignments: filteredAssignments, assignmentSelection: assignmentSelection, setAssignmentSelection: setAssignmentSelectionState, bulkActionTarget: bulkActionTarget, handleBulkUpdate: onBulkUpdate, handleBulkDelete: onBulkDelete, onCreate: onAssignmentCreate, onOpenRoute: onAssignmentOpen, onEdit: (row) => onAssignmentEdit(row) }), _jsx(CloseoutsTab, { resources: resources, filteredCloseouts: filteredCloseouts, closeoutSelection: closeoutSelection, setCloseoutSelection: setCloseoutSelectionState, bulkActionTarget: bulkActionTarget, handleBulkDelete: onBulkDelete, onCreate: onCloseoutCreate, onEdit: (row) => onCloseoutEdit(row) })] }), slots?.afterTabs] })), slots?.dialogs] }));
|
|
140
176
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resources-tabs-primary.d.ts","sourceRoot":"","sources":["../../../src/resources/components/resources-tabs-primary.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAa,UAAU,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AAcrF,OAAO,EAEL,KAAK,aAAa,EAClB,KAAK,qBAAqB,EAC1B,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,KAAK,cAAc,EACpB,MAAM,aAAa,CAAA;AAGpB,KAAK,MAAM,GAAG,CAAC,IAAI,EAAE;IACnB,GAAG,EAAE,MAAM,EAAE,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;IACd,YAAY,EAAE,MAAM,CAAA;IACpB,UAAU,EAAE,MAAM,CAAA;IAClB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAChC,WAAW,EAAE,MAAM,CAAA;IACnB,cAAc,EAAE,MAAM,IAAI,CAAA;CAC3B,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;AAEnB,KAAK,QAAQ,GAAG,CAAC,IAAI,EAAE;IACrB,GAAG,EAAE,MAAM,EAAE,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;IACd,YAAY,EAAE,MAAM,CAAA;IACpB,UAAU,EAAE,MAAM,CAAA;IAClB,cAAc,EAAE,MAAM,IAAI,CAAA;CAC3B,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;
|
|
1
|
+
{"version":3,"file":"resources-tabs-primary.d.ts","sourceRoot":"","sources":["../../../src/resources/components/resources-tabs-primary.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAa,UAAU,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AAcrF,OAAO,EAEL,KAAK,aAAa,EAClB,KAAK,qBAAqB,EAC1B,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,KAAK,cAAc,EACpB,MAAM,aAAa,CAAA;AAGpB,KAAK,MAAM,GAAG,CAAC,IAAI,EAAE;IACnB,GAAG,EAAE,MAAM,EAAE,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;IACd,YAAY,EAAE,MAAM,CAAA;IACpB,UAAU,EAAE,MAAM,CAAA;IAClB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAChC,WAAW,EAAE,MAAM,CAAA;IACnB,cAAc,EAAE,MAAM,IAAI,CAAA;CAC3B,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;AAEnB,KAAK,QAAQ,GAAG,CAAC,IAAI,EAAE;IACrB,GAAG,EAAE,MAAM,EAAE,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;IAC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