Browse Source

listing

packProduct
Charly 3 years ago
parent
commit
2d32718274
3 changed files with 38 additions and 33 deletions
  1. +22
    -22
      Controller/PointSale/PointSaleAdminController.php
  2. +14
    -11
      Controller/Product/ProductCategoryAdminController.php
  3. +2
    -0
      Resources/translations/admin.fr.yaml

+ 22
- 22
Controller/PointSale/PointSaleAdminController.php View File

namespace Lc\CaracoleBundle\Controller\PointSale; namespace Lc\CaracoleBundle\Controller\PointSale;


use EasyCorp\Bundle\EasyAdminBundle\Field\FormField; use EasyCorp\Bundle\EasyAdminBundle\Field\FormField;
use EasyCorp\Bundle\EasyAdminBundle\Field\IntegerField;
use EasyCorp\Bundle\EasyAdminBundle\Field\MoneyField;
use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField; use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField;
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
use Lc\CaracoleBundle\Container\PointSale\PointSaleContainer; use Lc\CaracoleBundle\Container\PointSale\PointSaleContainer;
use Lc\SovBundle\Controller\AbstractAdminController; use Lc\SovBundle\Controller\AbstractAdminController;
use Lc\SovBundle\Field\BooleanField; use Lc\SovBundle\Field\BooleanField;
use Lc\SovBundle\Field\StatusField; use Lc\SovBundle\Field\StatusField;
use Lc\SovBundle\Field\ToggleField;


abstract class PointSaleAdminController extends AbstractAdminController abstract class PointSaleAdminController extends AbstractAdminController
{ {


public function configureFields(string $pageName): iterable public function configureFields(string $pageName): iterable
{ {

return array_merge( return array_merge(
[
FormField::addPanel('general'),
TextField::new('title'),
NumberField::new('orderAmountMin')
->setCustomOption('appendHtml','€')
->hideOnIndex(),
NumberField::new('deliveryPrice')
->setCustomOption('appendHtml','€')
->hideOnIndex(),
BooleanField::new('isPublic'),
BooleanField::new('isDepository'),
StatusField::new('status')
->hideOnIndex(),
FormField::addPanel('address'),
AddressField::new('address')
->setRequired(true)
],
$this->getSeoPanel(),
$this->getConfPanel(),
[
FormField::addPanel('general'),
IntegerField::new('id')->onlyOnIndex(),
TextField::new('title'),
MoneyField::new('orderAmountMin')->setCurrency('EUR'),
NumberField::new('deliveryPrice')
->setCustomOption('appendHtml', '€')
->hideOnIndex(),
StatusField::new('status'),
ToggleField::new('isPublic'),
ToggleField::new('isDepository'),
FormField::addPanel('address'),
AddressField::new('address')
->setRequired(true)
],
$this->getSeoPanel(),
$this->getConfPanel(),
); );
} }


public function createEntity(string $entityFqcn) public function createEntity(string $entityFqcn)
{ {
return $this->get(PointSaleContainer::class) return $this->get(PointSaleContainer::class)
->getFactory()
->create($this->get(MerchantResolver::class)->getCurrent());
->getFactory()
->create($this->get(MerchantResolver::class)->getCurrent());
} }
} }

+ 14
- 11
Controller/Product/ProductCategoryAdminController.php View File

use EasyCorp\Bundle\EasyAdminBundle\Field\FormField; use EasyCorp\Bundle\EasyAdminBundle\Field\FormField;
use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField; use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField;
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
use EasyCorp\Bundle\EasyAdminBundle\Field\DateTimeField;
use Lc\CaracoleBundle\Container\Order\OrderShopContainer; use Lc\CaracoleBundle\Container\Order\OrderShopContainer;
use Lc\CaracoleBundle\Controller\AdminControllerTrait; use Lc\CaracoleBundle\Controller\AdminControllerTrait;
use Lc\CaracoleBundle\Field\Address\AddressField; use Lc\CaracoleBundle\Field\Address\AddressField;
use Lc\SovBundle\Field\BooleanField; use Lc\SovBundle\Field\BooleanField;
use Lc\SovBundle\Field\CKEditorField; use Lc\SovBundle\Field\CKEditorField;
use Lc\SovBundle\Field\StatusField; use Lc\SovBundle\Field\StatusField;
use Lc\SovBundle\Field\ToggleField;
use Lc\SovBundle\Translation\TranslatorAdmin; use Lc\SovBundle\Translation\TranslatorAdmin;


abstract class ProductCategoryAdminController extends AbstractAdminController abstract class ProductCategoryAdminController extends AbstractAdminController
public function configureFields(string $pageName): iterable public function configureFields(string $pageName): iterable
{ {
return array_merge( return array_merge(
[
FormField::addPanel('general'),
TextField::new('title'),
NumberField::new('position')->hideOnForm(),
AssociationField::new('parent'),
CKEditorField::new('description'),
BooleanField::new('saleStatus'),
StatusField::new('status'),
[
FormField::addPanel('general'),
TextField::new('title'),
NumberField::new('position')->hideOnForm(),
AssociationField::new('parent')->hideOnIndex(),
DateTimeField::new('createdAt')->setFormat('short'),
CKEditorField::new('description')->hideOnIndex(),
ToggleField::new('saleStatus'),
StatusField::new('status'),


],
$this->getSeoPanel(),
$this->getConfPanel()
],
$this->getSeoPanel(),
$this->getConfPanel()
); );
} }



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

label_plurial: Points de vente label_plurial: Points de vente
fields: fields:
orderAmountMin: Montant minimum de commande orderAmountMin: Montant minimum de commande
isPublic: Public
isDepository: Dépôt


Address: Address:
fields: fields:

Loading…
Cancel
Save