Files
laravel-test/resources/views/customers/show.blade.php
2026-03-30 19:15:13 +02:00

154 lines
7.4 KiB
PHP

@extends('layouts.app')
@section('title', $customer->name)
@section('page-title', $customer->name)
@section('page-actions')
<div class="btn-group">
<a href="{{ route('customers.index') }}" class="btn btn-outline-secondary">
<i class="bi bi-arrow-left me-1"></i>Lista
</a>
<a href="{{ route('customers.edit', $customer) }}" class="btn btn-warning">
<i class="bi bi-pencil me-1"></i>Modifica
</a>
<form method="POST" action="{{ route('customers.destroy', $customer) }}"
onsubmit="return confirm('Sei sicuro di voler eliminare questo cliente?')">
@csrf
@method('DELETE')
<button type="submit" class="btn btn-danger">
<i class="bi bi-trash me-1"></i>Elimina
</button>
</form>
</div>
@endsection
@section('content')
<div class="row g-4">
{{-- ─── Scheda principale ────────────────────────────────────────────── --}}
<div class="col-lg-8">
<div class="card">
<div class="card-header bg-white border-0 pt-4 px-4 pb-0">
<div class="d-flex align-items-center gap-3">
{{-- Avatar generato con iniziali --}}
<div class="rounded-circle bg-primary d-flex align-items-center justify-content-center text-white fw-bold fs-4"
style="width: 56px; height: 56px; flex-shrink: 0;">
{{ strtoupper(substr($customer->name, 0, 1)) }}
</div>
<div>
<h4 class="mb-1">{{ $customer->name }}</h4>
<div class="d-flex gap-2">
<span class="badge bg-{{ $customer->badge_color }}">{{ ucfirst($customer->status) }}</span>
<span class="badge bg-light text-dark border">{{ $customer->type_label }}</span>
</div>
</div>
</div>
</div>
<div class="card-body p-4">
<div class="row g-4">
{{-- Contatti --}}
<div class="col-md-6">
<h6 class="text-muted text-uppercase small fw-semibold mb-3">Contatto</h6>
<dl class="row mb-0">
<dt class="col-4 text-muted fw-normal small">Email</dt>
<dd class="col-8">
<a href="mailto:{{ $customer->email }}">{{ $customer->email }}</a>
</dd>
@if($customer->phone)
<dt class="col-4 text-muted fw-normal small">Telefono</dt>
<dd class="col-8">
<a href="tel:{{ $customer->phone }}">{{ $customer->phone }}</a>
</dd>
@endif
@if($customer->city)
<dt class="col-4 text-muted fw-normal small">Città</dt>
<dd class="col-8">{{ $customer->city }}</dd>
@endif
@if($customer->address)
<dt class="col-4 text-muted fw-normal small">Indirizzo</dt>
<dd class="col-8">{{ $customer->address }}</dd>
@endif
</dl>
</div>
{{-- Dati fiscali --}}
<div class="col-md-6">
<h6 class="text-muted text-uppercase small fw-semibold mb-3">Dati fiscali</h6>
<dl class="row mb-0">
@if($customer->vat_number)
<dt class="col-5 text-muted fw-normal small">P. IVA</dt>
<dd class="col-7 font-monospace">{{ $customer->vat_number }}</dd>
@endif
@if($customer->fiscal_code)
<dt class="col-5 text-muted fw-normal small">Cod. Fiscale</dt>
<dd class="col-7 font-monospace">{{ $customer->fiscal_code }}</dd>
@endif
<dt class="col-5 text-muted fw-normal small">Contratto</dt>
<dd class="col-7 fw-bold text-success fs-5">
{{ $appSettings['currency_symbol'] }}{{ number_format($customer->contract_value, 2, ',', '.') }}
</dd>
</dl>
</div>
</div>
{{-- Note --}}
@if ($customer->notes)
<hr>
<h6 class="text-muted text-uppercase small fw-semibold mb-2">Note</h6>
<p class="mb-0 text-secondary">{{ $customer->notes }}</p>
@endif
</div>
</div>
</div>
{{-- ─── Sidebar informazioni ─────────────────────────────────────────── --}}
<div class="col-lg-4">
<div class="card mb-3">
<div class="card-body">
<h6 class="text-muted text-uppercase small fw-semibold mb-3">Timeline</h6>
<div class="d-flex flex-column gap-2">
<div class="d-flex justify-content-between">
<span class="text-muted small">Creato il</span>
{{-- format() usa il formato da configurazione dinamica --}}
<span class="small">{{ $customer->created_at->format($appSettings['date_format'] ?? 'd/m/Y') }}</span>
</div>
<div class="d-flex justify-content-between">
<span class="text-muted small">Aggiornato il</span>
<span class="small">{{ $customer->updated_at->format($appSettings['date_format'] ?? 'd/m/Y') }}</span>
</div>
<div class="d-flex justify-content-between">
<span class="text-muted small">ID sistema</span>
<span class="small font-monospace">#{{ $customer->id }}</span>
</div>
</div>
</div>
</div>
<div class="card">
<div class="card-body text-center">
<p class="text-muted small mb-3">Azioni rapide</p>
<div class="d-grid gap-2">
<a href="{{ route('customers.edit', $customer) }}" class="btn btn-warning btn-sm">
<i class="bi bi-pencil me-1"></i>Modifica dati
</a>
<a href="mailto:{{ $customer->email }}" class="btn btn-outline-primary btn-sm">
<i class="bi bi-envelope me-1"></i>Invia email
</a>
</div>
</div>
</div>
</div>
</div>
@endsection