Updated Settings Controller/Request/Blade and winnersList
This commit is contained in:
parent
c928f9a5c4
commit
89c5f19dfa
21 changed files with 1267 additions and 328 deletions
|
|
@ -3,89 +3,55 @@
|
|||
namespace App\Http\Controllers\Bo;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\Bo\Settings\UpdateSettingsRequest;
|
||||
use App\Models\Settings;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class SettingsController extends Controller
|
||||
{
|
||||
public function manage(Request $request)
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param \App\Models\Settings $settings
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function edit(Settings $settings): \Illuminate\Contracts\View\View
|
||||
{
|
||||
/** @var \App\Models\Settings $settings */
|
||||
$settings = app(Settings::class);
|
||||
return view('bo.pages.settings.edit', [
|
||||
'settingsModel' => $settings
|
||||
]);
|
||||
}
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$name = $request->name;
|
||||
$startDate = $request->start_date;
|
||||
$endDate = $request->end_date;
|
||||
$nbParticipationPlayer = $request->nb_participation_player;
|
||||
$nbParticipationIp = $request->nb_participation_ip;
|
||||
$nbUniqueCodeUse = $request->nb_unique_code_use;
|
||||
$useEanCodes = $request->use_ean_codes === null ? 0 : 1;
|
||||
$activatedTeaser = $request->activated_teaser === null ? 0 : 1;
|
||||
$teaserEndActivity = $request->teaser_end_activity;
|
||||
$activatedClosePage = $request->activated_close_page === null ? 0 : 1;
|
||||
$closePageActiveDate = $request->close_page_active_date;
|
||||
$redirectClose = $request->redirect_close;
|
||||
$reductionsActivated = $request->reductions_activated === null ? 0 : 1;
|
||||
$reductionsSite = $request->reductions_site;
|
||||
$reductionsCampaign = $request->reductions_campaign;
|
||||
$webCoupons = $request->web_coupons;
|
||||
$facebookActivated = $request->facebook_activated === null ? 0 : 1;
|
||||
$facebookAppId = $request->facebook_app_id;
|
||||
$facebookSecret = $request->facebook_secret;
|
||||
$notificationEmails = $request->notification_emails;
|
||||
$winningProof = $request->winning_proof === null ? 0 : 1;
|
||||
$company = $request->company;
|
||||
$analytics = $request->analytics;
|
||||
|
||||
// Check du lien de redirection après fermeture.
|
||||
if (strpos($redirectClose, 'https://') === false && strpos($redirectClose, 'http://') === false) {
|
||||
$redirectClose = 'https://' . $redirectClose;
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \App\Http\Requests\Bo\Settings\UpdateSettingsRequest $request
|
||||
* @param \App\Models\Settings $settings
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function update(UpdateSettingsRequest $request, Settings $settings): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
return DB::transaction(function () use ($request, $settings) {
|
||||
$settings->fill($request->validated());
|
||||
if ($settings->saveOrFail()) {
|
||||
$settingsGlobal = app(Settings::class)
|
||||
->select('name', 'company', 'analytics', 'start_date', 'end_date')->first();
|
||||
Cache::put('settingsGlobal', $settingsGlobal);
|
||||
return redirect()
|
||||
->route('bo.settings.edit', $settings)
|
||||
->with('success', trans(
|
||||
'crud.messages.has_been_updated',
|
||||
['model' => Str::singular(__('models.classes.settings'))]
|
||||
));
|
||||
}
|
||||
|
||||
$settings->name = $name;
|
||||
$settings->start_date = $startDate;
|
||||
$settings->end_date = $endDate;
|
||||
$settings->nb_participation_player = $nbParticipationPlayer;
|
||||
$settings->nb_participation_ip = $nbParticipationIp;
|
||||
$settings->nb_unique_code_use = $nbUniqueCodeUse;
|
||||
$settings->use_ean_codes = $useEanCodes;
|
||||
$settings->activated_teaser = $activatedTeaser;
|
||||
if ($activatedTeaser === 1) {
|
||||
$settings->teaser_end_activity = Carbon::parse($teaserEndActivity);
|
||||
}
|
||||
$settings->activated_close_page = $activatedClosePage;
|
||||
if ($activatedClosePage === 1) {
|
||||
$settings->close_page_active_date = Carbon::parse($closePageActiveDate);
|
||||
}
|
||||
$settings->redirect_close = $redirectClose;
|
||||
$settings->reductions_activated = $reductionsActivated;
|
||||
if ($reductionsActivated === 1) {
|
||||
$settings->reductions_site = $reductionsSite;
|
||||
$settings->reductions_campaign = $reductionsCampaign;
|
||||
$settings->web_coupons = $webCoupons;
|
||||
}
|
||||
$settings->facebook_activated = $facebookActivated;
|
||||
$settings->facebook_app_id = $facebookAppId;
|
||||
$settings->facebook_secret = $facebookSecret;
|
||||
$settings->notification_emails = $notificationEmails;
|
||||
$settings->winning_proof = $winningProof;
|
||||
$settings->company = $company;
|
||||
$settings->analytics = $analytics;
|
||||
|
||||
$settings->save();
|
||||
|
||||
$settingsGlobal = app(Settings::class)
|
||||
->select('name', 'company', 'analytics', 'start_date', 'end_date')->first();
|
||||
Cache::put('settingsGlobal', $settingsGlobal);
|
||||
|
||||
$success = "Modifications enregistrés !";
|
||||
|
||||
return view('bo.settings.manage', compact('settings', 'success'));
|
||||
}//end if
|
||||
|
||||
return view('bo.settings.manage', compact('settings'));
|
||||
return redirect()
|
||||
->back()
|
||||
->with('error', trans(
|
||||
'crud.messages.cannot_be_updated',
|
||||
['model' => Str::singular(__('models.classes.settings'))]
|
||||
));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,115 +3,34 @@
|
|||
namespace App\Http\Controllers\Bo;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Mail\CourrierArcadiaError;
|
||||
use App\Models\Participation;
|
||||
use App\Models\Settings;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
|
||||
class WinnersListController extends Controller
|
||||
{
|
||||
private $apiCrm;
|
||||
|
||||
public function __construct()
|
||||
/**
|
||||
* 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
|
||||
{
|
||||
$this->apiCrm = new \LDCCRM\ApiV1(config('crm.endpoint'), config('crm.token'));
|
||||
}
|
||||
/** @var \Illuminate\Database\Eloquent\Builder $rangeModels */
|
||||
$participationModels = Participation::has('instantWin');
|
||||
|
||||
public function index()
|
||||
{
|
||||
$winnersList = Participation::has('instantWin')->get();
|
||||
$settings = Settings::select('use_ean_codes', 'winning_proof')->first();
|
||||
return view('bo.winners-list.index', compact('winnersList', 'settings'));
|
||||
}
|
||||
/** Sort columns with a query */
|
||||
$this->sortQuery($participationModels);
|
||||
|
||||
public function courrierArcadia($id)
|
||||
{
|
||||
$participation = Participation::findOrFail($id);
|
||||
/** Custom pagination */
|
||||
$participationModels = $this->customPaginate($participationModels, $request->pagination);
|
||||
|
||||
$crmUser = $this->apiCrm->getCustomer($participation->user->crm_id);
|
||||
if ($crmUser->status === 'NOK') {
|
||||
return back()->withErrors("Erreur lors de la récupération de l'utilisateur dans la CRM : Code : " .
|
||||
$crmUser->code . " Message : " . $crmUser->message);
|
||||
}
|
||||
$settings = Settings::select('use_ean_codes', 'winning_proof')->first();
|
||||
|
||||
$crmId = $participation->user->crm_id;
|
||||
|
||||
$crmUser = $crmUser->user;
|
||||
|
||||
$corps = '<arcadia>' . "\n";
|
||||
$corps .= '<Commande> ' . "\n";
|
||||
$corps .= "\t" . '<Num_Commande></Num_Commande>' . "\n";
|
||||
$corps .= "\t" . '<Date_Commande>' . date('d/m/Y') . '</Date_Commande>' . "\n";
|
||||
$corps .= "\t" . '<Operation></Operation> ' . "\n";
|
||||
$corps .= "\t" . '<Civilite></Civilite>' . "\n";
|
||||
$corps .= "\t" . '<Nom><![CDATA[' . trim($crmUser->firstname) . ']]></Nom>' . "\n";
|
||||
$corps .= "\t" . '<Prenom><![CDATA[' . trim($crmUser->lastname) . ']]></Prenom>' . "\n";
|
||||
$corps .= "\t" . '<Adresse><![CDATA[' . trim($crmUser->address) . ']]></Adresse>' . "\n";
|
||||
$corps .= "\t" . '<Adresse_Complementaire><![CDATA[' . trim($crmUser->address2) . ']]></Adresse_Complementaire>' . "\n";
|
||||
$corps .= "\t" . '<CP><![CDATA[' . trim($crmUser->postcode) . ']]></CP>' . "\n";
|
||||
$corps .= "\t" . '<Ville><![CDATA[' . trim($crmUser->city) . ']]></Ville>' . "\n";
|
||||
$corps .= '<Ligne_de_Commande>' . "\n";
|
||||
$corps .= "\t" . '<Code_Support></Code_Support> ' . "\n";
|
||||
$corps .= "\t" . '<Libelle_Type_Support></Libelle_Type_Support> ' . "\n";
|
||||
$corps .= "\t" . '<Quantite>1</Quantite>' . "\n";
|
||||
$corps .= "\t" . '<Poids_Unitaire_Colis></Poids_Unitaire_Colis>' . "\n";
|
||||
$corps .= '</Ligne_de_Commande>' . "\n";
|
||||
$corps .= '</Commande> ' . "\n";
|
||||
$corps .= '</arcadia>';
|
||||
|
||||
return view('bo.winners-list.arcadia', compact('participation', 'corps', 'crmId'));
|
||||
}
|
||||
|
||||
public function createCourrierArcadia(Request $request, $id)
|
||||
{
|
||||
$participation = Participation::findOrFail($id);
|
||||
$instantWin = $participation->instantWin;
|
||||
|
||||
if ($instantWin->prize->arcadia_operation_code !== 0 && $instantWin->prize->arcadia_support_code !== 0) {
|
||||
$fields = [
|
||||
'root' => [
|
||||
[
|
||||
'fieldName' => 'order_date',
|
||||
'fieldValue' => date('d/m/Y')
|
||||
],
|
||||
[
|
||||
'fieldName' => 'operation',
|
||||
'fieldValue' => $instantWin->prize->arcadia_operation_code
|
||||
]
|
||||
],
|
||||
'orderLine' => [
|
||||
[
|
||||
'fieldName' => 'code_unique',
|
||||
'fieldValue' => $participation->code->code_unique
|
||||
],
|
||||
[
|
||||
'fieldName' => 'support_code',
|
||||
'fieldValue' => $instantWin->prize->arcadia_support_code
|
||||
],
|
||||
[
|
||||
'fieldName' => 'label_type_support',
|
||||
'fieldValue' => 'Gain du lot : ' . $instantWin->prize->label_one
|
||||
]
|
||||
]
|
||||
];
|
||||
|
||||
/** @var \App\Models\Settings $settings */
|
||||
$settings = app(Settings::class);
|
||||
if ($settings->use_ean_codes === 1) {
|
||||
$fields['orderLine'][] = [
|
||||
'fieldName' => 'code_on_pack',
|
||||
'fieldValue' => $participation->codeEan->code
|
||||
];
|
||||
}
|
||||
|
||||
$arcadiaMail = $this->apiCrm->ArcadiaOutgoingMail($participation->user->crm_id, $fields, 'game');
|
||||
if ($arcadiaMail->status === 'NOK') {
|
||||
Mail::to(config('mail.MAIL_ADMIN'))->send(new CourrierArcadiaError($participation->user));
|
||||
return back()->withErrors("Erreur lors de l'envoi du courrier Arcadia. Code : " .
|
||||
$arcadiaMail->code . " Message : " . $arcadiaMail->message);
|
||||
}
|
||||
}//end if
|
||||
return back()->with('success', 'Courrier envoyé !');
|
||||
return view('bo.pages.winners-list.index', compact(
|
||||
'participationModels',
|
||||
'settings'
|
||||
));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
105
app/Http/Requests/Bo/Settings/UpdateSettingsRequest.php
Normal file
105
app/Http/Requests/Bo/Settings/UpdateSettingsRequest.php
Normal file
|
|
@ -0,0 +1,105 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Requests\Bo\Settings;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class UpdateSettingsRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return auth()->check();
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare the data for validation.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function prepareForValidation()
|
||||
{
|
||||
$this->merge([
|
||||
// Checkboxes.
|
||||
'use_ean_codes' => $this->use_ean_codes ? true : false,
|
||||
'activated_teaser' => $this->activated_teaser ? true : false,
|
||||
'activated_close_page' => $this->activated_close_page ? true : false,
|
||||
'reductions_activated' => $this->reductions_activated ? true : false,
|
||||
'winning_proof' => $this->winning_proof ? true : false,
|
||||
// Arrays.
|
||||
'notification_emails' => $this->notification_emails ? json_decode($this->notification_emails, true) : [],
|
||||
// Remove some dates if the checkbox is uncheck.
|
||||
'teaser_end_activity' => $this->activated_teaser ? $this->teaser_end_activity : null,
|
||||
'close_page_active_date' => $this->activated_close_page ? $this->close_page_active_date : null,
|
||||
// Remove reductions datas if the reduction checkbox is uncheck.
|
||||
'reductions_site' => $this->reductions_activated ? $this->reductions_site : null,
|
||||
'reductions_campaign' => $this->reductions_activated ? $this->reductions_campaign : null,
|
||||
'web_coupons' => $this->reductions_activated ?
|
||||
($this->web_coupons ? json_decode($this->web_coupons, true) : []) :
|
||||
[],
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'name' => 'required|string|min:3|max:255',
|
||||
'start_date' => 'required|date',
|
||||
'end_date' => 'required|date',
|
||||
'nb_participation_player' => 'required|numeric|min:0',
|
||||
'nb_participation_ip' => 'required|numeric|min:0',
|
||||
'nb_unique_code_use' => 'required|numeric|min:0',
|
||||
'use_ean_codes' => 'required|boolean',
|
||||
'activated_teaser' => 'required|boolean',
|
||||
'teaser_end_activity' => 'nullable|required_if:activated_teaser,true,1|date|after_or_equal:today',
|
||||
'activated_close_page' => 'required|boolean',
|
||||
'close_page_active_date' => 'nullable|required_if:activated_close_page,true,1|date|after_or_equal:today',
|
||||
'redirect_close' => 'required|url:http,https',
|
||||
'reductions_activated' => 'required|boolean',
|
||||
'reductions_site' => 'nullable|required_if:reductions_activated,true,1|string|min:3|max:255',
|
||||
'reductions_campaign' => 'nullable|required_if:reductions_activated,true,1|string|min:3|max:255',
|
||||
'web_coupons' => [
|
||||
'nullable',
|
||||
'required_if:reductions_activated,true,1',
|
||||
'present',
|
||||
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClassBeforeLastUsed
|
||||
'array',
|
||||
],
|
||||
'web_coupons.*' => 'nullable|array',
|
||||
'web_coupons.*.web_coupon_identifiant' => 'required|string|min:3|max:255',
|
||||
'web_coupons.*.percentage' => 'required|numeric|min:0|max:100',
|
||||
'web_coupons.*.face_value' => 'required|string|min:3|max:255',
|
||||
'web_coupons.*.valid_on' => 'required|string|min:3|max:255',
|
||||
'web_coupons.*.img_name' => 'required|string|min:3|max:255',
|
||||
'notification_emails' => 'nullable|array',
|
||||
'notification_emails.*' => 'nullable|array',
|
||||
'notification_emails.*.email' => 'required|email',
|
||||
'winning_proof' => 'required|boolean',
|
||||
'company' => 'required|string|min:3|max:255',
|
||||
'analytics' => 'nullable|numeric|min:1',
|
||||
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get custom attributes for validator errors.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function attributes(): array
|
||||
{
|
||||
return [
|
||||
'name' => trans('Nom de la page de gain'),
|
||||
'file_name' => trans('Nom du fchier'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -6,6 +6,34 @@ use Illuminate\Database\Eloquent\Model;
|
|||
|
||||
class Settings extends Model
|
||||
{
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'start_date',
|
||||
'end_date',
|
||||
'nb_participation_player',
|
||||
'nb_participation_ip',
|
||||
'nb_unique_code_use',
|
||||
'use_ean_codes',
|
||||
'activated_teaser',
|
||||
'teaser_end_activity',
|
||||
'activated_close_page',
|
||||
'close_page_active_date',
|
||||
'redirect_close',
|
||||
'reductions_activated',
|
||||
'reductions_site',
|
||||
'reductions_campaign',
|
||||
'web_coupons',
|
||||
'notification_emails',
|
||||
'winning_proof',
|
||||
'company',
|
||||
'analytics',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*
|
||||
|
|
@ -14,5 +42,7 @@ class Settings extends Model
|
|||
protected $casts = [
|
||||
'start_date' => 'datetime',
|
||||
'end_date' => 'datetime',
|
||||
'teaser_end_activity' => 'datetime',
|
||||
'close_page_active_date' => 'datetime',
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,9 +33,6 @@ class CreateSettings extends Migration
|
|||
$table->string('reductions_site')->nullable();
|
||||
$table->string('reductions_campaign')->nullable();
|
||||
$table->text('web_coupons')->nullable();
|
||||
$table->boolean('facebook_activated');
|
||||
$table->string('facebook_app_id')->nullable();
|
||||
$table->string('facebook_secret')->nullable();
|
||||
$table->text('notification_emails')->nullable();
|
||||
$table->boolean('winning_proof');
|
||||
$table->string('company');
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ class CreateParticipations extends Migration
|
|||
$table->string('sticker')->nullable();
|
||||
$table->string('ticket')->nullable();
|
||||
$table->string('barcode')->nullable();
|
||||
$table->foreignId('user_id')->constrained('users');
|
||||
$table->foreignId('customer_id')->constrained('customers');
|
||||
$table->foreignId('code_unique_id')->constrained('codes');
|
||||
$table->foreignId('code_ean_id')->nullable()->constrained('code_eans');
|
||||
$table->foreignId('reduction_id')->nullable()->constrained('reductions');
|
||||
|
|
|
|||
|
|
@ -11,5 +11,7 @@ return [
|
|||
'prizes' => 'Lots',
|
||||
'ranges' => 'Gammes',
|
||||
'products' => 'Produits',
|
||||
'winners' => 'Gagnants',
|
||||
'settings' => 'Réglages',
|
||||
]
|
||||
];
|
||||
|
|
|
|||
|
|
@ -192,7 +192,25 @@ return [
|
|||
'pdf_winning_proof' => 'pdf preuve de gain',
|
||||
'need_proof' => 'preuve de gain obligatoire',
|
||||
'picture' => 'illustration',
|
||||
'no_art' => 'Numéro d\'article',
|
||||
'ean_code' => 'Code EAN',
|
||||
'no_art' => 'numéro d\'article',
|
||||
'ean_code' => 'code EAN',
|
||||
'start_date' => 'date de début',
|
||||
'end_date' => 'date de fin',
|
||||
'nb_participation_player' => 'nombre de participation par joueur ',
|
||||
'nb_participation_ip' => 'nombre de participation par adresse IP',
|
||||
'nb_unique_code_use' => 'nombre d\'utilisation du code unique',
|
||||
'code_length' => 'longueur des code uniques',
|
||||
'use_ean_codes' => 'activer les codes EAN',
|
||||
'activated_teaser' => 'activation du teaser',
|
||||
'teaser_end_activity' => 'teaser actif jusqu\'au',
|
||||
'activated_close_page' => 'activation page de fermeture',
|
||||
'close_page_active_date' => 'page active jusqu\'au',
|
||||
'redirect_close' => 'url de redirection après la date de fin du jeu',
|
||||
'winning_proof' => 'activer les preuves de gain',
|
||||
'company' => 'société',
|
||||
'reductions_activated' => 'activer les bons de réduction',
|
||||
'reductions_site' => 'référence du site',
|
||||
'reductions_campaign' => 'référence de la campagne',
|
||||
'analytics' => 'analytics'
|
||||
],
|
||||
];
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
<tbody id="emails">
|
||||
<tr
|
||||
v-for="(item, index) in datas"
|
||||
:key="Number(item.id)"
|
||||
:key="Number(index)"
|
||||
>
|
||||
<td>{{ index + 1 }}</td>
|
||||
<td>
|
||||
|
|
@ -84,7 +84,8 @@
|
|||
<small
|
||||
v-show="totalPercentage > 100"
|
||||
class="text-danger"
|
||||
>Poucentage total > 100%</small>
|
||||
>
|
||||
Poucentage total › 100%</small>
|
||||
<a
|
||||
class="btn btn-primary btn-sm text-white"
|
||||
@click="newItem"
|
||||
|
|
@ -109,18 +110,15 @@ export default defineComponent({
|
|||
const json = String(this.$attrs.json ?? "{}"),
|
||||
data = JSON.parse(json);
|
||||
this.datas = JSON.parse(data.dbdatas);
|
||||
},
|
||||
props: {
|
||||
name: {
|
||||
type: String,
|
||||
default: ""
|
||||
}
|
||||
this.name = data.name;
|
||||
},
|
||||
data(): {
|
||||
datas: LaravelModelList;
|
||||
datas: Record<any, any>;
|
||||
name: string,
|
||||
} {
|
||||
return {
|
||||
datas: []
|
||||
datas: [],
|
||||
name: "",
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
|
|
@ -139,7 +137,7 @@ export default defineComponent({
|
|||
computed: {
|
||||
totalPercentage() {
|
||||
let total = 0;
|
||||
this.datas.forEach(element => total += parseInt(String(element.percentage)));
|
||||
this.datas.forEach((element: Record<string, number|string>) => total += parseInt(String(element.percentage)));
|
||||
return total;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,28 +67,23 @@
|
|||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
export default {
|
||||
import { defineComponent } from "vue";
|
||||
|
||||
export default defineComponent({
|
||||
mounted() {
|
||||
console.log("WinNotification Component mounted.");
|
||||
const json = String(this.$attrs.json ?? "{}"),
|
||||
data = JSON.parse(json);
|
||||
this.datas = JSON.parse(data.dbdatas);
|
||||
},
|
||||
props: {
|
||||
name: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
dbdatas: {
|
||||
type: Array,
|
||||
default: null
|
||||
}
|
||||
this.name = data.name;
|
||||
},
|
||||
data(): {
|
||||
datas: Record<any, any>
|
||||
datas: Record<any, any>,
|
||||
name: string,
|
||||
} {
|
||||
return {
|
||||
datas: []
|
||||
datas: [],
|
||||
name: ""
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
|
|
@ -104,5 +99,5 @@ export default {
|
|||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -7,5 +7,5 @@
|
|||
'instantwin' => $instant_win
|
||||
]
|
||||
@endphp
|
||||
<div id="instantWinComponent" data-json='@json($data)'></div>
|
||||
<div class="instant-win" data-json='@json($data)'></div>
|
||||
@endsection
|
||||
|
|
|
|||
|
|
@ -10,11 +10,11 @@
|
|||
</li>
|
||||
@superadmin
|
||||
<li class="nav-item">
|
||||
<a class="nav-link @if(request()->routeIs('bo.settings')) active @endif"
|
||||
href="{{ route('bo.settings') }}"
|
||||
title="{{ __('Réglages') }}"
|
||||
<a class="nav-link @if(request()->routeIs('bo.settings.*')) active @endif"
|
||||
href="{{ route('bo.settings.edit', \App\Models\Settings::first()) }}"
|
||||
title="{{ __('models.classes.settings') }}"
|
||||
data-bs-toggle="tooltip">
|
||||
{{ __('Réglages') }}
|
||||
{{ __('models.classes.settings') }}
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item dropdown">
|
||||
|
|
@ -40,14 +40,6 @@
|
|||
</a>
|
||||
</li>
|
||||
@endsuperadmin
|
||||
<li class="nav-item">
|
||||
<a class="nav-link @if(request()->routeIs('bo.code-eans.*')) active @endif"
|
||||
href="{{ route('bo.code-eans.index') }}"
|
||||
title="{{ __('Codes EAN') }}"
|
||||
data-bs-toggle="tooltip">
|
||||
{{ __('Codes EAN') }}
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link @if(request()->routeIs('bo.ranges.*')) active @endif"
|
||||
href="{{ route('bo.ranges.index') }}"
|
||||
|
|
@ -121,17 +113,5 @@
|
|||
</a>
|
||||
</li>
|
||||
@endsuperadmin
|
||||
<li class="nav-item">
|
||||
<a class="nav-link"
|
||||
href="{{ route('home') }}"
|
||||
target="_blank"
|
||||
title="{{ __('Aller sur le jeu') }}"
|
||||
data-bs-toggle="tooltip">
|
||||
{{ __('Aller sur le jeu') }}
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
@endauth
|
||||
|
||||
{{-- FIXME A REMOVE ? --}}
|
||||
{{-- <a class="btn bg-transparent text-left" href="#_">{{ __('Social share') }}</a> --}}
|
||||
|
|
|
|||
48
resources/views/bo/pages/settings/edit.blade.php
Normal file
48
resources/views/bo/pages/settings/edit.blade.php
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
@extends('bo.layout', ['brParam' => $settingsModel])
|
||||
|
||||
@section('title', __('Édition d\'une :model', ['model' => Str::singular(__('models.classes.settings'))]))
|
||||
@section('description', __('Édition d\'une :model déjà existante', ['model' => Str::singular(__('models.classes.settings'))]))
|
||||
@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">
|
||||
@include('breadcrumbs.breadcrumb-body', ['brParam' => $settingsModel])
|
||||
</div>
|
||||
<div class="mb-2 mb-md-0">
|
||||
<form action="{{ route('bo.settings.update', $settingsModel->id) }}"
|
||||
method="POST"
|
||||
class="confirmDeleteTS">
|
||||
@csrf
|
||||
@method('PUT')
|
||||
<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' => Str::singular(__('models.classes.settings'))]) }}">
|
||||
{{ __('crud.actions.save') }}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<form action="{{ route('bo.settings.update', $settingsModel->id) }}" method="POST" enctype="multipart/form-data">
|
||||
@csrf
|
||||
@method('PUT')
|
||||
@include('bo.pages.settings.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' => Str::singular(__('models.classes.settings'))]) }}">
|
||||
{{ __('crud.actions.save') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
@endsection
|
||||
538
resources/views/bo/pages/settings/form-inputs.blade.php
Normal file
538
resources/views/bo/pages/settings/form-inputs.blade.php
Normal file
|
|
@ -0,0 +1,538 @@
|
|||
<h5 class="card-subtitle mb-3">
|
||||
{{ __('Général') }}<br/>
|
||||
<small class="text-muted">{{ __('Paramètres généraux du jeu') }}</small>
|
||||
</h5>
|
||||
|
||||
<div class="row">
|
||||
{{-- NAME --}}
|
||||
<div class="col-12 col-md-6 mb-3">
|
||||
<fieldset class="border h-100 bg-white p-3">
|
||||
<legend>{{ Str::ucfirst(__('validation.attributes.name')) }}</legend>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
@include('bo.partials.inputs.varchar', [
|
||||
'id' => 'settingsName',
|
||||
'label' => Str::ucfirst(__('validation.attributes.name')),
|
||||
'hasWordCounter' => true,
|
||||
'name' => 'name',
|
||||
'required' => true,
|
||||
'model' => $settingsModel ?? null,
|
||||
'helper' => __('validation.between.string', [
|
||||
'attribute' => __(':field du jeu', [
|
||||
'field' => Str::ucfirst(__('validation.attributes.name')),
|
||||
]),
|
||||
'min' => 3,
|
||||
'max' => 255
|
||||
]),
|
||||
'placeholder' => __(':field du jeu', [
|
||||
'field' => Str::ucfirst(__('validation.attributes.name')),
|
||||
]),
|
||||
])
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
{{-- START_DATE --}}
|
||||
<div class="col-12 col-md-6 mb-3">
|
||||
<fieldset class="border h-100 bg-white p-3">
|
||||
<legend>{{ Str::ucfirst(__('validation.attributes.start_date')) }}</legend>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
@include('bo.partials.inputs.timestamp-datetime', [
|
||||
'id' => 'settingsStartDate',
|
||||
'label' => Str::ucfirst(__('validation.attributes.start_date')),
|
||||
'name' => 'start_date',
|
||||
'defaultValue' => true,
|
||||
'required' => true,
|
||||
'model' => $settingsModel ?? null,
|
||||
'helper' => __('La date doit être supérieure ou égale à aujourd\'hui.'),
|
||||
])
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
{{-- END_DATE --}}
|
||||
<div class="col-12 col-md-6 mb-3">
|
||||
<fieldset class="border h-100 bg-white p-3">
|
||||
<legend>{{ Str::ucfirst(__('validation.attributes.end_date')) }}</legend>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
@include('bo.partials.inputs.timestamp-datetime', [
|
||||
'id' => 'settingsEndDate',
|
||||
'label' => Str::ucfirst(__('validation.attributes.end_date')),
|
||||
'name' => 'end_date',
|
||||
'defaultValue' => true,
|
||||
'required' => true,
|
||||
'model' => $settingsModel ?? null,
|
||||
'helper' => __('La date doit être supérieure ou égale à aujourd\'hui.'),
|
||||
])
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
{{-- NB_PARTICIPATION_PLAYER --}}
|
||||
<div class="col-12 col-md-6 mb-3">
|
||||
<fieldset class="border h-100 bg-white p-3">
|
||||
<legend>{{ Str::ucfirst(__('validation.attributes.nb_participation_player')) }}</legend>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
@include('bo.partials.inputs.int-number', [
|
||||
'id' => 'settingsNbParticipationPlayer',
|
||||
'label' => Str::ucfirst(__('validation.attributes.nb_participation_player')),
|
||||
'name' => 'nb_participation_player',
|
||||
'required' => true,
|
||||
'model' => $settingsModel ?? null,
|
||||
'helper' => __('validation.min.numeric', [
|
||||
'attribute' => Str::ucfirst(__('validation.attributes.nb_participation_player')),
|
||||
'min' => 0
|
||||
]),
|
||||
'min' => 0
|
||||
])
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
{{-- NB_PARTICIPATION_IP --}}
|
||||
<div class="col-12 col-md-6 mb-3">
|
||||
<fieldset class="border h-100 bg-white p-3">
|
||||
<legend>{{ Str::ucfirst(__('validation.attributes.nb_participation_ip')) }}</legend>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
@include('bo.partials.inputs.int-number', [
|
||||
'id' => 'settingsNbParticipationIp',
|
||||
'label' => Str::ucfirst(__('validation.attributes.nb_participation_ip')),
|
||||
'name' => 'nb_participation_ip',
|
||||
'required' => true,
|
||||
'model' => $settingsModel ?? null,
|
||||
'helper' => __('validation.min.numeric', [
|
||||
'attribute' => Str::ucfirst(__('validation.attributes.nb_participation_ip')),
|
||||
'min' => 0
|
||||
]),
|
||||
'min' => 0
|
||||
])
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
{{-- NB_UNIQUE_CODE_USE --}}
|
||||
<div class="col-12 col-md-6 mb-3">
|
||||
<fieldset class="border h-100 bg-white p-3">
|
||||
<legend>{{ Str::ucfirst(__('validation.attributes.nb_unique_code_use')) }}</legend>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
@include('bo.partials.inputs.int-number', [
|
||||
'id' => 'settingsNbUniqueCodeUse',
|
||||
'label' => Str::ucfirst(__('validation.attributes.nb_unique_code_use')),
|
||||
'name' => 'nb_unique_code_use',
|
||||
'required' => true,
|
||||
'model' => $settingsModel ?? null,
|
||||
'helper' => __('validation.min.numeric', [
|
||||
'attribute' => Str::ucfirst(__('validation.attributes.nb_unique_code_use')),
|
||||
'min' => 0
|
||||
]),
|
||||
'min' => 0
|
||||
])
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
{{-- CODE_LENGTH --}}
|
||||
<div class="col-12 col-md-6 mb-3">
|
||||
<fieldset class="border h-100 bg-white p-3">
|
||||
<legend>{{ Str::ucfirst(__('validation.attributes.code_length')) }}</legend>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
@include('bo.partials.inputs.int-number', [
|
||||
'id' => 'settingsCodeLength',
|
||||
'label' => Str::ucfirst(__('validation.attributes.code_length')),
|
||||
'name' => 'code_length',
|
||||
'required' => false,
|
||||
'disabled' => true,
|
||||
'model' => $settingsModel ?? null,
|
||||
'helper' => __('Cette valeur ne doit pas varier en cours de jeu.'),
|
||||
'min' => 0
|
||||
])
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
{{-- USE_EAN_CODES --}}
|
||||
<div class="col-12 col-md-6 mb-3">
|
||||
<fieldset class="border h-100 bg-white p-3">
|
||||
<legend>{{ Str::ucfirst(__('validation.attributes.use_ean_codes')) }}</legend>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
@include('bo.partials.inputs.tinyint-boolean', [
|
||||
'id' => 'settingsUseEANCodes',
|
||||
'label' => Str::ucfirst(__('validation.attributes.use_ean_codes')),
|
||||
'name' => 'use_ean_codes',
|
||||
'required' => false,
|
||||
'model' => $settingsModel ?? null,
|
||||
'helper' => __('validation.boolean', [
|
||||
'attribute' => Str::ucfirst(__('validation.attributes.use_ean_codes')),
|
||||
]),
|
||||
])
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
{{-- ACTIVATED_TEASER --}}
|
||||
<div class="col-12 col-md-6 mb-3">
|
||||
<fieldset class="border h-100 bg-white p-3">
|
||||
<legend>{{ Str::ucfirst(__('validation.attributes.activated_teaser')) }}</legend>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
@include('bo.partials.inputs.tinyint-boolean', [
|
||||
'id' => 'settingsActivatedTeaser',
|
||||
'label' => Str::ucfirst(__('validation.attributes.activated_teaser')),
|
||||
'name' => 'activated_teaser',
|
||||
'required' => false,
|
||||
'model' => $settingsModel ?? null,
|
||||
'helper' => __('validation.boolean', [
|
||||
'attribute' => Str::ucfirst(__('validation.attributes.activated_teaser')),
|
||||
]),
|
||||
])
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
{{-- TEASER_END_ACTIVITY --}}
|
||||
<div class="col-12 col-md-6 mb-3" id="teaser_end_activity">
|
||||
<fieldset class="border h-100 bg-white p-3">
|
||||
<legend>{{ Str::ucfirst(__('validation.attributes.teaser_end_activity')) }}</legend>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
@include('bo.partials.inputs.timestamp-datetime', [
|
||||
'id' => 'settingsTeaserEndActivity',
|
||||
'label' => Str::ucfirst(__('validation.attributes.teaser_end_activity')),
|
||||
'name' => 'teaser_end_activity',
|
||||
'defaultValue' => false,
|
||||
'required' => true,
|
||||
'model' => $settingsModel ?? null,
|
||||
'helper' => __('La date doit être supérieure ou égale à aujourd\'hui.'),
|
||||
])
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
{{-- ACTIVATED_CLOSE_PAGE --}}
|
||||
<div class="col-12 col-md-6 mb-3">
|
||||
<fieldset class="border h-100 bg-white p-3">
|
||||
<legend>{{ Str::ucfirst(__('validation.attributes.activated_close_page')) }}</legend>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
@include('bo.partials.inputs.tinyint-boolean', [
|
||||
'id' => 'settingsActivatedClosePage',
|
||||
'label' => Str::ucfirst(__('validation.attributes.activated_close_page')),
|
||||
'name' => 'activated_close_page',
|
||||
'required' => false,
|
||||
'model' => $settingsModel ?? null,
|
||||
'helper' => __('validation.boolean', [
|
||||
'attribute' => Str::ucfirst(__('validation.attributes.activated_close_page')),
|
||||
]),
|
||||
])
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
{{-- CLOSE_PAGE_ACTIVE_DATE --}}
|
||||
<div class="col-12 col-md-6 mb-3" id="close_page_active_date">
|
||||
<fieldset class="border h-100 bg-white p-3">
|
||||
<legend>{{ Str::ucfirst(__('validation.attributes.close_page_active_date')) }}</legend>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
@include('bo.partials.inputs.timestamp-datetime', [
|
||||
'id' => 'settingsClosePageActiveDate',
|
||||
'label' => __('Page active jusqu\'au'),
|
||||
'name' => 'close_page_active_date',
|
||||
'defaultValue' => false,
|
||||
'required' => true,
|
||||
'model' => $settingsModel ?? null,
|
||||
'helper' => __('La date doit être supérieure ou égale à aujourd\'hui.'),
|
||||
])
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
{{-- REDIRECT_CLOSE --}}
|
||||
<div class="col-12 col-md-6 mb-3">
|
||||
<fieldset class="border h-100 bg-white p-3">
|
||||
<legend>{{ Str::ucfirst(__('validation.attributes.redirect_close')) }}</legend>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
@include('bo.partials.inputs.varchar', [
|
||||
'id' => 'settingsRedirectClose',
|
||||
'label' => __('URL de redirection après la date de fin du jeu'),
|
||||
'hasWordCounter' => true,
|
||||
'name' => 'redirect_close',
|
||||
'required' => true,
|
||||
'model' => $settingsModel ?? null,
|
||||
'helper' => __('crud.minicrud.url'),
|
||||
'placeholder' => 'https://example.test',
|
||||
])
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
{{-- WINNING_PROOF --}}
|
||||
<div class="col-12 col-md-6 mb-3">
|
||||
<fieldset class="border h-100 bg-white p-3">
|
||||
<legend>{{ Str::ucfirst(__('validation.attributes.winning_proof')) }}</legend>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
@include('bo.partials.inputs.tinyint-boolean', [
|
||||
'id' => 'settingsReductionsActivated',
|
||||
'label' => Str::ucfirst(__('validation.attributes.winning_proof')),
|
||||
'name' => 'winning_proof',
|
||||
'required' => false,
|
||||
'model' => $settingsModel ?? null,
|
||||
'helper' => __('validation.boolean', [
|
||||
'attribute' => Str::ucfirst(__('validation.attributes.winning_proof')),
|
||||
]),
|
||||
])
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
{{-- COMPANY --}}
|
||||
<div class="col-12 col-md-6 mb-3">
|
||||
<fieldset class="border h-100 bg-white p-3">
|
||||
<legend>{{ Str::ucfirst(__('validation.attributes.company')) }}</legend>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
@include('bo.partials.inputs.varchar', [
|
||||
'id' => 'settingsCompany',
|
||||
'label' => __('Nom de la :field', [
|
||||
'field' => Str::ucfirst(__('validation.attributes.company')),
|
||||
]),
|
||||
'hasWordCounter' => true,
|
||||
'name' => 'company',
|
||||
'required' => true,
|
||||
'model' => $settingsModel ?? null,
|
||||
'helper' => __('validation.between.string', [
|
||||
'attribute' => __('Nom de la :field', [
|
||||
'field' => Str::ucfirst(__('validation.attributes.company')),
|
||||
]),
|
||||
'min' => 3,
|
||||
'max' => 255
|
||||
]),
|
||||
'placeholder' => __(':field', [
|
||||
'field' => Str::ucfirst(__('validation.attributes.company')),
|
||||
]),
|
||||
])
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
<h5 class="card-subtitle mb-3">
|
||||
{{ __('Les réductions') }}<br/>
|
||||
<small class="text-muted">{{ __('Paramétrages des bons de réduction MLDC') }}</small>
|
||||
</h5>
|
||||
|
||||
<div class="row">
|
||||
{{-- REDUCTIONS_ACTIVATED --}}
|
||||
<div class="col-12 col-md-6 mb-3">
|
||||
<fieldset class="border h-100 bg-white p-3">
|
||||
<legend>{{ Str::ucfirst(__('validation.attributes.reductions_activated')) }}</legend>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
@include('bo.partials.inputs.tinyint-boolean', [
|
||||
'id' => 'settingsReductionsActivated',
|
||||
'label' => Str::ucfirst(__('validation.attributes.reductions_activated')),
|
||||
'name' => 'reductions_activated',
|
||||
'required' => false,
|
||||
'model' => $settingsModel ?? null,
|
||||
'helper' => __('validation.boolean', [
|
||||
'attribute' => Str::ucfirst(__('validation.attributes.reductions_activated')),
|
||||
]),
|
||||
])
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
{{-- REDUCTIONS_SITE --}}
|
||||
<div class="col-12 col-md-6 mb-3" id="reductions_site">
|
||||
<fieldset class="border h-100 bg-white p-3">
|
||||
<legend>{{ Str::ucfirst(__('validation.attributes.reductions_site')) }}</legend>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
@include('bo.partials.inputs.varchar', [
|
||||
'id' => 'settingsReductionsSite',
|
||||
'label' => __('validation.attributes.reductions_site'),
|
||||
'hasWordCounter' => true,
|
||||
'name' => 'reductions_site',
|
||||
'required' => true,
|
||||
'model' => $settingsModel ?? null,
|
||||
'helper' => __('validation.between.string', [
|
||||
'attribute' => __('validation.attributes.reductions_site'),
|
||||
'min' => 3,
|
||||
'max' => 255
|
||||
]),
|
||||
'placeholder' => __('validation.attributes.reductions_site'),
|
||||
])
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
{{-- REDUCTIONS_CAMPAIGN --}}
|
||||
<div class="col-12 col-md-6 mb-3" id="reductions_campaign">
|
||||
<fieldset class="border h-100 bg-white p-3">
|
||||
<legend>{{ Str::ucfirst(__('validation.attributes.reductions_campaign')) }}</legend>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
@include('bo.partials.inputs.varchar', [
|
||||
'id' => 'settingsReductionsCampaign',
|
||||
'label' => __('validation.attributes.reductions_campaign'),
|
||||
'hasWordCounter' => true,
|
||||
'name' => 'reductions_campaign',
|
||||
'required' => true,
|
||||
'model' => $settingsModel ?? null,
|
||||
'helper' => __('validation.between.string', [
|
||||
'attribute' => __('validation.attributes.reductions_campaign'),
|
||||
'min' => 3,
|
||||
'max' => 255
|
||||
]),
|
||||
'placeholder' => __('validation.attributes.reductions_campaign'),
|
||||
])
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
{{-- WEB_COUPONS --}}
|
||||
@php
|
||||
$data = [
|
||||
'dbdatas' => $settingsModel->web_coupons,
|
||||
'name' => 'web_coupons'
|
||||
]
|
||||
@endphp
|
||||
<div class="web-coupons mb-3" data-json='@json($data)' id="reductions_web_coupons"></div>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
<h5 class="card-subtitle mb-3">
|
||||
{{ __('Destinataires des notifications de gain') }}<br/>
|
||||
<small class="text-muted">{{ __('Ces mails recevront toutes les notifications de gain.') }}</small>
|
||||
</h5>
|
||||
|
||||
<div class="row">
|
||||
{{-- NOTIFICATION_EMAILS --}}
|
||||
@php
|
||||
$data = [
|
||||
'dbdatas' => $settingsModel->notification_emails,
|
||||
'name' => 'notification_emails'
|
||||
]
|
||||
@endphp
|
||||
<div class="win-notification mb-3" data-json='@json($data)'></div>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
<h5 class="card-subtitle mb-3">
|
||||
{{ __('Analytics') }}<br/>
|
||||
<small class="text-muted">{{ __('Saississez les informations permettant d\'établir des statistiques pour le jeu.') }}</small>
|
||||
</h5>
|
||||
|
||||
<div class="row">
|
||||
{{-- ANALYTICS --}}
|
||||
<div class="col-12 col-md-6 mb-3">
|
||||
<fieldset class="border h-100 bg-white p-3">
|
||||
<legend>{{ Str::ucfirst(__('validation.attributes.analytics')) }}</legend>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
@include('bo.partials.inputs.int-number', [
|
||||
'id' => 'settingsanalytics',
|
||||
'label' => Str::ucfirst(__('Site ID')),
|
||||
'name' => 'analytics',
|
||||
'required' => false,
|
||||
'model' => $settingsModel ?? null,
|
||||
'helper' => __('Insérer ici l\'id du site pour Matomo'),
|
||||
'min' => 0
|
||||
])
|
||||
</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('');
|
||||
})
|
||||
|
||||
const inputReductionsActivated = document.querySelector('input[name=reductions_activated]');
|
||||
const inputActivatedTeaser = document.querySelector('input[name=activated_teaser]');
|
||||
const inputActivatedClosePage = document.querySelector('input[name=activated_close_page]');
|
||||
|
||||
const reductionsSite = document.getElementById('reductions_site');
|
||||
const reductionsCampaign = document.getElementById('reductions_campaign');
|
||||
const reductionsWebCoupons = document.getElementById('reductions_web_coupons');
|
||||
const reductionsWebCouponsInputs = reductionsWebCoupons.getElementsByTagName('input');
|
||||
if (!inputReductionsActivated.checked) {
|
||||
reductionsSite.style.display = "none";
|
||||
reductionsCampaign.style.display = "none";
|
||||
reductionsWebCoupons.style.display = "none";
|
||||
}
|
||||
const teaserEndActivity = document.getElementById('teaser_end_activity');
|
||||
if (!inputActivatedTeaser.checked) {
|
||||
teaserEndActivity.style.display = "none";
|
||||
}
|
||||
const closePageActiveDate = document.getElementById('close_page_active_date');
|
||||
if (!inputActivatedClosePage.checked) {
|
||||
closePageActiveDate.style.display = "none";
|
||||
}
|
||||
|
||||
// Gestion du tableau pour reduction
|
||||
inputReductionsActivated.addEventListener('change', () => {
|
||||
if (!inputReductionsActivated.checked) {
|
||||
reductionsSite.style.display = "none";
|
||||
reductionsCampaign.style.display = "none";
|
||||
reductionsWebCoupons.style.display = "none";
|
||||
document.getElementById('settingsReductionsSite').disabled = true;
|
||||
document.getElementById('settingsReductionsCampaign').disabled = true;
|
||||
Array.from(reductionsWebCouponsInputs).forEach(element => {
|
||||
element.disabled = true;
|
||||
});
|
||||
} else {
|
||||
reductionsSite.style.display = "";
|
||||
reductionsCampaign.style.display = "";
|
||||
reductionsWebCoupons.style.display = "";
|
||||
document.getElementById('settingsReductionsSite').disabled = false;
|
||||
document.getElementById('settingsReductionsCampaign').disabled = false;
|
||||
Array.from(reductionsWebCouponsInputs).forEach(element => {
|
||||
element.disabled = false;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Gestion de l'activation du teaser (champ date à afficher ou non)
|
||||
inputActivatedTeaser.addEventListener('change', () => {
|
||||
if (!inputActivatedTeaser.checked) {
|
||||
teaserEndActivity.style.display = "none";
|
||||
document.getElementById('settingsTeaserEndActivity').disabled = true;
|
||||
} else {
|
||||
teaserEndActivity.style.display = "";
|
||||
document.getElementById('settingsTeaserEndActivity').disabled = false;
|
||||
}
|
||||
});
|
||||
|
||||
// Gestion de l'activation de la page de fermeture (champ date à afficher ou non)
|
||||
inputActivatedClosePage.addEventListener('change', () => {
|
||||
if (!inputActivatedClosePage.checked) {
|
||||
closePageActiveDate.style.display = "none";
|
||||
document.getElementById('settingsClosePageActiveDate').disabled = true;
|
||||
} else {
|
||||
closePageActiveDate.style.display = "";
|
||||
document.getElementById('settingsClosePageActiveDate').disabled = false;
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
350
resources/views/bo/pages/settings/manage.blade.php
Normal file
350
resources/views/bo/pages/settings/manage.blade.php
Normal file
|
|
@ -0,0 +1,350 @@
|
|||
@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') }} <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
|
||||
72
resources/views/bo/pages/winners-list/index.blade.php
Normal file
72
resources/views/bo/pages/winners-list/index.blade.php
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
@extends('bo.layout')
|
||||
|
||||
@section('title', __('models.classes.winners'))
|
||||
@section('description', __('Liste de tous les :model', ['model' => __('models.classes.winners')]))
|
||||
|
||||
@section('content')
|
||||
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center">
|
||||
@include('breadcrumbs.breadcrumb-body')
|
||||
</div>
|
||||
<table class="table table-hover">
|
||||
@if (count($participationModels) > 0)
|
||||
<thead>
|
||||
@php
|
||||
$cols = [
|
||||
'created_at' => __('Date participation'),
|
||||
'prize' => __('Lot'),
|
||||
'email' => __('Email')
|
||||
];
|
||||
if ($settings->use_ean_codes === 1) {
|
||||
$cols['code_ean_id'] = __('Code EAN');
|
||||
}
|
||||
$cols['code_unique_id'] = __('Code unique');
|
||||
if ($settings->winning_proof === 1) {
|
||||
$cols['sticker'] = __('Sticker');
|
||||
$cols['barcode'] = __('Code barre');
|
||||
$cols['ticket'] = __('Ticket');
|
||||
}
|
||||
@endphp
|
||||
@include('bo.modules.table-col-sorter', [
|
||||
'cols' => $cols,
|
||||
'ignore' => ['sticker', 'barcode', 'ticket']
|
||||
])
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($participationModels as $participationModel)
|
||||
<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>
|
||||
@if ($settings->use_ean_codes)
|
||||
<td class="text-center align-middle">{{$participationModel->codeEan->code}}</td>
|
||||
@endif
|
||||
<td class="text-center align-middle">{{$participationModel->code->code_unique}}</td>
|
||||
@if ($settings->winning_proof === 1)
|
||||
@if ($participationModel->sticker !== null)
|
||||
<td class="text-center align-middle"><a href="/fichiers/preuve-de-gain/{{$participationModel->id}}/{{$participationModel->sticker}}" class="btn btn-success btn-sm" target="_blank">Voir</a></td>
|
||||
@else
|
||||
<td class="text-center align-middle">-</td>
|
||||
@endif
|
||||
@if ($participationModel->barcode !== null)
|
||||
<td class="text-center align-middle"><a href="/fichiers/preuve-de-gain/{{$participationModel->id}}/{{$participationModel->barcode}}" class="btn btn-success btn-sm" target="_blank">Voir</a></td>
|
||||
@else
|
||||
<td class="text-center align-middle">-</td>
|
||||
@endif
|
||||
@if ($participationModel->ticket !== null)
|
||||
<td class="text-center align-middle"><a href="/fichiers/preuve-de-gain/{{$participationModel->id}}/{{$participationModel->ticket}}" class="btn btn-success btn-sm" target="_blank">Voir</a></td>
|
||||
@else
|
||||
<td class="text-center align-middle">-</td>
|
||||
@endif
|
||||
@endif
|
||||
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
@else
|
||||
<tr>
|
||||
<td class="text-center fw-bold border-0">{{ __('crud.other.no_model_found', ['model' => Str::singular(__('models.classes.winners'))]) }}</td>
|
||||
</tr>
|
||||
@endif
|
||||
</table>
|
||||
{!! $participationModels->links() !!}
|
||||
@endsection
|
||||
|
|
@ -32,6 +32,9 @@
|
|||
@endif
|
||||
@if(!empty($required))
|
||||
required
|
||||
@endif
|
||||
@if(!empty($disabled))
|
||||
disabled
|
||||
@endif>
|
||||
@if(isset($appendText))
|
||||
<label class="input-group-text">{{ $appendText }}</label>
|
||||
|
|
|
|||
|
|
@ -1,31 +0,0 @@
|
|||
@extends('bo.layout')
|
||||
|
||||
@section('content')
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
Envoyer le courrier à Arcadia pour {{ $participation->user->lastname }} {{ $participation->user->firstname }}
|
||||
<a href="{{ route('bo.winners-list') }}" class="btn btn-sm btn-primary float-right">Retour</a>
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
<form method="POST" action="{{ route('bo.courrier-arcadia', $crmId) }}">
|
||||
@csrf
|
||||
<div class="form-row">
|
||||
<div class="col">
|
||||
ID CRM de l'utilisateur : <b>{{ $crmId }}</b>
|
||||
<input type="hidden" name="crm_id" value="{{ $crmId }}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-form-label">Corps du courrier :</label>
|
||||
<textarea class="form-control" rows="20" spellcheck="false" name="corps" disabled>{{ $corps }}</textarea>
|
||||
</div>
|
||||
<label>
|
||||
<input type="checkbox" name="confirm" required>
|
||||
Confirmer l'envoi du courrier
|
||||
</label>
|
||||
<input type="submit" class="btn btn-sm btn-success float-right" value="Envoyer le courrier">
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
|
@ -1,60 +0,0 @@
|
|||
@extends('bo.layout')
|
||||
|
||||
@section('content')
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
Liste des gagnants
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
<table class="table">
|
||||
<thead class="thead-light">
|
||||
<th scope="col">Date participation</th>
|
||||
<th scope="col">Lot</th>
|
||||
<th scope="col">Email</th>
|
||||
@if ($settings->use_ean_codes === 1)
|
||||
<th scope="col">Code EAN</th>
|
||||
@endif
|
||||
<th scope="col">Code unique</th>
|
||||
@if ($settings->winning_proof === 1)
|
||||
<th scope="col">Sticker</th>
|
||||
<th scope="col">Code barre</th>
|
||||
<th scope="col">Ticket</th>
|
||||
@endif
|
||||
<th scope="col">Arcadia</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($winnersList as $winner)
|
||||
<tr>
|
||||
<td>{{ \Carbon\Carbon::parse($winner->created_at)->format('d/m/Y à H:i') }}</td>
|
||||
<td>{{$winner->instantWin()->first()->prize->label_one}}</td>
|
||||
<td>{{$winner->user->email}}</td>
|
||||
@if ($settings->use_ean_codes)
|
||||
<td>{{$winner->codeEan->code}}</td>
|
||||
@endif
|
||||
<td>{{$winner->code->code_unique}}</td>
|
||||
@if ($settings->winning_proof === 1)
|
||||
@if ($winner->sticker !== null)
|
||||
<td class="text-center"><a href="/fichiers/preuve-de-gain/{{$winner->id}}/{{$winner->sticker}}" class="btn btn-success btn-sm" target="_blank">Voir</a></td>
|
||||
@else
|
||||
<td class="text-center">-</td>
|
||||
@endif
|
||||
@if ($winner->barcode !== null)
|
||||
<td class="text-center"><a href="/fichiers/preuve-de-gain/{{$winner->id}}/{{$winner->barcode}}" class="btn btn-success btn-sm" target="_blank">Voir</a></td>
|
||||
@else
|
||||
<td class="text-center">-</td>
|
||||
@endif
|
||||
@if ($winner->ticket !== null)
|
||||
<td class="text-center"><a href="/fichiers/preuve-de-gain/{{$winner->id}}/{{$winner->ticket}}" class="btn btn-success btn-sm" target="_blank">Voir</a></td>
|
||||
@else
|
||||
<td class="text-center">-</td>
|
||||
@endif
|
||||
@endif
|
||||
<td><a href="{{ route('bo.winners-arcadia', $winner->id) }}" class="btn btn-sm btn-primary">Envoyer</a></td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
|
@ -124,3 +124,13 @@ Breadcrumbs::for('bo.products.edit', function (Generator $trail, Product $produc
|
|||
$trail->parent('bo.products.index');
|
||||
$trail->push(__('crud.actions.edit'), route('bo.products.edit', $product->id));
|
||||
});
|
||||
|
||||
// * SETTINGS
|
||||
Breadcrumbs::for('bo.settings.edit', function (Generator $trail) {
|
||||
$trail->push(__('models.classes.settings'), route('bo.products.index'));
|
||||
});
|
||||
|
||||
// * WINNERS LIST
|
||||
Breadcrumbs::for('bo.winners-list', function (Generator $trail) {
|
||||
$trail->push(__('models.classes.winners'), route('bo.winners-list'));
|
||||
});
|
||||
|
|
|
|||
|
|
@ -66,6 +66,11 @@ Route::prefix('bo')
|
|||
Route::resource('products', ProductsController::class)
|
||||
->except('show')
|
||||
->withoutMiddleware('is-super-admin');
|
||||
// * SETTINGS.
|
||||
Route::resource('/settings', SettingsController::class)
|
||||
->only(['edit', 'update']);
|
||||
// * WINNERS LIST
|
||||
Route::get('/winners-list', [WinnersListController::class, 'index'])->name('winners-list');
|
||||
|
||||
// TODO RESTE A FAIRE :.
|
||||
Route::get('/', [DashboardController::class, 'index'])
|
||||
|
|
@ -81,11 +86,5 @@ Route::prefix('bo')
|
|||
Route::post('/codes', [CodesController::class, 'generate'])->name('generate-codes');
|
||||
Route::get('/codes/search', [CodesController::class, 'search'])->name('codes.search');
|
||||
Route::post('/codes/export', [CodesController::class, 'export'])->name('export-codes');
|
||||
// Liste des gagnants.
|
||||
Route::get('/winners-list', [WinnersListController::class, 'index'])->name('winners-list');
|
||||
Route::get('/winners-list/arcadia/{id}', [WinnersListController::class, 'courrierArcadia'])
|
||||
->name('winners-arcadia');
|
||||
Route::post('/winners-list/arcadia/{id}/send', [WinnersListController::class, 'createCourrierArcadia'])
|
||||
->name('courrier-arcadia');
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue