Logique de participation - Ajout de liste des gagnants

This commit is contained in:
Romain Bonhomme 2020-11-04 11:49:43 +01:00
parent 51a697eec9
commit a8d2471f1f
46 changed files with 1138 additions and 631 deletions

100
MesBR.php Normal file
View file

@ -0,0 +1,100 @@
<?php
namespace LDCWeb;
class MesBR
{
private $refSite;
private $refCamp;
public function __construct($refSite, $refCamp)
{
$this->refSite = $refSite;
$this->refCamp = $refCamp;
}
/** Update contact **/
public function updateContact($oCrmUser)
{
if (!$oCrmUser->zDateNaissance || $oCrmUser->zDateNaissance === '0000-00-00'){
$newDateNaissance = '01011990';
} else {
$tmpDate = date_create_from_format('Y-m-d', $oCrmUser->zDateNaissance);
$newDateNaissance = $tmpDate->format('dmY');
}
if(!$oCrmUser->getField('pays')){
$pays = 250;
} else {
$pays = $this->getCountry($oCrmUser->getField('pays'));
}
$url = 'https://www.mesbr.eu/updatecontact?refsite='.trim($this->refSite) .'&refadherent='. urlencode($oCrmUser->iId) . '&nom=' . urlencode($oCrmUser->zNom) .
'&prenom=' . urlencode($oCrmUser->zPrenom) . '&email=' . $oCrmUser->zEmail . '&date_naissance=' . $newDateNaissance .
'&code_postal=' . $oCrmUser->zCodePostal . '&commune=' . urlencode($oCrmUser->zVille).'&pays='.$pays;
$this->callAPI("GET", $url, false);
// TODO : Verif statut du call ?
return true;
}
/** Update panier **/
public function updatePanier($oCrmUser, $couponId, $quantity = 1)
{
if(!$oCrmUser->getField('pays')){
$pays = 250;
} else {
$pays = $this->getCountry($oCrmUser->getField('pays'));
}
$url = 'https://www.mesbr.eu/updatebasket?refsite='. trim($this->refSite) .'&refcamp='. trim($this->refCamp) .
'&refadherent='. urlencode($oCrmUser->iId) .'&nom='. urlencode($oCrmUser->zNom) .
'&prenom='. urlencode($oCrmUser->zPrenom) .'&email='. $oCrmUser->zEmail .
'&code_postal='. $oCrmUser->zCodePostal .'&commune='. urlencode($oCrmUser->zVille) .'&pays='.$pays.
'&panier=('.$quantity.')'.trim($couponId);
$res = $this->callAPI("GET", $url, false);
if ($res->Statut === 'KO') {
error_log("MESBR - CODE : $res->Code - MESSAGE : $res->Message");
return ['status' => 'KO'];
}
$panierVerification = 'https://www.mesbr.eu/showbasket?basketid=' . $res->Panier->Panier;
$panier_link = 'https://www.mesbr.eu/?basketid='. $res->Panier->Panier;
return ['status' => 'OK', 'link' => $panier_link, 'verif' => $panierVerification, 'basketId' => $res->Panier->Panier];
}
/** Génère le lien vers le mur (ou panier préprogrammé) **/
public function GetMurBDRLink($br_refsite, $br_refcamp, $crmUser)
{
return "https://www.mesbr.eu/?refsite=".trim($br_refsite)."&refcamp=".trim($br_refcamp)."&email=".$crmUser->zEmail;
}
private function getCountry($country)
{
switch ($country) {
case 'Belgique':
return 056;
break;
case 'Luxembourg':
return 442;
break;
default:
return 250;
break;
}
}
private function callAPI($method, $url, $data){
$curl = curl_init();
switch ($method){
case "POST":
curl_setopt($curl, CURLOPT_POST, 1);
if ($data)
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
break;
case "PUT":
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PUT");
if ($data)
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
break;
default:
if ($data)
$url = sprintf("%s?%s", $url, http_build_query($data));
}
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_COOKIESESSION, TRUE);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($curl);
if(!$result){die("Connection Failure");}
curl_close($curl);
return json_decode($result);
}
}

View file

@ -2,51 +2,190 @@
namespace App\Http\Controllers;
use App\Models\BannedIP;
use App\Models\Codes;
use App\Models\CodesEAN;
use App\Models\Prizes;
use App\Models\InstantWin;
use App\Models\Participation;
use App\Models\Reductions;
use LDCWeb\MesBR;
use App\Models\Settings;
use CPCConnection;
use Exception;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
class EnterCodeController extends Controller
{
public function index() {
// TODO : Compté les participations du user en cours pour voir s'il peut jouer, sinon rediriger vers participation-exhausted
$nbParticipations = Participation::where('user_id', Auth::user()->id)->count();
$settings = Settings::find(1)->select('use_ean_codes', 'nb_participation_player')->first();
// return view('front.basic.participation-exhausted', compact('settings'));
if ($nbParticipations >= $settings->nb_participation_player)
return view('front.basic.participation-exhausted', compact('settings'));
return view('front.basic.enter-code', compact('settings'));
}
public function participate(Request $request) {
$code = $request->code;
// Récupération des données à utilisées
$code = strtoupper($request->code);
$codeBase = Codes::where('code_unique', $code)->first();
$settings = Settings::find(1);
// Cas IP bannie
if (config('app.env') == "local") {
$ipBanned = BannedIP::where('ip', $_SERVER['REMOTE_ADDR'])->first() === null ? 0 : 1;
} else {
$ipBanned = BannedIP::where('ip', $_SERVER['HTTP_X_FORWARDED_FOR'])->first() === null ? 0 : 1;
}
if ($ipBanned)
return view('front.basic.participation-exhausted', compact('settings'));
// Cas nombre de participation maximale atteint
$nbParticipations = Participation::where('user_id', Auth::user()->id)->count();
if ($nbParticipations >= $settings->nb_participation_player)
return view('front.basic.participation-exhausted', compact('settings'));
// Check le code pour savoir s'il est encore utilisable
if ($codeBase->code_used)
return redirect()->back()->withErrors("Ce code n'est plus utilisable.");
// Check si l'utilisateur n'a pas déjà utiliser ce code
$participUser = Participation::where([
['code_unique_id', $codeBase->id],
['user_id', Auth::user()->id]
])->first();
if ($participUser)
return redirect()->back()->withErrors("Vous avez déjà utilisé ce code.");
// Check si les codes ean sont utilisés, auquel cas on test celui envoyé pour savoir s'il est correct
$codeEan = null;
$settings = Settings::select('use_ean_codes')->first();
if ($settings->use_ean_codes) {
$codeEan = $request->code_ean;
$eanExist = CodesEAN::where('code', $codeEan)->count();
if ($eanExist === 0)
$codeEanBase = CodesEAN::where('code', $codeEan)->first();
if (!$codeEanBase)
return redirect()->back()->withErrors('Le code EAN entré est incorrect, veuillez réessayer.');
}
$gagne = true;
// TODO : Traitement du code, instant gagnant etc
if ($gagne) {
$prizeId = $request->prize;
$prize = Prizes::findOrFail($prizeId);
// TODO : Check que le participant à bien gagné avant de renvoyé la vue, sinon 404
return view('front.basic.' . $prize->gain_view->file_name, compact('prize'));
} else {
// Page perdu si jeu non 100% gagnant, reduction sinon
$perdant = false;
$nbDefaultPrize = Prizes::where('is_default', 1)->count();
if ($nbDefaultPrize === 0)
$perdant = true;
if ($perdant) {
return view('front.basic.loose');
$codeNbUsage = Participation::where('code_unique_id', $codeBase->id)->count();
$codeUsedChanged = false;
// Gestion du nombre d'utilisation d'un code
if ($codeNbUsage >= $settings->nb_unique_code_use) {
$codeBase->code_used = 1;
$codeBase->save();
$codeUsedChanged = true;
return redirect()->back()->withErrors("Ce code n'est plus utilisable.");
} else {
if ($codeNbUsage + 1 >= $settings->nb_unique_code_use)
$codeBase->code_used = 1;
}
// Tous les cas "bloquants" sont passé, l'utilisateur participe à partir d'ici
$participation = new Participation();
$participation->user_id = Auth::user()->id;
$participation->code_unique_id = $codeBase->id;
$participation->code_ean_id = isset($codeEanBase) ? $codeEanBase->id : null;
if (config('app.env') === "local") {
$participation->ip = $_SERVER['REMOTE_ADDR'];
} else {
$participation->ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
}
$participation->save();
// Gestion des instants gagnants
$userAlreadyWon = Participation::where([
['user_id', Auth::user()->id],
['instant_win_id', '<>', null]
])->first();
// Si l'utilisateur actuel à déjà gagné un gros lot, pas d'instant gagnant
if ($userAlreadyWon) {
// Si le jeu est 100% gagnant
if ($settings->reductions_activated) {
$coupon = $this->getRandomCoupon($settings);
$crmCoupon = $this->updateCoupon($settings, $coupon, $participation);
if (!$crmCoupon) {
$participation->delete();
return redirect()->back()->withErrors("Une erreur est survenue, merci de réessayez ultérieurement.");
}
return view('front.basic.reduction', compact('crmCoupon'));
} else {
$prizes = Prizes::where('is_default', 1)->get();
// TODO : Gérer quel prix par défaut on retourne avec un pourcentage
return view('front.basic.reduction', compact('prizes'));
return view('front.basic.loose');
}
} else {
// Gain d'un gros lot
$instantWin = InstantWin::where('appear_date', '<', now())->orderByDesc('appear_date')->first();
if (isset($instantWin) && !$instantWin->won) {
$instantWin->won = 1;
$instantWin->participation_id = $participation->id;
$participation->instant_win_id = $instantWin->id;
$instantWin->save();
$participation->save();
return view("front.basic." . $instantWin->prize->gain_view->file_name)->with('prize', $instantWin->prize);
} else {
$coupon = $this->getRandomCoupon($settings);
$crmCoupon = $this->updateCoupon($settings, $coupon, $participation);
if (!$crmCoupon) {
$participation->delete();
return redirect()->back()->withErrors("Une erreur est survenue, merci de réessayez ultérieurement.");
}
return view('front.basic.reduction', compact('crmCoupon'));
}
}
}
private function getRandomCoupon($settings) {
$webCoupons = json_decode($settings->web_coupons);
if (count($webCoupons) > 1) {
$lots = [];
foreach($webCoupons as $webCoupon) {
$lots[$webCoupon->web_coupon_identifiant] = $webCoupon->percentage;
}
foreach ($lots as $k => $lot)
for ($i = 0; $i < $lot; $i++)
$tmp[] = "$k";
shuffle($tmp);
return $tmp[0];
} else {
return $webCoupons[0]->web_coupon_identifiant;
}
}
private function updateCoupon($settings, $coupon, $participation) {
$reduction = null;
$mesBR = new MesBR($settings->reductions_site, $settings->reductions_campaign);
try {
// Appel API CRM et MesBR
$cpcConnect = new CPCConnection(config('crm.CRM_PLATOS_WSDL'), config('crm.WS_SERVCE_LOGIN'), config('crm.WS_SERVCE_PASSWORD'));
$cpcConnect->connect();
$mesBR->updateContact($cpcConnect->getUser(Auth::user()->crm_id));
$result = $mesBR->updatePanier($cpcConnect->getUser(Auth::user()->crm_id), $coupon);
if ($result["status"] === "OK") {
$reduction = new Reductions();
$reduction->participation_id = $participation->id;
$reduction->link = $result["link"];
$reduction->verification = $result["verif"];
$reduction->basket_id = $result["basketId"];
$reduction->save();
$participation->reduction_id = $reduction->id;
$participation->save();
}
} catch (Exception $e) {
$reduction = null;
}
return $reduction;
}
public function formWinningProof() {
$participation = Participation::where([
['user_id', Auth::user()->id],
['instant_win_id', '<>', null],
['sticker', null],
['ticket', null],
['barcode', null]
])->first();
if ($participation)
return view('front.basic.winning-proof', $participation);
return redirect()->route('home');
}
}

View file

@ -3,18 +3,26 @@
namespace App\Http\Controllers;
use App\Mail\WinningProof;
use App\Models\Participation;
use App\Models\Settings;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Mail;
class WinningProofController extends Controller
{
public function index() {
// TODO : Vérification que le user à bien une preuve de gain à fournir (instant gagnant en attende d'info complémentaire)
return view('front.basic.winning-proof');
}
public function sendWinningProof(Request $request) {
// On récupère la participation gagnante en attente des infos
$participation = Participation::where([
['user_id', Auth::user()->id],
['instant_win_id', '<>', null],
['sticker', null],
['ticket', null],
['barcode', null]
])->first();
if (!$participation)
return redirect()->route('home');
$lastname = filter_var($request->lastname, FILTER_SANITIZE_STRING);
$firstname = filter_var($request->firstname, FILTER_SANITIZE_STRING);
$address = filter_var($request->address, FILTER_SANITIZE_STRING);
@ -43,8 +51,7 @@ class WinningProofController extends Controller
// TODO : Ajouter les infos à la table Participation et envoyé les infos code unique et ean si utilisé au mail
// TODO : Enregistrement des images dans des dossiers /fichiers/preuve-gain/{id-participaction}/{nom-fichier}-[sticker/ticket/barcode].png
$participationId = 364581; // Pour test, à supprimer
$participationId = $participation->id; // Pour test, à supprimer
$stickerFileName = $participationId . '-sticker.' . $sticker->extension();
$sticker->move(public_path('fichiers/preuve-de-gain/' . $participationId . '/'), $stickerFileName);
$stickerPath = 'fichiers/preuve-de-gain/' . $participationId . '/' . $stickerFileName;
@ -57,11 +64,16 @@ class WinningProofController extends Controller
$barcode->move(public_path('fichiers/preuve-de-gain/' . $participationId . '/'), $barcodeFileName);
$barcodePath = 'fichiers/preuve-de-gain/' . $participationId . '/' . $barcodeFileName;
$participation->sticker = $stickerFileName;
$participation->ticket = $ticketFileName;
$participation->barcode = $barcodeFileName;
$participation->save();
$settings = Settings::find(1);
$mails = json_decode($settings->notification_emails);
foreach ($mails as $mail) {
// TODO : Donné la participation au mail
Mail::to($mail)->send(new WinningProof($stickerPath, $ticketPath, $barcodePath));
Mail::to($mail)->send(new WinningProof($stickerPath, $ticketPath, $barcodePath, $participation));
}
return view('front.basic.replay');

View file

@ -35,10 +35,8 @@ class PrizesController extends Controller
$p->label_one = $prize->label_one;
$p->label_many = $prize->label_many;
$p->quantity = $prize->quantity;
$p->notifications = $prize->notifications;
$p->additional_form = $prize->additional_form;
$p->arcadia_mail_id = $prize->arcadia_mail_id;
$p->is_default = $prize->is_default;
$p->need_proof = $prize->need_proof;
$p->gain_view_id = $prize->gain_view_id;
if (isset($pdfs[$i])) {
@ -55,10 +53,8 @@ class PrizesController extends Controller
$p->label_one = $prize->label_one;
$p->label_many = $prize->label_many;
$p->quantity = $prize->quantity;
$p->notifications = $prize->notifications;
$p->additional_form = $prize->additional_form;
$p->arcadia_mail_id = $prize->arcadia_mail_id;
$p->is_default = $prize->is_default;
$p->need_proof = $prize->need_proof;
$p->gain_view_id = $prize->gain_view_id;
if (isset($pdfs[$i])) {

View file

@ -4,10 +4,8 @@ namespace App\Http\Controllers\bo;
use App\Http\Controllers\Controller;
use App\Models\Settings;
use App\Models\SettingsMails;
use Illuminate\Http\Request;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\Route;
class SettingsController extends Controller
{
@ -30,16 +28,12 @@ class SettingsController extends Controller
$closePageActiveDate = $request->close_page_active_date;
$redirectClose = $request->redirect_close;
$reductionsActivated = $request->reductions_activated === null ? 0 : 1;
$reductionsDistribution = $request->reductions_distribution;
$reductionsSite = $request->reductions_site;
$reductionsCampaign = $request->reductions_campaign;
$reductionsIdCoupon = $request->reductions_id_coupon;
$webCoupons = $request->web_coupons;
$facebookActivated = $request->facebook_activated === null ? 0 : 1;
$facebookAppId = $request->facebook_app_id;
$facebookSecret = $request->facebook_secret;
$mailFrom = $request->mail_from;
$mailSender = $request->mail_sender;
$mailSenderName = $request->mail_sender_name;
$notificationEmails = $request->notification_emails;
$winningProof = $request->winning_proof === null ? 0 : 1;
$company = $request->company;
@ -60,24 +54,20 @@ class SettingsController extends Controller
$settings->redirect_close = $redirectClose;
$settings->reductions_activated = $reductionsActivated;
if ($reductionsActivated === 1) {
$settings->reductions_distribution = $reductionsDistribution;
$settings->reductions_site = $reductionsSite;
$settings->reductions_campaign = $reductionsCampaign;
$settings->reductions_id_coupon = $reductionsIdCoupon;
$settings->web_coupons = $webCoupons;
}
$settings->facebook_activated = $facebookActivated;
$settings->facebook_app_id = $facebookAppId;
$settings->facebook_secret = $facebookSecret;
$settings->mail_from = $mailFrom;
$settings->mail_sender = $mailSender;
$settings->mail_sender_name = $mailSenderName;
$settings->notification_emails = $notificationEmails;
$settings->winning_proof = $winningProof;
$settings->company = $company;
$settings->save();
return redirect()->route('bo.settings', compact('settings'))->with('success', 'Enregistré !');
return view('bo.settings.manage', compact('settings'))->with('success', 'Enregistré !');
}
return view('bo.settings.manage', compact('settings'));

View file

@ -0,0 +1,17 @@
<?php
namespace App\Http\Controllers\bo;
use App\Http\Controllers\Controller;
use App\Models\Participation;
use App\Models\Settings;
use Illuminate\Http\Request;
class WinnersListController extends Controller
{
public function index() {
$winnersList = Participation::where('instant_win_id', '<>', null)->get();
$settings = Settings::select('use_ean_codes')->first();
return view('bo.winners-list.index', compact('winnersList', 'settings'));
}
}

View file

@ -42,7 +42,6 @@ class ProcessUniqueCode implements ShouldQueue
try {
$code = new Codes();
$code->code_unique = $this->getCode($this->length);
$code->code_used = 0;
$code->date_creation = now();
$code->save();
if ($code){

View file

@ -11,18 +11,19 @@ class WinningProof extends Mailable implements ShouldQueue
{
use Queueable, SerializesModels;
protected $sticker, $ticket, $barcode;
private $sticker, $ticket, $barcode, $participation;
/**
* Create a new message instance.
*
* @return void
*/
public function __construct($sticker, $ticket, $barcode)
public function __construct($sticker, $ticket, $barcode, $participation)
{
$this->sticker = $sticker;
$this->ticket = $ticket;
$this->barcode = $barcode;
$this->participation = $participation;
}
/**
@ -32,6 +33,7 @@ class WinningProof extends Mailable implements ShouldQueue
*/
public function build()
{
return $this->view('front.basic.winning-proof-email')->attach($this->sticker)->attach($this->ticket)->attach($this->barcode);
$participation = $this->participation;
return $this->view('front.basic.winning-proof-email', compact('participation'))->attach($this->sticker)->attach($this->ticket)->attach($this->barcode);
}
}

View file

@ -8,4 +8,8 @@ class Codes extends Model
{
protected $fillable = ['code_unique', 'code_used', 'date_creation'];
public $timestamps = false;
public function participations() {
return $this->hasMany('App\Models\Participation', 'code_unique_id');
}
}

View file

@ -9,4 +9,8 @@ class CodesEAN extends Model
protected $table = "codes_ean";
protected $fillable = ['code', 'product'];
public $timestamps = false;
public function participations() {
return $this->hasMany('App\Models\Participation', 'code_ean_id');
}
}

View file

@ -13,4 +13,8 @@ class InstantWin extends Model
public function prize() {
return $this->belongsTo('App\Models\Prizes', 'prize_id');
}
public function participation() {
return $this->hasOne('App\Models\Participation', 'instant_win_id');
}
}

View file

@ -0,0 +1,30 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Participation extends Model
{
protected $table = "participation";
public function user() {
return $this->belongsTo('App\User', 'user_id');
}
public function code() {
return $this->belongsTo('App\Models\Codes', 'code_unique_id');
}
public function code_ean() {
return $this->belongsTo('App\Models\CodesEAN', 'code_ean_id');
}
public function instant_win() {
return $this->hasOne('App\Models\InstantWin', 'participation_id');
}
public function reduction() {
return $this->hasOne('App\Models\Reductions', 'reduction_id');
}
}

12
app/Models/Reductions.php Normal file
View file

@ -0,0 +1,12 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Reductions extends Model
{
public function participation() {
return $this->hasOne('App\Models\Participation', 'participation_id');
}
}

View file

@ -48,4 +48,8 @@ class User extends Authenticatable
protected $casts = [
'email_verified_at' => 'datetime',
];
public function participations() {
return $this->hasMany('App\Models\Participation', 'user_id');
}
}

View file

@ -40,7 +40,8 @@
"classmap": [
"database/seeds",
"database/factories",
"ldccrm_client"
"ldccrm_client",
"MesBR.php"
]
},
"autoload-dev": {

View file

@ -28,16 +28,12 @@ class CreateSettings extends Migration
$table->dateTime('close_page_active_date')->nullable();
$table->string('redirect_close');
$table->boolean('reductions_activated');
$table->integer('reductions_distribution')->nullable();
$table->string('reductions_site')->nullable();
$table->string('reductions_campaign')->nullable();
$table->string('reductions_id_coupon')->nullable();
$table->text('web_coupons')->nullable();
$table->boolean('facebook_activated');
$table->string('facebook_app_id')->nullable();
$table->string('facebook_secret')->nullable();
$table->string('mail_from');
$table->string('mail_sender');
$table->string('mail_sender_name')->nullable();
$table->text('notification_emails')->nullable();
$table->boolean('winning_proof');
$table->string('company');

View file

@ -19,11 +19,9 @@ class CreatePrizes extends Migration
$table->string("label_one");
$table->string("label_many");
$table->integer("quantity");
$table->boolean("notifications");
$table->boolean("additional_form");
$table->integer("arcadia_mail_id");
$table->string("pdf_winning_proof")->nullable();
$table->boolean("is_default");
$table->boolean("need_proof");
$table->foreignId("gain_view_id")->constrained("gain_views");
$table->timestamps();
});

View file

@ -17,7 +17,7 @@ class CreateInstantWin extends Migration
$table->id();
$table->foreignId("prize_id")->constrained("prizes");
$table->dateTime("appear_date");
// TODO : Ajouté gagné et participation_id
$table->boolean("won")->default(0);
});
}

View file

@ -14,10 +14,10 @@ class CreateCodes extends Migration
public function up()
{
Schema::create('codes', function (Blueprint $table) {
$table->id();
$table->string('code_unique');
$table->boolean('code_used')->default(0);
$table->date('date_creation');
$table->primary('code_unique');
});
}

View file

@ -16,18 +16,13 @@ class CreateParticipation extends Migration
Schema::create('participation', function (Blueprint $table) {
$table->id();
$table->foreignId('user_id')->constrained('users');
$table->foreignId('prize_id')->constrained('prizes');
$table->string('address')->nullable();
$table->string('address2')->nullable();
$table->string('town')->nullable();
$table->string('postal_code')->nullable();
$table->string('country')->nullable();
$table->string('phone')->nullable();
$table->foreignId('code_unique_id')->constrained('codes');
$table->foreignId('code_ean_id')->nullable()->constrained('codes_ean');
$table->foreignId('instant_win_id')->nullable()->constrained('instant_win');
$table->string('ip');
$table->string('sticker')->nullable();
$table->string('ticker')->nullable();
$table->string('ticket')->nullable();
$table->string('barcode')->nullable();
$table->string('browser');
$table->string('device');
$table->timestamps();
});
}

View file

@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateReductions extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('reductions', function (Blueprint $table) {
$table->id();
$table->foreignId('participation_id')->constrained('participation');
$table->string('link');
$table->string('basket_id');
$table->string('verification');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('reductions');
}
}

View file

@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class ParticipationAddReductionId extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table("participation", function(Blueprint $table) {
$table->foreignId('reduction_id')->after("instant_win_id")->nullable()->constrained('reductions');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table("participation", function(Blueprint $table) {
$table->dropForeign(["reduction_id"]);
$table->dropColumn("reduction_id");
});
}
}

View file

@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class UpdateInstantWinParticipationId extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table("instant_win", function(Blueprint $table) {
$table->foreignId('participation_id')->nullable()->constrained('participation');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table("instant_win", function(Blueprint $table) {
$table->dropForeign(["participation_id"]);
$table->dropColumn("participation_id");
});
}
}

View file

@ -26,12 +26,10 @@ class SettingsSeeder extends Seeder
$settings->redirect_close = "exemple.test";
$settings->reductions_activated = false;
$settings->facebook_activated = false;
$settings->mail_from = "exemple@exemple.exemple";
$settings->mail_sender = "exemple@exemple.exemple";
$settings->mail_sender_name = "Exemple";
$settings->notification_emails = "[]";
$settings->winning_proof = 0;
$settings->company = "Société";
$settings->web_coupons = "[]";
$settings->save();
}
}

264
public/css/app.css vendored
View file

@ -21,8 +21,8 @@
--white: #fff;
--gray: #6c757d;
--gray-dark: #343a40;
--primary: #3176C4;
--secondary: #E7374B;
--primary: #3490dc;
--secondary: #6c757d;
--success: #38c172;
--info: #6cb2eb;
--warning: #ffed4a;
@ -170,13 +170,13 @@ sup {
}
a {
color: #3176C4;
color: #3490dc;
text-decoration: none;
background-color: transparent;
}
a:hover {
color: #225187;
color: #1d68a7;
text-decoration: underline;
}
@ -1827,45 +1827,45 @@ pre code {
.table-primary,
.table-primary > th,
.table-primary > td {
background-color: #c5d9ee;
background-color: #c6e0f5;
}
.table-primary th,
.table-primary td,
.table-primary thead th,
.table-primary tbody + tbody {
border-color: #94b8e0;
border-color: #95c5ed;
}
.table-hover .table-primary:hover {
background-color: #b1cce8;
background-color: #b0d4f1;
}
.table-hover .table-primary:hover > td,
.table-hover .table-primary:hover > th {
background-color: #b1cce8;
background-color: #b0d4f1;
}
.table-secondary,
.table-secondary > th,
.table-secondary > td {
background-color: #f8c7cd;
background-color: #d6d8db;
}
.table-secondary th,
.table-secondary td,
.table-secondary thead th,
.table-secondary tbody + tbody {
border-color: #f397a1;
border-color: #b3b7bb;
}
.table-hover .table-secondary:hover {
background-color: #f5b0b9;
background-color: #c8cbcf;
}
.table-hover .table-secondary:hover > td,
.table-hover .table-secondary:hover > th {
background-color: #f5b0b9;
background-color: #c8cbcf;
}
.table-success,
@ -2149,9 +2149,9 @@ pre code {
.form-control:focus {
color: #495057;
background-color: #fff;
border-color: #91b8e4;
border-color: #a1cbef;
outline: 0;
box-shadow: 0 0 0 0.2rem rgba(49, 118, 196, 0.25);
box-shadow: 0 0 0 0.2rem rgba(52, 144, 220, 0.25);
}
.form-control::-moz-placeholder {
@ -2648,7 +2648,7 @@ textarea.form-control.is-invalid {
.btn:focus,
.btn.focus {
outline: 0;
box-shadow: 0 0 0 0.2rem rgba(49, 118, 196, 0.25);
box-shadow: 0 0 0 0.2rem rgba(52, 144, 220, 0.25);
}
.btn.disabled,
@ -2667,84 +2667,84 @@ fieldset:disabled a.btn {
.btn-primary {
color: #fff;
background-color: #3176C4;
border-color: #3176C4;
background-color: #3490dc;
border-color: #3490dc;
}
.btn-primary:hover {
color: #fff;
background-color: #2964a5;
border-color: #275d9b;
background-color: #227dc7;
border-color: #2176bd;
}
.btn-primary:focus,
.btn-primary.focus {
color: #fff;
background-color: #2964a5;
border-color: #275d9b;
box-shadow: 0 0 0 0.2rem rgba(80, 139, 205, 0.5);
background-color: #227dc7;
border-color: #2176bd;
box-shadow: 0 0 0 0.2rem rgba(82, 161, 225, 0.5);
}
.btn-primary.disabled,
.btn-primary:disabled {
color: #fff;
background-color: #3176C4;
border-color: #3176C4;
background-color: #3490dc;
border-color: #3490dc;
}
.btn-primary:not(:disabled):not(.disabled):active,
.btn-primary:not(:disabled):not(.disabled).active,
.show > .btn-primary.dropdown-toggle {
color: #fff;
background-color: #275d9b;
border-color: #245791;
background-color: #2176bd;
border-color: #1f6fb2;
}
.btn-primary:not(:disabled):not(.disabled):active:focus,
.btn-primary:not(:disabled):not(.disabled).active:focus,
.show > .btn-primary.dropdown-toggle:focus {
box-shadow: 0 0 0 0.2rem rgba(80, 139, 205, 0.5);
box-shadow: 0 0 0 0.2rem rgba(82, 161, 225, 0.5);
}
.btn-secondary {
color: #fff;
background-color: #E7374B;
border-color: #E7374B;
background-color: #6c757d;
border-color: #6c757d;
}
.btn-secondary:hover {
color: #fff;
background-color: #dd1b31;
border-color: #d2192e;
background-color: #5a6268;
border-color: #545b62;
}
.btn-secondary:focus,
.btn-secondary.focus {
color: #fff;
background-color: #dd1b31;
border-color: #d2192e;
box-shadow: 0 0 0 0.2rem rgba(235, 85, 102, 0.5);
background-color: #5a6268;
border-color: #545b62;
box-shadow: 0 0 0 0.2rem rgba(130, 138, 145, 0.5);
}
.btn-secondary.disabled,
.btn-secondary:disabled {
color: #fff;
background-color: #E7374B;
border-color: #E7374B;
background-color: #6c757d;
border-color: #6c757d;
}
.btn-secondary:not(:disabled):not(.disabled):active,
.btn-secondary:not(:disabled):not(.disabled).active,
.show > .btn-secondary.dropdown-toggle {
color: #fff;
background-color: #d2192e;
border-color: #c6182c;
background-color: #545b62;
border-color: #4e555b;
}
.btn-secondary:not(:disabled):not(.disabled):active:focus,
.btn-secondary:not(:disabled):not(.disabled).active:focus,
.show > .btn-secondary.dropdown-toggle:focus {
box-shadow: 0 0 0 0.2rem rgba(235, 85, 102, 0.5);
box-shadow: 0 0 0 0.2rem rgba(130, 138, 145, 0.5);
}
.btn-success {
@ -2994,24 +2994,24 @@ fieldset:disabled a.btn {
}
.btn-outline-primary {
color: #3176C4;
border-color: #3176C4;
color: #3490dc;
border-color: #3490dc;
}
.btn-outline-primary:hover {
color: #fff;
background-color: #3176C4;
border-color: #3176C4;
background-color: #3490dc;
border-color: #3490dc;
}
.btn-outline-primary:focus,
.btn-outline-primary.focus {
box-shadow: 0 0 0 0.2rem rgba(49, 118, 196, 0.5);
box-shadow: 0 0 0 0.2rem rgba(52, 144, 220, 0.5);
}
.btn-outline-primary.disabled,
.btn-outline-primary:disabled {
color: #3176C4;
color: #3490dc;
background-color: transparent;
}
@ -3019,35 +3019,35 @@ fieldset:disabled a.btn {
.btn-outline-primary:not(:disabled):not(.disabled).active,
.show > .btn-outline-primary.dropdown-toggle {
color: #fff;
background-color: #3176C4;
border-color: #3176C4;
background-color: #3490dc;
border-color: #3490dc;
}
.btn-outline-primary:not(:disabled):not(.disabled):active:focus,
.btn-outline-primary:not(:disabled):not(.disabled).active:focus,
.show > .btn-outline-primary.dropdown-toggle:focus {
box-shadow: 0 0 0 0.2rem rgba(49, 118, 196, 0.5);
box-shadow: 0 0 0 0.2rem rgba(52, 144, 220, 0.5);
}
.btn-outline-secondary {
color: #E7374B;
border-color: #E7374B;
color: #6c757d;
border-color: #6c757d;
}
.btn-outline-secondary:hover {
color: #fff;
background-color: #E7374B;
border-color: #E7374B;
background-color: #6c757d;
border-color: #6c757d;
}
.btn-outline-secondary:focus,
.btn-outline-secondary.focus {
box-shadow: 0 0 0 0.2rem rgba(231, 55, 75, 0.5);
box-shadow: 0 0 0 0.2rem rgba(108, 117, 125, 0.5);
}
.btn-outline-secondary.disabled,
.btn-outline-secondary:disabled {
color: #E7374B;
color: #6c757d;
background-color: transparent;
}
@ -3055,14 +3055,14 @@ fieldset:disabled a.btn {
.btn-outline-secondary:not(:disabled):not(.disabled).active,
.show > .btn-outline-secondary.dropdown-toggle {
color: #fff;
background-color: #E7374B;
border-color: #E7374B;
background-color: #6c757d;
border-color: #6c757d;
}
.btn-outline-secondary:not(:disabled):not(.disabled):active:focus,
.btn-outline-secondary:not(:disabled):not(.disabled).active:focus,
.show > .btn-outline-secondary.dropdown-toggle:focus {
box-shadow: 0 0 0 0.2rem rgba(231, 55, 75, 0.5);
box-shadow: 0 0 0 0.2rem rgba(108, 117, 125, 0.5);
}
.btn-outline-success {
@ -3283,12 +3283,12 @@ fieldset:disabled a.btn {
.btn-link {
font-weight: 400;
color: #3176C4;
color: #3490dc;
text-decoration: none;
}
.btn-link:hover {
color: #225187;
color: #1d68a7;
text-decoration: underline;
}
@ -3594,7 +3594,7 @@ input[type=button].btn-block {
.dropdown-item:active {
color: #fff;
text-decoration: none;
background-color: #3176C4;
background-color: #3490dc;
}
.dropdown-item.disabled,
@ -3957,22 +3957,22 @@ input[type=button].btn-block {
.custom-control-input:checked ~ .custom-control-label::before {
color: #fff;
border-color: #3176C4;
background-color: #3176C4;
border-color: #3490dc;
background-color: #3490dc;
}
.custom-control-input:focus ~ .custom-control-label::before {
box-shadow: 0 0 0 0.2rem rgba(49, 118, 196, 0.25);
box-shadow: 0 0 0 0.2rem rgba(52, 144, 220, 0.25);
}
.custom-control-input:focus:not(:checked) ~ .custom-control-label::before {
border-color: #91b8e4;
border-color: #a1cbef;
}
.custom-control-input:not(:disabled):active ~ .custom-control-label::before {
color: #fff;
background-color: #bad2ee;
border-color: #bad2ee;
background-color: #cce3f6;
border-color: #cce3f6;
}
.custom-control-input[disabled] ~ .custom-control-label,
@ -4024,8 +4024,8 @@ input[type=button].btn-block {
}
.custom-checkbox .custom-control-input:indeterminate ~ .custom-control-label::before {
border-color: #3176C4;
background-color: #3176C4;
border-color: #3490dc;
background-color: #3490dc;
}
.custom-checkbox .custom-control-input:indeterminate ~ .custom-control-label::after {
@ -4033,11 +4033,11 @@ input[type=button].btn-block {
}
.custom-checkbox .custom-control-input:disabled:checked ~ .custom-control-label::before {
background-color: rgba(49, 118, 196, 0.5);
background-color: rgba(52, 144, 220, 0.5);
}
.custom-checkbox .custom-control-input:disabled:indeterminate ~ .custom-control-label::before {
background-color: rgba(49, 118, 196, 0.5);
background-color: rgba(52, 144, 220, 0.5);
}
.custom-radio .custom-control-label::before {
@ -4049,7 +4049,7 @@ input[type=button].btn-block {
}
.custom-radio .custom-control-input:disabled:checked ~ .custom-control-label::before {
background-color: rgba(49, 118, 196, 0.5);
background-color: rgba(52, 144, 220, 0.5);
}
.custom-switch {
@ -4085,7 +4085,7 @@ input[type=button].btn-block {
}
.custom-switch .custom-control-input:disabled:checked ~ .custom-control-label::before {
background-color: rgba(49, 118, 196, 0.5);
background-color: rgba(52, 144, 220, 0.5);
}
.custom-select {
@ -4107,9 +4107,9 @@ input[type=button].btn-block {
}
.custom-select:focus {
border-color: #91b8e4;
border-color: #a1cbef;
outline: 0;
box-shadow: 0 0 0 0.2rem rgba(49, 118, 196, 0.25);
box-shadow: 0 0 0 0.2rem rgba(52, 144, 220, 0.25);
}
.custom-select:focus::-ms-value {
@ -4172,8 +4172,8 @@ input[type=button].btn-block {
}
.custom-file-input:focus ~ .custom-file-label {
border-color: #91b8e4;
box-shadow: 0 0 0 0.2rem rgba(49, 118, 196, 0.25);
border-color: #a1cbef;
box-shadow: 0 0 0 0.2rem rgba(52, 144, 220, 0.25);
}
.custom-file-input[disabled] ~ .custom-file-label,
@ -4237,15 +4237,15 @@ input[type=button].btn-block {
}
.custom-range:focus::-webkit-slider-thumb {
box-shadow: 0 0 0 1px #f8fafc, 0 0 0 0.2rem rgba(49, 118, 196, 0.25);
box-shadow: 0 0 0 1px #f8fafc, 0 0 0 0.2rem rgba(52, 144, 220, 0.25);
}
.custom-range:focus::-moz-range-thumb {
box-shadow: 0 0 0 1px #f8fafc, 0 0 0 0.2rem rgba(49, 118, 196, 0.25);
box-shadow: 0 0 0 1px #f8fafc, 0 0 0 0.2rem rgba(52, 144, 220, 0.25);
}
.custom-range:focus::-ms-thumb {
box-shadow: 0 0 0 1px #f8fafc, 0 0 0 0.2rem rgba(49, 118, 196, 0.25);
box-shadow: 0 0 0 1px #f8fafc, 0 0 0 0.2rem rgba(52, 144, 220, 0.25);
}
.custom-range::-moz-focus-outer {
@ -4256,7 +4256,7 @@ input[type=button].btn-block {
width: 1rem;
height: 1rem;
margin-top: -0.25rem;
background-color: #3176C4;
background-color: #3490dc;
border: 0;
border-radius: 1rem;
-webkit-transition: background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
@ -4273,7 +4273,7 @@ input[type=button].btn-block {
}
.custom-range::-webkit-slider-thumb:active {
background-color: #bad2ee;
background-color: #cce3f6;
}
.custom-range::-webkit-slider-runnable-track {
@ -4289,7 +4289,7 @@ input[type=button].btn-block {
.custom-range::-moz-range-thumb {
width: 1rem;
height: 1rem;
background-color: #3176C4;
background-color: #3490dc;
border: 0;
border-radius: 1rem;
-moz-transition: background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
@ -4306,7 +4306,7 @@ input[type=button].btn-block {
}
.custom-range::-moz-range-thumb:active {
background-color: #bad2ee;
background-color: #cce3f6;
}
.custom-range::-moz-range-track {
@ -4325,7 +4325,7 @@ input[type=button].btn-block {
margin-top: 0;
margin-right: 0.2rem;
margin-left: 0.2rem;
background-color: #3176C4;
background-color: #3490dc;
border: 0;
border-radius: 1rem;
-ms-transition: background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
@ -4341,7 +4341,7 @@ input[type=button].btn-block {
}
.custom-range::-ms-thumb:active {
background-color: #bad2ee;
background-color: #cce3f6;
}
.custom-range::-ms-track {
@ -4468,7 +4468,7 @@ input[type=button].btn-block {
.nav-pills .nav-link.active,
.nav-pills .show > .nav-link {
color: #fff;
background-color: #3176C4;
background-color: #3490dc;
}
.nav-fill > .nav-link,
@ -5223,14 +5223,14 @@ input[type=button].btn-block {
padding: 0.5rem 0.75rem;
margin-left: -1px;
line-height: 1.25;
color: #3176C4;
color: #3490dc;
background-color: #fff;
border: 1px solid #dee2e6;
}
.page-link:hover {
z-index: 2;
color: #225187;
color: #1d68a7;
text-decoration: none;
background-color: #e9ecef;
border-color: #dee2e6;
@ -5239,7 +5239,7 @@ input[type=button].btn-block {
.page-link:focus {
z-index: 3;
outline: 0;
box-shadow: 0 0 0 0.2rem rgba(49, 118, 196, 0.25);
box-shadow: 0 0 0 0.2rem rgba(52, 144, 220, 0.25);
}
.page-item:first-child .page-link {
@ -5256,8 +5256,8 @@ input[type=button].btn-block {
.page-item.active .page-link {
z-index: 3;
color: #fff;
background-color: #3176C4;
border-color: #3176C4;
background-color: #3490dc;
border-color: #3490dc;
}
.page-item.disabled .page-link {
@ -5341,36 +5341,36 @@ a.badge:focus {
.badge-primary {
color: #fff;
background-color: #3176C4;
background-color: #3490dc;
}
a.badge-primary:hover,
a.badge-primary:focus {
color: #fff;
background-color: #275d9b;
background-color: #2176bd;
}
a.badge-primary:focus,
a.badge-primary.focus {
outline: 0;
box-shadow: 0 0 0 0.2rem rgba(49, 118, 196, 0.5);
box-shadow: 0 0 0 0.2rem rgba(52, 144, 220, 0.5);
}
.badge-secondary {
color: #fff;
background-color: #E7374B;
background-color: #6c757d;
}
a.badge-secondary:hover,
a.badge-secondary:focus {
color: #fff;
background-color: #d2192e;
background-color: #545b62;
}
a.badge-secondary:focus,
a.badge-secondary.focus {
outline: 0;
box-shadow: 0 0 0 0.2rem rgba(231, 55, 75, 0.5);
box-shadow: 0 0 0 0.2rem rgba(108, 117, 125, 0.5);
}
.badge-success {
@ -5523,31 +5523,31 @@ a.badge-dark.focus {
}
.alert-primary {
color: #193d66;
background-color: #d6e4f3;
border-color: #c5d9ee;
color: #1b4b72;
background-color: #d6e9f8;
border-color: #c6e0f5;
}
.alert-primary hr {
border-top-color: #b1cce8;
border-top-color: #b0d4f1;
}
.alert-primary .alert-link {
color: #0f253d;
color: #113049;
}
.alert-secondary {
color: #781d27;
background-color: #fad7db;
border-color: #f8c7cd;
color: #383d41;
background-color: #e2e3e5;
border-color: #d6d8db;
}
.alert-secondary hr {
border-top-color: #f5b0b9;
border-top-color: #c8cbcf;
}
.alert-secondary .alert-link {
color: #4f131a;
color: #202326;
}
.alert-success {
@ -5672,7 +5672,7 @@ a.badge-dark.focus {
color: #fff;
text-align: center;
white-space: nowrap;
background-color: #3176C4;
background-color: #3490dc;
transition: width 0.6s ease;
}
@ -5763,8 +5763,8 @@ a.badge-dark.focus {
.list-group-item.active {
z-index: 2;
color: #fff;
background-color: #3176C4;
border-color: #3176C4;
background-color: #3490dc;
border-color: #3490dc;
}
.list-group-item + .list-group-item {
@ -5937,37 +5937,37 @@ a.badge-dark.focus {
}
.list-group-item-primary {
color: #193d66;
background-color: #c5d9ee;
color: #1b4b72;
background-color: #c6e0f5;
}
.list-group-item-primary.list-group-item-action:hover,
.list-group-item-primary.list-group-item-action:focus {
color: #193d66;
background-color: #b1cce8;
color: #1b4b72;
background-color: #b0d4f1;
}
.list-group-item-primary.list-group-item-action.active {
color: #fff;
background-color: #193d66;
border-color: #193d66;
background-color: #1b4b72;
border-color: #1b4b72;
}
.list-group-item-secondary {
color: #781d27;
background-color: #f8c7cd;
color: #383d41;
background-color: #d6d8db;
}
.list-group-item-secondary.list-group-item-action:hover,
.list-group-item-secondary.list-group-item-action:focus {
color: #781d27;
background-color: #f5b0b9;
color: #383d41;
background-color: #c8cbcf;
}
.list-group-item-secondary.list-group-item-action.active {
color: #fff;
background-color: #781d27;
border-color: #781d27;
background-color: #383d41;
border-color: #383d41;
}
.list-group-item-success {
@ -6951,25 +6951,25 @@ a.close.disabled {
}
.bg-primary {
background-color: #3176C4 !important;
background-color: #3490dc !important;
}
a.bg-primary:hover,
a.bg-primary:focus,
button.bg-primary:hover,
button.bg-primary:focus {
background-color: #275d9b !important;
background-color: #2176bd !important;
}
.bg-secondary {
background-color: #E7374B !important;
background-color: #6c757d !important;
}
a.bg-secondary:hover,
a.bg-secondary:focus,
button.bg-secondary:hover,
button.bg-secondary:focus {
background-color: #d2192e !important;
background-color: #545b62 !important;
}
.bg-success {
@ -7087,11 +7087,11 @@ button.bg-dark:focus {
}
.border-primary {
border-color: #3176C4 !important;
border-color: #3490dc !important;
}
.border-secondary {
border-color: #E7374B !important;
border-color: #6c757d !important;
}
.border-success {
@ -10685,21 +10685,21 @@ button.bg-dark:focus {
}
.text-primary {
color: #3176C4 !important;
color: #3490dc !important;
}
a.text-primary:hover,
a.text-primary:focus {
color: #225187 !important;
color: #1d68a7 !important;
}
.text-secondary {
color: #E7374B !important;
color: #6c757d !important;
}
a.text-secondary:hover,
a.text-secondary:focus {
color: #bb1629 !important;
color: #494f54 !important;
}
.text-success {

606
public/js/app.js vendored
View file

@ -2773,8 +2773,6 @@ __webpack_require__.r(__webpack_exports__);
//
//
//
//
//
/* harmony default export */ __webpack_exports__["default"] = ({
mounted: function mounted() {
console.log('GainViews Component mounted.');
@ -2793,8 +2791,7 @@ __webpack_require__.r(__webpack_exports__);
newItem: function newItem() {
this.datas.push({
name: '',
file_name: '',
slug_route: ''
file_name: ''
});
},
removeItem: function removeItem(index) {
@ -3064,38 +3061,6 @@ __webpack_require__.r(__webpack_exports__);
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
/* harmony default export */ __webpack_exports__["default"] = ({
mounted: function mounted() {
console.log('GainViews Component mounted.');
@ -3116,8 +3081,7 @@ __webpack_require__.r(__webpack_exports__);
methods: {
handleFileUpload: function handleFileUpload(index) {
var files = event.target.files || event.dataTransfer.files;
if (!files.length) return; // File[0] car on le récupère toujours de l'event au dessus
if (!files.length) return;
this.pdf_winning_proof[index] = files[0];
if (!this.pdf_winning_proof[index]) {
@ -3142,7 +3106,7 @@ __webpack_require__.r(__webpack_exports__);
additional_form: 0,
arcadia_mail_id: null,
pdf_winning_proof: null,
is_default: 0,
need_proof: 1,
gain_view_id: null
});
},
@ -3179,15 +3143,90 @@ __webpack_require__.r(__webpack_exports__);
this.processing = true;
this.response = "En cours de sauvegarde...";
axios.post('/bo/ajax/save-prizes', formData).then(function (response) {
return _this2.datas = response.data;
_this2.datas = response.data;
_this2.response = "Sauvegarde terminée !";
_this2.processing = false;
})["catch"](function (error) {
console.log(error);
this.response = "Erreur lors de la sauvegarde.";
});
this.response = "Sauvegarde terminée !";
setTimeout(function () {
this.processing = false;
}.bind(this), 3000);
});
}
}
});
/***/ }),
/***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/WebCoupons.vue?vue&type=script&lang=js&":
/*!*********************************************************************************************************************************************************************!*\
!*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/WebCoupons.vue?vue&type=script&lang=js& ***!
\*********************************************************************************************************************************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
/* harmony default export */ __webpack_exports__["default"] = ({
mounted: function mounted() {
console.log('WebCoupons Component mounted.');
this.datas = JSON.parse(this.dbdatas);
},
props: ['name', 'dbdatas'],
data: function data() {
return {
datas: []
};
},
watch: {},
methods: {
newItem: function newItem() {
this.datas.push({
web_coupon_identifiant: '',
percentage: 0
});
},
removeItem: function removeItem(index) {
this.datas.splice(index, 1);
}
},
computed: {
totalPercentage: function totalPercentage() {
var total = 0;
this.datas.forEach(function (element) {
return total += parseInt(element.percentage);
});
return total;
}
}
});
@ -39888,7 +39927,7 @@ var render = function() {
_c(
"button",
{
staticClass: "btn btn-secondary btn-sm",
staticClass: "btn btn-dangerbtn-sm",
on: {
click: function($event) {
return _vm.removeItem(item.ip)
@ -40287,7 +40326,7 @@ var render = function() {
_c(
"button",
{
staticClass: "btn btn-secondary btn-sm",
staticClass: "btn btn-danger btn-sm",
on: {
click: function($event) {
return _vm.removeItem(item.id)
@ -40997,7 +41036,7 @@ var render = function() {
_c(
"button",
{
staticClass: "btn btn-secondary btn-sm",
staticClass: "btn btn-danger btn-sm",
attrs: { disabled: _vm.processing },
on: {
click: function($event) {
@ -41173,35 +41212,11 @@ var render = function() {
})
]),
_vm._v(" "),
_c("td", [
_c("input", {
directives: [
{
name: "model",
rawName: "v-model",
value: item.slug_route,
expression: "item.slug_route"
}
],
staticClass: "form-control form-control-sm",
attrs: { type: "text", required: "" },
domProps: { value: item.slug_route },
on: {
input: function($event) {
if ($event.target.composing) {
return
}
_vm.$set(item, "slug_route", $event.target.value)
}
}
})
]),
_vm._v(" "),
_c("td", [
_c(
"button",
{
staticClass: "btn btn-secondary btn-sm",
staticClass: "btn btn-danger btn-sm",
on: {
click: function($event) {
return _vm.removeItem(index)
@ -41279,11 +41294,6 @@ var staticRenderFns = [
_c("span", { staticClass: "required-asterisk" }, [_vm._v("*")])
]),
_vm._v(" "),
_c("th", { attrs: { scope: "col" } }, [
_vm._v("Slug d'accès "),
_c("span", { staticClass: "required-asterisk" }, [_vm._v("*")])
]),
_vm._v(" "),
_c("th", { attrs: { scope: "col" } })
])
])
@ -41656,150 +41666,6 @@ var render = function() {
_c("tr", [
_vm._m(4, true),
_vm._v(" "),
_c("td", { staticClass: "align-middle" }, [
_c("div", { staticClass: "onoffswitch" }, [
_c("input", {
directives: [
{
name: "model",
rawName: "v-model",
value: item.notifications,
expression: "item.notifications"
}
],
staticClass: "onoffswitch-checkbox",
attrs: {
type: "checkbox",
id: "notifications_" + index
},
domProps: {
checked: Array.isArray(item.notifications)
? _vm._i(item.notifications, null) > -1
: item.notifications
},
on: {
change: function($event) {
var $$a = item.notifications,
$$el = $event.target,
$$c = $$el.checked ? true : false
if (Array.isArray($$a)) {
var $$v = null,
$$i = _vm._i($$a, $$v)
if ($$el.checked) {
$$i < 0 &&
_vm.$set(
item,
"notifications",
$$a.concat([$$v])
)
} else {
$$i > -1 &&
_vm.$set(
item,
"notifications",
$$a
.slice(0, $$i)
.concat($$a.slice($$i + 1))
)
}
} else {
_vm.$set(item, "notifications", $$c)
}
}
}
}),
_vm._v(" "),
_c(
"label",
{
staticClass: "onoffswitch-label",
attrs: { for: "notifications_" + index }
},
[
_c("span", { staticClass: "onoffswitch-inner" }),
_vm._v(" "),
_c("span", { staticClass: "onoffswitch-switch" })
]
)
])
])
]),
_vm._v(" "),
_c("tr", [
_vm._m(5, true),
_vm._v(" "),
_c("td", { staticClass: "align-middle" }, [
_c("div", { staticClass: "onoffswitch" }, [
_c("input", {
directives: [
{
name: "model",
rawName: "v-model",
value: item.additional_form,
expression: "item.additional_form"
}
],
staticClass: "onoffswitch-checkbox",
attrs: {
type: "checkbox",
id: "additional_form_" + index
},
domProps: {
checked: Array.isArray(item.additional_form)
? _vm._i(item.additional_form, null) > -1
: item.additional_form
},
on: {
change: function($event) {
var $$a = item.additional_form,
$$el = $event.target,
$$c = $$el.checked ? true : false
if (Array.isArray($$a)) {
var $$v = null,
$$i = _vm._i($$a, $$v)
if ($$el.checked) {
$$i < 0 &&
_vm.$set(
item,
"additional_form",
$$a.concat([$$v])
)
} else {
$$i > -1 &&
_vm.$set(
item,
"additional_form",
$$a
.slice(0, $$i)
.concat($$a.slice($$i + 1))
)
}
} else {
_vm.$set(item, "additional_form", $$c)
}
}
}
}),
_vm._v(" "),
_c(
"label",
{
staticClass: "onoffswitch-label",
attrs: { for: "additional_form_" + index }
},
[
_c("span", { staticClass: "onoffswitch-inner" }),
_vm._v(" "),
_c("span", { staticClass: "onoffswitch-switch" })
]
)
])
])
]),
_vm._v(" "),
_c("tr", [
_vm._m(6, true),
_vm._v(" "),
_c("td", { staticClass: "align-middle" }, [
_c("input", {
directives: [
@ -41862,7 +41728,7 @@ var render = function() {
]),
_vm._v(" "),
_c("tr", [
_vm._m(7, true),
_vm._m(5, true),
_vm._v(" "),
_c("td", { staticClass: "align-middle" }, [
_c("div", { staticClass: "onoffswitch" }, [
@ -41871,23 +41737,23 @@ var render = function() {
{
name: "model",
rawName: "v-model",
value: item.is_default,
expression: "item.is_default"
value: item.need_proof,
expression: "item.need_proof"
}
],
staticClass: "onoffswitch-checkbox",
attrs: {
type: "checkbox",
id: "is_default_" + index
id: "need_proof_" + index
},
domProps: {
checked: Array.isArray(item.is_default)
? _vm._i(item.is_default, null) > -1
: item.is_default
checked: Array.isArray(item.need_proof)
? _vm._i(item.need_proof, null) > -1
: item.need_proof
},
on: {
change: function($event) {
var $$a = item.is_default,
var $$a = item.need_proof,
$$el = $event.target,
$$c = $$el.checked ? true : false
if (Array.isArray($$a)) {
@ -41897,21 +41763,21 @@ var render = function() {
$$i < 0 &&
_vm.$set(
item,
"is_default",
"need_proof",
$$a.concat([$$v])
)
} else {
$$i > -1 &&
_vm.$set(
item,
"is_default",
"need_proof",
$$a
.slice(0, $$i)
.concat($$a.slice($$i + 1))
)
}
} else {
_vm.$set(item, "is_default", $$c)
_vm.$set(item, "need_proof", $$c)
}
}
}
@ -41921,7 +41787,7 @@ var render = function() {
"label",
{
staticClass: "onoffswitch-label",
attrs: { for: "is_default_" + index }
attrs: { for: "need_proof_" + index }
},
[
_c("span", { staticClass: "onoffswitch-inner" }),
@ -41934,7 +41800,7 @@ var render = function() {
]),
_vm._v(" "),
_c("tr", [
_vm._m(8, true),
_vm._m(6, true),
_vm._v(" "),
_c("td", { staticClass: "align-middle" }, [
_c(
@ -41992,7 +41858,7 @@ var render = function() {
_c(
"button",
{
staticClass: "btn btn-secondary btn-sm",
staticClass: "btn btn-danger btn-sm",
on: {
click: function($event) {
return _vm.removeItem(index)
@ -42075,36 +41941,6 @@ var staticRenderFns = [
_c("span", { staticClass: "required-asterisk" }, [_vm._v("*")])
])
},
function() {
var _vm = this
var _h = _vm.$createElement
var _c = _vm._self._c || _h
return _c("td", [
_vm._v("\n Activer les notifications "),
_c("span", { staticClass: "required-asterisk" }, [_vm._v("*")]),
_c("br"),
_vm._v(" "),
_c("small", { staticClass: "text-muted" }, [
_vm._v("Activer l'envoi d'un mail au gagnant")
])
])
},
function() {
var _vm = this
var _h = _vm.$createElement
var _c = _vm._self._c || _h
return _c("td", [
_vm._v("\n Formulaire complémentaire "),
_c("span", { staticClass: "required-asterisk" }, [_vm._v("*")]),
_c("br"),
_vm._v(" "),
_c("small", { staticClass: "text-muted" }, [
_vm._v(
"Si activé, l'utilisateur sera redirigé vers un formulaire complémentaire"
)
])
])
},
function() {
var _vm = this
var _h = _vm.$createElement
@ -42126,13 +41962,13 @@ var staticRenderFns = [
var _h = _vm.$createElement
var _c = _vm._self._c || _h
return _c("td", [
_vm._v("\n Lot par défaut "),
_vm._v("\n Preuve de gain obligatoire "),
_c("span", { staticClass: "required-asterisk" }, [_vm._v("*")]),
_c("br"),
_vm._v(" "),
_c("small", { staticClass: "text-muted" }, [
_vm._v(
"Si activé, ce lot sera systématiquement attribué en cas de perte aux instants gagnants"
"Si activé, il sera obligatoire de fournir des preuves de gain pour ce lot (sticker, ticket de caisse, code barre)."
)
])
])
@ -42152,6 +41988,172 @@ render._withStripped = true
/***/ }),
/***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/WebCoupons.vue?vue&type=template&id=60efcb44&":
/*!*************************************************************************************************************************************************************************************************************!*\
!*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/WebCoupons.vue?vue&type=template&id=60efcb44& ***!
\*************************************************************************************************************************************************************************************************************/
/*! exports provided: render, staticRenderFns */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
var render = function() {
var _vm = this
var _h = _vm.$createElement
var _c = _vm._self._c || _h
return _c("div", [
_c("table", { staticClass: "table table-bordered" }, [
_vm._m(0),
_vm._v(" "),
_c(
"tbody",
{ attrs: { id: "emails" } },
_vm._l(_vm.datas, function(item, index) {
return _c("tr", { key: item.id }, [
_c("td", [_vm._v(_vm._s(index + 1))]),
_vm._v(" "),
_c("td", [
_c("input", {
directives: [
{
name: "model",
rawName: "v-model",
value: item.web_coupon_identifiant,
expression: "item.web_coupon_identifiant"
}
],
staticClass: "form-control form-control-sm",
attrs: { type: "text", required: "" },
domProps: { value: item.web_coupon_identifiant },
on: {
input: function($event) {
if ($event.target.composing) {
return
}
_vm.$set(
item,
"web_coupon_identifiant",
$event.target.value
)
}
}
})
]),
_vm._v(" "),
_c("td", [
_c("input", {
directives: [
{
name: "model",
rawName: "v-model",
value: item.percentage,
expression: "item.percentage"
}
],
staticClass: "form-control form-control-sm",
class: {
border: _vm.totalPercentage > 100,
"border-danger": _vm.totalPercentage > 100
},
attrs: { type: "number", required: "" },
domProps: { value: item.percentage },
on: {
input: function($event) {
if ($event.target.composing) {
return
}
_vm.$set(item, "percentage", $event.target.value)
}
}
})
]),
_vm._v(" "),
_c("td", [
_c(
"button",
{
staticClass: "btn btn-danger btn-sm",
on: {
click: function($event) {
return _vm.removeItem(index)
}
}
},
[_vm._v("Supprimer")]
)
])
])
}),
0
)
]),
_vm._v(" "),
_c("div", { staticClass: "form-group text-right" }, [
_c(
"small",
{
directives: [
{
name: "show",
rawName: "v-show",
value: _vm.totalPercentage > 100,
expression: "totalPercentage > 100"
}
],
staticClass: "text-danger"
},
[_vm._v("Poucentage total > 100%")]
),
_vm._v(" "),
_c(
"a",
{
staticClass: "btn btn-primary btn-sm text-white",
attrs: { role: "button" },
on: { click: _vm.newItem }
},
[_vm._v("Ajouter un coupon")]
),
_vm._v(" "),
_c("input", {
attrs: { type: "hidden", name: _vm.name, required: "" },
domProps: { value: JSON.stringify(_vm.datas) }
})
])
])
}
var staticRenderFns = [
function() {
var _vm = this
var _h = _vm.$createElement
var _c = _vm._self._c || _h
return _c("thead", [
_c("tr", [
_c("th", { staticClass: "w-auto", attrs: { scope: "col" } }),
_vm._v(" "),
_c("th", { staticClass: "w-50", attrs: { scope: "col" } }, [
_vm._v("Identifiant coupon "),
_c("span", { staticClass: "required-asterisk" }, [_vm._v("*")])
]),
_vm._v(" "),
_c("th", { staticClass: "w-auto", attrs: { scope: "col" } }, [
_vm._v("Pourcentage "),
_c("span", { staticClass: "required-asterisk" }, [_vm._v("*")])
]),
_vm._v(" "),
_c("th", { staticClass: "w-auto", attrs: { scope: "col" } })
])
])
}
]
render._withStripped = true
/***/ }),
/***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/WinNotification.vue?vue&type=template&id=7f660068&":
@ -54474,6 +54476,7 @@ Vue.component('codes-ean', __webpack_require__(/*! ./components/CodesEAN.vue */
Vue.component('banned-ip', __webpack_require__(/*! ./components/BannedIP.vue */ "./resources/js/components/BannedIP.vue")["default"]);
Vue.component('faq-themes', __webpack_require__(/*! ./components/FaqThemes.vue */ "./resources/js/components/FaqThemes.vue")["default"]);
Vue.component('faq-questions', __webpack_require__(/*! ./components/FaqQuestions.vue */ "./resources/js/components/FaqQuestions.vue")["default"]);
Vue.component('web-coupons', __webpack_require__(/*! ./components/WebCoupons.vue */ "./resources/js/components/WebCoupons.vue")["default"]);
/**
* Next, we will create a fresh Vue application instance and attach it to
* the page. Then, you may begin adding components to this application
@ -55120,6 +55123,75 @@ __webpack_require__.r(__webpack_exports__);
/***/ }),
/***/ "./resources/js/components/WebCoupons.vue":
/*!************************************************!*\
!*** ./resources/js/components/WebCoupons.vue ***!
\************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _WebCoupons_vue_vue_type_template_id_60efcb44___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./WebCoupons.vue?vue&type=template&id=60efcb44& */ "./resources/js/components/WebCoupons.vue?vue&type=template&id=60efcb44&");
/* harmony import */ var _WebCoupons_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./WebCoupons.vue?vue&type=script&lang=js& */ "./resources/js/components/WebCoupons.vue?vue&type=script&lang=js&");
/* empty/unused harmony star reexport *//* harmony import */ var _node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js */ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js");
/* normalize component */
var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
_WebCoupons_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
_WebCoupons_vue_vue_type_template_id_60efcb44___WEBPACK_IMPORTED_MODULE_0__["render"],
_WebCoupons_vue_vue_type_template_id_60efcb44___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
false,
null,
null,
null
)
/* hot reload */
if (false) { var api; }
component.options.__file = "resources/js/components/WebCoupons.vue"
/* harmony default export */ __webpack_exports__["default"] = (component.exports);
/***/ }),
/***/ "./resources/js/components/WebCoupons.vue?vue&type=script&lang=js&":
/*!*************************************************************************!*\
!*** ./resources/js/components/WebCoupons.vue?vue&type=script&lang=js& ***!
\*************************************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_WebCoupons_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/babel-loader/lib??ref--4-0!../../../node_modules/vue-loader/lib??vue-loader-options!./WebCoupons.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/WebCoupons.vue?vue&type=script&lang=js&");
/* empty/unused harmony star reexport */ /* harmony default export */ __webpack_exports__["default"] = (_node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_WebCoupons_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
/***/ }),
/***/ "./resources/js/components/WebCoupons.vue?vue&type=template&id=60efcb44&":
/*!*******************************************************************************!*\
!*** ./resources/js/components/WebCoupons.vue?vue&type=template&id=60efcb44& ***!
\*******************************************************************************/
/*! exports provided: render, staticRenderFns */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_WebCoupons_vue_vue_type_template_id_60efcb44___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!../../../node_modules/vue-loader/lib??vue-loader-options!./WebCoupons.vue?vue&type=template&id=60efcb44& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/WebCoupons.vue?vue&type=template&id=60efcb44&");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "render", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_WebCoupons_vue_vue_type_template_id_60efcb44___WEBPACK_IMPORTED_MODULE_0__["render"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_WebCoupons_vue_vue_type_template_id_60efcb44___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
/***/ }),
/***/ "./resources/js/components/WinNotification.vue":

14
resources/js/app.js vendored
View file

@ -8,6 +8,10 @@ require('./bootstrap');
window.Vue = require('vue');
import Clipboard from 'v-clipboard'
Vue.use(Clipboard);
/**
* The following block of code may be used to automatically register your
* Vue components. It will recursively scan this directory for the Vue
@ -19,7 +23,15 @@ window.Vue = require('vue');
// const files = require.context('./', true, /\.vue$/i)
// files.keys().map(key => Vue.component(key.split('/').pop().split('.')[0], files(key).default))
Vue.component('example-component', require('./components/ExampleComponent.vue').default);
Vue.component('win-notification', require('./components/WinNotification.vue').default);
Vue.component('gain-views', require('./components/GainViews.vue').default);
Vue.component('prizes', require('./components/Prizes.vue').default);
Vue.component('instant-win', require('./components/InstantWin.vue').default);
Vue.component('codes-ean', require('./components/CodesEAN.vue').default);
Vue.component('banned-ip', require('./components/BannedIP.vue').default);
Vue.component('faq-themes', require('./components/FaqThemes.vue').default);
Vue.component('faq-questions', require('./components/FaqQuestions.vue').default);
Vue.component('web-coupons', require('./components/WebCoupons.vue').default);
/**
* Next, we will create a fresh Vue application instance and attach it to

View file

@ -40,7 +40,7 @@
<tbody>
<tr v-for="item in displayedips" v-bind:key="item.id">
<td><input class="form-control form-control-sm" v-model="item.ip" type="text" disabled></td>
<td><button @click="removeItem(item.ip)" class="btn btn-secondary btn-sm">Supprimer</button></td>
<td><button @click="removeItem(item.ip)" class="btn btn-dangerbtn-sm">Supprimer</button></td>
</tr>
</tbody>
</table>

View file

@ -42,7 +42,7 @@
<tr v-for="item in displayedCodes" v-bind:key="item.id">
<td><input class="form-control form-control-sm" v-model="item.code" type="text" disabled></td>
<td><input class="form-control form-control-sm" v-model="item.product" type="text" @keyup="updateBaseData(item.code)" required></td>
<td><button @click="removeItem(item.id)" class="btn btn-secondary btn-sm">Supprimer</button></td>
<td><button @click="removeItem(item.id)" class="btn btn-danger btn-sm">Supprimer</button></td>
</tr>
</tbody>
</table>

View file

@ -36,7 +36,7 @@
<tr v-for="(item, index) in datas" v-bind:key="item.id">
<td><input class="form-control form-control-sm" v-model="item.name" type="text" required></td>
<td>
<button @click="removeItem(index)" :disabled="processing" class="btn btn-secondary btn-sm">
<button @click="removeItem(index)" :disabled="processing" class="btn btn-danger btn-sm">
Supprimer
<div class="spinner-border spinner-border-sm text-light" role="status" v-show="processing">
<span class="sr-only">Loading...</span>

View file

@ -19,7 +19,7 @@
<tr v-for="(item, index) in datas" v-bind:key="item.id">
<td><input class="form-control form-control-sm" v-model="item.name" type="text" required></td>
<td><input class="form-control form-control-sm" v-model="item.file_name" type="text" required></td>
<td><button @click="removeItem(index)" class="btn btn-secondary btn-sm">Supprimer</button></td>
<td><button @click="removeItem(index)" class="btn btn-danger btn-sm">Supprimer</button></td>
</tr>
</tbody>
</table>

View file

@ -54,36 +54,6 @@
</td>
<td class="align-middle"><input class="form-control form-control-sm" v-model="item.quantity" type="number" required></td>
</tr>
<tr>
<td>
Activer les notifications <span class="required-asterisk">*</span><br/>
<small class="text-muted">Activer l'envoi d'un mail au gagnant</small>
</td>
<td class="align-middle">
<div class="onoffswitch">
<input type="checkbox" :id="'notifications_' + index" class="onoffswitch-checkbox" v-model="item.notifications">
<label class="onoffswitch-label" :for="'notifications_' + index">
<span class="onoffswitch-inner"></span>
<span class="onoffswitch-switch"></span>
</label>
</div>
</td>
</tr>
<tr>
<td>
Formulaire complémentaire <span class="required-asterisk">*</span><br/>
<small class="text-muted">Si activé, l'utilisateur sera redirigé vers un formulaire complémentaire</small>
</td>
<td class="align-middle">
<div class="onoffswitch">
<input type="checkbox" :id="'additional_form_' + index" class="onoffswitch-checkbox" v-model="item.additional_form">
<label class="onoffswitch-label" :for="'additional_form_' + index">
<span class="onoffswitch-inner"></span>
<span class="onoffswitch-switch"></span>
</label>
</div>
</td>
</tr>
<tr>
<td>
Id courrier Arcadia <span class="required-asterisk">*</span><br/>
@ -102,13 +72,13 @@
</tr>
<tr>
<td>
Lot par défaut <span class="required-asterisk">*</span><br/>
<small class="text-muted">Si activé, ce lot sera systématiquement attribué en cas de perte aux instants gagnants</small>
Preuve de gain obligatoire <span class="required-asterisk">*</span><br/>
<small class="text-muted">Si activé, il sera obligatoire de fournir des preuves de gain pour ce lot (sticker, ticket de caisse, code barre).</small>
</td>
<td class="align-middle">
<div class="onoffswitch">
<input type="checkbox" :id="'is_default_' + index" class="onoffswitch-checkbox" v-model="item.is_default">
<label class="onoffswitch-label" :for="'is_default_' + index">
<input type="checkbox" :id="'need_proof_' + index" class="onoffswitch-checkbox" v-model="item.need_proof">
<label class="onoffswitch-label" :for="'need_proof_' + index">
<span class="onoffswitch-inner"></span>
<span class="onoffswitch-switch"></span>
</label>
@ -130,7 +100,7 @@
Supprimer le lot
</td>
<td class="align-middle">
<button @click="removeItem(index)" class="btn btn-secondary btn-sm">Supprimer</button>
<button @click="removeItem(index)" class="btn btn-danger btn-sm">Supprimer</button>
</td>
</tr>
</tbody>
@ -200,7 +170,7 @@
additional_form: 0,
arcadia_mail_id: null,
pdf_winning_proof: null,
is_default: 0,
need_proof: 1,
gain_view_id: null
});
},
@ -236,16 +206,17 @@
this.response = "En cours de sauvegarde..."
axios.post('/bo/ajax/save-prizes', formData)
.then(
response => (this.datas = response.data)
(response) => {
this.datas = response.data;
this.response = "Sauvegarde terminée !";
this.processing = false;
}
)
.catch(function (error) {
console.log(error);
this.response = "Erreur lors de la sauvegarde.";
});
this.response = "Sauvegarde terminée !";
setTimeout(function() {
this.processing = false;
}.bind(this), 3000);
});
}
}
}

View file

@ -0,0 +1,66 @@
<template>
<div>
<table class="table table-bordered">
<thead>
<tr>
<th class="w-auto" scope="col"></th>
<th class="w-50" scope="col">Identifiant coupon <span class="required-asterisk">*</span></th>
<th class="w-auto" scope="col">Pourcentage <span class="required-asterisk">*</span></th>
<th class="w-auto" scope="col"></th>
</tr>
</thead>
<tbody id="emails">
<tr v-for="(item, index) in datas" v-bind:key="item.id">
<td>{{index + 1}}</td>
<td><input class="form-control form-control-sm" v-model="item.web_coupon_identifiant" type="text" required></td>
<td>
<input class="form-control form-control-sm" :class="{ border: totalPercentage > 100, 'border-danger': totalPercentage > 100}"
v-model="item.percentage" type="number" required>
</td>
<td><button @click="removeItem(index)" class="btn btn-danger btn-sm">Supprimer</button></td>
</tr>
</tbody>
</table>
<div class="form-group text-right">
<small v-show="totalPercentage > 100" class="text-danger">Poucentage total > 100%</small>
<a class="btn btn-primary btn-sm text-white" @click="newItem" role="button">Ajouter un coupon</a>
<input type="hidden" :name="name" :value="JSON.stringify(datas)" required>
</div>
</div>
</template>
<script>
export default {
mounted() {
console.log('WebCoupons Component mounted.');
this.datas = JSON.parse(this.dbdatas);
},
props: [
'name',
'dbdatas',
],
data() {
return {
datas: []
}
},
watch: {
},
methods: {
newItem() {
this.datas.push({web_coupon_identifiant: '', percentage: 0});
},
removeItem(index) {
this.datas.splice(index, 1);
}
},
computed: {
totalPercentage() {
let total = 0;
this.datas.forEach(element => total += parseInt(element.percentage));
return total;
}
}
}
</script>

View file

@ -6,3 +6,6 @@
// Bootstrap
@import '~bootstrap/scss/bootstrap';
// CSS custom
@import 'app_custom';

View file

@ -33,7 +33,7 @@
</div>
</div>
<div class="card-footer text-center">
<input type="submit" class="btn btn-secondary" value="Enregistrer">
<input type="submit" class="btn btn-success" value="Enregistrer">
</div>
</form>
</div>

View file

@ -6,10 +6,10 @@
Règlages du jeu
</div>
<div class="card-body">
<form action="{{route('bo.settings')}}" method="POST" enctype="multipart/form-data">
@method('PUT')
@csrf
<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">
@if ($errors->any())
@ -245,32 +245,6 @@
</div>
</td>
</tr>
<tr class="form-group" id="reductions_distribution">
<td>
<label class="col-form-label" for="reductions_distribution">
Mode de distribution
</label>
</td>
<td class="align-middle">
<label class="col-form-label">
@if ($settings->reductions_distribution == 0)
<input type="radio" name="reductions_distribution" value="0" checked>
@else
<input type="radio" name="reductions_distribution" value="0">
@endif
Mur ou panier préprogrammé
</label>
<br/>
<label class="col-form-label">
@if ($settings->reductions_distribution == 1)
<input type="radio" name="reductions_distribution" value="1" checked>
@else
<input type="radio" name="reductions_distribution" value="1">
@endif
Panier de coupon
</label>
</td>
</tr>
<tr class="form-group" id="reductions_site">
<td>
<label class="col-form-label" for="reductions_site">
@ -291,14 +265,9 @@
<input class="form-control" type="text" name="reductions_campaign" value="{{$settings->reductions_campaign}}">
</td>
</tr>
<tr class="form-group" id="reductions_id_coupon">
<td>
<label class="col-form-label" for="reductions_id_coupon">
Identifiant du web coupon <span class="required-asterisk">*</span>
</label>
</td>
<td class="align-middle">
<input class="form-control" type="text" name="reductions_id_coupon" value="{{$settings->reductions_id_coupon}}">
<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>
@ -355,45 +324,6 @@
</tbody>
</table>
<hr/>
<h5 class="card-subtitle">
Paramètrage des mails<br/>
</h5>
<br/>
<table class="table table-bordered">
<tbody>
<tr class="form-group">
<td class="w-50">
<label class="col-form-label" for="mail_from">
Adresse mail d'envoi (From) <span class="required-asterisk">*</span>
</label>
</td>
<td class="align-middle">
<input class="form-control" type="email" name="mail_from" value="{{$settings->mail_from}}" required>
</td>
</tr>
<tr class="form-group">
<td>
<label class="col-form-label" for="mail_sender">
Sender <span class="required-asterisk">*</span>
</label>
</td>
<td class="align-middle">
<input class="form-control" type="email" name="mail_sender" value="{{$settings->mail_sender}}" required>
</td>
</tr>
<tr class="form-group">
<td>
<label class="col-form-label" for="mail_sender_name">
Nom de l'envoyeur (sender name)
</label>
</td>
<td class="align-middle">
<input class="form-control" type="text" name="mail_sender_name" value="{{$settings->mail_sender_name}}">
</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>
@ -402,11 +332,11 @@
<win-notification name="notification_emails" dbdatas="{{$settings->notification_emails}}"/>
</div>
</div>
<div class="card-footer text-center">
<input type="submit" class="btn btn-secondary" value="Enregistrer">
</div>
</form>
</div>
</div>
<div class="card-footer text-center">
<input type="submit" class="btn btn-success" value="Enregistrer">
</div>
</form>
</div>
@endsection
@ -416,24 +346,21 @@
// Gestion du tableau pour reduction
$("input[name=reductions_activated]").change(function() {
if (!$('input[name=reductions_activated]').is(':checked')) {
$("#reductions_distribution").hide();
$("#reductions_site").hide();
$("#reductions_campaign").hide();
$("#reductions_id_coupon").hide();
$("#reductions_web_coupons").hide();
} else {
$("#reductions_distribution").show();
$("#reductions_site").show();
$("#reductions_campaign").show();
$("#reductions_id_coupon").show();
$("#reductions_web_coupons").show();
}
});
$(document).ready(function() {
if (!$('input[name=reductions_activated]').is(':checked')) {
$("#reductions_distribution").hide();
$("#reductions_site").hide();
$("#reductions_campaign").hide();
$("#reductions_id_coupon").hide();
$("#reductions_web_coupons").hide();
}
if (!$("input[name=activated_teaser]").is(':checked')) {
$("#teaser_end_activity").hide();

View file

@ -0,0 +1,42 @@
@extends('layouts.bo')
@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)
<th scope="col">Code EAN</th>
@endif
<th scope="col">Code unique</th>
<th scope="col">Sticker</th>
<th scope="col">Code barre</th>
<th scope="col">Ticket</th>
</thead>
<tbody>
@foreach($winnersList as $winner)
<tr>
<td>{{ \Carbon\Carbon::parse($winner->created_at)->format('d/m/Y à H:i') }}</td>
<td>{{$winner->instant_win->prize->label_one}}</td>
<td>{{$winner->user->email}}</td>
@if ($settings->use_ean_codes)
<td>{{$winner->code_ean->code}}</td>
@endif
<td>{{$winner->code->code_unique}}</td>
<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>
<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>
<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>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
@endsection

View file

@ -6,5 +6,9 @@
@section('content')
<p>Vous avez gagné {{$prize->label_one}} !</p>
<p><a href="{{route('winning-proof')}}" class="btn btn-success">Envoyer mes preuves de gain</a></p>
<form method="POST" action="{{route('winning-proof')}}">
@method('PUT')
@csrf
<button type="submit" class="btn btn-success">Envoyer mes preuves de gain</button>
</form>
@endsection

View file

@ -27,7 +27,7 @@
<td>{{$p->additional_form}}</td>
<td>{{$p->arcadia_mail_id}}</td>
<td><span class="badge badge-info">{{$p->pdf_winning_proof}}</span></td>
<td>{{$p->is_default}}</td>
<td>{{$p->need_proof}}</td>
</tr>
@endforeach
</tbody>

View file

@ -5,11 +5,18 @@
@section('content')
<p>Société : {{$settingsGlobal->company}} et nom du jeu : {{$settingsGlobal->name}}</p>
<p>
Test pour gain :
<form method="POST" action="{{route('saisir-code')}}">
@csrf
<input type="number" name="prize" class="form-control col-md-2" required>
<button type="submit" class="btn btn-success">Tester</button>
</form>
</p>
<ul>Toutes les routes :
<li><a href="{{route('home')}}">Accueil</a></li>
<li><a href="{{route('teaser')}}">Teaser</a></li>
<li><a href="{{route('reglement')}}">Règlement</a></li>
<li><a href="{{route('charte')}}">Charte</a></li>
<li><a href="{{route('legals')}}">Mentions légales</a></li>
<li><a href="{{route('end')}}">Page de fin de jeu</a></li>
<li><a href="{{route('faq')}}">FAQ</a></li>
<li><a href="{{route('comment-jouer')}}">Comment jouer</a></li>
<li><a href="{{route('les-gains')}}">Les gains</a></li>
<li><a href="{{route('saisir-code')}}">Saisie du code (nécessite d'être connecté)</a></li>
<li><a href="{{route('login')}}">Login</a></li>
<li><a href="{{route('inscription')}}">Inscription</a></li>
</ul>
@endsection

View file

@ -27,7 +27,7 @@
<td>{{$p->additional_form}}</td>
<td>{{$p->arcadia_mail_id}}</td>
<td><span class="badge badge-info">{{$p->pdf_winning_proof}}</span></td>
<td>{{$p->is_default}}</td>
<td>{{$p->need_proof}}</td>
</tr>
@endforeach
</tbody>

View file

@ -3,7 +3,7 @@
@section('title', 'Réduction')
@section('content')
<p>Gain d'une réduction</p>
<p>La réduction</p>
<p>Gain d'une réduction :</p>
<p>{{$crmCoupon->link}}</p>
<p><a class="btn btn-success" href="{{route('saisir-code')}}">Rejouer !</a>
@endsection

View file

@ -28,7 +28,7 @@
<td>{{$p->additional_form}}</td>
<td>{{$p->arcadia_mail_id}}</td>
<td><span class="badge badge-info">{{$p->pdf_winning_proof}}</span></td>
<td>{{$p->is_default}}</td>
<td>{{$p->need_proof}}</td>
</tr>
@endforeach
</tbody>

View file

@ -87,7 +87,7 @@
<a class="nav-link" href="{{route('bo.codes-ean')}}">Code EAN</a>
<!-- TODO : Social share et liste des gagnants -->
<a class="nav-link" href="#_">Social share</a>
<a class="nav-link" href="#_">Liste des gagnants</a>
<a class="nav-link" href="{{route('bo.winners-list')}}">Liste des gagnants</a>
<a class="nav-link" href="{{route('bo.banned-ip')}}">IP Bannies</a>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button">Contenus</a>

View file

@ -30,15 +30,14 @@ Route::put('/change-mdp', 'LoginController@changePassword')->name('change-passwo
// Front nécessitant d'être connecté
Route::get('/saisir-code', 'EnterCodeController@index')->name('saisir-code')->middleware('auth');
// TODO : Passer saisir-code en put ? Après ajout de participation
Route::post('/saisir-code', 'EnterCodeController@participate')->name('participate')->middleware('auth');
Route::get('/preuve-de-gain', 'WinningProofController@index')->name('winning-proof')->middleware('auth');
Route::put('/saisir-code', 'EnterCodeController@formWinningProof')->name('winning-proof')->middleware('auth');
Route::put('/rejouer', 'WinningProofController@sendWinningProof')->name('send-winning-proof')->middleware('auth');
// Authentification
Route::get('/login', 'LoginController@index')->name('login');
Route::post('/login', 'LoginController@authenticate')->name('authenticate');
Route::post('/logout', 'LoginController@logout')->name('logout');
Route::post('/logout', 'LoginController@logout')->name('logout')->middleware('auth');
Route::get('/inscription', 'RegisterController@index')->name('inscription');
Route::post('/inscription', 'RegisterController@register')->name('register');
@ -83,4 +82,6 @@ Route::namespace('Bo')
// Codes uniques
Route::get('/codes', 'CodesController@index')->name('codes');
Route::post('/codes', 'CodesController@generate')->name('generate-codes');
// Liste des gagnants
Route::get('/winners-list', 'WinnersListController@index')->name('winners-list');
});