$assets->addWebpackEncoreEntry('carac-common'); | $assets->addWebpackEncoreEntry('carac-common'); | ||||
$assets->addWebpackEncoreEntry('carac-switch-merchant'); | $assets->addWebpackEncoreEntry('carac-switch-merchant'); | ||||
$assets->addWebpackEncoreEntry('carac-duplicate'); | $assets->addWebpackEncoreEntry('carac-duplicate'); | ||||
$assets->addWebpackEncoreEntry('carac-product'); | |||||
return $assets; | return $assets; | ||||
} | } |
//findProductByAvailabilitiesNegative | //findProductByAvailabilitiesNegative | ||||
public function getByAvailabilitiesNegative(ProductRepositoryQuery $query = null): array | public function getByAvailabilitiesNegative(ProductRepositoryQuery $query = null): array | ||||
{ | { | ||||
$query = $this->createDefaultQuery($query); | |||||
$query = $this->createQuery($query); | |||||
$query->joinProductFamily(); | |||||
$query->filterIsOnline(); | $query->filterIsOnline(); | ||||
$query->filterBehaviorCountStock(); | $query->filterBehaviorCountStock(); | ||||
$query->groupBy('pf.id'); | $query->groupBy('pf.id'); |
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; | |||||
// } |
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; | |||||
} | |||||
} |
<?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 | |||||
]; | |||||
} | |||||
} |
namespace Lc\CaracoleBundle\Statistic\Product; | namespace Lc\CaracoleBundle\Statistic\Product; | ||||
use Doctrine\ORM\EntityManagerInterface; | 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\Product\ProductFamilyModel; | ||||
use Lc\CaracoleBundle\Model\Section\SectionInterface; | use Lc\CaracoleBundle\Model\Section\SectionInterface; | ||||
use Lc\CaracoleBundle\Repository\Order\OrderProductStore; | use Lc\CaracoleBundle\Repository\Order\OrderProductStore; | ||||
} | } | ||||
// Initialise les valeurs des données pour chaque Interval de date | // 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(); | $this->cycleNumbers = array(); | ||||
for ($w = $currentCycleNumber - $this->nbCycle + 1; $w <= $currentCycleNumber; $w++) { | for ($w = $currentCycleNumber - $this->nbCycle + 1; $w <= $currentCycleNumber; $w++) { | ||||
$this->cycleNumbers[] = $w; | $this->cycleNumbers[] = $w; |