Stat end + fix panier selectionnable
This commit is contained in:
parent
f222eed34b
commit
a9fac75863
20 changed files with 745 additions and 54 deletions
|
|
@ -61,8 +61,9 @@ class Kernel extends ConsoleKernel
|
|||
$sendGlobal = true;
|
||||
$couponAlert = true;
|
||||
}
|
||||
|
||||
// --- Check MaxDateDiffusion
|
||||
if(strtotime($coupon->coupon_maxdatediffusion) < (time() + (30*24*60*60))){ //Fin de diffusion dans moins de 30jours
|
||||
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;
|
||||
|
|
|
|||
|
|
@ -46,10 +46,10 @@ class Handler extends ExceptionHandler
|
|||
*/
|
||||
public function render($request, Exception $exception)
|
||||
{
|
||||
if ($exception instanceof \ErrorException) {
|
||||
$response = response()->view('errors.500', [], 500);
|
||||
return $this->toIlluminateResponse($response,$exception);
|
||||
}
|
||||
// if ($exception instanceof \ErrorException) {
|
||||
// $response = response()->view('errors.500', [], 500);
|
||||
// return $this->toIlluminateResponse($response,$exception);
|
||||
// }
|
||||
|
||||
return parent::render($request, $exception);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -462,7 +462,7 @@ class AjaxController extends Controller
|
|||
]);
|
||||
$panier = new Controllers\PanierController;
|
||||
$res = $panier->updateBasket($req);
|
||||
$url = "/?basketid=".$res->original['Panier']->panier_ref;
|
||||
$url = "/?basketid=".$res->original['Panier']->Panier;
|
||||
|
||||
}
|
||||
return json_encode( $url);
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@ class CouponController extends Controller
|
|||
}
|
||||
$coupon->coupon_rcs = $datas['coupon_rcs'];
|
||||
$coupon->coupon_site_contact = $datas['coupon_site_contact'];
|
||||
|
||||
$coupon->coupon_seuil_alert = $datas['coupon_seuil_alert'];
|
||||
|
||||
$site = Site::find($request->input('site_id'));
|
||||
|
||||
|
|
|
|||
|
|
@ -48,8 +48,10 @@ class PanierController extends Controller
|
|||
foreach ($panierContents as $panierContent) {
|
||||
$cp = Coupon::where(['coupon_id'=> $panierContent->panier_content_couponId])->first();
|
||||
$qty = $panierContent->panier_content_quantity;
|
||||
for ($i=0; $i < $qty; $i++) {
|
||||
$coupons[$i] = $cp;
|
||||
if($qty > 0){
|
||||
for ($i=0; $i < $qty; $i++) {
|
||||
$coupons[$i] = $cp;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,9 +3,11 @@
|
|||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Statistique;
|
||||
use App\Campagne;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use App\Traits\CouponTrait;
|
||||
use DateTime;
|
||||
|
||||
class StatistiqueController extends Controller
|
||||
{
|
||||
|
|
@ -18,13 +20,10 @@ class StatistiqueController extends Controller
|
|||
public function index()
|
||||
{
|
||||
$sites = Auth::user()->sites()->get();
|
||||
//$sitesToDisplay = [];
|
||||
foreach ($sites as $site) {
|
||||
//$sitesToDisplay[$site->site_nom] = ['site_id' => $site->site_id];
|
||||
if(isset($site->campagnes)){
|
||||
$campagnes = $site->campagnes;
|
||||
foreach ($campagnes as $campagne) {
|
||||
//$sitesToDisplay[$site->site_nom][$campagne->camp_id] = array('camp_name' => $campagne->camp_name, 'camp_type' => $campagne->camp_type, 'camp_published' => $campagne->camp_published);
|
||||
switch ($campagne->camp_type) {
|
||||
case 0:
|
||||
$campagne->camp_type = "Mur";
|
||||
|
|
@ -44,7 +43,6 @@ class StatistiqueController extends Controller
|
|||
$coupon->quantity = $this->getFullQuantity($coupon);
|
||||
$coupon->remain = $this->getFullQuantity($coupon) - $this->getUsedQuantity($coupon);
|
||||
$coupon->isPrintable = $this->isAvailableToPrint($coupon, $campagne);
|
||||
//$sitesToDisplay[$site->site_nom][$campagne->camp_id][$coupon->coupon_code] = array('coupon_name' => $coupon->coupon_name, 'coupon_value' => $coupon->coupon_value, 'coupon_quantity' => $coupon->quantity, 'coupon_remain' => $coupon->remain);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -53,45 +51,93 @@ class StatistiqueController extends Controller
|
|||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
* Show the stat detail of a campaign.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
//
|
||||
public function statdetail(Campagne $campagne) {
|
||||
$count = 0;
|
||||
$colors = config('constants.colors');
|
||||
switch ($campagne->camp_type) {
|
||||
case 0:
|
||||
$campagne->camp_type = "Mur";
|
||||
break;
|
||||
case 1:
|
||||
$campagne->camp_type = "Panier";
|
||||
break;
|
||||
case 2:
|
||||
$campagne->camp_type = "Mur sans sélection";
|
||||
break;
|
||||
case 3:
|
||||
$campagne->camp_type = "Panier Sélectionnable";
|
||||
break;
|
||||
}
|
||||
|
||||
$coupons = $campagne->coupons;
|
||||
foreach ($coupons as $coupon) {
|
||||
$coupon->quantity = $this->getFullQuantity($coupon);
|
||||
$coupon->remain = $this->getFullQuantity($coupon) - $this->getUsedQuantity($coupon);
|
||||
$coupon->isPrintable = $this->isAvailableToPrint($coupon, $campagne);
|
||||
$coupon->color = $colors[$count];
|
||||
$count++;
|
||||
}
|
||||
$enddate = date('Y-m-d');
|
||||
$startdate = date('Y-m-d', strtotime("-30 days"));
|
||||
return view('stats.detail')->with(['campagne' => $campagne, 'startdate' => $startdate, 'enddate'=> $enddate]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
public function load_stats(Request $request){
|
||||
$campid = $request->campid;
|
||||
$startdate = $request->startdate;
|
||||
$enddate = $request->enddate;
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param \App\Statistique $statistique
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show(Statistique $statistique)
|
||||
{
|
||||
//
|
||||
}
|
||||
$datetime1 = new DateTime($request->startdate);
|
||||
$datetime2 = new DateTime($request->enddate);
|
||||
$interval = $datetime1->diff($datetime2);
|
||||
$days = $interval->format('%a');
|
||||
// ---- Labels des graphiques
|
||||
$labels = [];
|
||||
for ($i=0; $i <= $days ; $i++) {
|
||||
$date = date('d/m/Y', strtotime("+".$i." days", strtotime($startdate)));
|
||||
array_push($labels, $date);
|
||||
}
|
||||
//array_reverse($labels);
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \App\Statistique $statistique
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy(Statistique $statistique)
|
||||
{
|
||||
//
|
||||
// ---- Data pour le graphique global
|
||||
$dataGlobal = [];
|
||||
$test = [];
|
||||
foreach ($labels as $label) {
|
||||
$date = date('Y-m-d', strtotime(str_replace('/', '-', $label)));
|
||||
$stat = Statistique::where(['stat_campId' => $campid])->whereDate('created_at', '=', $date)->sum('stat_couponPrinted');
|
||||
$test[] = $date;
|
||||
if(isset($stat)){
|
||||
$dataGlobal[] = $stat;
|
||||
} else {
|
||||
$dataGlobal[] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// ---- Data pour le graphique par coupons
|
||||
$campagne = Campagne::where(['camp_id' => $campid])->first();
|
||||
$coupons = $campagne->coupons;
|
||||
$dataSpec = [];
|
||||
foreach ($coupons as $coupon) {
|
||||
$dataCoupon = [];
|
||||
foreach ($labels as $label) {
|
||||
$date = date('Y-m-d', strtotime(str_replace('/', '-', $label)));
|
||||
$stat = Statistique::where(['stat_campId' => $campid, 'stat_couponId' => $coupon->coupon_id])->whereDate('created_at', '=', $date)->first();
|
||||
if(isset($stat->stat_couponPrinted)){
|
||||
$dataCoupon[] = $stat->stat_couponPrinted;
|
||||
} else {
|
||||
$dataCoupon[] = 0;
|
||||
}
|
||||
}
|
||||
$dataSpec[$coupon->coupon_code] = $dataCoupon;
|
||||
}
|
||||
|
||||
|
||||
$data = array('labels' => $labels, 'dataGlobal' => $dataGlobal, 'dataSpec' => $dataSpec);
|
||||
|
||||
return json_encode($data);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,8 @@ return [
|
|||
'updatebasket' => 1,
|
||||
'delctrlcontact' => 2,
|
||||
'impression' => 3,
|
||||
'updatecontact' => 4
|
||||
'updatecontact' => 4,
|
||||
'colors' => ['#ffe258', '#8c86ff', '#86ffbc', '#86caff', '#ff86e7', '#b986ff', '#ff869d', '#b9ff86', '#cdff86']
|
||||
];
|
||||
|
||||
?>
|
||||
217
public/css/app.css
vendored
217
public/css/app.css
vendored
|
|
@ -146,6 +146,13 @@ h2 .add-button:hover {
|
|||
border: 1px solid #de9700;
|
||||
}
|
||||
|
||||
h3 {
|
||||
font-family: 'Nunito-ExtraLight', sans-serif;
|
||||
font-size: 1.3em;
|
||||
color: #de9700;
|
||||
margin: 20px 0 10px 0;
|
||||
}
|
||||
|
||||
h4 {
|
||||
font-family: 'Nunito-ExtraLight', sans-serif;
|
||||
font-size: 1.1em;
|
||||
|
|
@ -6769,6 +6776,215 @@ main section .siteContent .campContent .coupons table tr td {
|
|||
text-align: center;
|
||||
}
|
||||
|
||||
main section .title-stat {
|
||||
display: -webkit-box;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
-webkit-box-pack: justify;
|
||||
-ms-flex-pack: justify;
|
||||
justify-content: space-between;
|
||||
-webkit-box-align: center;
|
||||
-ms-flex-align: center;
|
||||
align-items: center;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
main section .title-stat h2 {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
main section .title-stat div {
|
||||
width: 55%;
|
||||
display: -webkit-box;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
-webkit-box-align: center;
|
||||
-ms-flex-align: center;
|
||||
align-items: center;
|
||||
-webkit-box-pack: end;
|
||||
-ms-flex-pack: end;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
main section .title-stat div input {
|
||||
min-width: 15%;
|
||||
}
|
||||
|
||||
main section .title-stat div input#startdate {
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
main section .title-stat div h4 {
|
||||
margin: 0;
|
||||
margin-right: 20px;
|
||||
}
|
||||
|
||||
main section .statistiquesGlobales {
|
||||
display: -webkit-box;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
-webkit-box-pack: justify;
|
||||
-ms-flex-pack: justify;
|
||||
justify-content: space-between;
|
||||
-webkit-box-align: start;
|
||||
-ms-flex-align: start;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
main section .statistiquesGlobales .campstat {
|
||||
width: 40%;
|
||||
text-align: center;
|
||||
border: 1px solid #212121;
|
||||
}
|
||||
|
||||
main section .statistiquesGlobales .campstat thead {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
main section .statistiquesGlobales .campstat thead th {
|
||||
padding: 10px;
|
||||
font-size: 1.3em;
|
||||
text-align: center;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
main section .statistiquesGlobales .campstat td {
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
main section .statistiquesGlobales .campstat td:first-child {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
main section .statistiquesGlobales .graphStatsGlobales {
|
||||
width: 55%;
|
||||
}
|
||||
|
||||
main section .statistiquesGlobales .graphStatsGlobales h3 {
|
||||
margin: 0 0 20px 0;
|
||||
}
|
||||
|
||||
main section .title {
|
||||
margin: 30px 0 10px 0;
|
||||
display: -webkit-box;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
-webkit-box-align: center;
|
||||
-ms-flex-align: center;
|
||||
align-items: center;
|
||||
-webkit-box-pack: justify;
|
||||
-ms-flex-pack: justify;
|
||||
justify-content: space-between;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
main section .title h3 {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
main section .title .btns a {
|
||||
margin-left: 5px;
|
||||
font-size: 0.8em;
|
||||
}
|
||||
|
||||
main section .statistiquesContent {
|
||||
display: -webkit-box;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
-webkit-box-pack: justify;
|
||||
-ms-flex-pack: justify;
|
||||
justify-content: space-between;
|
||||
-webkit-box-align: start;
|
||||
-ms-flex-align: start;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
main section .statistiquesContent .couponStats {
|
||||
display: -webkit-box;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-box-direction: normal;
|
||||
-ms-flex-direction: column;
|
||||
flex-direction: column;
|
||||
width: 40%;
|
||||
-webkit-box-pack: justify;
|
||||
-ms-flex-pack: justify;
|
||||
justify-content: space-between;
|
||||
-webkit-box-align: center;
|
||||
-ms-flex-align: center;
|
||||
align-items: center;
|
||||
-ms-flex-wrap: wrap;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
main section .statistiquesContent .couponStats .couponStatsDetail {
|
||||
margin-top: 10px;
|
||||
width: 100%;
|
||||
border: 1px solid #212121;
|
||||
}
|
||||
|
||||
main section .statistiquesContent .couponStats .couponStatsDetail h4 {
|
||||
padding: 10px;
|
||||
position: relative;
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
text-align: center;
|
||||
color: #adb5bd;
|
||||
font-weight: bold;
|
||||
background-color: #212121;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
main section .statistiquesContent .couponStats .couponStatsDetail h4 .couponLegend {
|
||||
position: absolute;
|
||||
display: inline-block;
|
||||
right: 8px;
|
||||
top: 8px;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
main section .statistiquesContent .couponStats .couponStatsDetail .content {
|
||||
display: none;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
main section .statistiquesContent .couponStats .couponStatsDetail .content figure {
|
||||
text-align: center;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
main section .statistiquesContent .couponStats .couponStatsDetail .content figure img {
|
||||
width: 60%;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
main section .statistiquesContent .couponStats .couponStatsDetail .content p {
|
||||
margin-bottom: 10px;
|
||||
display: -webkit-box;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
-webkit-box-pack: justify;
|
||||
-ms-flex-pack: justify;
|
||||
justify-content: space-between;
|
||||
-ms-flex-wrap: nowrap;
|
||||
flex-wrap: nowrap;
|
||||
}
|
||||
|
||||
main section .statistiquesContent .couponStats .couponStatsDetail .content p:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
main section .statistiquesContent .graphStats {
|
||||
width: 55%;
|
||||
}
|
||||
|
||||
main section .statistiquesContent .graphStats h3 {
|
||||
margin: 30px 0 20px 0;
|
||||
}
|
||||
|
||||
#coupons-list {
|
||||
background-color: #2d2d2d;
|
||||
padding: 20px;
|
||||
|
|
@ -6938,7 +7154,6 @@ main section .siteContent .campContent .coupons table tr td {
|
|||
}
|
||||
|
||||
.fancybox-content {
|
||||
max-width: 450px !important;
|
||||
background-color: #2d2d2d !important;
|
||||
font-family: 'Nunito-Regular', sans-serif;
|
||||
}
|
||||
|
|
|
|||
2
public/js/app.js
vendored
2
public/js/app.js
vendored
File diff suppressed because one or more lines are too long
26
resources/js/app.js
vendored
26
resources/js/app.js
vendored
|
|
@ -293,4 +293,30 @@ $('.couponDetail').each(function(){
|
|||
console.log();
|
||||
$(this).parent().parent().parent().parent().find('.fa-exclamation-triangle').show();
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
$('body').on('click', '.couponStats h4', function(event){
|
||||
event.preventDefault();
|
||||
var contentDiv = $(this).parent().find('.content')
|
||||
|
||||
if(contentDiv.css('display') == 'none'){
|
||||
contentDiv.slideDown();
|
||||
} else {
|
||||
contentDiv.slideUp();
|
||||
}
|
||||
})
|
||||
|
||||
$('.open-all-stats').on('click', function(event){
|
||||
event.preventDefault();
|
||||
$('.couponStats .content').each(function(){
|
||||
$(this).slideDown(500);
|
||||
})
|
||||
})
|
||||
|
||||
$('.close-all-stats').on('click', function(event){
|
||||
event.preventDefault();
|
||||
$('.couponStats .content').each(function(){
|
||||
$(this).slideUp(500);
|
||||
})
|
||||
})
|
||||
138
resources/sass/partials/content.scss
vendored
138
resources/sass/partials/content.scss
vendored
|
|
@ -560,4 +560,142 @@ table {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.title-stat {
|
||||
display:flex;
|
||||
justify-content: space-between;
|
||||
align-items:center;
|
||||
margin-bottom:20px;
|
||||
h2 {
|
||||
margin-bottom:0;
|
||||
}
|
||||
div {
|
||||
width:55%;
|
||||
display:flex;
|
||||
align-items:center;
|
||||
justify-content:flex-end;
|
||||
input {
|
||||
min-width:15%;
|
||||
&#startdate{
|
||||
margin-right:5px;
|
||||
}
|
||||
}
|
||||
h4 {
|
||||
margin:0;
|
||||
margin-right:20px;
|
||||
}
|
||||
}
|
||||
}
|
||||
.statistiquesGlobales {
|
||||
display:flex;
|
||||
justify-content:space-between;
|
||||
align-items:flex-start;
|
||||
.campstat {
|
||||
width:40%;
|
||||
thead{
|
||||
text-align: center;
|
||||
th {
|
||||
padding:10px;
|
||||
font-size:1.3em;
|
||||
text-align:center;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
text-align: center;
|
||||
border:1px solid $darkgrey;
|
||||
td {
|
||||
padding:10px;
|
||||
&:first-child{
|
||||
text-align:left;
|
||||
}
|
||||
}
|
||||
}
|
||||
.graphStatsGlobales {
|
||||
width:55%;
|
||||
h3 {
|
||||
margin:0 0 20px 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
.title {
|
||||
margin:30px 0 10px 0;
|
||||
display:flex;
|
||||
align-items:center;
|
||||
justify-content: space-between;
|
||||
width:100%;
|
||||
h3{
|
||||
margin:0;
|
||||
}
|
||||
.btns{
|
||||
a {
|
||||
margin-left:5px;
|
||||
font-size: 0.8em;
|
||||
//text-transform: uppercase;
|
||||
}
|
||||
}
|
||||
}
|
||||
.statistiquesContent {
|
||||
display:flex;
|
||||
justify-content: space-between;
|
||||
align-items: flex-start;
|
||||
.couponStats {
|
||||
display:flex;
|
||||
flex-direction:column;
|
||||
width:40%;
|
||||
justify-content: space-between;
|
||||
align-items:center;
|
||||
flex-wrap:wrap;
|
||||
.couponStatsDetail{
|
||||
margin-top:10px;
|
||||
width:100%;
|
||||
border:1px solid $darkgrey;
|
||||
h4 {
|
||||
padding:10px;
|
||||
position:relative;
|
||||
margin-top:0;
|
||||
margin-bottom:0;
|
||||
text-align:center;
|
||||
color:$lightgrey;
|
||||
font-weight:bold;
|
||||
background-color:$darkgrey;
|
||||
cursor:pointer;
|
||||
.couponLegend {
|
||||
position:absolute;
|
||||
display:inline-block;
|
||||
right:8px;
|
||||
top:8px;
|
||||
width:20px;
|
||||
height:20px;
|
||||
border-radius:50%;
|
||||
}
|
||||
}
|
||||
.content {
|
||||
display:none;
|
||||
padding:10px;
|
||||
figure {
|
||||
text-align:center;
|
||||
margin-bottom:5px;
|
||||
img {
|
||||
width:60%;
|
||||
height:auto;
|
||||
}
|
||||
}
|
||||
p {
|
||||
margin-bottom:10px;
|
||||
display:flex;
|
||||
justify-content:space-between;
|
||||
flex-wrap:nowrap;
|
||||
&:last-child{
|
||||
margin-bottom:0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.graphStats {
|
||||
width:55%;
|
||||
h3 {
|
||||
margin:30px 0 20px 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
2
resources/sass/partials/fancy.scss
vendored
2
resources/sass/partials/fancy.scss
vendored
|
|
@ -150,7 +150,7 @@
|
|||
}
|
||||
|
||||
.fancybox-content {
|
||||
max-width:450px !important;
|
||||
//max-width:450px !important;
|
||||
background-color: $grey2 !important;
|
||||
font-family: 'Nunito-Regular', sans-serif;
|
||||
h3 {
|
||||
|
|
|
|||
8
resources/sass/partials/reset.scss
vendored
8
resources/sass/partials/reset.scss
vendored
|
|
@ -99,6 +99,14 @@ h2 {
|
|||
}
|
||||
}
|
||||
|
||||
h3 {
|
||||
font-family: 'Nunito-ExtraLight', sans-serif;
|
||||
font-size:1.3em;
|
||||
//font-weight:bold;
|
||||
color:$orange;
|
||||
margin: 20px 0 10px 0;
|
||||
}
|
||||
|
||||
h4 {
|
||||
font-family: 'Nunito-ExtraLight', sans-serif;
|
||||
font-size:1.1em;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<nav>
|
||||
<div class="menu-content">
|
||||
<div class="menu-item-list">
|
||||
<a href="{{ route('home') }}" class="menu-item @if(session()->get('active_route') == 'home') active @endif"><i class="fas fa-chart-line"></i> <span>Statistiques</span></a>
|
||||
<a href="{{ route('home') }}" class="menu-item @if(session()->get('active_route') == 'home' || session()->get('active_route') == 'camp') active @endif"><i class="fas fa-chart-line"></i> <span>Statistiques</span></a>
|
||||
@if(Auth::user()->roles == "superadmin" || Auth::user()->roles == "admin")
|
||||
<a href="{{ route('site.index') }}" class="menu-item @if(session()->get('active_route') == 'site') active @endif"><i class="fas fa-building"></i> <span>Sites</span></a>
|
||||
<a href="{{ route('campagne.index') }}" class="menu-item @if(session()->get('active_route') == 'campagne') active @endif"><i class="fa fa-folder"><i class="fas fa-ticket-alt"></i></i> <span>Campagnes</span></a>
|
||||
|
|
|
|||
|
|
@ -95,8 +95,6 @@
|
|||
})
|
||||
labels = labels.reverse();
|
||||
errorCount = errorCount.reverse();
|
||||
console.log(labels);
|
||||
console.log(errorCount);
|
||||
|
||||
//---- GRAPH ERRORS
|
||||
var ctx = document.getElementById("myChart").getContext('2d');
|
||||
|
|
|
|||
253
resources/views/stats/detail.blade.php
Normal file
253
resources/views/stats/detail.blade.php
Normal file
|
|
@ -0,0 +1,253 @@
|
|||
@extends('layouts.main')
|
||||
|
||||
@section('content')
|
||||
<div class="title-stat">
|
||||
<h2><i class="fas fa-chart-line"></i>Statistiques de la campagne</h2>
|
||||
<div class="selector-stat">
|
||||
<h4>Période :</h4>
|
||||
<input type="date" name="startdate" id="startdate" value="{{ $startdate }}">
|
||||
<input type="date" name="enddate" id="enddate" value="{{ $enddate }}">
|
||||
<input type="hidden" name="csrf" id="csrf" value="<?php echo csrf_token(); ?>">
|
||||
<a href="#" class="add-button reload-stats" id="reloader" data-campid="{{ $campagne->camp_id }}"><i class="fas fa-chart-line"></i> Charger</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="statistiquesGlobales">
|
||||
<table class="campstat">
|
||||
<thead>
|
||||
<th colspan="2">{{ $campagne->camp_name }}</th>
|
||||
</thead>
|
||||
<tr>
|
||||
<td>Référence</td>
|
||||
<td>{{ $campagne->camp_id }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Référence Site</td>
|
||||
<td>{{ $campagne->camp_siteId }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Type</td>
|
||||
<td>{{ $campagne->camp_type }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Impression limité</td>
|
||||
<td>
|
||||
@if ( $campagne->camp_limitedPrinting === 1)
|
||||
Oui
|
||||
@else
|
||||
Non
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Date de création</td>
|
||||
<td>
|
||||
{{ date('d/m/Y', strtotime($campagne->camp_createdate)) }}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
Publiée ?
|
||||
</td>
|
||||
<td>
|
||||
@if ( $campagne->camp_published === 1)
|
||||
<i class="fas fa-check-circle green"></i>
|
||||
@else
|
||||
<i class="fas fa-times-circle red"></i>
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div class="graphStatsGlobales">
|
||||
<h3>Consommation Globale</h3>
|
||||
<canvas id="myChartGlobal" height="150" width="300"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
<div class="statistiquesContent">
|
||||
<div class="couponStats">
|
||||
<div class="title">
|
||||
<h3>Les Coupons</h3>
|
||||
<div class="btns">
|
||||
<a href="#" class="add-button open-all-stats"><i class="fas fa-plus-square"></i> Tout Ouvrir</a>
|
||||
<a href="#" class="add-button close-all-stats"><i class="fas fa-minus-square"></i> Tout Fermer</a>
|
||||
</div>
|
||||
</div>
|
||||
@foreach ($campagne->coupons as $coupon)
|
||||
<div class="couponStatsDetail">
|
||||
<h4>{{ $coupon->coupon_name }} <span style="background-color:{{$coupon->color}}" class="couponLegend"></span></h4>
|
||||
<div class="content">
|
||||
<figure>
|
||||
<a href="{{ asset($coupon->coupon_image) }}" data-fancybox="images" data-caption="{{ $coupon->coupon_name }}"><img src="{{ asset($coupon->coupon_image) }}" alt=""></a>
|
||||
</figure>
|
||||
<p><span>Code de traitement :</span> <span>{{ $coupon->coupon_code }}</span></p>
|
||||
<p><span>Valeur :</span> <span>{{ str_replace('.', ',', number_format($coupon->coupon_value, 2))}} €</span></p>
|
||||
<p><span>Quantité Totale :</span> <span>{{$coupon->quantity}}</span></p>
|
||||
<p><span>Quantité Restante :</span> <span>{{$coupon->remain}}</span></p>
|
||||
<p><span>Quantité Diffusé :</span> <span>{{$coupon->quantity - $coupon->remain}}</span></p>
|
||||
@if($coupon->coupon_maxdatediffusion != null)
|
||||
<p><span>Date de début de diffusion :</span> <span>{{ date('d/m/Y', strtotime($coupon->coupon_mindatediffusion)) }}</span></p>
|
||||
@else
|
||||
<p><span>Date de début de diffusion :</span> <span>n/c</span></p>
|
||||
@endif
|
||||
@if($coupon->coupon_maxdatediffusion != null)
|
||||
<p><span>Date de fin de diffusion :</span> <span>{{ date('d/m/Y', strtotime($coupon->coupon_maxdatediffusion)) }}</span></p>
|
||||
@else
|
||||
<p><span>Date de fin de diffusion :</span> <span>n/c</span></p>
|
||||
@endif
|
||||
@if ( $coupon->coupon_published == 1)
|
||||
<p><span>Publié ?</span><span><i class="fas fa-check-circle green"></i></span></p>
|
||||
@else
|
||||
<p><span>Publié ?</span><span><i class="fas fa-times-circle red"></i></span></p>
|
||||
@endif
|
||||
@if ( $coupon->isPrintable == 1)
|
||||
<p><span>Imprimable ?</span><span><i class="fas fa-check-circle green"></i></span></p>
|
||||
@else
|
||||
<p><span>Imprimable ?</span><span><i class="fas fa-times-circle red"></i></span></p>
|
||||
@endif
|
||||
<input type="hidden" class="couponStatData" data-color="{{ $coupon->color }}" data-name="{{ $coupon->coupon_name }}" id="{{ $coupon->coupon_code }}" >
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
<div class="graphStats">
|
||||
<h3>Consommation par coupons</h3>
|
||||
<canvas id="myChart" height="150" width="300"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@section('scripts')
|
||||
<script src="{{ asset('js/Chart.js') }}" charset="utf-8"></script>
|
||||
<script>
|
||||
function load_graphs(campid, startdate, enddate){
|
||||
$.ajaxSetup({
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': $('#csrf').val()
|
||||
}
|
||||
});
|
||||
$.ajax({
|
||||
url: '/loadStat',
|
||||
type: 'POST',
|
||||
data: {
|
||||
campid: campid,
|
||||
startdate : startdate,
|
||||
enddate : enddate,
|
||||
},
|
||||
dataType: 'JSON',
|
||||
success: function (response) {
|
||||
//console.log("label", response.labels.reverse());
|
||||
//Mise en place du graphique globa
|
||||
var configGlobal = {
|
||||
type: 'line',
|
||||
data: {
|
||||
labels: response.labels,
|
||||
datasets: [{
|
||||
label : "Coupons",
|
||||
data: response.dataGlobal,
|
||||
fill: false,
|
||||
borderColor: '#de9700',
|
||||
backgroundColor: '#de9700',
|
||||
borderWidth :1,
|
||||
}]
|
||||
},
|
||||
options: {
|
||||
maintainAspectRatio: true,
|
||||
responsive: true,
|
||||
legend: {
|
||||
display:false,
|
||||
},
|
||||
title: {
|
||||
display:false,
|
||||
}
|
||||
}
|
||||
}
|
||||
var ctxGlobal = document.getElementById("myChartGlobal").getContext('2d');
|
||||
window.myLineGlobal = new Chart(ctxGlobal, configGlobal);
|
||||
|
||||
//Mise en place du graphique spec
|
||||
var dataSpecCp = [];
|
||||
$.each(response.dataSpec, function(coupon_code, data){
|
||||
var dataset = {
|
||||
label : $('#'+coupon_code).attr('data-name'),
|
||||
borderColor: $('#'+coupon_code).attr('data-color'),
|
||||
borderWidth :1,
|
||||
backgroundColor: $('#'+coupon_code).attr('data-color'),
|
||||
fill: false,
|
||||
data: data,
|
||||
}
|
||||
dataSpecCp.push(dataset);
|
||||
})
|
||||
var config = {
|
||||
type: 'line',
|
||||
data: {
|
||||
labels: response.labels,
|
||||
datasets: dataSpecCp,
|
||||
},
|
||||
options: {
|
||||
maintainAspectRatio: true,
|
||||
responsive: true,
|
||||
legend: {
|
||||
display:true,
|
||||
position:'bottom',
|
||||
},
|
||||
title: {
|
||||
display:false,
|
||||
text: 'Consommation de BR par jour'
|
||||
}
|
||||
}
|
||||
}
|
||||
var ctx = document.getElementById("myChart").getContext('2d');
|
||||
window.myLine = new Chart(ctx, config);
|
||||
},
|
||||
error: function (e) {
|
||||
console.log(e.responseText);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
window.onload = function() {
|
||||
load_graphs($('#reloader').attr('data-campid'), $('#startdate').val(), $('#enddate').val());
|
||||
}
|
||||
|
||||
|
||||
$('.reload-stats').on('click', function(event){
|
||||
var campid = $(this).attr('data-campid');
|
||||
var startdate = $('#startdate').val();
|
||||
var enddate = $('#enddate').val();
|
||||
event.preventDefault();
|
||||
|
||||
//console.log(enddate);
|
||||
if(startdate != "" && enddate != ""){
|
||||
teststartdate = new Date(startdate);
|
||||
testenddate = new Date(enddate);
|
||||
if(teststartdate < testenddate){
|
||||
myLine.destroy();
|
||||
myLineGlobal.destroy();
|
||||
load_graphs(campid, startdate, enddate);
|
||||
} else {
|
||||
$.fancyConfirm({
|
||||
title : "<i class='fas fa-times-circle red'></i> Erreur",
|
||||
message : "La date de fin doit être supérieure à la date de début.",
|
||||
okButton : 'Valider',
|
||||
noButton : "",
|
||||
callback : function (value) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
} else {
|
||||
$.fancyConfirm({
|
||||
title : "<i class='fas fa-times-circle red'></i> Erreur",
|
||||
message : "Veuillez remplir les deux dates pour voir les données associées.",
|
||||
okButton : 'Valider',
|
||||
noButton : "",
|
||||
callback : function (value) {
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
</script>
|
||||
@endsection
|
||||
|
|
@ -21,7 +21,7 @@
|
|||
<i class="fas fa-times-circle red"></i>
|
||||
@endif
|
||||
</p>
|
||||
<p>{{ $campagne->camp_name }}</p>
|
||||
<p><a href="{{ route('camp.stats', $campagne) }}">{{ $campagne->camp_name }}</a></p>
|
||||
<p>{{ $campagne->camp_type }}</p>
|
||||
<p>{{ $campagne->coupons->count() }} Coupon(s) <i class="fas fa-exclamation-triangle red"></i></p>
|
||||
<p>{{ date('d/m/Y', strtotime($campagne->camp_createdate)) }}</p>
|
||||
|
|
|
|||
Binary file not shown.
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.6 KiB |
|
|
@ -22,6 +22,7 @@ Route::group(['prefix' => 'bo', 'middleware' => ['auth', 'saveroute']], function
|
|||
return redirect(route('home'));
|
||||
});
|
||||
Route::get('/home', 'StatistiqueController@index')->name('home');
|
||||
Route::get('/statistiques/{campagne}', 'StatistiqueController@statdetail')->name('camp.stats');
|
||||
// ---- Routes pour les ressources en CRUD
|
||||
Route::resource('coupon', 'CouponController')->except(['show'])->middleware('admin');
|
||||
Route::resource('campagne', 'CampagneController')->except(['show'])->middleware('admin');
|
||||
|
|
@ -70,6 +71,8 @@ Route::group(['prefix' => 'bo', 'middleware' => ['auth', 'saveroute']], function
|
|||
Route::post('/cleanWalls', 'AjaxController@clean_walls');
|
||||
// ---- Maintenance : Nettoyer les paniers
|
||||
Route::post('/cleanBaskets', 'AjaxController@clean_baskets');
|
||||
// ---- Statistiques
|
||||
Route::post('/loadStat', 'StatistiqueController@load_stats');
|
||||
|
||||
// ---- Routes spécifiques : API
|
||||
Route::any('/{param?}', function ($param = null) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue