소스 검색

Intégration app product - renouvelement des stocks

packProduct
Fab 3 년 전
부모
커밋
583dfc3d3b
10개의 변경된 파일60개의 추가작업 그리고 30개의 파일을 삭제
  1. +2
    -2
      Builder/Order/OrderShopBuilder.php
  2. +4
    -0
      Controller/AdminControllerTrait.php
  3. +0
    -17
      Model/Product/ProductFamilyModel.php
  4. +1
    -4
      Repository/Product/ProductFamilyStore.php
  5. +4
    -3
      Resources/assets/functions/statistic.js
  6. +3
    -0
      Resources/translations/admin.fr.yaml
  7. +0
    -1
      Resources/views/admin/product/modal/show_products_sales_statistic.html.twig
  8. +0
    -1
      Solver/Price/ProductPriceSolver.php
  9. +6
    -2
      Statistic/Product/ProductsSalesStatistic.php
  10. +40
    -0
      Twig/ToolsTwigExtension.php

+ 2
- 2
Builder/Order/OrderShopBuilder.php 파일 보기



public function getProductsSalesStatistic(SectionInterface $section, $entity, $nbWeek = 2) public function getProductsSalesStatistic(SectionInterface $section, $entity, $nbWeek = 2)
{ {
$productsSalesStatistic = new ProductsSalesStatistic($this->entityManager, $entity, $nbWeek);
$productsSalesStatistic = new ProductsSalesStatistic($this->entityManager, $entity, $nbWeek, $this->productSolver);


$productsSalesStatistic->init($section, $this->orderShopSolver, $this->openingResolver); $productsSalesStatistic->init($section, $this->orderShopSolver, $this->openingResolver);
$productsSalesStatistic->populateProperties($this->orderShopStore); $productsSalesStatistic->populateProperties($this->orderShopStore);
} }




}
}

+ 4
- 0
Controller/AdminControllerTrait.php 파일 보기



return $duplicateAction; return $duplicateAction;
} }

public function getCurrentSection(){
return $this->get(SectionResolver::class)->getCurrent();
}
} }



+ 0
- 17
Model/Product/ProductFamilyModel.php 파일 보기

*/ */
protected $behaviorStockCycle; protected $behaviorStockCycle;


/**
* @ORM\Column(type="boolean", nullable=true)
*/
protected $availabilityRenewedThisWeek;

/** /**
* @ORM\Column(type="string", length=255) * @ORM\Column(type="string", length=255)
*/ */
return $this; return $this;
} }


public function getAvailabilityRenewedThisWeek(): ?bool
{
return $this->availabilityRenewedThisWeek;
}

public function setAvailabilityRenewedThisWeek(?bool $availabilityRenewedThisWeek): self
{
$this->availabilityRenewedThisWeek = $availabilityRenewedThisWeek;

return $this;
}

