Browse Source

indiv definition

develop
Charly 3 years ago
parent
commit
f65c78fb8e
2 changed files with 12 additions and 27 deletions
  1. +2
    -2
      Controller/IndividualData/IndividualDataAdminController.php
  2. +10
    -25
      Definition/Field/IndividualData/IndividualDataFieldDefinition.php

+ 2
- 2
Controller/IndividualData/IndividualDataAdminController.php View File

@@ -46,7 +46,7 @@ abstract class IndividualDataAdminController extends AbstractAdminController
{
return $this->getIndividualDataContainer()
->getFieldDefinition()
->getFieldList($pageName);
->getFields($pageName);
}

public function createIndexQueryBuilder(
@@ -74,7 +74,7 @@ abstract class IndividualDataAdminController extends AbstractAdminController
$export = Action::new('export', 'actions.export')
->setIcon('fa fa-download')
->linkToCrudAction('exportCsv')
->setCssClass('btn btn-primary')
->setCssClass('btn btn-primary export-csv')
->createAsGlobalAction();

return $actions->add(Crud::PAGE_INDEX, $export);

+ 10
- 25
Definition/Field/IndividualData/IndividualDataFieldDefinition.php View File

@@ -42,11 +42,6 @@ class IndividualDataFieldDefinition extends AbstractFieldDefinition
];
}

public function configurePanels(): array
{
return [];
}

public function configureFields(): array
{
$fields = array();
@@ -56,45 +51,35 @@ class IndividualDataFieldDefinition extends AbstractFieldDefinition
$fields['email'] = EmailField::new('email');
$fields['territory'] = AssociationField::new('territory')
->setTemplatePath('crud/field/association.html.twig');
$fields['nbDream'] = TextField::new('nbDream')
->onlyOnIndex();
$fields['nbRevolt'] = TextField::new('nbRevolt')
->onlyOnIndex();
$fields['nbProjectBoost'] = TextField::new('nbProjectBoost')
->onlyOnIndex();
$fields['nbProjectInspiring'] = TextField::new('nbProjectInspiring')
->onlyOnIndex();
$fields['nbDream'] = TextField::new('nbDream');
$fields['nbRevolt'] = TextField::new('nbRevolt');
$fields['nbProjectBoost'] = TextField::new('nbProjectBoost');
$fields['nbProjectInspiring'] = TextField::new('nbProjectInspiring');
$fields['revolt'] = CollectionField::new('revolt')
->setFormTypeOption('entry_type', RevoltType::class)
->setFormTypeOption('by_reference', false)
->setRequired(false)
->hideOnIndex();
->setRequired(false);
$fields['dream'] = CollectionField::new('dream')
->setFormTypeOption('entry_type', DreamType::class)
->setFormTypeOption('by_reference', false)
->setRequired(false)
->hideOnIndex();
->setRequired(false);
$fields['projectBoost'] = CollectionField::new('projectBoost')
->setFormTypeOption('entry_type', ProjectBoostType::class)
->setFormTypeOption('by_reference', false)
->setRequired(false)
->hideOnIndex();
->setRequired(false);
$fields['projectinspiring'] = CollectionField::new('projectinspiring')
->setFormTypeOption('entry_type', ProjectInspiringType::class)
->setFormTypeOption('by_reference', false)
->setRequired(false)
->hideOnIndex();
->setRequired(false);
$hasAccess = $this->authorizationChecker->isGranted('ROLE_ADMIN');
if ($hasAccess) {
$fields['status'] = StatusField::new('status')
->setFormTypeOption('data', 0)
->setFormTypeOption('choices', ['Validé' => 1, 'En attente' => 0])
->setCustomOption('toggle_label', 'Valider')
->hideOnIndex();
->setCustomOption('toggle_label', 'Valider');
} else {
$fields['status'] = HiddenField::new('status')
->setFormTypeOption('data', 0)
->hideOnIndex();
->setFormTypeOption('data', 0);
}



Loading…
Cancel
Save