SYNC 14 Setup prizes add picture + normalize + make usage of all fields + add image/resizer

This commit is contained in:
Jérémy Munsch 2023-12-06 11:19:39 +01:00
parent 880d722e5f
commit d66e34f5b8
No known key found for this signature in database
GPG key ID: 18361AF3BFEC0FEC
20 changed files with 539 additions and 85 deletions

View file

@ -38,14 +38,12 @@ class PrizeController extends Controller
$prizeModels,
$search,
null,
'label_one',
'label_many',
'label',
);
}
$searchFields = \sprintf(
'%s, %s ...',
Str::ucfirst(__('validation.custom.label_one')),
__('validation.custom.label_many'),
'%s ...',
Str::ucfirst(__('validation.custom.label'))
);
/** Sort columns with a query */

View file

@ -154,7 +154,7 @@ class EnterCodeController extends Controller
],
[
'fieldName' => 'label_type_support',
'fieldValue' => 'Gain du lot : ' . $instantWin->prize->label_one
'fieldValue' => 'Gain du lot : ' . $instantWin->prize->label
]
]
];

View file

@ -3,11 +3,14 @@
namespace App\Http\Requests\Bo\Prizes;
use App\Models\Prize;
use App\Traits\Requests\HasPicture;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Gate;
class StorePrizeRequest extends FormRequest
{
use HasPicture;
/**
* Determine if the user is authorized to make this request.
*
@ -37,15 +40,22 @@ class StorePrizeRequest extends FormRequest
*/
public function rules()
{
return [
'label_one' => 'required|string|min:3|max:255',
'label_many' => 'required|string|min:3|max:255',
$rules = [
'label' => 'required|string|min:3|max:255',
'picture_alt' => 'required|string|between:3,255',
'picture_title' => 'required|string|between:3,255',
'arg_title' => 'required|string|min:3|max:255',
'arg_subtitle' => 'required|string|min:3|max:255',
'arg_content' => 'required|string|min:15',
'quantity' => 'required|numeric|min:1',
'pdf_winning_proof' => 'nullable|file|mimes:pdf',
];
$width = config('theme.models.prizes.picture_max_width');
$height = config('theme.models.prizes.picture_max_height');
return \array_merge(
$rules,
$this->pictureRules('picture', $width, $height, $width, $height),
);
}
/**
@ -56,8 +66,10 @@ class StorePrizeRequest extends FormRequest
public function attributes(): array
{
return [
'label_one' => trans('validation.custom.label_one'),
'label_many' => trans('validation.custom.label_many'),
'label' => trans('validation.custom.label'),
'picture' => trans('validation.custom.picture'),
'picture_alt' => trans('validation.custom.picture_alt'),
'picture_title' => trans('validation.custom.picture_title'),
'arg_title' => trans('validation.attributes.title'),
'arg_subtitle' => trans('validation.custom.subtitle'),
'arg_content' => trans('validation.attributes.content'),

View file

@ -49,7 +49,7 @@ class PrizeWon extends Mailable implements ShouldQueue
return $this->subject(sprintf(
'Félicitations %s, vous avez remporté 1 %s !',
$this->user->firstname,
$this->prize->label_one
$this->prize->label
))
->view('front.basic.prize-mail')
->with(['user' => $this->user, 'prize' => $this->prize, 'settings' => $this->settings]);

View file

@ -11,8 +11,10 @@ use Illuminate\Validation\ValidationException;
/**
* Prize.
*
* @property string $label_one Singular label
* @property string $label_many Plural label
* @property string $label Label
* @property string $picture Path of the picture
* @property string $picture_alt Alt text for the picture
* @property string $picture_title Title text for the picture
* @property string $arg_title Description title
* @property string $arg_subtitle Description subtitle
* @property string $arg_content Description content
@ -21,9 +23,6 @@ use Illuminate\Validation\ValidationException;
* @property-read \Illuminate\Support\Carbon $created_at Creation Date.
* @property-read \Illuminate\Support\Carbon $updated_at Last update Date.
*
* @method protected static function booted() The "booted" method of the model.
* @method private static function manageFields($model) Manage model fields.
*
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\InstantWin[] $instantWins
* Associated instantWins.
*/
@ -37,8 +36,10 @@ class Prize extends Model
* @var array
*/
protected $fillable = [
'label_one',
'label_many',
'label',
'picture',
'picture_alt',
'picture_title',
'arg_title',
'arg_subtitle',
'arg_content',
@ -64,6 +65,7 @@ class Prize extends Model
});
static::updated(function (self $model) {
self::removeCached();
FileStorageHelper::removeOldFile($model, 'picture');
FileStorageHelper::removeOldFile($model, 'pdf_winning_proof');
});
static::deleting(function (self $model) {
@ -77,6 +79,7 @@ class Prize extends Model
});
static::deleted(function (self $model) {
self::removeCached();
FileStorageHelper::removeFile($model, 'picture');
FileStorageHelper::removeFile($model, 'pdf_winning_proof');
});
}
@ -86,15 +89,16 @@ class Prize extends Model
/**
* Common methods function.
*
* @param Model $model
* @param \Illuminate\Database\Eloquent\Model $model
* @return void
*/
private static function manageFields(Model $model)
{
$model->picture = FileStorageHelper::storeFile($model, $model->picture, true);
$model->pdf_winning_proof = FileStorageHelper::storeFile($model, $model->pdf_winning_proof, true);
}
// * RELATIONS
// * RELATIONSHIPS
/**
* HasMany InstantWin relation

View file

@ -10,14 +10,13 @@ use Illuminate\Database\Eloquent\Model;
/**
* Product.
*
* @property string $name Name
* @property string $picture Path of the picture
* @property integer $code_ean Ean code
* @property-read \Illuminate\Support\Carbon $created_at Creation Date.
* @property-read \Illuminate\Support\Carbon $updated_at Last update Date.
*
* @method protected static function booted() The "booted" method of the model.
* @method private static function manageFields($model) Manage model fields.
* @property string $name Name
* @property string $picture Path of the picture
* @property string $picture_alt Alt text for the picture
* @property string $picture_title Title text for the picture
* @property integer $code_ean Ean code
* @property-read \Illuminate\Support\Carbon $created_at Creation Date.
* @property-read \Illuminate\Support\Carbon $updated_at Last update Date.
*
* @property-read \App\Models\Range[] $range Associated range.
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\Participation[] $participations
@ -71,9 +70,9 @@ class Product extends Model
// * METHODS
/**
* Undocumented function
* Common methods function.
*
* @param Model $model
* @param \Illuminate\Database\Eloquent\Model $model
* @return void
*/
private static function manageFields(Model $model)
@ -81,6 +80,8 @@ class Product extends Model
$model->picture = FileStorageHelper::storeFile($model, $model->picture, true);
}
// * RELATIONSHIPS
/**
* Range relation
*

View file

@ -14,9 +14,6 @@ use Illuminate\Database\Eloquent\Model;
* @property-read \Illuminate\Support\Carbon $created_at Creation Date.
* @property-read \Illuminate\Support\Carbon $updated_at Last update Date.
*
* @method protected static function booted() The "booted" method of the model.
* @method private static function manageFields($model) Manage model fields.
*
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\Product[] $products
* Associated products.
*/
@ -60,9 +57,9 @@ class Range extends Model
// * METHODS
/**
* Undocumented function
* Common methods function.
*
* @param Model $model
* @param \Illuminate\Database\Eloquent\Model $model
* @return void
*/
private static function manageFields(Model $model)
@ -70,6 +67,8 @@ class Range extends Model
$model->picture = FileStorageHelper::storeFile($model, $model->picture, true);
}
// * RELATIONSHIPS
/**
* Product relation
*

View file

@ -16,6 +16,7 @@
"axlon/laravel-postal-code-validation": "^3.4",
"diglactic/laravel-breadcrumbs": "^8.0",
"guzzlehttp/guzzle": "^7.2",
"kwaadpepper/image-resizer": "^2.1",
"kwaadpepper/serial-int-caster": "^1.1",
"laravel/framework": "^10.0",
"laravel/tinker": "^2.8",

278
composer.lock generated
View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "5abaeeb6a418b44840fbe2581492f5d8",
"content-hash": "6e9302579912a55a9da2af836c6d2e94",
"packages": [
{
"name": "axlon/laravel-postal-code-validation",
@ -1348,6 +1348,157 @@
],
"time": "2023-08-27T10:19:19+00:00"
},
{
"name": "intervention/image",
"version": "2.7.2",
"source": {
"type": "git",
"url": "https://github.com/Intervention/image.git",
"reference": "04be355f8d6734c826045d02a1079ad658322dad"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Intervention/image/zipball/04be355f8d6734c826045d02a1079ad658322dad",
"reference": "04be355f8d6734c826045d02a1079ad658322dad",
"shasum": ""
},
"require": {
"ext-fileinfo": "*",
"guzzlehttp/psr7": "~1.1 || ^2.0",
"php": ">=5.4.0"
},
"require-dev": {
"mockery/mockery": "~0.9.2",
"phpunit/phpunit": "^4.8 || ^5.7 || ^7.5.15"
},
"suggest": {
"ext-gd": "to use GD library based image processing.",
"ext-imagick": "to use Imagick based image processing.",
"intervention/imagecache": "Caching extension for the Intervention Image library"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.4-dev"
},
"laravel": {
"providers": [
"Intervention\\Image\\ImageServiceProvider"
],
"aliases": {
"Image": "Intervention\\Image\\Facades\\Image"
}
}
},
"autoload": {
"psr-4": {
"Intervention\\Image\\": "src/Intervention/Image"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Oliver Vogel",
"email": "oliver@intervention.io",
"homepage": "https://intervention.io/"
}
],
"description": "Image handling and manipulation library with support for Laravel integration",
"homepage": "http://image.intervention.io/",
"keywords": [
"gd",
"image",
"imagick",
"laravel",
"thumbnail",
"watermark"
],
"support": {
"issues": "https://github.com/Intervention/image/issues",
"source": "https://github.com/Intervention/image/tree/2.7.2"
},
"funding": [
{
"url": "https://paypal.me/interventionio",
"type": "custom"
},
{
"url": "https://github.com/Intervention",
"type": "github"
}
],
"time": "2022-05-21T17:30:32+00:00"
},
{
"name": "intervention/imagecache",
"version": "2.6.0",
"source": {
"type": "git",
"url": "https://github.com/Intervention/imagecache.git",
"reference": "86136575a62d3634b51f196a998fce4a583b49bb"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Intervention/imagecache/zipball/86136575a62d3634b51f196a998fce4a583b49bb",
"reference": "86136575a62d3634b51f196a998fce4a583b49bb",
"shasum": ""
},
"require": {
"illuminate/cache": "^5.5|~6|~7|~8|~9|~10",
"illuminate/filesystem": "^5.5|~6|~7|~8|~9|~10",
"intervention/image": "~2.2",
"nesbot/carbon": "^2.39",
"opis/closure": "^3.5",
"php": "~7.2|~8"
},
"require-dev": {
"phpunit/phpunit": "^8.0"
},
"type": "library",
"autoload": {
"psr-4": {
"Intervention\\Image\\": "src/Intervention/Image"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Oliver Vogel",
"email": "oliver@intervention.io",
"homepage": "http://intervention.io/"
}
],
"description": "Caching extension for the Intervention Image Class",
"homepage": "https://image.intervention.io",
"keywords": [
"cache",
"gd",
"image",
"imagick",
"laravel"
],
"support": {
"issues": "https://github.com/Intervention/imagecache/issues",
"source": "https://github.com/Intervention/imagecache/tree/2.6.0"
},
"funding": [
{
"url": "https://paypal.me/interventionio",
"type": "custom"
},
{
"url": "https://github.com/Intervention",
"type": "github"
}
],
"time": "2023-02-25T19:40:47+00:00"
},
{
"name": "jean85/pretty-package-versions",
"version": "2.0.5",
@ -1467,6 +1618,66 @@
},
"time": "2022-07-28T15:18:54+00:00"
},
{
"name": "kwaadpepper/image-resizer",
"version": "2.1.0",
"source": {
"type": "git",
"url": "https://github.com/Kwaadpepper/image-resizer.git",
"reference": "2a14ad153b34916f437af50549bad47c018902df"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Kwaadpepper/image-resizer/zipball/2a14ad153b34916f437af50549bad47c018902df",
"reference": "2a14ad153b34916f437af50549bad47c018902df",
"shasum": ""
},
"require": {
"illuminate/support": "~10",
"intervention/image": "^2.7.2",
"intervention/imagecache": "^2.6",
"laravel/framework": "~10"
},
"require-dev": {
"slevomat/coding-standard": "^8.11"
},
"type": "library",
"extra": {
"laravel": {
"providers": [
"Kwaadpepper\\ImageResizer\\ImageResizerServiceProvider"
]
}
},
"autoload": {
"psr-4": {
"Kwaadpepper\\ImageResizer\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Jérémy Munsch",
"email": "github@jeremydev.ovh",
"homepage": "https://jeremydev.ovh"
}
],
"description": "Resize images on the fly and cache them",
"homepage": "https://github.com/kwaadpepper/image-resizer",
"keywords": [
"images",
"laravel",
"resize"
],
"support": {
"issues": "https://github.com/Kwaadpepper/image-resizer/issues",
"source": "https://github.com/Kwaadpepper/image-resizer/tree/2.1.0"
},
"time": "2023-06-08T12:07:24+00:00"
},
{
"name": "kwaadpepper/serial-int-caster",
"version": "1.1.0",
@ -3133,6 +3344,71 @@
],
"time": "2023-11-13T09:31:12+00:00"
},
{
"name": "opis/closure",
"version": "3.6.3",
"source": {
"type": "git",
"url": "https://github.com/opis/closure.git",
"reference": "3d81e4309d2a927abbe66df935f4bb60082805ad"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/opis/closure/zipball/3d81e4309d2a927abbe66df935f4bb60082805ad",
"reference": "3d81e4309d2a927abbe66df935f4bb60082805ad",
"shasum": ""
},
"require": {
"php": "^5.4 || ^7.0 || ^8.0"
},
"require-dev": {
"jeremeamia/superclosure": "^2.0",
"phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.6.x-dev"
}
},
"autoload": {
"files": [
"functions.php"
],
"psr-4": {
"Opis\\Closure\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Marius Sarca",
"email": "marius.sarca@gmail.com"
},
{
"name": "Sorin Sarca",
"email": "sarca_sorin@hotmail.com"
}
],
"description": "A library that can be used to serialize closures (anonymous functions) and arbitrary objects.",
"homepage": "https://opis.io/closure",
"keywords": [
"anonymous functions",
"closure",
"function",
"serializable",
"serialization",
"serialize"
],
"support": {
"issues": "https://github.com/opis/closure/issues",
"source": "https://github.com/opis/closure/tree/3.6.3"
},
"time": "2022-01-27T09:35:39+00:00"
},
{
"name": "phpoption/phpoption",
"version": "1.9.2",

64
config/image-resizer.php Normal file
View file

@ -0,0 +1,64 @@
<?php
return [
/**
* The php image driver to use
* this can be 'imagick' or 'gd'
*/
'driver' => 'imagick',
/**
* The cache driver to use as defined
* in config/cache of your app
*/
'cache' => 'file',
/**
* The path where to store image in cache
*/
'cachePath' => 'cache/images',
/**
* Image cache life time
* This is given in minutes
* Here the cache for images is
* one hour
*/
'lifetime' => 60,
/**
* Format can specifiy to which format save the image
* JPEG PNG GIF TIF BMP ICO PSD WebP
* GD ✔️ ✔️ ✔️ - - - - ✔️ *
* Imagick ✔️ ✔️ ✔️ ✔️ ✔️ ✔️ ✔️ ✔️ *
* For WebP support GD driver must be used with PHP 5 >= 5.5.0 or PHP 7
* in order to use imagewebp(). If Imagick is used, it must be compiled
* with libwebp for WebP support.
* resize => will resize the image (boolean)
* fit => Combine cropping and resizing to format image in a smart way (boolean)
* keepRatio => will keep image ratio wile resizing (boolean)
* trim => boolean to trim the image using border color
* inCanvas => to make sure image boundarie is respected
* format => select tha wantd ouput form, yan can just convert images if you want
* example :
* 'small' => [
* 'height' => 500,
* 'width' => 250,
* 'inCanvas' => true,
* 'trim' => ['transparent', null, 10]
* ],
* 'smallWebp' => [
* 'height' => 500,
* 'width' => 250,
* 'inCanvas' => true,
* 'format' => 'webp'
* ],
* 'justconvertImage' => [
* 'format' => 'webp'
* ]
*/
'templates' => array_replace_recursive(
[],
(require(resource_path('theme/mounted/theme.config.php')))['resizes'],
)
];

