Merge branch '338-add-field' into 'develop'

feat: ✨ add sales name field to product

See merge request ldc-web/projets/le-gaulois!403
This commit is contained in:
K. 2026-10-22 07:39:54 +00:00
commit 44f6f52fae
7 changed files with 68 additions and 0 deletions

View file

@ -60,6 +60,7 @@ class StoreProductRequest extends FormRequest
'description' => ['required', 'string', new WysiwygLength()],
'details' => ['required', 'string', new WysiwygLength()],
'preparation' => ['required', 'string', new WysiwygLength()],
'sales_name' => ['nullable', 'string', new WysiwygLength(min: 0, max: 100)],
'ingredients' => ['required', 'string', new WysiwygLength()],
'nutritionnal_values' => 'required|array',
'nutritionnal_values.energy' => 'required|numeric|between:0,999999',
@ -219,6 +220,7 @@ class StoreProductRequest extends FormRequest
'description' => trans('validations.custom.description'),
'details' => trans('validations.custom.details'),
'preparation' => trans('validations.custom.preparation'),
'sales_name' => trans('validation.custom.sales_name'),
'ingredients' => trans('validations.custom.ingredients'),
'approach_id' => trans('models.classes.demarche'),

View file

@ -90,6 +90,7 @@ class Product extends Model implements RedirectableInterface, SchemaOrgInterface
'details',
'preparation',
'ingredients',
'sales_name',
'approach_id',
'range_id',
'subrange_id',

View file

@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('products', function (Blueprint $table) {
$table->text('sales_name')->nullable()->comment('Product sales name.')->after('ingredients');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('products', function (Blueprint $table) {
$table->dropColumn('sales_name');
});
}
};

View file

@ -398,5 +398,6 @@ return [
'advice_picto' => 'advice icon',
'tips_title' => 'nutrition tip title',
'tips_picto' => 'nutrition tip icon',
'sales_name' => 'sales name',
],
];

View file

@ -417,5 +417,6 @@ return [
'advice_picto' => 'picto du conseil',
'tips_title' => 'titre de l\'astuce nutrition',
'tips_picto' => 'picto de l\'astuce nutrition',
'sales_name' => 'dénomination de vente',
],
];

View file

@ -235,6 +235,35 @@
</fieldset>
</div>
{{-- INGREDIENTS --}}
<div class="col-12 mb-3">
<fieldset class="border p-3">
<legend>{{ str(__('validation.custom.sales_name'))->ucfirst() }}</legend>
<div class="row mb-3">
<div class="col-12">
@include('bo.partials.inputs.text-html', [
'id' => 'productSalesName',
'label' => str(
__(':field :inter:model', [
'field' => str(__('validation.custom.sales_name')),
'inter' => __('validation.custom.of_the.male'),
'model' => __('models.classes.product'),
]))->ucfirst(),
'name' => 'sales_name',
'model' => $productModel ?? null,
'required' => false,
'helper' =>
__('crud.minicrud.text_warning') .
' ' .
__('validation.min.string', [
'attribute' => str(__('validation.custom.sales_name')),
'min' => 0,
]),
])
</div>
</div>
</fieldset>
</div>
{{-- INGREDIENTS --}}
<div class="col-12 mb-3">
<fieldset class="border p-3">
<legend>{{ str(__('validation.custom.ingredient'))->ucfirst()->plural() }}</legend>

View file

@ -265,6 +265,12 @@
title="{{ __('Bouton de fermeture de la modale') }}" alt="{{ __('Croix marron') }}">
</button>
<div class="modal-body line-border-small bg-white">
@if ($productModel->sales_name)
<div class="mb-3">
<p class="f-bourton-base fs-5 mb-2">{{ __('Dénomination de vente') }}</p>
{!! clean($productModel->sales_name) !!}
</div>
@endif
<p class="f-bourton-base fs-5 mb-2">{{ __('ingrédients') }}</p>
{!! clean($productModel->ingredients) !!}
@if ($nutritionnalValueModel)