Add label filter on products
This commit is contained in:
parent
107424743a
commit
eb16ad2ad3
22 changed files with 410 additions and 68 deletions
59
app/Http/Controllers/Bo/LabelController.php
Normal file
59
app/Http/Controllers/Bo/LabelController.php
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Bo;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\StoreLabel;
|
||||
use App\Http\Requests\UpdateLabel;
|
||||
use App\Models\Label;
|
||||
use App\Traits\UpdateModelStatus;
|
||||
|
||||
class LabelController extends Controller
|
||||
{
|
||||
use UpdateModelStatus;
|
||||
|
||||
public function index()
|
||||
{
|
||||
$labels = Label::paginate();
|
||||
return view('bo.labels.index', compact('labels'));
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
return view('bo.labels.create');
|
||||
}
|
||||
|
||||
//
|
||||
public function store(StoreLabel $request)
|
||||
{
|
||||
(new Label($request->validated()))->saveOrFail();
|
||||
return redirect()->route('bo.labels.index');
|
||||
}
|
||||
|
||||
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass
|
||||
public function edit(Label $label)
|
||||
{
|
||||
return view('bo.labels.edit', compact('label'));
|
||||
}
|
||||
|
||||
public function update(UpdateLabel $request, Label $label)
|
||||
{
|
||||
$label->fill($request->validated());
|
||||
$label->saveOrFail();
|
||||
|
||||
return redirect()->route('bo.labels.edit', $label)
|
||||
->with('success', trans('Enregistré !'));
|
||||
}
|
||||
|
||||
public function destroy(Label $label)
|
||||
{
|
||||
if ($label->products()->count()) {
|
||||
return redirect()->route('bo.labels.edit', $label)
|
||||
->withErrors([trans('Vous ne pouvez supprimer un types ce label car des produits y sont associés')]);
|
||||
}
|
||||
$label->delete();
|
||||
|
||||
return redirect()->route('bo.labels.index')
|
||||
->with('warning', trans('Le contenu à bien été supprimé'));
|
||||
}
|
||||
}
|
||||
|
|
@ -17,6 +17,7 @@ use App\Models\Range;
|
|||
use App\Models\MeatTypes;
|
||||
use App\Models\Recipes;
|
||||
use App\Models\IncoNutritionalValues;
|
||||
use App\Models\Label;
|
||||
use App\Models\SubRange;
|
||||
use App\Models\XmlInco;
|
||||
use App\Traits\UpdateModelStatus;
|
||||
|
|
@ -68,6 +69,7 @@ class ProductsController extends Controller
|
|||
$ranges = Range::select('id', 'name')->paginate();
|
||||
$meatTypes = MeatTypes::all();
|
||||
$consumptionTimes = ConsumptionTimes::select('id', 'name')->paginate();
|
||||
$labels = Label::all();
|
||||
$recipes = Recipes::select('id', 'title')->paginate();
|
||||
return view('bo.products.create', compact(
|
||||
'pictosDatas',
|
||||
|
|
@ -75,6 +77,7 @@ class ProductsController extends Controller
|
|||
'ranges',
|
||||
'meatTypes',
|
||||
'consumptionTimes',
|
||||
'labels',
|
||||
'recipes',
|
||||
'subranges',
|
||||
));
|
||||
|
|
@ -99,7 +102,7 @@ class ProductsController extends Controller
|
|||
$rangeId = $request->range_id;
|
||||
$meatTypeId = $request->meat_type_id;
|
||||
$consumptionTimesId = $request->consumption_times_id;
|
||||
$departaimants = $request->departaimants === null ? 0 : 1;
|
||||
$labelId = (\is_string($request->label_id) and \strlen($request->label_id)) ? $request->label_id : null;
|
||||
$preparationAdvice = $request->preparation_advice;
|
||||
$ingredients = $request->ingredients;
|
||||
$tips = $request->tips;
|
||||
|
|
@ -144,7 +147,7 @@ class ProductsController extends Controller
|
|||
}
|
||||
$p->meat_type_id = $meatTypeId;
|
||||
$p->consumption_times_id = $consumptionTimesId;
|
||||
$p->departaimants = $departaimants;
|
||||
$p->label_id = $labelId;
|
||||
$p->preparation_advice = $preparationAdvice;
|
||||
$p->ingredients = $ingredients;
|
||||
$p->tips = $tips;
|
||||
|
|
@ -186,6 +189,7 @@ class ProductsController extends Controller
|
|||
$subranges = SubRange::all();
|
||||
$ranges = Range::select('id', 'name')->with('subranges')->get();
|
||||
$meatTypes = MeatTypes::all();
|
||||
$labels = Label::all();
|
||||
$consumptionTimes = ConsumptionTimes::select('id', 'name')->get();
|
||||
$recipes = Recipes::select('id', 'title')->get();
|
||||
$pictosSelected = [];
|
||||
|
|
@ -205,6 +209,7 @@ class ProductsController extends Controller
|
|||
'subranges',
|
||||
'meatTypes',
|
||||
'consumptionTimes',
|
||||
'labels',
|
||||
'recipes',
|
||||
));
|
||||
}
|
||||
|
|
@ -228,7 +233,7 @@ class ProductsController extends Controller
|
|||
$rangeId = $request->range_id;
|
||||
$meatTypeId = $request->meat_type_id;
|
||||
$consumptionTimesId = $request->consumption_times_id;
|
||||
$departaimants = $request->departaimants === null ? 0 : 1;
|
||||
$labelId = (\is_string($request->label_id) and \strlen($request->label_id)) ? $request->label_id : null;
|
||||
$preparationAdvice = $request->preparation_advice;
|
||||
$ingredients = $request->ingredients;
|
||||
$tips = $request->tips;
|
||||
|
|
@ -308,7 +313,7 @@ class ProductsController extends Controller
|
|||
}
|
||||
$p->meat_type_id = $meatTypeId;
|
||||
$p->consumption_times_id = $consumptionTimesId;
|
||||
$p->departaimants = $departaimants;
|
||||
$p->label_id = $labelId;
|
||||
$p->preparation_advice = $preparationAdvice;
|
||||
$p->ingredients = $ingredients;
|
||||
$p->tips = $tips;
|
||||
|
|
@ -321,7 +326,7 @@ class ProductsController extends Controller
|
|||
}
|
||||
$p->show_rsm = $show_rsm;
|
||||
$p->status = $status;
|
||||
$p->save();
|
||||
$p->saveOrFail();
|
||||
|
||||
return redirect()->route('bo.products.edit', $p->id)->with('success', 'Enregistré !');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ namespace App\Http\Controllers;
|
|||
|
||||
use App\Enums\GeneralConfigType;
|
||||
use App\Models\ConsumptionTimes;
|
||||
use App\Models\Label;
|
||||
use App\Models\ProductSliderPictures;
|
||||
use App\Models\MeatTypes;
|
||||
use App\Models\Products;
|
||||
|
|
@ -20,9 +21,10 @@ class ProductsController extends Controller
|
|||
$productsSlides = ProductSliderPictures::where('status', 1)->orderBy('order', 'ASC')->get();
|
||||
$meatTypes = MeatTypes::select('name', 'slug')->where('status', 1)->get();
|
||||
$ct = ConsumptionTimes::select('name', 'slug')->where('status', 1)->get();
|
||||
$labels = Label::select('name', 'slug')->where('status', 1)->get();
|
||||
$ranges = Range::where('status', 1)->with('products:id,range_id,picture')->get();
|
||||
|
||||
return view('front.products.index', compact('productsSlides', 'ranges', 'meatTypes', 'ct'));
|
||||
return view('front.products.index', compact('productsSlides', 'ranges', 'meatTypes', 'ct', 'labels'));
|
||||
}
|
||||
|
||||
public function filter(Model $model, SubRange $subrange = null)
|
||||
|
|
@ -32,6 +34,7 @@ class ProductsController extends Controller
|
|||
$ranges = Range::where('status', 1)->get();
|
||||
$meatTypes = MeatTypes::select('name', 'slug')->where('status', 1)->get();
|
||||
$ct = ConsumptionTimes::select('name', 'slug')->where('status', 1)->get();
|
||||
$labels = Label::select('name', 'slug')->where('status', 1)->get();
|
||||
|
||||
$type = explode('/', Route::getCurrentRoute()->uri)[1];
|
||||
$productsList = null;
|
||||
|
|
@ -72,6 +75,13 @@ class ProductsController extends Controller
|
|||
$title = $consumptionTime->name;
|
||||
$momentConso = true;
|
||||
break;
|
||||
case 'label':
|
||||
/** @var \App\Models\Label */
|
||||
$label = $model;
|
||||
$productsList = $label->products->where('status', 1)->sortBy('order');
|
||||
$title = $label->name;
|
||||
$momentConso = true;
|
||||
break;
|
||||
default:
|
||||
abort(404);
|
||||
break;
|
||||
|
|
@ -85,6 +95,7 @@ class ProductsController extends Controller
|
|||
'subrange',
|
||||
'meatTypes',
|
||||
'ct',
|
||||
'labels',
|
||||
'title',
|
||||
'gamme',
|
||||
'typeViande',
|
||||
|
|
@ -92,29 +103,6 @@ class ProductsController extends Controller
|
|||
));
|
||||
}
|
||||
|
||||
public function departaimants()
|
||||
{
|
||||
$productsSlides = ProductSliderPictures::where('status', 1)->orderBy('order', 'ASC')->get();
|
||||
$ranges = Range::where('status', 1)->get();
|
||||
$meatTypes = MeatTypes::select('name', 'slug')->where('status', 1)->get();
|
||||
$ct = ConsumptionTimes::select('name', 'slug')->where('status', 1)->get();
|
||||
|
||||
$productsList = Products::where([['status', 1], ['departaimants', 1]])->get();
|
||||
|
||||
$departaimants = true;
|
||||
$title = "Départ'Aimants";
|
||||
|
||||
return view('front.products.index', compact(
|
||||
'productsList',
|
||||
'departaimants',
|
||||
'productsSlides',
|
||||
'ranges',
|
||||
'meatTypes',
|
||||
'ct',
|
||||
'title'
|
||||
));
|
||||
}
|
||||
|
||||
public function show(Products $product)
|
||||
{
|
||||
$recipeVideo = $product->recipe()->first();
|
||||
|
|
|
|||
37
app/Http/Requests/StoreLabel.php
Normal file
37
app/Http/Requests/StoreLabel.php
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class StoreLabel extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
if (!$this->status) {
|
||||
$this->request->add(['status' => false]);
|
||||
}
|
||||
$this->request->add(['slug' => Str::slug($this->name)]);
|
||||
return auth()->check();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'name' => 'required|min:5|max:50',
|
||||
'slug' => 'required|min:1|unique:meat_types,slug',
|
||||
'status' => 'required|boolean'
|
||||
];
|
||||
}
|
||||
}
|
||||
16
app/Http/Requests/UpdateLabel.php
Normal file
16
app/Http/Requests/UpdateLabel.php
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
class UpdateLabel extends StoreLabel
|
||||
{
|
||||
public function rules()
|
||||
{
|
||||
return array_merge(
|
||||
parent::rules(),
|
||||
[
|
||||
'slug' => 'required|unique:meat_types,slug,' . $this->meat_type->id . '|max:255',
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
30
app/Models/Label.php
Normal file
30
app/Models/Label.php
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Label extends Model
|
||||
{
|
||||
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'status'
|
||||
];
|
||||
|
||||
protected static function booted()
|
||||
{
|
||||
static::creating(function ($type) {
|
||||
$type->slug = Str::slug($type->name);
|
||||
});
|
||||
static::updating(function ($type) {
|
||||
$type->slug = Str::slug($type->name);
|
||||
});
|
||||
}
|
||||
|
||||
public function products()
|
||||
{
|
||||
return $this->hasMany(Products::class, 'label_id');
|
||||
}
|
||||
}
|
||||
|
|
@ -53,6 +53,11 @@ class Products extends Model
|
|||
return $this->belongsTo(MeatTypes::class, 'meat_type_id');
|
||||
}
|
||||
|
||||
public function label()
|
||||
{
|
||||
return $this->belongsTo(Label::class, 'label_id');
|
||||
}
|
||||
|
||||
public function consumptionTimes()
|
||||
{
|
||||
return $this->belongsTo(ConsumptionTimes::class, 'consumption_times_id');
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ use App\Models\Engagement;
|
|||
use App\Models\FaqQuestions;
|
||||
use App\Models\GeneralConfig;
|
||||
use App\Models\HomeSliderPictures;
|
||||
use App\Models\Label;
|
||||
use App\Models\MeatTypes;
|
||||
use App\Models\Moments;
|
||||
use App\Models\NewsSliderPictures;
|
||||
|
|
@ -119,6 +120,9 @@ class RouteServiceProvider extends ServiceProvider
|
|||
Route::bind('meat_type', function ($value) {
|
||||
return MeatTypes::where('id', $value)->orWhere('slug', $value)->firstOrFail();
|
||||
});
|
||||
Route::bind('label', function ($value) {
|
||||
return Label::where('id', $value)->orWhere('slug', $value)->firstOrFail();
|
||||
});
|
||||
Route::bind('ocbbreeder', function ($value) {
|
||||
return OCBBreeder::where('id', $value)->orWhere('slug', $value)->firstOrFail();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ use App\Enums\EleveurOcbStatus;
|
|||
use App\Models\Articles;
|
||||
use App\Models\BreedingPage;
|
||||
use App\Models\ConsumptionTimes;
|
||||
use App\Models\Label;
|
||||
use App\Models\MeatTypes;
|
||||
use App\Models\Products;
|
||||
use App\Models\Range;
|
||||
|
|
@ -50,6 +51,9 @@ return [
|
|||
'products.meat-type' => [
|
||||
'slugMeatType' => [MeatTypes::class, 'slug']
|
||||
],
|
||||
'products.label' => [
|
||||
'label' => [Label::class, 'slug']
|
||||
],
|
||||
'club.infos.child' => [
|
||||
'articleTag' => [Articles::class, 'type'],
|
||||
'publishedArticle' => [Articles::class, 'slug']
|
||||
|
|
|
|||
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class RemoveDepartaimantsColumnFromProducts extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('products', function (Blueprint $table) {
|
||||
$table->dropColumn('departaimants');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('products', function (Blueprint $table) {
|
||||
$table->boolean('departaimants')
|
||||
->after('number_portion')
|
||||
->default(false);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateLabelsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('labels', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
||||
$table->string('name', 50);
|
||||
$table->string('slug', 50)->unique();
|
||||
|
||||
$table->boolean('status')->default(false);
|
||||
|
||||
$table->timestamps();
|
||||
});
|
||||
Schema::table('products', function (Blueprint $table) {
|
||||
$table->foreignId('label_id')->nullable()->after('meat_type_id');
|
||||
$table->foreign('label_id')->references('id')->on('labels');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('products', function (Blueprint $table) {
|
||||
$table->dropForeign(['label_id']);
|
||||
$table->dropColumn('label_id');
|
||||
});
|
||||
Schema::dropIfExists('labels');
|
||||
}
|
||||
}
|
||||
4
resources/sass/app.scss
vendored
4
resources/sass/app.scss
vendored
|
|
@ -27,3 +27,7 @@ $custom-file-text: (
|
|||
font-size: 0.85rem;
|
||||
}
|
||||
}
|
||||
|
||||
.cursor-default {
|
||||
cursor: default !important;
|
||||
}
|
||||
|
|
|
|||
25
resources/views/bo/labels/create.blade.php
Normal file
25
resources/views/bo/labels/create.blade.php
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
@extends('layouts.bo')
|
||||
|
||||
@section('content')
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
{{ __('Labels')}}
|
||||
<a href="{{route('bo.labels.index')}}" class="btn btn-sm btn-primary float-right">{{ __('Retour') }}</a>
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
<form action="{{route('bo.labels.store')}}" method="POST">
|
||||
@csrf
|
||||
<div class="row">
|
||||
<div class="col-md-6 offset-md-3">
|
||||
@include('bo.messages')
|
||||
@include('bo.labels.form-inputs')
|
||||
<div class="form-group text-center">
|
||||
<input type="submit" class="btn btn-secondary" value="{{ __('Ajouter') }}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
31
resources/views/bo/labels/edit.blade.php
Normal file
31
resources/views/bo/labels/edit.blade.php
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
@extends('layouts.bo')
|
||||
|
||||
@section('content')
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
{{ __('Labels') }}
|
||||
<a href="{{route('bo.labels.index')}}" class="btn btn-sm btn-primary float-right ml-2">{{ __('Retour') }}</a>
|
||||
<form action="{{route('bo.labels.destroy', ['label' => $label->id])}}" method="POST" class="d-inline confirmDeleteJS">
|
||||
@method('DELETE')
|
||||
@csrf
|
||||
<input type="submit" class="btn btn-sm btn-danger float-right" value="{{ __('Supprimer') }}">
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
<form action="{{route('bo.labels.update', ['label' => $label->id])}}" method="POST">
|
||||
@method('PUT')
|
||||
@csrf
|
||||
<div class="row">
|
||||
<div class="col-md-6 offset-md-3">
|
||||
@include('bo.messages')
|
||||
@include('bo.labels.form-inputs')
|
||||
<div class="form-group text-center">
|
||||
<input type="submit" class="btn btn-secondary" value="{{ __('Modifier') }}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
10
resources/views/bo/labels/form-inputs.blade.php
Normal file
10
resources/views/bo/labels/form-inputs.blade.php
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
<div class="form-group">
|
||||
<label for="name"><small>{{ __('Nom') }}</small></label>
|
||||
<input id="name" type="text" class="form-control" name="name" placeholder="{{ __('Nom') }}" value="{{old('name') ?? $label->name ?? ''}}" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>
|
||||
<input type="checkbox" name="status" value="1" @if (isset($label) and $label->status)checked @endif>
|
||||
{{ __('Publié ?') }}
|
||||
</label>
|
||||
</div>
|
||||
41
resources/views/bo/labels/index.blade.php
Normal file
41
resources/views/bo/labels/index.blade.php
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
@extends('layouts.bo')
|
||||
|
||||
@section('content')
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
{{ __('Label') }}
|
||||
<a href="{{route('bo.labels.create')}}" class="btn btn-sm btn-primary float-right">{{ __('Ajouter') }}</a>
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
{{ $labels->withQueryString()->links() }}
|
||||
<table class="table text-center">
|
||||
<thead class="thead-dark">
|
||||
<tr>
|
||||
<th scope="col">{{ __('Nom') }}</th>
|
||||
<th scope="col">{{ __('Publié ?') }}</th>
|
||||
<th scope="col"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($labels as $type)
|
||||
<tr>
|
||||
<th>{{$type->name}}</th>
|
||||
<td>
|
||||
<a href="{{route('bo.labels.change-published', $type)}}" class="btn-link">
|
||||
@if ($type->status)
|
||||
<i class="fas fa-check check-green"></i>
|
||||
@else
|
||||
<i class="fas fa-times cross-red"></i>
|
||||
@endif
|
||||
</a>
|
||||
</td>
|
||||
<td><a href="{{route('bo.labels.edit', ['label' => $type->id])}}" class="btn btn-sm btn-primary">{{ __('Éditer') }}</a></td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
{{ $labels->withQueryString()->links() }}
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
|
@ -137,15 +137,18 @@
|
|||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-check-label">
|
||||
@if ((old('departaimants') ?? $p->departaimants ?? '' )=== 1)
|
||||
<input type="checkbox" name="departaimants" checked>
|
||||
@else
|
||||
<input type="checkbox" name="departaimants">
|
||||
@endif
|
||||
Ayant un départ'aimants
|
||||
</label>
|
||||
<div class="form-group form-inline">
|
||||
<label class="col-form-label col-md-4 d-flex justify-content-start">{{ __('Labels')}} *</label>
|
||||
<select class="custom-select col-md-8" name="label_id">
|
||||
<option value="">{{ __('Aucun label') }}</option>
|
||||
@foreach ($labels as $label)
|
||||
@if ($label->id === ($p->label->id ?? ''))
|
||||
<option value="{{$label->id}}" selected>{{$label->name}}</option>
|
||||
@else
|
||||
<option value="{{$label->id}}">{{$label->name}}</option>
|
||||
@endif
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-form-label">Conseil de préparation</label>
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
// This special case is for breadcrumb because this template is used for mutiple routes
|
||||
$routeName = request()->route()->getName();
|
||||
$brParam = null;
|
||||
if($routeName != 'products.index' && $routeName != 'products.departaimants') {
|
||||
if($routeName != 'products.index') {
|
||||
$brParam = $title;
|
||||
$routeName .= '.show';
|
||||
}
|
||||
|
|
@ -24,8 +24,8 @@ if(isset($typeViande) and $typeViande) {
|
|||
if(isset($momentConso) and $momentConso) {
|
||||
$metatitle = __('Les Produits par moment de consommation : :name', ['name' => $title]);
|
||||
}
|
||||
if(isset($departaimants) && $departaimants) {
|
||||
$metatitle = __('Les Produits avec Départ\'aimants');
|
||||
if(isset($label) and $label) {
|
||||
$metatitle = __('Les Produits par label : :name', ['name' => $title]);
|
||||
}
|
||||
if(!$metatitle) {
|
||||
$metatitle = __('Les Produits');
|
||||
|
|
@ -38,7 +38,7 @@ $description = (isset($gamme) and $gamme) ? __('La gamme ":game", :description',
|
|||
]) : null;
|
||||
$description = $description ?? ((isset($typeViande) and $typeViande) ? __('Découvrez nos différents produits disponibles sélectionnés par leur type de viande, à base de :name', ['name' => $title]) : null);
|
||||
$description = $description ?? ((isset($momentConso) and $momentConso) ? __('Découvrez nos différents produits disponibles sélectionnés par leurs moments de consommation : :name', ['name' => $title]) : null);
|
||||
$description = $description ?? ((isset($departaimants) and $departaimants) ? __('Découvrez les différents produits ayant des Départ\'aimants inclus') : null);
|
||||
$description = $description ?? ((isset($label) and $label) ? __('Découvrez nos différents produits disponibles sélectionnés par leur label : :name', ['name' => $title]) : null);
|
||||
$description = $description ?? __('Découvrez les différents produits en fonction de multiples critères');
|
||||
|
||||
$vegetal = (isset($product) && $product->range->slug === "le-vegetal") ? true : false;
|
||||
|
|
@ -104,19 +104,17 @@ $vegetal = ($vegetal || isset($gamme) && $gamme && $gamme->slug === "le-vegetal"
|
|||
@endforeach
|
||||
</ul>
|
||||
</div>
|
||||
<div class="filter @if (isset($departaimants) && $departaimants)active @endif">
|
||||
@if (isset($departaimants) && $departaimants)
|
||||
<a class="label" href="{{ route('products.index') }}">
|
||||
@else
|
||||
<a class="label" href="{{ route('products.departaimants') }}">
|
||||
@endif
|
||||
{{ __('Départ\'Aimants') }}
|
||||
@if (isset($departaimants) && $departaimants)
|
||||
<i aria-hidden="true" class="far fa-check-square"></i>
|
||||
@else
|
||||
<i aria-hidden="true" class="far fa-square"></i>
|
||||
@endif
|
||||
</a>
|
||||
<div class="filter hassub @if (isset($label) && $label)active @endif">
|
||||
<input class="menu-checkbox" id="product-label" type="checkbox"/>
|
||||
<label for="product-label" class="menu-toggle">
|
||||
{{ __('Labels qualité') }}
|
||||
<i aria-hidden="true" class="fa fa-chevron-down"></i>
|
||||
</label>
|
||||
<ul class="sub">
|
||||
@foreach ($labels as $lbl)
|
||||
<li><a href="{{ route('products.label', $lbl->slug) }}">{{ $lbl->name }}</a></li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
@if(isset($gamme) and isset($subranges) and $subranges and count($subranges))
|
||||
|
|
@ -158,7 +156,7 @@ $vegetal = ($vegetal || isset($gamme) && $gamme && $gamme->slug === "le-vegetal"
|
|||
</div>
|
||||
@endif
|
||||
@endif
|
||||
@if (isset($gamme) or isset($departaimants))
|
||||
@if (isset($gamme))
|
||||
@if($vegetal)
|
||||
<h2 class="gammeDescription vegetal">
|
||||
Découvrez les produits Le Gaulois Végétal : du végétal sans concession avec des produits SANS VIANDE, 100% GOURMANDS, élaborés EN FRANCE à partir de soja SANS OGM.<br>
|
||||
|
|
|
|||
|
|
@ -173,21 +173,25 @@
|
|||
<li class="nav-item dropdown btn btn-sm btn-dark mb-1">
|
||||
<a class="nav-link dropdown-toggle text-white" data-toggle="dropdown" href="#" role="button">{{ __('Les produits') }}</a>
|
||||
<div class="dropdown-menu">
|
||||
<a class="dropdown-item" href="{{route('bo.products.index')}}">{{ __('Tous les produits') }}</a>
|
||||
<span class="d-block text-center fs-4 font-weight-bold cursor-default">{{ __('Produits') }}</span>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item" href="{{route('bo.general-configs.edit', GeneralConfigType::rsm()->value)}}">{{ __('Configuration RSM') }}</a>
|
||||
<a class="dropdown-item" href="{{route('bo.products.index')}}">{{ __('Tous les produits') }}</a>
|
||||
<a class="dropdown-item" href="{{route('bo.products.create')}}">{{ __('Ajouter') }}</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item" href="{{route('bo.ranges.index')}}">{{ __('Toutes les gammes') }}</a>
|
||||
<a class="dropdown-item" href="{{route('bo.ranges.create')}}">{{ __('Ajouter') }}</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item" href="{{route('bo.subranges.index')}}">{{ __('Toutes les sous gammes') }}</a>
|
||||
<a class="dropdown-item" href="{{route('bo.subranges.create')}}">{{ __('Ajouter') }}</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item" href="{{route('bo.product-pictograms.index')}}">{{ __('Gestion des pictos') }}</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<span class="d-block text-center fs-4 font-weight-bold cursor-default">{{ __('Filtres') }}</span>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item" href="{{route('bo.ranges.index')}}">{{ __('Gammes') }}</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item" href="{{route('bo.subranges.index')}}">{{ __('Sous-gammes') }}</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item" href="{{route('bo.consumption-times.index')}}">{{ __('Moments conso.') }}</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item" href="{{route('bo.meat-types.index')}}">{{ __('Types de viandes') }}</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item" href="{{route('bo.labels.index')}}">{{ __('Labels qualité') }}</a>
|
||||
</div>
|
||||
</li>
|
||||
{{-- Les recettes --}}
|
||||
|
|
|
|||
|
|
@ -70,10 +70,6 @@ Breadcrumbs::for('products.consumption-times.show', function (Generator $trail,
|
|||
$trail->parent('products.consumption-times');
|
||||
$trail->push(ucfirst($slugConsumptionTime), route('products.consumption-times', compact('slugConsumptionTime')));
|
||||
});
|
||||
Breadcrumbs::for('products.departaimants', function (Generator $trail) {
|
||||
$trail->parent('products.index');
|
||||
$trail->push(__('Départaimants'), route('products.departaimants'));
|
||||
});
|
||||
Breadcrumbs::for('product.show', function (Generator $trail, Products $product) {
|
||||
$trail->parent('products.index');
|
||||
$trail->push($product->name, route('product.show', compact('product')));
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ use App\Http\Controllers\Bo\GeneralConfig;
|
|||
use App\Http\Controllers\Bo\NutritionPageController;
|
||||
use App\Http\Controllers\Bo\HomeSliderPicturesController;
|
||||
use App\Http\Controllers\Bo\JoinusController;
|
||||
use App\Http\Controllers\Bo\LabelController;
|
||||
use App\Http\Controllers\Bo\MeatTypesController;
|
||||
use App\Http\Controllers\Bo\MomentsController;
|
||||
use App\Http\Controllers\Bo\NewsSliderPicturesController;
|
||||
|
|
@ -61,6 +62,7 @@ Route::prefix('bo')
|
|||
Route::resource('faq-themes', FaqThemesController::class)->except(['show']);
|
||||
Route::resource('home-slider-pictures', HomeSliderPicturesController::class)->except(['show']);
|
||||
Route::resource('meat-types', MeatTypesController::class)->except(['show']);
|
||||
Route::resource('labels', LabelController::class)->except(['show']);
|
||||
Route::resource('moments', MomentsController::class)->except(['show'])
|
||||
->withoutMiddleware('xss')
|
||||
->middleware('xss:strates,featured_text');
|
||||
|
|
@ -127,6 +129,7 @@ Route::prefix('bo')
|
|||
Route::get('/moments/change-published/{moment}', [MomentsController::class, 'changePublished'])->name('moments.change-published');
|
||||
Route::get('/consumption-times/change-published/{consumptiontime}', [ConsumptionTimesController::class, 'changePublished'])->name('consumption-times.change-published');
|
||||
Route::get('/meat-types/change-published/{meat_type}', [MeatTypesController::class, 'changePublished'])->name('meat-types.change-published');
|
||||
Route::get('/labels/change-published/{label}', [LabelController::class, 'changePublished'])->name('labels.change-published');
|
||||
Route::get('/ads/change-published/{ad}', [AdsController::class, 'changePublished'])->name('ads.change-published');
|
||||
Route::get('/home-slider-pictures/change-published/{homeslider}', [HomeSliderPicturesController::class, 'changePublished'])->name('home-slider-pictures.change-published');
|
||||
Route::get('/news-slider-pictures/change-published/{newsslider}', [NewsSliderPicturesController::class, 'changePublished'])->name('news-slider-pictures.change-published');
|
||||
|
|
|
|||
|
|
@ -61,11 +61,11 @@ Route::prefix('/produits')
|
|||
->name('products.')
|
||||
->group(function () {
|
||||
Route::get('/', [ProductsController::class, 'index'])->name('index');
|
||||
Route::get('/departaimants', [ProductsController::class, 'departaimants'])->name('departaimants');
|
||||
Route::get('/gamme/{slugRange}/{subRange?}', [ProductsController::class, 'filter'])->name('range');
|
||||
Route::get('/moment-consommations/{slugConsumptionTime}', [ProductsController::class, 'filter'])
|
||||
->name('consumption-times');
|
||||
Route::get('/type-viande/{slugMeatType}', [ProductsController::class, 'filter'])->name('meat-type');
|
||||
Route::get('/label/{label}', [ProductsController::class, 'filter'])->name('label');
|
||||
});
|
||||
|
||||
Route::prefix('/produit')
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue