SuperSeller3000/src/Infrastructure/Http/Controller/Admin/InvoiceCrudController.php
Simon Kuehn 0c278aefbf chore: hide UUID id column from all index/list views
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-18 09:04:39 +00:00

51 lines
1.9 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Infrastructure\Http\Controller\Admin;
use App\Domain\Order\Invoice;
use EasyCorp\Bundle\EasyAdminBundle\Config\Action;
use EasyCorp\Bundle\EasyAdminBundle\Config\Actions;
use EasyCorp\Bundle\EasyAdminBundle\Config\Crud;
use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController;
use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField;
use EasyCorp\Bundle\EasyAdminBundle\Field\DateTimeField;
use EasyCorp\Bundle\EasyAdminBundle\Field\IdField;
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
use Symfony\Component\Translation\TranslatableMessage;
/** @extends AbstractCrudController<Invoice> */
final class InvoiceCrudController extends AbstractCrudController
{
public static function getEntityFqcn(): string
{
return Invoice::class;
}
public function configureCrud(Crud $crud): Crud
{
return $crud
->setEntityLabelInSingular(new TranslatableMessage('crud.invoice.singular', [], 'admin'))
->setEntityLabelInPlural(new TranslatableMessage('crud.invoice.plural', [], 'admin'))
->setDefaultSort(['createdAt' => 'DESC'])
->showEntityActionsInlined();
}
public function configureActions(Actions $actions): Actions
{
return $actions
->disable(Action::NEW, Action::EDIT, Action::DELETE)
->add(Crud::PAGE_INDEX, Action::DETAIL);
}
public function configureFields(string $pageName): iterable
{
yield IdField::new('id')->hideOnForm()->hideOnIndex();
yield TextField::new('frappeInvoiceId', 'Frappe-Rechnungsnr.');
yield AssociationField::new('order', 'Bestellung');
yield DateTimeField::new('createdAt', 'Erstellt am');
yield DateTimeField::new('emailedAt', 'Per E-Mail versendet');
yield TextField::new('filename', 'PDF-Datei')->onlyOnDetail();
}
}