You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
1.8KB

  1. <?php
  2. namespace Lc\CaracoleBundle\Controller\Product;
  3. use EasyCorp\Bundle\EasyAdminBundle\Context\AdminContext;
  4. use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField;
  5. use EasyCorp\Bundle\EasyAdminBundle\Field\FormField;
  6. use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField;
  7. use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
  8. use Lc\CaracoleBundle\Container\Order\OrderShopContainer;
  9. use Lc\CaracoleBundle\Controller\AdminControllerTrait;
  10. use Lc\CaracoleBundle\Field\Address\AddressField;
  11. use Lc\CaracoleBundle\Resolver\SectionResolver;
  12. use Lc\SovBundle\Controller\AbstractAdminController;
  13. use Lc\SovBundle\Field\BooleanField;
  14. use Lc\SovBundle\Field\CKEditorField;
  15. use Lc\SovBundle\Field\StatusField;
  16. use Symfony\Component\HttpFoundation\RequestStack;
  17. use Symfony\Component\HttpFoundation\Response;
  18. abstract class ProductFamilyAdminController extends AbstractAdminController
  19. {
  20. use AdminControllerTrait;
  21. public function showSalesStatistic(AdminContext $context)
  22. {
  23. $productFamily = $context->getEntity()->getInstance();
  24. $currentSection = $this->get(SectionResolver::class)->getCurrent();
  25. $productsSalesStatistic = $this->get(OrderShopContainer::class)->getBuilder()->getProductsSalesStatistic($currentSection, $productFamily, 16);
  26. $parameters = array(
  27. 'productFamily' => $productFamily,
  28. 'productsSalesStatistic' => $productsSalesStatistic
  29. );
  30. //TODO flashMessages ???
  31. $response['flashMessages'] = [];//$this->utils->getFlashMessages();
  32. $response['data'] = $this->render('@LcCaracole/admin/product/modal/show_products_sales_statistic.html.twig', $parameters)->getContent();
  33. $response['statistics'] = $productsSalesStatistic;
  34. return new Response(json_encode($response));
  35. }
  36. }