<?php declare(strict_types=1);
namespace TemplaidInvoices\Controller;
use Shopware\Core\Checkout\Cart\Exception\CustomerNotLoggedInException;
use Shopware\Core\Framework\DataAbstractionLayer\Exception\InconsistentCriteriaIdsException;
use Shopware\Core\Framework\Routing\Annotation\LoginRequired;
use Shopware\Core\Framework\Routing\Annotation\RouteScope;
use Shopware\Core\Framework\Routing\Annotation\Since;
use Shopware\Core\Framework\Routing\Exception\MissingRequestParameterException;
use Shopware\Core\System\SalesChannel\SalesChannelContext;
use Shopware\Storefront\Controller\StorefrontController;
use Shopware\Storefront\Framework\Routing\Annotation\NoStore;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\EventListener\AbstractSessionListener;
use Symfony\Component\Routing\Annotation\Route;
use TemplaidInvoices\Storefront\Page\Account\TemplaidAssortmentPageLoader;
/**
* @RouteScope(scopes={"storefront"})
*/
class ListController extends StorefrontController
{
private TemplaidAssortmentPageLoader $assortmentPageLoader;
public function __construct(
TemplaidAssortmentPageLoader $assortmentPageLoader
)
{
$this->assortmentPageLoader = $assortmentPageLoader;
}
/**
* @Since("6.0.0.0")
* @LoginRequired()
* @Route("/account/assortment/{list}/{listId}", name="frontend.templaid.assortment.page", options={"seo"="false"}, methods={"GET", "POST"}, defaults={"XmlHttpRequest"=true})
* @NoStore()
*
* @throws CustomerNotLoggedInException
* @throws InconsistentCriteriaIdsException
* @throws MissingRequestParameterException
* @throws \Exception
*/
public function invoices(string $list, string $listId, Request $request, SalesChannelContext $context): Response
{
$page = $this->assortmentPageLoader->load($request, $context);
return $this->renderStorefront('@Storefront/storefront/page/account/assortment.html.twig', ['page' => $page, 'list' => $list, 'listId' => $listId]);
}
}