Browse Source

Merge branch 'develop'

master
Guillaume 3 years ago
parent
commit
85c81c423e
8 changed files with 35 additions and 4 deletions
  1. +1
    -0
      Controller/Section/SectionAdminController.php
  2. +1
    -1
      Controller/Section/SwitchSectionAdminController.php
  3. +17
    -0
      Model/Section/SectionModel.php
  4. +5
    -1
      Repository/Section/SectionRepositoryQuery.php
  5. +6
    -0
      Repository/Section/SectionStore.php
  6. +1
    -1
      Resolver/SectionResolver.php
  7. +3
    -0
      Resources/translations/admin.fr.yaml
  8. +1
    -1
      Twig/FormTwigExtension.php

+ 1
- 0
Controller/Section/SectionAdminController.php View File

@@ -55,6 +55,7 @@ abstract class SectionAdminController extends AbstractAdminController
->hideOnIndex(),
BooleanField::new('isDefault'),
StatusField::new('status'),
BooleanField::new('isOnlineFrontend'),
],
$this->getSeoPanel(),
$this->getConfPanel(),

+ 1
- 1
Controller/Section/SwitchSectionAdminController.php View File

@@ -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,

+ 17
- 0
Model/Section/SectionModel.php View File

@@ -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;
}
}

+ 5
- 1
Repository/Section/SectionRepositoryQuery.php View File

@@ -20,6 +20,10 @@ class SectionRepositoryQuery extends AbstractRepositoryQuery
return $this->andWhereEqual('isDefault', $isDefault);
}


public function filterIsOnlineFrontend()
{
return $this->filterIsOnline()
&& $this->andWhereEqual('isOnlineFrontend', true);
}

}

+ 6
- 0
Repository/Section/SectionStore.php View File

@@ -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();
}

}

+ 1
- 1
Resolver/SectionResolver.php View File

@@ -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é');
}

+ 3
- 0
Resources/translations/admin.fr.yaml View File

@@ -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

+ 1
- 1
Twig/FormTwigExtension.php View File

@@ -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,
]

Loading…
Cancel
Save