@extends('admin.layouts.app') @section('title', __('admin.labels.option_title') . ' — ' . $option->name_en) @section('page_title', __('admin.labels.option_title')) @push('styles') @endpush @section('content') @php $methodIcons = [ 'whatsapp' => '💬', 'email' => '✉️', 'notification' => '🔔', 'sms' => '📱', ]; @endphp @php // Localized helpers for the breadcrumb. We resolve names defensively // because either side may be empty in the labels catalog (the admin // can omit name_ar on system-only labels, for instance). $crumbLocale = app()->getLocale(); $labelName = $crumbLocale === 'ar' ? ($label->name_ar ?: $label->name_en) : ($label->name_en ?: $label->name_ar); $optionName = $crumbLocale === 'ar' ? ($option->name_ar ?: $option->name_en) : ($option->name_en ?: $option->name_ar); // The labels.index route accepts ?type=…&label={id} so the crumb // lands directly on the right tab AND auto-selects the parent label. $labelsTypeUrl = route('admin.labels.index', ['type' => $label->type]); $labelDeepUrl = route('admin.labels.index', ['type' => $label->type, 'label' => $label->id]); $typeKey = $label->type === 'startup' ? 'admin.labels.crumb_startup' : 'admin.labels.crumb_investor'; @endphp {{-- Breadcrumb: each level links to its own anchor so the admin can escape upward without using the browser back button. The current leaf is non-clickable. --}} {{-- Hero: one heading (the option name), with status + method badges. Replaces the old block which duplicated the subtitle the breadcrumb already shows. The breadcrumb handles all upward navigation, so the two ghost back-buttons are removed. --}}
@php $mc = is_array($option->methods) ? count($option->methods) : 0; @endphp @if ($mc > 0) {{ $mc }} / {{ count($supportedMethods) }} · {{ __('admin.labels.methods_short') }} @endif
{{-- ── Combined: core info + notification channels in one card ── Logical sections are separated by an inner .section-divider so the form still reads as two grouped chunks, but it lives on a single visual surface (per spec). --}}

{{ __('admin.labels.option_core') }}

{{-- Methods-count badge stays in the header so an admin can see channel coverage at a glance even before scrolling to the methods section below. --}} {{ __('admin.labels.no_methods') }}
{{-- Paired name inputs: Arabic + English side-by-side on desktop, stacked on mobile (.field-pair handles the responsive breakpoint). Each input keeps its own dir/lang so cursor + IME behavior is correct. --}}
{{-- ── Linked Group (action labels only) ──────────────────── Optional explicit Action → Group link. When set, applying this action moves the startup/investor into the chosen group; empty leaves groups untouched (config fallback). --}} @if ($label->key === 'action')
{{ __('admin.labels.linked_group_hint') }}
@endif {{-- ── Section header ─────────────────────────────────── --}}

{{ __('admin.labels.methods_title') }}

{{ __('admin.labels.methods_hint') }}

{{-- ── Channel accordion ────────────────────────────────── One row per channel. Click the row body to expand and preview its config; tick the inline checkbox to actually enable the channel. Only ONE row is expanded at a time so the screen stays focused. Preview mode (open but not checked) shows a banner reminding the admin that the channel is inactive until enabled. --}}
{{-- ===== EMAIL ===== --}}
{{ __('admin.labels.channel_email_title') }}
{{ __('admin.labels.channel_email_hint') }}
{{ __('admin.labels.email_subject_hint') }} ⚠ {{ __('admin.labels.email_subject_required') }}
{{ __('admin.labels.email_body_hint') }} ⚠ {{ __('admin.labels.email_body_required') }}
{{-- ===== SMS ===== --}}
{{ __('admin.labels.channel_sms_title') }}
{{ __('admin.labels.channel_sms_hint') }}
{{ __('admin.labels.sms_body_hint') }} ⚠ {{ __('admin.labels.sms_body_required') }}
{{-- ===== WHATSAPP ===== --}}
{{ __('admin.labels.channel_whatsapp_title') }}
{{ __('admin.labels.channel_whatsapp_hint') }}
⚠ {{ __('admin.labels.whatsapp_template_required') }}
{{ __('admin.labels.whatsapp_placeholders_hint') }}
{{-- ===== IN-APP NOTIFICATION ===== --}}
{{ __('admin.labels.channel_notification_title') }}
{{ __('admin.labels.channel_notification_hint') }}
⚠ {{ __('admin.labels.notification_title_required') }}
⚠ {{ __('admin.labels.notification_body_required') }}
{{-- ── Shared variable picker (unchanged behavior) ────────── --}}
{{-- The shared variable picker lives below. Each accordion row above carries its own per-channel form; this block now holds ONLY the picker + unknown-vars warning. --}} {{-- ── Template variable picker ── --}} {{-- Flat, ungrouped chip list — same layout as the Automations screen's Template Variables picker. Each chip inserts its {{ token }} into the last-focused field. --}}

{{ __('admin.labels.tpl_vars_title') }}

{{ __('admin.labels.tpl_vars_hint') }}

@foreach ($templateVars as $v) @php // Build the literal `{{ key }}` token here — inlining // it in a Blade `{{ }}` expression makes the compiler // greedily match the inner `}}` and emit broken PHP. $chipToken = '{{ ' . $v['key'] . ' }}'; @endphp @endforeach
{{-- Unknown-variable warning --}}
⚠️ {{ __('admin.labels.tpl_unknown_warning') }}
{{-- The legacy shared "Live preview" block was removed: each per-channel card now renders its own preview (email subject/body, sms body, whatsapp interpolation). The variable picker above still drives every field. --}}
{{-- Empty state when no methods picked --}}
{{ __('admin.labels.notify_disabled_hint') }}
{{-- The "side effects" section (cancel-meeting toggle) was intentionally removed: cancellation policy is now driven by `config('microsoft_bookings.auto_cancel_option_ids')`, NOT per-option UI state. See CancelSubjectMeetingsOnLabelAction. --}} {{-- Single primary action; breadcrumb provides escape route, so we don't repeat a Cancel link here. Save is locked until the conditional requirements are satisfied (visible warning explains why the button is disabled). --}}
{{ __('admin.labels.notification_complete_to_save') }}
@endsection @push('scripts') {{-- Alpine.js is already loaded by admin.layouts.app — adding it here a second time double-binds every `@click` / `@focus` / `x-model`, which caused the chip-click to insert the variable token twice. --}} @endpush