@@ -31,7 +31,6 @@ class DashboardAdminAdminController extends SovDashboardController | |||
$assets->addWebpackEncoreEntry('carac-common'); | |||
$assets->addWebpackEncoreEntry('carac-switch-merchant'); | |||
$assets->addWebpackEncoreEntry('carac-duplicate'); | |||
$assets->addWebpackEncoreEntry('carac-product'); | |||
return $assets; | |||
} |
@@ -37,7 +37,8 @@ class ProductStore extends AbstractStore | |||
//findProductByAvailabilitiesNegative | |||
public function getByAvailabilitiesNegative(ProductRepositoryQuery $query = null): array | |||
{ | |||
$query = $this->createDefaultQuery($query); | |||
$query = $this->createQuery($query); | |||
$query->joinProductFamily(); | |||
$query->filterIsOnline(); | |||
$query->filterBehaviorCountStock(); | |||
$query->groupBy('pf.id'); |
@@ -1,69 +0,0 @@ | |||
import { CaracStatistics } from '../../../functions/statistic.js'; | |||
global.CaracStatistics = CaracStatistics; | |||
jQuery(document).ready(function () { | |||
CaracStatistics.initBtnShowTotalOrderProduct(); | |||
}); | |||
// | |||
// function initBtnShowTotalOrderProduct(){ | |||
// $('.lc-show-products-sales-statistic').unbind('click').on('click', function (){ | |||
// $btn = $(this); | |||
// var url = $(this).data('url'); | |||
// $('#modal-products-sales-statistic').remove(); | |||
// $.ajax({ | |||
// url: url, | |||
// method: "POST", | |||
// dataType: "json", | |||
// success: function (response) { | |||
// $('body').append(response.data); | |||
// $('#modal-products-sales-statistic').modal('show'); | |||
// initModalProductsSalesStatistic(response.statistics); | |||
// } | |||
// }); | |||
// }); | |||
// } | |||
// function initModalProductsSalesStatistic(statistics) { | |||
// var chart = null; | |||
// $('.btn-products-sales-statistic').off('click'); | |||
// $('.btn-products-sales-statistic').on('click', function () { | |||
// $('.table-products-sales-statistic').hide(); | |||
// $('.btn-products-sales-statistic').addClass('btn-secondary').removeClass('btn-primary'); | |||
// $(this).removeClass('btn-secondary').addClass('btn-primary'); | |||
// | |||
// $('#table-products-sales-statistic-'+$(this).data('property-name')).show() | |||
// if (chart) chart.destroy(); | |||
// $(this).removeClass('btn-secondary'); | |||
// chart = drawProductsSalesStatistic(statistics,$(this).data('property-name')) | |||
// }); | |||
// $('.btn-products-sales-statistic').first().click(); | |||
// | |||
// } | |||
// | |||
// function drawProductsSalesStatistic(statictics, propertyName) { | |||
// | |||
// var options = { | |||
// bezierCurve : false, | |||
// tooltips: { | |||
// callbacks: { | |||
// label: (item) => item.yLabel , | |||
// }, | |||
// }, | |||
// }; | |||
// | |||
// chart = new Chart(document.getElementById("chart"), { | |||
// "type": "line", | |||
// "data": { | |||
// "labels": Object.values(statictics.label), | |||
// "datasets": [{ | |||
// "label": "Vente de produits / semaine", | |||
// "data": Object.values(statictics.data[propertyName].data), | |||
// "fill": false, | |||
// "borderColor": "rgb(75, 192, 192)", | |||
// "lineTension": 0.1 | |||
// }] | |||
// }, | |||
// "options": options | |||
// }); | |||
// return chart; | |||
// } |
@@ -1,65 +0,0 @@ | |||
import Chart from 'chart'; | |||
export class CaracStatistics { | |||
static initBtnShowTotalOrderProduct(){ | |||
$('.lc-show-products-sales-statistic').unbind('click').on('click', function (){ | |||
var $btn = $(this); | |||
var url = $(this).data('url'); | |||
$('#modal-products-sales-statistic').remove(); | |||
$.ajax({ | |||
url: url, | |||
method: "POST", | |||
dataType: "json", | |||
success: function (response) { | |||
$('body').append(response.data); | |||
$('#modal-products-sales-statistic').modal('show'); | |||
CaracStatistics.initModalProductsSalesStatistic(response.statistics); | |||
} | |||
}); | |||
}); | |||
} | |||
static initModalProductsSalesStatistic(statistics) { | |||
var chart = null; | |||
$('.btn-products-sales-statistic').off('click'); | |||
$('.btn-products-sales-statistic').on('click', function () { | |||
$('.table-products-sales-statistic').hide(); | |||
$('.btn-products-sales-statistic').addClass('btn-secondary').removeClass('btn-primary'); | |||
$(this).removeClass('btn-secondary').addClass('btn-primary'); | |||
$('#table-products-sales-statistic-'+$(this).data('property-name')).show() | |||
if (chart) chart.destroy(); | |||
$(this).removeClass('btn-secondary'); | |||
chart = CaracStatistics.drawProductsSalesStatistic(statistics,$(this).data('property-name')) | |||
}); | |||
$('.btn-products-sales-statistic').first().click(); | |||
} | |||
static drawProductsSalesStatistic(statictics, propertyName) { | |||
var options = { | |||
bezierCurve : false, | |||
tooltips: { | |||
callbacks: { | |||
label: (item) => item.yLabel , | |||
}, | |||
}, | |||
}; | |||
chart = new Chart(document.getElementById("chart"), { | |||
"type": "line", | |||
"data": { | |||
"labels": Object.values(statictics.label), | |||
"datasets": [{ | |||
"label": "Vente de produits / semaine", | |||
"data": Object.values(statictics.data[propertyName].data), | |||
"fill": false, | |||
"borderColor": "rgb(75, 192, 192)", | |||
"lineTension": 0.1 | |||
}] | |||
}, | |||
"options": options | |||
}); | |||
return chart; | |||
} | |||
} |
@@ -0,0 +1,20 @@ | |||
<?php | |||
namespace Lc\CaracoleBundle\Solver\Statistic; | |||
class StatisticSolver | |||
{ | |||
const INTERVAL_DAY = 'D'; | |||
const INTERVAL_WEEK = 'W'; | |||
const INTERVAL_MONTH = 'M'; | |||
public function getIntervalChoices() | |||
{ | |||
return [ | |||
self::INTERVAL_DAY, | |||
self::INTERVAL_WEEK, | |||
self::INTERVAL_MONTH | |||
]; | |||
} | |||
} |
@@ -3,6 +3,8 @@ | |||
namespace Lc\CaracoleBundle\Statistic\Product; | |||
use Doctrine\ORM\EntityManagerInterface; | |||
use Lc\CaracoleBundle\Builder\Distribution\DistributionBuilder; | |||
use Lc\CaracoleBundle\Container\Order\OrderShopContainer; | |||
use Lc\CaracoleBundle\Model\Product\ProductFamilyModel; | |||
use Lc\CaracoleBundle\Model\Section\SectionInterface; | |||
use Lc\CaracoleBundle\Repository\Order\OrderProductStore; | |||
@@ -50,12 +52,15 @@ class ProductsSalesStatistic extends Statistic | |||
} | |||
// Initialise les valeurs des données pour chaque Interval de date | |||
public function init(SectionInterface $section, OrderShopSolver $orderShopSolver, OpeningResolver $openingResolver) | |||
public function init(SectionInterface $section, DistributionBuilder $distributionBuilder, OpeningResolver $openingResolver) | |||
{ | |||
$currentCycleNumber = $orderShopSolver->getCycleNumberCurrentOrder($section); | |||
if ($openingResolver->isOpenSale($section, null,OpeningResolver::OPENING_CONTEXT_BACKEND) == false && date('w') > 2) { | |||
$currentCycleNumber = $currentCycleNumber - 1; | |||
} | |||
$currentDistribution = $distributionBuilder->guessCurrentDistributionOrder($section); | |||
// if ($openingResolver->isOpenSale($section, null,OpeningResolver::OPENING_CONTEXT_BACKEND) == false && date('w') > 2) { | |||
// $currentCycleNumber = $currentCycleNumber - 1; | |||
// } | |||
$this->cycleNumbers = array(); | |||
for ($w = $currentCycleNumber - $this->nbCycle + 1; $w <= $currentCycleNumber; $w++) { | |||
$this->cycleNumbers[] = $w; |