Add private comment to rendez-vous

This commit is contained in:
Julie Lenaerts 2022-04-25 15:47:51 +02:00
parent 79fa030323
commit 171cc79a4a
6 changed files with 68 additions and 1 deletions

View File

@ -70,6 +70,12 @@ class Calendar
*/ */
private CommentEmbeddable $comment; private CommentEmbeddable $comment;
/**
* @ORM\Embedded(class=CommentEmbeddable::class, columnPrefix="prcomment_")
* @Serializer\Groups({"calendar:read"})
*/
private CommentEmbeddable $privateComment;
/** /**
* @ORM\Column(type="datetimetz_immutable") * @ORM\Column(type="datetimetz_immutable")
* @Serializer\Groups({"calendar:read"}) * @Serializer\Groups({"calendar:read"})
@ -151,6 +157,7 @@ class Calendar
public function __construct() public function __construct()
{ {
$this->comment = new CommentEmbeddable(); $this->comment = new CommentEmbeddable();
$this->privateComment = new CommentEmbeddable();
$this->persons = new ArrayCollection(); $this->persons = new ArrayCollection();
$this->professionals = new ArrayCollection(); $this->professionals = new ArrayCollection();
$this->invites = new ArrayCollection(); $this->invites = new ArrayCollection();
@ -208,6 +215,11 @@ class Calendar
return $this->comment; return $this->comment;
} }
public function getPrivateComment(): CommentEmbeddable
{
return $this->privateComment;
}
public function getEndDate(): ?DateTimeImmutable public function getEndDate(): ?DateTimeImmutable
{ {
return $this->endDate; return $this->endDate;
@ -386,6 +398,13 @@ class Calendar
return $this; return $this;
} }
public function setPrivateComment(CommentEmbeddable $privateComment): self
{
$this->privateComment = $privateComment;
return $this;
}
public function setEndDate(DateTimeImmutable $endDate): self public function setEndDate(DateTimeImmutable $endDate): self
{ {
$this->endDate = $endDate; $this->endDate = $endDate;

View File

@ -18,6 +18,7 @@ use Chill\CalendarBundle\Entity\Invite;
use Chill\MainBundle\Entity\Location; use Chill\MainBundle\Entity\Location;
use Chill\MainBundle\Entity\User; use Chill\MainBundle\Entity\User;
use Chill\MainBundle\Form\Type\CommentType; use Chill\MainBundle\Form\Type\CommentType;
use Chill\MainBundle\Form\Type\PrivateCommentType;
use Chill\MainBundle\Templating\TranslatableStringHelper; use Chill\MainBundle\Templating\TranslatableStringHelper;
use Chill\PersonBundle\Entity\Person; use Chill\PersonBundle\Entity\Person;
use Chill\ThirdPartyBundle\Entity\ThirdParty; use Chill\ThirdPartyBundle\Entity\ThirdParty;
@ -51,6 +52,10 @@ class CalendarType extends AbstractType
->add('comment', CommentType::class, [ ->add('comment', CommentType::class, [
'required' => false, 'required' => false,
]) ])
->add('privateComment', PrivateCommentType::class, [
'required' => false,
'label' => 'private comment'
])
// ->add('cancelReason', EntityType::class, [ // ->add('cancelReason', EntityType::class, [
// 'required' => false, // 'required' => false,
// 'class' => CancelReason::class, // 'class' => CancelReason::class,

View File

@ -47,6 +47,10 @@
{{ form_row(form.comment) }} {{ form_row(form.comment) }}
{% endif %} {% endif %}
{%- if form.privateComment is defined -%}
{{ form_row(form.privateComment) }}
{% endif %}
{%- if form.sendSMS is defined -%} {%- if form.sendSMS is defined -%}
{{ form_row(form.sendSMS) }} {{ form_row(form.sendSMS) }}
{% endif %} {% endif %}

View File

@ -43,6 +43,10 @@
{{ form_row(form.comment) }} {{ form_row(form.comment) }}
{% endif %} {% endif %}
{%- if form.privateComment is defined -%}
{{ form_row(form.privateComment) }}
{% endif %}
{%- if form.sendSMS is defined -%} {%- if form.sendSMS is defined -%}
{{ form_row(form.sendSMS) }} {{ form_row(form.sendSMS) }}
{% endif %} {% endif %}

View File

@ -0,0 +1,34 @@
<?php
declare(strict_types=1);
namespace Chill\Migrations\Calendar;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20220425131140 extends AbstractMigration
{
public function getDescription(): string
{
return 'Add private comment to calendar';
}
public function up(Schema $schema): void
{
$this->addSql('ALTER TABLE chill_calendar.calendar ADD prcomment_comment TEXT DEFAULT NULL');
$this->addSql('ALTER TABLE chill_calendar.calendar ADD prcomment_date TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL');
$this->addSql('ALTER TABLE chill_calendar.calendar ADD prcomment_userId INT DEFAULT NULL');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE chill_calendar.calendar DROP prcomment_comment');
$this->addSql('ALTER TABLE chill_calendar.calendar DROP prcomment_date');
$this->addSql('ALTER TABLE chill_calendar.calendar DROP prcomment_userId');
}
}

View File

@ -25,4 +25,5 @@ Add a new calendar: Ajouter un nouveau rendez-vous
The calendar item has been successfully removed.: Le rendez-vous a été supprimé The calendar item has been successfully removed.: Le rendez-vous a été supprimé
From the day: Du From the day: Du
to the day: au to the day: au
Transform to activity: Transformer en échange Transform to activity: Transformer en échange
private comment: Commentaire privé