Browse Source

Edition stock dans liste

feature/export_comptable
Fab 4 years ago
parent
commit
c3a3cd786a
5 changed files with 45 additions and 20 deletions
  1. +17
    -18
      ShopBundle/Controller/Backend/ProductFamilyController.php
  2. +5
    -1
      ShopBundle/Resources/translations/lcshop.fr.yaml
  3. +1
    -1
      ShopBundle/Resources/views/backend/default/block/embed_modal.twig
  4. +18
    -0
      ShopBundle/Resources/views/backend/default/block/macros.html.twig
  5. +4
    -0
      ShopBundle/Services/Price/ProductPriceUtils.php

+ 17
- 18
ShopBundle/Controller/Backend/ProductFamilyController.php View File

@@ -261,22 +261,6 @@ class ProductFamilyController extends AdminController
$easyadmin = $this->request->attributes->get('easyadmin');
$entity = $easyadmin['item'];


$orderShopRepo = $this->em->getRepository(OrderShopInterface::class);

$totalProductOrdered = array();
foreach ($entity->getProducts() as $product) {
$currentWeekNumber = $this->orderUtils->getWeekNumberCurrent();
//Les commandes sont ouvertes ont récupèrent les commandes en cours et celle de la semaine dernière
if ($this->orderUtils->isOpenSale()) {
$totalProductOrdered[$product->getId()][$currentWeekNumber] = $orderShopRepo->countValidOrderProductsOfWeekByProduct($currentWeekNumber, $product->getId());
$totalProductOrdered[$product->getId()][$currentWeekNumber - 1] = $orderShopRepo->countValidOrderProductsOfWeekByProduct($currentWeekNumber - 1, $product->getId());
} else {
$totalProductOrdered[$product->getId()][$currentWeekNumber] = $orderShopRepo->countValidOrderProductsOfWeekByProduct($currentWeekNumber, $product->getId());
}
}


if ($this->request->isXmlHttpRequest() && $property = $this->request->query->get('property')) {
$newValue = 'true' === mb_strtolower($this->request->query->get('newValue'));
$fieldsMetadata = $this->entity['list']['fields'];
@@ -335,7 +319,7 @@ class ProductFamilyController extends AdminController
'entity' => $entity,
'delete_form' => $deleteForm->createView(),
'sortableProductsField' => $sortableProductsField,
'totalProductOrdered' => $totalProductOrdered
'totalProductOrdered' => $this->getTotalProductOrdered($entity)
];

return $this->executeDynamicMethod('render<EntityName>Template', ['edit', $this->entity['templates']['edit'], $parameters]);
@@ -398,6 +382,21 @@ class ProductFamilyController extends AdminController
}



public function getTotalProductOrdered($entity){
$orderShopRepo = $this->em->getRepository(OrderShopInterface::class);
$totalProductOrdered = array();
foreach ($entity->getProducts() as $product) {
$currentWeekNumber = $this->orderUtils->getWeekNumberCurrent();
//Les commandes sont ouvertes ont récupèrent les commandes en cours et celle de la semaine dernière
if ($this->orderUtils->isOpenSale()) {
$totalProductOrdered[$product->getId()][$currentWeekNumber] = $orderShopRepo->countValidOrderProductsOfWeekByProduct($currentWeekNumber, $product->getId());
$totalProductOrdered[$product->getId()][$currentWeekNumber - 1] = $orderShopRepo->countValidOrderProductsOfWeekByProduct($currentWeekNumber - 1, $product->getId());
} else {
$totalProductOrdered[$product->getId()][$currentWeekNumber] = $orderShopRepo->countValidOrderProductsOfWeekByProduct($currentWeekNumber, $product->getId());
}
}
return $totalProductOrdered;
}

}


+ 5
- 1
ShopBundle/Resources/translations/lcshop.fr.yaml View File

@@ -442,13 +442,17 @@ action:
search: Rechercher
delete: Supprimer
change: Modifier
save: Sauvegarder (retour liste)
save: Sauvegarder
saveGotoList: Sauvegarder (retour liste)
cancel: Annuler
continue: Continuer
list: Retour à la liste
deselect: Désélectionner
form.empty_value: Aucun(e)
add: Ajouter
product:
editStock: Gérer les stocks
editProductFamily: Éditer le produit
user:
account: Mon compte
logout: Me déconnecter

+ 1
- 1
ShopBundle/Resources/views/backend/default/block/embed_modal.twig View File

@@ -4,7 +4,7 @@
{% block form_start %}{% endblock %}
<div class="modal-content">
<div class="modal-header">
<h4>{% block title %}{% endblock %}</h4>
<h5>{% block title %}{% endblock %}</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>

+ 18
- 0
ShopBundle/Resources/views/backend/default/block/macros.html.twig View File

@@ -243,6 +243,24 @@
{% endmacro box_info %}


{% macro form_row_append(field, append) %}
<div class="form-group">
{{ form_label(field) }}
{{ _self.form_widget_append(field, append) }}
</div>
{% endmacro form_row_append %}
{% macro form_widget_append(field, append) %}
<div class="form-widget">
<div class="input-group">
{{ form_widget(field) }}
<div class="input-group-append">
<span class="input-group-text">{{ append }}</span>
</div>
</div>
{{ form_help(field) }}
</div>
{% endmacro form_widget_append %}

{#{% macro modal(title, form) %}
{% embed '@LcShop/backend/default/block/embed_modal.twig' %}
{% trans_default_domain 'lcshop' %}

+ 4
- 0
ShopBundle/Services/Price/ProductPriceUtils.php View File

@@ -91,5 +91,9 @@ class ProductPriceUtils
}
}

public function getMultiplyingFactor(ProductPropertyInterface $product){
return $this->round($this->getPriceWithTax($product) / $this->getBuyingPrice($product));
}

}


Loading…
Cancel
Save