Fixes #10 Add product picture arrow
This commit is contained in:
parent
49712d57e6
commit
6b63858cf8
6 changed files with 104 additions and 4 deletions
|
|
@ -53,6 +53,8 @@ class StoreProductRequest extends FormRequest
|
|||
'marinade' => 'nullable|string|min:15',
|
||||
'picture_alt' => 'required|min:3|max:255',
|
||||
'picture_title' => 'required|min:3|max:255',
|
||||
'picture_arrow_alt' => 'required_with:picture_arrow|min:3|max:255',
|
||||
'picture_arrow_title' => 'required_with:picture_arrow|min:3|max:255',
|
||||
'certifications' => 'present|array',
|
||||
'certifications.*' => 'required|integer',
|
||||
'list' => [
|
||||
|
|
@ -82,6 +84,7 @@ class StoreProductRequest extends FormRequest
|
|||
return \array_merge(
|
||||
$rules,
|
||||
$this->pictureRules('picture', 600, 600, 600, 600, false),
|
||||
$this->pictureRules('picture_arrow', 208, 108, 208, 108, true),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -101,6 +104,9 @@ class StoreProductRequest extends FormRequest
|
|||
'marinade' => trans('marinade'),
|
||||
'picture_alt' => trans('picture_alt'),
|
||||
'picture_title' => trans('picture_title'),
|
||||
'picture_arrow' => trans('picture_arrow'),
|
||||
'picture_arrow_alt' => trans('picture_arrow_alt'),
|
||||
'picture_arrow_title' => trans('picture_arrow_title'),
|
||||
'certifications' => trans('certifications'),
|
||||
'certifications.*' => trans('value(s) of certifications'),
|
||||
'list' => trans('list'),
|
||||
|
|
|
|||
|
|
@ -22,6 +22,8 @@ class UpdateProductRequest extends StoreProductRequest
|
|||
'marinade' => 'nullable|string|min:15',
|
||||
'picture_alt' => 'required|min:3|max:255',
|
||||
'picture_title' => 'required|min:3|max:255',
|
||||
'picture_arrow_alt' => 'required_with:picture_arrow|nullable|min:3|max:255',
|
||||
'picture_arrow_title' => 'required_with:picture_arrow|nullable|min:3|max:255',
|
||||
'certifications' => 'present|array',
|
||||
'certifications.*' => 'required|integer',
|
||||
'list' => [
|
||||
|
|
@ -51,6 +53,7 @@ class UpdateProductRequest extends StoreProductRequest
|
|||
return \array_merge(
|
||||
$rules,
|
||||
$this->pictureRules('picture', 600, 600, 600, 600, true),
|
||||
$this->pictureRules('picture_arrow', 208, 108, 208, 108, true),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,6 +45,9 @@ class Product extends Model
|
|||
'picture',
|
||||
'picture_alt',
|
||||
'picture_title',
|
||||
'picture_arrow',
|
||||
'picture_arrow_alt',
|
||||
'picture_arrow_title',
|
||||
'certifications',
|
||||
'nutritionnal_values',
|
||||
'list',
|
||||
|
|
@ -80,6 +83,9 @@ class Product extends Model
|
|||
'picture',
|
||||
'picture_alt',
|
||||
'picture_title',
|
||||
'picture_arrow',
|
||||
'picture_arrow_alt',
|
||||
'picture_arrow_title',
|
||||
'nutritionnal_values',
|
||||
'list',
|
||||
];
|
||||
|
|
|
|||
|
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('products', function (Blueprint $table) {
|
||||
$table->json('picture_arrow')->default("{}")->after('picture_title')
|
||||
->comment('Image fleche, 208px x 108px');
|
||||
$table->json('picture_arrow_alt')->default("{}")->after('picture_arrow')
|
||||
->comment('Attribut alt de l\'image fleche');
|
||||
$table->json('picture_arrow_title')->default("{}")->after('picture_arrow_alt')
|
||||
->comment('Titre de l\'image fleche');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('products', function (Blueprint $table) {
|
||||
$table->dropColumn('picture_arrow');
|
||||
$table->dropColumn('picture_arrow_alt');
|
||||
$table->dropColumn('picture_arrow_title');
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
@ -252,6 +252,54 @@
|
|||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
{{-- PICTURE ARROW --}}
|
||||
<div class="col-12 mb-3">
|
||||
<fieldset class="border h-100 bg-white p-3">
|
||||
<legend>{{ __('Illustration Flèche') }}</legend>
|
||||
<div class="row">
|
||||
{{-- PICTURE_ALT ARROW --}}
|
||||
<div class="col-12 col-md-6 mb-3">
|
||||
@include('bo.partials.inputs.varchar', [
|
||||
'id' => 'productPictureArrowAlt',
|
||||
'label' => __('Alt attribute of the :model', ['model' => Str::singular(__('models.classes.products'))]),
|
||||
'hasWordCounter' => true,
|
||||
'name' => 'picture_arrow_alt',
|
||||
'required' => false,
|
||||
'model' => $productModel ?? null,
|
||||
'helper' => __('Must describe your image for search engines and blind people (5 to 6 words, minimum 3 characters).'),
|
||||
])
|
||||
</div>
|
||||
{{-- PICTURE_TITLE ARROW --}}
|
||||
<div class="col-12 col-md-6 mb-3">
|
||||
@include('bo.partials.inputs.varchar', [
|
||||
'id' => 'productPictureArrowTitle',
|
||||
'label' => __('Title attribute of the :model', ['model' => Str::singular(__('models.classes.products'))]),
|
||||
'hasWordCounter' => true,
|
||||
'name' => 'picture_arrow_title',
|
||||
'required' => false,
|
||||
'model' => $productModel ?? null,
|
||||
'helper' => __('Useful for users, displayed by moving the mouse over the image (minimum 3 characters).'),
|
||||
])
|
||||
</div>
|
||||
{{-- PICTURE ARROW --}}
|
||||
<div class="col-12">
|
||||
@include('bo.partials.inputs.varchar-picture', [
|
||||
'id' => 'productPictureArrow',
|
||||
'name' => 'picture_arrow',
|
||||
'width' => 208,
|
||||
'height' => 108,
|
||||
'model' => $productModel ?? null,
|
||||
'helper' => __('crud.minicrud.dimensions_must_be', [
|
||||
'widthpx' => '208px',
|
||||
'heightpx' => '108px',
|
||||
]),
|
||||
'required' => false,
|
||||
'preview' => true,
|
||||
])
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
{{-- STATUS --}}
|
||||
<div class="col-12 col-md-6 mb-3">
|
||||
<fieldset class="border h-100 bg-white p-3">
|
||||
|
|
|
|||
|
|
@ -27,10 +27,8 @@
|
|||
</div>
|
||||
|
||||
<div class="block md:col-span-2 relative pt-12 sm:pt-0 ">
|
||||
@if ($productModel->range->picto == '05_soupchicken')
|
||||
<img class="absolute top-6 sm:-top-12 md-top-8 lg:-top-4 xl:top-2 left-4 sm:-left-16 md:-left-28 w-40 md:w-48" src="{{ Vite::asset('resources/assets/images/Icons/Produkt-USP-60prozent.svg') }}">
|
||||
@else
|
||||
<img class="absolute top-6 sm:-top-12 md-top-8 lg:-top-4 xl:top-2 left-4 sm:-left-16 md:-left-28 w-40 md:w-48" src="{{ Vite::asset('resources/assets/images/Icons/Produkt-USP.svg') }}">
|
||||
@if($productModel->picture_arrow)
|
||||
<img class="absolute top-6 sm:-top-12 md-top-8 lg:-top-4 xl:top-2 left-4 sm:-left-16 md:-left-28 w-40 md:w-48" src="{{ asset($productModel->picture_arrow) }}" title="{{ $productModel->picture_arrow_title }}" alt="{{ $productModel->picture_arrow_alt }}">
|
||||
@endif
|
||||
<img class="max-w-md sm:max-w-full w-full mx-auto mt-8 sm:mt-0" src="{{ asset($productModel->picture) }}" title="{{ $productModel->picture_title }}" alt="{{ $productModel->picture_alt }}">
|
||||
<div class="flex items-center justify-center w-full mt-6">
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue