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.

81 lines
3.6KB

  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\Repository\Section\SectionStore;
  13. use Lc\SovBundle\Translation\TranslatorAdmin;
  14. use Symfony\Component\Form\Extension\Core\Type\TextType;
  15. class OrderShopFieldDefinition extends AbstractFieldDefinition
  16. {
  17. use MerchantContextTrait;
  18. protected SectionStore $sectionStore;
  19. public function __construct(TranslatorAdmin $translatorAdmin, SectionStore $sectionStore)
  20. {
  21. parent::__construct($translatorAdmin);
  22. $this->sectionStore = $sectionStore;
  23. }
  24. public function configureFieldsIndex(): array
  25. {
  26. return ['id'];
  27. }
  28. public function configurePanels(): array
  29. {
  30. return [];
  31. }
  32. public function configureFields(): array
  33. {
  34. return [
  35. 'id' => IntegerField::new('id', 'ID')->setSortable(true),
  36. 'userLastname' => TextareaField::new('user.lastname')->setSortable(true),
  37. //->setTemplatePath('@LcShop/backend/default/field/textorempty.html.twig'),
  38. 'userFirstname' => TextareaField::new('user.firstname')->setSortable(true),
  39. //->setTemplatePath('@LcShop/backend/default/field/textorempty.html.twig'),
  40. 'userEmail' => TextareaField::new('user.email')->setSortable(true),
  41. //->setTemplatePath('@LcShop/backend/default/field/user.html.twig'),
  42. 'total' => NumberField::new('total')
  43. ->setTemplatePath('@LcCaracole/admin/order/field/total.html.twig'),
  44. 'orderStatus' => AssociationField::new('orderStatus')->setSortable(true)
  45. ->setTemplatePath('@LcCaracole/admin/order/field/order_status.html.twig'),
  46. 'createdAt' => DateTimeField::new('createdAt')->setSortable(true),
  47. 'updatedAt' => DateTimeField::new('updatedAt')->setSortable(true),
  48. 'orderShopCreatedAt' => DateTimeField::new('orderShopCreatedAt')->setSortable(true),
  49. 'distribution' => AssociationField::new('distribution')
  50. ->setSortable(true)
  51. ->setCustomOption('filter_type', TextType::class)
  52. ->setCustomOption('filter_on', 'cycleNumber')
  53. ,
  54. 'cycleDeliveryId' => IntegerField::new('cycleDeliveryId')->setSortable(true),
  55. 'cycleId' => IntegerField::new('cycleId')->setSortable(true),
  56. 'deliveryType' => Field::new('deliveryType')->setSortable(true),
  57. //->setTemplatePath('@LcShop/backend/default/field/options_translatable.html.twig'),
  58. 'reference' => TextField::new('reference')->setSortable(true),
  59. 'complementaryOrderShops' => AssociationField::new('complementaryOrderShops')
  60. ->setFormTypeOption('mapped', false)
  61. ->setTemplatePath('@LcCaracole/admin/order/field/complementary.html.twig')
  62. ->setCustomOption('filter', false)
  63. ,
  64. 'orderPayments' => AssociationField::new('orderPayments')
  65. ->setTemplatePath('@LcCaracole/admin/order/field/order_payment.html.twig')
  66. ->setCustomOption('filter', false),
  67. 'user'=> AssociationField::new('user')->setSortable(true)
  68. ];
  69. }
  70. }