Kaynağa Gözat

Crud PointSale

ideas
Guillaume 3 yıl önce
ebeveyn
işleme
1ed7790286
6 değiştirilmiş dosya ile 58 ekleme ve 7 silme
  1. +6
    -0
      Controller/AdminControllerTrait.php
  2. +1
    -1
      Controller/Merchant/MerchantAdminController.php
  3. +37
    -0
      Controller/PointSale/PointSaleAdminController.php
  4. +0
    -1
      Controller/Section/SectionAdminController.php
  5. +7
    -5
      Repository/PointSale/PointSaleRepository.php
  6. +7
    -0
      Resources/translations/admin.fr.yaml

+ 6
- 0
Controller/AdminControllerTrait.php Dosyayı Görüntüle

@@ -6,6 +6,7 @@ use Doctrine\ORM\QueryBuilder;
use EasyCorp\Bundle\EasyAdminBundle\Collection\FieldCollection;
use EasyCorp\Bundle\EasyAdminBundle\Collection\FilterCollection;
use Lc\CaracoleBundle\Doctrine\Extension\FilterMerchantInterface;
use Lc\CaracoleBundle\Doctrine\Extension\FilterMultipleMerchantsInterface;
use Lc\CaracoleBundle\Doctrine\Extension\FilterSectionInterface;
use Lc\CaracoleBundle\Factory\User\UserMerchantFactory;
use Lc\CaracoleBundle\Resolver\MerchantResolver;
@@ -47,6 +48,11 @@ trait AdminControllerTrait
$queryBuilder->setParameter('merchant', $this->get('merchant_resolver')->getCurrent());
}

if ($this->isInstanceOf(FilterMultipleMerchantsInterface::class)) {
$queryBuilder->andWhere(':merchant MEMBER OF entity.merchants');
$queryBuilder->setParameter('merchant', $this->get('merchant_resolver')->getCurrent());
}

if ($this->isInstanceOf(FilterSectionInterface::class)) {
$queryBuilder->andWhere('entity.section = :section');
$queryBuilder->setParameter('section', $this->get('section_resolver')->getCurrent());

+ 1
- 1
Controller/Merchant/MerchantAdminController.php Dosyayı Görüntüle

@@ -36,7 +36,7 @@ abstract class MerchantAdminController extends AbstractAdminController

FormField::addPanel('address'),
AddressField::new('address')
->setRequired(true),
],
$panel
);

+ 37
- 0
Controller/PointSale/PointSaleAdminController.php Dosyayı Görüntüle

@@ -0,0 +1,37 @@
<?php

namespace Lc\CaracoleBundle\Controller\PointSale;

use EasyCorp\Bundle\EasyAdminBundle\Field\FormField;
use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField;
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
use Lc\CaracoleBundle\Controller\AdminControllerTrait;
use Lc\CaracoleBundle\Field\Address\AddressField;
use Lc\SovBundle\Controller\AbstractAdminController;
use Lc\SovBundle\Field\StatusField;

abstract class PointSaleAdminController extends AbstractAdminController
{
use AdminControllerTrait;

public function configureFields(string $pageName): iterable
{
$panel = parent::configureFields($pageName);

return array_merge(
[
FormField::addPanel('general'),
TextField::new('title'),
NumberField::new('orderAmountMin')
->setCustomOption('appendHtml','€')
->hideOnIndex(),
StatusField::new('status'),
FormField::addPanel('address'),
AddressField::new('address')
->setRequired(true)
],
$panel
);
}

}

+ 0
- 1
Controller/Section/SectionAdminController.php Dosyayı Görüntüle

@@ -2,7 +2,6 @@

namespace Lc\CaracoleBundle\Controller\Section;

use Doctrine\ORM\EntityManagerInterface;
use EasyCorp\Bundle\EasyAdminBundle\Field\ChoiceField;
use EasyCorp\Bundle\EasyAdminBundle\Field\FormField;
use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField;

+ 7
- 5
Repository/PointSale/PointSaleRepository.php Dosyayı Görüntüle

@@ -2,8 +2,8 @@

namespace Lc\CaracoleBundle\Repository\PointSale;

use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
use Lc\CaracoleBundle\Repository\RepositoryTrait;
use Lc\SovBundle\Repository\AbstractRepository;
use Lc\CaracoleBundle\Model\PointSale\PointSaleInterface;

/**
@@ -12,10 +12,12 @@ use Lc\CaracoleBundle\Model\PointSale\PointSaleInterface;
* @method PointSaleInterface[] findAll()
* @method PointSaleInterface[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class PointSaleRepository extends ServiceEntityRepository
class PointSaleRepository extends AbstractRepository
{
public function __construct(ManagerRegistry $registry)
use RepositoryTrait;

public function getInterfaceClass()
{
parent::__construct($registry, PointSaleInterface::class);
return PointSaleInterface::class;
}
}

+ 7
- 0
Resources/translations/admin.fr.yaml Dosyayı Görüntüle

@@ -1,5 +1,6 @@

menu:
pointsale: Points de vente
setting: Paramètres
setting_merchant: Marchand
setting_section: Section
@@ -34,6 +35,12 @@ entity:
address: Adresse
merchant: Marchand
taxRate: Règle de taxe
PointSale:
label: Point de vente
label_plurial: Points de vente
fields:
orderAmountMin: Montant minimum de commande

Address:
fields:
type: Type

Yükleniyor…
İptal
Kaydet