Merge branch 'issue-4' into 'develop'
feat: delete the shelf in range and brand models See merge request ldc-web/projets/showroom/showroom-bo!11
This commit is contained in:
commit
aa767eff32
14 changed files with 36 additions and 105 deletions
|
|
@ -35,7 +35,6 @@ class ProductController extends Controller
|
|||
/** @var \Illuminate\Database\Eloquent\Builder $query */
|
||||
$query = Product::query()->with(['range', 'brand'])->withCount([
|
||||
'range as parent_published' => fn(Builder $q) => $q->where('ranges.status', true),
|
||||
'range as parent_shelf' => fn(Builder $q) => $q->where('ranges.shelf', true),
|
||||
'brand as parent_parent_published' => fn(Builder $q) => $q->where('brands.status', true),
|
||||
]);
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,6 @@ class RangeController extends Controller
|
|||
$query = Range::query()->with(['brand', 'font'])->withCount([
|
||||
'products',
|
||||
'products as published_products' => fn(Builder $q) => $q->where('products.status', true),
|
||||
'brand as parent_shelf' => fn(Builder $q) => $q->where('shelf', true),
|
||||
'brand as parent_published' => fn(Builder $q) => $q->where('status', true),
|
||||
]);
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@ class StoreBrandRequest extends FormRequest
|
|||
{
|
||||
$this->mergePicture('picture');
|
||||
$this->merge([
|
||||
'shelf' => $this->boolean('shelf'),
|
||||
'status' => $this->boolean('status')
|
||||
]);
|
||||
}
|
||||
|
|
@ -46,7 +45,6 @@ class StoreBrandRequest extends FormRequest
|
|||
$rules = [
|
||||
'name' => 'required|min:2|max:60',
|
||||
'color' => ['required', new Hex()],
|
||||
'shelf' => 'present|boolean',
|
||||
'status' => 'present|boolean'
|
||||
];
|
||||
|
||||
|
|
@ -66,7 +64,6 @@ class StoreBrandRequest extends FormRequest
|
|||
return [
|
||||
'color' => trans('validation.custom.color'),
|
||||
'status' => \trans('validation.custom.status'),
|
||||
'shelf' => \trans('validation.custom.shelf'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,7 +33,6 @@ class StoreRangeRequest extends FormRequest
|
|||
{
|
||||
$this->mergePicture('picture');
|
||||
$this->merge([
|
||||
'shelf' => $this->boolean('shelf'),
|
||||
'status' => $this->boolean('status')
|
||||
]);
|
||||
}
|
||||
|
|
@ -52,7 +51,6 @@ class StoreRangeRequest extends FormRequest
|
|||
'font_id' => 'required|exists:fonts,id',
|
||||
'color' => ['required', new Hex()],
|
||||
'width' => ['required', Rule::enum(Width::class)],
|
||||
'shelf' => 'present|boolean',
|
||||
'status' => 'present|boolean',
|
||||
];
|
||||
|
||||
|
|
@ -83,7 +81,6 @@ class StoreRangeRequest extends FormRequest
|
|||
'color' => \trans('validation.custom.color'),
|
||||
'width' => \trans('validation.custom.width'),
|
||||
'status' => \trans('validation.custom.status'),
|
||||
'shelf' => \trans('validation.custom.shelf'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ use Illuminate\Http\UploadedFile;
|
|||
* @property string $slug Slug of the name for the brand.
|
||||
* @property string $color HTML Color string.
|
||||
* @property string $picture Picture path for the brand.
|
||||
* @property boolean $shelf Les enfant sont rendus sur un étagere.
|
||||
* @property boolean $status Visible ? (présent dans l'export).
|
||||
* @property string $tenant_id Id of the related tenant.
|
||||
* @property-read \Illuminate\Support\Carbon $created_at Created date.
|
||||
|
|
@ -45,7 +44,6 @@ class Brand extends Model
|
|||
'name',
|
||||
'color',
|
||||
'picture',
|
||||
'shelf',
|
||||
'status',
|
||||
];
|
||||
|
||||
|
|
@ -66,7 +64,6 @@ class Brand extends Model
|
|||
*/
|
||||
protected $casts = [
|
||||
'color' => HtmlColor::class,
|
||||
'shelf' => 'bool',
|
||||
'status' => 'bool',
|
||||
];
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ use App\Helpers\ShowroomFileHelper;
|
|||
* @property integer $width Width or the range to display
|
||||
* (1 or 2 columns, 2 is full width).
|
||||
* @property integer $order Order for the range to display.
|
||||
* @property boolean $shelf Les enfant sont rendus sur un étagere.
|
||||
* @property boolean $status Visible ? (présent dans l'export).
|
||||
* @property string $tenant_id Id of the related tenant.
|
||||
* @property-read \Illuminate\Support\Carbon $created_at Created date.
|
||||
|
|
@ -54,7 +53,6 @@ class Range extends Model
|
|||
'color',
|
||||
'width',
|
||||
'order',
|
||||
'shelf',
|
||||
'status',
|
||||
];
|
||||
|
||||
|
|
@ -74,7 +72,6 @@ class Range extends Model
|
|||
* @var array<string, string>
|
||||
*/
|
||||
protected $casts = [
|
||||
'shelf' => 'bool',
|
||||
'status' => 'bool',
|
||||
'width' => Width::class
|
||||
];
|
||||
|
|
|
|||
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('brands', function (Blueprint $table) {
|
||||
$table->dropColumn('shelf');
|
||||
});
|
||||
Schema::table('ranges', function (Blueprint $table) {
|
||||
$table->dropColumn('shelf');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('brands', function (Blueprint $table) {
|
||||
$table->boolean('shelf')->comment('Les enfant sont rendus sur un étagere.');
|
||||
});
|
||||
Schema::table('ranges', function (Blueprint $table) {
|
||||
$table->boolean('shelf')->comment('Les enfant sont rendus sur un étagere.');
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
@ -85,24 +85,6 @@
|
|||
</fieldset>
|
||||
</div>
|
||||
|
||||
{{-- SHELF --}}
|
||||
<div class="col-12 col-md-6 mb-3">
|
||||
<fieldset class="h-100 border p-3">
|
||||
<legend>{{ Str::ucfirst(__('validation.custom.shelf')) }}</legend>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
@include('bo.partials.inputs.tinyint-boolean', [
|
||||
'id' => 'brandShelf',
|
||||
'name' => 'shelf',
|
||||
'label' => __('Afficher sur une étagère'),
|
||||
'helper' => __('Les modèles enfant seront affichés sur une étagère'),
|
||||
'model' => $brandModel ?? null,
|
||||
'default' => true,
|
||||
])
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
{{-- STATUS --}}
|
||||
<div class="col-12 col-md-6 mb-3">
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@
|
|||
'cols' => [
|
||||
'name' => Str::ucfirst(__('validation.attributes.name')),
|
||||
'color' => Str::ucfirst(__('validation.custom.color')),
|
||||
'shelf' => Str::ucfirst(__('validation.custom.shelf')),
|
||||
'status' => Str::ucfirst(__('validation.custom.status')),
|
||||
'updated_at' => Str::ucfirst(__('validation.attributes.updated_at')),
|
||||
],
|
||||
|
|
@ -34,13 +33,6 @@
|
|||
{{ $brandModel->color }}
|
||||
</span>
|
||||
</td>
|
||||
<td class="text-center align-middle">
|
||||
@if ($brandModel->shelf)
|
||||
<strong class="text-info px-1">{{ __('Oui') }}</strong>
|
||||
@else
|
||||
<strong class="text-bg-tertiary px-1">{{ __('Non') }}</strong>
|
||||
@endif
|
||||
</td>
|
||||
<td class="text-center align-middle">
|
||||
@if ($brandModel->status)
|
||||
<i class="text-primary fa-solid fa-circle-check"></i>
|
||||
|
|
|
|||
|
|
@ -61,14 +61,6 @@
|
|||
<a data-bs-toggle="tooltip" href="{{ route('bo.ranges.edit', ['tenant' => tenant(), 'range' => $productModel->range]) }}"
|
||||
title="{{ __('Éditer la gamme') }}">{{ $productModel->range->name }}</a>
|
||||
</div>
|
||||
<span class="d-inline-flex">
|
||||
<i>{{ Str::ucfirst(__('validation.custom.shelf')) }} : </i>
|
||||
@if ($productModel->range->shelf)
|
||||
<strong class="text-info px-1">{{ __('Oui') }}</strong>
|
||||
@else
|
||||
<strong class="text-bg-tertiary px-1">{{ __('Non') }}</strong>
|
||||
@endif
|
||||
</span>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -6,11 +6,10 @@
|
|||
'name' => Str::ucfirst(__('validation.attributes.name')),
|
||||
'range_id' => Str::ucfirst(trans_choice('models.classes.range', 1)),
|
||||
'brand_id' => Str::ucfirst(trans_choice('models.classes.brand', 1)),
|
||||
'shelf' => Str::ucfirst(__('validation.custom.shelf')),
|
||||
'status' => Str::ucfirst(__('validation.custom.status')),
|
||||
'updated_at' => Str::ucfirst(__('validation.attributes.updated_at')),
|
||||
],
|
||||
'ignore' => ['brand_id', 'shelf'],
|
||||
'ignore' => ['brand_id'],
|
||||
])
|
||||
</thead>
|
||||
<tbody>
|
||||
|
|
@ -40,16 +39,6 @@
|
|||
{{ Str::limit($productModel->brand->name, 35) }}
|
||||
</a>
|
||||
</td>
|
||||
<td class="text-center align-middle">
|
||||
<span class="d-inline-flex">
|
||||
{{ __('Parent') }} :
|
||||
@if ($productModel->parent_shelf)
|
||||
<strong class="text-info px-1">{{ __('Oui') }}</strong>
|
||||
@else
|
||||
<strong class="text-bg-tertiary px-1">{{ __('Non') }}</strong>
|
||||
@endif
|
||||
</span>
|
||||
</td>
|
||||
<td class="text-center align-middle">
|
||||
@if ($productModel->status)
|
||||
<i class="text-primary fa-solid fa-circle-check"></i>
|
||||
|
|
|
|||
|
|
@ -62,14 +62,6 @@
|
|||
<legend>{{ __('Parent') }}</legend>
|
||||
<a data-bs-toggle="tooltip" href="{{ route('bo.brands.edit', ['tenant' => tenant(), 'brand' => $rangeModel->brand]) }}"
|
||||
title="{{ __('Éditer la marque') }}">{{ $rangeModel->brand->name }}</a>
|
||||
<span class="d-inline-flex">
|
||||
<i>{{ Str::ucfirst(__('validation.custom.shelf')) }} : </i>
|
||||
@if ($rangeModel->brand->shelf)
|
||||
<strong class="text-info px-1">{{ __('Oui') }}</strong>
|
||||
@else
|
||||
<strong class="text-bg-tertiary px-1">{{ __('Non') }}</strong>
|
||||
@endif
|
||||
</span>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -149,25 +149,6 @@
|
|||
|
||||
|
||||
|
||||
{{-- SHELF --}}
|
||||
<div class="col-12 col-md-6 mb-3">
|
||||
<fieldset class="h-100 border p-3">
|
||||
<legend>{{ Str::ucfirst(__('validation.custom.shelf')) }}</legend>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
@include('bo.partials.inputs.tinyint-boolean', [
|
||||
'id' => 'productShelf',
|
||||
'name' => 'shelf',
|
||||
'label' => __('Afficher sur une étagère'),
|
||||
'helper' => __('Les modèles enfant seront affichés sur une étagère'),
|
||||
'model' => $rangeModel ?? null,
|
||||
'default' => true,
|
||||
])
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
{{-- STATUS --}}
|
||||
<div class="col-12 col-md-6 mb-3">
|
||||
<fieldset class="h-100 border p-3">
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@
|
|||
'cols' => [
|
||||
'name' => Str::ucfirst(__('validation.attributes.name')),
|
||||
'brand_id' => Str::ucfirst(trans_choice('models.classes.brand', 1)),
|
||||
'shelf' => Str::ucfirst(__('validation.custom.shelf')),
|
||||
'width' => Str::ucfirst(__('validation.custom.width')),
|
||||
'status' => Str::ucfirst(__('validation.custom.status')),
|
||||
'order' => Str::ucfirst(__('validation.custom.order')),
|
||||
|
|
@ -48,23 +47,7 @@
|
|||
{{ Str::limit($rangeModel->brand->name, 35) }}
|
||||
</a>
|
||||
</td>
|
||||
<td class="text-center align-middle">
|
||||
<span>
|
||||
@if ($rangeModel->shelf)
|
||||
<strong class="text-info px-1">{{ __('Oui') }}</strong>
|
||||
@else
|
||||
<strong class="text-bg-tertiary px-1">{{ __('Non') }}</strong>
|
||||
@endif
|
||||
</span>
|
||||
<span class="d-inline-flex">
|
||||
{{ __('Parent') }} :
|
||||
@if ($rangeModel->parent_shelf)
|
||||
<strong class="text-info px-1">{{ __('Oui') }}</strong>
|
||||
@else
|
||||
<strong class="text-bg-tertiary px-1">{{ __('Non') }}</strong>
|
||||
@endif
|
||||
</span>
|
||||
</td>
|
||||
|
||||
<td class="text-center align-middle">
|
||||
<span>{{ $rangeModel->width->percentValue() }}</span>
|
||||
</td>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue