|
|
|
|
|
|
|
|
$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; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|