Some fixes, docblocks, style, cleaning ... Added a footer

This commit is contained in:
Noah Lancien 2023-08-24 13:00:43 +02:00
parent ec7f20cf4d
commit 4113e2254a
68 changed files with 382 additions and 1758 deletions

View file

@ -4,7 +4,6 @@ namespace App\Console\Commands;
use App\Mail\ExportCodesUniques as MailExportCodesUniques;
use App\Models\Code;
use App\Models\Settings;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Mail;
@ -109,7 +108,7 @@ class ExportCodesUniques extends Command
// Envoi de mail à MAIL_ADMIN avec le nom du ZIP "CodesUniques_". date('dmY') .".zip" .
Mail::to(config('mail.MAIL_ADMIN'))
->send(new MailExportCodesUniques(app(Settings::class)->name, $nbCodeFic, $nbCodeTot, $nbCodeLigne));
->send(new MailExportCodesUniques($nbCodeFic, $nbCodeTot, $nbCodeLigne));
return 0;
}

View file

@ -200,16 +200,16 @@ class UserCreate extends Command
try {
$tmp = $this->choice(
'Select his role',
[RoleEnum::conceptor()->label, RoleEnum::admin()->label],
RoleEnum::admin()->label,
[RoleEnum::conceptor->label(), RoleEnum::admin->label()],
RoleEnum::admin->label(),
$maxAttempts = null,
$allowMultipleSelections = false
);
if ($tmp === RoleEnum::conceptor()->label) {
$tmp = RoleEnum::conceptor();
if ($tmp === RoleEnum::conceptor->label()) {
$tmp = RoleEnum::conceptor;
}
if ($tmp === RoleEnum::admin()->label) {
$tmp = RoleEnum::admin();
if ($tmp === RoleEnum::admin->label()) {
$tmp = RoleEnum::admin;
}
$validator = Validator::make(['role' => $tmp], [
'role' => 'required'

View file

@ -17,9 +17,9 @@ class CodesController extends Controller
/**
* Show code form to generate and export
*
* @return \Illuminate\View\View|\Illuminate\Contracts\View\Factory
* @return \Illuminate\Contracts\View\View
*/
public function index()
public function index(): \Illuminate\Contracts\View\View
{
$settings = Settings::first();
$nbCodeBase = Code::count();
@ -41,7 +41,7 @@ class CodesController extends Controller
* @param GenerateCodesRequest $request
* @return \Illuminate\Http\RedirectResponse
*/
public function generate(GenerateCodesRequest $request)
public function generate(GenerateCodesRequest $request): \Illuminate\Http\RedirectResponse
{
ProcessUniqueCode::dispatch(
$request->quantity,
@ -61,7 +61,7 @@ class CodesController extends Controller
* @param ExportCodesRequest $request
* @return \Illuminate\Http\RedirectResponse
*/
public function export(ExportCodesRequest $request)
public function export(ExportCodesRequest $request): \Illuminate\Http\RedirectResponse
{
ProcessExportCodesUniques::dispatch(
intval($request->nb_code_fic),
@ -80,9 +80,9 @@ class CodesController extends Controller
* Search for a specific code.
*
* @param CodeSearchRequest $request
* @return \Illuminate\View\View|\Illuminate\Contracts\View\Factory
* @return \Illuminate\Contracts\View\View
*/
public function search(CodeSearchRequest $request)
public function search(CodeSearchRequest $request): \Illuminate\Contracts\View\View
{
$code = null;
try {

View file

@ -1,159 +0,0 @@
<?php
namespace App\Http\Controllers\Bo;
use App\Http\Controllers\Controller;
use App\Http\Requests\Bo\CodesEan\StoreCodeEanRequest;
use App\Http\Requests\Bo\CodesEan\UpdateCodeEanRequest;
use App\Models\CodeEan;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Str;
class CodesEANController extends Controller
{
/**
* Display a listing of the resource.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Contracts\View\View
*/
public function index(Request $request): \Illuminate\Contracts\View\View
{
/** @var \Illuminate\Database\Eloquent\Builder $codeEanModels */
$codeEanModels = CodeEan::query();
/** @var string $search Search field */
$search = $request->search;
if ($search) {
$this->searchQuery(
$codeEanModels,
$search,
null,
'code',
'product'
);
}
$searchFields = \sprintf(
'%s, %s',
Str::ucfirst(__('validation.attributes.code')),
Str::ucfirst(__('validation.attributes.product'))
);
/** Sort columns with a query */
$this->sortQuery($codeEanModels);
/** Custom pagination */
$codeEanModels = $this->customPaginate($codeEanModels, $request->pagination);
return view('bo.pages.codes-ean.index', compact('codeEanModels', 'search', 'searchFields'));
}
/**
* Show the form for creating a new resource.
*
* @param \App\Models\CodeEan $codeEan
* @return \Illuminate\Contracts\View\View
*/
public function create(CodeEan $codeEan): \Illuminate\Contracts\View\View
{
return view('bo.pages.codes-ean.create', [
'codeEanModel' => $codeEan,
]);
}
/**
* Store a newly created resource in storage.
*
* @param \App\Http\Requests\Bo\CodesEan\StoreCodeEanRequest $request
* @return \Illuminate\Http\RedirectResponse
*/
public function store(StoreCodeEanRequest $request): \Illuminate\Http\RedirectResponse
{
return DB::transaction(function () use ($request) {
$codeEan = new CodeEan();
$codeEan->fill($request->validated());
if ($codeEan->saveOrFail()) {
return redirect()
->route('bo.code-eans.edit', $codeEan)
->with('success', trans(
'crud.messages.has_been_created',
['model' => \trans_choice('models.classes.codes-ean', 1)]
));
}
return redirect()
->back()
->with('error', trans(
'crud.messages.cannot_be_created',
['model' => \trans_choice('models.classes.codes-ean', 1)]
));
});
}
/**
* Show the form for editing the specified resource.
*
* @param \App\Models\CodeEan $codeEan
* @return \Illuminate\Contracts\View\View
*/
public function edit(CodeEan $codeEan): \Illuminate\Contracts\View\View
{
return view('bo.pages.codes-ean.edit', [
'codeEanModel' => $codeEan,
]);
}
/**
* Update the specified resource in storage.
*
* @param \App\Http\Requests\Bo\CodesEan\UpdateCodeEanRequest $request
* @param \App\Models\CodeEan $codeEan
* @return \Illuminate\Http\RedirectResponse
*/
public function update(UpdateCodeEanRequest $request, CodeEan $codeEan): \Illuminate\Http\RedirectResponse
{
return DB::transaction(function () use ($request, $codeEan) {
$codeEan->fill($request->validated());
if ($codeEan->saveOrFail()) {
return redirect()
->route('bo.code-eans.edit', $codeEan)
->with('success', trans(
'crud.messages.has_been_updated',
['model' => trans_choice('models.classes.codes-ean', 1)]
));
}
return redirect()
->back()
->with('error', trans(
'crud.messages.cannot_be_updated',
['model' => trans_choice('models.classes.codes-ean', 1)]
));
});
}
/**
* Remove the specified resource from storage.
*
* @param \App\Models\CodeEan $codeEan
* @return \Illuminate\Http\RedirectResponse
*/
public function destroy(CodeEan $codeEan): \Illuminate\Http\RedirectResponse
{
return DB::transaction(function () use ($codeEan) {
if ($codeEan->deleteOrFail()) {
return redirect()
->route('bo.code-eans.index')
->with('success', __(
'crud.messages.has_been_deleted',
['model' => trans_choice('models.classes.codes-ean', 1)]
));
}
return redirect()
->back()
->with('error', __(
':crud.messages.cannot_be_deleted',
['model' => trans_choice('models.classes.codes-ean', 1)]
));
});
}
}

View file

@ -29,10 +29,15 @@ class ContentController extends Controller
$contentModels,
$search,
null,
'ip',
'key',
'value'
);
}
$searchFields = trans('validation.attributes.ip');
$searchFields = \sprintf(
'%s, %s',
trans('validation.attributes.name'),
trans('validation.attributes.value'),
);
/** Sort columns with a query */
$this->sortQuery($contentModels);

View file

@ -15,20 +15,20 @@ class DashboardController extends Controller
*
* @return \Illuminate\Contracts\View\View
*/
public function index()
public function index(): \Illuminate\Contracts\View\View
{
// Pour les stats.
$settings = app(Settings::class);
$participations = Participation::selectRaw("COUNT(*) AS count, DATE(created_at) AS date")
->groupByRaw("DATE(created_at)")->get();
$participationsUniquePerDay = Participation::selectRaw("DISTINCT user_id AS user, COUNT(*) AS count, DATE(created_at) AS date")
$participationsUniquePerDay = Participation::selectRaw("DISTINCT customer_id AS user, COUNT(*) AS count, DATE(created_at) AS date")
->groupByRaw("DATE(created_at), user")->get();
$statsUnique = [];
foreach ($participationsUniquePerDay as $participationPerDay) {
$dateUnique = $participationPerDay->date->format('d/m/Y');
$dateUnique = Carbon::parse($participationPerDay->date)->format('d/m/Y');
$statsUnique[$dateUnique] = isset($statsUnique[$dateUnique]) ? $statsUnique[$dateUnique] + 1 : 1;
}
$participationsUnique = Participation::selectRaw("DISTINCT user_id AS user, COUNT(*) AS count")
$participationsUnique = Participation::selectRaw("DISTINCT customer_id AS user, COUNT(*) AS count")
->groupBy("user")->orderBy("user")->get();
// Données calculées à afficher.
@ -41,7 +41,7 @@ class DashboardController extends Controller
// Tableau des dates comprises dans la table participation.
foreach ($participations as $participation) {
$datesParticipations[$participation->date->format('d/m/Y')] = $participation->count;
$datesParticipations[Carbon::parse($participation->date)->format('d/m/Y')] = $participation->count;
}
// Création des tableaux avec toutes les dates depuis le début du jeu et le nombre de participations associées.
@ -50,8 +50,8 @@ class DashboardController extends Controller
// Récupération des 3 codes EAN les plus utilisés.
$codesEan = Participation::select(
DB::raw('COUNT(code_ean_id) AS nb_usage, code_ean_id')
)->groupBy('code_ean_id')->orderByDesc('nb_usage')->limit(3)->get();
DB::raw('COUNT(product_id) AS nb_usage, product_id')
)->groupBy('product_id')->orderByDesc('nb_usage')->limit(3)->get();
// TODO : Carbon Interval.
@ -67,7 +67,7 @@ class DashboardController extends Controller
$date->addDay();
}
return view('bo.dashboard.index', compact(
return view('bo.pages.dashboard.index', compact(
'dates',
'count',
'countUnique',

View file

@ -30,15 +30,10 @@ class FaqThemesController extends Controller
$faqThemeModels,
$search,
null,
'question',
'answer'
'name',
);
}
$searchFields = \sprintf(
'%s, %s ...',
Str::ucfirst(__('validation.attributes.question')),
__('validation.attributes.answer'),
);
$searchFields = Str::ucfirst(__('validation.attributes.name'));
/** Sort columns with a query */
$this->sortQuery($faqThemeModels);

View file

@ -32,7 +32,7 @@ class InstantWinController extends Controller
$instantWin = InstantWin::orderBy('appear_date')->get();
return view('bo.instant-win.index', [
return view('bo.pages.instant-win.index', [
'can_generate' => $canGenerate,
'instant_win' => $instantWin
]);

View file

@ -178,7 +178,7 @@ class EnterCodeController extends Controller
Mail::to($mail->email)->send(new NotifWinAdmin($settings, $participation));
}
$participation->save();
return view("front.basic." . $instantWin->prize->gain_view->file_name, compact('settings'))
return view("front.basic." . $instantWin->prize->gainView->file_name, compact('settings'))
->with('prize', $instantWin->prize);
}

View file

@ -1,49 +0,0 @@
<?php
namespace App\Http\Requests\Bo\CodesEan;
use Illuminate\Foundation\Http\FormRequest;
class StoreCodeEanRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return boolean
*/
public function authorize()
{
return auth()->check();
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'code' => [
'required',
'numeric',
'unique:code_eans,code',
'regex:/^[0-9]{7}$|^[0-9]{8}$|^[0-9]{13}$/',
],
'product' => 'required|string|min:3|max:255',
];
}
/**
* Get custom attributes for validator errors.
*
* @return array
*/
public function attributes(): array
{
return [
'code' => trans('Code EAN'),
'product' => trans('Produit'),
];
}
}

View file

@ -1,23 +0,0 @@
<?php
namespace App\Http\Requests\Bo\CodesEan;
class UpdateCodeEanRequest extends StoreCodeEanRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return \array_merge(parent::rules(), [
'code' => [
'required',
'numeric',
'unique:code_eans,code,' . $this->route('code_ean')->id . ',id',
'regex:/^[0-9]{7}$|^[0-9]{8}$|^[0-9]{13}$/',
],
]);
}
}

View file

@ -5,6 +5,7 @@ namespace App\Http\Requests;
use App\Models\Code;
use App\Models\CodeEan;
use App\Models\Participation;
use App\Models\Product;
use App\Models\Settings;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Validator;
@ -50,10 +51,10 @@ class ParticipateRequest extends FormRequest
], $this->attributes());
// * Union pour faire des recherches séparée en une seule requête.
/** @var \App\Models\CodeEan|null */
$codeEan = CodeEan::where('code', $this->code_ean)
->union(CodeEan::where('code', Str::limit($this->code_ean, 8, '')))
->union(CodeEan::where('code', Str::limit($this->code_ean, 7, '')))
/** @var \App\Models\Product|null */
$codeEan = Product::where('code_ean', $this->code_ean)
->union(Product::where('code_ean', Str::limit($this->code_ean, 8, '')))
->union(Product::where('code_ean', Str::limit($this->code_ean, 7, '')))
->first() ?? false;
$this->merge(['code_ean' => $codeEan]);
@ -135,7 +136,7 @@ class ParticipateRequest extends FormRequest
'required',
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClassBeforeLastUsed
function ($attribute, $value, $fail) {
if (!\is_object($value) or \get_class($value) !== CodeEan::class) {
if (!\is_object($value) or \get_class($value) !== Product::class) {
$fail('Le code barre entré est incorrect, veuillez réessayer.');
}
}

View file

@ -4,6 +4,11 @@ namespace App\Models;
use Illuminate\Database\Eloquent\Model;
/**
* BannedIp.
*
* @property integer $ip IP.
*/
class BannedIp extends Model
{
/**

View file

@ -5,6 +5,21 @@ namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Kwaadpepper\Serial\SerialCaster;
/**
* Code.
*
* @property boolean $code_used Is the code used ?
* @property boolean $code_exported Is the code exported ?
* @property \Illuminate\Support\Carbon $date_creation Date of creation.
*
* @property-read string|null $code_unique The unique code
*
* @method public static function intToSerial($int) Generate a serial from an int.
* @method public static function serialToInt($serial) Get an int from a serial.
*
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\Participation[] $participations
* Associated participations.
*/
class Code extends Model
{
/**
@ -13,7 +28,8 @@ class Code extends Model
* @var array
*/
protected $fillable = [
'code_used', 'code_exported',
'code_used',
'code_exported',
'date_creation'
];
@ -68,7 +84,7 @@ class Code extends Model
}
/**
* Generate a serial from an int.
* Get an int from a serial.
*
* @param string $serial
* @return integer The ID represented

View file

@ -1,31 +0,0 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class CodeEan extends Model
{
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = ['code', 'product'];
/**
* Indicates if the model should be timestamped.
*
* @var boolean
*/
public $timestamps = false;
/**
* Participations relation
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function participations()
{
return $this->hasMany(Participation::class);
}
}

View file

@ -4,6 +4,14 @@ namespace App\Models;
use Illuminate\Database\Eloquent\Model;
/**
* Content.
*
* @property-read string $key Content key.
* @property string $value Content text
* @property-read \Illuminate\Support\Carbon $created_at Created date.
* @property-read \Illuminate\Support\Carbon $updated_at Updated date.
*/
class Content extends Model
{
/**

View file

@ -6,6 +6,33 @@ use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Illuminate\Support\Facades\Hash;
/**
* Customer.
*
* @property integer $crm_id CRM ID
* @property string $firstname Firstname
* @property string $lastname Lastname
* @property \Illuminate\Support\Carbon $birth_date Birth date.
* @property string $email Email
* @property string $password Password
* @property string $address Address
* @property string $address2 Second address
* @property string $town Town
* @property string $postal_code Postal code
* @property string $country Country
* @property string $phone Phone number
* @property-read string $email_verify_token Token for email verification
* @property-read boolean $email_verified Is the email verified ?
* @property-read string $password_token Password token
* @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 updatePassword($model) Update the password if needed.
*
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\Participation[] $participations
* Associated participations.
*/
class Customer extends Authenticatable
{
use Notifiable;

View file

@ -4,6 +4,16 @@ namespace App\Models;
use Illuminate\Database\Eloquent\Model;
/**
* FaqQuestion.
*
* @property string $question Question
* @property string $answer Answer
* @property-read \Illuminate\Support\Carbon $created_at Creation Date.
* @property-read \Illuminate\Support\Carbon $updated_at Last update Date.
*
* @property-read \App\Models\FaqTheme $theme Associated theme.
*/
class FaqQuestion extends Model
{
/**

View file

@ -4,6 +4,17 @@ namespace App\Models;
use Illuminate\Database\Eloquent\Model;
/**
* FaqTheme.
*
* @property string $question Question
* @property string $answer Answer
* @property-read \Illuminate\Support\Carbon $created_at Creation Date.
* @property-read \Illuminate\Support\Carbon $updated_at Last update Date.
*
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\FaqQuestion[] $questions
* Associated questions.
*/
class FaqTheme extends Model
{
/**

View file

@ -4,6 +4,17 @@ namespace App\Models;
use Illuminate\Database\Eloquent\Model;
/**
* GainView.
*
* @property string $name Name
* @property string $file_name Name of the view file.
* @property-read \Illuminate\Support\Carbon $created_at Creation Date.
* @property-read \Illuminate\Support\Carbon $updated_at Last update Date.
*
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\Prizes[] $prizes
* Associated prizes.
*/
class GainView extends Model
{
/**
@ -11,10 +22,14 @@ class GainView extends Model
*
* @var array
*/
protected $fillable = ['name', 'file_name'];
protected $fillable = [
'name',
'file_name'
];
/**
* Prize relation
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function prizes()

View file

@ -4,6 +4,15 @@ namespace App\Models;
use Illuminate\Database\Eloquent\Model;
/**
* InstantWin.
*
* @property-read \Illuminate\Support\Carbon $appear_date Appear date
* @property-read boolean $won Is the prize won ?
*
* @property-read \App\Models\Prizes $prize Associated prize.
* @property-read \App\Models\Participation $participation Associated participation.
*/
class InstantWin extends Model
{
/**

View file

@ -2,8 +2,27 @@
namespace App\Models;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Model;
/**
* Participation.
*
* @property string $ip IP
* @property string $sticker Path of the sticker file
* @property string $ticket Path of the ticket file
* @property string $barcode Path of the barcode file
* @property-read \Illuminate\Support\Carbon $created_at Creation Date.
* @property-read \Illuminate\Support\Carbon $updated_at Last update Date.
*
* @property-read string|null $code_ean Accessor for code_ean, from product table.
*
* @property-read \App\Models\Customer $customer Associated customer.
* @property-read \App\Models\Code $code Associated code.
* @property-read \App\Models\Product $product Associated product.
* @property-read \App\Models\InstantWin $instantWin Associated instantWin.
* @property-read \App\Models\Reduction $reduction Associated reduction.
*/
class Participation extends Model
{
/**
@ -11,7 +30,7 @@ class Participation extends Model
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function user()
public function customer()
{
return $this->belongsTo(Customer::class);
}
@ -27,13 +46,13 @@ class Participation extends Model
}
/**
* BelongsTo CodesEAN relation
* BelongsTo Product relation
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function codeEan()
public function product()
{
return $this->belongsTo(CodeEan::class);
return $this->belongsTo(Product::class);
}
/**
@ -57,12 +76,14 @@ class Participation extends Model
}
/**
* ean_code_value accessor
* Accessor for code_ean, from product table.
*
* @return integer|null
* @return \Illuminate\Database\Eloquent\Casts\Attribute;
*/
public function getCodeEanValueAttribute()
public function codeEan(): Attribute
{
return optional($this->codeEan)->code;
return Attribute::make(
get: fn () => optional($this->product)->code_ean,
);
}
}

View file

@ -5,6 +5,27 @@ namespace App\Models;
use App\Lib\Helpers\FileStorageHelper;
use Illuminate\Database\Eloquent\Model;
/**
* Prize.
*
* @property string $label_one Singular label
* @property string $label_many Plural label
* @property string $arg_title Description title
* @property string $arg_subtitle Description subtitle
* @property string $arg_content Description content
* @property integer $quantity Quantity
* @property string $pdf_winning_proof Path of the winning proof file
* @property boolean $need_proof Does the prize need a winning proof ?
* @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 \App\Models\GainView[] $gainView Associated gainViews.
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\InstantWin[] $instantWins
* Associated instantWins.
*/
class Prize extends Model
{
/**
@ -58,12 +79,22 @@ class Prize extends Model
$model->pdf_winning_proof = FileStorageHelper::storeFile($model, $model->pdf_winning_proof, true);
}
public function gain_view()
/**
* BelongsTo GainView relation
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function gainView()
{
return $this->belongsTo(GainView::class, 'gain_view_id');
}
public function instant_wins()
/**
* HasMany InstantWin relation
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function instantWins()
{
return $this->hasMany(InstantWin::class, 'prize_id');
}

View file

@ -5,6 +5,23 @@ namespace App\Models;
use App\Lib\Helpers\FileStorageHelper;
use Illuminate\Database\Eloquent\Model;
/**
* Product.
*
* @property string $name Name
* @property integer $no_art Number of this article
* @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-read \App\Models\Range[] $range Associated range.
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\Participation[] $participations
* Associated participations.
*/
class Product extends Model
{
/**
@ -65,4 +82,14 @@ class Product extends Model
{
return $this->belongsTo(Range::class);
}
/**
* Participations relation
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function participations()
{
return $this->hasMany(Participation::class);
}
}

View file

@ -5,6 +5,20 @@ namespace App\Models;
use App\Lib\Helpers\FileStorageHelper;
use Illuminate\Database\Eloquent\Model;
/**
* Range.
*
* @property string $name Name
* @property string $picture Path of the picture
* @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.
*/
class Range extends Model
{
/**

View file

@ -4,6 +4,17 @@ namespace App\Models;
use Illuminate\Database\Eloquent\Model;
/**
* Reduction.
*
* @property string $link Link
* @property string $basket_id Basket id
* @property string $verification Verification
* @property-read \Illuminate\Support\Carbon $created_at Creation Date.
* @property-read \Illuminate\Support\Carbon $updated_at Last update Date.
*
* @property-read \App\Models\Participation $participation Associated participation.
*/
class Reduction extends Model
{
/**

View file

@ -4,6 +4,33 @@ namespace App\Models;
use Illuminate\Database\Eloquent\Model;
/**
* Settings.
*
* @property integer $name Name
* @property \Illuminate\Support\Carbon $start_date Start date of the game
* @property \Illuminate\Support\Carbon $end_date End date of the game
* @property int $nb_participation_player Max paticipation per player
* @property int $nb_participation_ip Max paticipation per ip
* @property int $nb_unique_code_use Max unique code use
* @property-read int $code_length Code length
* @property boolean $use_ean_codes Should the game use ean codes ?
* @property boolean $activated_teaser Is the teaser active ?
* @property \Illuminate\Support\Carbon $teaser_end_activity End date of the teaser
* @property boolean $activated_close_page Is the close page active ?
* @property \Illuminate\Support\Carbon $close_page_active_date End date of the close page
* @property string $redirect_close Link to redirect when the game is ended
* @property boolean $reductions_activated Are the reductions active ?
* @property string $reductions_site Reduction site
* @property string $reductions_campaign Reduction campaign
* @property string $web_coupons Array of web coupons
* @property string $notification_emails Array of email to notify when there's a winnner
* @property boolean $winning_proof Is the winning proof needed
* @property string $company Name of the company
* @property string $analytics Matomo siteId
* @property-read \Illuminate\Support\Carbon $created_at Creation Date.
* @property-read \Illuminate\Support\Carbon $updated_at Last update Date.
*/
class Settings extends Model
{
/**

View file

@ -8,6 +8,22 @@ use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Illuminate\Support\Facades\Hash;
/**
* User.
*
* @property string $firstname Firstname
* @property string $lastname Lastname
* @property string $email Email
* @property-read \Illuminate\Support\Carbon $email_verified_at Date of email verification.
* @property string $password Password
* @property-read string $remember_token Remember token
* @property \App\Enums\Users\RoleEnum $role Role of the user
* @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 updatePassword($model) Update the password if needed.
*/
class User extends Authenticatable
{
use HasFactory;
@ -24,9 +40,6 @@ class User extends Authenticatable
'email',
'password',
'role',
'published',
'published_at',
'order',
];
/**
@ -68,17 +81,6 @@ class User extends Authenticatable
// * METHODS
/**
* Set order after the last element of the list.
*
* @param self $model
* @return void
*/
private static function setOrder(self $model): void
{
$model->order = \intval(self::query()->max('order')) + 1;
}
/**
* Update password.
*

View file

@ -1,5 +0,0 @@
<?php
return [
'analyticsKey' => env('ANALYTICS_GOOGLE_ID')
];

View file

@ -22,9 +22,6 @@ return new class extends Migration
$table->string('password')->comment('Password of the user account.');
$table->rememberToken();
$table->boolean('role')->comment('Role of the user who defines the rights/access.');
$table->boolean('published')->comment('The user is published or not.');
$table->timestamp('published_at')->nullable()->comment('The date on which the user was published.');
$table->integer('order')->comment('Order of this user.');
$table->timestamps();
});
}

View file

@ -1,33 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateCodeEans extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('code_eans', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('code');
$table->string('product');
$table->unique('code');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('code_eans');
}
}

View file

@ -21,7 +21,7 @@ class CreateParticipations extends Migration
$table->string('barcode')->nullable();
$table->foreignId('customer_id')->constrained('customers');
$table->foreignId('code_unique_id')->constrained('codes');
$table->foreignId('code_ean_id')->nullable()->constrained('code_eans');
$table->foreignId('product_id')->nullable()->constrained('products');
$table->foreignId('reduction_id')->nullable()->constrained('reductions');
$table->timestamps();
});

View file

@ -27,7 +27,6 @@ class SettingsSeeder extends Seeder
$settings->activated_close_page = false;
$settings->redirect_close = "https://example.test";
$settings->reductions_activated = false;
$settings->facebook_activated = false;
$settings->notification_emails = "[]";
$settings->winning_proof = 0;
$settings->company = "Société";

View file

@ -3,7 +3,6 @@
return [
'classes' => [
'bannedips' => 'IP bannies',
'codes-ean' => 'Code EAN|Codes EAN',
'contents' => 'Contenus',
'faq-questions' => 'Question pour la FAQ|Questions pour la FAQ',
'faq-themes' => 'Thème pour la FAQ|Thèmes pour la FAQ',

View file

@ -113,3 +113,7 @@
font-size: large;
text-align: center;
}
.btn-md {
height: 38px;
}

View file

@ -5,7 +5,7 @@
@include('bo.layouts.head')
</head>
<body>
<body class="position-relative min-vh-100">
<nav class="navbar navbar-expand-md bg-light text-bg-light shadow-sm">
<div class="container">
<a class="navbar-brand rounded px-2 py-1" href="{{ url('/') }}">
@ -55,7 +55,7 @@
</div>
</div>
</nav>
<main class="container-fluid pt-2 @yield('bg-color')">
<main class="container-fluid pt-2 pb-5 @yield('bg-color')">
<div class="row justify-content-center">
<div class="col col-md-6">
@include('modules.flash-messages')
@ -67,6 +67,7 @@
</div>
</div>
</main>
@include('bo.layouts.footer')
@stack('scripts-constants')
@include('modules.script-constants')
@vite(['resources/ts/bo.ts'])

View file

@ -0,0 +1,8 @@
<footer id="footer" class="position-absolute bottom-0 w-100 text-center">
<div class="text-center p-2 bg-light">
<span class="text-reset">{{ $name }}&nbsp;-&nbsp;{{ $version }}</span>
-
<span class="text-reset fw-bold">UWIL</span>
© {{ date('Y') }}
</div>
</footer>

View file

@ -17,6 +17,26 @@
{{ __('models.classes.settings') }}
</a>
</li>
<li class="nav-item dropdown">
<a id="navbarDropdownGame" class="nav-link dropdown-toggle" href="#" role="button"
data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
{{ __('Gestion du jeu') }} <span class="caret"></span>
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdownGame">
<li>
<a class="dropdown-item" href="{{ route('bo.instant-win') }}">{{ __('Instant gagnants') }}</a>
</li>
<li>
<a class="dropdown-item" href="{{ route('bo.winners-list') }}">{{ __('Liste des gagnants') }}</a>
</li>
<li>
<a class="dropdown-item" href="{{ route('bo.bannedips.index') }}">{{ __('IP Bannies') }}</a>
</li>
<li>
<a class="dropdown-item" href="{{ route('bo.codes') }}">{{ __('Codes uniques') }}</a>
</li>
</ul>
</li>
<li class="nav-item dropdown">
<a id="navbarDropdownPrizes" class="nav-link dropdown-toggle" href="#" role="button"
data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
@ -31,48 +51,22 @@
</li>
</ul>
</li>
<li class="nav-item">
<a class="nav-link @if(request()->routeIs('bo.instant-win')) active @endif"
href="{{ route('bo.instant-win') }}"
title="{{ __('Instant gagnants') }}"
data-bs-toggle="tooltip">
{{ __('Instant gagnants') }}
</a>
</li>
@endsuperadmin
<li class="nav-item">
<a class="nav-link @if(request()->routeIs('bo.ranges.*')) active @endif"
href="{{ route('bo.ranges.index') }}"
title="{{ __('Gammes') }}"
data-bs-toggle="tooltip">
{{ __('Gammes') }}
</a>
</li>
<li class="nav-item">
<a class="nav-link @if(request()->routeIs('bo.products.*')) active @endif"
href="{{ route('bo.products.index') }}"
title="{{ __('Produits porteurs') }}"
data-bs-toggle="tooltip">
{{ __('Produits porteurs') }}
<li class="nav-item dropdown">
<a id="navbarDropdownProducts" class="nav-link dropdown-toggle" href="#" role="button"
data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
{{ __('Produits') }} <span class="caret"></span>
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdownProducts">
<li>
<a class="dropdown-item" href="{{ route('bo.ranges.index') }}">{{ __('Gammes') }}</a>
</li>
<li>
<a class="dropdown-item" href="{{route('bo.products.index')}}">{{ __('Produits porteurs') }}</a>
</li>
</ul>
</li>
@superadmin
<li class="nav-item">
<a class="nav-link @if(request()->routeIs('bo.winners-list')) active @endif"
href="{{ route('bo.winners-list') }}"
title="{{ __('Liste des gagnants') }}"
data-bs-toggle="tooltip">
{{ __('Liste des gagnants') }}
</a>
</li>
<li class="nav-item">
<a class="nav-link @if(request()->routeIs('bo.bannedips.*')) active @endif"
href="{{ route('bo.bannedips.index') }}"
title="{{ __('IP Bannies') }}"
data-bs-toggle="tooltip">
{{ __('IP Bannies') }}
</a>
</li>
<li class="nav-item dropdown">
<a id="navbarDropdownContents" class="nav-link dropdown-toggle" href="#" role="button"
data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
@ -104,14 +98,6 @@
</li>
</ul>
</li>
<li class="nav-item">
<a class="nav-link @if(request()->routeIs('bo.codes')) active @endif"
href="{{ route('bo.codes') }}"
title="{{ __('Codes uniques') }}"
data-bs-toggle="tooltip">
{{ __('Codes uniques') }}
</a>
</li>
@endsuperadmin
</ul>
@endauth

View file

@ -8,7 +8,7 @@
$iArgs['search'] = request()->sort_way;
}
@endphp
<div class="row mb-3">
<div class="row my-3">
<div class="col-12">
<form id="searchForm" action="/{{ request()->path() }}">
<div class="input-group">

View file

@ -1,46 +0,0 @@
@extends('bo.layout', ['brParam' => $codeEanModel])
@section('title', __('Création d\'une :model', ['model' => trans_choice('models.classes.codes-ean', 1)]))
@section('description', __('Création d\'un tout nouveau :model', ['model' => trans_choice('models.classes.codes-ean', 1)]))
@section('breadcrumb', request()->route()->getName())
@section('content')
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pb-3">
<div class="d-flex flex-row align-items-center">
<a href="{{ route('bo.code-eans.index') }}"
class="btn btn-primary text-decoration-none m-0 me-2"
data-bs-toggle="tooltip"
data-bs-placement="top"
title="{{ __('crud.helpers.list_all', ['model' => trans_choice('models.classes.codes-ean', 2)]) }}">
<i class="fa-solid fa-arrow-left"></i>
</a>
@include('breadcrumbs.breadcrumb-body', ['brParam' => $codeEanModel])
</div>
<div class="mb-2 mb-md-0">
<button id="formSubmitClone"
type="submit"
class="btn btn-primary"
data-bs-toggle="tooltip"
data-bs-placement="top"
title="{{ __('crud.helpers.save_model', ['model' => trans_choice('models.classes.codes-ean', 1)]) }}">
{{ __('crud.actions.save') }}
</button>
</div>
</div>
<form action="{{ route('bo.code-eans.store') }}" method="POST" enctype="multipart/form-data">
@csrf
@include('bo.pages.codes-ean.form-inputs')
<div class="row mt-3">
<div class="col text-center">
<button id="formSubmit"
type="submit"
class="btn btn-primary"
data-bs-toggle="tooltip"
data-bs-placement="top"
title="{{ __('crud.helpers.save_model', ['model' => trans_choice('models.classes.codes-ean', 1)]) }}">
{{ __('crud.actions.save') }}
</button>
</div>
</div>
</form>
@endsection

View file

@ -1,62 +0,0 @@
@extends('bo.layout', ['brParam' => $codeEanModel])
@section('title', __('Édition d\'une :model', ['model' => trans_choice('models.classes.codes-ean', 1)]))
@section('description', __('Édition d\'une :model déjà existante', ['model' => trans_choice('models.classes.codes-ean', 1)]))
@section('breadcrumb', request()->route()->getName())
@section('content')
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pb-3">
<div class="d-flex flex-row align-items-start">
<a href="{{ route('bo.code-eans.index') }}"
class="btn btn-primary text-decoration-none m-0 me-2"
data-bs-toggle="tooltip"
data-bs-placement="top"
title="{{ __('crud.helpers.list_all', ['model' => trans_choice('models.classes.codes-ean', 2)]) }}">
<i class="fa-solid fa-arrow-left"></i>
</a>
@include('breadcrumbs.breadcrumb-body', ['brParam' => $codeEanModel])
</div>
<div class="mb-2 mb-md-0">
<form action="{{ route('bo.code-eans.destroy', $codeEanModel) }}"
method="POST"
class="confirmDeleteTS">
@csrf
@method('DELETE')
<div class="btn-group" role="group">
<button id="formSubmitClone"
type="submit"
class="btn btn-primary"
data-bs-toggle="tooltip"
data-bs-placement="top"
title="{{ __('crud.helpers.save_model', ['model' => trans_choice('models.classes.codes-ean', 1)]) }}">
{{ __('crud.actions.save') }}
</button>
<button type="submit"
class="btn btn-danger"
data-bs-toggle="tooltip"
data-bs-placement="top"
title="{{ __('crud.helpers.delete_model', ['model' => trans_choice('models.classes.codes-ean', 1)]) }}">
<i class="fa-solid fa-trash"></i>
</button>
</div>
</form>
</div>
</div>
<form action="{{ route('bo.code-eans.update', $codeEanModel->id) }}" method="POST" enctype="multipart/form-data">
@csrf
@method('PUT')
@include('bo.pages.codes-ean.form-inputs')
<div class="row">
<div class="col text-center">
<button id="formSubmit"
type="submit"
class="btn btn-primary"
data-bs-toggle="tooltip"
data-bs-placement="top"
title="{{ __('crud.helpers.save_model', ['model' => trans_choice('models.classes.codes-ean', 1)]) }}">
{{ __('crud.actions.save') }}
</button>
</div>
</div>
</form>
@endsection

View file

@ -1,76 +0,0 @@
<div class="row">
{{-- CODE --}}
<div class="col-12 col-md-6 mb-3">
<fieldset class="border h-100 bg-white p-3">
<legend>{{ Str::ucfirst(__('validation.attributes.code')) }}</legend>
<div class="row">
<div class="col-12">
@include('bo.partials.inputs.int-number', [
'id' => 'codeEanCode',
'label' => __(':field', [
'field' => Str::ucfirst(__('validation.attributes.code')),
]),
'name' => 'code',
'required' => true,
'model' => $codeEanModel ?? null,
'helper' => __('validation.ean', [
'attribute' => __(':field', [
'field' => Str::ucfirst(__('validation.attributes.code')),
]),
]),
'placeholder' => __(':field', [
'field' => Str::ucfirst(__('validation.attributes.code')),
]),
// Unsigned between 7 and 13 digits
'min' => 1000000,
'max' => 9999999999999
])
</div>
</div>
</fieldset>
</div>
{{-- PRODUCT --}}
<div class="col-12 col-md-6 mb-3">
<fieldset class="border h-100 bg-white p-3">
<legend>{{ Str::ucfirst(__('validation.attributes.product')) }}</legend>
<div class="row">
<div class="col-12">
@include('bo.partials.inputs.varchar', [
'id' => 'codeEanProduct',
'label' => __('Nom du :field', [
'field' => Str::ucfirst(__('validation.attributes.product')),
]),
'hasWordCounter' => true,
'name' => 'product',
'required' => true,
'model' => $codeEanModel ?? null,
'helper' => __('validation.between.string', [
'attribute' => __('Nom du :field', [
'field' => Str::ucfirst(__('validation.attributes.product')),
]),
'min' => 3,
'max' => 255
]),
'placeholder' => __('Nom du :field', [
'field' => Str::ucfirst(__('validation.attributes.product')),
]),
])
</div>
</div>
</fieldset>
</div>
</div>
@push('scripts')
<script>
document.addEventListener("DOMContentLoaded", () => {
// Submit button clone.
const submit = document.getElementById('formSubmit')
submitClone = document.getElementById('formSubmitClone');
submitClone.addEventListener('click', (event) => {
event.preventDefault();
submit.click('');
})
});
</script>
@endpush

View file

@ -1,66 +0,0 @@
@extends('bo.layout')
@section('title', trans_choice('models.classes.codes-ean', 2))
@section('description', __('Liste de toutes les :model', ['model' => trans_choice('models.classes.codes-ean', 2)]))
@section('content')
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center">
@include('breadcrumbs.breadcrumb-body')
<a href="{{ route('bo.code-eans.create') }}"
class="btn btn-primary float-right"
data-bs-toggle="tooltip"
data-bs-placement="top"
title="{{ __('crud.helpers.create_model', ['model' => trans_choice('models.classes.codes-ean', 1)]) }}">
<i class="fa-solid fa-plus"></i>
</a>
</div>
@include('bo.modules.search-bar')
<table class="table table-hover">
@if (count($codeEanModels) > 0)
<thead>
@include('bo.modules.table-col-sorter', [
'cols' => [
'code' => Str::ucfirst(__('validation.attributes.code')),
'product' => Str::ucfirst(__('validation.attributes.product')),
],
])
</thead>
<tbody>
@foreach ($codeEanModels as $codeEanModel)
<tr class="list-item border-bottom">
<td class="text-center align-middle">{{ $codeEanModel->code }}</td>
<td class="text-center align-middle">{{ $codeEanModel->product }}</td>
<td class="text-end align-middle">
<form action="{{ route('bo.code-eans.destroy', $codeEanModel) }}"
method="POST"
class="btn-group confirmDeleteTS"
novalidate>
<a class="btn btn-sm btn-primary"
href="{{ route('bo.code-eans.edit', $codeEanModel) }}"
data-bs-toggle="tooltip"
data-bs-placement="top"
title="{{ __('crud.actions.update') }}">
<i class="fa-solid fa-pencil"></i>
</a>
@csrf
@method('DELETE')
<button type="submit"
class="btn btn-sm btn-danger"
data-bs-toggle="tooltip"
data-bs-placement="top"
title="{{ __('crud.actions.delete') }}">
<i class="fa-solid fa-trash"></i>
</button>
</form>
</td>
</tr>
@endforeach
</tbody>
@else
<tr>
<td class="text-center fw-bold border-0">{{ __('crud.other.no_model_found', ['model' => trans_choice('models.classes.codes-ean', 1)]) }}</td>
</tr>
@endif
</table>
{!! $codeEanModels->links() !!}
@endsection

View file

@ -15,7 +15,7 @@
{{ __('Top 3 des codes EAN les plus utilisés') }} :
<ul class="list-group list-group-horizontal">
@foreach ($codesEan as $codeEan)
<li class="list-group-item">{{ $codeEan->code_ean_value }} : <b>{{ $codeEan->nb_usage }}</b></li>
<li class="list-group-item">{{ $codeEan->code_ean }} : <b>{{ $codeEan->nb_usage }}</b></li>
@endforeach
</ul>
@endif

View file

@ -41,12 +41,12 @@
</td>
<td class="text-center align-middle">
<a
href="{{ route('bo.gain-views.edit', $prizeModel->gain_view->id) }}"
href="{{ route('bo.gain-views.edit', $prizeModel->gainView->id) }}"
data-bs-toggle="tooltip"
data-bs-placement="top"
title="{{ __('crud.actions.update') . ' ' . $prizeModel->gain_view->name }}"
title="{{ __('crud.actions.update') . ' ' . $prizeModel->gainView->name }}"
>
{{ $prizeModel->gain_view->name }}
{{ $prizeModel->gainView->name }}
</a>
</td>
<td class="text-end align-middle">

View file

@ -50,7 +50,6 @@
'preview' => true,
])
</div>
</div>
</fieldset>
</div>

View file

@ -1,350 +0,0 @@
@extends('bo.layout')
@section('content')
<div class="card">
<div class="card-header">
Règlages du jeu
</div>
<form action="{{route('bo.settings')}}" method="POST" enctype="multipart/form-data">
@method('PUT')
@csrf
<div class="card-body">
<div class="row">
<div class="col-md-10 offset-md-1 align-left">
<div class="form-group text-center">
<label class="col-form-label" for="name"><b>Nom du jeu <span class="required-asterisk">*</span></b></label>
<input class="form-control offset-md-3 col-md-6 game-name" type="text" name="name" placeholder="Nom du jeu *" value="{{$settings->name}}" required>
</div>
<hr/>
<h5 class="card-subtitle">
Générale<br/>
<small class="text-muted">Paramétres généraux du jeu</small>
</h5>
<br/>
<table class="table table-bordered">
<tbody>
<tr class="form-group">
<td class="w-50">
<label class="col-form-label" for="start_date">
Date de début <span class="required-asterisk">*</span><br/>
<small class="text-muted">Date d'activation du jeu</small>
</label>
</td>
<td class="align-middle">
<input class="form-control" type="datetime-local" name="start_date" value="{{\Carbon\Carbon::parse($settings->start_date)->format('Y-m-d\TH:i')}}" required>
</td>
</tr>
<tr class="form-group">
<td>
<label class="col-form-label" for="start_date">
Date de fin <span class="required-asterisk">*</span><br/>
<small class="text-muted">Date de fermeture du jeu</small>
</label>
</td>
<td class="align-middle">
<input class="form-control" type="datetime-local" name="end_date" value="{{\Carbon\Carbon::parse($settings->end_date)->format('Y-m-d\TH:i')}}" required>
</td>
</tr>
<tr class="form-group">
<td>
<label class="col-form-label" for="nb_participation_player">
Nombre de participation par joueur <span class="required-asterisk">*</span><br/>
<small class="text-muted">Si égale à 0, le nombre de participation est illimité.</small>
</label>
</td>
<td class="align-middle">
<input class="form-control" type="number" name="nb_participation_player" value="{{$settings->nb_participation_player}}" required>
</td>
</tr>
<tr class="form-group">
<td>
<label class="col-form-label" for="nb_participation_ip">
Nombre de participation par adresse IP <span class="required-asterisk">*</span><br/>
<small class="text-muted">Si égale à 0, le nombre de participation est illimité.</small>
</label>
</td>
<td class="align-middle">
<input class="form-control" type="number" name="nb_participation_ip" value="{{$settings->nb_participation_ip}}" required>
</td>
</tr>
<tr class="form-group">
<td>
<label class="col-form-label" for="nb_unique_code_use">
Nombre d'utilisation du code unique <span class="required-asterisk">*</span><br/>
<small class="text-muted">{{ __('Nombre d\'utilisations possible au total d\'un code unique.') }}</small>
</label>
</td>
<td class="align-middle">
<input class="form-control" type="number" name="nb_unique_code_use" value="{{$settings->nb_unique_code_use}}" required>
</td>
</tr>
<tr class="form-group">
<td>
<label class="col-form-label" for="code_length">
{{ __('Longueur des code uniques') }}&nbsp;<span class="required-asterisk">*</span><br/>
<small class="text-muted">{{ __('!! Cette valeur ne doit pas varier en cour de jeu !!') }}</small>
</label>
</td>
<td class="align-middle">
<input class="form-control" type="number" name="code_length" value="{{$settings->code_length}}" readonly>
</td>
</tr>
<tr class="form-group">
<td>
<label class="col-form-label" for="ean_codes">
Activer les codes EAN<br/>
<small class="text-muted">Active la vérification des codes barre des produits.</small>
</label>
</td>
<td class="align-middle">
<div class="onoffswitch">
@if ($settings->use_ean_codes === 1)
<input type="checkbox" name="use_ean_codes" class="onoffswitch-checkbox" id="ean_codes" checked>
@else
<input type="checkbox" name="use_ean_codes" class="onoffswitch-checkbox" id="ean_codes">
@endif
<label class="onoffswitch-label" for="ean_codes">
<span class="onoffswitch-inner"></span>
<span class="onoffswitch-switch"></span>
</label>
</div>
</td>
</tr>
<tr class="form-group">
<td>
<label class="col-form-label" for="activated_teaser">
Activation du teaser
</label>
</td>
<td class="align-middle">
<div class="onoffswitch">
@if ($settings->activated_teaser === 1)
<input type="checkbox" name="activated_teaser" class="onoffswitch-checkbox" id="activated_teaser" checked>
@else
<input type="checkbox" name="activated_teaser" class="onoffswitch-checkbox" id="activated_teaser">
@endif
<label class="onoffswitch-label" for="activated_teaser">
<span class="onoffswitch-inner"></span>
<span class="onoffswitch-switch"></span>
</label>
</div>
</td>
</tr>
<tr class="form-group" id="teaser_end_activity">
<td>
<label class="col-form-label" for="teaser_end_activity">
Teaser actif jusqu'au <span class="required-asterisk">*</span><br/>
</label>
</td>
<td class="align-middle">
<input class="form-control" type="datetime-local" name="teaser_end_activity" value="{{\Carbon\Carbon::parse($settings->teaser_end_activity)->format('Y-m-d\TH:i')}}" required>
</td>
</tr>
<tr class="form-group">
<td>
<label class="col-form-label" for="activated_close_page">
Activation page de fermeture<br/>
<small class="text-muted">Active la page de fermeture indiquant aux participant(s) que le jeu est terminé.</small>
</label>
</td>
<td class="align-middle">
<div class="onoffswitch">
@if ($settings->activated_close_page === 1)
<input type="checkbox" name="activated_close_page" class="onoffswitch-checkbox" id="activated_close_page" checked>
@else
<input type="checkbox" name="activated_close_page" class="onoffswitch-checkbox" id="activated_close_page">
@endif
<label class="onoffswitch-label" for="activated_close_page">
<span class="onoffswitch-inner"></span>
<span class="onoffswitch-switch"></span>
</label>
</div>
</td>
</tr>
<tr class="form-group" id="close_page_active_date">
<td>
<label class="col-form-label" for="close_page_active_date">
Page active jusqu'au <span class="required-asterisk">*</span>
</label>
</td>
<td class="align-middle">
<input class="form-control" type="datetime-local" name="close_page_active_date" value="{{\Carbon\Carbon::parse($settings->close_page_active_date)->format('Y-m-d\TH:i')}}">
</td>
</tr>
<tr class="form-group">
<td>
<label class="col-form-label" for="redirect_close">
URL de redirection après la date de fin du jeu <span class="required-asterisk">*</span><br/>
<small class="text-muted">L'URL doit commencer par "http://" ou "https://".</small>
</label>
</td>
<td class="align-middle">
<input class="form-control" type="text" name="redirect_close" value="{{$settings->redirect_close}}" required>
</td>
</tr>
<tr class="form-group">
<td>
<label class="col-form-label" for="winning_proof">
Activer les preuves de gain<br/>
<small class="text-muted">Active l'affichage de la page de transmission des preuves de gain.</small>
</label>
</td>
<td class="align-middle">
<div class="onoffswitch">
@if ($settings->winning_proof === 1)
<input type="checkbox" name="winning_proof" class="onoffswitch-checkbox" id="winning_proof" checked>
@else
<input type="checkbox" name="winning_proof" class="onoffswitch-checkbox" id="winning_proof">
@endif
<label class="onoffswitch-label" for="winning_proof">
<span class="onoffswitch-inner"></span>
<span class="onoffswitch-switch"></span>
</label>
</div>
</td>
</tr>
<tr class="form-group">
<td>
<label class="col-form-label" for="redirect_close">
Nom de la société <span class="required-asterisk">*</span>
</label>
</td>
<td class="align-middle">
<input class="form-control" type="text" name="company" value="{{$settings->company}}" required>
</td>
</tr>
</tbody>
</table>
<hr/>
<h5 class="card-subtitle">
Les réductions<br/>
<small class="text-muted">Paramétrages des bons de réduction MLDC</small>
</h5>
<br/>
<table class="table table-bordered">
<tbody>
<tr class="form-group">
<td class="w-50">
<label class="col-form-label" for="reductions_activated">
Activer les bons de réduction<br/>
</label>
</td>
<td class="align-middle">
<div class="onoffswitch">
@if ($settings->reductions_activated === 1)
<input type="checkbox" name="reductions_activated" class="onoffswitch-checkbox" id="reductions_activated" checked>
@else
<input type="checkbox" name="reductions_activated" class="onoffswitch-checkbox" id="reductions_activated">
@endif
<label class="onoffswitch-label" for="reductions_activated">
<span class="onoffswitch-inner"></span>
<span class="onoffswitch-switch"></span>
</label>
</div>
</td>
</tr>
<tr class="form-group" id="reductions_site">
<td>
<label class="col-form-label" for="reductions_site">
Référence du site <span class="required-asterisk">*</span>
</label>
</td>
<td class="align-middle">
<input class="form-control" type="text" name="reductions_site" value="{{$settings->reductions_site}}">
</td>
</tr>
<tr class="form-group" id="reductions_campaign">
<td>
<label class="col-form-label" for="reductions_campaign">
Référence de la campagne <span class="required-asterisk">*</span>
</label>
</td>
<td class="align-middle">
<input class="form-control" type="text" name="reductions_campaign" value="{{$settings->reductions_campaign}}">
</td>
</tr>
<tr class="form-group" id="reductions_web_coupons">
<td colspan="2">
<web-coupons dbdatas='{{$settings->web_coupons}}' name="web_coupons"></web-coupons>
</td>
</tr>
</tbody>
</table>
<hr/>
<h5 class="card-subtitle">
Destinataires des notifications de gain<br/>
<small class="text-muted">Ces mails recevront toutes les notifications de gain.</small>
</h5>
<br/>
<win-notification name="notification_emails" dbdatas="{{$settings->notification_emails}}"></win-notification>
<hr>
<h5 class="card-subtitle">
Google analytics<br/>
<small class="text-muted">Insérer ici la clé analytics pour le jeu.</small>
</h5>
<table class="table table-bordered">
<tr class="form-group">
<td class="w-50 align-middle">Clé analytics (eg: UA-XX196604-1)</td>
<td class="align-middle"><input name="analytics" class="form-control" value="{{ $settings->analytics }}" type="text"/></td>
</tr>
</table>
</div>
</div>
</div>
<div class="card-footer text-center">
<input type="submit" class="btn btn-success" value="Enregistrer">
</div>
</form>
</div>
@endsection
@push('scripts')
<script type="text/javascript" defer>
// Gestion du tableau pour reduction
$("input[name=reductions_activated]").change(function() {
if (!$('input[name=reductions_activated]').is(':checked')) {
$("#reductions_site").hide();
$("#reductions_campaign").hide();
$("#reductions_web_coupons").hide();
} else {
$("#reductions_site").show();
$("#reductions_campaign").show();
$("#reductions_web_coupons").show();
}
});
$(document).ready(function() {
if (!$('input[name=reductions_activated]').is(':checked')) {
$("#reductions_site").hide();
$("#reductions_campaign").hide();
$("#reductions_web_coupons").hide();
}
if (!$("input[name=activated_teaser]").is(':checked')) {
$("#teaser_end_activity").hide();
}
if (!$("input[name=activated_close_page]").is(':checked')) {
$("#close_page_active_date").hide();
}
});
// Gère l'activation du teaser (champ date à affihcer ou non)
$("input[name=activated_teaser]").change(function() {
if ($(this).is(':checked')) {
$("#teaser_end_activity").show();
} else {
$("#teaser_end_activity").hide();
}
});
// Gère l'activation de la page de fermeture (champ date à afficher ou non)
$("input[name=activated_close_page]").change(function() {
if ($(this).is(':checked')) {
$("#close_page_active_date").show();
} else {
$("#close_page_active_date").hide();
}
});
</script>
@endpush

View file

@ -36,9 +36,9 @@
<tr class="list-item border-bottom">
<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->user->email}}</td>
<td class="text-center align-middle">{{$participationModel->customer->email}}</td>
@if ($settings->use_ean_codes)
<td class="text-center align-middle">{{$participationModel->codeEan->code}}</td>
<td class="text-center align-middle">{{$participationModel->codeEan}}</td>
@endif
<td class="text-center align-middle">{{$participationModel->code->code_unique}}</td>
@if ($settings->winning_proof === 1)

View file

@ -1,27 +0,0 @@
@extends('bo.layout')
@section('content')
<div class="card">
<form action="{{route('bo.products.store')}}" method="POST" enctype="multipart/form-data">
@csrf
<div class="card-header">
<div class="row">
<div class="col-md-3">
<a href="{{route('bo.products.index')}}" class="h2 text-decoration-none"><</a> Produit Porteur - Ajout
</div>
<div class="col-md-6 text-center">
</div>
<div class="col-md-3 text-right">
<button type="submit" class="btn btn-primary btn-sm text-white float-right">
Enregistrer
</button>
</div>
</div>
</div>
<div class="card-body">
@include('bo.products.input-forms')
</div>
</form>
</div>
@endsection

View file

@ -1,30 +0,0 @@
@extends('bo.layout')
@section('content')
<div class="card">
<form action="{{route('bo.products.update', $product->id)}}" method="POST" enctype="multipart/form-data">
@method('PUT')
@csrf
<div class="card-header">
<div class="row">
<div class="col-md-4">
<a href="{{route('bo.products.index')}}" class="h2 text-decoration-none"><</a> Produit Porteur - Modification
</div>
<div class="col-md-5 text-center">
@if (session('success'))
<span class="float-center text-success">{{ session('success') }}</span>
@endif
</div>
<div class="col-md-3 text-right">
<button type="submit" class="btn btn-primary btn-sm text-white float-right">
Enregistrer
</button>
</div>
</div>
</div>
<div class="card-body">
@include('bo.products.input-forms')
</div>
</form>
</div>
@endsection

View file

@ -1,66 +0,0 @@
@extends('bo.layout')
@section('content')
<div class="card">
<div class="card-header">
<div class="row">
<div class="col-md-3">
Produits Porteur
</div>
<div class="col-md-6 text-center">
</div>
<div class="col-md-3 text-right">
<a class="btn btn-primary btn-sm text-white float-right" href="{{route('bo.products.create')}}">
Ajouter
</a>
</div>
</div>
</div>
<div class="card-body">
@if ($errors->any())
<div class="alert alert-danger">
<ul>
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif
<table class="table">
<thead class="thead-light">
<th scope="col">N° Article</th>
<th scope="col">Libellé</th>
<th scope="col">EAN</th>
<th scope="col">Image</th>
<th scope="col"></th>
</thead>
<tbody>
@foreach($products as $product)
<tr>
<td>{{$product->no_art}}</td>
<td>{{$product->name}}</td>
<td>{{$product->code_ean}}</td>
<td>
@if($product->picture)
<a data-fancybox="gallery" href="{{ asset('/images/produits/' . $product->picture ) }}">
<img src="{{ asset('/images/produits/' . $product->picture ) }}" alt="{{$product->name}}" style="max-height: 50px">
</a>
@endif
</td>
<td>
<a href="{{ route('bo.products.edit', $product->id) }}" class="btn btn-sm btn-primary">Modifier</a>
<form action="{{route('bo.products.destroy', $product->id)}}" method="POST" class="d-inline">
@method('DELETE')
@csrf
<input type="submit" class="btn btn-sm btn-danger" value="Supprimer"
onclick="return confirm('Êtes-vous sûr(e) ?')">
</form>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
@endsection

View file

@ -1,38 +0,0 @@
<div class="form-group">
<label for="name">Libelle Produit *</label>
<input type="text" id="name" name="name" class="form-control" placeholder="Libelle Produit" value="{{ old('name', $product->name ?? '') }}" required>
</div>
<div class="form-group">
<label for="no_art">Code Article</label>
<input type="text" id="no_art" name="no_art" class="form-control" placeholder="no_art" value="{{ old('no_art', $product->no_art ?? '') }}">
</div>
<div class="form-group">
<label for="code_ean">Code EAN</label>
<input type="text" id="code_ean" name="code_ean" class="form-control" placeholder="code_ean" value="{{ old('code_ean', $product->code_ean ?? '') }}" required>
</div>
<div class="form-group">
<label for="picture">Image *<small class="text-muted">- JPEG/PNG, 2Mo max. Dimensions {{ Config::get('theme.product_image_maxwidth') }} px par {{ Config::get('theme.product_image_maxheight') }} px</small></label></br>
<input type="file" id="picture" name="picture" accept="image/png, image/jpeg">
@if (isset($product->picture) and $product->picture !== null)
<br/>
<br/>
<a data-fancybox="gallery" href="{{ asset('/images/produits/' . $product->picture ) }}">
<img src="{{ asset('/images/produits/' . $product->picture ) }}" alt="{{$product->name}}" style="max-height: 100px">
</a>
@endif
</div>
<div class="form-group">
<div class="input-group mb-3">
<div class="input-group-prepend">
<label class="input-group-text" for="range">{{ __('Gamme') }}</label>
</div>
<select class="custom-select" name="range_id" id="range" required>
@if(!isset($product))
<option selected disabled value="">{{ __('Selectionnez une gamme') }}</option>
@endif
@foreach($ranges as $range)
<option value="{{ $range->id }}" @if(isset($product) and $product->range_id === $range->id) selected @endif>{{ $range->name }}</option>
@endforeach
</select>
</div>
</div>

View file

@ -1,27 +0,0 @@
@extends('bo.layout')
@section('content')
<div class="card">
<form action="{{route('bo.ranges.store')}}" method="POST" enctype="multipart/form-data">
@csrf
<div class="card-header">
<div class="row">
<div class="col-md-3">
<a href="{{route('bo.ranges.index')}}" class="h2 text-decoration-none"><</a>{{ __('Gammes - Ajout') }}
</div>
<div class="col-md-6 text-center">
</div>
<div class="col-md-3 text-right">
<button type="submit" class="btn btn-primary btn-sm text-white float-right">
{{__('Enregistrer') }}
</button>
</div>
</div>
</div>
<div class="card-body">
@include('bo.ranges.input-forms')
</div>
</form>
</div>
@endsection

View file

@ -1,30 +0,0 @@
@extends('bo.layout')
@section('content')
<div class="card">
<form action="{{route('bo.ranges.update', $range->id)}}" method="POST" enctype="multipart/form-data">
@method('PUT')
@csrf
<div class="card-header">
<div class="row">
<div class="col-md-4">
<a href="{{route('bo.ranges.index')}}" class="h2 text-decoration-none"><</a>{{ __('Gammes - Modification') }}
</div>
<div class="col-md-5 text-center">
@if (session('success'))
<span class="float-center text-success">{{ session('success') }}</span>
@endif
</div>
<div class="col-md-3 text-right">
<button type="submit" class="btn btn-primary btn-sm text-white float-right">
{{__('Enregistrer') }}
</button>
</div>
</div>
</div>
<div class="card-body">
@include('bo.ranges.input-forms')
</div>
</form>
</div>
@endsection

View file

@ -1,52 +0,0 @@
@extends('bo.layout')
@section('content')
<div class="card">
<div class="card-header">
<div class="row">
<div class="col-md-3">
{{ __('Gammes') }}
</div>
<div class="col-md-6 text-center">
</div>
<div class="col-md-3 text-right">
<a class="btn btn-primary btn-sm text-white float-right" href="{{route('bo.ranges.create')}}">
{{ __('Ajouter') }}
</a>
</div>
</div>
</div>
<div class="card-body">
<table class="table">
<thead class="thead-light">
<th scope="col">{{ __('Nom') }}</th>
<th scope="col">Image</th>
<th scope="col"></th>
</thead>
<tbody>
@foreach($ranges as $range)
<tr>
<td>{{$range->name}}</td>
<td>
@if($range->picture)
<a data-fancybox="gallery" href="{{ asset('/images/ranges/' . $range->picture ) }}">
<img src="{{ asset('/images/ranges/' . $range->picture ) }}" alt="{{$range->name}}" style="max-height: 50px">
</a>
@endif
</td>
<td>
<a href="{{ route('bo.ranges.edit', $range->id) }}" class="btn btn-sm btn-primary">{{ __('Modifier') }}</a>
<form action="{{route('bo.ranges.destroy', $range->id)}}" method="POST" class="d-inline">
@method('DELETE')
@csrf
<input type="submit" class="btn btn-sm btn-danger" value="{{ __('Supprimer') }}" onclick="return confirm('{{ __('Êtes-vous sûr(e) ?') }}')">
</form>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
@endsection

View file

@ -1,15 +0,0 @@
<div class="form-group">
<label for="name">Nom *</label>
<input type="text" id="name" name="name" class="form-control" placeholder="Nom de la gamme" value="{{ old('name', $range->name ?? '') }}" required>
</div>
<div class="form-group">
<label for="picture">Image *<small class="text-muted">- JPEG/PNG, 2Mo max. Dimensions {{ Config::get('theme.product_image_maxwidth') }} px par {{ Config::get('theme.product_image_maxheight') }} px</small></label></br>
<input type="file" id="picture" name="picture" accept="image/png, image/jpeg">
@if (isset($range->picture) and $range->picture !== null)
<br/>
<br/>
<a data-fancybox="gallery" href="{{ asset('/images/ranges/' . $range->picture ) }}">
<img src="{{ asset('/images/ranges/' . $range->picture ) }}" alt="{{$range->name}}" style="max-height: 100px">
</a>
@endif
</div>

View file

@ -1,401 +0,0 @@
@extends('bo.layout')
@section('content')
<div class="card">
<div class="card-header">
Règlages du jeu
</div>
<form action="{{route('bo.settings')}}" method="POST" enctype="multipart/form-data">
@method('PUT')
@csrf
<div class="card-body">
<div class="row">
<div class="col-md-10 offset-md-1 align-left">
<div class="form-group text-center">
<label class="col-form-label" for="name"><b>Nom du jeu <span class="required-asterisk">*</span></b></label>
<input class="form-control offset-md-3 col-md-6 game-name" type="text" name="name" placeholder="Nom du jeu *" value="{{$settings->name}}" required>
</div>
<hr/>
<h5 class="card-subtitle">
Générale<br/>
<small class="text-muted">Paramétres généraux du jeu</small>
</h5>
<br/>
<table class="table table-bordered">
<tbody>
<tr class="form-group">
<td class="w-50">
<label class="col-form-label" for="start_date">
Date de début <span class="required-asterisk">*</span><br/>
<small class="text-muted">Date d'activation du jeu</small>
</label>
</td>
<td class="align-middle">
<input class="form-control" type="datetime-local" name="start_date" value="{{\Carbon\Carbon::parse($settings->start_date)->format('Y-m-d\TH:i')}}" required>
</td>
</tr>
<tr class="form-group">
<td>
<label class="col-form-label" for="start_date">
Date de fin <span class="required-asterisk">*</span><br/>
<small class="text-muted">Date de fermeture du jeu</small>
</label>
</td>
<td class="align-middle">
<input class="form-control" type="datetime-local" name="end_date" value="{{\Carbon\Carbon::parse($settings->end_date)->format('Y-m-d\TH:i')}}" required>
</td>
</tr>
<tr class="form-group">
<td>
<label class="col-form-label" for="nb_participation_player">
Nombre de participation par joueur <span class="required-asterisk">*</span><br/>
<small class="text-muted">Si égale à 0, le nombre de participation est illimité.</small>
</label>
</td>
<td class="align-middle">
<input class="form-control" type="number" name="nb_participation_player" value="{{$settings->nb_participation_player}}" required>
</td>
</tr>
<tr class="form-group">
<td>
<label class="col-form-label" for="nb_participation_ip">
Nombre de participation par adresse IP <span class="required-asterisk">*</span><br/>
<small class="text-muted">Si égale à 0, le nombre de participation est illimité.</small>
</label>
</td>
<td class="align-middle">
<input class="form-control" type="number" name="nb_participation_ip" value="{{$settings->nb_participation_ip}}" required>
</td>
</tr>
<tr class="form-group">
<td>
<label class="col-form-label" for="nb_unique_code_use">
Nombre d'utilisation du code unique <span class="required-asterisk">*</span><br/>
<small class="text-muted">{{ __('Nombre d\'utilisations possible au total d\'un code unique.') }}</small>
</label>
</td>
<td class="align-middle">
<input class="form-control" type="number" name="nb_unique_code_use" value="{{$settings->nb_unique_code_use}}" required>
</td>
</tr>
<tr class="form-group">
<td>
<label class="col-form-label" for="code_length">
{{ __('Longueur des code uniques') }}&nbsp;<span class="required-asterisk">*</span><br/>
<small class="text-muted">{{ __('!! Cette valeur ne doit pas varier en cour de jeu !!') }}</small>
</label>
</td>
<td class="align-middle">
<input class="form-control" type="number" name="code_length" value="{{$settings->code_length}}" readonly>
</td>
</tr>
<tr class="form-group">
<td>
<label class="col-form-label" for="ean_codes">
Activer les codes EAN<br/>
<small class="text-muted">Active la vérification des codes barre des produits.</small>
</label>
</td>
<td class="align-middle">
<div class="onoffswitch">
@if ($settings->use_ean_codes === 1)
<input type="checkbox" name="use_ean_codes" class="onoffswitch-checkbox" id="ean_codes" checked>
@else
<input type="checkbox" name="use_ean_codes" class="onoffswitch-checkbox" id="ean_codes">
@endif
<label class="onoffswitch-label" for="ean_codes">
<span class="onoffswitch-inner"></span>
<span class="onoffswitch-switch"></span>
</label>
</div>
</td>
</tr>
<tr class="form-group">
<td>
<label class="col-form-label" for="activated_teaser">
Activation du teaser
</label>
</td>
<td class="align-middle">
<div class="onoffswitch">
@if ($settings->activated_teaser === 1)
<input type="checkbox" name="activated_teaser" class="onoffswitch-checkbox" id="activated_teaser" checked>
@else
<input type="checkbox" name="activated_teaser" class="onoffswitch-checkbox" id="activated_teaser">
@endif
<label class="onoffswitch-label" for="activated_teaser">
<span class="onoffswitch-inner"></span>
<span class="onoffswitch-switch"></span>
</label>
</div>
</td>
</tr>
<tr class="form-group" id="teaser_end_activity">
<td>
<label class="col-form-label" for="teaser_end_activity">
Teaser actif jusqu'au <span class="required-asterisk">*</span><br/>
</label>
</td>
<td class="align-middle">
<input class="form-control" type="datetime-local" name="teaser_end_activity" value="{{\Carbon\Carbon::parse($settings->teaser_end_activity)->format('Y-m-d\TH:i')}}" required>
</td>
</tr>
<tr class="form-group">
<td>
<label class="col-form-label" for="activated_close_page">
Activation page de fermeture<br/>
<small class="text-muted">Active la page de fermeture indiquant aux participant(s) que le jeu est terminé.</small>
</label>
</td>
<td class="align-middle">
<div class="onoffswitch">
@if ($settings->activated_close_page === 1)
<input type="checkbox" name="activated_close_page" class="onoffswitch-checkbox" id="activated_close_page" checked>
@else
<input type="checkbox" name="activated_close_page" class="onoffswitch-checkbox" id="activated_close_page">
@endif
<label class="onoffswitch-label" for="activated_close_page">
<span class="onoffswitch-inner"></span>
<span class="onoffswitch-switch"></span>
</label>
</div>
</td>
</tr>
<tr class="form-group" id="close_page_active_date">
<td>
<label class="col-form-label" for="close_page_active_date">
Page active jusqu'au <span class="required-asterisk">*</span>
</label>
</td>
<td class="align-middle">
<input class="form-control" type="datetime-local" name="close_page_active_date" value="{{\Carbon\Carbon::parse($settings->close_page_active_date)->format('Y-m-d\TH:i')}}">
</td>
</tr>
<tr class="form-group">
<td>
<label class="col-form-label" for="redirect_close">
URL de redirection après la date de fin du jeu <span class="required-asterisk">*</span><br/>
<small class="text-muted">L'URL doit commencer par "http://" ou "https://".</small>
</label>
</td>
<td class="align-middle">
<input class="form-control" type="text" name="redirect_close" value="{{$settings->redirect_close}}" required>
</td>
</tr>
<tr class="form-group">
<td>
<label class="col-form-label" for="winning_proof">
Activer les preuves de gain<br/>
<small class="text-muted">Active l'affichage de la page de transmission des preuves de gain.</small>
</label>
</td>
<td class="align-middle">
<div class="onoffswitch">
@if ($settings->winning_proof === 1)
<input type="checkbox" name="winning_proof" class="onoffswitch-checkbox" id="winning_proof" checked>
@else
<input type="checkbox" name="winning_proof" class="onoffswitch-checkbox" id="winning_proof">
@endif
<label class="onoffswitch-label" for="winning_proof">
<span class="onoffswitch-inner"></span>
<span class="onoffswitch-switch"></span>
</label>
</div>
</td>
</tr>
<tr class="form-group">
<td>
<label class="col-form-label" for="redirect_close">
Nom de la société <span class="required-asterisk">*</span>
</label>
</td>
<td class="align-middle">
<input class="form-control" type="text" name="company" value="{{$settings->company}}" required>
</td>
</tr>
</tbody>
</table>
<hr/>
<h5 class="card-subtitle">
Les réductions<br/>
<small class="text-muted">Paramétrages des bons de réduction MLDC</small>
</h5>
<br/>
<table class="table table-bordered">
<tbody>
<tr class="form-group">
<td class="w-50">
<label class="col-form-label" for="reductions_activated">
Activer les bons de réduction<br/>
</label>
</td>
<td class="align-middle">
<div class="onoffswitch">
@if ($settings->reductions_activated === 1)
<input type="checkbox" name="reductions_activated" class="onoffswitch-checkbox" id="reductions_activated" checked>
@else
<input type="checkbox" name="reductions_activated" class="onoffswitch-checkbox" id="reductions_activated">
@endif
<label class="onoffswitch-label" for="reductions_activated">
<span class="onoffswitch-inner"></span>
<span class="onoffswitch-switch"></span>
</label>
</div>
</td>
</tr>
<tr class="form-group" id="reductions_site">
<td>
<label class="col-form-label" for="reductions_site">
Référence du site <span class="required-asterisk">*</span>
</label>
</td>
<td class="align-middle">
<input class="form-control" type="text" name="reductions_site" value="{{$settings->reductions_site}}">
</td>
</tr>
<tr class="form-group" id="reductions_campaign">
<td>
<label class="col-form-label" for="reductions_campaign">
Référence de la campagne <span class="required-asterisk">*</span>
</label>
</td>
<td class="align-middle">
<input class="form-control" type="text" name="reductions_campaign" value="{{$settings->reductions_campaign}}">
</td>
</tr>
<tr class="form-group" id="reductions_web_coupons">
<td colspan="2">
<web-coupons dbdatas='{{$settings->web_coupons}}' name="web_coupons"></web-coupons>
</td>
</tr>
</tbody>
</table>
<hr/>
<h5 class="card-subtitle">
Facebook Connect<br/>
<small class="text-muted">Paramétrage du Facebook Connect</small>
</h5>
<br/>
<table class="table table-bordered">
<tbody>
<tr class="form-group">
<td class="w-50">
<label class="col-form-label" for="facebook_activated">
Activer<br/>
<small class="text-muted">Activer ou désactiver la fonctionnalité</small>
</label>
</td>
<td class="align-middle">
<div class="onoffswitch">
@if ($settings->facebook_activated === 1)
<input type="checkbox" name="facebook_activated" class="onoffswitch-checkbox" id="facebook_activated" checked>
@else
<input type="checkbox" name="facebook_activated" class="onoffswitch-checkbox" id="facebook_activated">
@endif
<label class="onoffswitch-label" for="facebook_activated">
<span class="onoffswitch-inner"></span>
<span class="onoffswitch-switch"></span>
</label>
</div>
</td>
</tr>
<tr class="form-group">
<td>
<label class="col-form-label" for="facebook_app_id">
app_id
</label>
</td>
<td class="align-middle">
<input class="form-control" type="text" name="facebook_app_id" value="{{$settings->facebook_app_id}}">
</td>
</tr>
<tr class="form-group">
<td>
<label class="col-form-label" for="facebook_secret">
app_secret
</label>
</td>
<td class="align-middle">
<input class="form-control" type="text" name="facebook_secret" value="{{$settings->facebook_secret}}">
</td>
</tr>
</tbody>
</table>
<hr/>
<h5 class="card-subtitle">
Destinataires des notifications de gain<br/>
<small class="text-muted">Ces mails recevront toutes les notifications de gain.</small>
</h5>
<br/>
<win-notification name="notification_emails" dbdatas="{{$settings->notification_emails}}"></win-notification>
<hr>
<h5 class="card-subtitle">
Google analytics<br/>
<small class="text-muted">Insérer ici la clé analytics pour le jeu.</small>
</h5>
<table class="table table-bordered">
<tr class="form-group">
<td class="w-50 align-middle">Clé analytics (eg: UA-XX196604-1)</td>
<td class="align-middle"><input name="analytics" class="form-control" value="{{ $settings->analytics }}" type="text"/></td>
</tr>
</table>
</div>
</div>
</div>
<div class="card-footer text-center">
<input type="submit" class="btn btn-success" value="Enregistrer">
</div>
</form>
</div>
@endsection
@push('scripts')
<script type="text/javascript" defer>
// Gestion du tableau pour reduction
$("input[name=reductions_activated]").change(function() {
if (!$('input[name=reductions_activated]').is(':checked')) {
$("#reductions_site").hide();
$("#reductions_campaign").hide();
$("#reductions_web_coupons").hide();
} else {
$("#reductions_site").show();
$("#reductions_campaign").show();
$("#reductions_web_coupons").show();
}
});
$(document).ready(function() {
if (!$('input[name=reductions_activated]').is(':checked')) {
$("#reductions_site").hide();
$("#reductions_campaign").hide();
$("#reductions_web_coupons").hide();
}
if (!$("input[name=activated_teaser]").is(':checked')) {
$("#teaser_end_activity").hide();
}
if (!$("input[name=activated_close_page]").is(':checked')) {
$("#close_page_active_date").hide();
}
});
// Gère l'activation du teaser (champ date à affihcer ou non)
$("input[name=activated_teaser]").change(function() {
if ($(this).is(':checked')) {
$("#teaser_end_activity").show();
} else {
$("#teaser_end_activity").hide();
}
});
// Gère l'activation de la page de fermeture (champ date à afficher ou non)
$("input[name=activated_close_page]").change(function() {
if ($(this).is(':checked')) {
$("#close_page_active_date").show();
} else {
$("#close_page_active_date").hide();
}
});
</script>
@endpush

View file

@ -5,6 +5,8 @@
!empty($brParam) ? (is_array($brParam) ? $brParam : [$brParam]) : []
)) }}
@endif
@elseif(Breadcrumbs::exists(request()->route()->getName()))
@elseif(request()->route() != null)
@if(Breadcrumbs::exists(request()->route()->getName()))
{{ Breadcrumbs::render(request()->route()->getName()) }}
@endif
@endif

View file

@ -1,10 +1,9 @@
@hasSection('breadcrumb')
@if(Breadcrumbs::exists(app()->view->getSections()['breadcrumb']))
{{ call_user_func_array('Breadcrumbs::view', array_merge(
['breadcrumbs::json-ld', app()->view->getSections()['breadcrumb']],
!empty($brParam) ? (is_array($brParam) ? $brParam : [$brParam]) : []
)) }}
{{ Breadcrumbs::view('breadcrumbs::json-ld', app()->view->getSections()['breadcrumb'], $brParam ?? null) }}
@endif
@elseif(Breadcrumbs::exists(request()->route()->getName()))
@elseif(request()->route() != null)
@if (Breadcrumbs::exists(request()->route()->getName()))
{{ Breadcrumbs::view('breadcrumbs::json-ld', request()->route()->getName()) }}
@endif
@endif

View file

@ -1,15 +1,17 @@
@if (isset($breadcrumbs))
@unless ($breadcrumbs->isEmpty())
<nav aria-label="breadcrumb" class="d-inline">
<ol class="breadcrumb d-inline-flex">
@foreach ($breadcrumbs as $breadcrumb)
@if (!is_null($breadcrumb->url) && !$loop->last)
<li class="breadcrumb-item"><a href="{{ $breadcrumb->url }}" rel="nofollow">{{ $breadcrumb->title }}</a></li>
@else
<li class="breadcrumb-item active" aria-current="page">{{ $breadcrumb->title }}</li>
@endif
@endforeach
</ol>
</nav>
@endunless
@if (count($breadcrumbs))
<ol class="breadcrumb flex-nowrap border-0 w-fit p-0 m-0">
@foreach ($breadcrumbs as $breadcrumb)
@if ($breadcrumb->url && !$loop->last)
<li class="breadcrumb-item d-flex h2 fw-bold m-0">
<a class="text-decoration-none text-secondary" href="{{ $breadcrumb->url }}">
{{ $breadcrumb->title }}
</a>
</li>
@else
<li class="breadcrumb-item d-flex align-items-center flex-grow-1 text-dark h2 fw-bold active m-0">
{{ $breadcrumb->title }}
</li>
@endif
@endforeach
</ol>
@endif

View file

@ -1,7 +1,7 @@
@extends('front.basic.layout')
@section('title')
{{$prize->gain_view->name}}
{{$prize->gainView->name}}
@endsection
@section('content')

View file

@ -13,9 +13,9 @@
<p>{{ $participation->user->email }}</p><br />
<p><b>Codes utilisé@if ($settings->use_ean_codes)s @endif :</b></p>
@if ($settings->use_ean_codes)
<p>- Code On Pack : {{ $participation->codeEan->code }}</p>
<p>- Code On Pack : {{ $participation->codeEan }}</p>
@endif
<p>- Code Unique : {{ $participation->code->code_unique }}</p>
</div>
</section>
</div>
</div>

View file

@ -1,4 +1,4 @@
@extends('layouts.app')
@extends('bo.layout')
@section('content')
<div class="container">

View file

@ -1,7 +1,6 @@
<?php
use App\Models\BannedIp;
use App\Models\CodeEan;
use App\Models\Content;
use App\Models\FaqQuestion;
use App\Models\FaqTheme;
@ -25,19 +24,6 @@ Breadcrumbs::for('bo.bannedips.edit', function (Generator $trail, BannedIp $bann
$trail->push(__('crud.actions.edit'), route('bo.bannedips.edit', $bannedip->id));
});
// * CODES EAN
Breadcrumbs::for('bo.code-eans.index', function (Generator $trail) {
$trail->push(trans_choice('models.classes.codes-ean', 2), route('bo.code-eans.index'));
});
Breadcrumbs::for('bo.code-eans.create', function (Generator $trail) {
$trail->parent('bo.code-eans.index');
$trail->push(__('crud.actions.create'), route('bo.code-eans.create'));
});
Breadcrumbs::for('bo.code-eans.edit', function (Generator $trail, CodeEan $codeEan) {
$trail->parent('bo.code-eans.index');
$trail->push(__('crud.actions.edit'), route('bo.code-eans.edit', $codeEan->id));
});
// * CONTENTS
Breadcrumbs::for('bo.contents.index', function (Generator $trail) {
$trail->push(__('models.classes.contents'), route('bo.contents.index'));

View file

@ -2,7 +2,6 @@
use App\Http\Controllers\Bo\BannedIpController;
use App\Http\Controllers\Bo\CodesController;
use App\Http\Controllers\Bo\CodesEANController;
use App\Http\Controllers\Bo\ContentController;
use App\Http\Controllers\Bo\DashboardController;
use App\Http\Controllers\Bo\FaqQuestionsController;
@ -40,10 +39,6 @@ Route::prefix('bo')
->name('dashboard')->withoutMiddleware('is-super-admin');
// * BANNED IPS
Route::resource('/bannedips', BannedIpController::class)->except('show');
// * CODES EAN
Route::resource('/code-eans', CodesEANController::class)
->except('show')
->withoutMiddleware('is-super-admin');
// * CONTENTS
Route::resource('/contents', ContentController::class)
->only(['index', 'edit', 'update'])

View file

@ -27,8 +27,7 @@ Route::namespace('\App\Http\Controllers\Fo')->middleware(['throttle:credentials'
Route::put('/rejouer', [WinningProofController::class, 'sendWinningProof'])
->name('send-winning-proof');
});
Route::get('/', [HomeController::class, 'index'])->name('home');
// Route::get('/', [HomeController::class, 'home'])->name('home');
Route::get('/', [HomeController::class, 'home'])->name('home');
Route::get('/reglement', [ViewContentController::class, 'reglement'])->name('reglement');
Route::get('/charte', [ViewContentController::class, 'charte'])->name('charte');