@@ -55,6 +55,7 @@ abstract class SectionAdminController extends AbstractAdminController | |||
->hideOnIndex(), | |||
BooleanField::new('isDefault'), | |||
StatusField::new('status'), | |||
BooleanField::new('isOnlineFrontend'), | |||
], | |||
$this->getSeoPanel(), | |||
$this->getConfPanel(), |
@@ -14,7 +14,7 @@ use Symfony\Component\Routing\Annotation\Route; | |||
class SwitchSectionAdminController extends AbstractController | |||
{ | |||
/** | |||
* @Route("/admin/section/switch", name="carac_section_switch") | |||
* @Route("/admin/section/switch", name="admin_section_switch") | |||
*/ | |||
public function switchSection( | |||
Request $request, |
@@ -102,6 +102,11 @@ abstract class SectionModel extends AbstractFullEntity implements FilterMerchant | |||
*/ | |||
protected $pointSaleSections; | |||
/** | |||
* @ORM\Column(type="boolean", nullable=true) | |||
*/ | |||
protected $isOnlineFrontend; | |||
public function __construct() | |||
{ | |||
$this->orderShops = new ArrayCollection(); | |||
@@ -441,4 +446,16 @@ abstract class SectionModel extends AbstractFullEntity implements FilterMerchant | |||
return $this; | |||
} | |||
public function getIsOnlineFrontend(): ?bool | |||
{ | |||
return $this->isOnlineFrontend; | |||
} | |||
public function setIsOnlineFrontend(?bool $isOnlineFrontend): self | |||
{ | |||
$this->isOnlineFrontend = $isOnlineFrontend; | |||
return $this; | |||
} | |||
} |
@@ -20,6 +20,10 @@ class SectionRepositoryQuery extends AbstractRepositoryQuery | |||
return $this->andWhereEqual('isDefault', $isDefault); | |||
} | |||
public function filterIsOnlineFrontend() | |||
{ | |||
return $this->filterIsOnline() | |||
&& $this->andWhereEqual('isOnlineFrontend', true); | |||
} | |||
} |
@@ -75,5 +75,11 @@ class SectionStore extends AbstractStore | |||
// @TODO : à implémenter avec le nouveau système d'ouverture des commandes | |||
} | |||
public function getOnlineFrontend($query = null) | |||
{ | |||
$query = $this->createDefaultQuery($query); | |||
$query->filterIsOnlineFrontend(); | |||
return $query->find(); | |||
} | |||
} |
@@ -94,7 +94,7 @@ class SectionResolver | |||
if (isset($requestAttributesArray['section'])) { | |||
$sectionCurrent = $sectionStore | |||
->setMerchant($merchantCurrent) | |||
->getOneBySlug($requestAttributesArray['section'], false); | |||
->getOneBySlug($requestAttributesArray['section']); | |||
if($sectionCurrent===null){ | |||
throw new NotFoundHttpException('Aucun espace n\'a été trouvé'); | |||
} |
@@ -112,6 +112,7 @@ entity: | |||
Merchant: | |||
label: Marchand | |||
label_plurial: Marchands | |||
Section: | |||
label: Section | |||
label_plurial: Sections | |||
@@ -119,6 +120,8 @@ entity: | |||
cycle: Cycle de vente | |||
isDefault: Section par défaut | |||
cycleType: Cycle | |||
isOnlineFrontend: Visible sur le site | |||
TaxRate: | |||
label: Règle de taxe | |||
label_plurial: Règles de taxes |
@@ -54,7 +54,7 @@ class FormTwigExtension extends AbstractExtension | |||
SwitchSectionFormType::class, | |||
null, | |||
[ | |||
'action' => $this->urlGenerator->generate('carac_section_switch'), | |||
'action' => $this->urlGenerator->generate('admin_section_switch'), | |||
'attr' => ['class' => 'switch-section'], | |||
'section' => $section, | |||
] |