您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

ProductFamilyAdminController.php 1.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. }