update CRUD customer
This commit is contained in:
parent
ff292c6f26
commit
3a82230e9c
9 changed files with 304 additions and 221 deletions
|
|
@ -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'
|
||||
));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,76 +0,0 @@
|
|||
<th scope="col">
|
||||
@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))
|
||||
<a class="col_sort text-secondary lead asc" href="{{ _genUrl(['sort_col' => $colname, 'sort_way' => 'asc', 'rst' => null]) }}"> ↓ </a>
|
||||
@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))
|
||||
<a class="col_sort text-secondary lead desc" href="{{ _genUrl(['sort_col' => $colname, 'sort_way' => 'desc', 'rst' => null]) }}"> ↑ </a>
|
||||
@endif
|
||||
</th>
|
||||
<th scope="col">
|
||||
@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))
|
||||
<a class="col_sort text-secondary lead asc" href="{{ _genUrl(['sort_col' => $colname, 'sort_way' => 'asc', 'rst' => null]) }}"> ↓ </a>
|
||||
@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))
|
||||
<a class="col_sort text-secondary lead desc" href="{{ _genUrl(['sort_col' => $colname, 'sort_way' => 'desc', 'rst' => null]) }}"> ↑ </a>
|
||||
@endif
|
||||
</th>
|
||||
<th scope="col">
|
||||
@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))
|
||||
<a class="col_sort text-secondary lead asc" href="{{ _genUrl(['sort_col' => $colname, 'sort_way' => 'asc', 'rst' => null]) }}"> ↓ </a>
|
||||
@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))
|
||||
<a class="col_sort text-secondary lead desc" href="{{ _genUrl(['sort_col' => $colname, 'sort_way' => 'desc', 'rst' => null]) }}"> ↑ </a>
|
||||
@endif
|
||||
</th>
|
||||
<th scope="col">
|
||||
@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))
|
||||
<a class="col_sort text-secondary lead asc" href="{{ _genUrl(['sort_col' => $colname, 'sort_way' => 'asc', 'rst' => null]) }}"> ↓ </a>
|
||||
@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))
|
||||
<a class="col_sort text-secondary lead desc" href="{{ _genUrl(['sort_col' => $colname, 'sort_way' => 'desc', 'rst' => null]) }}"> ↑ </a>
|
||||
@endif
|
||||
</th>
|
||||
<th scope="col">
|
||||
@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))
|
||||
<a class="col_sort text-secondary lead asc" href="{{ _genUrl(['sort_col' => $colname, 'sort_way' => 'asc', 'rst' => null]) }}"> ↓ </a>
|
||||
@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))
|
||||
<a class="col_sort text-secondary lead desc" href="{{ _genUrl(['sort_col' => $colname, 'sort_way' => 'desc', 'rst' => null]) }}"> ↑ </a>
|
||||
@endif
|
||||
</th>
|
||||
<th scope="col">
|
||||
@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))
|
||||
<a class="col_sort text-secondary lead asc" href="{{ _genUrl(['sort_col' => $colname, 'sort_way' => 'asc', 'rst' => null]) }}"> ↓ </a>
|
||||
@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))
|
||||
<a class="col_sort text-secondary lead desc" href="{{ _genUrl(['sort_col' => $colname, 'sort_way' => 'desc', 'rst' => null]) }}"> ↑ </a>
|
||||
@endif
|
||||
</th>
|
||||
<th scope="col">
|
||||
@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))
|
||||
<a class="col_sort text-secondary lead asc" href="{{ _genUrl(['sort_col' => $colname, 'sort_way' => 'asc', 'rst' => null]) }}"> ↓ </a>
|
||||
@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))
|
||||
<a class="col_sort text-secondary lead desc" href="{{ _genUrl(['sort_col' => $colname, 'sort_way' => 'desc', 'rst' => null]) }}"> ↑ </a>
|
||||
@endif
|
||||
</th>
|
||||
<th scope="col">
|
||||
@if(session("crud.$modelTable.sort_way") and session("crud.$modelTable.sort_col"))
|
||||
<a href="{{ _genUrl(['rst' => 'true','sort_col' => null, 'sort_way' => null]) }}" class="btn btn-small btn-danger">⌫</a>
|
||||
@endif
|
||||
</th>
|
||||
|
|
@ -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')
|
||||
<div class="card">
|
||||
@include('crud-policies::crud.modules.flashMessage')
|
||||
<div class="card-header">
|
||||
@include('crud-policies::crud.modules.breadcrumb', ['action' => CrudAction::viewAny()])
|
||||
@include('crud-policies::crud.modules.actionbar.bar', ['action' => CrudAction::viewAny()])
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col">
|
||||
<form action="{{ request()->fullUrlWithQuery(['rst' => null]) }}">
|
||||
<div class="input-group mb-3">
|
||||
<label class="input-group-text" for="brandSelect">{{ __('Filter par Marque') }}</label>
|
||||
<select class="form-select" id="brandSelect">
|
||||
<option value="0" @if(!request()->brand) selected @endif>{{ __('Sélectionnez une marque..') }}</option>
|
||||
@foreach(Brand::all() as $brand)
|
||||
<option value="{{ $brand->id }}" @if(request()->brand == "$brand->id" or Session::get("crud.$modelTable.brand") == $brand->id) selected @endif>{{ $brand->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<label class="input-group-text bg-warning" for="searchField">🔍🠚</label>
|
||||
<input type="search" id="searchField" name="search" class="form-control" value="{{ request()->search ?? Session::get("crud.$modelTable.search") }}" placeholder="Recherche.."/>
|
||||
<input type="text" name="sort_col" class="d-none" value="{{ request()->sort_col }}"/>
|
||||
<input type="text" name="sort_way" class="d-none" value="{{ request()->sort_way }}"/>
|
||||
@if(request()->brand)
|
||||
<input type="hidden" name="brand" class="d-none" value="{{ request()->brand }}"/>
|
||||
@endif
|
||||
<a class="btn btn-danger" href="{{ request()->fullUrlWithQuery(['rst' => 'true', 'search' => null, 'brand' => null]) }}">{{ __('crud-policies::crud.reset') }}</a>
|
||||
<button type="submit" class="btn btn-primary">
|
||||
{{ __('crud-policies::crud.search') }}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{{ $customers->appends(Request::except('rst'))->links() }}
|
||||
<table class="table text-center">
|
||||
<thead class="thead-dark">
|
||||
<tr>
|
||||
@include('customer.index-tableHeaders')
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@if(count($customers))
|
||||
|
||||
{{-- DISPLAY MODELS --}}
|
||||
@foreach($customers as $customerInfo)
|
||||
<tr>
|
||||
|
||||
<td>
|
||||
{{ $customerInfo->customer->email }}
|
||||
</td>
|
||||
<td>
|
||||
{{ $customerInfo->firstname }}
|
||||
</td>
|
||||
<td>
|
||||
{{ $customerInfo->lastname }}
|
||||
</td>
|
||||
<td>
|
||||
{{ $customerInfo->opt_in ? 'Oui' :'Non' }}
|
||||
</td>
|
||||
<td>
|
||||
{{ $customerInfo->brand->name }}
|
||||
</td>
|
||||
<td>
|
||||
{{ $customerInfo->status ? 'Oui' :'Non' }}
|
||||
</td>
|
||||
<td>
|
||||
{{ $customerInfo->last_connection }}
|
||||
</td>
|
||||
|
||||
{{-- MODEL ACTIONS --}}
|
||||
<td>
|
||||
<div class="btn-group" role="group" aria-label="{{ Str::plural(__('crud-policies::crud.action')) }}">
|
||||
@can('view', $customerInfo->customer)
|
||||
<a href="{{ CrudController::getRoutePrefixed("customers.show", [
|
||||
'customer' => $customerInfo->customer_id,
|
||||
'brand' => $customerInfo->brand_id
|
||||
]) }}" class="btn btn-sm btn-primary">{{ __('crud-policies::crud.view') }}</a>
|
||||
@endcan
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
@else
|
||||
<tr>
|
||||
<td colspan="5">
|
||||
{{ __('crud-policies::crud.nothingtoshow') }}
|
||||
</td>
|
||||
</tr>
|
||||
@endif
|
||||
</tbody>
|
||||
</table>
|
||||
{{ $customers->appends(Request::except('rst'))->links() }}
|
||||
</div>
|
||||
</div>
|
||||
@include('crud-policies::crud.modules.scriptConstants')
|
||||
@endsection
|
||||
45
resources/views/customers/index-list.blade.php
Normal file
45
resources/views/customers/index-list.blade.php
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
<div class="table-responsive">
|
||||
<table class="table table-hover text-center">
|
||||
<thead class="border-dark border-top-0 border-start-0 border-end-0 border-2">
|
||||
<tr>
|
||||
@include('customers.index-tableHeaders')
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@if(count($customerModels))
|
||||
{{-- DISPLAY MODELS --}}
|
||||
@foreach($customerModels as $customerInfo)
|
||||
<tr>
|
||||
<td class="align-middle bg-white">{{ $customerInfo->customer->email }}</td>
|
||||
<td class="align-middle bg-white">{{ $customerInfo->firstname }}</td>
|
||||
<td class="align-middle bg-white">{{ $customerInfo->lastname }}</td>
|
||||
<td class="align-middle bg-white">{{ $customerInfo->opt_in ? 'Oui' :'Non' }}</td>
|
||||
<td class="align-middle bg-white">{{ $customerInfo->brand->name }}</td>
|
||||
<td class="align-middle bg-white">{{ $customerInfo->status ? 'Oui' :'Non' }}</td>
|
||||
<td class="align-middle bg-white"><span class="badge bg-warning text-dark text-wrap">{{ $customerInfo->last_connection }}</span></td>
|
||||
{{-- MODEL ACTIONS --}}
|
||||
<td class="text-end align-middle bg-white">
|
||||
@can('view', $customerInfo->customer)
|
||||
<a href="{{ route("customers.show", [
|
||||
'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">
|
||||
<i class="fa-solid fa-eye"></i>
|
||||
</a>
|
||||
@endcan
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
@else
|
||||
<tr>
|
||||
<td class="bg-white" colspan="8">
|
||||
<span class="h3">{{ __('Aucun résultat pour les :models', ['models' => __('models.classes.customers')]) }}
|
||||
</td>
|
||||
</tr>
|
||||
@endif
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
141
resources/views/customers/index-tableHeaders.blade.php
Normal file
141
resources/views/customers/index-tableHeaders.blade.php
Normal file
|
|
@ -0,0 +1,141 @@
|
|||
<th class="bg-white" scope="col">
|
||||
@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))
|
||||
<a class="col_sort text-secondary text-decoration-none lead asc" href="{{ _genUrl(['sort_col' => $colname, 'sort_way' => 'asc', 'rst' => null]) }}">
|
||||
<button class="btn btn-sm btn-outline-dark">
|
||||
<i class="fas fa-arrow-down 2xs"></i>
|
||||
</button>
|
||||
</a>
|
||||
@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))
|
||||
<a class="col_sort text-secondary text-decoration-none lead desc" href="{{ _genUrl(['sort_col' => $colname, 'sort_way' => 'desc', 'rst' => null]) }}">
|
||||
<button class="btn btn-sm btn-outline-dark">
|
||||
<i class="fas fa-arrow-up 2xs"></i>
|
||||
</button>
|
||||
</a>
|
||||
@endif
|
||||
</th>
|
||||
<th class="bg-white" scope="col">
|
||||
@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))
|
||||
<a class="col_sort text-secondary text-decoration-none lead asc" href="{{ _genUrl(['sort_col' => $colname, 'sort_way' => 'asc', 'rst' => null]) }}">
|
||||
<button class="btn btn-sm btn-outline-dark">
|
||||
<i class="fas fa-arrow-down 2xs"></i>
|
||||
</button>
|
||||
</a>
|
||||
@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))
|
||||
<a class="col_sort text-secondary text-decoration-none lead desc" href="{{ _genUrl(['sort_col' => $colname, 'sort_way' => 'desc', 'rst' => null]) }}">
|
||||
<button class="btn btn-sm btn-outline-dark">
|
||||
<i class="fas fa-arrow-up 2xs"></i>
|
||||
</button>
|
||||
</a>
|
||||
@endif
|
||||
</th>
|
||||
<th class="bg-white" scope="col">
|
||||
@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))
|
||||
<a class="col_sort text-secondary text-decoration-none lead asc" href="{{ _genUrl(['sort_col' => $colname, 'sort_way' => 'asc', 'rst' => null]) }}">
|
||||
<button class="btn btn-sm btn-outline-dark">
|
||||
<i class="fas fa-arrow-down 2xs"></i>
|
||||
</button>
|
||||
</a>
|
||||
@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))
|
||||
<a class="col_sort text-secondary text-decoration-none lead desc" href="{{ _genUrl(['sort_col' => $colname, 'sort_way' => 'desc', 'rst' => null]) }}">
|
||||
<button class="btn btn-sm btn-outline-dark">
|
||||
<i class="fas fa-arrow-up 2xs"></i>
|
||||
</button>
|
||||
</a>
|
||||
@endif
|
||||
</th>
|
||||
<th class="bg-white" scope="col">
|
||||
@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))
|
||||
<a class="col_sort text-secondary text-decoration-none lead asc" href="{{ _genUrl(['sort_col' => $colname, 'sort_way' => 'asc', 'rst' => null]) }}">
|
||||
<button class="btn btn-sm btn-outline-dark">
|
||||
<i class="fas fa-arrow-down 2xs"></i>
|
||||
</button>
|
||||
</a>
|
||||
@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))
|
||||
<a class="col_sort text-secondary text-decoration-none lead desc" href="{{ _genUrl(['sort_col' => $colname, 'sort_way' => 'desc', 'rst' => null]) }}">
|
||||
<button class="btn btn-sm btn-outline-dark">
|
||||
<i class="fas fa-arrow-up 2xs"></i>
|
||||
</button>
|
||||
</a>
|
||||
@endif
|
||||
</th>
|
||||
<th class="bg-white" scope="col">
|
||||
@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))
|
||||
<a class="col_sort text-secondary text-decoration-none lead asc" href="{{ _genUrl(['sort_col' => $colname, 'sort_way' => 'asc', 'rst' => null]) }}">
|
||||
<button class="btn btn-sm btn-outline-dark">
|
||||
<i class="fas fa-arrow-down 2xs"></i>
|
||||
</button>
|
||||
</a>
|
||||
@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))
|
||||
<a class="col_sort text-secondary text-decoration-none lead desc" href="{{ _genUrl(['sort_col' => $colname, 'sort_way' => 'desc', 'rst' => null]) }}">
|
||||
<button class="btn btn-sm btn-outline-dark">
|
||||
<i class="fas fa-arrow-up 2xs"></i>
|
||||
</button>
|
||||
</a>
|
||||
@endif
|
||||
</th>
|
||||
<th class="bg-white" scope="col">
|
||||
@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))
|
||||
<a class="col_sort text-secondary text-decoration-none lead asc" href="{{ _genUrl(['sort_col' => $colname, 'sort_way' => 'asc', 'rst' => null]) }}">
|
||||
<button class="btn btn-sm btn-outline-dark">
|
||||
<i class="fas fa-arrow-down 2xs"></i>
|
||||
</button>
|
||||
</a>
|
||||
@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))
|
||||
<a class="col_sort text-secondary text-decoration-none lead desc" href="{{ _genUrl(['sort_col' => $colname, 'sort_way' => 'desc', 'rst' => null]) }}">
|
||||
<button class="btn btn-sm btn-outline-dark">
|
||||
<i class="fas fa-arrow-up 2xs"></i>
|
||||
</button>
|
||||
</a>
|
||||
@endif
|
||||
</th>
|
||||
<th class="bg-white" scope="col">
|
||||
@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))
|
||||
<a class="col_sort text-secondary text-decoration-none lead asc" href="{{ _genUrl(['sort_col' => $colname, 'sort_way' => 'asc', 'rst' => null]) }}">
|
||||
<button class="btn btn-sm btn-outline-dark">
|
||||
<i class="fas fa-arrow-down 2xs"></i>
|
||||
</button>
|
||||
</a>
|
||||
@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))
|
||||
<a class="col_sort text-secondary text-decoration-none lead desc" href="{{ _genUrl(['sort_col' => $colname, 'sort_way' => 'desc', 'rst' => null]) }}">
|
||||
<button class="btn btn-sm btn-outline-dark">
|
||||
<i class="fas fa-arrow-up 2xs"></i>
|
||||
</button>
|
||||
</a>
|
||||
@endif
|
||||
</th>
|
||||
<th class="text-end bg-white" scope="col">
|
||||
@if(session("crud.$modelTable.sort_way") and session("crud.$modelTable.sort_col"))
|
||||
<a href="{{ _genUrl(['rst' => 'true','sort_col' => null, 'sort_way' => null]) }}"
|
||||
class="btn btn-sm btn-danger"
|
||||
data-bs-toggle="tooltip"
|
||||
title="{{ __('Effacer le tri') }}">
|
||||
<i class="fa fa-eraser"></i>
|
||||
</a>
|
||||
@else
|
||||
<span data-bs-toggle="tooltip" data-bs-placement="top" title="{{ __('Ici, les flèches servent à trier et non pas à filtrer') }}">
|
||||
<i class="fas fa-question-circle"></i>
|
||||
</span>
|
||||
@endif
|
||||
</th>
|
||||
55
resources/views/customers/index.blade.php
Normal file
55
resources/views/customers/index.blade.php
Normal file
|
|
@ -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')
|
||||
<div class="row w-100 mx-auto">
|
||||
<div class="col p-0">
|
||||
<div class="card rounded-0 border-0">
|
||||
<div class="card-header bg-light">
|
||||
<div class="row w-100 mx-auto">
|
||||
<div class="col p-0">
|
||||
@include('breadcrumbs.breadcrumb-body')
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body bg-white">
|
||||
<form action="{{ request()->fullUrlWithQuery(['rst' => null]) }}">
|
||||
<div class="input-group mb-3">
|
||||
<label class="input-group-text" for="brandSelect">{{ __('Filter par Marque') }}</label>
|
||||
<select class="form-select" id="brandSelect">
|
||||
<option value="0" @if(!request()->brand) selected @endif>{{ __('Sélectionnez une marque..') }}</option>
|
||||
@foreach(Brand::all() as $brand)
|
||||
<option value="{{ $brand->id }}" @if(request()->brand == "$brand->id" or Session::get("crud.$modelTable.brand") == $brand->id) selected @endif>{{ $brand->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<label class="input-group-text bg-warning" for="searchField">🔍🠚</label>
|
||||
<input type="search" id="searchField" name="search" class="form-control" value="{{ request()->search ?? Session::get("crud.$modelTable.search") }}" placeholder="Recherche.."/>
|
||||
<input type="text" name="sort_col" class="d-none" value="{{ request()->sort_col }}"/>
|
||||
<input type="text" name="sort_way" class="d-none" value="{{ request()->sort_way }}"/>
|
||||
@if(request()->brand)
|
||||
<input type="hidden" name="brand" class="d-none" value="{{ request()->brand }}"/>
|
||||
@endif
|
||||
<button type="submit" class="btn btn-primary">
|
||||
<i class="fas fa-search"></i>
|
||||
</button>
|
||||
<a class="btn btn-danger" href="{{ request()->fullUrlWithQuery(['rst' => 'true', 'search' => null, 'brand' => null]) }}">
|
||||
<i class="fas fa-backspace"></i>
|
||||
</a>
|
||||
</div>
|
||||
</form>
|
||||
{!! $customerModels->links() !!}
|
||||
<div class="row w-100 mx-auto">
|
||||
<div class="col p-0">
|
||||
@include('customers.index-list')
|
||||
</div>
|
||||
</div>
|
||||
{!! $customerModels->links() !!}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@include('crud-policies::crud.modules.scriptConstants')
|
||||
@endsection
|
||||
|
|
@ -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')
|
||||
<div class="card">
|
||||
@include('crud-policies::crud.modules.flashMessage')
|
||||
<div class="card-header">
|
||||
<nav aria-label="breadcrumb" class="d-inline">
|
||||
<ol class="breadcrumb d-inline-flex">
|
||||
<li class="breadcrumb-item">
|
||||
<a href="{{ route('customers.index') }}">{{ __('models.classes.customers') }}</a>
|
||||
</li>
|
||||
<li class="breadcrumb-item active" aria-current="page">{{__('Liste') }}</li>
|
||||
</ol>
|
||||
</nav>
|
||||
<div class="card border-0">
|
||||
<div class="card-header bg-light">
|
||||
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center">
|
||||
<div class="d-flex flex-row align-items-start">
|
||||
<a href="{{ route('customers.index') }}"
|
||||
class="btn btn-primary text-decoration-none me-2"
|
||||
data-bs-toggle="tooltip"
|
||||
data-bs-placement="top"
|
||||
title="{{ __('Retourner sur la liste des :model', ['model' => __('models.classes.customers')]) }}"
|
||||
data-bs-toggle="tooltip">
|
||||
<i class="fa-solid fa-arrow-left"></i>
|
||||
</a>
|
||||
@include('breadcrumbs.breadcrumb-body')
|
||||
</div>
|
||||
<div class="col-12 col-md-4 d-flex justify-content-center justify-content-md-end align-items-center">
|
||||
<form id="customerDelete"
|
||||
action="{{ route('customers.delete', ['customer' => $customerInfos->customer_id, 'brand' => $customerInfos->brand_id]) }}"
|
||||
method="POST">
|
||||
@csrf
|
||||
@method('DELETE')
|
||||
<button class="btn btn-danger"
|
||||
title="{{ __('Supprimer ce :model', ['model' => Str::singular(__('models.classes.customers'))]) }}"
|
||||
data-bs-toggle="tooltip">
|
||||
<i class="fa-solid fa-trash"></i>
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="card-body bg-white">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col">
|
||||
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
|
||||
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center py-0 mb-2">
|
||||
<h1 class="h2">{{ __('Informations du client') }} {{ $customerInfos->firstname }} {{ $customerInfos->lastname }} - {{ Str::singular(__('models.classes.brands')) }} {{ $customerInfos->brand->name }}</h1>
|
||||
<a href="{{ route('customers.index') }}" class="btn btn-sm btn-primary float-right">Retour</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -33,47 +50,47 @@
|
|||
<td class="w-50">{{ $customerInfos->customer->email }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>Prénom</b></td>
|
||||
<td><b>{{ __('Prénom') }}</b></td>
|
||||
<td>{{ $customerInfos->firstname }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>Nom</b></td>
|
||||
<td><b>{{ __('Nom') }}</b></td>
|
||||
<td>{{ $customerInfos->lastname }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>Date de naissance</b></td>
|
||||
<td><b>{{ __('Date de naissance') }}</b></td>
|
||||
<td>{{ \Carbon\Carbon::parse($customerInfos->birth_date)->format('d/m/Y') }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>Téléphone</b></td>
|
||||
<td><b>{{ __('Téléphone') }}</b></td>
|
||||
<td>{{ $customerInfos->phone }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>Adresse</b></td>
|
||||
<td><b>{{ __('Adresse') }}</b></td>
|
||||
<td>{{ $customerInfos->address }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>Adresse complémentaire</b></td>
|
||||
<td><b>{{ __('Adresse complémentaire') }}</b></td>
|
||||
<td>{{ $customerInfos->address2 }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>Pays</b></td>
|
||||
<td><b>{{ __('Pays') }}</b></td>
|
||||
<td>{{ $customerInfos->country }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>Ville</b></td>
|
||||
<td><b>{{ __('Ville') }}</b></td>
|
||||
<td>{{ $customerInfos->city }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>Code postal</b></td>
|
||||
<td><b>{{ __('Code postal') }}</b></td>
|
||||
<td>{{ $customerInfos->postcode }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>Abonné à la newsletter</b></td>
|
||||
<td><b>{{ __('Abonné à la newsletter') }}</b></td>
|
||||
<td>{{ $customerInfos->opt_in ? "Oui" : "Non" }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>Date de la dernière modification de l'abonnement</b></td>
|
||||
<td><b>{{ __('Date de la dernière modification de l\'abonnement') }}</b></td>
|
||||
@if($customerInfos->customer->optInHistory()->orderBy('created_at', 'DESC')->exists())
|
||||
<td>{{ \Carbon\Carbon::parse($customerInfos->customer->optInHistory()->orderBy('created_at', 'DESC')->first()->created_at)->format('d/m/Y à H:i') }}</td>
|
||||
@else
|
||||
|
|
@ -81,32 +98,27 @@
|
|||
@endif
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>Dernière connexion</b></td>
|
||||
<td><b>{{ __('Dernière connexion') }}</b></td>
|
||||
<td>{{ \Carbon\Carbon::parse($customerLogin->last_connection)->format('d/m/Y à H:i') }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>Status du compte</b></td>
|
||||
<td><b>{{ __('Status du compte') }}</b></td>
|
||||
<td>{{ $customerLogin->status ? "Activé" : "Non activé" }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>Hashcode</b></td>
|
||||
<td><b>{{ __('Hashcode') }}</b></td>
|
||||
<td>{{ $customerInfos->hashcode }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>Date de création</b></td>
|
||||
<td><b>{{ __('Date de création') }}</b></td>
|
||||
<td>{{ \Carbon\Carbon::parse($customerInfos->created_at)->format('d/m/Y à H:i') }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>Date de modification</b></td>
|
||||
<td><b>{{ __('Date de modification') }}</b></td>
|
||||
<td>{{ \Carbon\Carbon::parse($customerInfos->updated_at)->format('d/m/Y à H:i') }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<form id="customerDelete" action="{{ route('customers.delete', ['customer' => $customerInfos->customer_id, 'brand' => $customerInfos->brand_id]) }}" method="POST">
|
||||
@csrf
|
||||
@method('DELETE')
|
||||
<input type="submit" value="{{ __('Supprimer') }}" class="btn btn-sm btn-danger">
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@include('crud-policies::crud.modules.scriptConstants')
|
||||
|
|
@ -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'));
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue