From a8d2471f1f8d3aa4482db26427f2cea28c0738e2 Mon Sep 17 00:00:00 2001
From: Romain Bonhomme
Date: Wed, 4 Nov 2020 11:49:43 +0100
Subject: [PATCH] Logique de participation - Ajout de liste des gagnants
---
MesBR.php | 100 +++
app/Http/Controllers/EnterCodeController.php | 189 +++++-
.../Controllers/WinningProofController.php | 28 +-
app/Http/Controllers/bo/PrizesController.php | 8 +-
.../Controllers/bo/SettingsController.php | 16 +-
.../Controllers/bo/WinnersListController.php | 17 +
app/Jobs/ProcessUniqueCode.php | 1 -
app/Mail/WinningProof.php | 8 +-
app/Models/Codes.php | 4 +
app/Models/CodesEAN.php | 4 +
app/Models/InstantWin.php | 4 +
app/Models/Participation.php | 30 +
app/Models/Reductions.php | 12 +
app/User.php | 4 +
composer.json | 3 +-
.../2020_10_12_123129_create_settings.php | 6 +-
.../2020_10_16_091811_create_prizes.php | 4 +-
.../2020_10_20_120243_create_instant_win.php | 2 +-
.../2020_10_20_165858_create_codes.php | 2 +-
...2020_10_28_091935_create_participation.php | 15 +-
.../2020_11_03_160038_create_reductions.php | 35 +
..._161626_participation_add_reduction_id.php | 33 +
...56_update_instant_win_participation_id.php | 33 +
database/seeds/SettingsSeeder.php | 4 +-
public/css/app.css | 264 ++++----
public/js/app.js | 606 ++++++++++--------
resources/js/app.js | 14 +-
resources/js/components/BannedIP.vue | 2 +-
resources/js/components/CodesEAN.vue | 2 +-
resources/js/components/FaqThemes.vue | 2 +-
resources/js/components/GainViews.vue | 2 +-
resources/js/components/Prizes.vue | 53 +-
resources/js/components/WebCoupons.vue | 66 ++
resources/sass/app.scss | 3 +
resources/views/bo/content/manage.blade.php | 2 +-
.../views/bo/list-winners/index.blade.php | 0
resources/views/bo/settings/manage.blade.php | 103 +--
.../views/bo/winners-list/index.blade.php | 42 ++
resources/views/front/basic/gain1.blade.php | 6 +-
resources/views/front/basic/gains.blade.php | 2 +-
resources/views/front/basic/home.blade.php | 21 +-
.../views/front/basic/how-to-play.blade.php | 2 +-
.../views/front/basic/reduction.blade.php | 4 +-
resources/views/front/basic/teaser.blade.php | 2 +-
resources/views/layouts/bo.blade.php | 2 +-
routes/web.php | 7 +-
46 files changed, 1138 insertions(+), 631 deletions(-)
create mode 100644 MesBR.php
create mode 100644 app/Http/Controllers/bo/WinnersListController.php
create mode 100644 app/Models/Participation.php
create mode 100644 app/Models/Reductions.php
create mode 100644 database/migrations/2020_11_03_160038_create_reductions.php
create mode 100644 database/migrations/2020_11_03_161626_participation_add_reduction_id.php
create mode 100644 database/migrations/2020_11_04_102756_update_instant_win_participation_id.php
create mode 100644 resources/js/components/WebCoupons.vue
delete mode 100644 resources/views/bo/list-winners/index.blade.php
create mode 100644 resources/views/bo/winners-list/index.blade.php
diff --git a/MesBR.php b/MesBR.php
new file mode 100644
index 0000000..4be61c5
--- /dev/null
+++ b/MesBR.php
@@ -0,0 +1,100 @@
+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);
+ }
+}
diff --git a/app/Http/Controllers/EnterCodeController.php b/app/Http/Controllers/EnterCodeController.php
index 07c6c46..650453f 100644
--- a/app/Http/Controllers/EnterCodeController.php
+++ b/app/Http/Controllers/EnterCodeController.php
@@ -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');
+ }
}
diff --git a/app/Http/Controllers/WinningProofController.php b/app/Http/Controllers/WinningProofController.php
index f99d4d9..7700df2 100644
--- a/app/Http/Controllers/WinningProofController.php
+++ b/app/Http/Controllers/WinningProofController.php
@@ -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');
diff --git a/app/Http/Controllers/bo/PrizesController.php b/app/Http/Controllers/bo/PrizesController.php
index 82e29ae..23fd2d8 100644
--- a/app/Http/Controllers/bo/PrizesController.php
+++ b/app/Http/Controllers/bo/PrizesController.php
@@ -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])) {
diff --git a/app/Http/Controllers/bo/SettingsController.php b/app/Http/Controllers/bo/SettingsController.php
index 0129a5f..3cccf9e 100644
--- a/app/Http/Controllers/bo/SettingsController.php
+++ b/app/Http/Controllers/bo/SettingsController.php
@@ -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'));
diff --git a/app/Http/Controllers/bo/WinnersListController.php b/app/Http/Controllers/bo/WinnersListController.php
new file mode 100644
index 0000000..21f83f1
--- /dev/null
+++ b/app/Http/Controllers/bo/WinnersListController.php
@@ -0,0 +1,17 @@
+', null)->get();
+ $settings = Settings::select('use_ean_codes')->first();
+ return view('bo.winners-list.index', compact('winnersList', 'settings'));
+ }
+}
diff --git a/app/Jobs/ProcessUniqueCode.php b/app/Jobs/ProcessUniqueCode.php
index 5f66a65..e383d0d 100644
--- a/app/Jobs/ProcessUniqueCode.php
+++ b/app/Jobs/ProcessUniqueCode.php
@@ -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){
diff --git a/app/Mail/WinningProof.php b/app/Mail/WinningProof.php
index be61f10..00a53ff 100644
--- a/app/Mail/WinningProof.php
+++ b/app/Mail/WinningProof.php
@@ -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);
}
}
diff --git a/app/Models/Codes.php b/app/Models/Codes.php
index 3d6a379..05ba9bc 100644
--- a/app/Models/Codes.php
+++ b/app/Models/Codes.php
@@ -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');
+ }
}
diff --git a/app/Models/CodesEAN.php b/app/Models/CodesEAN.php
index b6b3b47..dc45a8d 100644
--- a/app/Models/CodesEAN.php
+++ b/app/Models/CodesEAN.php
@@ -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');
+ }
}
diff --git a/app/Models/InstantWin.php b/app/Models/InstantWin.php
index 6e29c58..8ac20ba 100644
--- a/app/Models/InstantWin.php
+++ b/app/Models/InstantWin.php
@@ -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');
+ }
}
diff --git a/app/Models/Participation.php b/app/Models/Participation.php
new file mode 100644
index 0000000..45cba2e
--- /dev/null
+++ b/app/Models/Participation.php
@@ -0,0 +1,30 @@
+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');
+ }
+}
diff --git a/app/Models/Reductions.php b/app/Models/Reductions.php
new file mode 100644
index 0000000..fadc642
--- /dev/null
+++ b/app/Models/Reductions.php
@@ -0,0 +1,12 @@
+hasOne('App\Models\Participation', 'participation_id');
+ }
+}
diff --git a/app/User.php b/app/User.php
index 1a136a2..f3774af 100644
--- a/app/User.php
+++ b/app/User.php
@@ -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');
+ }
}
diff --git a/composer.json b/composer.json
index 03316e6..68f0042 100644
--- a/composer.json
+++ b/composer.json
@@ -40,7 +40,8 @@
"classmap": [
"database/seeds",
"database/factories",
- "ldccrm_client"
+ "ldccrm_client",
+ "MesBR.php"
]
},
"autoload-dev": {
diff --git a/database/migrations/2020_10_12_123129_create_settings.php b/database/migrations/2020_10_12_123129_create_settings.php
index b7eeb91..7f4d9c4 100644
--- a/database/migrations/2020_10_12_123129_create_settings.php
+++ b/database/migrations/2020_10_12_123129_create_settings.php
@@ -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');
diff --git a/database/migrations/2020_10_16_091811_create_prizes.php b/database/migrations/2020_10_16_091811_create_prizes.php
index 9ea5fc2..cab3cb8 100644
--- a/database/migrations/2020_10_16_091811_create_prizes.php
+++ b/database/migrations/2020_10_16_091811_create_prizes.php
@@ -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();
});
diff --git a/database/migrations/2020_10_20_120243_create_instant_win.php b/database/migrations/2020_10_20_120243_create_instant_win.php
index f34ba1e..237359e 100644
--- a/database/migrations/2020_10_20_120243_create_instant_win.php
+++ b/database/migrations/2020_10_20_120243_create_instant_win.php
@@ -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);
});
}
diff --git a/database/migrations/2020_10_20_165858_create_codes.php b/database/migrations/2020_10_20_165858_create_codes.php
index 1f7d8cc..9814487 100644
--- a/database/migrations/2020_10_20_165858_create_codes.php
+++ b/database/migrations/2020_10_20_165858_create_codes.php
@@ -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');
});
}
diff --git a/database/migrations/2020_10_28_091935_create_participation.php b/database/migrations/2020_10_28_091935_create_participation.php
index c02ef61..44a4a4f 100644
--- a/database/migrations/2020_10_28_091935_create_participation.php
+++ b/database/migrations/2020_10_28_091935_create_participation.php
@@ -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();
});
}
diff --git a/database/migrations/2020_11_03_160038_create_reductions.php b/database/migrations/2020_11_03_160038_create_reductions.php
new file mode 100644
index 0000000..1d26702
--- /dev/null
+++ b/database/migrations/2020_11_03_160038_create_reductions.php
@@ -0,0 +1,35 @@
+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');
+ }
+}
diff --git a/database/migrations/2020_11_03_161626_participation_add_reduction_id.php b/database/migrations/2020_11_03_161626_participation_add_reduction_id.php
new file mode 100644
index 0000000..f260c09
--- /dev/null
+++ b/database/migrations/2020_11_03_161626_participation_add_reduction_id.php
@@ -0,0 +1,33 @@
+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");
+ });
+ }
+}
diff --git a/database/migrations/2020_11_04_102756_update_instant_win_participation_id.php b/database/migrations/2020_11_04_102756_update_instant_win_participation_id.php
new file mode 100644
index 0000000..e926ba4
--- /dev/null
+++ b/database/migrations/2020_11_04_102756_update_instant_win_participation_id.php
@@ -0,0 +1,33 @@
+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");
+ });
+ }
+}
diff --git a/database/seeds/SettingsSeeder.php b/database/seeds/SettingsSeeder.php
index d9e6bc8..4cef026 100644
--- a/database/seeds/SettingsSeeder.php
+++ b/database/seeds/SettingsSeeder.php
@@ -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();
}
}
diff --git a/public/css/app.css b/public/css/app.css
index 36d3303..ffaa1c4 100644
--- a/public/css/app.css
+++ b/public/css/app.css
@@ -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 {
diff --git a/public/js/app.js b/public/js/app.js
index 495adb4..f90652c 100644
--- a/public/js/app.js
+++ b/public/js/app.js
@@ -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":
diff --git a/resources/js/app.js b/resources/js/app.js
index aa19e31..540fc40 100644
--- a/resources/js/app.js
+++ b/resources/js/app.js
@@ -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
diff --git a/resources/js/components/BannedIP.vue b/resources/js/components/BannedIP.vue
index d78dfec..90a03a4 100644
--- a/resources/js/components/BannedIP.vue
+++ b/resources/js/components/BannedIP.vue
@@ -40,7 +40,7 @@
- Supprimer
+ Supprimer
diff --git a/resources/js/components/CodesEAN.vue b/resources/js/components/CodesEAN.vue
index 95b7e87..7e42d12 100644
--- a/resources/js/components/CodesEAN.vue
+++ b/resources/js/components/CodesEAN.vue
@@ -42,7 +42,7 @@
- Supprimer
+ Supprimer
diff --git a/resources/js/components/FaqThemes.vue b/resources/js/components/FaqThemes.vue
index 4e44d03..6f7c457 100644
--- a/resources/js/components/FaqThemes.vue
+++ b/resources/js/components/FaqThemes.vue
@@ -36,7 +36,7 @@
-
+
Supprimer
Loading...
diff --git a/resources/js/components/GainViews.vue b/resources/js/components/GainViews.vue
index 5284747..75a1d33 100644
--- a/resources/js/components/GainViews.vue
+++ b/resources/js/components/GainViews.vue
@@ -19,7 +19,7 @@
- Supprimer
+ Supprimer
diff --git a/resources/js/components/Prizes.vue b/resources/js/components/Prizes.vue
index 8859005..2e1652e 100644
--- a/resources/js/components/Prizes.vue
+++ b/resources/js/components/Prizes.vue
@@ -54,36 +54,6 @@
-
-
- Activer les notifications *
- Activer l'envoi d'un mail au gagnant
-
-
-
-
-
-
-
-
-
-
-
-
-
- Formulaire complémentaire *
- Si activé, l'utilisateur sera redirigé vers un formulaire complémentaire
-
-
-
-
-
-
-
-
-
-
-
Id courrier Arcadia *
@@ -102,13 +72,13 @@
- Lot par défaut *
- Si activé, ce lot sera systématiquement attribué en cas de perte aux instants gagnants
+ Preuve de gain obligatoire *
+ Si activé, il sera obligatoire de fournir des preuves de gain pour ce lot (sticker, ticket de caisse, code barre).
-
-
+
+
@@ -130,7 +100,7 @@
Supprimer le lot
- Supprimer
+ Supprimer
@@ -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);
+ });
}
}
}
diff --git a/resources/js/components/WebCoupons.vue b/resources/js/components/WebCoupons.vue
new file mode 100644
index 0000000..a23e3fe
--- /dev/null
+++ b/resources/js/components/WebCoupons.vue
@@ -0,0 +1,66 @@
+
+
+
+
+
diff --git a/resources/sass/app.scss b/resources/sass/app.scss
index 3193ffa..850c2ca 100644
--- a/resources/sass/app.scss
+++ b/resources/sass/app.scss
@@ -6,3 +6,6 @@
// Bootstrap
@import '~bootstrap/scss/bootstrap';
+
+// CSS custom
+@import 'app_custom';
diff --git a/resources/views/bo/content/manage.blade.php b/resources/views/bo/content/manage.blade.php
index 7e3a42d..2deae91 100644
--- a/resources/views/bo/content/manage.blade.php
+++ b/resources/views/bo/content/manage.blade.php
@@ -33,7 +33,7 @@
diff --git a/resources/views/bo/list-winners/index.blade.php b/resources/views/bo/list-winners/index.blade.php
deleted file mode 100644
index e69de29..0000000
diff --git a/resources/views/bo/settings/manage.blade.php b/resources/views/bo/settings/manage.blade.php
index 4260a3e..8bb8e66 100644
--- a/resources/views/bo/settings/manage.blade.php
+++ b/resources/views/bo/settings/manage.blade.php
@@ -6,10 +6,10 @@
Règlages du jeu
-
+
+
+
@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();
diff --git a/resources/views/bo/winners-list/index.blade.php b/resources/views/bo/winners-list/index.blade.php
new file mode 100644
index 0000000..3d6c672
--- /dev/null
+++ b/resources/views/bo/winners-list/index.blade.php
@@ -0,0 +1,42 @@
+@extends('layouts.bo')
+
+@section('content')
+
+
+
+
+
+
+ Date participation
+ Lot
+ Email
+ @if ($settings->use_ean_codes)
+ Code EAN
+ @endif
+ Code unique
+ Sticker
+ Code barre
+ Ticket
+
+
+ @foreach($winnersList as $winner)
+
+ {{ \Carbon\Carbon::parse($winner->created_at)->format('d/m/Y à H:i') }}
+ {{$winner->instant_win->prize->label_one}}
+ {{$winner->user->email}}
+ @if ($settings->use_ean_codes)
+ {{$winner->code_ean->code}}
+ @endif
+ {{$winner->code->code_unique}}
+ Voir
+ Voir
+ Voir
+
+ @endforeach
+
+
+
+
+@endsection
diff --git a/resources/views/front/basic/gain1.blade.php b/resources/views/front/basic/gain1.blade.php
index 4635513..3012eda 100644
--- a/resources/views/front/basic/gain1.blade.php
+++ b/resources/views/front/basic/gain1.blade.php
@@ -6,5 +6,9 @@
@section('content')
Vous avez gagné {{$prize->label_one}} !
- Envoyer mes preuves de gain
+
@endsection
diff --git a/resources/views/front/basic/gains.blade.php b/resources/views/front/basic/gains.blade.php
index 5b6da0b..5be525a 100644
--- a/resources/views/front/basic/gains.blade.php
+++ b/resources/views/front/basic/gains.blade.php
@@ -27,7 +27,7 @@
{{$p->additional_form}}
{{$p->arcadia_mail_id}}
{{$p->pdf_winning_proof}}
- {{$p->is_default}}
+ {{$p->need_proof}}
@endforeach
diff --git a/resources/views/front/basic/home.blade.php b/resources/views/front/basic/home.blade.php
index 9d6c2c3..d81d117 100644
--- a/resources/views/front/basic/home.blade.php
+++ b/resources/views/front/basic/home.blade.php
@@ -5,11 +5,18 @@
@section('content')
Société : {{$settingsGlobal->company}} et nom du jeu : {{$settingsGlobal->name}}
- Test pour gain :
-
-
+
@endsection
diff --git a/resources/views/front/basic/how-to-play.blade.php b/resources/views/front/basic/how-to-play.blade.php
index 387c1e6..e2bb4d2 100644
--- a/resources/views/front/basic/how-to-play.blade.php
+++ b/resources/views/front/basic/how-to-play.blade.php
@@ -27,7 +27,7 @@
{{$p->additional_form}}
{{$p->arcadia_mail_id}}
{{$p->pdf_winning_proof}}
- {{$p->is_default}}
+ {{$p->need_proof}}
@endforeach
diff --git a/resources/views/front/basic/reduction.blade.php b/resources/views/front/basic/reduction.blade.php
index 8d12b3d..328abc7 100644
--- a/resources/views/front/basic/reduction.blade.php
+++ b/resources/views/front/basic/reduction.blade.php
@@ -3,7 +3,7 @@
@section('title', 'Réduction')
@section('content')
- Gain d'une réduction
- La réduction
+ Gain d'une réduction :
+ {{$crmCoupon->link}}
Rejouer !
@endsection
diff --git a/resources/views/front/basic/teaser.blade.php b/resources/views/front/basic/teaser.blade.php
index d4912b9..07935aa 100644
--- a/resources/views/front/basic/teaser.blade.php
+++ b/resources/views/front/basic/teaser.blade.php
@@ -28,7 +28,7 @@
{{$p->additional_form}}
{{$p->arcadia_mail_id}}
{{$p->pdf_winning_proof}}
- {{$p->is_default}}
+ {{$p->need_proof}}
@endforeach
diff --git a/resources/views/layouts/bo.blade.php b/resources/views/layouts/bo.blade.php
index 686234d..3b65bb1 100644
--- a/resources/views/layouts/bo.blade.php
+++ b/resources/views/layouts/bo.blade.php
@@ -87,7 +87,7 @@
Code EAN
Social share
- Liste des gagnants
+ Liste des gagnants
IP Bannies
Contenus
diff --git a/routes/web.php b/routes/web.php
index a5be943..96ceb7e 100644
--- a/routes/web.php
+++ b/routes/web.php
@@ -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');
});