152 lines
8.4 KiB
PHP
152 lines
8.4 KiB
PHP
@extends('layouts.app')
|
|
|
|
@section('content')
|
|
<section class="mx-auto max-w-4xl space-y-6">
|
|
<div class="border-b border-zinc-200 pb-6">
|
|
<a href="{{ route('contacts.index') }}" class="text-sm font-medium text-teal-700 hover:text-teal-900">Retour aux contacts</a>
|
|
<div class="mt-3 flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between">
|
|
<div>
|
|
<h1 class="text-2xl font-semibold">{{ $contact->displayName() }}</h1>
|
|
<p class="mt-2 text-sm text-zinc-600">{{ $contact->organization ?: ucfirst($contact->source) }}</p>
|
|
</div>
|
|
|
|
<div class="flex flex-col gap-3 sm:items-end">
|
|
<div class="flex flex-wrap gap-2">
|
|
@if ($contact->is_favorite)
|
|
<span class="rounded-full bg-amber-50 px-3 py-1 text-sm font-semibold text-amber-800">Favori</span>
|
|
@endif
|
|
@if ($contact->sms_opt_out)
|
|
<span class="rounded-full bg-red-50 px-3 py-1 text-sm font-semibold text-red-700">Refus SMS</span>
|
|
@endif
|
|
</div>
|
|
|
|
<form method="POST" action="{{ route('contacts.favorite', $contact) }}" class="flex justify-end">
|
|
@csrf
|
|
@method('PATCH')
|
|
<input type="hidden" name="is_favorite" value="{{ $contact->is_favorite ? '0' : '1' }}">
|
|
<button type="submit" class="rounded-md border border-amber-300 px-4 py-2 text-sm font-semibold text-amber-800 hover:bg-amber-50">
|
|
{{ $contact->is_favorite ? 'Retirer des favoris' : 'Mettre en favori' }}
|
|
</button>
|
|
</form>
|
|
|
|
<form method="POST" action="{{ route('contacts.opt-out', $contact) }}" class="flex justify-end">
|
|
@csrf
|
|
@method('PATCH')
|
|
<input type="hidden" name="sms_opt_out" value="{{ $contact->sms_opt_out ? '0' : '1' }}">
|
|
<button type="submit" class="rounded-md border border-red-300 px-4 py-2 text-sm font-semibold text-red-700 hover:bg-red-50">
|
|
{{ $contact->sms_opt_out ? 'Retirer Refus SMS' : 'Refus SMS' }}
|
|
</button>
|
|
</form>
|
|
|
|
@if ($contact->source === 'local')
|
|
<div class="flex flex-wrap gap-2">
|
|
<a href="{{ route('contacts.edit', $contact) }}" class="rounded-md bg-teal-700 px-4 py-2 text-sm font-semibold text-white hover:bg-teal-800">
|
|
Modifier
|
|
</a>
|
|
|
|
<form method="POST" action="{{ route('contacts.destroy', $contact) }}" onsubmit="return confirm('Supprimer ce contact ?')">
|
|
@csrf
|
|
@method('DELETE')
|
|
<button type="submit" class="rounded-md border border-red-300 px-4 py-2 text-sm font-semibold text-red-700 hover:bg-red-50">
|
|
Supprimer
|
|
</button>
|
|
</form>
|
|
</div>
|
|
@else
|
|
<span class="rounded-full bg-amber-50 px-3 py-1 text-sm font-semibold text-amber-800">
|
|
Fiche importee non modifiable
|
|
</span>
|
|
@endif
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
@if (session('status'))
|
|
<div class="rounded-md border border-teal-200 bg-teal-50 px-4 py-3 text-sm font-medium text-teal-900">
|
|
{{ session('status') }}
|
|
</div>
|
|
@endif
|
|
|
|
<div class="grid gap-6 lg:grid-cols-[minmax(0,1fr)_18rem]">
|
|
<div class="space-y-6">
|
|
<div class="rounded-lg border border-zinc-200 bg-white p-5">
|
|
<h2 class="text-base font-semibold">Coordonnees</h2>
|
|
|
|
<dl class="mt-5 grid gap-4 sm:grid-cols-2">
|
|
<div>
|
|
<dt class="text-sm font-medium text-zinc-500">Email</dt>
|
|
<dd class="mt-1 text-sm text-zinc-900">{{ $contact->email ?: 'Non renseigne' }}</dd>
|
|
</div>
|
|
<div>
|
|
<dt class="text-sm font-medium text-zinc-500">Source</dt>
|
|
<dd class="mt-1 text-sm text-zinc-900">{{ $contact->source }}</dd>
|
|
</div>
|
|
@if ($contact->synced_at)
|
|
<div>
|
|
<dt class="text-sm font-medium text-zinc-500">Derniere synchro</dt>
|
|
<dd class="mt-1 text-sm text-zinc-900">{{ $contact->synced_at->format('d/m/Y H:i') }}</dd>
|
|
</div>
|
|
@endif
|
|
</dl>
|
|
</div>
|
|
|
|
<div class="rounded-lg border border-zinc-200 bg-white p-5">
|
|
<h2 class="text-base font-semibold">Numeros</h2>
|
|
|
|
<div class="mt-5 space-y-3">
|
|
@forelse ($contact->phoneNumbers as $phoneNumber)
|
|
<div class="rounded-md border border-zinc-200 p-4">
|
|
<div class="flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between">
|
|
<div>
|
|
<p class="text-sm font-semibold text-zinc-900">{{ $phoneNumber->label ?: 'Telephone' }}</p>
|
|
<p class="mt-1 text-sm text-zinc-700">{{ $phoneNumber->normalized_number ?: $phoneNumber->raw_number }}</p>
|
|
@if ($phoneNumber->normalized_number)
|
|
<p class="mt-1 text-xs text-zinc-500">Brut : {{ $phoneNumber->raw_number }}</p>
|
|
@endif
|
|
</div>
|
|
|
|
<div class="flex flex-wrap gap-2">
|
|
<span class="rounded-full px-3 py-1 text-xs font-semibold {{ $phoneNumber->is_valid ? 'bg-teal-50 text-teal-800' : 'bg-red-50 text-red-700' }}">
|
|
{{ $phoneNumber->is_valid ? 'Valide' : 'Invalide' }}
|
|
</span>
|
|
<span class="rounded-full px-3 py-1 text-xs font-semibold {{ $phoneNumber->hasDetectedMobileNumber() ? 'bg-teal-50 text-teal-800' : 'bg-zinc-100 text-zinc-700' }}">
|
|
{{ $phoneNumber->hasDetectedMobileNumber() ? 'Mobile' : 'Non mobile' }}
|
|
</span>
|
|
</div>
|
|
</div>
|
|
|
|
@if ($phoneNumber->validation_error)
|
|
<p class="mt-3 text-sm text-red-700">{{ $phoneNumber->validation_error }}</p>
|
|
@endif
|
|
</div>
|
|
@empty
|
|
<p class="text-sm text-zinc-600">Aucun numero.</p>
|
|
@endforelse
|
|
</div>
|
|
</div>
|
|
|
|
@if ($contact->notes)
|
|
<div class="rounded-lg border border-zinc-200 bg-white p-5">
|
|
<h2 class="text-base font-semibold">Notes</h2>
|
|
<p class="mt-4 whitespace-pre-line text-sm text-zinc-700">{{ $contact->notes }}</p>
|
|
</div>
|
|
@endif
|
|
</div>
|
|
|
|
<aside class="rounded-lg border border-zinc-200 bg-white p-5">
|
|
<h2 class="text-base font-semibold">Groupes</h2>
|
|
|
|
<div class="mt-4 space-y-2">
|
|
@forelse ($contact->groups as $group)
|
|
<a href="{{ route('contacts.index', ['group' => $group->id]) }}" class="block rounded-md border border-zinc-200 px-3 py-2 text-sm font-medium text-zinc-800 hover:bg-zinc-50">
|
|
{{ $group->name }}
|
|
</a>
|
|
@empty
|
|
<p class="text-sm text-zinc-600">Aucun groupe.</p>
|
|
@endforelse
|
|
</div>
|
|
</aside>
|
|
</div>
|
|
</section>
|
|
@endsection
|