Merge branch 'trunk'

This commit is contained in:
Vincent BRIDIER 2024-08-13 12:57:21 +02:00
commit da979ce793
No known key found for this signature in database
GPG key ID: 8571BFA20420D512
11 changed files with 35 additions and 15 deletions

View file

@ -171,7 +171,7 @@ class ProductController extends Controller
{
if (is_array($request->input('slider_pictures'))) {
$product->slider_pictures = [];
$product->slider_pictures = collect($request->input('slider_pictures'))
$product->slider_pictures = collect($request->file('slider_pictures'))
->map(function ($picture) use ($product) {
return FileStorageHelper::storeFile($product, $picture, true);
})->all();

View file

@ -90,7 +90,7 @@ class StoreAdviceRequest extends FormRequest
}
],
'ingredients.*' => 'required|array',
'ingredients.*.value' => 'nullable|numeric|max:65535',
'ingredients.*.value' => 'nullable|regex:/^\d*\.?\d{0,1}$/|between:0,65535',
'ingredients.*.label' => [
Rule::requiredIf(function () {
return $this->type === AdviceTypeEnum::recipes->value();

View file

@ -38,6 +38,7 @@ class StoreProductRequest extends FormRequest
'status' => $this->status ? true : false
]);
$this->mergePicture('sticker_sm');
$this->mergePicture('slider_pictures');
}
/**

View file

@ -115,9 +115,17 @@ class Product extends Model implements SeoInterface
});
static::updated(function (self $model) {
FileStorageHelper::removeOldFile($model, 'sticker_sm');
FileStorageHelper::removeOldFiles(
$model->getOriginal('slider_pictures'),
$model->slider_pictures
);
});
static::deleted(function (self $model) {
FileStorageHelper::removeFile($model, 'sticker_sm');
FileStorageHelper::removeOldFiles(
$model->getOriginal('slider_pictures'),
[]
);
});
}

View file

@ -112,8 +112,7 @@ trait HasPicture
];
return [
$name => [!$nullable ? 'required' : 'nullable', 'array', "between:{$limitMin},{$limitMax}"],
"{$name}Validate" => "required_with:{$name}|array",
"{$name}Validate.*" => [
"{$name}.*" => [
'required',
function (string $attribute, $value, callable $fail) use ($sizes) {
ToolboxHelper::validatePicture($attribute, $value, $fail, $sizes);

8
package-lock.json generated
View file

@ -14,7 +14,7 @@
"@fortawesome/free-regular-svg-icons": "^6.5.1",
"@fortawesome/free-solid-svg-icons": "^6.5.1",
"@fortawesome/vue-fontawesome": "^3.0.5",
"@ldc-web/cookie-notice": "^5.0.7",
"@ldc-web/cookie-notice": "^6.0.3",
"@sipec/vue3-tags-input": "^3.0.4",
"@types/bootstrap": "^5.2.7",
"@types/node": "^20.8.2",
@ -1076,9 +1076,9 @@
}
},
"node_modules/@ldc-web/cookie-notice": {
"version": "5.0.7",
"resolved": "https://lab.s-web.fr/api/v4/projects/50/packages/npm/@ldc-web/cookie-notice/-/@ldc-web/cookie-notice-5.0.7.tgz",
"integrity": "sha1-oKA7WKy2idz0btEKn3vSWpoj8aw=",
"version": "6.0.3",
"resolved": "https://lab.s-web.fr/api/v4/projects/50/packages/npm/@ldc-web/cookie-notice/-/@ldc-web/cookie-notice-6.0.3.tgz",
"integrity": "sha1-mW2DD+8ipWkmvKhZ3m9h5wemAHI=",
"dev": true
},
"node_modules/@nodelib/fs.scandir": {

View file

@ -22,7 +22,7 @@
"@fortawesome/free-regular-svg-icons": "^6.5.1",
"@fortawesome/free-solid-svg-icons": "^6.5.1",
"@fortawesome/vue-fontawesome": "^3.0.5",
"@ldc-web/cookie-notice": "^5.0.7",
"@ldc-web/cookie-notice": "^6.0.3",
"@sipec/vue3-tags-input": "^3.0.4",
"@types/bootstrap": "^5.2.7",
"@types/node": "^20.8.2",

View file

@ -219,6 +219,10 @@ $thumbs-height: 10%;
// L::::::::::::::::::::::L GGG::::::GGG:::G
// LLLLLLLLLLLLLLLLLLLLLLLL GGGGGG GGGG
@include media-breakpoint-up(lg) { // >= 992px
.swiper-lgp {
width: 100%;
}
.swiper-hero-progress-bar { width: 99%; }
.section-products {

View file

@ -19,11 +19,11 @@
v-for="(ingredient, index) of ingredients"
:key="index"
>
<span v-if="Number.parseInt(String(ingredient.value)) > 0">{{
<span v-if="Number.parseFloat(String(ingredient.value)) > 0">{{
Math.ceil(
(guests * Number.parseInt(String(ingredient.value))) /
(guests * Number.parseFloat(String(ingredient.value)) * 10) /
adviceGuestBase
)
) / 10
}}&nbsp;</span>
<span>{{ ingredient.label }}</span>
</li>

View file

@ -517,7 +517,7 @@
'label' => Str::ucfirst(__('validation.attributes.ingredients')),
'model' => $adviceModel ?? null,
'itemColumns' => [['value', 'Quantité'], ['label', 'Description']],
'itemType' => ['number', 'text'],
'itemType' => ['float', 'text'],
'itemLimit' => [1, 15],
'inputPlaceholder' => ['Quantité (nombre)', 'Mesure + ingrédients (ex: g. de sautés de poulet ou tomate(s))'],
'required' => true,

View file

@ -62,7 +62,10 @@ $cookies['recaptcha'] = [
'description' => __('cookie-notice.custom.recaptcha.description'),
'link' => 'https://policies.google.com/privacy',
'labelLink' => __('En savoir +'),
'cookies' => ['NID', '__Secure-3PAPISID', '__Secure-3PSID', '__Secure-3PSIDCC']
'cookies' => [
"NID", "_grecaptcha", "__Secure-3PAPISID", "__Secure-3PSID", "__Secure-3PSIDCC",
"_GRECAPTCHA", "rc::c", "rc::b", "rc::a", "itsec-recaptcha-opt-in-*"
]
];
$cookies['recaptcha']['script'] = <<<SCRIPT
@ -98,7 +101,12 @@ $cookies['matomo'] = [
'description' => __('cookie-notice.custom.matomo.description'),
'link' => 'https://fr.matomo.org/gdpr-analytics/',
'labelLink' => __('En savoir +'),
'cookies' => ['_pk']
'cookies' => [
"_pk*",
"_pk_ref", "_pk_cvar", "_pk_id", "_pk_ses", "_pk_hsr", "piwik_ignore", "_pk_uid",
"mtm_consent", "matomo_ignore", "matomo_sessid"
]
];
$cookies['matomo']['script'] = <<<SCRIPT