|
- <?php
-
- namespace Lc\CaracoleBundle\Definition\Field\Order;
-
- use EasyCorp\Bundle\EasyAdminBundle\Field\DateTimeField;
- use EasyCorp\Bundle\EasyAdminBundle\Field\Field;
- use EasyCorp\Bundle\EasyAdminBundle\Field\IntegerField;
- use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField;
- use EasyCorp\Bundle\EasyAdminBundle\Field\TextareaField;
- use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
- use Lc\CaracoleBundle\Context\MerchantContextTrait;
- use Lc\CaracoleBundle\Definition\Field\AbstractFieldDefinition;
- use Lc\CaracoleBundle\Field\AssociationField;
- use Lc\CaracoleBundle\Field\Filter\Order\OrderShopComplementaryFilter;
- use Lc\CaracoleBundle\Field\Filter\Order\OrderShopOrderDeliveryTypeFilter;
- use Lc\CaracoleBundle\Field\Filter\Order\OrderShopOrderPaymentFilter;
- use Lc\CaracoleBundle\Field\Filter\Order\OrderShopOrderStatusFilter;
- use Lc\CaracoleBundle\Field\Filter\Order\OrderShopUserEmailFilter;
- use Lc\CaracoleBundle\Field\Filter\Order\OrderShopUserFirstnameFilter;
- use Lc\CaracoleBundle\Field\Filter\Order\OrderShopUserLastnameFilter;
- use Lc\CaracoleBundle\Repository\Section\SectionStore;
- use Lc\SovBundle\Translation\TranslatorAdmin;
- use Symfony\Component\Form\Extension\Core\Type\TextType;
-
- class OrderShopFieldDefinition extends AbstractFieldDefinition
- {
- use MerchantContextTrait;
-
- protected SectionStore $sectionStore;
-
- public function __construct(TranslatorAdmin $translatorAdmin, SectionStore $sectionStore)
- {
- parent::__construct($translatorAdmin);
- $this->sectionStore = $sectionStore;
- }
-
- public function configureFieldsIndex(): array
- {
- return ['id'];
- }
-
- public function configurePanels(): array
- {
- return [];
- }
-
- public function configureFields(): array
- {
- return [
- 'id' => IntegerField::new('id', 'ID')->setSortable(true),
- 'userLastname' => TextareaField::new('user.lastname')->setSortable(true)
- ->setCustomOption('filter_fqcn', OrderShopUserLastnameFilter::class),
- //->setTemplatePath('@LcShop/backend/default/field/textorempty.html.twig'),
- 'userFirstname' => TextareaField::new('user.firstname')->setSortable(true)
- ->setCustomOption('filter_fqcn', OrderShopUserFirstnameFilter::class),
- //->setTemplatePath('@LcShop/backend/default/field/textorempty.html.twig'),
- 'userEmail' => TextareaField::new('user.email')->setSortable(true)
- ->setCustomOption('filter_fqcn', OrderShopUserEmailFilter::class),
- //->setTemplatePath('@LcShop/backend/default/field/user.html.twig'),
- 'total' => NumberField::new('total')
- ->setTemplatePath('@LcCaracole/admin/order/field/total.html.twig'),
- 'orderStatus' => AssociationField::new('orderStatus')->setSortable(true)
- ->setTemplatePath('@LcCaracole/admin/order/field/order_status.html.twig')
- ->setCustomOption('filter_fqcn', OrderShopOrderStatusFilter::class),
- 'createdAt' => DateTimeField::new('createdAt')->setSortable(true),
- 'updatedAt' => DateTimeField::new('updatedAt')->setSortable(true),
- 'orderShopCreatedAt' => DateTimeField::new('orderShopCreatedAt')->setSortable(true),
- 'distribution' => AssociationField::new('distribution')
- ->setSortable(true)
- ->setCustomOption('filter_type', TextType::class)
- ->setCustomOption('filter_on', 'cycleNumber'),
- 'cycleDeliveryId' => IntegerField::new('cycleDeliveryId')->setSortable(true),
- 'cycleId' => IntegerField::new('cycleId')->setSortable(true),
- 'deliveryType' => Field::new('deliveryType')->setSortable(true)
- ->setCustomOption('filter_fqcn', OrderShopOrderDeliveryTypeFilter::class),
- //->setTemplatePath('@LcShop/backend/default/field/options_translatable.html.twig'),
- 'reference' => TextField::new('reference')->setSortable(true),
- 'complementaryOrderShops' => AssociationField::new('complementaryOrderShops')
- ->setFormTypeOption('mapped', false)
- ->setCustomOption('filter', false)
- ->setTemplatePath('@LcCaracole/admin/order/field/complementary.html.twig'),
- 'orderPayments' => AssociationField::new('orderPayments')
- ->setTemplatePath('@LcCaracole/admin/order/field/order_payment.html.twig')
- ->setCustomOption('filter_fqcn', OrderShopOrderPaymentFilter::class),
- 'user' => AssociationField::new('user')->setSortable(true)
- ];
- }
-
- }
|