Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

90 lines
4.5KB

  1. <?php
  2. namespace Lc\CaracoleBundle\Definition\Field\Order;
  3. use EasyCorp\Bundle\EasyAdminBundle\Field\DateTimeField;
  4. use EasyCorp\Bundle\EasyAdminBundle\Field\Field;
  5. use EasyCorp\Bundle\EasyAdminBundle\Field\IntegerField;
  6. use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField;
  7. use EasyCorp\Bundle\EasyAdminBundle\Field\TextareaField;
  8. use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
  9. use Lc\CaracoleBundle\Context\MerchantContextTrait;
  10. use Lc\CaracoleBundle\Definition\Field\AbstractFieldDefinition;
  11. use Lc\CaracoleBundle\Field\AssociationField;
  12. use Lc\CaracoleBundle\Field\Filter\Order\OrderShopComplementaryFilter;
  13. use Lc\CaracoleBundle\Field\Filter\Order\OrderShopOrderDeliveryTypeFilter;
  14. use Lc\CaracoleBundle\Field\Filter\Order\OrderShopOrderPaymentFilter;
  15. use Lc\CaracoleBundle\Field\Filter\Order\OrderShopOrderStatusFilter;
  16. use Lc\CaracoleBundle\Field\Filter\Order\OrderShopUserEmailFilter;
  17. use Lc\CaracoleBundle\Field\Filter\Order\OrderShopUserFirstnameFilter;
  18. use Lc\CaracoleBundle\Field\Filter\Order\OrderShopUserLastnameFilter;
  19. use Lc\CaracoleBundle\Repository\Section\SectionStore;
  20. use Lc\SovBundle\Translation\TranslatorAdmin;
  21. use Symfony\Component\Form\Extension\Core\Type\TextType;
  22. class OrderShopFieldDefinition extends AbstractFieldDefinition
  23. {
  24. use MerchantContextTrait;
  25. protected SectionStore $sectionStore;
  26. public function __construct(TranslatorAdmin $translatorAdmin, SectionStore $sectionStore)
  27. {
  28. parent::__construct($translatorAdmin);
  29. $this->sectionStore = $sectionStore;
  30. }
  31. public function configureFieldsIndex(): array
  32. {
  33. return ['id'];
  34. }
  35. public function configurePanels(): array
  36. {
  37. return [];
  38. }
  39. public function configureFields(): array
  40. {
  41. return [
  42. 'id' => IntegerField::new('id', 'ID')->setSortable(true),
  43. 'userLastname' => TextareaField::new('user.lastname')->setSortable(true)
  44. ->setCustomOption('filter_fqcn', OrderShopUserLastnameFilter::class),
  45. //->setTemplatePath('@LcShop/backend/default/field/textorempty.html.twig'),
  46. 'userFirstname' => TextareaField::new('user.firstname')->setSortable(true)
  47. ->setCustomOption('filter_fqcn', OrderShopUserFirstnameFilter::class),
  48. //->setTemplatePath('@LcShop/backend/default/field/textorempty.html.twig'),
  49. 'userEmail' => TextareaField::new('user.email')->setSortable(true)
  50. ->setCustomOption('filter_fqcn', OrderShopUserEmailFilter::class),
  51. //->setTemplatePath('@LcShop/backend/default/field/user.html.twig'),
  52. 'total' => NumberField::new('total')
  53. ->setTemplatePath('@LcCaracole/admin/order/field/total.html.twig'),
  54. 'orderStatus' => AssociationField::new('orderStatus')->setSortable(true)
  55. ->setTemplatePath('@LcCaracole/admin/order/field/order_status.html.twig')
  56. ->setCustomOption('filter_fqcn', OrderShopOrderStatusFilter::class),
  57. 'createdAt' => DateTimeField::new('createdAt')->setSortable(true),
  58. 'updatedAt' => DateTimeField::new('updatedAt')->setSortable(true),
  59. 'orderShopCreatedAt' => DateTimeField::new('orderShopCreatedAt')->setSortable(true),
  60. 'distribution' => AssociationField::new('distribution')
  61. ->setSortable(true)
  62. ->setCustomOption('filter_type', TextType::class)
  63. ->setCustomOption('filter_on', 'cycleNumber'),
  64. 'cycleDeliveryId' => IntegerField::new('cycleDeliveryId')->setSortable(true),
  65. 'cycleId' => IntegerField::new('cycleId')->setSortable(true),
  66. 'deliveryType' => Field::new('deliveryType')->setSortable(true)
  67. ->setCustomOption('filter_fqcn', OrderShopOrderDeliveryTypeFilter::class),
  68. //->setTemplatePath('@LcShop/backend/default/field/options_translatable.html.twig'),
  69. 'reference' => TextField::new('reference')->setSortable(true),
  70. 'complementaryOrderShops' => AssociationField::new('complementaryOrderShops')
  71. ->setFormTypeOption('mapped', false)
  72. ->setCustomOption('filter', false)
  73. ->setTemplatePath('@LcCaracole/admin/order/field/complementary.html.twig'),
  74. 'orderPayments' => AssociationField::new('orderPayments')
  75. ->setTemplatePath('@LcCaracole/admin/order/field/order_payment.html.twig')
  76. ->setCustomOption('filter_fqcn', OrderShopOrderPaymentFilter::class),
  77. 'user' => AssociationField::new('user')->setSortable(true)
  78. ];
  79. }
  80. }