mini fix v2

This commit is contained in:
Alexis Gousseau 2023-06-15 13:18:48 +02:00
parent 49f3d8b8b7
commit 02a6f37a9c
5 changed files with 10 additions and 28 deletions

View file

@ -23,22 +23,22 @@ class BrandController extends Controller
*/
public function index(Request $request)
{
/** @var \Illuminate\Database\Eloquent\Builder $brands */
$brands = Brand::query();
/** @var \Illuminate\Database\Eloquent\Builder $query */
$query = Brand::query();
if ($request->search) {
$this->searchQuery(
$brands,
$query,
$request->search,
null,
'name',
);
}
$this->sortQuery($brands);
$this->sortQuery($query);
$searchFields = trans('Nom');
$brandModels = $brands->paginate(12);
$brandModels = $query->paginate(12);
return view('brands.index', compact('brandModels', 'searchFields'));
}

View file

@ -28,6 +28,7 @@ class QuestionController extends Controller
*/
public function index(Request $request)
{
/** @var \Illuminate\Database\Eloquent\Builder $query */
$query = Question::query();
if ($request->brand) {

View file

@ -21,23 +21,6 @@
<td class="text-center align-middle bg-white">{{ $brandModel->name }}</td>
<td class="text-center align-middle bg-white">{{ count(\App\Models\CustomerInfo::where('brand_id', 'LIKE', $brandModel->id)->get()) }}</td>
<td class="text-center align-middle bg-white">{{ count(\App\Models\CustomerInfo::where('brand_id', 'LIKE', $brandModel->id)->where('opt_in', true)->get()) }}</td>
@php $routeName = request()->route()->getName(); @endphp
@if(empty(request()->search) and empty($noOrder) and Session::get("$routeName.sort_col") === 'order')
<td class="d-flex">
<form action="{{ route('brands.change-order', ['product' => $brandModel, 'action' => 'up']) }}" method="POST" class="text-center @if($loop->first and $brandModels->onFirstPage()) invisible @endif">
@csrf
<button type="submit" class="btn btn-sm @if(($loop->first and $brandModels->onFirstPage())) disabled @endif" title="{{ __('Change the order of appearance upwards') }}" data-bs-toggle="tooltip">
<i class="fas fa-arrow-alt-circle-up"></i>
</button>
</form>
<form action="{{ route('brands.change-order', ['product' => $brandModel, 'action' => 'down']) }}" method="POST" class="text-center @if($loop->last and $brandModels->currentPage() === $brandModels->lastPage()) invisible @endif">
@csrf
<button type="submit" class="btn btn-sm @if($loop->last and $brandModels->currentPage() === $brandModels->lastPage()) disabled @endif" title="{{ __('Change the order of appearance downwards') }}" data-bs-toggle="tooltip">
<i class="fas fa-arrow-alt-circle-down"></i>
</button>
</form>
</td>
@endif
<td class="text-center align-middle bg-white">
<span class="badge bg-warning text-dark text-wrap">{{ $brandModel->updated_at->formatLocalized('%d/%m/%Y à %H:%M') }}</span>
</td>

View file

@ -19,17 +19,15 @@
<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">
class="btn btn-sm btn-warning">
<i class="fa-solid fa-eye"></i>
</a>
@endcan
</td>
</tr>
@endforeach

View file

@ -28,7 +28,7 @@
{{-- MODEL ACTIONS --}}
<td class="text-end bg-white">
<form id="dataDelete"
action="{{ route("$modelTable.destroy", $questionModel) }}"
action="{{ route("questions.destroy", $questionModel) }}"
method="POST"
class="btn-group">
<a href="{{ route("questions.answers.index", $questionModel) }}" class="btn btn-sm btn-dark"
@ -36,12 +36,12 @@
data-bs-toggle="tooltip">
<i class="fa-solid fa-comments"></i>
</a>
<a href="{{ route("$modelTable.show", $questionModel) }}" class="btn btn-sm btn-warning"
<a href="{{ route("questions.show", $questionModel) }}" class="btn btn-sm btn-warning"
title="{{ __('Afficher cette :model', ['model' => Str::singular(__('models.classes.questions'))]) }}"
data-bs-toggle="tooltip">
<i class="fa-solid fa-eye"></i>
</a>
<a href="{{ route("$modelTable.edit", $questionModel) }}" class="btn btn-sm btn-primary"
<a href="{{ route("questions.edit", $questionModel) }}" class="btn btn-sm btn-primary"
title="{{ __('Modifier cette :model', ['model' => Str::singular(__('models.classes.questions'))]) }}"
data-bs-toggle="tooltip">
<i class="fa-solid fa-pencil"></i>