99 lines
4.1 KiB
PHP
99 lines
4.1 KiB
PHP
@extends('layouts.main')
|
|
|
|
@section('content')
|
|
|
|
<h2><i class="fas fa-users"></i> Recherche de contacts <a href="{{ route('contact.create') }}" class="add-button"><i class="fas fa-plus-square"></i> Ajouter</a></h2>
|
|
<div class="form-wrapper">
|
|
<form action="{{ route('contact.search') }}" method="GET" role="search">
|
|
<div class="form-split">
|
|
<div class="form-field">
|
|
<label for="searchName">Nom</label>
|
|
<input type="text" name="searchName" id="searchName" value="@if(isset($searchData['name'])){{$searchData['name']}}@endif">
|
|
</div>
|
|
<div class="form-field">
|
|
<label for="searchFirstname">Prénom</label>
|
|
<input type="text" name="searchFirstname" id="searchFirstname" value="@if(isset($searchData['firstname'])){{$searchData['firstname']}}@endif">
|
|
</div>
|
|
</div>
|
|
<div class="form-split">
|
|
<div class="form-field">
|
|
<label for="searchEmail">Email</label>
|
|
<input type="email" name="searchEmail" id="searchEmail" value="@if(isset($searchData['email'])){{$searchData['email']}}@endif">
|
|
</div>
|
|
<div class="form-field">
|
|
<label for="searchCp">Code Postal</label>
|
|
<input type="text" maxlength="6" name="searchCp" id="searchCp" value="@if(isset($searchData['cp'])){{$searchData['cp']}}@endif">
|
|
</div>
|
|
</div>
|
|
<div class="form-split">
|
|
<div class="form-field">
|
|
<label for="searchVille">Ville</label>
|
|
<input type="text" name="searchVille" id="searchVille" value="@if(isset($searchData['ville'])){{$searchData['ville']}}@endif">
|
|
</div>
|
|
<div class="form-field">
|
|
<label for="searchCountry">Pays</label>
|
|
<select name="searchCountry" id="searchCountry">
|
|
<option value="">Tous</option>
|
|
<option value="250" @if(isset($searchData['pays']) && $searchData['pays'] == 250) selected @endif>France</option>
|
|
<option value="056" @if(isset($searchData['pays']) && $searchData['pays'] == 056) selected @endif>Belgique</option>
|
|
<option value="442" @if(isset($searchData['pays']) && $searchData['pays'] == 442) selected @endif>Luxembourg</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="form-field submit">
|
|
<input type="submit" value="Rechercher">
|
|
</div>
|
|
</form>
|
|
</div>
|
|
<div class="separator"></div>
|
|
@if(isset($contacts) && count($contacts)>0)
|
|
<div class="content-list">
|
|
<table>
|
|
<thead>
|
|
<th>Ref</th>
|
|
<th>Nom</th>
|
|
<th>Email</th>
|
|
<th>Code Postal</th>
|
|
<th>Ville</th>
|
|
<th>Pays</th>
|
|
</thead>
|
|
@foreach ($contacts as $contact)
|
|
@php
|
|
switch ($contact->contact_country) {
|
|
case 250:
|
|
$contact->contact_country = 'France';
|
|
break;
|
|
case 56:
|
|
$contact->contact_country = 'Belgique';
|
|
break;
|
|
case 442:
|
|
$contact->contact_country = 'Luxembourg';
|
|
break;
|
|
default:
|
|
$contact->contact_country = 'France';
|
|
break;
|
|
}
|
|
@endphp
|
|
<tr>
|
|
<td>{{ $contact->contact_ref }}</td>
|
|
<td><a href="{{ route('contact.edit', $contact) }}">{{ $contact->contact_prenom }} {{$contact->contact_nom}}</a></td>
|
|
<td>{{ $contact->contact_email }}</td>
|
|
<td>{{ $contact->contact_cp }}</td>
|
|
<td>{{ $contact->contact_ville }}</td>
|
|
<td>{{ $contact->contact_country }}</td>
|
|
</tr>
|
|
@endforeach
|
|
<tfoot>
|
|
<tr>
|
|
<td colspan="7">
|
|
@if($search)
|
|
{{ $contacts->appends(request()->input())->links() }}
|
|
@endif
|
|
</td>
|
|
</tr>
|
|
</tfoot>
|
|
</table>
|
|
|
|
</div>
|
|
@endif
|
|
@endsection
|