View file

@ -4,6 +4,10 @@ return array_replace_recursive(
[
'name' => 'base',
'models' => [
'prizes' => [
'picture_max_width' => 560,
'picture_max_height' => 700,
],
'products' => [
'picture_max_width' => 550,
'picture_max_height' => 550,
@ -13,6 +17,38 @@ return array_replace_recursive(
'picture_max_height' => 355,
],
],
/**
* Format can specifiy to which format save the image
* JPEG PNG GIF TIF BMP ICO PSD WebP
* GD ✔️ ✔️ ✔️ - - - - ✔️ *
* Imagick ✔️ ✔️ ✔️ ✔️ ✔️ ✔️ ✔️ ✔️ *
* For WebP support GD driver must be used with PHP 5 >= 5.5.0 or PHP 7
* in order to use imagewebp(). If Imagick is used, it must be compiled
* with libwebp for WebP support.
* resize => will resize the image (boolean)
* fit => Combine cropping and resizing to format image in a smart way (boolean)
* keepRatio => will keep image ratio wile resizing (boolean)
* trim => boolean to trim the image using border color
* inCanvas => to make sure image boundarie is respected
* format => select tha wantd ouput form, yan can just convert images if you want
* example :
* 'small' => [
* 'height' => 500,
* 'width' => 250,
* 'inCanvas' => true,
* 'trim' => ['transparent', null, 10]
* ],
* 'smallWebp' => [
* 'height' => 500,
* 'width' => 250,
* 'inCanvas' => true,
* 'format' => 'webp'
* ],
* 'justconvertImage' => [
* 'format' => 'webp'
* ]
*/
'resizes' => []
],
require(resource_path('theme/mounted/theme.config.php')),
);

Binary file not shown.

After

Width:  |  Height:  |  Size: 528 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 184 KiB

View file

@ -15,8 +15,12 @@ class CreatePrizes extends Migration
{
Schema::create('prizes', function (Blueprint $table) {
$table->id();
$table->string('label_one')->comment('Libellé au singulier');
$table->string('label_many')->comment('Libellé au pluriel');
$table->string('label')->comment('Libellé');
$table->string('picture')->comment('Image du lot');
$table->string('picture_alt')->comment('Attribut alt de l\'image du lot');
$table->string('picture_title')->comment('Attribut title de l\'image du lot');
$table->string('arg_title')->comment('Tire argumentaire');
$table->string('arg_subtitle')->comment('Sous-titre argumentaire');
$table->text('arg_content')->comment('Contenu argumentaire');

View file

@ -2,6 +2,7 @@
namespace Database\Seeders\Development;
use App\Lib\Helpers\FileStorageHelper;
use App\Models\Prize;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
@ -24,21 +25,37 @@ class PrizeSeeder extends Seeder
File::deleteDirectory(\storage_path('app/public/modelfiles/prizes'));
$prize = new Prize();
$prize->label_one = 'Lot 1';
$prize->label_many = 'Lots 1';
$prize->arg_title = 'Titre Lot 1';
$prize->arg_subtitle = 'Sous-titre Lot 1';
$prize->arg_content = 'Argumentaire du lot 1';
$prize->quantity = 1;
$prize->save();
$prize->label = 'Wonderbox Sportives et aventurières';
$prize->arg_title = 'Wonderbox Sportives et aventurières';
$prize->arg_subtitle = '1 activité pour 2 à 6 personnes';
// phpcs:ignore Generic.Files.LineLength.TooLong
$prize->arg_content = '1640 activités en famille : cinéma, visite d’un zoo ou d’un château, spectacle au théâtre, cirque, balade en bateau, randonnée équestre, atelier culinaire… Les petits et les grands vont se régaler : sortie à l’aquarium de Paris pour faire connaissance avec ses 10 000 pensionnaires, atelier culinaire pour savourer une bonne dose de bonheur, découverte du bassin de la Villette en bateau électrique, rencontre avec le nouveau monde de Mini World Lyon…';
$prize->picture = FileStorageHelper::storeFile(
new Prize(),
new \SplFileInfo(
\resource_path('../database/factories/assets/prizes/lot-1.png')
)
);
$prize->picture_title = 'Wonderbox Sportives et aventurières';
$prize->picture_alt = 'Un coffret cadeau avec des personnes faisant du rift sur un bateau gonflable.';
$prize->quantity = 1;
$prize->saveOrFail();
$prize = new Prize();
$prize->label_one = 'Lot 2';
$prize->label_many = 'Lots 2';
$prize->arg_title = 'Titre Lot 2';
$prize->arg_subtitle = 'Sous-titre Lot 2';
$prize->arg_content = 'Argumentaire du lot 2';
$prize->quantity = 2;
$prize->save();
$prize->label = 'Wonderbox Happy Day';
$prize->arg_title = 'Wonderbox Happy Day';
$prize->arg_subtitle = '1 activité pour 1 à 2 personnes';
// phpcs:ignore Generic.Files.LineLength.TooLong
$prize->arg_content = 'Plus de 2500 activités : laser game, bowling, balade en canoë, cinéma, repas, dégustation de macarons… Besoin d’une super activité pour déconnecter ? Soyez prêts, vous allez adorer cette journée : parties de bowling endiablées à Châlons-en-Champagne, séance de Taï Chi ou de Wing Chung à Bordeaux ou pizza à déguster face à Notre-Dame de Paris… Voici tout ce dont vous avez besoin pour apprécier un Happy Day !';
$prize->picture = FileStorageHelper::storeFile(
new Prize(),
new \SplFileInfo(
\resource_path('../database/factories/assets/prizes/lot-2.png')
)
);
$prize->picture_title = 'Wonderbox Happy Day';
$prize->picture_alt = 'Un coffret cadeau avec une femme faisant du canöe en mer.';
$prize->quantity = 2;
$prize->saveOrFail();
}
}

View file

@ -244,8 +244,7 @@ return [
'answer' => 'réponse',
'theme' => 'thème',
'file_name' => 'nom du fichier',
'label_one' => 'libellé au singulier',
'label_many' => 'libellé au pluriel',
'label' => 'libellé',
'arg' => 'argumentaire',
'subtitle' => 'sous-titre',
'quantity' => 'quantité',

View file

@ -22,10 +22,10 @@
{{-- WON PRIZE X --}}
<a class="list-group-item list-group-item-action" href="{{ route('re7.prize', ['prize' => $prize]) }}"
title="{{ __('Afficher la page de gain du lot :name dans un nouvel onglet', [
'name' => __('Lot :name', ['name' => $prize->label_one]),
'name' => __('Lot :name', ['name' => $prize->label]),
]) }}"
target="_blank">
{{ __('Lot :name', ['name' => $prize->label_one]) }}
{{ __('Lot :name', ['name' => $prize->label]) }}
</a>
@endforeach
</div>

