setEntityLabelInPlural('platform_offers') ->setSearchFields(['name']) ; } public function configureFilters(Filters $filters): Filters { return $filters ->add(UuidFilter::new('id')) ->add(EnumFilter::new('type', OfferTypeType::class)) ->add('name') ->add('active') ; } public function configureActions(Actions $actions): Actions { return $actions ->add(Crud::PAGE_INDEX, Action::DETAIL) ->add(Crud::PAGE_EDIT, Action::DETAIL) ->add(Crud::PAGE_EDIT, Action::INDEX) ; } public static function getEntityFqcn(): string { return PlatformOffer::class; } public function configureFields(string $pageName): iterable { $idFIeld = IdField::new('id') ->setLabel('id') ->hideOnForm(); $nameField = TextField::new('name'); $typeField = ChoiceField::new('type') ->setFormType(EnumType::class) ->setFormTypeOption('class', OfferType::class) ->setChoices(OfferType::getAsArray()); $priceField = MoneyField::new('price') ->setCurrencyPropertyPath('currency') ->setStoredAsCents(); $currencyField = CurrencyField::new('currency'); $activeField = BooleanField::new('active') ->setTemplatePath('easy_admin/field/boolean.html.twig') ; $createdAtField = DateTimeField::new('createdAt'); $updatedAtField = DateTimeField::new('updatedAt'); $panels = $this->getPanels(); if ($pageName === Crud::PAGE_INDEX) { return [$nameField, $typeField, $priceField, $activeField, $createdAtField, $updatedAtField]; } if ($pageName === Crud::PAGE_NEW || $pageName === Crud::PAGE_EDIT) { $typeField->setChoices(OfferType::cases()); return [ $nameField, $typeField, $priceField, $currencyField, $activeField, ]; } // show return [ $panels['information'], $nameField, $typeField, $priceField, $currencyField, $panels['tech_information'], $idFIeld, $updatedAtField, $createdAtField, ]; } }