diff --git a/app/Http/Controllers/CustomerController.php b/app/Http/Controllers/CustomerController.php index a705fe5..c4631b1 100644 --- a/app/Http/Controllers/CustomerController.php +++ b/app/Http/Controllers/CustomerController.php @@ -118,12 +118,12 @@ class CustomerController extends Controller } /** @var \Illuminate\Pagination\AbstractPaginator */ - $customers = $query->paginate(config('crud.paginate', 50)); + $customerModels = $query->paginate(50); - return view('customer.index', compact( + return view('customers.index', compact( 'modelClass', 'modelTable', - 'customers', + 'customerModels', 'brands' )); } @@ -142,7 +142,7 @@ class CustomerController extends Controller $customerLogin = CustomerLogin::where('customer_id', $customer->id) ->where('brand_id', $brand->id)->first(); - return view('customer.show', compact( + return view('customers.show', compact( 'customerInfos', 'customerLogin' )); @@ -208,7 +208,7 @@ class CustomerController extends Controller public function export() { $brands = Brand::all(); - return view('customer.export', compact( + return view('customers.export', compact( 'brands' )); } diff --git a/resources/views/customer/index-tableHeaders.blade.php b/resources/views/customer/index-tableHeaders.blade.php deleted file mode 100644 index 3885d08..0000000 --- a/resources/views/customer/index-tableHeaders.blade.php +++ /dev/null @@ -1,76 +0,0 @@ - - @php $colname = 'customers.email' @endphp - @php function _genUrl($q) { return request()->fullUrlWithQuery($q); } @endphp - {{ __('Email')}} - @if(!session("crud.$modelTable.sort_way") or session("crud.$modelTable.sort_col") !== $colname or (session("crud.$modelTable.sort_way") === 'desc' and session("crud.$modelTable.sort_col") === $colname)) -  ↓  - @endif - @if(!session("crud.$modelTable.sort_way") or session("crud.$modelTable.sort_col") !== $colname or (session("crud.$modelTable.sort_way") === 'asc' and session("crud.$modelTable.sort_col") === $colname)) -  ↑  - @endif - - - @php $colname = 'customer_infos.firstname' @endphp - {{ __('Prénom')}} - @if(!session("crud.$modelTable.sort_way") or session("crud.$modelTable.sort_col") !== $colname or (session("crud.$modelTable.sort_way") === 'desc' and session("crud.$modelTable.sort_col") === $colname)) -  ↓  - @endif - @if(!session("crud.$modelTable.sort_way") or session("crud.$modelTable.sort_col") !== $colname or (session("crud.$modelTable.sort_way") === 'asc' and session("crud.$modelTable.sort_col") === $colname)) -  ↑  - @endif - - - @php $colname = 'customer_infos.lastname' @endphp - {{ __('Nom')}} - @if(!session("crud.$modelTable.sort_way") or session("crud.$modelTable.sort_col") !== $colname or (session("crud.$modelTable.sort_way") === 'desc' and session("crud.$modelTable.sort_col") === $colname)) -  ↓  - @endif - @if(!session("crud.$modelTable.sort_way") or session("crud.$modelTable.sort_col") !== $colname or (session("crud.$modelTable.sort_way") === 'asc' and session("crud.$modelTable.sort_col") === $colname)) -  ↑  - @endif - - - @php $colname = 'customer_infos.opt_in' @endphp - {{ __('Opt-In')}} - @if(!session("crud.$modelTable.sort_way") or session("crud.$modelTable.sort_col") !== $colname or (session("crud.$modelTable.sort_way") === 'desc' and session("crud.$modelTable.sort_col") === $colname)) -  ↓  - @endif - @if(!session("crud.$modelTable.sort_way") or session("crud.$modelTable.sort_col") !== $colname or (session("crud.$modelTable.sort_way") === 'asc' and session("crud.$modelTable.sort_col") === $colname)) -  ↑  - @endif - - - @php $colname = 'brands.name' @endphp - {{ __('Marque')}} - @if(!session("crud.$modelTable.sort_way") or session("crud.$modelTable.sort_col") !== $colname or (session("crud.$modelTable.sort_way") === 'desc' and session("crud.$modelTable.sort_col") === $colname)) -  ↓  - @endif - @if(!session("crud.$modelTable.sort_way") or session("crud.$modelTable.sort_col") !== $colname or (session("crud.$modelTable.sort_way") === 'asc' and session("crud.$modelTable.sort_col") === $colname)) -  ↑  - @endif - - - @php $colname = 'customer_logins.status' @endphp - {{ __('Activé ?')}} - @if(!session("crud.$modelTable.sort_way") or session("crud.$modelTable.sort_col") !== $colname or (session("crud.$modelTable.sort_way") === 'desc' and session("crud.$modelTable.sort_col") === $colname)) -  ↓  - @endif - @if(!session("crud.$modelTable.sort_way") or session("crud.$modelTable.sort_col") !== $colname or (session("crud.$modelTable.sort_way") === 'asc' and session("crud.$modelTable.sort_col") === $colname)) -  ↑  - @endif - - - @php $colname = 'customer_logins.last_connection' @endphp - {{ __('Dernière connexion')}} - @if(!session("crud.$modelTable.sort_way") or session("crud.$modelTable.sort_col") !== $colname or (session("crud.$modelTable.sort_way") === 'desc' and session("crud.$modelTable.sort_col") === $colname)) -  ↓  - @endif - @if(!session("crud.$modelTable.sort_way") or session("crud.$modelTable.sort_col") !== $colname or (session("crud.$modelTable.sort_way") === 'asc' and session("crud.$modelTable.sort_col") === $colname)) -  ↑  - @endif - - - @if(session("crud.$modelTable.sort_way") and session("crud.$modelTable.sort_col")) - ⌫ - @endif - diff --git a/resources/views/customer/index.blade.php b/resources/views/customer/index.blade.php deleted file mode 100644 index dc4118c..0000000 --- a/resources/views/customer/index.blade.php +++ /dev/null @@ -1,103 +0,0 @@ -@extends('layouts.app') - -@section('title', sprintf('%s - %s', Str::ucfirst(Str::plural(trans('models.classes.customers'))), __('crud-policies::crud.viewAny'))) -@section('description', sprintf('%s %s', __('crud-policies::crud.viewAny'), Str::ucfirst(Str::plural(trans('models.classes.customers'))))) -@section('metaIndex', 'noindex,nofollow') - -@section('content') -
- @include('crud-policies::crud.modules.flashMessage') -
- @include('crud-policies::crud.modules.breadcrumb', ['action' => CrudAction::viewAny()]) - @include('crud-policies::crud.modules.actionbar.bar', ['action' => CrudAction::viewAny()]) -
-
-
-
-
-
- - - - - - - @if(request()->brand) - - @endif - {{ __('crud-policies::crud.reset') }} - -
-
-
-
- {{ $customers->appends(Request::except('rst'))->links() }} - - - - @include('customer.index-tableHeaders') - - - - @if(count($customers)) - - {{-- DISPLAY MODELS --}} - @foreach($customers as $customerInfo) - - - - - - - - - - - {{-- MODEL ACTIONS --}} - - - @endforeach - @else - - - - @endif - -
- {{ $customerInfo->customer->email }} - - {{ $customerInfo->firstname }} - - {{ $customerInfo->lastname }} - - {{ $customerInfo->opt_in ? 'Oui' :'Non' }} - - {{ $customerInfo->brand->name }} - - {{ $customerInfo->status ? 'Oui' :'Non' }} - - {{ $customerInfo->last_connection }} - - -
- {{ __('crud-policies::crud.nothingtoshow') }} -
- {{ $customers->appends(Request::except('rst'))->links() }} -
-
-@include('crud-policies::crud.modules.scriptConstants') -@endsection diff --git a/resources/views/customer/export.blade.php b/resources/views/customers/export.blade.php similarity index 100% rename from resources/views/customer/export.blade.php rename to resources/views/customers/export.blade.php diff --git a/resources/views/customers/index-list.blade.php b/resources/views/customers/index-list.blade.php new file mode 100644 index 0000000..4d7026b --- /dev/null +++ b/resources/views/customers/index-list.blade.php @@ -0,0 +1,45 @@ +
+ + + + @include('customers.index-tableHeaders') + + + + @if(count($customerModels)) + {{-- DISPLAY MODELS --}} + @foreach($customerModels as $customerInfo) + + + + + + + + + {{-- MODEL ACTIONS --}} + + + @endforeach + @else + + + + @endif + +
{{ $customerInfo->customer->email }}{{ $customerInfo->firstname }}{{ $customerInfo->lastname }}{{ $customerInfo->opt_in ? 'Oui' :'Non' }}{{ $customerInfo->brand->name }}{{ $customerInfo->status ? 'Oui' :'Non' }}{{ $customerInfo->last_connection }} + @can('view', $customerInfo->customer) + $customerInfo->customer_id, + 'brand' => $customerInfo->brand_id + ]) }}" + title="{{ __('Afficher ce :model', ['model' => Str::singular(__('models.classes.customers'))]) }}" + data-bs-toggle="tooltip" + class="btn btn-sm btn-primary"> + + + @endcan +
+ {{ __('Aucun résultat pour les :models', ['models' => __('models.classes.customers')]) }} +
+
diff --git a/resources/views/customers/index-tableHeaders.blade.php b/resources/views/customers/index-tableHeaders.blade.php new file mode 100644 index 0000000..a250393 --- /dev/null +++ b/resources/views/customers/index-tableHeaders.blade.php @@ -0,0 +1,141 @@ + + @php $colname = 'customers.email' @endphp + @php function _genUrl($q) { return request()->fullUrlWithQuery($q); } @endphp + {{ __('Email')}} + @if(!session("crud.$modelTable.sort_way") or session("crud.$modelTable.sort_col") !== $colname or (session("crud.$modelTable.sort_way") === 'desc' and session("crud.$modelTable.sort_col") === $colname)) + + + + @endif + @if(!session("crud.$modelTable.sort_way") or session("crud.$modelTable.sort_col") !== $colname or (session("crud.$modelTable.sort_way") === 'asc' and session("crud.$modelTable.sort_col") === $colname)) + + + + @endif + + + @php $colname = 'customer_infos.firstname' @endphp + {{ __('Prénom')}} + @if(!session("crud.$modelTable.sort_way") or session("crud.$modelTable.sort_col") !== $colname or (session("crud.$modelTable.sort_way") === 'desc' and session("crud.$modelTable.sort_col") === $colname)) + + + + @endif + @if(!session("crud.$modelTable.sort_way") or session("crud.$modelTable.sort_col") !== $colname or (session("crud.$modelTable.sort_way") === 'asc' and session("crud.$modelTable.sort_col") === $colname)) + + + + @endif + + + @php $colname = 'customer_infos.lastname' @endphp + {{ __('Nom')}} + @if(!session("crud.$modelTable.sort_way") or session("crud.$modelTable.sort_col") !== $colname or (session("crud.$modelTable.sort_way") === 'desc' and session("crud.$modelTable.sort_col") === $colname)) + + + + @endif + @if(!session("crud.$modelTable.sort_way") or session("crud.$modelTable.sort_col") !== $colname or (session("crud.$modelTable.sort_way") === 'asc' and session("crud.$modelTable.sort_col") === $colname)) + + + + @endif + + + @php $colname = 'customer_infos.opt_in' @endphp + {{ __('Opt-In')}} + @if(!session("crud.$modelTable.sort_way") or session("crud.$modelTable.sort_col") !== $colname or (session("crud.$modelTable.sort_way") === 'desc' and session("crud.$modelTable.sort_col") === $colname)) + + + + @endif + @if(!session("crud.$modelTable.sort_way") or session("crud.$modelTable.sort_col") !== $colname or (session("crud.$modelTable.sort_way") === 'asc' and session("crud.$modelTable.sort_col") === $colname)) + + + + @endif + + + @php $colname = 'brands.name' @endphp + {{ __('Marque')}} + @if(!session("crud.$modelTable.sort_way") or session("crud.$modelTable.sort_col") !== $colname or (session("crud.$modelTable.sort_way") === 'desc' and session("crud.$modelTable.sort_col") === $colname)) + + + + @endif + @if(!session("crud.$modelTable.sort_way") or session("crud.$modelTable.sort_col") !== $colname or (session("crud.$modelTable.sort_way") === 'asc' and session("crud.$modelTable.sort_col") === $colname)) + + + + @endif + + + @php $colname = 'customer_logins.status' @endphp + {{ __('Activé ?')}} + @if(!session("crud.$modelTable.sort_way") or session("crud.$modelTable.sort_col") !== $colname or (session("crud.$modelTable.sort_way") === 'desc' and session("crud.$modelTable.sort_col") === $colname)) + + + + @endif + @if(!session("crud.$modelTable.sort_way") or session("crud.$modelTable.sort_col") !== $colname or (session("crud.$modelTable.sort_way") === 'asc' and session("crud.$modelTable.sort_col") === $colname)) + + + + @endif + + + @php $colname = 'customer_logins.last_connection' @endphp + {{ __('Dernière connexion')}} + @if(!session("crud.$modelTable.sort_way") or session("crud.$modelTable.sort_col") !== $colname or (session("crud.$modelTable.sort_way") === 'desc' and session("crud.$modelTable.sort_col") === $colname)) + + + + @endif + @if(!session("crud.$modelTable.sort_way") or session("crud.$modelTable.sort_col") !== $colname or (session("crud.$modelTable.sort_way") === 'asc' and session("crud.$modelTable.sort_col") === $colname)) + + + + @endif + + + @if(session("crud.$modelTable.sort_way") and session("crud.$modelTable.sort_col")) + + + + @else + + + + @endif + diff --git a/resources/views/customers/index.blade.php b/resources/views/customers/index.blade.php new file mode 100644 index 0000000..c72cec8 --- /dev/null +++ b/resources/views/customers/index.blade.php @@ -0,0 +1,55 @@ +@extends('layouts.app') + +@section('title', sprintf('%s - %s', __('models.classes.customers'), Str::ucfirst(__('liste')))) +@section('description', __('Listage de tous les :model', ['model' => __('models.classes.customers')])) +@section('metaIndex', 'noindex,nofollow') + +@section('content') +
+
+
+
+
+
+ @include('breadcrumbs.breadcrumb-body') +
+
+
+
+
+
+ + + + + + + @if(request()->brand) + + @endif + + + + +
+
+ {!! $customerModels->links() !!} +
+
+ @include('customers.index-list') +
+
+ {!! $customerModels->links() !!} +
+
+
+
+@include('crud-policies::crud.modules.scriptConstants') +@endsection diff --git a/resources/views/customer/show.blade.php b/resources/views/customers/show.blade.php similarity index 51% rename from resources/views/customer/show.blade.php rename to resources/views/customers/show.blade.php index 67d63dd..feca149 100644 --- a/resources/views/customer/show.blade.php +++ b/resources/views/customers/show.blade.php @@ -1,28 +1,45 @@ @extends('layouts.app') -@section('title', sprintf('%s - %s', transFb(sprintf('models.classes.%s', strtolower(Str::plural(class_basename($modelClass)))), Str::plural(class_basename($modelClass))), __('crud-policies::crud.viewAny'))) -@section('description', sprintf('%s %s', __('crud-policies::crud.viewAny'), trans(Str::plural(class_basename($modelClass))))) +@section('title', sprintf('%s - %s', __('models.classes.customers'), Str::ucfirst(__('aperçu')))) +@section('description', __('Aperçu d\'un :model', ['model' => __('models.classes.customers')])) @section('metaIndex', 'noindex,nofollow') +@section('breadcrumb', request()->route()->getName()) @section('content') -
- @include('crud-policies::crud.modules.flashMessage') -
- +
+
+
+
+ + + + @include('breadcrumbs.breadcrumb-body') +
+
+
+ @csrf + @method('DELETE') + +
+
+
-
+
-
+

{{ __('Informations du client') }} {{ $customerInfos->firstname }} {{ $customerInfos->lastname }} - {{ Str::singular(__('models.classes.brands')) }} {{ $customerInfos->brand->name }}

- Retour
@@ -33,47 +50,47 @@ {{ $customerInfos->customer->email }} - Prénom + {{ __('Prénom') }} {{ $customerInfos->firstname }} - Nom + {{ __('Nom') }} {{ $customerInfos->lastname }} - Date de naissance + {{ __('Date de naissance') }} {{ \Carbon\Carbon::parse($customerInfos->birth_date)->format('d/m/Y') }} - Téléphone + {{ __('Téléphone') }} {{ $customerInfos->phone }} - Adresse + {{ __('Adresse') }} {{ $customerInfos->address }} - Adresse complémentaire + {{ __('Adresse complémentaire') }} {{ $customerInfos->address2 }} - Pays + {{ __('Pays') }} {{ $customerInfos->country }} - Ville + {{ __('Ville') }} {{ $customerInfos->city }} - Code postal + {{ __('Code postal') }} {{ $customerInfos->postcode }} - Abonné à la newsletter + {{ __('Abonné à la newsletter') }} {{ $customerInfos->opt_in ? "Oui" : "Non" }} - Date de la dernière modification de l'abonnement + {{ __('Date de la dernière modification de l\'abonnement') }} @if($customerInfos->customer->optInHistory()->orderBy('created_at', 'DESC')->exists()) {{ \Carbon\Carbon::parse($customerInfos->customer->optInHistory()->orderBy('created_at', 'DESC')->first()->created_at)->format('d/m/Y à H:i') }} @else @@ -81,32 +98,27 @@ @endif - Dernière connexion + {{ __('Dernière connexion') }} {{ \Carbon\Carbon::parse($customerLogin->last_connection)->format('d/m/Y à H:i') }} - Status du compte + {{ __('Status du compte') }} {{ $customerLogin->status ? "Activé" : "Non activé" }} - Hashcode + {{ __('Hashcode') }} {{ $customerInfos->hashcode }} - Date de création + {{ __('Date de création') }} {{ \Carbon\Carbon::parse($customerInfos->created_at)->format('d/m/Y à H:i') }} - Date de modification + {{ __('Date de modification') }} {{ \Carbon\Carbon::parse($customerInfos->updated_at)->format('d/m/Y à H:i') }} -
- @csrf - @method('DELETE') - -
@include('crud-policies::crud.modules.scriptConstants') diff --git a/routes/breadcrumbs.php b/routes/breadcrumbs.php index 197ab22..6f29d98 100644 --- a/routes/breadcrumbs.php +++ b/routes/breadcrumbs.php @@ -4,6 +4,15 @@ use App\Models\Brand; use Diglactic\Breadcrumbs\Breadcrumbs; use Diglactic\Breadcrumbs\Generator; +// * CUSTOMERS +Breadcrumbs::for('customers.index', function (Generator $trail) { + $trail->push(trans('Clients'), route('customers.index')); +}); +Breadcrumbs::for('customers.show', function (Generator $trail) { + $trail->parent('customers.index'); + $trail->push(trans('Aperçu')); +}); + // * BRANDS Breadcrumbs::for('brands.index', function (Generator $trail) { $trail->push(trans('Marques'), route('brands.index'));