mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 21:34:25 +00:00
Merge branch '139_demandeur' of gitlab.com:Chill-Projet/chill-bundles into 139_demandeur
This commit is contained in:
commit
5e0d869d9b
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace Chill\MainBundle\Doctrine\Event;
|
namespace Chill\MainBundle\Doctrine\Event;
|
||||||
|
|
||||||
|
use Chill\MainBundle\Entity\User;
|
||||||
use Doctrine\Common\EventSubscriber;
|
use Doctrine\Common\EventSubscriber;
|
||||||
use Doctrine\ORM\Events;
|
use Doctrine\ORM\Events;
|
||||||
use Doctrine\Persistence\Event\LifecycleEventArgs;
|
use Doctrine\Persistence\Event\LifecycleEventArgs;
|
||||||
@ -37,7 +38,8 @@ class TrackCreateUpdateSubscriber implements EventSubscriber
|
|||||||
{
|
{
|
||||||
$object = $args->getObject();
|
$object = $args->getObject();
|
||||||
|
|
||||||
if ($object instanceof TrackCreationInterface) {
|
if ($object instanceof TrackCreationInterface
|
||||||
|
&& $this->security->getUser() instanceof User) {
|
||||||
$object->setCreatedBy($this->security->getUser());
|
$object->setCreatedBy($this->security->getUser());
|
||||||
$object->setCreatedAt(new \DateTimeImmutable('now'));
|
$object->setCreatedAt(new \DateTimeImmutable('now'));
|
||||||
}
|
}
|
||||||
@ -54,7 +56,8 @@ class TrackCreateUpdateSubscriber implements EventSubscriber
|
|||||||
|
|
||||||
protected function onUpdate(object $object): void
|
protected function onUpdate(object $object): void
|
||||||
{
|
{
|
||||||
if ($object instanceof TrackUpdateInterface) {
|
if ($object instanceof TrackUpdateInterface
|
||||||
|
&& $this->security->getUser() instanceof User) {
|
||||||
$object->setUpdatedBy($this->security->getUser());
|
$object->setUpdatedBy($this->security->getUser());
|
||||||
$object->setUpdatedAt(new \DateTimeImmutable('now'));
|
$object->setUpdatedAt(new \DateTimeImmutable('now'));
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,8 @@
|
|||||||
|
|
||||||
namespace Chill\PersonBundle\Entity;
|
namespace Chill\PersonBundle\Entity;
|
||||||
|
|
||||||
|
use Chill\MainBundle\Doctrine\Model\TrackUpdateInterface;
|
||||||
|
use Chill\MainBundle\Doctrine\Model\TrackCreationInterface;
|
||||||
use Chill\MainBundle\Entity\Scope;
|
use Chill\MainBundle\Entity\Scope;
|
||||||
use Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive;
|
use Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive;
|
||||||
use Chill\PersonBundle\Entity\AccompanyingPeriod\Comment;
|
use Chill\PersonBundle\Entity\AccompanyingPeriod\Comment;
|
||||||
@ -29,6 +31,7 @@ use Chill\PersonBundle\Entity\AccompanyingPeriod\Origin;
|
|||||||
use Chill\PersonBundle\Entity\AccompanyingPeriod\Resource;
|
use Chill\PersonBundle\Entity\AccompanyingPeriod\Resource;
|
||||||
use Chill\PersonBundle\Entity\SocialWork\SocialIssue;
|
use Chill\PersonBundle\Entity\SocialWork\SocialIssue;
|
||||||
use Chill\ThirdPartyBundle\Entity\ThirdParty;
|
use Chill\ThirdPartyBundle\Entity\ThirdParty;
|
||||||
|
use DateTimeInterface;
|
||||||
use Doctrine\Common\Collections\ArrayCollection;
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
use Doctrine\Common\Collections\Collection;
|
use Doctrine\Common\Collections\Collection;
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
@ -46,7 +49,7 @@ use Symfony\Component\Serializer\Annotation\DiscriminatorMap;
|
|||||||
* "accompanying_period"=AccompanyingPeriod::class
|
* "accompanying_period"=AccompanyingPeriod::class
|
||||||
* })
|
* })
|
||||||
*/
|
*/
|
||||||
class AccompanyingPeriod
|
class AccompanyingPeriod implements TrackCreationInterface, TrackUpdateInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Mark an accompanying period as "occasional"
|
* Mark an accompanying period as "occasional"
|
||||||
@ -260,6 +263,23 @@ class AccompanyingPeriod
|
|||||||
*/
|
*/
|
||||||
private Collection $socialIssues;
|
private Collection $socialIssues;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="datetime", nullable=true, options={"default": NULL})
|
||||||
|
*/
|
||||||
|
private \DateTimeInterface $createdAt;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\ManyToOne(
|
||||||
|
* targetEntity=User::class
|
||||||
|
* )
|
||||||
|
*/
|
||||||
|
private User $updatedBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="datetime", nullable=true, options={"default": NULL})
|
||||||
|
*/
|
||||||
|
private \DateTimeInterface $updatedAt;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AccompanyingPeriod constructor.
|
* AccompanyingPeriod constructor.
|
||||||
*
|
*
|
||||||
@ -789,4 +809,25 @@ class AccompanyingPeriod
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setCreatedAt(\DateTimeInterface $datetime): self
|
||||||
|
{
|
||||||
|
$this->createdAt = $datetime;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setUpdatedBy(User $user): self
|
||||||
|
{
|
||||||
|
$this->updatedBy = $user;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setUpdatedAt(\DateTimeInterface $datetime): self
|
||||||
|
{
|
||||||
|
$this->updatedAt = $datetime;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
namespace Chill\PersonBundle\Menu;
|
namespace Chill\PersonBundle\Menu;
|
||||||
|
|
||||||
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
|
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
|
||||||
|
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||||
use Knp\Menu\MenuItem;
|
use Knp\Menu\MenuItem;
|
||||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||||
|
|
||||||
@ -32,24 +33,31 @@ class AccompanyingCourseMenuBuilder implements LocalMenuBuilderInterface
|
|||||||
|
|
||||||
public function buildMenu($menuId, MenuItem $menu, array $parameters): void
|
public function buildMenu($menuId, MenuItem $menu, array $parameters): void
|
||||||
{
|
{
|
||||||
|
$period = $parameters['accompanyingCourse'];
|
||||||
|
|
||||||
$menu->addChild($this->translator->trans('Resume Accompanying Course'), [
|
$menu->addChild($this->translator->trans('Resume Accompanying Course'), [
|
||||||
'route' => 'chill_person_accompanying_course_index',
|
'route' => 'chill_person_accompanying_course_index',
|
||||||
'routeParameters' => [
|
'routeParameters' => [
|
||||||
'accompanying_period_id' => $parameters['accompanyingCourse']->getId()
|
'accompanying_period_id' => $period->getId()
|
||||||
]])
|
]])
|
||||||
->setExtras(['order' => 10]);
|
->setExtras(['order' => 10]);
|
||||||
|
|
||||||
$menu->addChild($this->translator->trans('Edit Accompanying Course'), [
|
$menu->addChild($this->translator->trans('Edit Accompanying Course'), [
|
||||||
'route' => 'chill_person_accompanying_course_show',
|
'route' => 'chill_person_accompanying_course_show',
|
||||||
'routeParameters' => [
|
'routeParameters' => [
|
||||||
'accompanying_period_id' => $parameters['accompanyingCourse']->getId()
|
'accompanying_period_id' => $period->getId()
|
||||||
]])
|
]])
|
||||||
->setExtras(['order' => 20]);
|
->setExtras(['order' => 20]);
|
||||||
|
|
||||||
|
if (AccompanyingPeriod::STEP_DRAFT === $period->getStep()) {
|
||||||
|
// no more menu items if the period is draft
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$menu->addChild($this->translator->trans('Accompanying Course Details'), [
|
$menu->addChild($this->translator->trans('Accompanying Course Details'), [
|
||||||
'route' => 'chill_person_accompanying_course_history',
|
'route' => 'chill_person_accompanying_course_history',
|
||||||
'routeParameters' => [
|
'routeParameters' => [
|
||||||
'accompanying_period_id' => $parameters['accompanyingCourse']->getId()
|
'accompanying_period_id' => $period->getId()
|
||||||
]])
|
]])
|
||||||
->setExtras(['order' => 30]);
|
->setExtras(['order' => 30]);
|
||||||
}
|
}
|
||||||
|
@ -71,6 +71,14 @@ class SectionMenuBuilder implements LocalMenuBuilderInterface
|
|||||||
'icons' => [ 'plus' ]
|
'icons' => [ 'plus' ]
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$menu->addChild($this->translator->trans('Create an accompanying course'), [
|
||||||
|
'route' => 'chill_person_accompanying_course_new'
|
||||||
|
])
|
||||||
|
->setExtras([
|
||||||
|
'order' => 11,
|
||||||
|
'icons' => [ 'plus' ]
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -12,19 +12,17 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="grid-4">
|
<div class="grid-4">
|
||||||
<ul class="record_actions">
|
|
||||||
<li>ponctuel <i class="fa fa-toggle-on fa-fw"></i> régulier</li>
|
|
||||||
<li>ouvert</li>
|
|
||||||
<li>en file active</li>
|
|
||||||
<li>urgent</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="grid-3">
|
<div class="grid-3">
|
||||||
<p style="text-align: right;">
|
<p style="text-align: right;">
|
||||||
<i>{{ 'Started on %date%'|trans({'%date%': accompanyingCourse.openingDate|format_date('short') } ) }}</i><br>
|
{% if 'DRAFT' == accompanyingCourse.getStep() %}
|
||||||
{% if accompanyingCourse.user is not null %}
|
Brouillon
|
||||||
par <b>{{ accompanyingCourse.user.usernameCanonical }}</b>
|
{% else %}
|
||||||
|
<i>{{ 'Started on %date%'|trans({'%date%': accompanyingCourse.openingDate|format_date('short') } ) }}</i><br>
|
||||||
|
{% if accompanyingCourse.user is not null %}
|
||||||
|
par <b>{{ accompanyingCourse.user.username }}</b>
|
||||||
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
@ -6,21 +6,23 @@
|
|||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
<h1>{{ block('title') }}</h1>
|
{% if 'DRAFT' == accompanyingCourse.step %}
|
||||||
|
<div class="grid-8 centered error flash_message">
|
||||||
|
<span>
|
||||||
|
{{ 'This accompanying course is still a draft'|trans }}
|
||||||
|
<a href="{{ path('chill_person_accompanying_course_show', { 'accompanying_period_id': accompanyingCourse.id } ) }}">
|
||||||
|
{{ 'Edit & activate accompanying course'|trans }}
|
||||||
|
</a>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<pre>
|
<h1>{{ 'Associated peoples'|trans }}</h1>
|
||||||
{{ accompanyingCourse.id }}
|
|
||||||
{{ accompanyingCourse.openingDate|format_date('short') }}
|
|
||||||
{{ accompanyingCourse.closingDate|format_date('short') }}
|
|
||||||
{{ accompanyingCourse.closingMotive|chill_entity_render_box }}
|
|
||||||
{{ accompanyingCourse.remark|raw }}
|
|
||||||
{{ accompanyingCourse.user }}
|
|
||||||
usagers:
|
|
||||||
{% for p in accompanyingCourse.participations %}
|
|
||||||
{{ p.person.id }} | <a href="{{ path('chill_person_accompanying_period_list', { person_id: p.person.id }) }}">{{ p.person.fullnamecanonical }}</a> | {{ p.startdate|format_date('short') }} | {{ p.enddate|format_date('short') }}
|
|
||||||
{% endfor %}
|
|
||||||
</pre>
|
|
||||||
|
|
||||||
{{ dump() }}
|
<h1>{{ 'Resources'|trans }}</h1>
|
||||||
|
|
||||||
|
<h1>{{ 'Social actions'|trans }}</h1>
|
||||||
|
|
||||||
|
<h1>{{ 'Last events on accompanying course'|trans }}</h1>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
{% extends 'ChillPersonBundle:AccompanyingCourse:layout.html.twig' %}
|
{% extends 'ChillPersonBundle:AccompanyingCourse:layout.html.twig' %}
|
||||||
|
|
||||||
|
{% set title = 'DRAFT' == accompanyingCourse.step ? 'New accompanying course' : 'Edit accompanying course' %}
|
||||||
|
|
||||||
{% block title %}
|
{% block title %}
|
||||||
{{ 'Edit Accompanying Course'|trans }}
|
{{ title|trans }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Chill\Migrations\Person;
|
||||||
|
|
||||||
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
|
use Doctrine\Migrations\AbstractMigration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add updatedAt, updatedBy, createdAt on accompanying period
|
||||||
|
*/
|
||||||
|
final class Version20210519204938 extends AbstractMigration
|
||||||
|
{
|
||||||
|
public function getDescription(): string
|
||||||
|
{
|
||||||
|
return 'Add updatedAt, updatedBy, createdAt on accompanying period';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function up(Schema $schema): void
|
||||||
|
{
|
||||||
|
$this->addSql('ALTER TABLE chill_person_accompanying_period ADD createdAt TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL');
|
||||||
|
$this->addSql('ALTER TABLE chill_person_accompanying_period ADD updatedAt TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL');
|
||||||
|
$this->addSql('ALTER TABLE chill_person_accompanying_period ADD updatedBy_id INT DEFAULT NULL');
|
||||||
|
$this->addSql('ALTER TABLE chill_person_accompanying_period ADD CONSTRAINT FK_E260A86865FF1AEC FOREIGN KEY (updatedBy_id) REFERENCES users (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||||
|
$this->addSql('CREATE INDEX IDX_E260A86865FF1AEC ON chill_person_accompanying_period (updatedBy_id)');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema): void
|
||||||
|
{
|
||||||
|
$this->addSql('ALTER TABLE chill_person_accompanying_period DROP createdAt');
|
||||||
|
$this->addSql('ALTER TABLE chill_person_accompanying_period DROP updatedAt');
|
||||||
|
$this->addSql('ALTER TABLE chill_person_accompanying_period DROP updatedBy_id');
|
||||||
|
}
|
||||||
|
}
|
@ -153,6 +153,7 @@ Update accompanying period: Mettre à jour une période d'accompagnement
|
|||||||
Any accompanying periods are open: Aucune période d'accompagnement ouverte
|
Any accompanying periods are open: Aucune période d'accompagnement ouverte
|
||||||
An accompanying period is open: Une période d'accompagnement est ouverte
|
An accompanying period is open: Une période d'accompagnement est ouverte
|
||||||
Accompanying period list: Périodes d'accompagnement
|
Accompanying period list: Périodes d'accompagnement
|
||||||
|
New accompanying course: Nouveau parcours d'accompagnement
|
||||||
Choose a motive: Motif de fermeture
|
Choose a motive: Motif de fermeture
|
||||||
Re-open accompanying period: Ré-ouvrir
|
Re-open accompanying period: Ré-ouvrir
|
||||||
Re-Open a period: Ré-ouvrir
|
Re-Open a period: Ré-ouvrir
|
||||||
@ -162,6 +163,14 @@ Pediod closing form is not valid: Le formulaire n'est pas valide
|
|||||||
Accompanying user: Accompagnant
|
Accompanying user: Accompagnant
|
||||||
No accompanying user: Aucun accompagnant
|
No accompanying user: Aucun accompagnant
|
||||||
No data given: Pas d'information
|
No data given: Pas d'information
|
||||||
|
Create an accompanying course: Créer un parcours
|
||||||
|
This accompanying course is still a draft: Ce parcours est à l'état brouillon
|
||||||
|
Associated peoples: Usagers concernés
|
||||||
|
Resources: Interlocuteurs privilégiés
|
||||||
|
Social actions: Actions d'accompagnement
|
||||||
|
Last events on accompanying course: Dernières actions de suivi
|
||||||
|
Edit & activate accompanying course: Modifier et valider
|
||||||
|
|
||||||
# pickAPersonType
|
# pickAPersonType
|
||||||
Pick a person: Choisir une personne
|
Pick a person: Choisir une personne
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user