->hideOnIndex(), | ->hideOnIndex(), | ||||
BooleanField::new('isDefault'), | BooleanField::new('isDefault'), | ||||
StatusField::new('status'), | StatusField::new('status'), | ||||
BooleanField::new('isOnlineFrontend'), | |||||
], | ], | ||||
$this->getSeoPanel(), | $this->getSeoPanel(), | ||||
$this->getConfPanel(), | $this->getConfPanel(), |
class SwitchSectionAdminController extends AbstractController | class SwitchSectionAdminController extends AbstractController | ||||
{ | { | ||||
/** | /** | ||||
* @Route("/admin/section/switch", name="carac_section_switch") | |||||
* @Route("/admin/section/switch", name="admin_section_switch") | |||||
*/ | */ | ||||
public function switchSection( | public function switchSection( | ||||
Request $request, | Request $request, |
*/ | */ | ||||
protected $pointSaleSections; | protected $pointSaleSections; | ||||
/** | |||||
* @ORM\Column(type="boolean", nullable=true) | |||||
*/ | |||||
protected $isOnlineFrontend; | |||||
public function __construct() | public function __construct() | ||||
{ | { | ||||
$this->orderShops = new ArrayCollection(); | $this->orderShops = new ArrayCollection(); | ||||
return $this; | return $this; | ||||
} | } | ||||
public function getIsOnlineFrontend(): ?bool | |||||
{ | |||||
return $this->isOnlineFrontend; | |||||
} | |||||
public function setIsOnlineFrontend(?bool $isOnlineFrontend): self | |||||
{ | |||||
$this->isOnlineFrontend = $isOnlineFrontend; | |||||
return $this; | |||||
} | |||||
} | } |
return $this->andWhereEqual('isDefault', $isDefault); | return $this->andWhereEqual('isDefault', $isDefault); | ||||
} | } | ||||
public function filterIsOnlineFrontend() | |||||
{ | |||||
return $this->filterIsOnline() | |||||
&& $this->andWhereEqual('isOnlineFrontend', true); | |||||
} | |||||
} | } |
// @TODO : à implémenter avec le nouveau système d'ouverture des commandes | // @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(); | |||||
} | |||||
} | } |
if (isset($requestAttributesArray['section'])) { | if (isset($requestAttributesArray['section'])) { | ||||
$sectionCurrent = $sectionStore | $sectionCurrent = $sectionStore | ||||
->setMerchant($merchantCurrent) | ->setMerchant($merchantCurrent) | ||||
->getOneBySlug($requestAttributesArray['section'], false); | |||||
->getOneBySlug($requestAttributesArray['section']); | |||||
if($sectionCurrent===null){ | if($sectionCurrent===null){ | ||||
throw new NotFoundHttpException('Aucun espace n\'a été trouvé'); | throw new NotFoundHttpException('Aucun espace n\'a été trouvé'); | ||||
} | } |
Merchant: | Merchant: | ||||
label: Marchand | label: Marchand | ||||
label_plurial: Marchands | label_plurial: Marchands | ||||
Section: | Section: | ||||
label: Section | label: Section | ||||
label_plurial: Sections | label_plurial: Sections | ||||
cycle: Cycle de vente | cycle: Cycle de vente | ||||
isDefault: Section par défaut | isDefault: Section par défaut | ||||
cycleType: Cycle | cycleType: Cycle | ||||
isOnlineFrontend: Visible sur le site | |||||
TaxRate: | TaxRate: | ||||
label: Règle de taxe | label: Règle de taxe | ||||
label_plurial: Règles de taxes | label_plurial: Règles de taxes |
SwitchSectionFormType::class, | SwitchSectionFormType::class, | ||||
null, | null, | ||||
[ | [ | ||||
'action' => $this->urlGenerator->generate('carac_section_switch'), | |||||
'action' => $this->urlGenerator->generate('admin_section_switch'), | |||||
'attr' => ['class' => 'switch-section'], | 'attr' => ['class' => 'switch-section'], | ||||
'section' => $section, | 'section' => $section, | ||||
] | ] |