mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-07-02 23:16:13 +00:00
main: add civility to User
This commit is contained in:
parent
9dd463882c
commit
380c55698c
@ -11,6 +11,8 @@ and this project adheres to
|
|||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
<!-- write down unreleased development here -->
|
<!-- write down unreleased development here -->
|
||||||
|
* [main] add civility to User (entity, migration and form type) (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/577)
|
||||||
|
|
||||||
* [admin] refactorisation of the admin section: reorganisation of the menu, translations, form types, new entities (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/592)
|
* [admin] refactorisation of the admin section: reorganisation of the menu, translations, form types, new entities (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/592)
|
||||||
* [admin] add admin section for languages and countries (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/596)
|
* [admin] add admin section for languages and countries (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/596)
|
||||||
* [activity] activity admin: translations + remove label field for comment on admin activity type (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/587)
|
* [activity] activity admin: translations + remove label field for comment on admin activity type (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/587)
|
||||||
|
@ -47,6 +47,11 @@ class User implements AdvancedUserInterface
|
|||||||
*/
|
*/
|
||||||
private array $attributes = [];
|
private array $attributes = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\ManyToOne(targetEntity=Civility::class)
|
||||||
|
*/
|
||||||
|
private ?Civility $civility = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\ManyToOne(targetEntity=Location::class)
|
* @ORM\ManyToOne(targetEntity=Location::class)
|
||||||
*/
|
*/
|
||||||
@ -184,6 +189,11 @@ class User implements AdvancedUserInterface
|
|||||||
return $this->attributes;
|
return $this->attributes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getCivility(): ?Civility
|
||||||
|
{
|
||||||
|
return $this->civility;
|
||||||
|
}
|
||||||
|
|
||||||
public function getCurrentLocation(): ?Location
|
public function getCurrentLocation(): ?Location
|
||||||
{
|
{
|
||||||
return $this->currentLocation;
|
return $this->currentLocation;
|
||||||
@ -363,6 +373,13 @@ class User implements AdvancedUserInterface
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setCivility(?Civility $civility): User
|
||||||
|
{
|
||||||
|
$this->civility = $civility;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
public function setCurrentLocation(?Location $currentLocation): User
|
public function setCurrentLocation(?Location $currentLocation): User
|
||||||
{
|
{
|
||||||
$this->currentLocation = $currentLocation;
|
$this->currentLocation = $currentLocation;
|
||||||
|
@ -15,6 +15,7 @@ use Chill\MainBundle\Entity\Center;
|
|||||||
use Chill\MainBundle\Entity\Location;
|
use Chill\MainBundle\Entity\Location;
|
||||||
use Chill\MainBundle\Entity\Scope;
|
use Chill\MainBundle\Entity\Scope;
|
||||||
use Chill\MainBundle\Entity\UserJob;
|
use Chill\MainBundle\Entity\UserJob;
|
||||||
|
use Chill\MainBundle\Form\Type\PickCivilityType;
|
||||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||||
use Doctrine\ORM\EntityRepository;
|
use Doctrine\ORM\EntityRepository;
|
||||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||||
@ -47,6 +48,11 @@ class UserType extends AbstractType
|
|||||||
'required' => true,
|
'required' => true,
|
||||||
])
|
])
|
||||||
->add('label', TextType::class)
|
->add('label', TextType::class)
|
||||||
|
->add('civility', PickCivilityType::class, [
|
||||||
|
'required' => false,
|
||||||
|
'label' => 'Civility',
|
||||||
|
'placeholder' => 'choose civility',
|
||||||
|
])
|
||||||
->add('mainCenter', EntityType::class, [
|
->add('mainCenter', EntityType::class, [
|
||||||
'label' => 'Main center',
|
'label' => 'Main center',
|
||||||
'required' => false,
|
'required' => false,
|
||||||
|
@ -11,6 +11,11 @@
|
|||||||
<div class="item-bloc">
|
<div class="item-bloc">
|
||||||
<div class="item-row">
|
<div class="item-row">
|
||||||
<div class="item-col">
|
<div class="item-col">
|
||||||
|
{% if entity.civility is not null %}
|
||||||
|
{% if entity.civility.name|length > 0 %}
|
||||||
|
{{ entity.civility.name|first }}
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
{{ entity.label }}
|
{{ entity.label }}
|
||||||
{% if entity.isEnabled %}
|
{% if entity.isEnabled %}
|
||||||
<i class="fa fa-check chill-green"></i>
|
<i class="fa fa-check chill-green"></i>
|
||||||
|
@ -1,5 +1,12 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Chill is a software for social workers
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view
|
||||||
|
* the LICENSE file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Chill\Migrations\Main;
|
namespace Chill\Migrations\Main;
|
||||||
@ -9,6 +16,10 @@ use Doctrine\Migrations\AbstractMigration;
|
|||||||
|
|
||||||
final class Version20220513151853 extends AbstractMigration
|
final class Version20220513151853 extends AbstractMigration
|
||||||
{
|
{
|
||||||
|
public function down(Schema $schema): void
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
public function getDescription(): string
|
public function getDescription(): string
|
||||||
{
|
{
|
||||||
return 'set default on attributes';
|
return 'set default on attributes';
|
||||||
@ -18,9 +29,4 @@ final class Version20220513151853 extends AbstractMigration
|
|||||||
{
|
{
|
||||||
$this->addSql('update users set attributes = \'[]\'::json where attributes IS NULL');
|
$this->addSql('update users set attributes = \'[]\'::json where attributes IS NULL');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function down(Schema $schema): void
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,40 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Chill is a software for social workers
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view
|
||||||
|
* the LICENSE file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Chill\Migrations\Main;
|
||||||
|
|
||||||
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
|
use Doctrine\Migrations\AbstractMigration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add civility to User.
|
||||||
|
*/
|
||||||
|
final class Version20220516085659 extends AbstractMigration
|
||||||
|
{
|
||||||
|
public function down(Schema $schema): void
|
||||||
|
{
|
||||||
|
$this->addSql('ALTER TABLE users DROP CONSTRAINT FK_1483A5E923D6A298');
|
||||||
|
$this->addSql('DROP INDEX IDX_1483A5E923D6A298');
|
||||||
|
$this->addSql('ALTER TABLE users DROP civility_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDescription(): string
|
||||||
|
{
|
||||||
|
return 'Add civility to User';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function up(Schema $schema): void
|
||||||
|
{
|
||||||
|
$this->addSql('ALTER TABLE users ADD civility_id INT DEFAULT NULL');
|
||||||
|
$this->addSql('ALTER TABLE users ADD CONSTRAINT FK_1483A5E923D6A298 FOREIGN KEY (civility_id) REFERENCES chill_main_civility (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||||
|
$this->addSql('CREATE INDEX IDX_1483A5E923D6A298 ON users (civility_id)');
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user