Merge branch '232_resources_comment' into 'master'

232 resources comment

See merge request Chill-Projet/chill-bundles!276
This commit is contained in:
2022-01-13 11:05:15 +00:00
31 changed files with 502 additions and 71 deletions

View File

@@ -359,8 +359,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);
@@ -380,7 +380,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() {

View File

@@ -5,6 +5,7 @@
:action="context.action"
:buttonText="options.buttonText"
:displayBadge="options.displayBadge === 'true'"
:parent="options.parent"
@saveFormOnTheFly="saveFormOnTheFly">
</on-the-fly>
</template>

View File

@@ -23,25 +23,37 @@
<template v-slot:body v-if="type === 'person'">
<on-the-fly-person
v-bind:id="id"
v-bind:type="type"
v-bind:action="action"
:id="id"
:type="type"
:action="action"
ref="castPerson">
</on-the-fly-person>
<div v-if="hasResourceComment">
<h3>{{ $t('onthefly.resource_comment_title') }}</h3>
<blockquote class="chill-user-quote">
{{ parent.comment }}
</blockquote>
</div>
</template>
<template v-slot:body v-else-if="type === 'thirdparty'">
<on-the-fly-thirdparty
v-bind:id="id"
v-bind:type="type"
v-bind:action="action"
:id="id"
:type="type"
:action="action"
ref="castThirdparty">
</on-the-fly-thirdparty>
<div v-if="hasResourceComment">
<h3>{{ $t('onthefly.resource_comment_title') }}</h3>
<blockquote class="chill-user-quote">
{{ parent.comment }}
</blockquote>
</div>
</template>
<template v-slot:body v-else>
<on-the-fly-create
v-bind:action="action"
:action="action"
ref="castNew">
</on-the-fly-create>
</template>
@@ -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();

View File

@@ -17,6 +17,7 @@ const ontheflyMessages = {
person: "un nouvel usager",
thirdparty: "un nouveau tiers professionnel"
},
resource_comment_title: "Un commentaire est associé à cet interlocuteur"
}
}
}

View File

@@ -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,
}
}
}

View File

@@ -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)
#}
<span class="onthefly-container"
@@ -31,6 +32,10 @@
data-display-badge="true"
{% endif %}
{% if parent is defined %}
data-parent='{{ parent|json_encode }}'
{% endif %}
></span>
{{ encore_entry_script_tags('vue_onthefly') }}

View File

@@ -6,7 +6,7 @@
<p class="message-confirm">{{ confirm_question }}</p>
{% endif %}
{% if display_content is not empty %}
{% if display_content is defined and display_content is not empty %}
{{ display_content|raw }}
{% endif %}