diff --git a/client/src/Pages/Charts.tsx b/client/src/Pages/Charts.tsx index 41477eff..d8e9fa4c 100644 --- a/client/src/Pages/Charts.tsx +++ b/client/src/Pages/Charts.tsx @@ -21,16 +21,16 @@ const Charts = () => { let nbBeneficiariesAccountsData = {}; let nbStoredDocsData = {}; - permanencesContext.permanences.forEach((note: any) => { + permanencesContext.permanences.forEach((permanence: any) => { nbProAccountsData = { - [formatDate(note.date)]: note.nbProAccounts, + [formatDate(permanence.date)]: permanence.nbProAccounts, ...nbProAccountsData, }; nbBeneficiariesAccountsData = { - [formatDate(note.date)]: note.nbBeneficiariesAccounts, + [formatDate(permanence.date)]: permanence.nbBeneficiariesAccounts, ...nbBeneficiariesAccountsData, }; - nbStoredDocsData = {[formatDate(note.date)]: note.nbStoredDocs, ...nbStoredDocsData}; + nbStoredDocsData = {[formatDate(permanence.date)]: permanence.nbStoredDocs, ...nbStoredDocsData}; }); return ( diff --git a/client/src/Services/requests.tsx b/client/src/Services/requests.tsx index 4db96c71..ac97ee62 100644 --- a/client/src/Services/requests.tsx +++ b/client/src/Services/requests.tsx @@ -12,7 +12,7 @@ export const dropdownsEndpoint = `${apiEndpoint}/dropdowns`; export const loginEndpoint = `${backendUrl}/login`; export const googleLoginEndpoint = `${backendUrl}/google-login-trigger`; export const logoutEndpoint = `${backendUrl}/logout`; -export const permanencesEndpoint = `${apiEndpoint}/notes`; +export const permanencesEndpoint = `${apiEndpoint}/permanences`; export const tagsEndpoint = `${apiEndpoint}/tags`; export const workshopsEndpoint = `${apiEndpoint}/workshops`; diff --git a/src/Controller/Admin/AbstractSuperAdminWorkshopSectionCrudController.php b/src/Controller/Admin/AbstractSuperAdminWorkshopSectionCrudController.php new file mode 100644 index 00000000..1b6f6f14 --- /dev/null +++ b/src/Controller/Admin/AbstractSuperAdminWorkshopSectionCrudController.php @@ -0,0 +1,22 @@ +hideOnForm(), + TextField::new('name', 'name'), + ]; + } +} diff --git a/src/Controller/Admin/AgeBreakpointCrudController.php b/src/Controller/Admin/AgeBreakpointCrudController.php index ee32354c..0b695c49 100644 --- a/src/Controller/Admin/AgeBreakpointCrudController.php +++ b/src/Controller/Admin/AgeBreakpointCrudController.php @@ -3,22 +3,19 @@ namespace App\Controller\Admin; use App\Entity\AgeBreakpoint; +use EasyCorp\Bundle\EasyAdminBundle\Config\Crud; -class AgeBreakpointCrudController extends AbstractSuperAdminController +class AgeBreakpointCrudController extends AbstractSuperAdminWorkshopSectionCrudController { public static function getEntityFqcn(): string { return AgeBreakpoint::class; } - /* - public function configureFields(string $pageName): iterable + public function configureCrud(Crud $crud): Crud { - return [ - IdField::new('id'), - TextField::new('title'), - TextEditorField::new('description'), - ]; + return $crud + ->setEntityLabelInSingular('age_breakpoint') + ->setEntityLabelInPlural('age_breakpoints'); } - */ } diff --git a/src/Controller/Admin/CenterCrudController.php b/src/Controller/Admin/CenterCrudController.php index b5777007..0686e901 100644 --- a/src/Controller/Admin/CenterCrudController.php +++ b/src/Controller/Admin/CenterCrudController.php @@ -19,25 +19,26 @@ public static function getEntityFqcn(): string public function configureCrud(Crud $crud): Crud { return $crud - ->setEntityLabelInSingular('Center') - ->setEntityLabelInPlural('Center') + ->setEntityLabelInSingular('center') + ->setEntityLabelInPlural('centers') ->setSearchFields(['id', 'name']) ->setDefaultSort(['id' => 'DESC']); } public function configureFields(string $pageName): iterable { - $name = TextField::new('name'); - $place = TextField::new('place')->setRequired(false)->setEmptyData(Center::PLACE_DEFAULT_VALUE); - $notes = AssociationField::new('notes'); - $tags = AssociationField::new('tags')->setFormTypeOption('by_reference', false); + $name = TextField::new('name', 'name'); + $place = TextField::new('place', 'place')->setRequired(false)->setEmptyData(Center::PLACE_DEFAULT_VALUE); + $permanences = AssociationField::new('permanences', 'permanences_count'); + $workshops = AssociationField::new('workshops', 'workshops_count'); + $tags = AssociationField::new('tags', 'center_tags')->setFormTypeOption('by_reference', false); $id = IntegerField::new('id', 'ID'); - $workshop = BooleanField::new('workshop'); - $permanence = BooleanField::new('permanence'); - $enabled = BooleanField::new('enabled'); + $workshop = BooleanField::new('workshop', 'workshop'); + $permanence = BooleanField::new('permanence', 'permanence'); + $enabled = BooleanField::new('enabled', 'enabled'); if (Crud::PAGE_INDEX === $pageName || Crud::PAGE_DETAIL === $pageName) { - return [$id, $name, $place, $notes, $tags, $workshop, $permanence, $enabled]; + return [$id, $name, $place, $permanences, $workshops, $tags, $permanence, $workshop, $enabled]; } return [$name, $place, $tags, $workshop, $permanence, $enabled]; diff --git a/src/Controller/Admin/CenterTagCrudController.php b/src/Controller/Admin/CenterTagCrudController.php index 4cc5194d..0dfadad3 100644 --- a/src/Controller/Admin/CenterTagCrudController.php +++ b/src/Controller/Admin/CenterTagCrudController.php @@ -3,6 +3,9 @@ namespace App\Controller\Admin; use App\Entity\CenterTag; +use EasyCorp\Bundle\EasyAdminBundle\Config\Crud; +use EasyCorp\Bundle\EasyAdminBundle\Field\IntegerField; +use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; class CenterTagCrudController extends AbstractSuperAdminController { @@ -11,14 +14,21 @@ public static function getEntityFqcn(): string return CenterTag::class; } - /* + public function configureCrud(Crud $crud): Crud + { + return $crud + ->setEntityLabelInSingular('center_tag') + ->setEntityLabelInPlural('center_tags') + ->setSearchFields(['id', 'name']); + } + public function configureFields(string $pageName): iterable { return [ - IdField::new('id'), - TextField::new('title'), - TextEditorField::new('description'), + IntegerField::new('id', 'ID')->hideOnForm(), + TextField::new('name', 'name'), + TextField::new('color', 'color'), + TextField::new('category', 'category'), ]; } - */ } diff --git a/src/Controller/Admin/DashboardController.php b/src/Controller/Admin/DashboardController.php index a46129b6..d580bc15 100644 --- a/src/Controller/Admin/DashboardController.php +++ b/src/Controller/Admin/DashboardController.php @@ -50,22 +50,22 @@ public function configureMenuItems(): iterable { yield MenuItem::linkToLogout('Logout', 'fas fa-sign-out-alt text-danger')->setCssClass('text-danger'); yield MenuItem::section('Interventions'); - yield MenuItem::linkToCrud('Permanence', 'fas fa-home', Permanence::class); - yield MenuItem::linkToCrud('Workshop', 'fas fa-briefcase', Workshop::class); + yield MenuItem::linkToCrud('permanences', 'fas fa-home', Permanence::class); + yield MenuItem::linkToCrud('workshops', 'fas fa-briefcase', Workshop::class); if ($this->isGranted('ROLE_SUPER_ADMIN')) { yield MenuItem::section('Utilisateurs et Centres'); - yield MenuItem::linkToCrud('User', 'fas fa-users', User::class); - yield MenuItem::linkToCrud('Center', 'fas fa-home', Center::class); - yield MenuItem::linkToCrud('Tag', 'fas fa-tags', CenterTag::class); + yield MenuItem::linkToCrud('users', 'fas fa-users', User::class); + yield MenuItem::linkToCrud('centers', 'fas fa-home', Center::class); + yield MenuItem::linkToCrud('center_tags', 'fas fa-tags', CenterTag::class); yield MenuItem::section('Données'); - yield MenuItem::linkToCrud('Topic', 'fas fa-comment', Topic::class); - yield MenuItem::linkToCrud('Skill', 'fas fa-hand-paper', Skill::class); - yield MenuItem::linkToCrud('AgeBreakpoint', 'fas fa-birthday-cake', AgeBreakpoint::class); - yield MenuItem::linkToCrud('Duration', 'fas fa-clock', Duration::class); - yield MenuItem::linkToCrud('ParticipantKind', 'fas fa-users', ParticipantKind::class); - yield MenuItem::linkToCrud('EquipmentSupplier', 'fas fa-truck', EquipmentSupplier::class); - yield MenuItem::linkToCrud('UsedEquipment', 'fas fa-tools', UsedEquipment::class); + yield MenuItem::linkToCrud('topics', 'fas fa-comment', Topic::class); + yield MenuItem::linkToCrud('skills', 'fas fa-hand-paper', Skill::class); + yield MenuItem::linkToCrud('age_breakpoints', 'fas fa-birthday-cake', AgeBreakpoint::class); + yield MenuItem::linkToCrud('durations', 'fas fa-clock', Duration::class); + yield MenuItem::linkToCrud('participant_kinds', 'fas fa-users', ParticipantKind::class); + yield MenuItem::linkToCrud('equipment_supplier', 'fas fa-truck', EquipmentSupplier::class); + yield MenuItem::linkToCrud('used_equipments', 'fas fa-tools', UsedEquipment::class); } } } diff --git a/src/Controller/Admin/DurationCrudController.php b/src/Controller/Admin/DurationCrudController.php index 95afaafd..5792fcfd 100644 --- a/src/Controller/Admin/DurationCrudController.php +++ b/src/Controller/Admin/DurationCrudController.php @@ -3,22 +3,20 @@ namespace App\Controller\Admin; use App\Entity\Duration; +use EasyCorp\Bundle\EasyAdminBundle\Config\Crud; -class DurationCrudController extends AbstractSuperAdminController +class DurationCrudController extends AbstractSuperAdminWorkshopSectionCrudController { public static function getEntityFqcn(): string { return Duration::class; } - /* - public function configureFields(string $pageName): iterable + public function configureCrud(Crud $crud): Crud { - return [ - IdField::new('id'), - TextField::new('title'), - TextEditorField::new('description'), - ]; + return $crud + ->setEntityLabelInSingular('duration') + ->setEntityLabelInPlural('durations') + ->setSearchFields(['id', 'name']); } - */ } diff --git a/src/Controller/Admin/EquipmentSupplierCrudController.php b/src/Controller/Admin/EquipmentSupplierCrudController.php index d38de664..1003213a 100644 --- a/src/Controller/Admin/EquipmentSupplierCrudController.php +++ b/src/Controller/Admin/EquipmentSupplierCrudController.php @@ -3,22 +3,20 @@ namespace App\Controller\Admin; use App\Entity\EquipmentSupplier; +use EasyCorp\Bundle\EasyAdminBundle\Config\Crud; -class EquipmentSupplierCrudController extends AbstractSuperAdminController +class EquipmentSupplierCrudController extends AbstractSuperAdminWorkshopSectionCrudController { public static function getEntityFqcn(): string { return EquipmentSupplier::class; } - /* - public function configureFields(string $pageName): iterable + public function configureCrud(Crud $crud): Crud { - return [ - IdField::new('id'), - TextField::new('title'), - TextEditorField::new('description'), - ]; + return $crud + ->setEntityLabelInSingular('equipment_supplier') + ->setEntityLabelInPlural('equipment_supplier') + ->setSearchFields(['id', 'name']); } - */ } diff --git a/src/Controller/Admin/ParticipantKindCrudController.php b/src/Controller/Admin/ParticipantKindCrudController.php index ee9563f6..a71a28c3 100644 --- a/src/Controller/Admin/ParticipantKindCrudController.php +++ b/src/Controller/Admin/ParticipantKindCrudController.php @@ -3,22 +3,20 @@ namespace App\Controller\Admin; use App\Entity\ParticipantKind; +use EasyCorp\Bundle\EasyAdminBundle\Config\Crud; -class ParticipantKindCrudController extends AbstractSuperAdminController +class ParticipantKindCrudController extends AbstractSuperAdminWorkshopSectionCrudController { public static function getEntityFqcn(): string { return ParticipantKind::class; } - /* - public function configureFields(string $pageName): iterable + public function configureCrud(Crud $crud): Crud { - return [ - IdField::new('id'), - TextField::new('title'), - TextEditorField::new('description'), - ]; + return $crud + ->setEntityLabelInSingular('participant_kind') + ->setEntityLabelInPlural('participant_kinds') + ->setSearchFields(['id', 'name']); } - */ } diff --git a/src/Controller/Admin/PermanenceCrudController.php b/src/Controller/Admin/PermanenceCrudController.php index d94d9c7a..dd265ae5 100644 --- a/src/Controller/Admin/PermanenceCrudController.php +++ b/src/Controller/Admin/PermanenceCrudController.php @@ -15,7 +15,9 @@ use EasyCorp\Bundle\EasyAdminBundle\Field\IntegerField; use EasyCorp\Bundle\EasyAdminBundle\Field\TextareaField; use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; +use EasyCorp\Bundle\EasyAdminBundle\Filter\DateTimeFilter; use EasyCorp\Bundle\EasyAdminBundle\Filter\EntityFilter; +use EasyCorp\Bundle\EasyAdminBundle\Filter\TextFilter; use EasyCorp\Bundle\EasyAdminBundle\Provider\AdminContextProvider; use Symfony\Bridge\Doctrine\Form\Type\EntityType; @@ -63,45 +65,45 @@ public static function getEntityFqcn(): string public function configureFilters(Filters $filters): Filters { return $filters - ->add('date') - ->add('author') - ->add('attendees') - ->add('createdAt') - ->add('updatedAt') + ->add(DateTimeFilter::new('date', 'date')) + ->add(EntityFilter::new('author', 'author')) + ->add(TextFilter::new('attendees', 'attendees')) + ->add(DateTimeFilter::new('createdAt', 'created_at')) + ->add(DateTimeFilter::new('updatedAt', 'updated_at')) ->add(EntityFilter::new('center')->setFormTypeOption('value_type_options.multiple', 'true')) - ->add(AssociationFilter::new('center.tags.id')->setLabel('tags')->setFormType(EntityType::class)->setFormTypeOption('class', CenterTag::class)); + ->add(AssociationFilter::new('center.tags.id', 'tags')->setFormType(EntityType::class)->setFormTypeOption('class', CenterTag::class)); } public function configureCrud(Crud $crud): Crud { return $crud ->overrideTemplate('crud/index', 'bundles/EasyAdminBundle/Permanence/index.html.twig') - ->setEntityLabelInSingular('Permanence') - ->setEntityLabelInPlural('Permanence') + ->setEntityLabelInSingular('permanence') + ->setEntityLabelInPlural('permanences') ->setSearchFields(['id', 'hours', 'nbPros', 'nbProAccounts', 'nbBeneficiaries', 'nbBeneficiariesAccounts', 'nbStoredDocs', 'beneficiariesNotes', 'proNotes', 'reconnectNotes', 'attendees']); } public function configureFields(string $pageName): \Generator { yield IntegerField::new('id')->hideOnForm()->setColumns(3); - yield DateField::new('date')->setColumns(3); - yield IntegerField::new('hours')->setColumns(3); - yield TextField::new('place')->onlyOnForms()->setColumns(3); - yield TextField::new('attendees')->hideOnIndex()->setColumns(3); - yield AssociationField::new('author')->hideOnIndex()->setColumns(6); - yield AssociationField::new('center')->hideOnIndex()->setColumns(6); - yield IntegerField::new('nbPros')->setColumns(3); - yield IntegerField::new('nbBeneficiaries')->setColumns(3); - yield IntegerField::new('nbBeneficiariesAccounts')->setColumns(3); - yield IntegerField::new('nbUninterestedBeneficiaries', 'nbUninterestedBeneficiaries')->setColumns(3); - yield IntegerField::new('nbHelpedBeneficiaries', 'nbHelpedBeneficiaries')->setColumns(3); - yield IntegerField::new('nbStoredDocs')->setColumns(6)->hideOnIndex(); - yield IntegerField::new('maleCount')->setColumns(3)->setRequired(true)->hideOnIndex(); - yield IntegerField::new('femaleCount')->setColumns(3)->setRequired(true)->hideOnIndex(); - yield IntegerField::new('noGenderCount')->setColumns(3)->setRequired(true)->hideOnIndex(); - yield TextareaField::new('beneficiariesNotes')->hideOnIndex()->setColumns(6); - yield TextareaField::new('proNotes')->hideOnIndex()->setColumns(6); - yield DateTimeField::new('createdAt')->onlyOnDetail(); - yield DateTimeField::new('updatedAt')->onlyOnDetail(); + yield DateField::new('date', 'date')->setColumns(3); + yield IntegerField::new('hours', 'hours')->setColumns(3); + yield TextField::new('place', 'place')->onlyOnForms()->setColumns(3); + yield TextField::new('attendees', 'attendees')->hideOnIndex()->setColumns(3); + yield AssociationField::new('author', 'author')->hideOnIndex()->setColumns(6); + yield AssociationField::new('center', 'center')->hideOnIndex()->setColumns(6); + yield IntegerField::new('nbPros', 'pros_count')->setColumns(3); + yield IntegerField::new('nbBeneficiaries', 'beneficiaries_count')->setColumns(3); + yield IntegerField::new('nbBeneficiariesAccounts', 'beneficiaries_accounts_count')->setColumns(3); + yield IntegerField::new('nbUninterestedBeneficiaries', 'unintested_beneficiaries_count')->setColumns(3); + yield IntegerField::new('nbHelpedBeneficiaries', 'helped_beneficiaries_count')->setColumns(3); + yield IntegerField::new('nbStoredDocs', 'stored_docs_count')->setColumns(6)->hideOnIndex(); + yield IntegerField::new('maleCount', 'male_count')->setColumns(3)->setRequired(true); + yield IntegerField::new('femaleCount', 'female_count')->setColumns(3)->setRequired(true); + yield IntegerField::new('noGenderCount', 'no_gender_count')->setColumns(3)->setRequired(true)->hideOnIndex(); + yield TextareaField::new('beneficiariesNotes', 'beneficiaries_notes')->hideOnIndex()->setColumns(6); + yield TextareaField::new('proNotes', 'pro_notes')->hideOnIndex()->setColumns(6); + yield DateTimeField::new('createdAt', 'created_at')->onlyOnDetail(); + yield DateTimeField::new('updatedAt', 'updated_at')->onlyOnDetail(); } } diff --git a/src/Controller/Admin/SkillCrudController.php b/src/Controller/Admin/SkillCrudController.php index 79542378..361eb4aa 100644 --- a/src/Controller/Admin/SkillCrudController.php +++ b/src/Controller/Admin/SkillCrudController.php @@ -3,23 +3,28 @@ namespace App\Controller\Admin; use App\Entity\Skill; +use EasyCorp\Bundle\EasyAdminBundle\Config\Crud; use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField; -use EasyCorp\Bundle\EasyAdminBundle\Field\IdField; -use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; -class SkillCrudController extends AbstractSuperAdminController +class SkillCrudController extends AbstractSuperAdminWorkshopSectionCrudController { public static function getEntityFqcn(): string { return Skill::class; } + public function configureCrud(Crud $crud): Crud + { + return $crud + ->setEntityLabelInSingular('skill') + ->setEntityLabelInPlural('skills'); + } + public function configureFields(string $pageName): iterable { return [ - IdField::new('id')->hideOnForm(), - TextField::new('name'), - AssociationField::new('topic'), + ...parent::configureFields($pageName), + AssociationField::new('topic', 'topic'), ]; } } diff --git a/src/Controller/Admin/TopicCrudController.php b/src/Controller/Admin/TopicCrudController.php index ed448082..4711ecd6 100644 --- a/src/Controller/Admin/TopicCrudController.php +++ b/src/Controller/Admin/TopicCrudController.php @@ -3,22 +3,19 @@ namespace App\Controller\Admin; use App\Entity\Topic; +use EasyCorp\Bundle\EasyAdminBundle\Config\Crud; -class TopicCrudController extends AbstractSuperAdminController +class TopicCrudController extends AbstractSuperAdminWorkshopSectionCrudController { public static function getEntityFqcn(): string { return Topic::class; } - /* - public function configureFields(string $pageName): iterable + public function configureCrud(Crud $crud): Crud { - return [ - IdField::new('id'), - TextField::new('title'), - TextEditorField::new('description'), - ]; + return $crud + ->setEntityLabelInSingular('topic') + ->setEntityLabelInPlural('topics'); } - */ } diff --git a/src/Controller/Admin/UsedEquipmentCrudController.php b/src/Controller/Admin/UsedEquipmentCrudController.php index 56f211c7..95d41a58 100644 --- a/src/Controller/Admin/UsedEquipmentCrudController.php +++ b/src/Controller/Admin/UsedEquipmentCrudController.php @@ -3,22 +3,19 @@ namespace App\Controller\Admin; use App\Entity\UsedEquipment; +use EasyCorp\Bundle\EasyAdminBundle\Config\Crud; -class UsedEquipmentCrudController extends AbstractSuperAdminController +class UsedEquipmentCrudController extends AbstractSuperAdminWorkshopSectionCrudController { public static function getEntityFqcn(): string { return UsedEquipment::class; } - /* - public function configureFields(string $pageName): iterable + public function configureCrud(Crud $crud): Crud { - return [ - IdField::new('id'), - TextField::new('title'), - TextEditorField::new('description'), - ]; + return $crud + ->setEntityLabelInSingular('used_equipment') + ->setEntityLabelInPlural('used_equipments'); } - */ } diff --git a/src/Controller/Admin/UserCrudController.php b/src/Controller/Admin/UserCrudController.php index c42672af..22435ff3 100644 --- a/src/Controller/Admin/UserCrudController.php +++ b/src/Controller/Admin/UserCrudController.php @@ -26,8 +26,8 @@ public static function getEntityFqcn(): string public function configureCrud(Crud $crud): Crud { return $crud - ->setEntityLabelInSingular('User') - ->setEntityLabelInPlural('User') + ->setEntityLabelInSingular('user') + ->setEntityLabelInPlural('users') ->setSearchFields(['id', 'email', 'roles']); } @@ -46,9 +46,9 @@ public function updateEntity(EntityManagerInterface $entityManager, mixed $entit public function configureFields(string $pageName): \Generator { yield TextField::new('email'); - yield TextField::new('plainPassword', 'Password')->onlyOnForms(); - yield AssociationField::new('notes')->onlyOnIndex(); - yield AssociationField::new('workshops')->onlyOnIndex(); + yield TextField::new('plainPassword', 'password')->onlyOnForms(); + yield AssociationField::new('permanences', 'permanences')->onlyOnIndex(); + yield AssociationField::new('workshops', 'workshops')->onlyOnIndex(); yield IntegerField::new('id', 'ID')->onlyOnDetail(); yield BooleanField::new('disabled', 'disabled'); yield ChoiceField::new('roles') diff --git a/src/Controller/Admin/WorkshopCrudController.php b/src/Controller/Admin/WorkshopCrudController.php index 773e8859..329638c0 100644 --- a/src/Controller/Admin/WorkshopCrudController.php +++ b/src/Controller/Admin/WorkshopCrudController.php @@ -14,6 +14,8 @@ use EasyCorp\Bundle\EasyAdminBundle\Field\DateTimeField; use EasyCorp\Bundle\EasyAdminBundle\Field\IntegerField; use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; +use EasyCorp\Bundle\EasyAdminBundle\Filter\BooleanFilter; +use EasyCorp\Bundle\EasyAdminBundle\Filter\DateTimeFilter; use EasyCorp\Bundle\EasyAdminBundle\Filter\EntityFilter; use EasyCorp\Bundle\EasyAdminBundle\Provider\AdminContextProvider; use Symfony\Bridge\Doctrine\Form\Type\EntityType; @@ -68,58 +70,58 @@ public static function getEntityFqcn(): string public function configureFilters(Filters $filters): Filters { return $filters - ->add('date') - ->add('author') - ->add('participantKinds') - ->add('topics') - ->add('ageBreakpoints') - ->add('equipmentSuppliers') - ->add('usedEquipments') - ->add('usedVault') - ->add('skills') - ->add('duration') - ->add(EntityFilter::new('center')->setFormTypeOption('value_type_options.multiple', 'true')) - ->add(AssociationFilter::new('center.tags.id')->setLabel('tags')->setFormType(EntityType::class)->setFormTypeOption('class', CenterTag::class)); + ->add(DateTimeFilter::new('date', 'date')) + ->add(EntityFilter::new('author', 'author')) + ->add(EntityFilter::new('participantKinds', 'participant_kinds')) + ->add(EntityFilter::new('topics', 'topics')) + ->add(EntityFilter::new('ageBreakpoints', 'age_breakpoints')) + ->add(EntityFilter::new('equipmentSuppliers', 'equipment_supplier')) + ->add(EntityFilter::new('usedEquipments', 'used_equipments')) + ->add(BooleanFilter::new('usedVault', 'has_used_vault')) + ->add(EntityFilter::new('skills', 'skills')) + ->add(EntityFilter::new('duration', 'duration')) + ->add(EntityFilter::new('center', 'center')->setFormTypeOption('value_type_options.multiple', 'true')) + ->add(AssociationFilter::new('center.tags.id', 'tags')->setFormType(EntityType::class)->setFormTypeOption('class', CenterTag::class)); } public function configureCrud(Crud $crud): Crud { return $crud ->overrideTemplate('crud/index', 'bundles/EasyAdminBundle/Workshop/index.html.twig') - ->setEntityLabelInSingular('Workshop') - ->setEntityLabelInPlural('Workshops') + ->setEntityLabelInSingular('workshop') + ->setEntityLabelInPlural('workshops') ->setSearchFields(['id', 'date', 'attendees', 'topics.name', 'skills.name', 'participantKinds.name']); } public function configureFields(string $pageName): iterable { $id = IntegerField::new('id', 'ID'); - $date = DateField::new('date'); - $place = TextField::new('place'); - $topicPrecision = TextField::new('topicPrecision'); - $nbParticipants = IntegerField::new('nbParticipants'); - $participantKinds = AssociationField::new('participantKinds'); - $globalReport = TextField::new('globalReport'); - $author = AssociationField::new('author'); - $createdAt = DateTimeField::new('createdAt'); - $updatedAt = DateTimeField::new('updatedAt'); - $center = AssociationField::new('center'); - $topics = AssociationField::new('topics'); - $ageBreakpoints = AssociationField::new('ageBreakpoints'); - $equipmentSuppliers = AssociationField::new('equipmentSuppliers'); - $usedEquipments = AssociationField::new('usedEquipments'); - $nbBeneficiariesAccounts = IntegerField::new('nbBeneficiariesAccounts'); - $nbStoredDocs = IntegerField::new('nbStoredDocs'); - $nbCreatedEvents = IntegerField::new('nbCreatedEvents'); - $nbCreatedContacts = IntegerField::new('nbCreatedContacts'); - $nbCreatedNotes = IntegerField::new('nbCreatedNotes'); - $skills = AssociationField::new('skills'); - $attendees = TextField::new('attendees'); - $improvementAxis = TextField::new('improvementAxis'); - $duration = AssociationField::new('duration'); - $maleCount = IntegerField::new('maleCount')->setRequired(true); - $femaleCount = IntegerField::new('femaleCount')->setRequired(true); - $noGenderCount = IntegerField::new('noGenderCount')->setRequired(true); + $date = DateField::new('date', 'date'); + $place = TextField::new('place', 'place'); + $topicPrecision = TextField::new('topicPrecision', 'topic_precision'); + $nbParticipants = IntegerField::new('nbParticipants', 'attendees_count'); + $participantKinds = AssociationField::new('participantKinds', 'participant_kinds'); + $globalReport = TextField::new('globalReport', 'global_report'); + $author = AssociationField::new('author', 'author'); + $createdAt = DateTimeField::new('createdAt', 'created_at'); + $updatedAt = DateTimeField::new('updatedAt', 'updated_at'); + $center = AssociationField::new('center', 'center'); + $topics = AssociationField::new('topics', 'topic'); + $ageBreakpoints = AssociationField::new('ageBreakpoints', 'age_breakpoints'); + $equipmentSuppliers = AssociationField::new('equipmentSuppliers', 'equipment_supplier'); + $usedEquipments = AssociationField::new('usedEquipments', 'used_equipments'); + $nbBeneficiariesAccounts = IntegerField::new('nbBeneficiariesAccounts', 'beneficiaries_accounts_count'); + $nbStoredDocs = IntegerField::new('nbStoredDocs', 'stored_docs_count'); + $nbCreatedEvents = IntegerField::new('nbCreatedEvents', 'created_events_count'); + $nbCreatedContacts = IntegerField::new('nbCreatedContacts', 'created_contacts_count'); + $nbCreatedNotes = IntegerField::new('nbCreatedNotes', 'created_notes_count'); + $skills = AssociationField::new('skills', 'skills'); + $attendees = TextField::new('attendees', 'attendees'); + $improvementAxis = TextField::new('improvementAxis', 'improvement_axis'); + $duration = AssociationField::new('duration', 'duration'); + $maleCount = IntegerField::new('maleCount', 'male_count')->setRequired(true); + $femaleCount = IntegerField::new('femaleCount', 'female_count')->setRequired(true); + $noGenderCount = IntegerField::new('noGenderCount', 'no_gender_count')->setRequired(true); if (Crud::PAGE_DETAIL === $pageName) { return [ diff --git a/src/Entity/Center.php b/src/Entity/Center.php index ab88c643..9e4298b4 100644 --- a/src/Entity/Center.php +++ b/src/Entity/Center.php @@ -46,7 +46,7 @@ class Center implements \Stringable /** @var Collection */ #[Groups(['read'])] #[ORM\OneToMany(mappedBy: 'center', targetEntity: Permanence::class)] - private Collection $notes; + private Collection $permanences; #[Groups(['read'])] #[ORM\Column(type: Types::STRING, length: 255, nullable: true)] @@ -82,7 +82,7 @@ public function __toString(): string public function __construct() { - $this->notes = new ArrayCollection(); + $this->permanences = new ArrayCollection(); $this->tags = new ArrayCollection(); $this->workshops = new ArrayCollection(); } @@ -105,27 +105,27 @@ public function setName(string $name = null): void /** * @return Collection */ - public function getNotes(): Collection + public function getPermanences(): Collection { - return $this->notes; + return $this->permanences; } - /** @param Collection $notes */ - public function setNotes(Collection $notes): void + /** @param Collection $permanences */ + public function setPermanences(Collection $permanences): void { - $this->notes = $notes; + $this->permanences = $permanences; } - public function addNote(Permanence $note): self + public function addPermanence(Permanence $permanence): self { - $this->notes->add($note); + $this->permanences->add($permanence); return $this; } - public function removeNote(Permanence $note): self + public function removePermanence(Permanence $permanence): self { - $this->notes->removeElement($note); + $this->permanences->removeElement($permanence); return $this; } @@ -172,19 +172,19 @@ public function removeTag(CenterTag $tag): self #[Groups('read')] public function getBeneficiariesCount(): int { - return array_reduce($this->notes->toArray(), fn (int $acc, Permanence $note) => $acc + $note->getNbBeneficiaries(), 0); + return array_reduce($this->permanences->toArray(), fn (int $acc, Permanence $permanence) => $acc + $permanence->getNbBeneficiaries(), 0); } #[Groups('read')] public function getCreatedBeneficiaryCount(): int { - return $this->getNotesBeneficiariesCount() + $this->getWorkshopsBeneficiariesCount(); + return $this->getPermanencesBeneficiariesCount() + $this->getWorkshopsBeneficiariesCount(); } #[Groups('read')] - public function getNotesBeneficiariesCount(): int + public function getPermanencesBeneficiariesCount(): int { - return array_reduce($this->notes->toArray(), fn (int $acc, Permanence $note) => $acc + $note->getNbBeneficiariesAccounts(), 0); + return array_reduce($this->permanences->toArray(), fn (int $acc, Permanence $permanence) => $acc + $permanence->getNbBeneficiariesAccounts(), 0); } #[Groups('read')] @@ -196,7 +196,7 @@ public function getWorkshopsBeneficiariesCount(): int #[Groups('read')] public function getStoredDocumentsCount(): int { - return $this->getWorkshopsStoredDocumentsCount() + $this->getNotesStoredDocumentsCount(); + return $this->getWorkshopsStoredDocumentsCount() + $this->getPermanencesStoredDocumentsCount(); } #[Groups('read')] @@ -206,9 +206,9 @@ public function getWorkshopsStoredDocumentsCount(): int } #[Groups('read')] - public function getNotesStoredDocumentsCount(): int + public function getPermanencesStoredDocumentsCount(): int { - return array_reduce($this->notes->toArray(), fn (int $acc, Permanence $note) => $acc + $note->getNbStoredDocs(), 0); + return array_reduce($this->permanences->toArray(), fn (int $acc, Permanence $permanence) => $acc + $permanence->getNbStoredDocs(), 0); } #[Groups('read')] diff --git a/src/Entity/Permanence.php b/src/Entity/Permanence.php index f923e2d9..9cc7cde0 100644 --- a/src/Entity/Permanence.php +++ b/src/Entity/Permanence.php @@ -17,7 +17,7 @@ use Symfony\Component\Serializer\Annotation\Groups; #[ApiResource( - shortName: 'notes', + shortName: 'permanences', operations: [ new Get(), new Put(), diff --git a/src/Entity/User.php b/src/Entity/User.php index 5fe9513e..3886a7d1 100644 --- a/src/Entity/User.php +++ b/src/Entity/User.php @@ -37,7 +37,7 @@ class User implements PasswordAuthenticatedUserInterface, UserInterface, \String /** @var Collection */ #[ORM\OneToMany(mappedBy: 'author', targetEntity: Permanence::class)] - private Collection $notes; + private Collection $permanences; private ?string $plainPassword = null; @@ -62,7 +62,7 @@ public function setPlainPassword(string $plainPassword): self public function __construct() { - $this->notes = new ArrayCollection(); + $this->permanences = new ArrayCollection(); $this->workshops = new ArrayCollection(); } @@ -180,26 +180,26 @@ public function eraseCredentials(): void } /** @return Collection */ - public function getNotes(): Collection + public function getPermanences(): Collection { - return $this->notes; + return $this->permanences; } - public function setNotes(mixed $notes): void + public function setPermanences(mixed $permanences): void { - $this->notes = $notes; + $this->permanences = $permanences; } - public function addNote(Permanence $note): static + public function addPermanence(Permanence $permanence): static { - $this->notes[] = $note; + $this->permanences[] = $permanence; return $this; } - public function removeNote(Permanence $note): static + public function removePermanence(Permanence $permanence): static { - $this->notes->removeElement($note); + $this->permanences->removeElement($permanence); return $this; } diff --git a/translations/messages.fr.yaml b/translations/messages.fr.yaml index 4834227c..1741526d 100644 --- a/translations/messages.fr.yaml +++ b/translations/messages.fr.yaml @@ -1,91 +1,64 @@ -Age Breakpoints: Tranches d'âge -AgeBreakpoint: Tranches d'âge -AgeBreakpoints: Tranches d'âge -Attendees: Participants -Author: Créateur -Beneficiaries Notes: 'Bénéficiaires : bilan et axes d’amélioration' -BeneficiariesNotes: Remarques concernant les bénéficiaires -Category: Catégorie -Center: Centres -CenterTag: Label -Color: Couleur -Created At: Date de création -CreatedAt: Date de création -Date: Date -Duration: Durée -Equipment Suppliers: Equipement fourni par -EquipmentSupplier: Equipement fourni par -EquipmentSuppliers: Equipement fourni par -Enabled: Actif -Female Count: Nb femmes -Global Report: Bilan global -Hours: Heures ID: Id -Improvement Axis: Axes d'amélioration -Male Count: Nb hommes -Name: Nom -Nb Beneficiaries Accounts: Nb CFN -Nb Beneficiaries: Nb Bénef -Nb Created Contacts: Nb de contacts créés -Nb Created Events: Nb d'événements créés -Nb Created Notes: Nb de notes créées -Nb Pro Accounts: Nb Comptes Pro -Nb Pros: Nb Pros -Nb Stored Docs: Nb docs stockés -NbStoredDocs: Nombre de documents stockés -No Gender Count: Nb autres -Participant Kind: Types de participants -Participant Kinds: Types de participants -ParticipantKind: Types de participants -ParticipantKinds: Types de participants -Password: Mot de passe -Permanence: Permanence CFN -Place: Lieu -Pro Notes: 'Professionnels & Structure : bilan et axes d’amélioration' -ProNotes: Remarques concernant les bénéficiaires -Project: Projet -Reconnect Notes: Remarques concernant Reconnect -ReconnectNotes: Remarques concernant Reconnect -Skill: Compétence -Skills: Compétences -Tag: Label -Tags: Labels -Topic Precision: Précisions sur le thème -Topic: Thème -Topics: Thèmes -Updated At: Date de dernière mise à jour -UpdatedAt: Date de mise à jour -Used Equipments: Outils utilisés -UsedEquipment: Outils utilisés -UsedEquipments: Outils utilisés -UsedVault: Utilisation du CFN -User: Utilisateurs -Workshop: Accompagnement numérique -Workshops: Accompagnements numérique +age_breakpoint: Tranche d'âge +age_breakpoints: Tranches d'âges attendees: Participants +attendees_count: nbParticipants author: Créateur +beneficiaries_accounts_count: Nb CFN +beneficiaries_count: Nombre de Bénéficiaires rencontrés +beneficiaries_notes: 'Bénéficiaires : bilan et axes d’amélioration' beneficiariesNotes: 'Bénéficiaires : bilan et axes d’amélioration' +category: Categorie center: Centre -createdAt: Date de création +centers: Centres +center_tag: Label +center_tags: Labels +color: Couleur +created_at: Date de création +created_contacts_count: Nb de contacts créés +created_events_count: Nb d'événements créés +created_notes_count: Nb de notes créées date: Date +duration: Durée +durations: Durées +enabled: Actif +equipment_supplier: Equipement fourni par export: Exporter -femaleCount: Nb femmes +female_count: Nb femmes field_format_unknown: Format du champ inconnu +global_report: Bilan global +has_used_vault: Utilisation du CFN +helped_beneficiaries_count: Nb bénéf aidés sur le CFN hours: Heures id: Id -maleCount: Nb hommes -nbBeneficiaries: Nombre de bénéficiaires rencontrés +improvement_axis: Axes d'amélioration +male_count: Nb hommes +name: Nom nbBeneficiariesAccounts: Nombre de CFN -nbHelpedBeneficiaries: Nb bénéf aidés sur le CFN -nbNewParticipants: Nombre de nouveaux participants -nbProAccounts: Nombre de comptes Pro crées -nbPros: Nombre de Professionnels présents -nbStoredDocs: Nombre de documents stockés -nbUninterestedBeneficiaries: Nb benef pas intéressés -noGenderCount: Nb autres +no_gender_count: Nb autres +participant_kind: Type de participant +participant_kinds: Types de participants +password: Mot de passe +permanence: Permanence +permanences: Permanences +permanences_count: Nb Permanences place: Lieu -proNotes: 'Professionnels & Structure : bilan et axes d’amélioration' -reconnectNotes: Remarques concernant Reconnect +pro_notes: 'Professionnels & Structure : bilan et axes d’amélioration' +pros_count: Nombre de Professionnels présents +skill: Compétence +skills: Compétences +stored_docs_count: Nb docs stockés tags: Labels +topic: Thème +topic_precision: Précisions sur le thème +topics: Thèmes unfilled: Non renseigné -updatedAt: Date de mise à jour +unintested_beneficiaries_count: Nb benef pas intéressés +updated_at: Date de mise à jour +user: Utilisateur +users: Utilisateurs +used_equipment: Outil utilisé +used_equipments: Outils utilisés +workshops: Ateliers +workshops_count: Nb Ateliers +workshop: Atelier