diff --git a/src/Bundle/ChillCalendarBundle/Entity/Calendar.php b/src/Bundle/ChillCalendarBundle/Entity/Calendar.php index 11104cc6a..bf425bd2d 100644 --- a/src/Bundle/ChillCalendarBundle/Entity/Calendar.php +++ b/src/Bundle/ChillCalendarBundle/Entity/Calendar.php @@ -70,6 +70,12 @@ class Calendar */ private CommentEmbeddable $comment; + /** + * @ORM\Embedded(class=CommentEmbeddable::class, columnPrefix="prcomment_") + * @Serializer\Groups({"calendar:read"}) + */ + private CommentEmbeddable $privateComment; + /** * @ORM\Column(type="datetimetz_immutable") * @Serializer\Groups({"calendar:read"}) @@ -151,6 +157,7 @@ class Calendar public function __construct() { $this->comment = new CommentEmbeddable(); + $this->privateComment = new CommentEmbeddable(); $this->persons = new ArrayCollection(); $this->professionals = new ArrayCollection(); $this->invites = new ArrayCollection(); @@ -208,6 +215,11 @@ class Calendar return $this->comment; } + public function getPrivateComment(): CommentEmbeddable + { + return $this->privateComment; + } + public function getEndDate(): ?DateTimeImmutable { return $this->endDate; @@ -386,6 +398,13 @@ class Calendar return $this; } + public function setPrivateComment(CommentEmbeddable $privateComment): self + { + $this->privateComment = $privateComment; + + return $this; + } + public function setEndDate(DateTimeImmutable $endDate): self { $this->endDate = $endDate; diff --git a/src/Bundle/ChillCalendarBundle/Form/CalendarType.php b/src/Bundle/ChillCalendarBundle/Form/CalendarType.php index 05dc362b4..7269b2a66 100644 --- a/src/Bundle/ChillCalendarBundle/Form/CalendarType.php +++ b/src/Bundle/ChillCalendarBundle/Form/CalendarType.php @@ -18,6 +18,7 @@ use Chill\CalendarBundle\Entity\Invite; use Chill\MainBundle\Entity\Location; use Chill\MainBundle\Entity\User; use Chill\MainBundle\Form\Type\CommentType; +use Chill\MainBundle\Form\Type\PrivateCommentType; use Chill\MainBundle\Templating\TranslatableStringHelper; use Chill\PersonBundle\Entity\Person; use Chill\ThirdPartyBundle\Entity\ThirdParty; @@ -51,6 +52,10 @@ class CalendarType extends AbstractType ->add('comment', CommentType::class, [ 'required' => false, ]) + ->add('privateComment', PrivateCommentType::class, [ + 'required' => false, + 'label' => 'private comment' + ]) // ->add('cancelReason', EntityType::class, [ // 'required' => false, // 'class' => CancelReason::class, diff --git a/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/edit.html.twig b/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/edit.html.twig index d67202920..b96d12c06 100644 --- a/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/edit.html.twig +++ b/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/edit.html.twig @@ -47,6 +47,10 @@ {{ form_row(form.comment) }} {% endif %} +{%- if form.privateComment is defined -%} + {{ form_row(form.privateComment) }} +{% endif %} + {%- if form.sendSMS is defined -%} {{ form_row(form.sendSMS) }} {% endif %} diff --git a/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/new.html.twig b/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/new.html.twig index 255c2641b..7841f5b46 100644 --- a/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/new.html.twig +++ b/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/new.html.twig @@ -43,6 +43,10 @@ {{ form_row(form.comment) }} {% endif %} +{%- if form.privateComment is defined -%} + {{ form_row(form.privateComment) }} +{% endif %} + {%- if form.sendSMS is defined -%} {{ form_row(form.sendSMS) }} {% endif %} diff --git a/src/Bundle/ChillCalendarBundle/migrations/Version20220425131140.php b/src/Bundle/ChillCalendarBundle/migrations/Version20220425131140.php new file mode 100644 index 000000000..5910ca236 --- /dev/null +++ b/src/Bundle/ChillCalendarBundle/migrations/Version20220425131140.php @@ -0,0 +1,34 @@ +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'); + } +} diff --git a/src/Bundle/ChillCalendarBundle/translations/messages.fr.yml b/src/Bundle/ChillCalendarBundle/translations/messages.fr.yml index 56ac8543c..1dbb00bb8 100644 --- a/src/Bundle/ChillCalendarBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillCalendarBundle/translations/messages.fr.yml @@ -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é From the day: Du to the day: au -Transform to activity: Transformer en échange \ No newline at end of file +Transform to activity: Transformer en échange +private comment: Commentaire privé \ No newline at end of file