{{-- ── Chat Panel ──────────────────────────────────────────────────────── --}} @if($isOpen)
{{-- ── Header ── --}}
Report Assistant ⒶⓇ {{-- Mode badge --}} @if($mode !== 'select') {{ $mode }} @endif
{{-- Back to mode select (only when in a mode) --}} @if($mode !== 'select') @endif {{-- Reset --}} {{-- Close --}}
{{-- ══════════════════════════════════════════════════════════════════ --}} {{-- ── MODE SELECT SCREEN ── --}} {{-- ══════════════════════════════════════════════════════════════════ --}} @if($mode === 'select')

How would you like to query?

Choose a mode to get started

{{-- Basic card --}} {{-- Advanced card --}}
{{-- Hint --}}

💡 Tip: Use Advanced to just describe what you need in plain English — Gemini will figure out the rest

@endif {{-- ══════════════════════════════════════════════════════════════════ --}} {{-- ── BASIC MODE ── --}} {{-- ══════════════════════════════════════════════════════════════════ --}} @if($mode === 'basic')
{{-- ── Report Type Selector (dropdown) ──────────────────────────── --}}
{{-- Custom wrapper gives us the chevron icon and accent border on selection --}}
{{-- Chevron icon --}}
{{-- ── Placeholder when no report type selected ─────────────────── --}} @if($reportType === '')

Select a report type from the dropdown to get started

@endif {{-- ══════════════════════════════════════════════════════════════ --}} {{-- ── PRODUCTION REPORT FORM ── --}} {{-- ══════════════════════════════════════════════════════════════ --}} @if($reportType === 'production') {{-- Plant --}}
{{-- Line --}}
@if(!$selectedPlantId)

Select a plant first

@endif
{{-- Date Range --}}
{{-- Fetch Button --}} {{-- Production Result --}} @if($hasResult)

{{ $result }}

@endif @endif {{-- end production --}} {{-- ══════════════════════════════════════════════════════════════ --}} {{-- ── INVOICE REPORT FORM (type lookup) ── --}} {{-- ══════════════════════════════════════════════════════════════ --}} @if($reportType === 'invoice') {{-- Plant --}}
{{-- Item Code --}}

Press Enter or click the button below

{{-- Fetch Button --}} {{-- Invoice Report Result --}} @if($hasInvoiceResult)
@if(str_contains($invoiceResult, 'serial invoice')) @elseif(str_contains($invoiceResult, 'material invoice')) @elseif(str_contains($invoiceResult, 'does not exist') || str_contains($invoiceResult, 'not found')) @else @endif

{{ $invoiceResult }}

@endif @endif {{-- end invoice report --}} {{-- ══════════════════════════════════════════════════════════════ --}} {{-- ── INVOICE STATUS FORM (scan status) ── NEW ── --}} {{-- ══════════════════════════════════════════════════════════════ --}} @if($reportType === 'invoice_status') {{-- Description banner --}}

Enter an invoice number to see how many serial numbers have been scanned, how many are pending, and the list of unscanned serials.

{{-- Invoice Number input --}}

Press Enter or click the button below

{{-- Fetch Button --}} {{-- Invoice Status Result --}} @if($hasInvoiceStatusResult) @php $sd = $invoiceStatusData; $sdType = $sd['type'] ?? 'error'; $sdTotal = $sd['total'] ?? 0; $sdScanned = $sd['scanned'] ?? 0; $sdNot = $sd['not_scanned'] ?? 0; $sdSerials = $sd['unscanned_serials'] ?? []; $sdCount = count($sdSerials); $sdInv = $sd['invoice_number'] ?? ''; $isGood = $sdType === 'all_scanned'; $isWarn = in_array($sdType, ['error', 'not_found', 'invalid']); $borderCol = $isGood ? '#10b981' : ($isWarn ? '#f59e0b' : '#3b82f6'); @endphp
{{-- ── Icon + summary row ── --}}
@if($isGood) @elseif($isWarn) @else @endif

{{ $sd['message'] ?? $invoiceStatusResult }}

{{-- ── Count pills (only for real invoice data) ── --}} @if($sdTotal > 0)
Total: {{ $sdTotal }} ✔ Scanned: {{ $sdScanned }} @if($sdNot > 0) ✘ Not scanned: {{ $sdNot }} @endif
@endif
{{-- ── Unscanned serial numbers section ── --}} @if($sdCount > 0)

Unscanned serial numbers {{ $sdCount }}

{{-- Serial chips — first 10, or all when expanded --}} @php $visibleSerials = $showAllUnscanned ? $sdSerials : array_slice($sdSerials, 0, 10); $hiddenCount = $sdCount - 10; @endphp
@foreach($visibleSerials as $serial) {{ $serial }} @endforeach
{{-- Show more / Show less button --}} @if($sdCount > 10) @endif
@endif
@endif @endif {{-- end invoice_status --}}
@endif {{-- ══════════════════════════════════════════════════════════════════ --}} {{-- ── ADVANCED MODE ── --}} {{-- ══════════════════════════════════════════════════════════════════ --}} @if($mode === 'advanced')
{{-- ── Conversation area ── --}}
@if(empty($chatHistory)) {{-- ── Empty state ── --}}

AI-Powered Assistant

Ask anything in plain English — tap an example below to get started

{{-- Example prompt cards --}}
{{-- Card 1 — Invoice scan status --}} {{-- Card 2 — Invoice type lookup --}} {{-- Card 3 — Production report --}}
@endif {{-- ── Chat bubbles ── --}} @foreach($chatHistory as $message) @if($message['role'] === 'user')
{{ $message['content'] }}
@else
{{ $message['content'] }}
@endif @endforeach {{-- ── Typing indicator ── --}} @if($isAdvancedLoading)
@endif
{{-- ── Input bar ── --}}

Press Enter to send · Ask anything in plain English

@endif
@endif {{-- ── FAB Toggle Button ───────────────────────────────────────────────── --}}