| @@ -32,8 +32,9 @@ | ||
| 32 | 32 | CardHeader, |
| 33 | 33 | CardTitle, |
| 34 | 34 | } from "../components/ui/card"; |
| 35 | 35 | import { ConditionalRender } from "../components/ui/conditional-render"; |
| 36 | +import { CustomerSummaryCard } from "../components/ai/CustomerSummaryCard"; | |
| 36 | 37 | import { |
| 37 | 38 | Table, |
| 38 | 39 | TableBody, |
| 39 | 40 | TableCell, |
| @@ -132,9 +133,9 @@ | ||
| 132 | 133 | emergency.relationship ?? |
| 133 | 134 | null, |
| 134 | 135 | } as Customer; |
| 135 | 136 | }, |
| 136 | - enabled: !!customerId && can("yatra_view_bookings"), | |
| 137 | + enabled: !!customerId && can("yatra_view_customers"), | |
| 137 | 138 | }); |
| 138 | 139 | |
| 139 | 140 | // Fetch customer bookings |
| 140 | 141 | const { data: bookings, isLoading: isLoadingBookings } = useQuery<Booking[]>({ |
| @@ -162,9 +163,11 @@ | ||
| 162 | 163 | return formatDateUtil(dateString); |
| 163 | 164 | }; |
| 164 | 165 | |
| 165 | 166 | const formatPrice = (price: number, currencyCode: string = "USD") => |
| 166 | - formatYatraMoney(Number(price) || 0, currencyCode, { zeroAsUnknown: false }); | |
| 167 | + formatYatraMoney(Number(price) || 0, currencyCode, { | |
| 168 | + zeroAsUnknown: false, | |
| 169 | + }); | |
| 167 | 170 | |
| 168 | 171 | const getStatusBadge = (status: string) => { |
| 169 | 172 | const statusMap: Record<string, { className: string; label: string }> = { |
| 170 | 173 | active: { |
| @@ -396,9 +399,9 @@ | ||
| 396 | 399 | title={__("Customer Details", "yatra")} |
| 397 | 400 | description={__("View complete customer information", "yatra")} |
| 398 | 401 | actions={ |
| 399 | 402 | <div className="flex gap-2"> |
| 400 | - <ConditionalRender capability="yatra_edit_bookings"> | |
| 403 | + <ConditionalRender capability="yatra_edit_customers"> | |
| 401 | 404 | <Button onClick={handleEdit} className="flex items-center gap-2"> |
| 402 | 405 | <Edit className="w-4 h-4" /> |
| 403 | 406 | {__("Edit Customer", "yatra")} |
| 404 | 407 | </Button> |
| @@ -414,12 +417,17 @@ | ||
| 414 | 417 | </div> |
| 415 | 418 | } |
| 416 | 419 | /> |
| 417 | 420 | |
| 418 | - <ConditionalRender capability="yatra_view_bookings"> | |
| 421 | + <ConditionalRender capability="yatra_view_customers"> | |
| 419 | 422 | <div className="grid grid-cols-1 lg:grid-cols-3 gap-3"> |
| 420 | 423 | {/* Main Content */} |
| 421 | 424 | <div className="lg:col-span-2 space-y-3"> |
| 425 | + {/* AI Customer Summary — operator-triggered 3-line | |
| 426 | + snapshot. Self-gates on AI eligibility + module | |
| 427 | + state, so renders nothing in non-eligible tiers. */} | |
| 428 | + {customer?.id && <CustomerSummaryCard customerId={customer.id} />} | |
| 429 | + | |
| 422 | 430 | {/* Customer Overview */} |
| 423 | 431 | <Card> |
| 424 | 432 | <CardHeader className="pb-2"> |
| 425 | 433 | <div className="flex items-center justify-between"> |