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

$easyadmin = $this->request->attributes->get('easyadmin'); $easyadmin = $this->request->attributes->get('easyadmin');
$entity = $easyadmin['item']; $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')) { if ($this->request->isXmlHttpRequest() && $property = $this->request->query->get('property')) {
$newValue = 'true' === mb_strtolower($this->request->query->get('newValue')); $newValue = 'true' === mb_strtolower($this->request->query->get('newValue'));
$fieldsMetadata = $this->entity['list']['fields']; $fieldsMetadata = $this->entity['list']['fields'];
'entity' => $entity, 'entity' => $entity,
'delete_form' => $deleteForm->createView(), 'delete_form' => $deleteForm->createView(),
'sortableProductsField' => $sortableProductsField, 'sortableProductsField' => $sortableProductsField,
'totalProductOrdered' => $totalProductOrdered
'totalProductOrdered' => $this->getTotalProductOrdered($entity)
]; ];


return $this->executeDynamicMethod('render<EntityName>Template', ['edit', $this->entity['templates']['edit'], $parameters]); return $this->executeDynamicMethod('render<EntityName>Template', ['edit', $this->entity['templates']['edit'], $parameters]);
} }





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

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

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

{% block form_start %}{% endblock %} {% block form_start %}{% endblock %}
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <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"> <button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span> <span aria-hidden="true">×</span>
</button> </button>

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

{% endmacro box_info %} {% 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) %} {#{% macro modal(title, form) %}
{% embed '@LcShop/backend/default/block/embed_modal.twig' %} {% embed '@LcShop/backend/default/block/embed_modal.twig' %}
{% trans_default_domain 'lcshop' %} {% trans_default_domain 'lcshop' %}

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

} }
} }


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

} }



Loading…
Cancel
Save