public function getBehaviorDisplaySale(): ?string public function getBehaviorDisplaySale(): ?string
{ {
return $this->behaviorDisplaySale; return $this->behaviorDisplaySale;

+ 1
- 4
Repository/Product/ProductFamilyStore.php 파일 보기



public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
{ {
if($this->section) {
$query->filterBySection($this->section);
}

$query->filterBySection($this->section);
return $query; return $query;
} }



+ 4
- 3
Resources/assets/functions/statistic.js 파일 보기

import Chart from 'chart';
export class CaracStatistics { export class CaracStatistics {
static initBtnShowTotalOrderProduct(){ static initBtnShowTotalOrderProduct(){
$('.lc-show-products-sales-statistic').unbind('click').on('click', function (){ $('.lc-show-products-sales-statistic').unbind('click').on('click', function (){
$btn = $(this);
var $btn = $(this);
var url = $(this).data('url'); var url = $(this).data('url');
$('#modal-products-sales-statistic').remove(); $('#modal-products-sales-statistic').remove();
$.ajax({ $.ajax({
success: function (response) { success: function (response) {
$('body').append(response.data); $('body').append(response.data);
$('#modal-products-sales-statistic').modal('show'); $('#modal-products-sales-statistic').modal('show');
initModalProductsSalesStatistic(response.statistics);
CaracStatistics.initModalProductsSalesStatistic(response.statistics);
} }
}); });
}); });
$('#table-products-sales-statistic-'+$(this).data('property-name')).show() $('#table-products-sales-statistic-'+$(this).data('property-name')).show()
if (chart) chart.destroy(); if (chart) chart.destroy();
$(this).removeClass('btn-secondary'); $(this).removeClass('btn-secondary');
chart = drawProductsSalesStatistic(statistics,$(this).data('property-name'))
chart = CaracStatistics.drawProductsSalesStatistic(statistics,$(this).data('property-name'))
}); });
$('.btn-products-sales-statistic').first().click(); $('.btn-products-sales-statistic').first().click();



+ 3
- 0
Resources/translations/admin.fr.yaml 파일 보기





flash_message: flash_message:
error:
formValidation: Une erreur est survenue lors de la soumission du formulaire
settings_saved: Paramètres mis à jour settings_saved: Paramètres mis à jour
duplicateToOtherMerchant: "Le document a bien été dupliqué sur le marchand : %merchant%" duplicateToOtherMerchant: "Le document a bien été dupliqué sur le marchand : %merchant%"
duplicateToOtherSection: "Le document a bien été dupliqué sur la section : %section%" duplicateToOtherSection: "Le document a bien été dupliqué sur la section : %section%"
favorite: Définir comme favoris favorite: Définir comme favoris
duplicateToOtherMerchant: Dupliquer sur un autre marchand duplicateToOtherMerchant: Dupliquer sur un autre marchand
duplicateToOtherSection: Dupliquer sur une autre section duplicateToOtherSection: Dupliquer sur une autre section
editProductFamily: Éditer le produit


setting_definition: setting_definition:
merchant: merchant:

+ 0
- 1
Resources/views/admin/product/modal/show_products_sales_statistic.html.twig 파일 보기

{% embed "@LcSov/adminlte/embed/modal.twig" %} {% embed "@LcSov/adminlte/embed/modal.twig" %}
{% import '@LcCaracole/admin/product/macro/product_family_macro.html.twig' as pfm %} {% import '@LcCaracole/admin/product/macro/product_family_macro.html.twig' as pfm %}


{% trans_default_domain 'lcshop' %}
{% block size %}modal-lg{% endblock %} {% block size %}modal-lg{% endblock %}
{% block id %}modal-products-sales-statistic{% endblock %} {% block id %}modal-products-sales-statistic{% endblock %}
{% block title %}Total ventes/semaines : {{ productFamily.title }}{% endblock %} {% block title %}Total ventes/semaines : {{ productFamily.title }}{% endblock %}

+ 0
- 1
Solver/Price/ProductPriceSolver.php 파일 보기

$solver = $this->getSolver($product); $solver = $this->getSolver($product);


if ($solver->getBehaviorPriceInherited($product) == 'by-piece') { if ($solver->getBehaviorPriceInherited($product) == 'by-piece') {
dump($product);
return $solver->getBuyingPriceInherited($product); return $solver->getBuyingPriceInherited($product);
} elseif ($solver->getBehaviorPriceInherited($product) == 'by-reference-unit') { } elseif ($solver->getBehaviorPriceInherited($product) == 'by-reference-unit') {
if ($solver->getQuantityInherited($product) > 0) { if ($solver->getQuantityInherited($product) > 0) {

+ 6
- 2
Statistic/Product/ProductsSalesStatistic.php 파일 보기

use Lc\CaracoleBundle\Repository\Order\OrderShopStore; use Lc\CaracoleBundle\Repository\Order\OrderShopStore;
use Lc\CaracoleBundle\Resolver\OpeningResolver; use Lc\CaracoleBundle\Resolver\OpeningResolver;
use Lc\CaracoleBundle\Solver\Order\OrderShopSolver; use Lc\CaracoleBundle\Solver\Order\OrderShopSolver;
use Lc\CaracoleBundle\Solver\Product\ProductSolver;
use Lc\CaracoleBundle\Statistic\Statistic; use Lc\CaracoleBundle\Statistic\Statistic;


class ProductsSalesStatistic extends Statistic class ProductsSalesStatistic extends Statistic
protected $productFamily; protected $productFamily;
protected $cycleNumbers = array(); protected $cycleNumbers = array();
protected $productIds = array(); protected $productIds = array();
protected ProductSolver $productSolver;


public function __construct(EntityManagerInterface $entityManager, $productFamily, $nbCycle)
public function __construct(EntityManagerInterface $entityManager, $productFamily, $nbCycle, ProductSolver $productSolver)
{ {
parent::__construct($entityManager); parent::__construct($entityManager);
$this->nbCycle = $nbCycle; $this->nbCycle = $nbCycle;
$this->productFamily = $productFamily; $this->productFamily = $productFamily;
$this->productSolver = $productSolver;


$this->createProperties(); $this->createProperties();
} }
$this->setData($result['productId'], $result['cycleNumber'], $result['quantity']); $this->setData($result['productId'], $result['cycleNumber'], $result['quantity']);
$product = $this->productIds[$result['productId']]; $product = $this->productIds[$result['productId']];
if ($this->productFamily->getBehaviorDisplaySale() == ProductFamilyModel::BEHAVIOR_DISPLAY_SALE_BY_MEASURE) { if ($this->productFamily->getBehaviorDisplaySale() == ProductFamilyModel::BEHAVIOR_DISPLAY_SALE_BY_MEASURE) {
$ratioByMeasure = $product->getQuantityInherited() / $product->getUnitInherited()->getCoefficient();

$ratioByMeasure = $this->productSolver->getQuantityInherited($product) / $this->productSolver->getUnitInherited($product)->getCoefficient();
$this->setData('total_sales', $result['cycleNumber'], intval($result['quantity']) * $ratioByMeasure); $this->setData('total_sales', $result['cycleNumber'], intval($result['quantity']) * $ratioByMeasure);
} else { } else {
$this->setData('total_sales', $result['cycleNumber'], intval($result['quantity'])); $this->setData('total_sales', $result['cycleNumber'], intval($result['quantity']));

+ 40
- 0
Twig/ToolsTwigExtension.php 파일 보기

<?php

namespace Lc\CaracoleBundle\Twig;

use Lc\CaracoleBundle\Builder\Order\OrderShopBuilder;
use Lc\CaracoleBundle\Model\Merchant\MerchantInterface;
use Lc\CaracoleBundle\Model\Order\OrderShopInterface;
use Lc\CaracoleBundle\Model\Section\SectionInterface;
use Lc\CaracoleBundle\Model\User\UserMerchantInterface;
use Lc\CaracoleBundle\Repository\Config\TaxRateStore;
use Lc\CaracoleBundle\Repository\Config\UnitStore;
use Lc\CaracoleBundle\Repository\Merchant\MerchantStore;
use Lc\CaracoleBundle\Repository\Order\OrderShopStore;
use Lc\CaracoleBundle\Repository\Product\ProductCategoryStore;
use Lc\CaracoleBundle\Repository\Reminder\ReminderStore;
use Lc\CaracoleBundle\Repository\Section\SectionStore;
use Lc\CaracoleBundle\Resolver\MerchantResolver;
use Lc\CaracoleBundle\Resolver\SectionResolver;
use Lc\CaracoleBundle\Resolver\VisitorResolver;
use Lc\SovBundle\Solver\Setting\SettingSolver;
use Symfony\Component\Security\Core\Security;
use Twig\Extension\AbstractExtension;
use Twig\TwigFunction;

class ToolsTwigExtension extends AbstractExtension
{

public function getFunctions()
{
return array(
new TwigFunction('die', [$this, 'simuleDie']),
);
}

public function simuleDie(string $message = null)
{
die($message);
}

}

Loading…
취소
저장