|
12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- <?php
-
- namespace Lc\CaracoleBundle\Controller\Product;
-
- use EasyCorp\Bundle\EasyAdminBundle\Context\AdminContext;
- use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField;
- use EasyCorp\Bundle\EasyAdminBundle\Field\FormField;
- use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField;
- use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
- use Lc\CaracoleBundle\Container\Order\OrderShopContainer;
- use Lc\CaracoleBundle\Controller\AdminControllerTrait;
- use Lc\CaracoleBundle\Field\Address\AddressField;
- use Lc\CaracoleBundle\Resolver\SectionResolver;
- use Lc\SovBundle\Controller\AbstractAdminController;
- use Lc\SovBundle\Field\BooleanField;
- use Lc\SovBundle\Field\CKEditorField;
- use Lc\SovBundle\Field\StatusField;
- use Symfony\Component\HttpFoundation\RequestStack;
- use Symfony\Component\HttpFoundation\Response;
-
- abstract class ProductFamilyAdminController extends AbstractAdminController
- {
- use AdminControllerTrait;
-
- public function showSalesStatistic(AdminContext $context)
- {
- $productFamily = $context->getEntity()->getInstance();
-
- $currentSection = $this->get(SectionResolver::class)->getCurrent();
- $productsSalesStatistic = $this->get(OrderShopContainer::class)->getBuilder()->getProductsSalesStatistic($currentSection, $productFamily, 16);
- $parameters = array(
- 'productFamily' => $productFamily,
- 'productsSalesStatistic' => $productsSalesStatistic
- );
-
- //TODO flashMessages ???
- $response['flashMessages'] = [];//$this->utils->getFlashMessages();
- $response['data'] = $this->render('@LcCaracole/admin/product/modal/show_products_sales_statistic.html.twig', $parameters)->getContent();
- $response['statistics'] = $productsSalesStatistic;
- return new Response(json_encode($response));
- }
-
- }
|