Changed Config Variables database and other entities.

This commit is contained in:
2024-09-09 12:11:24 +02:00
parent 8c6a70b0be
commit 82bd51e6f0
7 changed files with 135 additions and 23 deletions
@@ -3,9 +3,11 @@
namespace App\Controller\Admin;
use App\Entity\ConfigVariable;
use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController;
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
use App\Enum\ConfigSectionType;
use EasyCorp\Bundle\EasyAdminBundle\Config\Crud;
use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController;
use EasyCorp\Bundle\EasyAdminBundle\Field\ChoiceField;
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
class ConfigVariableCrudController extends AbstractCrudController
{
@@ -14,11 +16,15 @@ class ConfigVariableCrudController extends AbstractCrudController
return ConfigVariable::class;
}
public function configureCrud(Crud $crud): Crud
{
return $crud;
}
public function configureFields(string $pageName): iterable
{
yield TextField::new('section');
yield TextField::new('key');
yield TextField::new('value');
yield ChoiceField::new ('section')->setChoices(ConfigSectionType::cases());
yield TextField::new ('key');
yield TextField::new ('value');
}
}
@@ -20,7 +20,8 @@ class RoomFareCrudController extends AbstractCrudController
public function configureFields(string $pageName): iterable
{
$fieldFareTable = AssociationField::new ('fareTable')->setRequired(true);
$fieldFareTable = AssociationField::new('fareTable')->setRequired(true)
->formatValue(fn ($value) => $value->getComment() . " (" . $value->getRoomCategory() . ")");
if ($pageName == Crud::PAGE_EDIT) {
$fieldFareTable->setDisabled(true);
}