diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index 6f37aa8..5a955ee 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -45,34 +45,34 @@ class Kernel extends ConsoleKernel $couponSeuilGlobal = array(); $couponDiffusionGlobal = array(); $sendGlobal = false; - foreach ($sites as $site) { // ---- Pour chaque site - $sendMail = false; - $users = array(); - $couponSeuil = array(); - $couponDiffusion = array(); - $coupons = Coupon::where(['coupon_siteId' => $site->id])->get(); - foreach ($coupons as $coupon) { - $couponAlert = false; - // --- Check du seuil - $coupon->coupon_left = $this->getFullQuantity($coupon) - $this->getUsedQuantity($coupon); - if($coupon->coupon_left < $coupon->coupon_seuil_alert){ - array_push($couponSeuil, $coupon); - array_push($couponSeuilGlobal, [$site->site_nom , $coupon]); - $sendGlobal = true; - $couponAlert = true; - } + foreach ($sites as $site) { // ---- Pour chaque site + $campagnes = Campagne::where(['camp_siteId' => $site->id])->get(); + foreach ($campagnes as $campagne) { + $sendMail = false; + $users = array(); + $couponSeuil = array(); + $couponDiffusion = array(); + $coupons = $campagne->coupons()->get(); + foreach ($coupons as $coupon) { + $couponAlert = false; + + $coupon->coupon_left = $this->getFullQuantity($coupon) - $this->getUsedQuantity($coupon); + if($coupon->coupon_left < $coupon->coupon_seuil_alert){ + array_push($couponSeuil, $coupon); + array_push($couponSeuilGlobal, [$site->site_nom , $coupon]); + $sendGlobal = true; + $couponAlert = true; + } - // --- Check MaxDateDiffusion - if($coupon->coupon_maxdatediffusion != null && strtotime($coupon->coupon_maxdatediffusion) < (time() + (30*24*60*60))){ //Fin de diffusion dans moins de 30jours - array_push($couponDiffusion, $coupon); - array_push($couponDiffusionGlobal, [$site->site_nom , $coupon]); - $sendGlobal = true; - $couponAlert = true; - } + // --- Check MaxDateDiffusion + if($coupon->coupon_maxdatediffusion != null && strtotime($coupon->coupon_maxdatediffusion) < (time() + (30*24*60*60))){ //Fin de diffusion dans moins de 30jours + array_push($couponDiffusion, $coupon); + array_push($couponDiffusionGlobal, [$site->site_nom , $coupon]); + $sendGlobal = true; + $couponAlert = true; + } - if($couponAlert){ - $campagnes = $coupon->campagnes()->get(); - foreach ($campagnes as $campagne) { + if($couponAlert){ $notifications = Notification::where(['notif_campId' => $campagne->camp_id])->get(); foreach ($notifications as $notification) { if(!array_key_exists($notification->notif_id, $users)){ @@ -83,11 +83,11 @@ class Kernel extends ConsoleKernel } } } - $sendMail = true; } - } - if($sendMail){ - Mail::to($users)->send(new AlertBr($couponSeuil, $couponDiffusion, $site->site_nom)); + + if($sendMail){ + Mail::to($users)->send(new AlertBr($couponSeuil, $couponDiffusion, $site->site_nom)); + } } } if($sendGlobal) { diff --git a/app/Traits/GenerateBR.php b/app/Traits/GenerateBR.php index 9622fb1..e2c33b4 100644 --- a/app/Traits/GenerateBR.php +++ b/app/Traits/GenerateBR.php @@ -129,6 +129,21 @@ trait GenerateBR { $this->imagettftextSp($ImageFond , 12 , 0, 0, $y, $black, $arialbd, $textReduc, 0.01); $y= $y+18; } + imagecolortransparent($ImageFond, $white); + imagecopy($mask, $ImageFond, 360, 170, 0, 0, imagesx($ImageFond), imagesy($ImageFond)); + } elseif(strlen($textReduc) > 200) { + $ImageFond = imagecreate(387, 205); + $white = imagecolorallocate($ImageFond, 255, 255, 255); + $black = imagecolorallocate($ImageFond, 0, 0, 0); + + $textReducs = explode("\r\n", $textReduc); + $y = 10; + foreach ($textReducs as $textReduc) { + $this->imagettftextSp($ImageFond , 9 , 0, 0, $y, $black, $arialbd, $textReduc, 0.01); + $y= $y+12; + } + imagecolortransparent($ImageFond, $white); + imagecopy($mask, $ImageFond, 360, 165, 0, 0, imagesx($ImageFond), imagesy($ImageFond)); } else { $ImageFond = imagecreate(387, 200); $white = imagecolorallocate($ImageFond, 255, 255, 255); @@ -140,10 +155,11 @@ trait GenerateBR { $this->imagettftextSp($ImageFond , 10 , 0, 0, $y, $black, $arialbd, $textReduc, 0.01); $y= $y+12; } + imagecolortransparent($ImageFond, $white); + imagecopy($mask, $ImageFond, 360, 170, 0, 0, imagesx($ImageFond), imagesy($ImageFond)); } //imagettftext($ImageFond , 12 , 0, 0, 14, $black, $arialbd, $textReduc); - imagecolortransparent($ImageFond, $white); - imagecopy($mask, $ImageFond, 360, 170, 0, 0, imagesx($ImageFond), imagesy($ImageFond)); + // ---- Copie le produit dans le mask $size = getimagesize($product_image); diff --git a/config/constants.php b/config/constants.php index f6a4095..f69b779 100644 --- a/config/constants.php +++ b/config/constants.php @@ -5,7 +5,7 @@ return [ 'delctrlcontact' => 2, 'impression' => 3, 'updatecontact' => 4, -'colors' => ['#ffe258', '#8c86ff', '#86ffbc', '#86caff', '#ff86e7', '#b986ff', '#ff869d', '#b9ff86', '#cdff86'] +'colors' => ['#ffe258', '#8c86ff', '#86ffbc', '#ffc286', '#86caff', '#ff86e7', '#ff869d', '#b9ff86', '#e7ff86', '#b986ff', '#ffae86', '#5c60ff', '#ff5c5c', '#3ba33b'] ]; ?> \ No newline at end of file diff --git a/resources/views/coupon/create.blade.php b/resources/views/coupon/create.blade.php index e93883c..a4516ce 100644 --- a/resources/views/coupon/create.blade.php +++ b/resources/views/coupon/create.blade.php @@ -100,21 +100,21 @@

Vignettes

- {!! Form::label('coupon_thumbnail1', 'Vignette 1 active') !!} + {!! Form::label('coupon_thumbnail1', 'Vignette Desktop active') !!} {!! Form::file('coupon_thumbnail1', ['class' => 'input-file']) !!}
- {!! Form::label('coupon_thumbnail2', 'Vignette 1 grise') !!} + {!! Form::label('coupon_thumbnail2', 'Vignette Desktop grise') !!} {!! Form::file('coupon_thumbnail2', ['class' => 'input-file']) !!}
- {!! Form::label('coupon_thumbnail3', 'Vignette 2 active') !!} + {!! Form::label('coupon_thumbnail3', 'Vignette Mobile active') !!} {!! Form::file('coupon_thumbnail3', ['class' => 'input-file']) !!}
- {!! Form::label('coupon_thumbnail4', 'Vignette 2 grise') !!} + {!! Form::label('coupon_thumbnail4', 'Vignette Mobile grise') !!} {!! Form::file('coupon_thumbnail4', ['class' => 'input-file']) !!}
diff --git a/resources/views/coupon/edit.blade.php b/resources/views/coupon/edit.blade.php index b15c9f7..1b3ef58 100644 --- a/resources/views/coupon/edit.blade.php +++ b/resources/views/coupon/edit.blade.php @@ -129,7 +129,7 @@

Vignettes

- {!! Form::label('coupon_thumbnail1', 'Vignette 1 active') !!} + {!! Form::label('coupon_thumbnail1', 'Vignette Desktop active') !!} {!! Form::file('coupon_thumbnail1', ['class' => 'input-file']) !!} @if($coupon->coupon_thumbnail1 != "")
@@ -139,7 +139,7 @@ {!! Form::input('hidden', 'coupon_thumbnail1_hidden', $coupon->coupon_thumbnail1) !!}
- {!! Form::label('coupon_thumbnail2', 'Vignette 1 grise') !!} + {!! Form::label('coupon_thumbnail2', 'Vignette Desktop grise') !!} {!! Form::file('coupon_thumbnail2', ['class' => 'input-file']) !!} @if($coupon->coupon_thumbnail2 != "")
@@ -151,7 +151,7 @@
- {!! Form::label('coupon_thumbnail3', 'Vignette 2 active') !!} + {!! Form::label('coupon_thumbnail3', 'Vignette Mobile active') !!} {!! Form::file('coupon_thumbnail3', ['class' => 'input-file']) !!} @if($coupon->coupon_thumbnail3 != "")
@@ -161,7 +161,7 @@ {!! Form::input('hidden', 'coupon_thumbnail3_hidden', $coupon->coupon_thumbnail3) !!}
- {!! Form::label('coupon_thumbnail4', 'Vignette 2 grise') !!} + {!! Form::label('coupon_thumbnail4', 'Vignette Mobile grise') !!} {!! Form::file('coupon_thumbnail4', ['class' => 'input-file']) !!} @if($coupon->coupon_thumbnail4 != "")
diff --git a/resources/views/stats/index.blade.php b/resources/views/stats/index.blade.php index 554b937..e37ba01 100644 --- a/resources/views/stats/index.blade.php +++ b/resources/views/stats/index.blade.php @@ -21,7 +21,7 @@ @endif

-

{{ $campagne->camp_name }}

+

{{ $campagne->camp_name }} ({{ $campagne->camp_id }})

{{ $campagne->camp_type }}

{{ $campagne->coupons->count() }} Coupon(s)

{{ date('d/m/Y', strtotime($campagne->camp_createdate)) }}

@@ -76,324 +76,3 @@ @endforeach @endsection -@section('scripts') - - -@endsection \ No newline at end of file