Skip to content

Commit

Permalink
Merge pull request #205 from re-connect/feature/rename-permanences
Browse files Browse the repository at this point in the history
ETQA, je vois une colonne qui est renommée "permanences" au lieu de "notes" & une colonne "ateliers" au lieu d'"accompagnement numérique"
  • Loading branch information
AntoineAresu authored Mar 19, 2024
2 parents 2304fdc + 122be34 commit 685264f
Show file tree
Hide file tree
Showing 20 changed files with 270 additions and 270 deletions.
8 changes: 4 additions & 4 deletions client/src/Pages/Charts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
2 changes: 1 addition & 1 deletion client/src/Services/requests.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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`;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

namespace App\Controller\Admin;

use EasyCorp\Bundle\EasyAdminBundle\Field\IntegerField;
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;

class AbstractSuperAdminWorkshopSectionCrudController extends AbstractSuperAdminController
{
public static function getEntityFqcn(): string
{
return '';
}

public function configureFields(string $pageName): iterable
{
return [
IntegerField::new('id', 'ID')->hideOnForm(),
TextField::new('name', 'name'),
];
}
}
15 changes: 6 additions & 9 deletions src/Controller/Admin/AgeBreakpointCrudController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
*/
}
21 changes: 11 additions & 10 deletions src/Controller/Admin/CenterCrudController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
20 changes: 15 additions & 5 deletions src/Controller/Admin/CenterTagCrudController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -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'),
];
}
*/
}
24 changes: 12 additions & 12 deletions src/Controller/Admin/DashboardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
16 changes: 7 additions & 9 deletions src/Controller/Admin/DurationCrudController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
}
*/
}
16 changes: 7 additions & 9 deletions src/Controller/Admin/EquipmentSupplierCrudController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
}
*/
}
16 changes: 7 additions & 9 deletions src/Controller/Admin/ParticipantKindCrudController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
}
*/
}
56 changes: 29 additions & 27 deletions src/Controller/Admin/PermanenceCrudController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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();
}
}
17 changes: 11 additions & 6 deletions src/Controller/Admin/SkillCrudController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
];
}
}
Loading

0 comments on commit 685264f

Please sign in to comment.