-
-
Notifications
You must be signed in to change notification settings - Fork 199
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
686 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
<?php | ||
|
||
namespace Migrations; | ||
|
||
use Doctrine\DBAL\Schema\Schema; | ||
use Doctrine\Migrations\AbstractMigration; | ||
|
||
final class Version20250131092016 extends AbstractMigration | ||
{ | ||
public function up(Schema $schema): void | ||
{ | ||
$this->addSql('CREATE TABLE general_convention ( | ||
id INT UNSIGNED AUTO_INCREMENT NOT NULL, | ||
department_zone_id INT UNSIGNED DEFAULT NULL, | ||
committee_zone_id INT UNSIGNED DEFAULT NULL, | ||
district_zone_id INT UNSIGNED DEFAULT NULL, | ||
reporter_id INT UNSIGNED DEFAULT NULL, | ||
created_by_administrator_id INT DEFAULT NULL, | ||
updated_by_administrator_id INT DEFAULT NULL, | ||
organizer VARCHAR(255) NOT NULL, | ||
reported_at DATETIME NOT NULL, | ||
meeting_type VARCHAR(255) NOT NULL, | ||
members_count SMALLINT UNSIGNED DEFAULT 0 NOT NULL, | ||
participant_quality VARCHAR(255) NOT NULL, | ||
general_summary LONGTEXT DEFAULT NULL, | ||
party_definition_summary LONGTEXT DEFAULT NULL, | ||
unique_party_summary LONGTEXT DEFAULT NULL, | ||
progress_since2016 LONGTEXT DEFAULT NULL, | ||
party_objectives LONGTEXT DEFAULT NULL, | ||
governance LONGTEXT DEFAULT NULL, | ||
communication LONGTEXT DEFAULT NULL, | ||
militant_training LONGTEXT DEFAULT NULL, | ||
member_journey LONGTEXT DEFAULT NULL, | ||
mobilization LONGTEXT DEFAULT NULL, | ||
talent_detection LONGTEXT DEFAULT NULL, | ||
election_preparation LONGTEXT DEFAULT NULL, | ||
relationship_with_supporters LONGTEXT DEFAULT NULL, | ||
work_with_partners LONGTEXT DEFAULT NULL, | ||
additional_comments LONGTEXT DEFAULT NULL, | ||
uuid CHAR(36) NOT NULL COMMENT \'(DC2Type:uuid)\', | ||
created_at DATETIME NOT NULL, | ||
updated_at DATETIME NOT NULL, | ||
UNIQUE INDEX UNIQ_F66947EFD17F50A6 (uuid), | ||
INDEX IDX_F66947EF2285D748 (department_zone_id), | ||
INDEX IDX_F66947EF94819E3B (committee_zone_id), | ||
INDEX IDX_F66947EF23F5C396 (district_zone_id), | ||
INDEX IDX_F66947EFE1CFE6F5 (reporter_id), | ||
INDEX IDX_F66947EF9DF5350C (created_by_administrator_id), | ||
INDEX IDX_F66947EFCF1918FF (updated_by_administrator_id), | ||
PRIMARY KEY(id) | ||
) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); | ||
$this->addSql('ALTER TABLE | ||
general_convention | ||
ADD | ||
CONSTRAINT FK_F66947EF2285D748 FOREIGN KEY (department_zone_id) REFERENCES geo_zone (id)'); | ||
$this->addSql('ALTER TABLE | ||
general_convention | ||
ADD | ||
CONSTRAINT FK_F66947EF94819E3B FOREIGN KEY (committee_zone_id) REFERENCES geo_zone (id)'); | ||
$this->addSql('ALTER TABLE | ||
general_convention | ||
ADD | ||
CONSTRAINT FK_F66947EF23F5C396 FOREIGN KEY (district_zone_id) REFERENCES geo_zone (id)'); | ||
$this->addSql('ALTER TABLE | ||
general_convention | ||
ADD | ||
CONSTRAINT FK_F66947EFE1CFE6F5 FOREIGN KEY (reporter_id) REFERENCES adherents (id)'); | ||
$this->addSql('ALTER TABLE | ||
general_convention | ||
ADD | ||
CONSTRAINT FK_F66947EF9DF5350C FOREIGN KEY (created_by_administrator_id) REFERENCES administrators (id) ON DELETE | ||
SET | ||
NULL'); | ||
$this->addSql('ALTER TABLE | ||
general_convention | ||
ADD | ||
CONSTRAINT FK_F66947EFCF1918FF FOREIGN KEY (updated_by_administrator_id) REFERENCES administrators (id) ON DELETE | ||
SET | ||
NULL'); | ||
} | ||
|
||
public function down(Schema $schema): void | ||
{ | ||
$this->addSql('ALTER TABLE general_convention DROP FOREIGN KEY FK_F66947EF2285D748'); | ||
$this->addSql('ALTER TABLE general_convention DROP FOREIGN KEY FK_F66947EF94819E3B'); | ||
$this->addSql('ALTER TABLE general_convention DROP FOREIGN KEY FK_F66947EF23F5C396'); | ||
$this->addSql('ALTER TABLE general_convention DROP FOREIGN KEY FK_F66947EFE1CFE6F5'); | ||
$this->addSql('ALTER TABLE general_convention DROP FOREIGN KEY FK_F66947EF9DF5350C'); | ||
$this->addSql('ALTER TABLE general_convention DROP FOREIGN KEY FK_F66947EFCF1918FF'); | ||
$this->addSql('DROP TABLE general_convention'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,247 @@ | ||
<?php | ||
|
||
namespace App\Admin; | ||
|
||
use App\Entity\Adherent; | ||
use App\Entity\Geo\Zone; | ||
use App\Form\Admin\SimpleMDEContent; | ||
use App\GeneralConvention\MeetingTypeEnum; | ||
use App\GeneralConvention\OrganizerEnum; | ||
use App\GeneralConvention\ParticipantQuality; | ||
use Sonata\AdminBundle\Admin\AbstractAdmin; | ||
use Sonata\AdminBundle\Admin\AdminInterface; | ||
use Sonata\AdminBundle\Datagrid\ListMapper; | ||
use Sonata\AdminBundle\Form\FormMapper; | ||
use Sonata\AdminBundle\Form\Type\ModelAutocompleteType; | ||
use Symfony\Component\Form\Extension\Core\Type\EnumType; | ||
|
||
class GeneralConventionAdmin extends AbstractAdmin | ||
{ | ||
protected function configureFormFields(FormMapper $form): void | ||
{ | ||
$form | ||
->add('departmentZone', ModelAutocompleteType::class, [ | ||
'multiple' => false, | ||
'label' => 'Département', | ||
'required' => true, | ||
'property' => ['name', 'code'], | ||
'callback' => function (AdminInterface $admin, array $property, $value): void { | ||
$datagrid = $admin->getDatagrid(); | ||
$query = $datagrid->getQuery(); | ||
$rootAlias = $query->getRootAlias(); | ||
$query | ||
->andWhere($rootAlias.'.type = :type_department') | ||
->setParameter('type_department', Zone::DEPARTMENT) | ||
; | ||
|
||
$datagrid->setValue($property[0], null, $value); | ||
}, | ||
'btn_add' => false, | ||
]) | ||
->add('committeeZone', ModelAutocompleteType::class, [ | ||
'multiple' => false, | ||
'label' => 'Comité (zone)', | ||
'required' => false, | ||
'property' => ['name', 'code'], | ||
'callback' => function (AdminInterface $admin, array $property, $value): void { | ||
$datagrid = $admin->getDatagrid(); | ||
$query = $datagrid->getQuery(); | ||
$rootAlias = $query->getRootAlias(); | ||
$query | ||
->andWhere($rootAlias.'.type = :type_city') | ||
->setParameter('type_city', Zone::CITY) | ||
; | ||
|
||
$datagrid->setValue($property[0], null, $value); | ||
}, | ||
'btn_add' => false, | ||
]) | ||
->add('districtZone', ModelAutocompleteType::class, [ | ||
'multiple' => false, | ||
'label' => 'Circonscription', | ||
'required' => false, | ||
'property' => ['name', 'code'], | ||
'callback' => function (AdminInterface $admin, array $property, $value): void { | ||
$datagrid = $admin->getDatagrid(); | ||
$query = $datagrid->getQuery(); | ||
$rootAlias = $query->getRootAlias(); | ||
$query | ||
->andWhere($rootAlias.'.type = :type_district') | ||
->setParameter('type_district', Zone::DISTRICT) | ||
; | ||
|
||
$datagrid->setValue($property[0], null, $value); | ||
}, | ||
'btn_add' => false, | ||
]) | ||
->add('organizer', EnumType::class, [ | ||
'label' => 'Instance organisatrice', | ||
'class' => OrganizerEnum::class, | ||
'choice_label' => function (OrganizerEnum $organizer) { | ||
return 'general_convention.organizer.'.$organizer->value; | ||
}, | ||
]) | ||
->add('reporter', ModelAutocompleteType::class, [ | ||
'label' => 'Auteur de la remontée', | ||
'minimum_input_length' => 1, | ||
'items_per_page' => 20, | ||
'property' => [ | ||
'search', | ||
], | ||
'to_string_callback' => static function (Adherent $adherent): string { | ||
return \sprintf( | ||
'%s (%s) [%s]', | ||
$adherent->getFullName(), | ||
$adherent->getEmailAddress(), | ||
$adherent->getId() | ||
); | ||
}, | ||
'btn_add' => false, | ||
]) | ||
->add('reportedAt', null, [ | ||
'label' => 'Date de la remontée', | ||
]) | ||
->add('meetingType', EnumType::class, [ | ||
'label' => 'Instance organisatrice', | ||
'class' => MeetingTypeEnum::class, | ||
'choice_label' => function (MeetingTypeEnum $meetingType) { | ||
return 'general_convention.meeting_type.'.$meetingType->value; | ||
}, | ||
]) | ||
->add('membersCount', null, [ | ||
'label' => 'Nombre de participants', | ||
]) | ||
->add('participantQuality', EnumType::class, [ | ||
'label' => 'Qualité des participants', | ||
'class' => ParticipantQuality::class, | ||
'choice_label' => function (ParticipantQuality $participantQuality) { | ||
return 'general_convention.participant_quality.'.$participantQuality->value; | ||
}, | ||
]) | ||
->add('generalSummary', SimpleMDEContent::class, [ | ||
'label' => 'Synthèse générale', | ||
'required' => false, | ||
'attr' => ['rows' => 10], | ||
'help_html' => true, | ||
]) | ||
->add('partyDefinitionSummary', SimpleMDEContent::class, [ | ||
'label' => 'Synthèse des réponses concernant l\'échange sur ce qu\'est un parti politique pour les participants', | ||
'required' => false, | ||
'attr' => ['rows' => 10], | ||
'help_html' => true, | ||
]) | ||
->add('uniquePartySummary', SimpleMDEContent::class, [ | ||
'label' => 'Synthèse des échanges sur "Renaissance, un parti pas comme les autres"', | ||
'required' => false, | ||
'attr' => ['rows' => 10], | ||
'help_html' => true, | ||
]) | ||
->add('progressSince2016', SimpleMDEContent::class, [ | ||
'label' => 'Synthèse des échanges sur le chemin parcouru depuis 2016', | ||
'required' => false, | ||
'attr' => ['rows' => 10], | ||
'help_html' => true, | ||
]) | ||
->add('partyObjectives', SimpleMDEContent::class, [ | ||
'label' => 'Synthèse des échanges sur les objectifs de Renaissance', | ||
'required' => false, | ||
'attr' => ['rows' => 10], | ||
'help_html' => true, | ||
]) | ||
->add('governance', SimpleMDEContent::class, [ | ||
'label' => 'Notre gouvernance', | ||
'required' => false, | ||
'attr' => ['rows' => 10], | ||
'help_html' => true, | ||
]) | ||
->add('communication', SimpleMDEContent::class, [ | ||
'label' => 'Notre communication', | ||
'required' => false, | ||
'attr' => ['rows' => 10], | ||
'help_html' => true, | ||
]) | ||
->add('militantTraining', SimpleMDEContent::class, [ | ||
'label' => 'La formation militante', | ||
'required' => false, | ||
'attr' => ['rows' => 10], | ||
'help_html' => true, | ||
]) | ||
->add('memberJourney', SimpleMDEContent::class, [ | ||
'label' => 'Le parcours adhérent', | ||
'required' => false, | ||
'attr' => ['rows' => 10], | ||
'help_html' => true, | ||
]) | ||
->add('mobilization', SimpleMDEContent::class, [ | ||
'label' => 'La mobilisation', | ||
'required' => false, | ||
'attr' => ['rows' => 10], | ||
'help_html' => true, | ||
]) | ||
->add('talentDetection', SimpleMDEContent::class, [ | ||
'label' => 'Détecter les talents', | ||
'required' => false, | ||
'attr' => ['rows' => 10], | ||
'help_html' => true, | ||
]) | ||
->add('electionPreparation', SimpleMDEContent::class, [ | ||
'label' => 'Préparer les élections', | ||
'required' => false, | ||
'attr' => ['rows' => 10], | ||
'help_html' => true, | ||
]) | ||
->add('relationshipWithSupporters', SimpleMDEContent::class, [ | ||
'label' => 'Notre relation aux sympathisants, aux corps intermédiaires, à la société civile', | ||
'required' => false, | ||
'attr' => ['rows' => 10], | ||
'help_html' => true, | ||
]) | ||
->add('workWithPartners', SimpleMDEContent::class, [ | ||
'label' => 'Notre travail avec les partenaires', | ||
'required' => false, | ||
'attr' => ['rows' => 10], | ||
'help_html' => true, | ||
]) | ||
->add('additionalComments', SimpleMDEContent::class, [ | ||
'label' => 'Souhaitez-vous ajouter quelque chose ?', | ||
'required' => false, | ||
'attr' => ['rows' => 10], | ||
'help' => 'help.markdown', | ||
'help_html' => true, | ||
]) | ||
; | ||
} | ||
|
||
protected function configureListFields(ListMapper $list): void | ||
{ | ||
$list | ||
->add('departmentZone', null, [ | ||
'label' => 'Département', | ||
]) | ||
->add('organizer', null, [ | ||
'label' => 'Instance organisatrice', | ||
'template' => 'admin/general_convention/list_organizer.html.twig', | ||
]) | ||
->add('district_or_committee', null, [ | ||
'label' => 'Circonscription ou Comité organisateur', | ||
'virtual_field' => true, | ||
'template' => 'admin/general_convention/list_district_or_committee.html.twig', | ||
]) | ||
->add('reportedAt', null, [ | ||
'label' => 'Date', | ||
]) | ||
->add('membersCount', null, [ | ||
'label' => 'Participants', | ||
]) | ||
->add('reporter', null, [ | ||
'label' => 'Auteur', | ||
]) | ||
->add(ListMapper::NAME_ACTIONS, null, [ | ||
'virtual_field' => true, | ||
'actions' => [ | ||
'edit' => [], | ||
], | ||
]) | ||
; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.