diff --git a/src/Bundle/ChillActivityBundle/Resources/views/Activity/show.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/Activity/show.html.twig
index 633493104..b67ff08ef 100644
--- a/src/Bundle/ChillActivityBundle/Resources/views/Activity/show.html.twig
+++ b/src/Bundle/ChillActivityBundle/Resources/views/Activity/show.html.twig
@@ -85,7 +85,7 @@
{% include 'ChillActivityBundle:Activity:concernedGroups.html.twig' with {
'context': context,
- 'with_display': 'bloc',
+ 'render': 'bloc',
'badge_person': 'true'
} %}
diff --git a/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/listByAccompanyingCourse.html.twig b/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/listByAccompanyingCourse.html.twig
index 215b7bb55..6cf97a58d 100644
--- a/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/listByAccompanyingCourse.html.twig
+++ b/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/listByAccompanyingCourse.html.twig
@@ -94,7 +94,7 @@
{% include 'ChillActivityBundle:Activity:concernedGroups.html.twig' with {
'context': accompanyingCourse,
- 'with_display': 'row',
+ 'render': 'row',
'entity': calendar
} %}
diff --git a/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/show.html.twig b/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/show.html.twig
index 7c59996d2..3a1bf03d5 100644
--- a/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/show.html.twig
+++ b/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/show.html.twig
@@ -6,7 +6,7 @@
{{ 'Concerned groups'|trans }}
-{% include 'ChillActivityBundle:Activity:concernedGroups.html.twig' with {'context': context, 'with_display': 'bloc' } %}
+{% include 'ChillActivityBundle:Activity:concernedGroups.html.twig' with {'context': context, 'render': 'bloc' } %}
{{ 'Calendar data'|trans }}
@@ -108,13 +108,13 @@
{# TODO
{% if is_granted('CHILL_ACTIVITY_DELETE', entity) %}
#}
-
+
{{ 'Delete'|trans }}
-
+
{#
{% endif %}
#}
diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress.vue
index 76979b7aa..1f62269de 100644
--- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress.vue
+++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress.vue
@@ -365,8 +365,8 @@ export default {
//console.log('validFrom', this.validFrom);
//console.log('validTo', this.validTo);
//console.log('useDatePane', this.useDatePane);
+ //console.log('Mounted now !');
- console.log('Mounted now !');
if (this.context.edit) {
console.log('getInitialAddress', this.context.addressId);
this.getInitialAddress(this.context.addressId);
@@ -386,7 +386,7 @@ export default {
this.openEditPane();
} else {
this.flag.showPane = true;
- console.log('step0: open the Show Panel');
+ //console.log('step0: open the Show Panel');
}
},
closeShowPane() {
diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/OnTheFly/App.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/OnTheFly/App.vue
index 48f68380b..05fed6671 100644
--- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/OnTheFly/App.vue
+++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/OnTheFly/App.vue
@@ -5,6 +5,7 @@
:action="context.action"
:buttonText="options.buttonText"
:displayBadge="options.displayBadge === 'true'"
+ :parent="options.parent"
@saveFormOnTheFly="saveFormOnTheFly">
diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/OnTheFly/components/OnTheFly.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/OnTheFly/components/OnTheFly.vue
index d64ae274e..d4342fdee 100644
--- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/OnTheFly/components/OnTheFly.vue
+++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/OnTheFly/components/OnTheFly.vue
@@ -23,25 +23,37 @@
+
+
{{ $t('onthefly.resource_comment_title') }}
+
+ {{ parent.comment }}
+
+
+
+
{{ $t('onthefly.resource_comment_title') }}
+
+ {{ parent.comment }}
+
+
@@ -78,18 +90,25 @@ export default {
OnTheFlyThirdparty,
OnTheFlyCreate
},
- props: ['type', 'id', 'action', 'buttonText', 'displayBadge'],
+ props: ['type', 'id', 'action', 'buttonText', 'displayBadge', 'parent'],
emits: ['saveFormOnTheFly'],
data() {
return {
modal: {
showModal: false,
modalDialogClass: "modal-dialog-scrollable modal-xl"
- },
- //action: this.action
+ }
}
},
computed: {
+ hasResourceComment() {
+ //console.log('hasResourceComment', this.parent);
+ return (typeof this.parent !== 'undefined' && this.parent !== null)
+ && this.action === 'show'
+ && this.parent.type === 'accompanying_period_resource'
+ && (this.parent.comment !== null && this.parent.comment !== '')
+ ;
+ },
classAction() {
switch (this.action) {
case 'show':
@@ -145,8 +164,8 @@ export default {
},
methods: {
openModal() {
- console.log('## OPEN ON THE FLY MODAL');
- console.log('## type:', this.type, ', action:', this.action);
+ //console.log('## OPEN ON THE FLY MODAL');
+ //console.log('## type:', this.type, ', action:', this.action);
this.modal.showModal = true;
this.$nextTick(function() {
//this.$refs.search.focus();
diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/OnTheFly/i18n.js b/src/Bundle/ChillMainBundle/Resources/public/vuejs/OnTheFly/i18n.js
index 3cba67149..c619ef96b 100644
--- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/OnTheFly/i18n.js
+++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/OnTheFly/i18n.js
@@ -17,6 +17,7 @@ const ontheflyMessages = {
person: "un nouvel usager",
thirdparty: "un nouveau tiers professionnel"
},
+ resource_comment_title: "Un commentaire est associé à cet interlocuteur"
}
}
}
diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/OnTheFly/index.js b/src/Bundle/ChillMainBundle/Resources/public/vuejs/OnTheFly/index.js
index 88e6aad5e..479cc1248 100644
--- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/OnTheFly/index.js
+++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/OnTheFly/index.js
@@ -21,7 +21,8 @@ containers.forEach((container) => {
},
options: {
buttonText: container.dataset.buttonText || null,
- displayBadge: container.dataset.displayBadge || false
+ displayBadge: container.dataset.displayBadge || false,
+ parent: JSON.parse(container.dataset.parent) || null,
}
}
}
diff --git a/src/Bundle/ChillMainBundle/Resources/views/OnTheFly/_insert_vue_onthefly.html.twig b/src/Bundle/ChillMainBundle/Resources/views/OnTheFly/_insert_vue_onthefly.html.twig
index e63fd9ee0..666743fb2 100644
--- a/src/Bundle/ChillMainBundle/Resources/views/OnTheFly/_insert_vue_onthefly.html.twig
+++ b/src/Bundle/ChillMainBundle/Resources/views/OnTheFly/_insert_vue_onthefly.html.twig
@@ -10,6 +10,7 @@
* action string 'show', 'edit', 'create'
* buttonText string
* displayBadge boolean (default: false) replace button by badge, need to define buttonText for content
+ * parent object (optional) pass parent context of the targetEntity (used for course resource comment)
#}
{{ encore_entry_script_tags('vue_onthefly') }}
diff --git a/src/Bundle/ChillMainBundle/Resources/views/Util/confirmation_template.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Util/confirmation_template.html.twig
index 1da31cfc7..119e213ef 100644
--- a/src/Bundle/ChillMainBundle/Resources/views/Util/confirmation_template.html.twig
+++ b/src/Bundle/ChillMainBundle/Resources/views/Util/confirmation_template.html.twig
@@ -6,7 +6,7 @@
{{ confirm_question }}
{% endif %}
-{% if display_content is not empty %}
+{% if display_content is defined and display_content is not empty %}
{{ display_content|raw }}
{% endif %}
diff --git a/src/Bundle/ChillMainBundle/Tests/Entity/NotificationTest.php b/src/Bundle/ChillMainBundle/Tests/Entity/NotificationTest.php
index 6bf966bbb..8110fa11d 100644
--- a/src/Bundle/ChillMainBundle/Tests/Entity/NotificationTest.php
+++ b/src/Bundle/ChillMainBundle/Tests/Entity/NotificationTest.php
@@ -15,6 +15,7 @@ use Chill\MainBundle\Entity\Notification;
use Chill\MainBundle\Entity\User;
use Chill\MainBundle\Repository\UserRepository;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
+use DateTimeImmutable;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use function count;
@@ -98,6 +99,7 @@ final class NotificationTest extends KernelTestCase
->setSender($em->find(User::class, $senderId))
->setRelatedEntityId(0)
->setRelatedEntityClass(AccompanyingPeriod::class)
+ ->setUpdatedAt(new DateTimeImmutable())
->setMessage('Fake message');
foreach ($addressesIds as $addresseeId) {
diff --git a/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php b/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php
index 000720a7f..5982fcebe 100644
--- a/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php
+++ b/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php
@@ -14,6 +14,7 @@ namespace Chill\PersonBundle\DependencyInjection;
use Chill\MainBundle\DependencyInjection\MissingBundleException;
use Chill\MainBundle\Security\Authorization\ChillExportVoter;
use Chill\PersonBundle\Doctrine\DQL\AddressPart;
+use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodResourceVoter;
use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter;
use Chill\PersonBundle\Security\Authorization\PersonVoter;
use Exception;
@@ -413,6 +414,25 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
],
],
],
+ [
+ 'class' => \Chill\PersonBundle\Entity\AccompanyingPeriod\Resource::class,
+ 'name' => 'accompanying_period_resource',
+ 'base_path' => '/api/1.0/person/accompanying-period/resource',
+ 'base_role' => 'ROLE_USER',
+ 'actions' => [
+ '_entity' => [
+ 'methods' => [
+ Request::METHOD_GET => false,
+ Request::METHOD_PATCH => true,
+ Request::METHOD_HEAD => false,
+ Request::METHOD_DELETE => false,
+ ],
+ 'roles' => [
+ Request::METHOD_PATCH => AccompanyingPeriodResourceVoter::EDIT,
+ ],
+ ],
+ ],
+ ],
[
'class' => \Chill\PersonBundle\Entity\AccompanyingPeriod\Origin::class,
'name' => 'accompanying_period_origin',
diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/Resource.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/Resource.php
index a11dc9b3d..8f84f319a 100644
--- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/Resource.php
+++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/Resource.php
@@ -20,6 +20,8 @@ use Symfony\Component\Serializer\Annotation\Groups;
use UnexpectedValueException;
/**
+ * **About denormalization**: this operation is operated by @see{AccompanyingPeriodResourdeNormalizer}.
+ *
* @ORM\Entity
* @ORM\Table(
* name="chill_person_accompanying_period_resource",
@@ -44,9 +46,10 @@ class Resource
private ?AccompanyingPeriod $accompanyingPeriod = null;
/**
- * @ORM\ManyToOne(targetEntity=Comment::class)
+ * @ORM\Column(type="text", nullable=true)
+ * @Groups({"read"})
*/
- private $comment;
+ private ?string $comment = '';
/**
* @ORM\Id
@@ -75,7 +78,7 @@ class Resource
return $this->accompanyingPeriod;
}
- public function getComment(): ?Comment
+ public function getComment(): ?string
{
return $this->comment;
}
@@ -92,7 +95,7 @@ class Resource
/**
* @return Person|ThirdParty
- * @Groups({"read", "write"})
+ * @Groups({"read"})
*/
public function getResource()
{
@@ -111,9 +114,9 @@ class Resource
return $this;
}
- public function setComment(?Comment $comment): self
+ public function setComment(?string $comment = null): self
{
- $this->comment = $comment;
+ $this->comment = (string) $comment;
return $this;
}
diff --git a/src/Bundle/ChillPersonBundle/Resources/public/chill/scss/badge.scss b/src/Bundle/ChillPersonBundle/Resources/public/chill/scss/badge.scss
index 46c13d152..e8a98bc80 100644
--- a/src/Bundle/ChillPersonBundle/Resources/public/chill/scss/badge.scss
+++ b/src/Bundle/ChillPersonBundle/Resources/public/chill/scss/badge.scss
@@ -184,5 +184,9 @@ div[class*='activity-'] {
background-color: $chill-ll-gray;
color: $chill-blue;
}
+ &.bg-confidential {
+ background-color: $chill-ll-gray;
+ color: $chill-red;
+ }
}
diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Resources/ResourceItem.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Resources/ResourceItem.vue
index e17555c6a..e7bc18371 100644
--- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Resources/ResourceItem.vue
+++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Resources/ResourceItem.vue
@@ -14,8 +14,15 @@
}">
+ -
+
+
-
@@ -23,6 +30,7 @@
-
+ -
+
+
-
@@ -62,6 +76,7 @@
-
+
+
+
+
+
+
+
+
{{ $t('write_comment_about', { 'r': resource.resource.text }) }}
+
+
+
+
+
+
+
+
+
+
+
+ {{ $t('action.save')}}
+
+
+
+
+
+
+
+
diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/store/index.js b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/store/index.js
index 3f26f5a8d..43400d8eb 100644
--- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/store/index.js
+++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/store/index.js
@@ -124,6 +124,11 @@ let initPromise = Promise.all([scopesPromise, accompanyingCoursePromise])
//console.log('### mutation: addResource', resource);
state.accompanyingCourse.resources.push(resource);
},
+ updateResource(state, payload) {
+ console.log('### mutation: updateResource', payload);
+ let i = state.accompanyingCourse.resources.findIndex(r => r.id === payload.id);
+ state.accompanyingCourse.resources[i] = payload;
+ },
updatePerson(state, payload) {
console.log('### mutation: updatePerson', payload);
let i = null;
@@ -360,6 +365,23 @@ let initPromise = Promise.all([scopesPromise, accompanyingCoursePromise])
throw error;
})
},
+ patchResource({ commit }, payload) {
+ const body = { type: "accompanying_period_resource" };
+ body['resource'] = {
+ type: payload.result.type,
+ id: payload.result.id
+ };
+ const url = `/api/1.0/person/accompanying-course/resource/${id}.json`;
+
+ return makeFetch('PATCH', url, body)
+ .then((response) => {
+ commit('patchResource', response);
+ })
+ .catch((error) => {
+ commit('catchError', error);
+ throw error;
+ })
+ },
/**
* On The Fly
*/
diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/OnTheFly/Person.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/OnTheFly/Person.vue
index f740fc2cb..9543da3bb 100644
--- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/OnTheFly/Person.vue
+++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/OnTheFly/Person.vue
@@ -227,7 +227,7 @@ export default {
getPerson(this.id)
.then(person => new Promise((resolve, reject) => {
this.person = person;
- console.log('get person', this.person);
+ //console.log('get person', this.person);
resolve();
}));
},
diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig
index 9071fdcfc..21e4a376e 100644
--- a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig
+++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig
@@ -4,11 +4,12 @@
{{ 'Resume Accompanying Course'|trans }}
{% endblock %}
-{% macro insert_onthefly(type, entity) %}
+{% macro insert_onthefly(type, entity, parent = null) %}
{% include '@ChillMain/OnTheFly/_insert_vue_onthefly.html.twig' with {
action: 'show', displayBadge: true,
targetEntity: { name: type, id: entity.id },
- buttonText: entity|chill_entity_render_string
+ buttonText: entity|chill_entity_render_string,
+ parent: parent
} %}
{% endmacro %}
@@ -55,6 +56,7 @@
{% endif %}
+ {% if accompanyingCourse.locationStatus != 'none' %}
+ {% endif %}
{% if accompanyingCourse.pinnedComment is not empty %}
diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/_list_item.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/_list_item.html.twig
index 79e159596..d2084bd87 100644
--- a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/_list_item.html.twig
+++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/_list_item.html.twig
@@ -11,7 +11,7 @@
{% endif %}
{% if period.confidential %}
-