Publication initiale de RelaisSMS : documentation et sources nettoyees
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="mx-auto max-w-md">
|
||||
<div class="rounded-lg border border-zinc-200 bg-white p-6 shadow-sm">
|
||||
<h1 class="text-2xl font-semibold">Connexion</h1>
|
||||
|
||||
<form method="POST" action="{{ route('login') }}" class="mt-6 space-y-5">
|
||||
@csrf
|
||||
|
||||
<div>
|
||||
<label for="email" class="block text-sm font-medium text-zinc-700">Identifiant</label>
|
||||
<input
|
||||
id="email"
|
||||
name="email"
|
||||
type="text"
|
||||
value="{{ old('email') }}"
|
||||
autocomplete="username"
|
||||
required
|
||||
autofocus
|
||||
class="mt-2 block w-full rounded-md border border-zinc-300 px-3 py-2 text-base shadow-sm outline-none focus:border-teal-600 focus:ring-2 focus:ring-teal-600/20"
|
||||
>
|
||||
@error('email')
|
||||
<p class="mt-2 text-sm text-red-700">{{ $message }}</p>
|
||||
@enderror
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="password" class="block text-sm font-medium text-zinc-700">Mot de passe</label>
|
||||
<input
|
||||
id="password"
|
||||
name="password"
|
||||
type="password"
|
||||
autocomplete="current-password"
|
||||
required
|
||||
class="mt-2 block w-full rounded-md border border-zinc-300 px-3 py-2 text-base shadow-sm outline-none focus:border-teal-600 focus:ring-2 focus:ring-teal-600/20"
|
||||
>
|
||||
@error('password')
|
||||
<p class="mt-2 text-sm text-red-700">{{ $message }}</p>
|
||||
@enderror
|
||||
</div>
|
||||
|
||||
<label class="flex items-center gap-2 text-sm text-zinc-700">
|
||||
<input name="remember" type="checkbox" class="h-4 w-4 rounded border-zinc-300 text-teal-700 focus:ring-teal-600">
|
||||
Rester connecte
|
||||
</label>
|
||||
|
||||
<button type="submit" class="w-full rounded-md bg-teal-700 px-4 py-2.5 text-sm font-semibold text-white hover:bg-teal-800 focus:outline-none focus:ring-2 focus:ring-teal-600 focus:ring-offset-2">
|
||||
Se connecter
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
@@ -0,0 +1,112 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<section class="page-wrap">
|
||||
<header class="topbar">
|
||||
<div class="title">
|
||||
<a href="{{ route('contacts.index', ['group' => $group->id]) }}" class="link">Retour aux contacts</a>
|
||||
<h1 class="h-offset">Modifier le groupe</h1>
|
||||
<p>{{ $group->contacts_count }} contact(s) · groupe local</p>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<form method="POST" action="{{ route('contact-groups.update', $group) }}" class="panel">
|
||||
@csrf
|
||||
@method('PUT')
|
||||
<input type="hidden" name="members_submitted" value="1">
|
||||
|
||||
<div class="panel-header">
|
||||
<h2>Informations</h2>
|
||||
</div>
|
||||
|
||||
<div class="panel-body stack">
|
||||
<div class="form-grid cols-2">
|
||||
<div class="field">
|
||||
<label for="name">Nom</label>
|
||||
<input id="name" name="name" value="{{ old('name', $group->name) }}" required class="input">
|
||||
@error('name')
|
||||
<p class="notice error">{{ $message }}</p>
|
||||
@enderror
|
||||
</div>
|
||||
|
||||
<label class="field-label inline-badges">
|
||||
<input name="is_favorite" type="checkbox" value="1" @checked(old('is_favorite', $group->is_favorite))>
|
||||
Favori
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<label for="description">Description</label>
|
||||
<textarea id="description" name="description" rows="4" class="textarea">{{ old('description', $group->description) }}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel-header">
|
||||
<h2>Membres</h2>
|
||||
<span class="pill">{{ count($selectedContactIds) }} selectionne(s)</span>
|
||||
</div>
|
||||
|
||||
<div class="table-wrap">
|
||||
<table class="data-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Inclure</th>
|
||||
<th>Contact</th>
|
||||
<th>Telephone</th>
|
||||
<th>Source</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@forelse ($contacts as $contact)
|
||||
@php($primaryPhone = $contact->phoneNumbers->firstWhere('is_primary', true) ?? $contact->phoneNumbers->first())
|
||||
<tr>
|
||||
<td>
|
||||
<input
|
||||
name="contact_ids[]"
|
||||
type="checkbox"
|
||||
value="{{ $contact->id }}"
|
||||
@checked(in_array($contact->id, old('contact_ids', $selectedContactIds), false))
|
||||
>
|
||||
</td>
|
||||
<td>
|
||||
{{ $contact->displayName() }}
|
||||
<div class="muted truncate">{{ $contact->email ?: $contact->organization ?: 'Sans detail' }}</div>
|
||||
</td>
|
||||
<td>{{ $primaryPhone?->normalized_number ?: $primaryPhone?->raw_number ?: 'Aucun' }}</td>
|
||||
<td>
|
||||
<span class="badge {{ $contact->source === 'local' ? '' : 'pending' }}">
|
||||
{{ ucfirst($contact->source) }}
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
@empty
|
||||
<tr>
|
||||
<td colspan="4" class="empty-state">Aucun contact disponible.</td>
|
||||
</tr>
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="panel-body">
|
||||
<div class="actions">
|
||||
<button type="submit" class="primary">Enregistrer</button>
|
||||
<a href="{{ route('contacts.index', ['group' => $group->id]) }}" class="secondary">Annuler</a>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<form method="POST" action="{{ route('contact-groups.destroy', $group) }}" onsubmit="return confirm('Supprimer ce groupe ?')" class="panel">
|
||||
@csrf
|
||||
@method('DELETE')
|
||||
|
||||
<div class="panel-header">
|
||||
<h2>Suppression</h2>
|
||||
</div>
|
||||
<div class="panel-body stack-sm">
|
||||
<p class="muted">La suppression retire le groupe des contacts associes.</p>
|
||||
<button type="submit" class="danger">Supprimer le groupe</button>
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
||||
@endsection
|
||||
@@ -0,0 +1,113 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<section class="mx-auto max-w-3xl">
|
||||
<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>
|
||||
<h1 class="mt-3 text-2xl font-semibold">Nouveau contact</h1>
|
||||
</div>
|
||||
|
||||
<form method="POST" action="{{ route('contacts.store') }}" class="mt-8 space-y-8">
|
||||
@csrf
|
||||
|
||||
<div class="rounded-lg border border-zinc-200 bg-white p-5">
|
||||
<h2 class="text-base font-semibold">Identite</h2>
|
||||
|
||||
<div class="mt-5 grid gap-5 sm:grid-cols-2">
|
||||
<div>
|
||||
<label for="first_name" class="block text-sm font-medium text-zinc-700">Prenom</label>
|
||||
<input id="first_name" name="first_name" value="{{ old('first_name') }}" class="mt-2 block w-full rounded-md border border-zinc-300 px-3 py-2 text-base shadow-sm outline-none focus:border-teal-600 focus:ring-2 focus:ring-teal-600/20">
|
||||
@error('first_name')
|
||||
<p class="mt-2 text-sm text-red-700">{{ $message }}</p>
|
||||
@enderror
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="last_name" class="block text-sm font-medium text-zinc-700">Nom</label>
|
||||
<input id="last_name" name="last_name" value="{{ old('last_name') }}" required class="mt-2 block w-full rounded-md border border-zinc-300 px-3 py-2 text-base shadow-sm outline-none focus:border-teal-600 focus:ring-2 focus:ring-teal-600/20">
|
||||
@error('last_name')
|
||||
<p class="mt-2 text-sm text-red-700">{{ $message }}</p>
|
||||
@enderror
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="organization" class="block text-sm font-medium text-zinc-700">Structure</label>
|
||||
<input id="organization" name="organization" value="{{ old('organization') }}" class="mt-2 block w-full rounded-md border border-zinc-300 px-3 py-2 text-base shadow-sm outline-none focus:border-teal-600 focus:ring-2 focus:ring-teal-600/20">
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="email" class="block text-sm font-medium text-zinc-700">Email</label>
|
||||
<input id="email" name="email" type="email" value="{{ old('email') }}" class="mt-2 block w-full rounded-md border border-zinc-300 px-3 py-2 text-base shadow-sm outline-none focus:border-teal-600 focus:ring-2 focus:ring-teal-600/20">
|
||||
@error('email')
|
||||
<p class="mt-2 text-sm text-red-700">{{ $message }}</p>
|
||||
@enderror
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mt-5">
|
||||
<label for="notes" class="block text-sm font-medium text-zinc-700">Notes</label>
|
||||
<textarea id="notes" name="notes" rows="4" class="mt-2 block w-full rounded-md border border-zinc-300 px-3 py-2 text-base shadow-sm outline-none focus:border-teal-600 focus:ring-2 focus:ring-teal-600/20">{{ old('notes') }}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="rounded-lg border border-zinc-200 bg-white p-5">
|
||||
<h2 class="text-base font-semibold">Telephone</h2>
|
||||
|
||||
<div class="mt-5 grid gap-5 sm:grid-cols-[12rem_minmax(0,1fr)]">
|
||||
<div>
|
||||
<label for="phone_label" class="block text-sm font-medium text-zinc-700">Libelle</label>
|
||||
<input id="phone_label" name="phone_label" value="{{ old('phone_label', 'Mobile') }}" class="mt-2 block w-full rounded-md border border-zinc-300 px-3 py-2 text-base shadow-sm outline-none focus:border-teal-600 focus:ring-2 focus:ring-teal-600/20">
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="raw_phone_number" class="block text-sm font-medium text-zinc-700">Numero</label>
|
||||
<input id="raw_phone_number" name="raw_phone_number" value="{{ old('raw_phone_number') }}" class="mt-2 block w-full rounded-md border border-zinc-300 px-3 py-2 text-base shadow-sm outline-none focus:border-teal-600 focus:ring-2 focus:ring-teal-600/20">
|
||||
@error('raw_phone_number')
|
||||
<p class="mt-2 text-sm text-red-700">{{ $message }}</p>
|
||||
@enderror
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="rounded-lg border border-zinc-200 bg-white p-5">
|
||||
<h2 class="text-base font-semibold">Groupes et options</h2>
|
||||
|
||||
<div class="mt-5 grid gap-3 sm:grid-cols-2">
|
||||
@forelse ($groups as $group)
|
||||
<label class="flex items-center gap-2 rounded-md border border-zinc-200 px-3 py-2 text-sm text-zinc-700">
|
||||
<input
|
||||
name="group_ids[]"
|
||||
type="checkbox"
|
||||
value="{{ $group->id }}"
|
||||
@checked(in_array($group->id, old('group_ids', [])))
|
||||
class="h-4 w-4 rounded border-zinc-300 text-teal-700 focus:ring-teal-600"
|
||||
>
|
||||
{{ $group->name }}
|
||||
</label>
|
||||
@empty
|
||||
<p class="text-sm text-zinc-600">Aucun groupe disponible.</p>
|
||||
@endforelse
|
||||
</div>
|
||||
|
||||
<div class="mt-6 grid gap-3 sm:grid-cols-2">
|
||||
<label class="flex items-center gap-2 text-sm text-zinc-700">
|
||||
<input name="sms_opt_out" type="checkbox" value="1" class="h-4 w-4 rounded border-zinc-300 text-teal-700 focus:ring-teal-600">
|
||||
Refus SMS
|
||||
</label>
|
||||
|
||||
<label class="flex items-center gap-2 text-sm text-zinc-700">
|
||||
<input name="is_favorite" type="checkbox" value="1" class="h-4 w-4 rounded border-zinc-300 text-teal-700 focus:ring-teal-600">
|
||||
Favori
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex items-center justify-end gap-3">
|
||||
<a href="{{ route('contacts.index') }}" class="rounded-md border border-zinc-300 px-4 py-2.5 text-sm font-semibold text-zinc-800 hover:bg-zinc-100">Annuler</a>
|
||||
<button type="submit" class="rounded-md bg-teal-700 px-4 py-2.5 text-sm font-semibold text-white hover:bg-teal-800 focus:outline-none focus:ring-2 focus:ring-teal-600 focus:ring-offset-2">
|
||||
Creer le contact
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
||||
@endsection
|
||||
@@ -0,0 +1,127 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<section class="mx-auto max-w-3xl">
|
||||
<div class="border-b border-zinc-200 pb-6">
|
||||
<a href="{{ route('contacts.show', $contact) }}" class="text-sm font-medium text-teal-700 hover:text-teal-900">Retour au contact</a>
|
||||
<h1 class="mt-3 text-2xl font-semibold">Modifier le contact</h1>
|
||||
</div>
|
||||
|
||||
<form method="POST" action="{{ route('contacts.update', $contact) }}" class="mt-8 space-y-8">
|
||||
@csrf
|
||||
@method('PUT')
|
||||
|
||||
<div class="rounded-lg border border-zinc-200 bg-white p-5">
|
||||
<h2 class="text-base font-semibold">Identite</h2>
|
||||
|
||||
<div class="mt-5 grid gap-5 sm:grid-cols-2">
|
||||
<div>
|
||||
<label for="first_name" class="block text-sm font-medium text-zinc-700">Prenom</label>
|
||||
<input id="first_name" name="first_name" value="{{ old('first_name', $contact->first_name) }}" class="mt-2 block w-full rounded-md border border-zinc-300 px-3 py-2 text-base shadow-sm outline-none focus:border-teal-600 focus:ring-2 focus:ring-teal-600/20">
|
||||
@error('first_name')
|
||||
<p class="mt-2 text-sm text-red-700">{{ $message }}</p>
|
||||
@enderror
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="last_name" class="block text-sm font-medium text-zinc-700">Nom</label>
|
||||
<input id="last_name" name="last_name" value="{{ old('last_name', $contact->last_name) }}" required class="mt-2 block w-full rounded-md border border-zinc-300 px-3 py-2 text-base shadow-sm outline-none focus:border-teal-600 focus:ring-2 focus:ring-teal-600/20">
|
||||
@error('last_name')
|
||||
<p class="mt-2 text-sm text-red-700">{{ $message }}</p>
|
||||
@enderror
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="organization" class="block text-sm font-medium text-zinc-700">Structure</label>
|
||||
<input id="organization" name="organization" value="{{ old('organization', $contact->organization) }}" class="mt-2 block w-full rounded-md border border-zinc-300 px-3 py-2 text-base shadow-sm outline-none focus:border-teal-600 focus:ring-2 focus:ring-teal-600/20">
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="email" class="block text-sm font-medium text-zinc-700">Email</label>
|
||||
<input id="email" name="email" type="email" value="{{ old('email', $contact->email) }}" class="mt-2 block w-full rounded-md border border-zinc-300 px-3 py-2 text-base shadow-sm outline-none focus:border-teal-600 focus:ring-2 focus:ring-teal-600/20">
|
||||
@error('email')
|
||||
<p class="mt-2 text-sm text-red-700">{{ $message }}</p>
|
||||
@enderror
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mt-5">
|
||||
<label for="notes" class="block text-sm font-medium text-zinc-700">Notes</label>
|
||||
<textarea id="notes" name="notes" rows="4" class="mt-2 block w-full rounded-md border border-zinc-300 px-3 py-2 text-base shadow-sm outline-none focus:border-teal-600 focus:ring-2 focus:ring-teal-600/20">{{ old('notes', $contact->notes) }}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="rounded-lg border border-zinc-200 bg-white p-5">
|
||||
<h2 class="text-base font-semibold">Telephone principal</h2>
|
||||
|
||||
<div class="mt-5 grid gap-5 sm:grid-cols-[12rem_minmax(0,1fr)]">
|
||||
<div>
|
||||
<label for="phone_label" class="block text-sm font-medium text-zinc-700">Libelle</label>
|
||||
<input id="phone_label" name="phone_label" value="{{ old('phone_label', $primaryPhone?->label ?? 'Mobile') }}" class="mt-2 block w-full rounded-md border border-zinc-300 px-3 py-2 text-base shadow-sm outline-none focus:border-teal-600 focus:ring-2 focus:ring-teal-600/20">
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="raw_phone_number" class="block text-sm font-medium text-zinc-700">Numero</label>
|
||||
<input id="raw_phone_number" name="raw_phone_number" value="{{ old('raw_phone_number', $primaryPhone?->raw_number) }}" class="mt-2 block w-full rounded-md border border-zinc-300 px-3 py-2 text-base shadow-sm outline-none focus:border-teal-600 focus:ring-2 focus:ring-teal-600/20">
|
||||
@error('raw_phone_number')
|
||||
<p class="mt-2 text-sm text-red-700">{{ $message }}</p>
|
||||
@enderror
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="rounded-lg border border-zinc-200 bg-white p-5">
|
||||
<h2 class="text-base font-semibold">Groupes et options</h2>
|
||||
|
||||
<div class="mt-5 grid gap-3 sm:grid-cols-2">
|
||||
@php($selectedGroups = old('group_ids', $contact->groups->pluck('id')->all()))
|
||||
|
||||
@forelse ($groups as $group)
|
||||
<label class="flex items-center gap-2 rounded-md border border-zinc-200 px-3 py-2 text-sm text-zinc-700">
|
||||
<input
|
||||
name="group_ids[]"
|
||||
type="checkbox"
|
||||
value="{{ $group->id }}"
|
||||
@checked(in_array($group->id, $selectedGroups))
|
||||
class="h-4 w-4 rounded border-zinc-300 text-teal-700 focus:ring-teal-600"
|
||||
>
|
||||
{{ $group->name }}
|
||||
</label>
|
||||
@empty
|
||||
<p class="text-sm text-zinc-600">Aucun groupe disponible.</p>
|
||||
@endforelse
|
||||
</div>
|
||||
|
||||
<div class="mt-6 grid gap-3 sm:grid-cols-2">
|
||||
<label class="flex items-center gap-2 text-sm text-zinc-700">
|
||||
<input name="sms_opt_out" type="checkbox" value="1" @checked(old('sms_opt_out', $contact->sms_opt_out)) class="h-4 w-4 rounded border-zinc-300 text-teal-700 focus:ring-teal-600">
|
||||
Refus SMS
|
||||
</label>
|
||||
|
||||
<label class="flex items-center gap-2 text-sm text-zinc-700">
|
||||
<input name="is_favorite" type="checkbox" value="1" @checked(old('is_favorite', $contact->is_favorite)) class="h-4 w-4 rounded border-zinc-300 text-teal-700 focus:ring-teal-600">
|
||||
Favori
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-wrap items-center justify-between gap-3">
|
||||
<button type="submit" form="delete-contact-form" class="rounded-md border border-red-300 px-4 py-2.5 text-sm font-semibold text-red-700 hover:bg-red-50">
|
||||
Supprimer
|
||||
</button>
|
||||
|
||||
<div class="flex items-center gap-3">
|
||||
<a href="{{ route('contacts.show', $contact) }}" class="rounded-md border border-zinc-300 px-4 py-2.5 text-sm font-semibold text-zinc-800 hover:bg-zinc-100">Annuler</a>
|
||||
<button type="submit" class="rounded-md bg-teal-700 px-4 py-2.5 text-sm font-semibold text-white hover:bg-teal-800 focus:outline-none focus:ring-2 focus:ring-teal-600 focus:ring-offset-2">
|
||||
Enregistrer
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<form id="delete-contact-form" method="POST" action="{{ route('contacts.destroy', $contact) }}" onsubmit="return confirm('Supprimer ce contact ?')">
|
||||
@csrf
|
||||
@method('DELETE')
|
||||
</form>
|
||||
</section>
|
||||
@endsection
|
||||
@@ -0,0 +1,264 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
@php
|
||||
$baseFilters = array_filter([
|
||||
'q' => $search,
|
||||
'group' => $selectedGroupId ?: null,
|
||||
'mobile' => $selectedMobileFilter,
|
||||
], fn ($value) => $value !== null && $value !== '');
|
||||
@endphp
|
||||
|
||||
<section class="page-wrap wide">
|
||||
<header class="topbar">
|
||||
<div class="title">
|
||||
<h1>Contacts</h1>
|
||||
<p>
|
||||
Contacts locaux, groupes et recherche.
|
||||
@if ($lastCardDavSyncRun)
|
||||
<span class="block sm:inline">CardDAV : {{ $lastCardDavSyncRun->status }} · {{ $lastCardDavSyncRun->started_at?->diffForHumans() }}</span>
|
||||
@endif
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="actions">
|
||||
@if ($cardDavSyncEnabled)
|
||||
<form method="POST" action="{{ route('contacts.sync-carddav') }}">
|
||||
@csrf
|
||||
<button type="submit" class="secondary">
|
||||
↻ Synchroniser
|
||||
</button>
|
||||
</form>
|
||||
@endif
|
||||
|
||||
<a href="{{ route('contacts.create') }}" class="primary">
|
||||
+ Contact local
|
||||
</a>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div class="content-grid">
|
||||
<div class="stack">
|
||||
<form method="GET" action="{{ route('contacts.index') }}" class="panel flush">
|
||||
<div class="panel-body">
|
||||
<div class="form-grid contact-filters-grid">
|
||||
<div class="field">
|
||||
<label for="q">Recherche</label>
|
||||
<input
|
||||
id="q"
|
||||
name="q"
|
||||
value="{{ $search }}"
|
||||
type="search"
|
||||
class="input"
|
||||
placeholder="Nom, email ou telephone"
|
||||
>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<label for="group">Groupe</label>
|
||||
<select
|
||||
id="group"
|
||||
name="group"
|
||||
class="select"
|
||||
>
|
||||
<option value="">Tous</option>
|
||||
@foreach ($groups as $group)
|
||||
<option value="{{ $group->id }}" @selected($selectedGroupId === $group->id)>{{ $group->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<label for="mobile">Mobile</label>
|
||||
<select id="mobile" name="mobile" class="select">
|
||||
<option value="detected" @selected($selectedMobileFilter === 'detected')>Mobile detecte</option>
|
||||
<option value="all" @selected($selectedMobileFilter === 'all')>Tous</option>
|
||||
<option value="non_mobile" @selected($selectedMobileFilter === 'non_mobile')>Non mobile</option>
|
||||
<option value="invalid" @selected($selectedMobileFilter === 'invalid')>Numero invalide</option>
|
||||
<option value="missing" @selected($selectedMobileFilter === 'missing')>Sans telephone</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<label for="status">Statut</label>
|
||||
<select id="status" name="status" class="select">
|
||||
<option value="" @selected($selectedStatus === '')>Tous</option>
|
||||
<option value="active" @selected($selectedStatus === 'active')>Actif</option>
|
||||
<option value="favorite" @selected($selectedStatus === 'favorite')>Favori</option>
|
||||
<option value="opt_out" @selected($selectedStatus === 'opt_out')>Refus SMS</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<button type="submit" class="secondary">Filtrer</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<div class="panel">
|
||||
<div class="panel-header">
|
||||
<h2>Liste des contacts</h2>
|
||||
<div class="tabs" aria-label="Vue contacts">
|
||||
<a class="{{ (! $favoriteOnly && $selectedStatus === '') ? 'active' : '' }}" href="{{ route('contacts.index', $baseFilters) }}">Tous</a>
|
||||
<a class="{{ ($favoriteOnly || $selectedStatus === 'favorite') ? 'active' : '' }}" href="{{ route('contacts.index', array_merge($baseFilters, ['status' => 'favorite'])) }}">Favoris</a>
|
||||
<a class="{{ $selectedStatus === 'opt_out' ? 'active' : '' }}" href="{{ route('contacts.index', array_merge($baseFilters, ['status' => 'opt_out'])) }}">Refus SMS</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="table-wrap">
|
||||
<table class="data-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Contact</th>
|
||||
<th>Telephone</th>
|
||||
<th>Groupes</th>
|
||||
<th>Statut</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@forelse ($contacts as $contact)
|
||||
@php($primaryPhone = $contact->phoneNumbers->firstWhere('is_primary', true) ?? $contact->phoneNumbers->first())
|
||||
<tr>
|
||||
<td>
|
||||
<a href="{{ route('contacts.show', $contact) }}" class="link item-line">
|
||||
@if ($contact->is_favorite)
|
||||
<span class="favorite-star" aria-label="Favori">★</span>
|
||||
@endif
|
||||
<span class="truncate">{{ $contact->displayName() }}</span>
|
||||
</a>
|
||||
<div class="muted truncate">{{ $contact->email ?: $contact->organization ?: ucfirst($contact->source) }}</div>
|
||||
</td>
|
||||
<td>
|
||||
@if ($primaryPhone)
|
||||
{{ $primaryPhone->normalized_number ?: $primaryPhone->raw_number }}
|
||||
@if (! $primaryPhone->is_valid)
|
||||
<div class="muted">Numero invalide</div>
|
||||
@elseif (! $primaryPhone->hasDetectedMobileNumber())
|
||||
<div class="muted">Non mobile</div>
|
||||
@else
|
||||
<div class="muted">Mobile detecte</div>
|
||||
@endif
|
||||
@else
|
||||
<span class="muted">Aucun</span>
|
||||
@endif
|
||||
</td>
|
||||
<td>{{ $contact->groups_count }}</td>
|
||||
<td>
|
||||
<span class="inline-badges">
|
||||
@if ($contact->is_favorite)
|
||||
<span class="badge pending">Favori</span>
|
||||
@endif
|
||||
@if ($contact->sms_opt_out)
|
||||
<span class="badge error">Refus SMS</span>
|
||||
@endif
|
||||
@if (! $contact->is_favorite && ! $contact->sms_opt_out)
|
||||
<span class="badge">Actif</span>
|
||||
@endif
|
||||
</span>
|
||||
<form method="POST" action="{{ route('contacts.favorite', $contact) }}" class="mt-sm">
|
||||
@csrf
|
||||
@method('PATCH')
|
||||
<input type="hidden" name="is_favorite" value="{{ $contact->is_favorite ? '0' : '1' }}">
|
||||
<button type="submit" class="secondary">
|
||||
{{ $contact->is_favorite ? 'Retirer favori' : 'Favori' }}
|
||||
</button>
|
||||
</form>
|
||||
<form method="POST" action="{{ route('contacts.opt-out', $contact) }}" class="mt-sm">
|
||||
@csrf
|
||||
@method('PATCH')
|
||||
<input type="hidden" name="sms_opt_out" value="{{ $contact->sms_opt_out ? '0' : '1' }}">
|
||||
<button type="submit" class="secondary">
|
||||
{{ $contact->sms_opt_out ? 'Retirer Refus SMS' : 'Refus SMS' }}
|
||||
</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
@empty
|
||||
<tr>
|
||||
<td colspan="4" class="empty-state">Aucun contact trouve.</td>
|
||||
</tr>
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{ $contacts->links() }}
|
||||
</div>
|
||||
|
||||
<aside class="stack">
|
||||
<form method="POST" action="{{ route('contact-groups.store') }}" class="panel">
|
||||
@csrf
|
||||
|
||||
<div class="panel-header">
|
||||
<h2>Nouveau groupe</h2>
|
||||
</div>
|
||||
|
||||
<div class="panel-body stack-sm">
|
||||
<div class="field">
|
||||
<label for="name">Nom</label>
|
||||
<input
|
||||
id="name"
|
||||
name="name"
|
||||
value="{{ old('name') }}"
|
||||
required
|
||||
class="input"
|
||||
>
|
||||
@error('name')
|
||||
<p class="notice error">{{ $message }}</p>
|
||||
@enderror
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<label for="description">Description</label>
|
||||
<textarea
|
||||
id="description"
|
||||
name="description"
|
||||
rows="3"
|
||||
class="textarea"
|
||||
>{{ old('description') }}</textarea>
|
||||
</div>
|
||||
|
||||
<label class="field-label inline-badges">
|
||||
<input name="is_favorite" type="checkbox" value="1">
|
||||
Favori
|
||||
</label>
|
||||
|
||||
<button type="submit" class="primary">
|
||||
Creer le groupe
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<div class="panel">
|
||||
<div class="panel-header">
|
||||
<h2>Groupes</h2>
|
||||
</div>
|
||||
|
||||
<div class="panel-body stack-sm">
|
||||
@forelse ($groups as $group)
|
||||
<div class="summary-row {{ $group->is_favorite ? 'favorite-row' : '' }}">
|
||||
<a href="{{ route('contacts.index', ['group' => $group->id]) }}" class="link truncate flex-fill">
|
||||
@if ($group->is_favorite)
|
||||
<span class="favorite-star" aria-label="Favori">★</span>
|
||||
@endif
|
||||
{{ $group->name }}
|
||||
</a>
|
||||
<span class="pill">{{ $group->contacts_count }}</span>
|
||||
|
||||
@if ($group->source === 'local')
|
||||
<a href="{{ route('contact-groups.edit', $group) }}" class="secondary">
|
||||
Modifier
|
||||
</a>
|
||||
@else
|
||||
<span class="pill warn">{{ ucfirst($group->source) }}</span>
|
||||
@endif
|
||||
</div>
|
||||
@empty
|
||||
<p class="muted">Aucun groupe.</p>
|
||||
@endforelse
|
||||
</div>
|
||||
</div>
|
||||
</aside>
|
||||
</div>
|
||||
</section>
|
||||
@endsection
|
||||
@@ -0,0 +1,151 @@
|
||||
@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
|
||||
@@ -0,0 +1,93 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||
|
||||
<title>{{ config('app.name', 'RelaisSMS') }}</title>
|
||||
|
||||
@if (file_exists(public_path('build/manifest.json')) || file_exists(public_path('hot')))
|
||||
@vite(['resources/css/app.css', 'resources/js/app.js'])
|
||||
@endif
|
||||
</head>
|
||||
<body class="font-sans antialiased">
|
||||
@auth
|
||||
<div class="app-shell">
|
||||
<aside class="app-sidebar" aria-label="Navigation principale">
|
||||
<a href="{{ route('recipients.index') }}" class="app-brand">
|
||||
<span class="app-brand-mark">R</span>
|
||||
<span>RelaisSMS</span>
|
||||
</a>
|
||||
|
||||
<nav class="app-nav">
|
||||
<a href="{{ route('recipients.index') }}" class="app-nav-link {{ request()->routeIs('recipients.*') ? 'active' : '' }}">
|
||||
<span class="app-nav-ico">✉</span>
|
||||
<span>Envoi</span>
|
||||
</a>
|
||||
<a href="{{ route('contacts.index') }}" class="app-nav-link {{ request()->routeIs('contacts.*') ? 'active' : '' }}">
|
||||
<span class="app-nav-ico">⌕</span>
|
||||
<span>Contacts</span>
|
||||
</a>
|
||||
<a href="{{ route('contacts.index') }}" class="app-nav-link {{ request()->routeIs('contact-groups.*') ? 'active' : '' }}">
|
||||
<span class="app-nav-ico">▦</span>
|
||||
<span>Groupes</span>
|
||||
</a>
|
||||
<a href="{{ route('sms-campaigns.index') }}" class="app-nav-link {{ request()->routeIs('sms-campaigns.*') ? 'active' : '' }}">
|
||||
<span class="app-nav-ico">◷</span>
|
||||
<span>Historique</span>
|
||||
</a>
|
||||
<a href="{{ route('settings.edit') }}" class="app-nav-link {{ request()->routeIs('settings.*') ? 'active' : '' }}">
|
||||
<span class="app-nav-ico">⚙</span>
|
||||
<span>Parametres</span>
|
||||
</a>
|
||||
</nav>
|
||||
|
||||
<div class="sync-card">
|
||||
<strong>Session active</strong>
|
||||
<span>{{ auth()->user()->name }}</span>
|
||||
<form method="POST" action="{{ route('logout') }}">
|
||||
@csrf
|
||||
<button type="submit" class="app-nav-button sync-logout">
|
||||
<span class="app-nav-ico">↩</span>
|
||||
<span>Deconnexion</span>
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
<main class="app-main">
|
||||
@if (session('status'))
|
||||
<div class="notice flash">
|
||||
{{ session('status') }}
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@if (session('error'))
|
||||
<div class="notice error flash">
|
||||
{{ session('error') }}
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@yield('content')
|
||||
</main>
|
||||
</div>
|
||||
@else
|
||||
<main class="app-main">
|
||||
@if (session('status'))
|
||||
<div class="notice flash">
|
||||
{{ session('status') }}
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@if (session('error'))
|
||||
<div class="notice error flash">
|
||||
{{ session('error') }}
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@yield('content')
|
||||
</main>
|
||||
@endauth
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,292 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
@php
|
||||
$reasonLabels = [
|
||||
'opt_out' => 'Refus SMS',
|
||||
'missing_phone' => 'Sans telephone',
|
||||
'invalid' => 'Numero invalide',
|
||||
'non_mobile' => 'Non mobile',
|
||||
'duplicate' => 'Doublon',
|
||||
];
|
||||
$summary = $resolution?->summary();
|
||||
$showSchedulePanel = old('send_mode', request('send_mode')) === 'scheduled' || old('scheduled_at', request('scheduled_at'));
|
||||
@endphp
|
||||
|
||||
<section class="page-wrap">
|
||||
<header class="topbar">
|
||||
<div class="title">
|
||||
<h1>Composer</h1>
|
||||
<p>Selectionner les destinataires et saisir le SMS.</p>
|
||||
</div>
|
||||
|
||||
<div class="actions">
|
||||
<a href="{{ route('contacts.index') }}" class="secondary">
|
||||
Contacts
|
||||
</a>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
@error('selection')
|
||||
<div class="notice error">
|
||||
{{ $message }}
|
||||
</div>
|
||||
@enderror
|
||||
|
||||
<form method="POST" action="{{ route('recipients.preview') }}" class="stack">
|
||||
@csrf
|
||||
<input type="hidden" name="q" value="{{ $search }}">
|
||||
|
||||
<section class="panel composer-panel" data-recipient-composer data-search-url="{{ route('recipients.search') }}">
|
||||
<div class="panel-header">
|
||||
<h2>Destination</h2>
|
||||
</div>
|
||||
|
||||
<div class="panel-body stack">
|
||||
<div class="field">
|
||||
<label for="recipient-composer-input">Pour</label>
|
||||
<div class="recipient-composer">
|
||||
<div class="recipient-chipbox" data-recipient-selected>
|
||||
@foreach ($selectedGroups as $group)
|
||||
<span class="recipient-chip group {{ $group->is_favorite ? 'favorite' : '' }}" data-recipient-token data-type="group" data-id="{{ $group->id }}">
|
||||
<span>{{ $group->name }}</span>
|
||||
<button type="button" data-recipient-remove aria-label="Retirer {{ $group->name }}">×</button>
|
||||
<input type="hidden" name="group_ids[]" value="{{ $group->id }}">
|
||||
</span>
|
||||
@endforeach
|
||||
|
||||
@foreach ($selectedContacts as $contact)
|
||||
<span class="recipient-chip {{ $contact->is_favorite ? 'favorite' : '' }}" data-recipient-token data-type="contact" data-id="{{ $contact->id }}">
|
||||
<span>{{ $contact->displayName() }}</span>
|
||||
<button type="button" data-recipient-remove aria-label="Retirer {{ $contact->displayName() }}">×</button>
|
||||
<input type="hidden" name="contact_ids[]" value="{{ $contact->id }}">
|
||||
</span>
|
||||
@endforeach
|
||||
|
||||
<input
|
||||
id="recipient-composer-input"
|
||||
type="search"
|
||||
class="recipient-input"
|
||||
autocomplete="off"
|
||||
placeholder="Ajouter un contact ou un groupe..."
|
||||
data-recipient-input
|
||||
>
|
||||
</div>
|
||||
<div class="recipient-results" data-recipient-results hidden></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<label for="message">Message SMS</label>
|
||||
<textarea
|
||||
id="message"
|
||||
name="message"
|
||||
rows="5"
|
||||
maxlength="612"
|
||||
required
|
||||
class="textarea"
|
||||
data-message-body
|
||||
>{{ old('message', request('message')) }}</textarea>
|
||||
@error('message')
|
||||
<p class="notice error">{{ $message }}</p>
|
||||
@enderror
|
||||
</div>
|
||||
|
||||
@if ($smsHeader !== '' || $smsFooter !== '')
|
||||
<div
|
||||
class="stack-sm"
|
||||
data-message-composer
|
||||
data-header="{{ e($smsHeader) }}"
|
||||
data-footer="{{ e($smsFooter) }}"
|
||||
>
|
||||
<div class="message-options">
|
||||
@if ($smsHeader !== '')
|
||||
<input type="hidden" name="include_sms_header" value="0">
|
||||
<label class="check-option">
|
||||
<input
|
||||
name="include_sms_header"
|
||||
type="checkbox"
|
||||
value="1"
|
||||
@checked(old('include_sms_header', $includeSmsHeader ? '1' : '0'))
|
||||
data-message-include-header
|
||||
>
|
||||
Entete
|
||||
</label>
|
||||
@endif
|
||||
|
||||
@if ($smsFooter !== '')
|
||||
<input type="hidden" name="include_sms_footer" value="0">
|
||||
<label class="check-option">
|
||||
<input
|
||||
name="include_sms_footer"
|
||||
type="checkbox"
|
||||
value="1"
|
||||
@checked(old('include_sms_footer', $includeSmsFooter ? '1' : '0'))
|
||||
data-message-include-footer
|
||||
>
|
||||
Pied
|
||||
</label>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<div class="message-preview">
|
||||
<strong>SMS complet</strong>
|
||||
<pre data-message-preview>{{ $composedMessage }}</pre>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div class="form-grid cols-2" data-schedule-panel @unless ($showSchedulePanel) hidden @endunless>
|
||||
<div class="field">
|
||||
<label for="scheduled_at">Date et heure d'envoi</label>
|
||||
<input
|
||||
id="scheduled_at"
|
||||
type="datetime-local"
|
||||
name="scheduled_at"
|
||||
value="{{ old('scheduled_at', request('scheduled_at')) }}"
|
||||
class="input"
|
||||
data-schedule-input
|
||||
>
|
||||
@error('scheduled_at')
|
||||
<p class="notice error">{{ $message }}</p>
|
||||
@enderror
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="actions">
|
||||
<button type="submit" class="primary" formnovalidate>
|
||||
Previsualiser
|
||||
</button>
|
||||
@if ($resolution && $resolution->recipients !== [])
|
||||
<button
|
||||
type="submit"
|
||||
class="primary"
|
||||
name="send_mode"
|
||||
value="now"
|
||||
formaction="{{ route('sms-campaigns.store') }}"
|
||||
onclick="return confirm('Envoyer ce SMS a {{ count($resolution->recipients) }} numero(s) ?')"
|
||||
>
|
||||
Envoyer {{ count($resolution->recipients) }} SMS
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="secondary"
|
||||
data-schedule-toggle
|
||||
aria-expanded="{{ $showSchedulePanel ? 'true' : 'false' }}"
|
||||
>
|
||||
Programmer
|
||||
</button>
|
||||
<button
|
||||
type="submit"
|
||||
class="secondary"
|
||||
name="send_mode"
|
||||
value="scheduled"
|
||||
formaction="{{ route('sms-campaigns.store') }}"
|
||||
data-schedule-submit
|
||||
@unless ($showSchedulePanel) hidden @endunless
|
||||
onclick="return confirm('Programmer ce SMS pour {{ count($resolution->recipients) }} numero(s) ?')"
|
||||
>
|
||||
Confirmer la programmation
|
||||
</button>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
@if ($resolution)
|
||||
<div class="summary-row" aria-label="Resume avant envoi">
|
||||
<span class="pill">{{ count($resolution->recipients) }} numeros valides</span>
|
||||
<span class="pill">1 SMS / destinataire</span>
|
||||
<span class="pill warn">{{ $summary['excluded_total'] }} exclus</span>
|
||||
<span class="pill warn">{{ $summary['duplicate'] }} doublons</span>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
</section>
|
||||
</form>
|
||||
|
||||
@if ($resolution)
|
||||
<div class="stack">
|
||||
<div class="stats-grid five">
|
||||
<div class="stat-card">
|
||||
<span>Numeros prets</span>
|
||||
<strong>{{ $summary['ready_numbers'] }}</strong>
|
||||
</div>
|
||||
<div class="stat-card">
|
||||
<span>Contacts</span>
|
||||
<strong>{{ $summary['selected_contacts'] }}</strong>
|
||||
</div>
|
||||
<div class="stat-card">
|
||||
<span>Groupes</span>
|
||||
<strong>{{ $summary['selected_groups'] }}</strong>
|
||||
</div>
|
||||
<div class="stat-card">
|
||||
<span>Exclus</span>
|
||||
<strong>{{ $summary['excluded_total'] }}</strong>
|
||||
</div>
|
||||
<div class="stat-card">
|
||||
<span>Doublons</span>
|
||||
<strong>{{ $summary['duplicate'] }}</strong>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="content-grid">
|
||||
<div class="panel">
|
||||
<div class="panel-header">
|
||||
<h2>Liste finale</h2>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
@forelse ($resolution->recipients as $recipient)
|
||||
<div class="list-row final-recipient-row">
|
||||
<div class="min-w-0">
|
||||
<p class="truncate text-strong">{{ $recipient['contact_name'] }}</p>
|
||||
<p class="muted truncate text-small">{{ implode(' · ', $recipient['selection']) }}</p>
|
||||
</div>
|
||||
<p class="text-small text-strong">{{ $recipient['number'] }}</p>
|
||||
</div>
|
||||
@empty
|
||||
<div class="empty-state">Aucun numero pret.</div>
|
||||
@endforelse
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel">
|
||||
<div class="panel-header">
|
||||
<h2>Ecarts</h2>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
@foreach ($reasonLabels as $reason => $label)
|
||||
@php($entries = $resolution->excludedByReason($reason))
|
||||
@if ($entries !== [])
|
||||
<div class="list-row">
|
||||
<p class="text-section">{{ $label }} · {{ count($entries) }}</p>
|
||||
<div class="stack-sm">
|
||||
@foreach ($entries as $entry)
|
||||
<div class="text-small">
|
||||
<p class="text-strong">{{ $entry['contact_name'] }}</p>
|
||||
<p class="muted">
|
||||
{{ ucfirst($entry['contact_source'] ?? 'local') }} #{{ $entry['contact_id'] }}
|
||||
</p>
|
||||
<p class="muted">
|
||||
{{ $entry['number'] ?: $entry['raw_number'] ?: 'Aucun numero' }}
|
||||
@if (($entry['duplicate_of'] ?? null) !== null)
|
||||
· deja retenu pour {{ $entry['duplicate_of'] }}
|
||||
@endif
|
||||
</p>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
@endforeach
|
||||
|
||||
@if ($resolution->excluded === [])
|
||||
<div class="empty-state">Aucun ecart.</div>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
</section>
|
||||
@endsection
|
||||
@@ -0,0 +1,57 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<section class="page-wrap narrow">
|
||||
<header class="topbar">
|
||||
<div class="title">
|
||||
<h1>Parametres</h1>
|
||||
<p>Textes ajoutes par defaut autour des SMS.</p>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<form method="POST" action="{{ route('settings.update') }}" class="panel">
|
||||
@csrf
|
||||
@method('PUT')
|
||||
|
||||
<div class="panel-header">
|
||||
<h2>Composition SMS</h2>
|
||||
</div>
|
||||
|
||||
<div class="panel-body stack">
|
||||
<div class="field">
|
||||
<label for="sms_message_header">Entete de message</label>
|
||||
<textarea
|
||||
id="sms_message_header"
|
||||
name="sms_message_header"
|
||||
rows="3"
|
||||
maxlength="612"
|
||||
class="textarea compact"
|
||||
>{{ old('sms_message_header', $smsHeader) }}</textarea>
|
||||
@error('sms_message_header')
|
||||
<p class="notice error">{{ $message }}</p>
|
||||
@enderror
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<label for="sms_message_footer">Pied de message</label>
|
||||
<textarea
|
||||
id="sms_message_footer"
|
||||
name="sms_message_footer"
|
||||
rows="3"
|
||||
maxlength="612"
|
||||
class="textarea compact"
|
||||
>{{ old('sms_message_footer', $smsFooter) }}</textarea>
|
||||
@error('sms_message_footer')
|
||||
<p class="notice error">{{ $message }}</p>
|
||||
@enderror
|
||||
</div>
|
||||
|
||||
<div class="actions">
|
||||
<button type="submit" class="primary">
|
||||
Enregistrer
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
||||
@endsection
|
||||
@@ -0,0 +1,129 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<section class="page-wrap wide">
|
||||
<header class="topbar">
|
||||
<div class="title">
|
||||
<h1>Historique SMS</h1>
|
||||
<p>Recherche, audit et export des campagnes SMS.</p>
|
||||
</div>
|
||||
|
||||
<div class="actions">
|
||||
<a href="{{ route('sms-campaigns.export', $filters) }}" class="secondary">
|
||||
Export CSV
|
||||
</a>
|
||||
<a href="{{ route('recipients.index') }}" class="primary">
|
||||
Nouvel envoi
|
||||
</a>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<form method="GET" action="{{ route('sms-campaigns.index') }}" class="panel flush">
|
||||
<div class="panel-body">
|
||||
<div class="form-grid filters-grid">
|
||||
<label class="field">
|
||||
<span class="field-label">Du</span>
|
||||
<input type="date" name="from" value="{{ $filters['from'] ?? '' }}" class="input">
|
||||
</label>
|
||||
|
||||
<label class="field">
|
||||
<span class="field-label">Au</span>
|
||||
<input type="date" name="to" value="{{ $filters['to'] ?? '' }}" class="input">
|
||||
</label>
|
||||
|
||||
<label class="field">
|
||||
<span class="field-label">Statut</span>
|
||||
<select name="status" class="select">
|
||||
<option value="">Tous</option>
|
||||
@foreach ($statuses as $status => $label)
|
||||
<option value="{{ $status }}" @selected(($filters['status'] ?? '') === $status)>{{ $label }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</label>
|
||||
|
||||
<label class="field">
|
||||
<span class="field-label">Utilisateur</span>
|
||||
<select name="user_id" class="select">
|
||||
<option value="">Tous</option>
|
||||
@foreach ($users as $user)
|
||||
<option value="{{ $user->id }}" @selected((string) ($filters['user_id'] ?? '') === (string) $user->id)>{{ $user->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</label>
|
||||
|
||||
<label class="field">
|
||||
<span class="field-label">Groupe</span>
|
||||
<select name="group_id" class="select">
|
||||
<option value="">Tous</option>
|
||||
@foreach ($groups as $group)
|
||||
<option value="{{ $group->id }}" @selected((string) ($filters['group_id'] ?? '') === (string) $group->id)>{{ $group->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</label>
|
||||
|
||||
<div class="actions nowrap-actions">
|
||||
<button type="submit" class="primary">
|
||||
Filtrer
|
||||
</button>
|
||||
<a href="{{ route('sms-campaigns.index') }}" class="secondary">
|
||||
Reset
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<div class="panel">
|
||||
<div class="panel-header">
|
||||
<h2>Campagnes</h2>
|
||||
<div class="tabs" aria-label="Statut">
|
||||
<span class="active">Toutes</span>
|
||||
<span>Envoyees</span>
|
||||
<span>Erreurs</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="table-wrap">
|
||||
<table class="data-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Date</th>
|
||||
<th>Programmation</th>
|
||||
<th>Message</th>
|
||||
<th>Destinataires</th>
|
||||
<th>Groupes</th>
|
||||
<th>Statut</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@forelse ($campaigns as $campaign)
|
||||
<tr>
|
||||
<td>
|
||||
<a href="{{ route('sms-campaigns.show', $campaign) }}" class="link">{{ $campaign->created_at->format('d/m/Y H:i') }}</a>
|
||||
<div class="muted">{{ $campaign->user?->name ?: 'Utilisateur supprime' }}</div>
|
||||
</td>
|
||||
<td>
|
||||
{{ $campaign->scheduled_at?->timezone(config('relais_sms.default_settings.display_timezone', 'Europe/Paris'))->format('d/m/Y H:i') ?: '-' }}
|
||||
</td>
|
||||
<td>{{ $campaign->message }}</td>
|
||||
<td>{{ $campaign->sent_count }}/{{ $campaign->recipients_count }} envoye(s)</td>
|
||||
<td class="truncate">{{ implode(', ', $campaign->selected_group_names ?? []) ?: 'Aucun groupe' }}</td>
|
||||
<td>
|
||||
<span class="badge {{ in_array($campaign->status, ['failed', 'partial', 'canceled'], true) ? 'error' : (in_array($campaign->status, ['scheduled', 'uncertain'], true) ? 'pending' : '') }}">
|
||||
{{ $statuses[$campaign->status] ?? $campaign->status }}
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
@empty
|
||||
<tr>
|
||||
<td colspan="6" class="empty-state">Aucune campagne ne correspond aux filtres.</td>
|
||||
</tr>
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{ $campaigns->links() }}
|
||||
</section>
|
||||
@endsection
|
||||
@@ -0,0 +1,142 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
@php
|
||||
$displayTimezone = config('relais_sms.default_settings.display_timezone', 'Europe/Paris');
|
||||
$statusLabels = [
|
||||
'draft' => 'Brouillon',
|
||||
'scheduled' => 'Programme',
|
||||
'sending' => 'Envoi',
|
||||
'uncertain' => 'A verifier',
|
||||
'sent' => 'Envoye',
|
||||
'partial' => 'Partiel',
|
||||
'failed' => 'Echec',
|
||||
'canceled' => 'Annule',
|
||||
'queued' => 'En attente',
|
||||
];
|
||||
@endphp
|
||||
|
||||
<section class="page-wrap">
|
||||
<header class="topbar">
|
||||
<div class="title">
|
||||
<a href="{{ route('sms-campaigns.index') }}" class="link">Retour a l'historique</a>
|
||||
<h1 class="h-offset">Campagne #{{ $campaign->id }}</h1>
|
||||
<p>{{ $campaign->created_at->format('d/m/Y H:i') }} par {{ $campaign->user?->name ?: 'Utilisateur supprime' }}</p>
|
||||
</div>
|
||||
|
||||
<div class="actions">
|
||||
@if ($campaign->status === 'scheduled')
|
||||
<form method="POST" action="{{ route('sms-campaigns.cancel', $campaign) }}">
|
||||
@csrf
|
||||
@method('PATCH')
|
||||
<button
|
||||
type="submit"
|
||||
class="secondary"
|
||||
onclick="return confirm('Annuler cette campagne programmee ?')"
|
||||
>
|
||||
Annuler
|
||||
</button>
|
||||
</form>
|
||||
@endif
|
||||
|
||||
<span class="badge {{ in_array($campaign->status, ['failed', 'partial', 'canceled'], true) ? 'error' : (in_array($campaign->status, ['scheduled', 'uncertain'], true) ? 'pending' : '') }}">
|
||||
{{ $statusLabels[$campaign->status] ?? $campaign->status }}
|
||||
</span>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div class="stats-grid three">
|
||||
<div class="stat-card">
|
||||
<span>Destinataires</span>
|
||||
<strong>{{ $campaign->recipients_count }}</strong>
|
||||
</div>
|
||||
<div class="stat-card">
|
||||
<span>Envoyes</span>
|
||||
<strong>{{ $campaign->sent_count }}</strong>
|
||||
</div>
|
||||
<div class="stat-card">
|
||||
<span>Echecs</span>
|
||||
<strong>{{ $campaign->failed_count }}</strong>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if ($campaign->status === 'uncertain')
|
||||
<p class="notice">{{ $campaign->recipients_count - $campaign->sent_count - $campaign->failed_count }} destinataire(s) a verifier. Un delai d attente ne signifie pas que les SMS ont echoue. La verification automatique consulte OVH sans renvoyer de SMS. Ne pas renvoyer cette campagne.</p>
|
||||
@endif
|
||||
|
||||
<div class="panel">
|
||||
<div class="panel-header">
|
||||
<h2>Message</h2>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<p class="message-text">{{ $campaign->message }}</p>
|
||||
|
||||
@if ($campaign->error_message)
|
||||
<p class="notice {{ $campaign->status === 'uncertain' ? '' : 'error' }} mt-md">{{ $campaign->error_message }}</p>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel">
|
||||
<div class="panel-header">
|
||||
<h2>Audit</h2>
|
||||
</div>
|
||||
<dl class="panel-body form-grid cols-2 audit-list">
|
||||
<div>
|
||||
<dt class="audit-term">Utilisateur</dt>
|
||||
<dd class="audit-value">{{ $campaign->user?->name ?: 'Utilisateur supprime' }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt class="audit-term">Cree le</dt>
|
||||
<dd class="audit-value">{{ $campaign->created_at->format('d/m/Y H:i') }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt class="audit-term">Programme le</dt>
|
||||
<dd class="audit-value">{{ $campaign->scheduled_at?->timezone($displayTimezone)->format('d/m/Y H:i') ?: 'Non programme' }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt class="audit-term">Annule le</dt>
|
||||
<dd class="audit-value">{{ $campaign->canceled_at?->timezone($displayTimezone)->format('d/m/Y H:i') ?: 'Non annule' }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt class="audit-term">Groupes selectionnes</dt>
|
||||
<dd class="audit-value">{{ implode(', ', $campaign->selected_group_names ?? []) ?: 'Aucun groupe' }}</dd>
|
||||
</div>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
<div class="panel">
|
||||
<div class="panel-header">
|
||||
<h2>Destinataires</h2>
|
||||
</div>
|
||||
|
||||
<div class="table-wrap">
|
||||
<table class="data-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Contact</th>
|
||||
<th>Numero</th>
|
||||
<th>Statut</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($campaign->deliveries as $delivery)
|
||||
<tr>
|
||||
<td>
|
||||
{{ $delivery->contact_name }}
|
||||
<div class="muted truncate">{{ $delivery->provider_message_id ?: $delivery->error_message }}</div>
|
||||
</td>
|
||||
<td>{{ $delivery->number }}</td>
|
||||
<td>
|
||||
<span class="badge {{ in_array($delivery->status, ['failed', 'canceled'], true) ? 'error' : (in_array($delivery->status, ['queued', 'uncertain'], true) ? 'pending' : '') }}">
|
||||
{{ $statusLabels[$delivery->status] ?? $delivery->status }}
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
@endsection
|
||||
Reference in New Issue
Block a user