View file

@ -1,17 +1,17 @@
<div class="row">
{{-- LABEL_ONE --}}
{{-- LABEL --}}
<div class="col-12 col-md-6 mb-3">
<fieldset class="h-100 border p-3">
<legend>{{ Str::ucfirst(__('validation.custom.label_one')) }}</legend>
<legend>{{ Str::ucfirst(__('validation.custom.label')) }}</legend>
<div class="row">
<div class="col-12">
@include('back::partials.inputs.varchar', [
'id' => 'prizeLabelOne',
'label' => __(':field', [
'field' => Str::ucfirst(__('validation.custom.label_one')),
'field' => Str::ucfirst(__('validation.custom.label')),
]),
'hasWordCounter' => true,
'name' => 'label_one',
'name' => 'label',
'required' => true,
'model' => $prizeModel ?? null,
'helper' => __('validation.between.string', [
@ -22,7 +22,7 @@
'max' => 255,
]),
'placeholder' => __(':field du :model', [
'field' => Str::ucfirst(__('validation.custom.label_one')),
'field' => Str::ucfirst(__('validation.custom.label')),
'model' => Str::singular(__('models.classes.prize')),
]),
])
@ -30,32 +30,75 @@
</div>
</fieldset>
</div>
{{-- LABEL_MANY --}}
<div class="col-12 col-md-6 mb-3">
{{-- PICTURE --}}
<div class="col-12 pb-3">
<fieldset class="h-100 border p-3">
<legend>{{ Str::ucfirst(__('validation.custom.label_many')) }}</legend>
<div class="row">
<div class="col-12">
<legend>{{ Str::ucfirst(__('validation.attributes.image')) }}</legend>
<div class="row mb-3">
{{-- PICTURE_ALT --}}
<div class="col-12 col-md-6 m-md-0 mb-3">
@include('back::partials.inputs.varchar', [
'id' => 'prizeLabelMany',
'label' => __(':field', [
'field' => Str::ucfirst(__('validation.custom.label_many')),
'id' => 'prizePictureAlt',
'label' => __(':field1 :inter1:field2 :inter2:model', [
'field1' => Str::ucfirst(__('validation.custom.attribute_alt')),
'inter1' => __('validation.custom.of_the.vowel'),
'field2' => __('validation.attributes.image'),
'inter2' => __('validation.custom.of_the.male'),
'model' => __('models.classes.prize'),
]),
'hasWordCounter' => true,
'name' => 'label_many',
'required' => true,
'name' => 'picture_alt',
'required' => false,
'model' => $prizeModel ?? null,
'helper' => __('validation.between.string', [
'attribute' => __(':field', [
'field' => Str::ucfirst(__('validation.attributes.name')),
]),
'min' => 3,
'max' => 255,
'helper' => __('crud.minicrud.picture_alt_helper'),
'placeholder' => __(':field1 :inter1:field2 :inter2:model', [
'field1' => Str::ucfirst(__('validation.custom.attribute_alt')),
'inter1' => __('validation.custom.of_the.vowel'),
'field2' => __('validation.attributes.image'),
'inter2' => __('validation.custom.of_the.male'),
'model' => __('models.classes.prize'),
]),
'placeholder' => __(':field du :model', [
'field' => Str::ucfirst(__('validation.custom.label_many')),
'model' => Str::singular(__('models.classes.prize')),
])
</div>
{{-- PICTURE_TITLE --}}
<div class="col-12 col-md-6 mb-3">
@include('back::.partials.inputs.varchar', [
'id' => 'productPictureTitle',
'label' => __(':field1 :inter1:field2 :inter2:model', [
'field1' => Str::ucfirst(__('validation.custom.attribute_title')),
'inter1' => __('validation.custom.of_the.vowel'),
'field2' => __('validation.attributes.image'),
'inter2' => __('validation.custom.of_the.male'),
'model' => __('models.classes.prize'),
]),
'hasWordCounter' => true,
'name' => 'picture_title',
'required' => false,
'model' => $prizeModel ?? null,
'helper' => __('crud.minicrud.picture_title_helper'),
'placeholder' => __(':field1 :inter1:field2 :inter2:model', [
'field1' => Str::ucfirst(__('validation.custom.attribute_title')),
'inter1' => __('validation.custom.of_the.vowel'),
'field2' => __('validation.attributes.image'),
'inter2' => __('validation.custom.of_the.male'),
'model' => __('models.classes.prize'),
]),
])
</div>
{{-- PICTURE --}}
<div class="col-12">
@include('back::partials.inputs.varchar-picture', [
'id' => 'prizePicture',
'name' => 'picture',
'width' => config('theme.models.prizes.picture_max_width'),
'height' => config('theme.models.prizes.picture_max_height'),
'model' => $prizeModel ?? null,
'helper' => __('crud.minicrud.dimensions_must_be', [
'widthpx' => config('theme.models.prizes.picture_max_width') . 'px',
'heightpx' => config('theme.models.prizes.picture_max_height') . 'px',
]),
'required' => false,
'preview' => true,
])
</div>
</div>
@ -114,7 +157,7 @@
]),
])
</div>
{{-- VALUE --}}
{{-- ARG CONTENT --}}
<div class="col-12 mb-3">
@include('back::partials.inputs.text-html', [
'id' => 'contentValue',

View file

@ -19,7 +19,7 @@
<thead>
@include('back::modules.table-col-sorter', [
'cols' => [
'label_one' => Str::ucfirst(__('validation.custom.label_one')),
'label' => Str::ucfirst(__('validation.custom.label')),
'quantity' => Str::ucfirst(__('validation.custom.quantity')),
],
])
@ -27,7 +27,7 @@
<tbody>
@foreach ($prizeModels as $prizeModel)
<tr class="border-bottom list-item">
<td class="text-center align-middle">{{ $prizeModel->label_one }}</td>
<td class="text-center align-middle">{{ $prizeModel->label }}</td>
<td class="text-center align-middle">{{ $prizeModel->quantity }}</td>
<td class="text-end align-middle">
<form class="btn-group confirmDeleteTS" action="{{ route('bo.prizes.destroy', $prizeModel) }}" method="POST"

View file

@ -37,7 +37,7 @@
<tr class="border-bottom list-item">
<td class="text-center align-middle">{{ \Carbon\Carbon::parse($participationModel->created_at)->format('d/m/Y à H:i') }}
</td>
<td class="text-center align-middle">{{ $participationModel->instantWin()->first()->prize->label_one }}</td>
<td class="text-center align-middle">{{ $participationModel->instantWin()->first()->prize->label }}</td>
<td class="text-center align-middle">{{ $participationModel->customer->email }}</td>
@if ($settings->use_ean_codes)
<td class="text-center align-middle">{{ $participationModel->codeEan }}</td>