netgescon-day0/resources/views/filament/pages/fornitore/lavorazioni-operative.blade.php

1232 lines
90 KiB
PHP
Executable File

<x-filament-panels::page>
<div class="space-y-4">
{{-- TOP HEADER CONTEXT TOOLBAR --}}
<div class="rounded-xl border border-slate-200 bg-white/95 p-4 shadow-xs backdrop-blur">
<div class="flex flex-wrap items-center justify-between gap-3">
<div class="flex items-center gap-3">
<div class="flex h-10 w-10 items-center justify-center rounded-xl bg-gradient-to-br from-sky-700 to-indigo-800 font-black text-white shadow-xs">
LO
</div>
<div>
<div class="flex items-center gap-2">
<h2 class="text-base font-bold text-slate-900 leading-tight">Lavorazioni Operative & Centro Assistenza</h2>
<span class="inline-flex items-center rounded-md bg-sky-50 px-2 py-0.5 text-[11px] font-bold text-sky-700 ring-1 ring-inset ring-sky-600/20">
Unificato
</span>
</div>
<div class="text-xs text-slate-500">
@if($this->fornitoreLabel)
Fornitore operativo: <span class="font-semibold text-slate-800">{{ $this->fornitoreLabel }}</span>
@else
Seleziona un fornitore per visualizzare le lavorazioni operative.
@endif
</div>
</div>
</div>
<div class="flex flex-wrap items-center gap-2">
@if(count($this->fornitoriOptions) > 1)
<div class="flex items-center gap-1.5">
<span class="text-xs font-semibold text-slate-500">Fornitore:</span>
<select
wire:model.live="fornitoreId"
class="rounded-lg border-slate-300 py-1.5 px-2.5 text-xs font-medium text-slate-800 shadow-xs focus:border-sky-500 focus:ring-sky-500"
>
@foreach($this->fornitoriOptions as $optId => $optLabel)
<option value="{{ $optId }}">{{ $optLabel }}</option>
@endforeach
</select>
</div>
@endif
<a
href="/admin-filament/fornitore/pratiche?fornitore={{ $this->fornitoreId }}"
class="inline-flex items-center gap-1 rounded-lg bg-sky-700 px-3 py-1.5 text-xs font-bold text-white shadow-xs hover:bg-sky-600 transition"
>
💻 Pratiche TecnoRepair
</a>
<a
href="/admin-filament/fornitore/seriali?fornitore={{ $this->fornitoreId }}"
class="inline-flex items-center gap-1 rounded-lg border border-slate-300 bg-white px-3 py-1.5 text-xs font-medium text-slate-700 shadow-xs hover:bg-slate-50 transition"
>
🔍 Ricerca Seriali
</a>
<a
href="{{ $this->getTicketsUrl() }}"
class="inline-flex items-center gap-1 rounded-lg border border-slate-300 bg-white px-3 py-1.5 text-xs font-medium text-slate-700 shadow-xs hover:bg-slate-50 transition"
>
🎫 Ticket operativi
</a>
<a
href="{{ $this->getCollaboratoriUrl() }}"
class="inline-flex items-center gap-1 rounded-lg border border-slate-300 bg-white px-3 py-1.5 text-xs font-medium text-slate-700 shadow-xs hover:bg-slate-50 transition"
>
👥 Collaboratori
</a>
<a
href="{{ $this->getRubricaUrl() }}"
class="inline-flex items-center gap-1 rounded-lg border border-slate-300 bg-white px-3 py-1.5 text-xs font-medium text-slate-700 shadow-xs hover:bg-slate-50 transition"
>
📖 Rubrica clienti
</a>
<a
href="{{ $this->getProdottiUrl() }}"
class="inline-flex items-center gap-1 rounded-lg border border-slate-300 bg-white px-3 py-1.5 text-xs font-medium text-slate-700 shadow-xs hover:bg-slate-50 transition"
>
📦 Prodotti & Ricambi
</a>
</div>
</div>
</div>
{{-- MAIN VIEW TABS: ELENCO LAVORAZIONI vs SCHEDA APPARECCHIO --}}
<div class="flex items-center justify-between border-b border-slate-200 bg-white rounded-xl px-3 pt-2 shadow-xs">
<div class="flex items-center gap-2">
<button
type="button"
wire:click="setMainTab('elenco')"
class="inline-flex items-center gap-2 px-4 py-2.5 text-xs font-bold rounded-t-lg border-b-2 transition cursor-pointer {{ $mainTab === 'elenco' ? 'border-sky-600 text-sky-800 bg-sky-50/50' : 'border-transparent text-slate-600 hover:text-slate-900 hover:bg-slate-50' }}"
>
<span>📋 Elenco Lavorazioni</span>
<span class="px-2 py-0.5 rounded-full text-[10px] font-extrabold {{ $mainTab === 'elenco' ? 'bg-sky-600 text-white' : 'bg-slate-100 text-slate-600' }}">
{{ number_format($totals['tutte'], 0, ',', '.') }}
</span>
</button>
@if($selectedRowId && $activeScheda)
<button
type="button"
wire:click="setMainTab('scheda')"
class="inline-flex items-center gap-2 px-4 py-2.5 text-xs font-bold rounded-t-lg border-b-2 transition cursor-pointer {{ $mainTab === 'scheda' ? 'border-indigo-600 text-indigo-900 bg-indigo-50/50 shadow-xs' : 'border-transparent text-slate-600 hover:text-slate-900 hover:bg-slate-50' }}"
>
<span>🔧 Scheda: #{{ $activeScheda['numero_scheda'] ?? $selectedRowId }} — {{ $activeScheda['product_model'] ?? $activeScheda['title'] ?? 'Dettaglio' }}</span>
<span wire:click.stop="closeScheda" class="ml-1 text-slate-400 hover:text-rose-600 font-black cursor-pointer" title="Chiudi Scheda"></span>
</button>
@endif
</div>
@if($mainTab === 'scheda')
<div class="flex items-center gap-2 pb-2">
<button
type="button"
wire:click="closeScheda"
class="inline-flex items-center gap-1 px-3 py-1.5 rounded-lg border border-slate-300 bg-white text-xs font-bold text-slate-700 hover:bg-slate-50 shadow-xs transition cursor-pointer"
>
⬅️ Torna all'Elenco
</button>
<button
type="button"
wire:click="saveActiveScheda"
class="inline-flex items-center gap-1 px-3.5 py-1.5 rounded-lg bg-emerald-600 hover:bg-emerald-500 text-white text-xs font-bold shadow-xs transition cursor-pointer"
>
💾 Salva Scheda
</button>
</div>
@endif
</div>
@if($this->missingAdminContext)
<div class="rounded-xl border border-amber-300 bg-amber-50 p-4 text-sm text-amber-800">
Questa vista per amministratori richiede un fornitore selezionato.
</div>
@else
{{-- TAB 1: ELENCO LAVORAZIONI --}}
@if($mainTab === 'elenco')
{{-- KPI SUMMARY CARDS --}}
<div class="grid grid-cols-2 gap-3 sm:grid-cols-4">
<button
type="button"
wire:click="setScope('tutte')"
class="rounded-xl border p-3.5 text-left transition shadow-xs cursor-pointer {{ $scope === 'tutte' ? 'border-sky-500 bg-sky-50/80 ring-2 ring-sky-500/20' : 'border-slate-200 bg-white hover:bg-slate-50' }}"
>
<div class="text-xs font-semibold uppercase tracking-wider text-slate-500">Tutte le Lavorazioni</div>
<div class="mt-1 text-2xl font-black text-slate-900">{{ number_format($totals['tutte'], 0, ',', '.') }}</div>
<div class="mt-1 text-[11px] text-slate-500">Vista consolidata TecnoRepair + Ticket.</div>
</button>
<button
type="button"
wire:click="setScope('aperte')"
class="rounded-xl border p-3.5 text-left transition shadow-xs cursor-pointer {{ $scope === 'aperte' ? 'border-sky-600 bg-sky-50 ring-2 ring-sky-500/20' : 'border-sky-200 bg-sky-50/60 hover:bg-sky-50' }}"
>
<div class="text-xs font-semibold uppercase tracking-wider text-sky-700">In Lavorazione / Aperte</div>
<div class="mt-1 text-2xl font-black text-sky-900">{{ number_format($totals['aperte'], 0, ',', '.') }}</div>
<div class="mt-1 text-[11px] text-sky-700/80">Accettazione, laboratorio o verifica.</div>
</button>
<button
type="button"
wire:click="setScope('chiuse')"
class="rounded-xl border p-3.5 text-left transition shadow-xs cursor-pointer {{ $scope === 'chiuse' ? 'border-emerald-600 bg-emerald-50 ring-2 ring-emerald-500/20' : 'border-emerald-200 bg-emerald-50/60 hover:bg-emerald-50' }}"
>
<div class="text-xs font-semibold uppercase tracking-wider text-emerald-700">Riparate / Chiuse</div>
<div class="mt-1 text-2xl font-black text-emerald-900">{{ number_format($totals['chiuse'], 0, ',', '.') }}</div>
<div class="mt-1 text-[11px] text-emerald-700/80">Completate, riconsegnate o rottamate.</div>
</button>
<button
type="button"
wire:click="setScope('ticket_amministratore')"
class="rounded-xl border p-3.5 text-left transition shadow-xs cursor-pointer {{ $scope === 'ticket_amministratore' ? 'border-indigo-600 bg-indigo-50 ring-2 ring-indigo-500/20' : 'border-indigo-200 bg-indigo-50/60 hover:bg-indigo-50' }}"
>
<div class="text-xs font-semibold uppercase tracking-wider text-indigo-700">Ticket Amministratore</div>
<div class="mt-1 text-2xl font-black text-indigo-900">{{ number_format($totals['ticket_amministratore'], 0, ',', '.') }}</div>
<div class="mt-1 text-[11px] text-indigo-700/80">Interventi ordinari dagli stabili gestiti.</div>
</button>
</div>
{{-- FILTRI PER RICERCA ELENCO --}}
<div class="rounded-xl border border-slate-200 bg-white p-4 shadow-xs space-y-3">
<div class="flex items-center justify-between border-b border-slate-100 pb-2">
<div class="text-xs font-bold uppercase tracking-wider text-slate-700 flex items-center gap-2">
<span>🔍 Filtra Lavorazioni Operative</span>
<span class="text-[10px] px-2 py-0.5 rounded-full bg-slate-100 text-slate-600 font-normal">Filtri rapidi reattivi</span>
</div>
<button
type="button"
wire:click="resetFiltri"
class="text-xs text-sky-700 hover:text-sky-900 font-bold underline cursor-pointer"
>
Reset Filtri
</button>
</div>
<div class="grid grid-cols-1 gap-3 md:grid-cols-4">
<div class="md:col-span-2">
<label class="block text-[11px] font-semibold text-slate-600 mb-1">Cerca (Matricola, Seriale, Modello, Cliente, Num. Scheda)</label>
<input
type="text"
wire:model.live.debounce.400ms="search"
placeholder="Es. G250, CND911854H, MILIA, 1876..."
class="w-full text-xs py-1.5 px-2.5 rounded-lg border border-slate-300 text-slate-800 focus:border-sky-500 focus:ring-sky-500"
/>
</div>
<div>
<label class="block text-[11px] font-semibold text-slate-600 mb-1">Stato Riparazione</label>
<select
wire:model.live="filterStato"
class="w-full text-xs py-1.5 px-2.5 rounded-lg border border-slate-300 text-slate-800 focus:border-sky-500 focus:ring-sky-500 font-medium"
>
<option value="">0 - TUTTI GLI STATI</option>
<option value="21">21 - INGRESSO ACCETTAZIONE</option>
<option value="2">2 - DISPOSITIVO IN RIPARAZIONE</option>
<option value="4">4 - RIPARATO</option>
<option value="5">5 - ATTESA RICAMBIO</option>
<option value="6">6 - INVIATO NUOVO PREVENTIVO</option>
<option value="10">10 - DISPOSITIVO IRRIPARABILE</option>
<option value="23">23 - PC DA UTILIZZARE COME RICAMBI</option>
<option value="33">33 - MANDATO IN GARANZIA / RMA</option>
<option value="31">31 - ACQUISTO RICONDIZIONATO</option>
<option value="37">37 - SMALTITO PER ABBANDONO</option>
</select>
</div>
<div>
<label class="block text-[11px] font-semibold text-slate-600 mb-1">Origine Lavorazione</label>
<select
wire:model.live="filterOrigine"
class="w-full text-xs py-1.5 px-2.5 rounded-lg border border-slate-300 text-slate-800 focus:border-sky-500 focus:ring-sky-500 font-medium"
>
<option value="">Tutte le origini</option>
<option value="tecnorepair">TecnoRepair MDB (Laboratorio)</option>
<option value="ticket">Ticket Amministratore (Stabili)</option>
</select>
</div>
</div>
</div>
{{-- TABELLA ELENCO LAVORAZIONI --}}
<div class="rounded-xl border border-slate-200 bg-white shadow-xs overflow-hidden">
<div class="p-3 bg-slate-50 border-b border-slate-200 flex flex-wrap items-center justify-between text-xs font-bold text-slate-700 gap-2">
<div>
Lavorazioni Elencate: <span class="text-sky-700">{{ count($rows) }}</span>
<span class="text-slate-400 font-normal">(filtrate su base reattiva)</span>
</div>
<div class="flex items-center gap-3 text-[11px] font-normal">
<span class="flex items-center gap-1"><span class="w-3 h-3 rounded bg-emerald-500 inline-block"></span> Riparato</span>
<span class="flex items-center gap-1"><span class="w-3 h-3 rounded bg-rose-500 inline-block"></span> Irreparabile / Ricambi</span>
<span class="flex items-center gap-1"><span class="w-3 h-3 rounded bg-sky-500 inline-block"></span> Accettazione / In Rip.</span>
<span class="flex items-center gap-1"><span class="w-3 h-3 rounded bg-amber-500 inline-block"></span> Attesa Ricambio</span>
</div>
</div>
<div class="overflow-x-auto max-h-[600px]">
<table class="w-full text-left text-xs border-collapse">
<thead class="sticky top-0 bg-slate-100 text-slate-700 font-bold border-b border-slate-200 text-[11px] uppercase tracking-wider z-10">
<tr>
<th class="py-2.5 px-2 border-r border-slate-200 w-16 text-center">Num.</th>
<th class="py-2.5 px-2 border-r border-slate-200 w-24">Ingresso</th>
<th class="py-2.5 px-2 border-r border-slate-200 w-44">Cliente / Contatto</th>
<th class="py-2.5 px-2 border-r border-slate-200 w-28">Telefono</th>
<th class="py-2.5 px-2 border-r border-slate-200 min-w-[200px]">Problema / Difetto</th>
<th class="py-2.5 px-2 border-r border-slate-200 w-20">Marca</th>
<th class="py-2.5 px-2 border-r border-slate-200 w-32">Modello</th>
<th class="py-2.5 px-2 border-r border-slate-200 w-36">Seriale / IMEI</th>
<th class="py-2.5 px-2 border-r border-slate-200 w-28">Origine</th>
<th class="py-2.5 px-2 border-r border-slate-200 w-28">Operatore</th>
<th class="py-2.5 px-2 border-r border-slate-200 w-36">Stato</th>
<th class="py-2.5 px-2 border-r border-slate-200 w-28">Aggiornato</th>
<th class="py-2.5 px-2 text-center w-28">Azione</th>
</tr>
</thead>
<tbody class="divide-y divide-slate-100 bg-white">
@forelse($rows as $row)
@php
$rowBg = match($row['row_color'] ?? '') {
'green' => 'bg-emerald-50/80 hover:bg-emerald-100/90 text-emerald-950 font-medium',
'red' => 'bg-rose-50/80 hover:bg-rose-100/90 text-rose-950 font-medium',
'blue' => 'bg-sky-50/80 hover:bg-sky-100/90 text-sky-950',
'amber' => 'bg-amber-50/80 hover:bg-amber-100/90 text-amber-950',
default => 'hover:bg-slate-50 text-slate-800',
};
$borderLeft = match($row['row_color'] ?? '') {
'green' => 'border-l-4 border-l-emerald-600',
'red' => 'border-l-4 border-l-rose-600',
'blue' => 'border-l-4 border-l-sky-600',
'amber' => 'border-l-4 border-l-amber-600',
default => 'border-l-4 border-l-transparent',
};
@endphp
<tr
class="{{ $rowBg }} {{ $borderLeft }} transition cursor-pointer"
wire:click="openRowDetail('{{ $row['row_type'] ?? 'tecnorepair' }}', {{ (int) $row['id'] }})"
>
<td class="py-2 px-2 border-r border-slate-200/60 font-black text-center text-slate-900">
<div>{{ $row['numero'] ?? ($row['ticket_id'] ? ('#' . $row['ticket_id']) : '-') }}</div>
<span class="inline-block px-1 py-0.2 rounded text-[10px] font-bold {{ ($row['row_type'] ?? '') === 'tecnorepair' ? 'bg-sky-100 text-sky-800' : 'bg-indigo-100 text-indigo-800' }}">
{{ ($row['row_type'] ?? '') === 'tecnorepair' ? 'TR' : 'TK' }}
</span>
</td>
<td class="py-2 px-2 border-r border-slate-200/60 font-medium">
<div>{{ $row['ingresso'] }}</div>
<div class="text-[10px] text-slate-500 truncate max-w-[90px]">{{ $row['stabile'] }}</div>
</td>
<td class="py-2 px-2 border-r border-slate-200/60 font-bold truncate max-w-[160px]" title="{{ $row['cliente'] ?? $row['contatto'] }}">
{{ $row['cliente'] ?? $row['contatto'] }}
</td>
<td class="py-2 px-2 border-r border-slate-200/60 font-mono text-[11px] text-slate-700">
{{ $row['telefono'] !== '' ? $row['telefono'] : '-' }}
</td>
<td class="py-2 px-2 border-r border-slate-200/60 truncate max-w-[240px]" title="{{ $row['difetto'] ?? $row['problema'] }}">
<div>{{ $row['difetto'] ?? $row['problema'] }}</div>
@if(($row['titolo'] ?? '') !== '' && $row['titolo'] !== '-')
<div class="text-[10px] text-slate-500 truncate">{{ $row['titolo'] }}</div>
@endif
</td>
<td class="py-2 px-2 border-r border-slate-200/60 font-semibold uppercase">{{ $row['brand'] ?? '-' }}</td>
<td class="py-2 px-2 border-r border-slate-200/60 truncate max-w-[120px]" title="{{ $row['modello'] ?? $row['apparato'] }}">
{{ $row['modello'] ?? $row['apparato'] }}
</td>
<td class="py-2 px-2 border-r border-slate-200/60 font-mono text-[11px] font-bold text-sky-800">
{{ $row['seriale'] ?? '-' }}
</td>
<td class="py-2 px-2 border-r border-slate-200/60">
<span class="inline-flex rounded-full px-2 py-0.5 text-[10px] font-bold {{ $row['badge_class'] ?? 'bg-sky-100 text-sky-700' }}">
{{ $row['origine'] }}
</span>
</td>
<td class="py-2 px-2 border-r border-slate-200/60 text-[11px] truncate max-w-[100px]">{{ $row['operatore'] }}</td>
<td class="py-2 px-2 border-r border-slate-200/60 font-bold text-[11px]">
<span class="inline-flex rounded-full px-2 py-0.5 text-[10px] font-bold {{ $row['badge_class'] ?? 'bg-slate-100 text-slate-700' }}">
{{ $row['stato'] }}
</span>
</td>
<td class="py-2 px-2 border-r border-slate-200/60 text-[11px] text-slate-500">{{ $row['updated_at'] }}</td>
<td class="py-2 px-2 text-center" onclick="event.stopPropagation()">
<button
type="button"
wire:click="openRowDetail('{{ $row['row_type'] ?? 'tecnorepair' }}', {{ (int) $row['id'] }})"
class="inline-flex items-center gap-1 rounded-md bg-sky-700 px-2.5 py-1 text-xs font-bold text-white hover:bg-sky-600 shadow-xs transition cursor-pointer"
>
🔧 Apri Scheda
</button>
</td>
</tr>
@empty
<tr>
<td colspan="13" class="py-12 text-center text-sm text-slate-500 bg-white">
Nessuna lavorazione trovata con i filtri correnti. Prova a cliccare "Reset Filtri".
</td>
</tr>
@endforelse
</tbody>
</table>
</div>
</div>
@endif
{{-- TAB 2: SCHEDA APPARECCHIO / DETTAGLIO INTERVENTO (IN-PAGE FULL TAB) --}}
@if($mainTab === 'scheda' && $activeScheda)
@if(($activeScheda['type'] ?? '') === 'tecnorepair')
{{-- TECNOREPAIR DESKTOP-FAITHFUL SCHEDA --}}
<div class="rounded-xl border border-slate-300 bg-white shadow-md overflow-hidden space-y-4">
{{-- SCHEDA TOP BAR: WINDOW BANNER & STATUS --}}
<div class="p-4 bg-gradient-to-r from-slate-900 via-sky-950 to-slate-900 text-white flex flex-wrap items-center justify-between gap-3 border-b border-sky-800">
<div class="flex items-center gap-3">
<span class="px-3 py-1.5 rounded-lg bg-sky-500 text-slate-950 font-black text-sm shadow-xs">
SCHEDA APPARECCHIO #{{ $activeScheda['numero_scheda'] }}
</span>
<div>
<h3 class="text-base font-bold text-white flex items-center gap-2">
<span>{{ $activeScheda['brand'] }} {{ $activeScheda['product_model'] }}</span>
<span class="text-sky-300 font-mono text-xs font-normal">({{ $activeScheda['serial_number'] }})</span>
</h3>
<p class="text-xs text-sky-200">
Cliente: <span class="font-bold text-white">{{ $activeScheda['customer_name'] }}</span>
Data Ingresso: <span class="font-semibold text-white">{{ $activeScheda['date_received'] }}</span> ore {{ $activeScheda['time_received'] }}
</p>
</div>
</div>
<div class="flex items-center gap-2">
<span class="px-3 py-1 rounded-full text-xs font-bold border border-white/20 bg-white/10 text-white">
Stato: {{ $activeScheda['status'] }}
</span>
<button
type="button"
wire:click="saveActiveScheda"
class="inline-flex items-center gap-1 px-3 py-1 rounded-lg bg-emerald-600 hover:bg-emerald-500 text-white text-xs font-bold shadow-xs transition cursor-pointer"
>
💾 Salva
</button>
<button
type="button"
wire:click="closeScheda"
class="inline-flex items-center gap-1 px-3 py-1 rounded-lg bg-white/10 hover:bg-white/20 text-white text-xs font-bold transition cursor-pointer"
>
Chiudi
</button>
</div>
</div>
{{-- CONTROLLI INTESTAZIONE SCHEDA & BOX CLIENTE (FEDELE A TECNOREPAIR DESKTOP) --}}
<div class="p-4 grid grid-cols-1 lg:grid-cols-3 gap-4 border-b border-slate-200 bg-slate-50/60">
{{-- LEFT: DATE & GESTIONE INTERVENTO --}}
<div class="lg:col-span-2 space-y-3">
<div class="grid grid-cols-2 sm:grid-cols-4 gap-2 text-xs">
<div>
<label class="block text-[11px] font-semibold text-slate-600 mb-0.5">Num. Scheda</label>
<input
type="text"
value="{{ $activeScheda['numero_scheda'] }}"
readonly
class="w-full py-1 px-2 rounded border border-slate-300 bg-slate-100 font-bold text-slate-800 text-xs"
/>
</div>
<div>
<label class="block text-[11px] font-semibold text-slate-600 mb-0.5">Data Ingresso</label>
<input
type="text"
value="{{ $activeScheda['date_received'] }} {{ $activeScheda['time_received'] }}"
readonly
class="w-full py-1 px-2 rounded border border-slate-300 bg-slate-100 font-medium text-slate-800 text-xs"
/>
</div>
<div>
<label class="block text-[11px] font-semibold text-slate-600 mb-0.5">Cons. Prevista</label>
<input
type="text"
value="{{ $activeScheda['date_delivery_prev'] }}"
readonly
class="w-full py-1 px-2 rounded border border-slate-300 bg-white font-medium text-slate-800 text-xs"
/>
</div>
<div>
<label class="block text-[11px] font-semibold text-slate-600 mb-0.5">Data Riconsegna</label>
<input
type="text"
value="{{ $activeScheda['date_returned'] }}"
readonly
class="w-full py-1 px-2 rounded border border-slate-300 bg-white font-medium text-slate-800 text-xs"
/>
</div>
</div>
<div class="grid grid-cols-1 sm:grid-cols-2 gap-2 text-xs">
<div>
<label class="block text-[11px] font-semibold text-slate-600 mb-0.5">Stato Riparazione Corrente</label>
<select
wire:model="schedaForm.status_code"
class="w-full py-1 px-2 rounded border border-slate-300 bg-white font-bold text-slate-800 text-xs focus:ring-1 focus:ring-sky-500"
>
<option value="21">21 - INGRESSO ACCETTAZIONE</option>
<option value="2">2 - DISPOSITIVO IN RIPARAZIONE</option>
<option value="4">4 - RIPARATO</option>
<option value="5">5 - ATTESA RICAMBIO</option>
<option value="6">6 - INVIATO NUOVO PREVENTIVO</option>
<option value="10">10 - DISPOSITIVO IRRIPARABILE</option>
<option value="23">23 - PC DA UTILIZZARE COME RICAMBI</option>
<option value="33">33 - MANDATO IN GARANZIA AL PRODUTTORE</option>
<option value="31">31 - ACQUISTO RICONDIZIONATO</option>
<option value="37">37 - SMALTITO PER ABBANDONO</option>
</select>
</div>
<div>
<label class="block text-[11px] font-semibold text-slate-600 mb-0.5">Tecnico Assegnato</label>
<input
type="text"
wire:model="schedaForm.tecnico"
placeholder="Nome del tecnico riparatore..."
class="w-full py-1 px-2 rounded border border-slate-300 bg-white text-slate-800 text-xs font-medium"
/>
</div>
</div>
{{-- CHECKBOXES ROW (FLAGS TECNOREPAIR DESKTOP) --}}
<div class="flex flex-wrap items-center gap-4 pt-1">
<label class="inline-flex items-center gap-1.5 text-xs font-semibold text-slate-700 cursor-pointer">
<input
type="checkbox"
wire:model="schedaForm.is_fare_preventivo"
class="rounded border-slate-300 text-sky-600 focus:ring-sky-500"
/>
<span>Fare Preventivo</span>
</label>
<label class="inline-flex items-center gap-1.5 text-xs font-semibold text-slate-700 cursor-pointer">
<input
type="checkbox"
wire:model="schedaForm.is_riparazione_sede"
class="rounded border-slate-300 text-sky-600 focus:ring-sky-500"
/>
<span>Riparazione in Sede</span>
</label>
<label class="inline-flex items-center gap-1.5 text-xs font-semibold text-slate-700 cursor-pointer">
<input
type="checkbox"
wire:model="schedaForm.is_riconsegnato"
class="rounded border-slate-300 text-emerald-600 focus:ring-emerald-500"
/>
<span class="text-emerald-800">Riconsegnato</span>
</label>
<label class="inline-flex items-center gap-1.5 text-xs font-semibold text-slate-700 cursor-pointer">
<input
type="checkbox"
wire:model="schedaForm.is_rientro"
class="rounded border-slate-300 text-rose-600 focus:ring-rose-500"
/>
<span>Rientro</span>
</label>
<label class="inline-flex items-center gap-1.5 text-xs font-semibold text-slate-700 cursor-pointer">
<input
type="checkbox"
wire:model="schedaForm.is_esame_tecnico"
class="rounded border-slate-300 text-amber-600 focus:ring-amber-500"
/>
<span>Esame Tecnico</span>
</label>
<label class="inline-flex items-center gap-1.5 text-xs font-semibold text-slate-700 cursor-pointer">
<input
type="checkbox"
wire:model="schedaForm.consegnato_no_doc"
class="rounded border-slate-300 text-slate-600 focus:ring-slate-500"
/>
<span>Ricons. No Ricevuta</span>
</label>
</div>
</div>
{{-- RIGHT: BOX "DATI CLIENTE" (POSIZIONATO ESATTAMENTE COME SUL DESKTOP) --}}
<div class="rounded-xl border border-slate-200 bg-white p-3.5 shadow-xs space-y-2">
<div class="flex items-center justify-between border-b border-slate-100 pb-1.5">
<div class="text-xs font-black text-slate-800 uppercase tracking-wider flex items-center gap-1">
<span>👤 Dati Cliente</span>
</div>
@if($activeScheda['customer_phone'])
<div class="flex items-center gap-1">
<a
href="https://wa.me/39{{ preg_replace('/\D+/', '', $activeScheda['customer_phone']) }}"
target="_blank"
class="px-2 py-0.5 rounded bg-emerald-600 hover:bg-emerald-500 text-white font-bold text-[10px] shadow-xs"
title="Invia WhatsApp"
>
WA
</a>
<a
href="tel:{{ $activeScheda['customer_phone'] }}"
class="px-2 py-0.5 rounded bg-sky-600 hover:bg-sky-500 text-white font-bold text-[10px] shadow-xs"
title="Chiama"
>
📞
</a>
</div>
@endif
</div>
<div class="space-y-1.5 text-xs">
<div>
<span class="text-[11px] font-semibold text-slate-500">Nome / Ragione Sociale:</span>
<input
type="text"
wire:model="schedaForm.cliente_nome"
class="w-full py-1 px-2 rounded border border-slate-200 bg-slate-50 text-slate-900 font-bold text-xs"
/>
</div>
<div class="grid grid-cols-2 gap-2">
<div>
<span class="text-[11px] font-semibold text-slate-500">Cellulare:</span>
<input
type="text"
wire:model="schedaForm.cliente_telefono"
class="w-full py-1 px-2 rounded border border-slate-200 bg-slate-50 font-mono text-xs"
/>
</div>
<div>
<span class="text-[11px] font-semibold text-slate-500">Fisso:</span>
<input
type="text"
wire:model="schedaForm.cliente_tel_fisso"
class="w-full py-1 px-2 rounded border border-slate-200 bg-slate-50 font-mono text-xs"
/>
</div>
</div>
<div>
<span class="text-[11px] font-semibold text-slate-500">Indirizzo & Città:</span>
<div class="grid grid-cols-2 gap-2">
<input
type="text"
wire:model="schedaForm.cliente_indirizzo"
placeholder="Indirizzo..."
class="w-full py-1 px-2 rounded border border-slate-200 bg-slate-50 text-xs"
/>
<input
type="text"
wire:model="schedaForm.cliente_citta"
placeholder="Città..."
class="w-full py-1 px-2 rounded border border-slate-200 bg-slate-50 text-xs font-semibold"
/>
</div>
</div>
</div>
</div>
</div>
{{-- SUB-TABS BAR (7 TABS TECNOREPAIR DESKTOP) --}}
<div class="bg-slate-100 border-b border-slate-200 px-4 pt-2 flex flex-wrap gap-1 text-xs font-bold">
@php
$subTabs = [
'entrata' => '1. Apparecchio in Entrata',
'riparazione' => '2. Riparazione & Flussi ⚡',
'ricambi' => '3. Ricambi Utilizzati',
'preventivo' => '4. Preventivo - Costi - DDT',
'annotazioni' => '5. Annotazioni & Cortesia',
'comunicazioni' => '6. Comunicazioni',
'cq' => '7. Controllo Qualità (C.Q.)',
];
@endphp
@foreach($subTabs as $tabKey => $tabLabel)
<button
type="button"
wire:click="setSchedaSubTab('{{ $tabKey }}')"
class="px-3.5 py-2 rounded-t-lg transition border-t border-x cursor-pointer {{ $schedaSubTab === $tabKey ? 'bg-white text-sky-800 border-slate-300 -mb-px font-black shadow-xs' : 'bg-slate-200/70 hover:bg-slate-200 text-slate-600 border-transparent' }}"
>
{{ $tabLabel }}
</button>
@endforeach
</div>
{{-- SUB-TAB CONTENTS --}}
<div class="p-5 space-y-4">
{{-- SUB-TAB 1: APPARECCHIO IN ENTRATA --}}
@if($schedaSubTab === 'entrata')
<div class="grid grid-cols-1 lg:grid-cols-2 gap-5">
{{-- LEFT COLUMN: DEVICE SPECS & IDENTIFIERS --}}
<div class="space-y-3 rounded-xl border border-slate-200 bg-slate-50/70 p-4">
<div class="text-xs font-black text-slate-700 uppercase tracking-wider border-b border-slate-200 pb-1 flex items-center justify-between">
<span>💻 Specifiche Apparecchio</span>
<span class="text-[11px] text-slate-500 font-normal">Identificatori univoci</span>
</div>
<div class="grid grid-cols-2 gap-3 text-xs">
<div>
<label class="block text-[11px] font-semibold text-slate-600 mb-0.5">Tipo Apparecchio</label>
<input
type="text"
value="{{ $activeScheda['product_type'] }}"
readonly
class="w-full py-1 px-2 rounded border border-slate-300 bg-white font-medium text-slate-800 text-xs"
/>
</div>
<div>
<label class="block text-[11px] font-semibold text-slate-600 mb-0.5">Marca</label>
<input
type="text"
value="{{ $activeScheda['brand'] }}"
readonly
class="w-full py-1 px-2 rounded border border-slate-300 bg-white font-bold text-slate-800 text-xs uppercase"
/>
</div>
<div>
<label class="block text-[11px] font-semibold text-slate-600 mb-0.5">Modello</label>
<input
type="text"
value="{{ $activeScheda['product_model'] }}"
readonly
class="w-full py-1 px-2 rounded border border-slate-300 bg-white font-bold text-slate-900 text-xs"
/>
</div>
<div>
<label class="block text-[11px] font-semibold text-slate-600 mb-0.5">Codice Prodotto</label>
<input
type="text"
value="{{ $activeScheda['product_code'] }}"
readonly
class="w-full py-1 px-2 rounded border border-slate-300 bg-white font-mono text-slate-800 text-xs"
/>
</div>
</div>
<div class="grid grid-cols-2 gap-3 text-xs">
<div>
<label class="block text-[11px] font-semibold text-sky-800 mb-0.5">Seriale / IMEI Primario</label>
<input
type="text"
value="{{ $activeScheda['serial_number'] }}"
readonly
class="w-full py-1.5 px-2 rounded border border-sky-300 bg-sky-50 font-mono font-bold text-sky-950 text-xs"
/>
</div>
<div>
<label class="block text-[11px] font-semibold text-slate-600 mb-0.5">Seriale 2 / IMEI SIM 2</label>
<input
type="text"
value="{{ $activeScheda['serial_number_2'] }}"
readonly
class="w-full py-1.5 px-2 rounded border border-slate-300 bg-white font-mono text-slate-800 text-xs"
/>
</div>
</div>
<div class="grid grid-cols-2 gap-3 text-xs">
<div>
<label class="block text-[11px] font-semibold text-slate-600 mb-0.5">Accessori Consegnati</label>
<input
type="text"
value="{{ $activeScheda['accessories'] }}"
readonly
class="w-full py-1 px-2 rounded border border-slate-300 bg-white text-slate-800 text-xs"
/>
</div>
<div>
<label class="block text-[11px] font-semibold text-slate-600 mb-0.5">Ubicazione / Locazione</label>
<input
type="text"
value="{{ $activeScheda['location'] }}"
readonly
class="w-full py-1 px-2 rounded border border-slate-300 bg-white text-slate-800 text-xs"
/>
</div>
</div>
</div>
{{-- RIGHT COLUMN: DEFECTS, NOTES & UNLOCK PATTERN MATRIX --}}
<div class="space-y-3">
<div class="rounded-xl border border-amber-300 bg-amber-50/70 p-3.5 space-y-1">
<label class="block text-xs font-bold text-amber-900 uppercase tracking-wider">
⚠️ Difetto Segnalato dal Cliente
</label>
<textarea
wire:model="schedaForm.difetto_segnalato"
rows="3"
class="w-full rounded-lg border-amber-300 bg-white p-2 text-xs font-medium text-amber-950 focus:border-amber-500 focus:ring-amber-500"
></textarea>
</div>
<div class="grid grid-cols-1 sm:grid-cols-2 gap-3">
{{-- PIN & UNLOCK CODE --}}
<div class="rounded-xl border border-slate-200 bg-slate-50/70 p-3.5 space-y-2">
<div class="text-xs font-bold text-slate-700 uppercase tracking-wider border-b border-slate-200 pb-1">
🔐 Codici di Sblocco
</div>
<div>
<label class="block text-[11px] font-semibold text-slate-600 mb-0.5">Codice PIN</label>
<input
type="text"
wire:model="schedaForm.pin_code"
placeholder="Es. 1234..."
class="w-full py-1 px-2 rounded border border-slate-300 bg-white font-mono font-bold text-slate-900 text-xs"
/>
</div>
<div>
<label class="block text-[11px] font-semibold text-slate-600 mb-0.5">Codice Sblocco Schermo</label>
<input
type="text"
wire:model="schedaForm.unlock_code"
placeholder="Es. Password o sequenza..."
class="w-full py-1 px-2 rounded border border-slate-300 bg-white font-mono font-bold text-slate-900 text-xs"
/>
</div>
</div>
{{-- PATTERN UNLOCK 3x3 MATRIX (ANDROID PATTERN GRID) --}}
<div class="rounded-xl border border-slate-200 bg-slate-50/70 p-3.5 flex flex-col items-center justify-between">
<div class="w-full text-xs font-bold text-slate-700 uppercase tracking-wider border-b border-slate-200 pb-1 text-center">
📱 Matrice Sblocco (3x3)
</div>
<div class="my-2 p-2 rounded-xl bg-slate-900 shadow-inner grid grid-cols-3 gap-2.5">
@for($dot = 0; $dot < 9; $dot++)
@php
$isActive = ($unlockPattern[$dot] ?? 0) === 1;
@endphp
<button
type="button"
wire:click="togglePatternDot({{ $dot }})"
class="w-7 h-7 rounded-full flex items-center justify-center font-black text-[10px] transition cursor-pointer shadow-xs {{ $isActive ? 'bg-sky-400 text-slate-950 ring-2 ring-sky-300 scale-110' : 'bg-slate-700 hover:bg-slate-600 text-slate-300' }}"
title="Nodo {{ $dot + 1 }}"
>
{{ $dot + 1 }}
</button>
@endfor
</div>
<div class="text-[10px] text-slate-500 text-center">
Fai clic sui pallini per comporre il segno
</div>
</div>
</div>
<div class="rounded-xl border border-slate-200 bg-white p-3 space-y-1">
<label class="block text-[11px] font-semibold text-slate-600">Stato Generale & Condizioni Estetiche</label>
<input
type="text"
wire:model="schedaForm.stato_generale"
placeholder="Es. Graffi su cover posteriore, vetro intatto..."
class="w-full py-1 px-2 rounded border border-slate-300 text-xs text-slate-800"
/>
</div>
</div>
</div>
@endif
{{-- SUB-TAB 2: RIPARAZIONE & FLUSSI AUTOMATIZZATI --}}
@if($schedaSubTab === 'riparazione')
<div class="space-y-4">
{{-- FLUSSI RAPIDI DI LAVORAZIONE --}}
<div class="p-4 rounded-xl border border-indigo-200 bg-indigo-50/60 space-y-3">
<div class="text-xs font-black text-indigo-900 uppercase tracking-wider flex items-center gap-1.5">
<span> AZIONI RAPIDE DI STATO & LAVORAZIONE</span>
</div>
<div class="grid grid-cols-1 sm:grid-cols-4 gap-3">
{{-- 1. RIPARATO --}}
<button
type="button"
wire:click="cambiaStatoRapido('4')"
class="p-3 rounded-xl border border-emerald-300 bg-white hover:bg-emerald-50 text-left transition shadow-xs space-y-1 cursor-pointer"
>
<div class="flex items-center gap-1.5">
<span class="w-5 h-5 rounded-full bg-emerald-100 text-emerald-700 flex items-center justify-center font-bold text-xs"></span>
<h4 class="font-bold text-xs text-emerald-900">4. RIPARATO</h4>
</div>
<p class="text-[11px] text-slate-600">Apparato collaudato e pronto al ritiro.</p>
</button>
{{-- 2. IN RIPARAZIONE --}}
<button
type="button"
wire:click="cambiaStatoRapido('2')"
class="p-3 rounded-xl border border-sky-300 bg-white hover:bg-sky-50 text-left transition shadow-xs space-y-1 cursor-pointer"
>
<div class="flex items-center gap-1.5">
<span class="w-5 h-5 rounded-full bg-sky-100 text-sky-700 flex items-center justify-center font-bold text-xs">⚙️</span>
<h4 class="font-bold text-xs text-sky-900">2. IN RIPARAZIONE</h4>
</div>
<p class="text-[11px] text-slate-600">Dispositivo sul banco di lavoro.</p>
</button>
{{-- 3. ATTESA RICAMBIO --}}
<button
type="button"
wire:click="cambiaStatoRapido('5')"
class="p-3 rounded-xl border border-amber-300 bg-white hover:bg-amber-50 text-left transition shadow-xs space-y-1 cursor-pointer"
>
<div class="flex items-center gap-1.5">
<span class="w-5 h-5 rounded-full bg-amber-100 text-amber-700 flex items-center justify-center font-bold text-xs"></span>
<h4 class="font-bold text-xs text-amber-900">5. ATTESA RICAMBIO</h4>
</div>
<p class="text-[11px] text-slate-600">In attesa ricezione componente.</p>
</button>
{{-- 4. ROTTAMAZIONE / RICAMBI --}}
<button
type="button"
wire:click="cambiaStatoRapido('23')"
class="p-3 rounded-xl border border-rose-300 bg-white hover:bg-rose-50 text-left transition shadow-xs space-y-1 cursor-pointer"
>
<div class="flex items-center gap-1.5">
<span class="w-5 h-5 rounded-full bg-rose-100 text-rose-700 flex items-center justify-center font-bold text-xs"></span>
<h4 class="font-bold text-xs text-rose-900">23. USO RICAMBI</h4>
</div>
<p class="text-[11px] text-slate-600">Dispositivo irrecuperabile.</p>
</button>
</div>
</div>
{{-- DESCRIZIONE RIPARAZIONE / RAPPORTO TECNICO --}}
<div class="rounded-xl border border-slate-200 bg-white p-4 space-y-3">
<div class="text-xs font-bold text-slate-800 uppercase tracking-wider">
🛠️ Descrizione Riparazione & Intervento Eseguito
</div>
<textarea
wire:model="schedaForm.repair_description"
rows="5"
placeholder="Descrivere le operazioni tecniche eseguite, test completati, componenti sostituiti..."
class="w-full rounded-lg border border-slate-300 p-2.5 text-xs text-slate-900 focus:border-sky-500 focus:ring-sky-500"
></textarea>
</div>
</div>
@endif
{{-- SUB-TAB 3: RICAMBI UTILIZZATI --}}
@if($schedaSubTab === 'ricambi')
<div class="rounded-xl border border-slate-200 bg-white p-4 space-y-3">
<div class="flex items-center justify-between border-b border-slate-100 pb-2">
<div class="text-xs font-bold text-slate-800 uppercase tracking-wider">
📦 Ricambi & Componenti Collegati alla Scheda
</div>
<a
href="/admin-filament/fornitore/prodotti?fornitore={{ $fornitoreId }}"
class="text-xs font-bold text-sky-700 hover:text-sky-900"
>
+ Consulta Catalogo Ricambi
</a>
</div>
<div class="p-6 text-center text-xs text-slate-500 bg-slate-50 rounded-lg">
Per questa scheda non risultano codici ricambio scaricati dall'archivio legacy.
I seriali impiegati possono essere ricercati tramite la sezione <a href="/admin-filament/fornitore/seriali?fornitore={{ $fornitoreId }}" class="font-bold text-sky-700 underline">Ricerca Seriali</a>.
</div>
</div>
@endif
{{-- SUB-TAB 4: PREVENTIVO - COSTI - DDT --}}
@if($schedaSubTab === 'preventivo')
<div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
<div class="rounded-xl border border-slate-200 bg-white p-4 space-y-3">
<div class="text-xs font-bold text-slate-800 uppercase tracking-wider border-b border-slate-100 pb-1.5">
💶 Riepilogo Economico Intervento
</div>
<div class="grid grid-cols-2 gap-3 text-xs">
<div>
<label class="block text-[11px] font-semibold text-slate-600 mb-0.5">Costo Preventivo</label>
<input
type="text"
value="€ {{ $activeScheda['costo_preventivo'] }}"
readonly
class="w-full py-1 px-2 rounded border border-slate-200 bg-slate-50 font-bold text-slate-800 text-xs"
/>
</div>
<div>
<label class="block text-[11px] font-semibold text-slate-600 mb-0.5">Acconto Versato</label>
<input
type="text"
value="€ {{ $activeScheda['acconto'] }}"
readonly
class="w-full py-1 px-2 rounded border border-slate-200 bg-slate-50 font-bold text-slate-800 text-xs"
/>
</div>
<div>
<label class="block text-[11px] font-semibold text-slate-600 mb-0.5">Costo Subito</label>
<input
type="text"
value="€ {{ $activeScheda['costo_subito'] }}"
readonly
class="w-full py-1 px-2 rounded border border-slate-200 bg-slate-50 font-mono text-slate-800 text-xs"
/>
</div>
<div>
<label class="block text-[11px] font-semibold text-slate-600 mb-0.5">Costo Addebitato</label>
<input
type="text"
value="€ {{ $activeScheda['costo_addebitato'] }}"
readonly
class="w-full py-1 px-2 rounded border border-slate-200 bg-slate-50 font-bold text-emerald-700 text-xs"
/>
</div>
</div>
</div>
<div class="rounded-xl border border-slate-200 bg-white p-4 space-y-3">
<div class="text-xs font-bold text-slate-800 uppercase tracking-wider border-b border-slate-100 pb-1.5">
📄 Riferimenti Documenti di Trasporto (DDT)
</div>
<div class="space-y-2 text-xs">
<div>
<label class="block text-[11px] font-semibold text-slate-600 mb-0.5">DDT Entrata</label>
<input
type="text"
value="{{ $activeScheda['rif_ddt_entrata'] }}"
readonly
class="w-full py-1 px-2 rounded border border-slate-200 bg-slate-50 text-xs text-slate-800"
/>
</div>
<div>
<label class="block text-[11px] font-semibold text-slate-600 mb-0.5">DDT Uscita</label>
<input
type="text"
value="{{ $activeScheda['rif_ddt_uscita'] }}"
readonly
class="w-full py-1 px-2 rounded border border-slate-200 bg-slate-50 text-xs text-slate-800"
/>
</div>
</div>
</div>
</div>
@endif
{{-- SUB-TAB 5: ANNOTAZIONI & CORTESIA --}}
@if($schedaSubTab === 'annotazioni')
<div class="grid grid-cols-1 lg:grid-cols-2 gap-4">
<div class="space-y-3">
<div class="rounded-xl border border-slate-200 bg-white p-4 space-y-2">
<label class="block text-xs font-bold text-slate-800 uppercase tracking-wider">
🔒 Note Interne (Riservate Laboratorio)
</label>
<textarea
wire:model="schedaForm.note_interne"
rows="4"
class="w-full rounded-lg border border-slate-300 p-2 text-xs text-slate-900 focus:border-sky-500 focus:ring-sky-500"
></textarea>
</div>
<div class="rounded-xl border border-slate-200 bg-white p-4 space-y-2">
<label class="block text-xs font-bold text-slate-800 uppercase tracking-wider">
🖨️ Note di Stampa (Visibili in Ricevuta)
</label>
<textarea
wire:model="schedaForm.note_stampa"
rows="4"
class="w-full rounded-lg border border-slate-300 p-2 text-xs text-slate-900 focus:border-sky-500 focus:ring-sky-500"
></textarea>
</div>
</div>
<div class="rounded-xl border border-slate-200 bg-slate-50 p-4 space-y-3">
<div class="text-xs font-bold text-slate-800 uppercase tracking-wider border-b border-slate-200 pb-1.5">
📱 Apparecchio Sostitutivo di Cortesia
</div>
<div class="space-y-2 text-xs">
<div>
<label class="block text-[11px] font-semibold text-slate-600 mb-0.5">Marca e Modello</label>
<input
type="text"
value="{{ $activeScheda['sost_marca_modello'] }}"
readonly
class="w-full py-1 px-2 rounded border border-slate-200 bg-white text-xs text-slate-800"
/>
</div>
<div>
<label class="block text-[11px] font-semibold text-slate-600 mb-0.5">Numero Seriale Sostitutivo</label>
<input
type="text"
value="{{ $activeScheda['sost_seriale'] }}"
readonly
class="w-full py-1 px-2 rounded border border-slate-200 bg-white font-mono text-xs text-slate-800"
/>
</div>
<div>
<label class="block text-[11px] font-semibold text-slate-600 mb-0.5">Stato Generale Sostitutivo</label>
<input
type="text"
value="{{ $activeScheda['sost_stato'] }}"
readonly
class="w-full py-1 px-2 rounded border border-slate-200 bg-white text-xs text-slate-800"
/>
</div>
</div>
</div>
</div>
@endif
{{-- SUB-TAB 6: COMUNICAZIONI --}}
@if($schedaSubTab === 'comunicazioni')
<div class="rounded-xl border border-slate-200 bg-white p-4 space-y-3">
<div class="text-xs font-bold text-slate-800 uppercase tracking-wider">
💬 Storico Comunicazioni & Avvisi al Cliente
</div>
<textarea
wire:model="schedaForm.communications"
rows="6"
placeholder="Registrare note telefonate, SMS inviati, conferme di preventivo..."
class="w-full rounded-lg border border-slate-300 p-2.5 text-xs text-slate-900 focus:border-sky-500 focus:ring-sky-500"
></textarea>
</div>
@endif
{{-- SUB-TAB 7: CONTROLLO QUALITÀ (C.Q.) --}}
@if($schedaSubTab === 'cq')
<div class="rounded-xl border border-slate-200 bg-white p-4 space-y-4">
<div class="text-xs font-bold text-slate-800 uppercase tracking-wider border-b border-slate-100 pb-2">
✅ Checklist Controllo Qualità & Collaudo Finale (C.Q.)
</div>
<div class="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-3 text-xs">
<div class="p-3 rounded-lg bg-slate-50 border border-slate-200 flex items-center gap-2">
<span class="w-5 h-5 rounded-full bg-emerald-100 text-emerald-700 flex items-center justify-center font-bold text-xs">✓</span>
<span class="font-medium text-slate-800">Accensione & Boot Sistema OK</span>
</div>
<div class="p-3 rounded-lg bg-slate-50 border border-slate-200 flex items-center gap-2">
<span class="w-5 h-5 rounded-full bg-emerald-100 text-emerald-700 flex items-center justify-center font-bold text-xs">✓</span>
<span class="font-medium text-slate-800">Display & Touchscreen Reattivi</span>
</div>
<div class="p-3 rounded-lg bg-slate-50 border border-slate-200 flex items-center gap-2">
<span class="w-5 h-5 rounded-full bg-emerald-100 text-emerald-700 flex items-center justify-center font-bold text-xs">✓</span>
<span class="font-medium text-slate-800">Audio Capsula & Speaker OK</span>
</div>
<div class="p-3 rounded-lg bg-slate-50 border border-slate-200 flex items-center gap-2">
<span class="w-5 h-5 rounded-full bg-emerald-100 text-emerald-700 flex items-center justify-center font-bold text-xs">✓</span>
<span class="font-medium text-slate-800">Ricarica Batteria & Alimentazione</span>
</div>
<div class="p-3 rounded-lg bg-slate-50 border border-slate-200 flex items-center gap-2">
<span class="w-5 h-5 rounded-full bg-emerald-100 text-emerald-700 flex items-center justify-center font-bold text-xs">✓</span>
<span class="font-medium text-slate-800">Connettività Wi-Fi / BT / Rete</span>
</div>
<div class="p-3 rounded-lg bg-slate-50 border border-slate-200 flex items-center gap-2">
<span class="w-5 h-5 rounded-full bg-emerald-100 text-emerald-700 flex items-center justify-center font-bold text-xs">✓</span>
<span class="font-medium text-slate-800">Pulizia & Sigillo Laboratorio</span>
</div>
</div>
</div>
@endif
</div>
{{-- BOTTOM ACTION TOOLBAR --}}
<div class="p-4 bg-slate-100 border-t border-slate-200 flex flex-wrap items-center justify-between gap-3">
<div class="flex items-center gap-2">
<button
type="button"
wire:click="closeScheda"
class="inline-flex items-center gap-1.5 px-4 py-2 rounded-lg border border-slate-300 bg-white text-xs font-bold text-slate-700 hover:bg-slate-50 shadow-xs transition cursor-pointer"
>
⬅️ Torna all'Elenco Lavorazioni
</button>
<button
type="button"
onclick="window.print()"
class="inline-flex items-center gap-1.5 px-4 py-2 rounded-lg border border-slate-300 bg-white text-xs font-bold text-slate-700 hover:bg-slate-50 shadow-xs transition cursor-pointer"
>
🖨️ Stampa Ricevuta
</button>
</div>
<button
type="button"
wire:click="saveActiveScheda"
class="inline-flex items-center gap-1.5 px-5 py-2 rounded-lg bg-emerald-600 hover:bg-emerald-500 text-white text-xs font-bold shadow-xs transition cursor-pointer"
>
💾 Salva Modifiche Scheda
</button>
</div>
</div>
@else
{{-- TICKET AMMINISTRATORE SCHEDA IN-PAGE VIEW --}}
<div class="rounded-xl border border-slate-300 bg-white shadow-md overflow-hidden space-y-4">
<div class="p-4 bg-gradient-to-r from-slate-900 via-indigo-950 to-slate-900 text-white flex flex-wrap items-center justify-between gap-3 border-b border-indigo-800">
<div class="flex items-center gap-3">
<span class="px-3 py-1.5 rounded-lg bg-indigo-500 text-white font-black text-sm shadow-xs">
{{ $activeScheda['numero_scheda'] }}
</span>
<div>
<h3 class="text-base font-bold text-white">{{ $activeScheda['title'] }}</h3>
<p class="text-xs text-indigo-200">
Stabile: <span class="font-bold text-white">{{ $activeScheda['stabile'] }}</span>
Richiedente: <span class="font-semibold text-white">{{ $activeScheda['customer_name'] }}</span>
</p>
</div>
</div>
<div class="flex items-center gap-2">
<span class="px-3 py-1 rounded-full text-xs font-bold border border-white/20 bg-white/10 text-white">
Stato: {{ $activeScheda['status'] }}
</span>
@if(($activeScheda['url'] ?? '') !== '')
<a
href="{{ $activeScheda['url'] }}"
class="inline-flex items-center gap-1 px-3 py-1 rounded-lg bg-sky-600 hover:bg-sky-500 text-white text-xs font-bold transition shadow-xs"
>
Apri Gestione Ticket
</a>
@endif
<button
type="button"
wire:click="closeScheda"
class="inline-flex items-center gap-1 px-3 py-1 rounded-lg bg-white/10 hover:bg-white/20 text-white text-xs font-bold transition cursor-pointer"
>
Chiudi
</button>
</div>
</div>
<div class="p-5 space-y-4">
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
<div class="p-4 rounded-xl border border-slate-200 bg-slate-50 space-y-2">
<div class="text-xs font-bold text-slate-700 uppercase tracking-wider border-b border-slate-200 pb-1">
🏢 Dati Stabile & Contatto
</div>
<div class="text-sm font-bold text-slate-900">{{ $activeScheda['stabile'] }}</div>
<div class="text-xs text-slate-600"><strong>Unità:</strong> {{ $activeScheda['unita'] ?? '-' }}</div>
<div class="text-xs text-slate-600"><strong>Richiedente:</strong> {{ $activeScheda['customer_name'] }}</div>
<div class="text-xs text-slate-600"><strong>Telefono:</strong> {{ $activeScheda['customer_phone'] ?: '-' }}</div>
<div class="text-xs text-slate-600"><strong>Indirizzo:</strong> {{ $activeScheda['customer_address'] }}, {{ $activeScheda['customer_city'] }}</div>
</div>
<div class="p-4 rounded-xl border border-slate-200 bg-slate-50 space-y-2">
<div class="text-xs font-bold text-slate-700 uppercase tracking-wider border-b border-slate-200 pb-1">
📋 Stato Intervento
</div>
<div>
<label class="block text-[11px] font-semibold text-slate-600 mb-1">Stato Ticket Fornitore</label>
<input
type="text"
wire:model="schedaForm.status_code"
class="w-full py-1.5 px-2.5 rounded-lg border border-slate-300 bg-white font-bold text-slate-800 text-xs"
/>
</div>
<div class="text-xs text-slate-600 pt-2">
<strong>Operatore Assegnato:</strong> {{ $activeScheda['operator'] }}
</div>
</div>
</div>
<div class="p-4 rounded-xl border border-amber-200 bg-amber-50 space-y-1">
<div class="text-xs font-bold text-amber-900 uppercase tracking-wider">⚠️ Problema Segnalato nel Ticket</div>
<p class="text-xs font-medium text-amber-950 whitespace-pre-line">{{ $activeScheda['defect_reported'] }}</p>
</div>
<div class="p-4 rounded-xl border border-slate-200 bg-white space-y-2">
<div class="text-xs font-bold text-slate-800 uppercase tracking-wider">🛠️ Rapporto Intervento Fornitore</div>
<textarea
wire:model="schedaForm.repair_description"
rows="5"
class="w-full rounded-lg border border-slate-300 p-2.5 text-xs text-slate-900 focus:border-indigo-500 focus:ring-indigo-500"
placeholder="Rapporto delle operazioni svolte..."
></textarea>
</div>
</div>
<div class="p-4 bg-slate-100 border-t border-slate-200 flex items-center justify-between gap-3">
<button
type="button"
wire:click="closeScheda"
class="inline-flex items-center gap-1.5 px-4 py-2 rounded-lg border border-slate-300 bg-white text-xs font-bold text-slate-700 hover:bg-slate-50 shadow-xs transition cursor-pointer"
>
⬅️ Torna all'Elenco Lavorazioni
</button>
<button
type="button"
wire:click="saveActiveScheda"
class="inline-flex items-center gap-1.5 px-5 py-2 rounded-lg bg-indigo-600 hover:bg-indigo-500 text-white text-xs font-bold shadow-xs transition cursor-pointer"
>
💾 Salva Intervento
</button>
</div>
</div>
@endif
@endif
@endif
</div>
</x-filament-panels::page>