@extends('admin.layouts.app')
@php
$dash = '—';
$text = fn ($v) => ($v === null || $v === '') ? $dash : $v;
// Modern semantic colour palette — drives every status pill on the page.
$statusPalette = [
'pending' => ['fg' => '#92400e', 'bg' => '#fef3c7', 'dot' => '#f59e0b'],
'confirmed' => ['fg' => '#065f46', 'bg' => '#d1fae5', 'dot' => '#10b981'],
'completed' => ['fg' => '#1e3a8a', 'bg' => '#dbeafe', 'dot' => '#3b82f6'],
'cancelled' => ['fg' => '#991b1b', 'bg' => '#fee2e2', 'dot' => '#ef4444'],
'no_show' => ['fg' => '#374151', 'bg' => '#e5e7eb', 'dot' => '#6b7280'],
];
$attendancePalette = [
'coming' => ['fg' => '#1d4ed8', 'bg' => '#dbeafe', 'dot' => '#3b82f6'],
'attended' => ['fg' => '#065f46', 'bg' => '#d1fae5', 'dot' => '#10b981'],
'not_attended' => ['fg' => '#991b1b', 'bg' => '#fee2e2', 'dot' => '#ef4444'],
'cancelled' => ['fg' => '#475569', 'bg' => '#e2e8f0', 'dot' => '#64748b'],
// Legacy backstop — kept so a row that escaped the backfill
// still renders a readable pill until it gets updated.
'unknown' => ['fg' => '#374151', 'bg' => '#e5e7eb', 'dot' => '#6b7280'],
];
$typePalette = [
'investor' => ['fg' => '#3730a3', 'bg' => '#e0e7ff', 'dot' => '#6366f1'],
'startup' => ['fg' => '#0c4a6e', 'bg' => '#e0f2fe', 'dot' => '#0ea5e9'],
];
$statusC = $statusPalette[$meeting->status] ?? ['fg' => '#475569', 'bg' => '#f1f5f9', 'dot' => '#64748b'];
$attendanceC = $attendancePalette[$meeting->attendance_status] ?? ['fg' => '#475569', 'bg' => '#f1f5f9', 'dot' => '#64748b'];
$typeC = $typePalette[$meeting->type] ?? ['fg' => '#475569', 'bg' => '#f1f5f9', 'dot' => '#64748b'];
// Owner link (investor or startup) — surfaced as a chip and a "linked
// profile" row in the info card.
$ownerRoute = null;
// Locale-aware owner name: AR name in Arabic UI / EN name in English UI,
// with a cross-locale fallback when one side is missing. (The investor's
// legacy `name` column was dropped in the 2026-06-09 refactor — reading
// `->name` rendered a bare dash. See Meeting::ownerDisplayName().)
$ownerLabel = $meeting->ownerDisplayName();
if ($meeting->meetingable) {
if ($meeting->type === 'investor') {
$ownerRoute = route('admin.investors.show', $meeting->meetingable);
} elseif ($meeting->type === 'startup') {
$ownerRoute = route('admin.startups.show', $meeting->meetingable);
}
}
// Headline for the breadcrumb + hero title +
tag. Prefer the
// locale-aware owner name; fall back to the Bookings customer snapshot,
// then the bare "#id" so the page reads as a person, not a number.
$headlineName = $ownerLabel
?: (trim((string) $meeting->customer_name) ?: ('#' . $meeting->id));
// Duration in minutes for the hero chip + info row. We prefer the
// persisted `duration_minutes` (set by the webhook job from canonical
// Graph times) and fall back to a live diff so historical rows that
// pre-date the backfill still render a number.
$durationMinutes = $meeting->duration_minutes;
if ($durationMinutes === null && $meeting->start_time && $meeting->end_time) {
// Carbon 3.x: diffInMinutes is signed (a->diff(b) == b - a). Go
// start→end so positive durations come out positive.
$durationMinutes = (int) max(0, round($meeting->start_time->diffInMinutes($meeting->end_time)));
}
@endphp
@section('title', $headlineName . ' — ' . __('admin.brand.name'))
@section('page_title', __('admin.meetings_admin.show_title'))
@section('content')
{{-- ────────────────────────── BREADCRUMBS + BACK ───────────────────── --}}
@if ($meeting->meeting_url)
{{ __('admin.meetings_admin.open_in_teams') }}
@else
{{ __('admin.meetings_admin.no_teams_link') }}
@endif
{{-- Resync button — pulls latest state from Microsoft Graph
and re-runs the upsert pipeline. Useful when webhooks
aren't reaching this environment (local dev) or have
lapsed silently. --}}
@endif
{{-- Staff assignment row. The PRIMARY assignee is
whoever the auto-pick (or admin override)
chose; the BLOCKED list (below) is everyone
whose Microsoft calendar now holds this
booking — they're operationally unavailable
at this slot even though the meeting is
organisationally owned by the primary. --}}
@if ($meeting->staff_name || $meeting->staff_email || $meeting->staff_id)
@endif
{{-- Blocked staff list — snapshotted at booking
time from StaffDirectory. Shows EVERY staff
whose Microsoft calendar got the appointment,
so an admin can see at a glance "this booking
blocked X, Y, and Z." Only renders when there
are 2+ entries (a single-entry list adds no
info beyond the primary row above). --}}
@php
$blocked = is_array($meeting->blocked_staff) ? $meeting->blocked_staff : [];
@endphp
@if (count($blocked) > 1)
{{-- ════════════════════════ RIGHT COLUMN ══════════════════════ --}}
@endsection
@push('styles')
@endpush
@push('scripts')
{{-- Alpine.js is already loaded by admin.layouts.app — loading it again
would double-bind every directive on this page. --}}
@endpush