cercle po: adresse doleance & reception et traitement OK

This commit is contained in:
Bachir Soussi Chiadmi 2025-02-26 12:24:23 +01:00
parent b3c6f3bb9c
commit 4afa5fbfa0
5 changed files with 234 additions and 77 deletions

View File

@ -117,9 +117,9 @@ fragment ConcernementFields on Concernement {
date_adresse {
start
}
entite_addresse_doleance
comment_ennonce_doleance
aqui_addresse_doleance
entite_adresse_doleance
comment_enonce_doleance
a_qui_adresse_doleance
reception_traitement {
id
revision_id

View File

@ -1302,7 +1302,9 @@ div.add-ressource-btn{
}
div.add-cerclepo-btn,
div.add-groupinteret-btn{
div.add-groupinteret-btn,
div.add-adressedoleance-btn,
div.add-receptiontraitement-btn{
@include add-btn();
margin: 0 0 1em;
height: 60px;

View File

@ -1749,9 +1749,9 @@ export default {
}
],
[
'entite_addresse_doleance',
'comment_ennonce_doleance',
'aqui_addresse_doleance',
'entite_adresse_doleance',
'comment_enonce_doleance',
'a_qui_adresse_doleance',
{
fieldname: 'reception_traitement',
fields: [
@ -1970,7 +1970,7 @@ export default {
// adresse de la doleance
if (doleance.entite_addresse_doleance || doleance.aqui_addresse_doleance || doleance.comment_ennonce_doleance) {
if (doleance.entite_adresse_doleance || doleance.a_qui_adresse_doleance || doleance.comment_enonce_doleance) {
g.addChild(new paper.Path.Circle({
center: [this.pos.x - r, this.pos.y],
radius: 3 * this.scale,

View File

@ -64,6 +64,9 @@ export default {
},
groupeinteret() {
return this.doleance.groupesinterets[this.opened_dol.field_index];
},
receptionettraitment() {
return this.doleance.reception_traitement[this.opened_dol.field_index];
}
},
created () {
@ -189,16 +192,26 @@ export default {
})
})
},
// adresse doleance
addAdresseDoleance(e){
this.setOpenedDoleanceField(this.cid, this.doleance.id, "adresse_de_la_doleance");
},
// groupe interet
addgroupInteret(e){
console.log('add groupe interet');
this.createCerclepoParagGeneric('groupes_interets', 'field_groupes', 'groupesinterets');
},
addReceptionEtTraitement(e){
this.createCerclepoParagGeneric('reception_et_traitement', 'field_receptions_et_traitements', 'reception_traitement');
},
createCerclepoParagGeneric(type, prt_field_name, obj_name){
console.log('createCerclepoParagGeneric',type, prt_field_name, obj_name);
this.reloading_concernements = true;
// 1 create paragraphe
this.createGroupinteretParag()
this.createParag(type, prt_field_name)
.then((parag) => {
console.log('createGroupinteretParag then parag', parag);
console.log('createParag then parag', parag);
// 3 record on concernement field_entites
this.recordCerclepoGroupesinteretsField(parag)
this.recordCerclepoParagField(parag, obj_name, prt_field_name)
.then((cercle_politique) => {
console.log('cercle_politique', cercle_politique);
// reload concernement doleances
@ -208,16 +221,15 @@ export default {
});
})
})
},
createGroupinteretParag(){
createParag(type, prt_field_name){
return new Promise((resolve, reject) => {
// 2 create paragraphe
const params_parag = {
type: [{target_id: 'groupes_interets'}],
type: [{target_id: type}],
parent_type:{value: 'node'},
parent_id:{value: this.opened_concernement.opened_doleance.id},
parent_field_name:{value: 'field_groupes'}, // entity reference revision
parent_field_name:{value: prt_field_name}, // entity reference revision
};
const configs = {
@ -235,38 +247,39 @@ export default {
})
})
},
recordCerclepoGroupesinteretsField(parag){
recordCerclepoParagField(parag, obj_name, field_name){
return new Promise((resolve, reject) => {
// 3 record concernement field_entite
// get all the field_entite values, we don't want to ersae everything
let groupes = [];
let parag_records = [];
this.concernement.doleances.forEach((doleance) =>{
if (doleance.id === this.opened_concernement.opened_doleance.id) {
doleance.groupesinterets.forEach((group) => {
console.log('group',group);
doleance[obj_name].forEach((fied) => {
console.log('fied',fied);
groupes.push({
target_id: group.id,
target_revision_id: group.revision_id
parag_records.push({
target_id: fied.id,
target_revision_id: fied.revision_id
})
})
}
})
console.log('groupes', groupes);
console.log('parag_records', parag_records);
// add the new field value
groupes.push({
parag_records.push({
target_id: parag.id[0].value,
target_revision_id: parag.revision_id[0].value
})
console.log('groupes', groupes);
console.log('parag_records', parag_records);
const params_node = {
type: 'cercle_politique',
nid: [{value: this.opened_concernement.opened_doleance.id}],
'field_groupes': groupes
// 'field_groupes': parag_records
};
params_node[field_name] = parag_records;
const configs = {
headers: {'X-CSRF-Token': this.csrf_token}
@ -274,11 +287,11 @@ export default {
REST.patch(`/node/${this.opened_concernement.opened_doleance.id}?_format=json`, params_node, configs)
.then(({ data }) => {
console.log('REST patch cercle_politique new field_group', data)
console.log('REST patch cercle_politique new parag field', data)
resolve(data)
})
.catch(error => {
console.warn(`Issue with patch cercle_politique new field_group`, error)
console.warn(`Issue with patch cercle_politique new parag field`, error)
reject(error)
})
// resolve('test')
@ -461,7 +474,8 @@ export default {
id: groupeinteret.id,
revision_id: groupeinteret.revision_id,
field: {field_name: 'field_groupe_interets', value:'value'}
}" />
}"
v-on:updated="reloadConcernementCerclePol(cid)"/>
<label for="accorder">{{ p_groupes_interets.field_accorder_interets.label }}</label>
<!-- <p
@ -480,7 +494,8 @@ export default {
id: groupeinteret.id,
revision_id: groupeinteret.revision_id,
field: {field_name: 'field_accorder_interets', value:'value'}
}" />
}"
v-on:updated="reloadConcernementCerclePol(cid)"/>
<label for="formuler">{{ p_groupes_interets.field_formuler.label }}</label>
<!-- <p
@ -499,58 +514,179 @@ export default {
id: groupeinteret.id,
revision_id: groupeinteret.revision_id,
field: {field_name: 'field_formuler', value:'value'}
}" />
}"
v-on:updated="reloadConcernementCerclePol(cid)"/>
</section>
</section>
<section
v-if="opened_dol.field === 'adresse_de_la_doleance'"
class="adresse">
<span class="date">{{ doleance.date_adresse.start }}</span>
<section v-if="opened_dol.field === 'adresse_de_la_doleance'" class="adresse">
<h5>Adresse de la doléance</h5>
<label for="entite_addresse_doleance">{{ ct_cercle_politique.field_entite_adresse_doleance.label }}</label>
<p
name="entite_addresse_doleance"
v-html="doleance.entite_addresse_doleance" />
<!-- <span class="date">{{ doleance.date_adresse.start }}</span> -->
<DateEditable
:value="doleance.date_adresse.start"
class="adressedoleance-date"
:contenteditable="opened_concernement.can_update"
:data="{
entitytype: 'node',
bundle: 'cercle_politique',
id: doleance.id,
field: {field_name: 'field_date_adresse'}
}"
v-on:updated="reloadConcernementCerclePol(cid)"/>
<label for="comment_ennonce_doleance">{{ ct_cercle_politique.field_comment_enonce_doleance.label }}</label>
<p
name="comment_ennonce_doleance"
v-html="doleance.comment_ennonce_doleance" />
<label for="entite_adresse_doleance">{{ ct_cercle_politique.field_entite_adresse_doleance.label }}</label>
<!-- <p name="entite_adresse_doleance" v-html="doleance.entite_adresse_doleance" /> -->
<ContentEditable
tag="p"
name="entite_adresse_doleance"
:value="doleance.entite_adresse_doleance"
:html="true"
:class="{ ellipsed: headerreduced }"
:contenteditable="opened_concernement.can_update"
:data="{
entitytype: 'node',
bundle: 'cercle_politique',
id: doleance.id,
field: {field_name: 'field_entite_adresse_doleance', value:'value'}
}"
v-on:updated="reloadConcernementCerclePol(cid)"/>
<label for="aqui_addresse_doleance">{{ ct_cercle_politique.field_a_qui_adresse_doleance.label }}</label>
<p
name="aqui_addresse_doleance"
v-html="doleance.aqui_addresse_doleance" />
<label for="comment_enonce_doleance">{{ ct_cercle_politique.field_comment_enonce_doleance.label }}</label>
<!-- <p name="comment_enonce_doleance" v-html="doleance.comment_enonce_doleance" /> -->
<ContentEditable
tag="p"
name="comment_enonce_doleance"
:value="doleance.comment_enonce_doleance"
:html="true"
:class="{ ellipsed: headerreduced }"
:contenteditable="opened_concernement.can_update"
:data="{
entitytype: 'node',
bundle: 'cercle_politique',
id: doleance.id,
field: {field_name: 'field_comment_enonce_doleance', value:'value'}
}"
v-on:updated="reloadConcernementCerclePol(cid)"/>
<label for="a_qui_adresse_doleance">{{ ct_cercle_politique.field_a_qui_adresse_doleance.label }}</label>
<!-- <p name="a_qui_adresse_doleance" v-html="doleance.a_qui_adresse_doleance" /> -->
<ContentEditable
tag="p"
name="a_qui_adresse_doleance"
:value="doleance.a_qui_adresse_doleance"
:html="true"
:class="{ ellipsed: headerreduced }"
:contenteditable="opened_concernement.can_update"
:data="{
entitytype: 'node',
bundle: 'cercle_politique',
id: doleance.id,
field: {field_name: 'field_a_qui_adresse_doleance', value:'value'}
}"
v-on:updated="reloadConcernementCerclePol(cid)"/>
</section>
<section
v-if="opened_dol.field === 'reception_traitement'"
class="reception_traitement">
<span class="date">
{{ doleance.reception_traitement[opened_dol.field_index].date.start }}
<!-- {{ doleance.reception_traitement[opened_dol.field_index].date.start }}
&#x2192;
{{ doleance.reception_traitement[opened_dol.field_index].date.end }}
{{ doleance.reception_traitement[opened_dol.field_index].date.end }} -->
<DateEditable
:value="receptionettraitment.date.start"
:end_value="receptionettraitment.date.end"
class="receptionettraitment-date"
:contenteditable="opened_concernement.can_update"
mode="range"
:data="{
entitytype: 'paragraph',
bundle: 'reception_et_traitement',
id: receptionettraitment.id,
revision_id: receptionettraitment.revision_id,
field: {field_name: 'field_date_reception_traite'}
}"
v-on:updated="reloadConcernementCerclePol(cid)"/>
</span>
<h5>Reception et traitement de la doléance</h5>
<label for="entite_adressee">{{ p_reception_et_traitement.field_entite_adressee.label }}</label>
<p
name="entite_adressee"
v-html="doleance.reception_traitement[opened_dol.field_index].entite_adressee" />
<label for="doleance_formulee">{{ p_reception_et_traitement.field_doleance_formulee.label }}</label>
<p
name="doleance_formulee"
v-html="doleance.reception_traitement[opened_dol.field_index].doleance_formulee" />
<label for="traite_doleance">{{ p_reception_et_traitement.field_traite_doleance.label }}</label>
<p
name="traite_doleance"
v-html="doleance.reception_traitement[opened_dol.field_index].traite_doleance" />
<label for="entite_recoit_doleance">{{ p_reception_et_traitement.field_entite_recoit_doleance.label }}</label>
<p
<!-- <p
name="entite_recoit_doleance"
v-html="doleance.reception_traitement[opened_dol.field_index].entite_recoit_doleance" />
v-html="doleance.reception_traitement[opened_dol.field_index].entite_recoit_doleance" /> -->
<ContentEditable
tag="p"
name="entite_recoit_doleance"
:value="receptionettraitment.entite_recoit_doleance"
:html="true"
:class="{ ellipsed: headerreduced }"
:contenteditable="opened_concernement.can_update"
:data="{
entitytype: 'paragraph',
bundle: 'reception_et_traitement',
id: receptionettraitment.id,
revision_id: receptionettraitment.revision_id,
field: {field_name: 'field_entite_recoit_doleance', value:'value'}
}"
v-on:updated="reloadConcernementCerclePol(cid)"/>
<label for="traite_doleance">{{ p_reception_et_traitement.field_traite_doleance.label }}</label>
<!-- <p
name="traite_doleance"
v-html="doleance.reception_traitement[opened_dol.field_index].traite_doleance" /> -->
<ContentEditable
tag="p"
name="traite_doleance"
:value="receptionettraitment.traite_doleance"
:html="true"
:class="{ ellipsed: headerreduced }"
:contenteditable="opened_concernement.can_update"
:data="{
entitytype: 'paragraph',
bundle: 'reception_et_traitement',
id: receptionettraitment.id,
revision_id: receptionettraitment.revision_id,
field: {field_name: 'field_traite_doleance', value:'value'}
}"
v-on:updated="reloadConcernementCerclePol(cid)"/>
<label for="doleance_formulee">{{ p_reception_et_traitement.field_doleance_formulee.label }}</label>
<!-- <p
name="doleance_formulee"
v-html="doleance.reception_traitement[opened_dol.field_index].doleance_formulee" /> -->
<ContentEditable
tag="p"
name="doleance_formulee"
:value="receptionettraitment.doleance_formulee"
:html="true"
:class="{ ellipsed: headerreduced }"
:contenteditable="opened_concernement.can_update"
:data="{
entitytype: 'paragraph',
bundle: 'reception_et_traitement',
id: receptionettraitment.id,
revision_id: receptionettraitment.revision_id,
field: {field_name: 'field_doleance_formulee', value:'value'}
}"
v-on:updated="reloadConcernementCerclePol(cid)"/>
<label for="entite_adressee">{{ p_reception_et_traitement.field_entite_adressee.label }}</label>
<!-- <p
name="entite_adressee"
v-html="doleance.reception_traitement[opened_dol.field_index].entite_adressee" /> -->
<ContentEditable
tag="p"
name="entite_adressee"
:value="receptionettraitment.entite_adressee"
:html="true"
:class="{ ellipsed: headerreduced }"
:contenteditable="opened_concernement.can_update"
:data="{
entitytype: 'paragraph',
bundle: 'reception_et_traitement',
id: receptionettraitment.id,
revision_id: receptionettraitment.revision_id,
field: {field_name: 'field_entite_adressee', value:'value'}
}"
v-on:updated="reloadConcernementCerclePol(cid)"/>
</section>
<section
@ -658,18 +794,21 @@ export default {
<template v-if="concernement.can_update">
<!-- <template v-if="opened_concernement.opened_doleance.field === 'groupesinterets'">
<template v-if="opened_concernement.opened_doleance.field === 'adresse_de_la_doleance' || opened_concernement.opened_doleance.field === 'reception_et_traitement'">
<div
v-if="!reloading_concernements"
@click="addgroupInteret"
class="add-groupinteret-btn btn">
<span>Ajouter un group d'intérêt</span>
@click="addReceptionEtTraitement"
class="add-receptiontraitement-btn btn">
<span>Ajouter réception et traitement</span>
<svg-icon type="mdi" :path="mdiStickerPlusOutline_path"/>
</div>
<div v-else class="add-groupinteret-btn btn">
<div v-else class="add-receptiontraitement-btn btn">
<div class="loading">Chargement</div>
</div>
</template> -->
</template>
<template v-if="opened_concernement.opened_doleance.field === 'lenquete' || opened_concernement.opened_doleance.field === 'groupesinterets'">
<div
@ -684,10 +823,25 @@ export default {
</div>
</template>
<template v-if="opened_concernement.opened_doleance.field === 'lenquete'">
<div v-if="!reloading_concernements" @click="addCerclePo" class="add-cerclepo-btn btn">
<span>Ajouter un cercle politique</span>
<svg-icon type="mdi" :path="mdiStickerPlusOutline_path"/>
<template v-if="opened_concernement.opened_doleance.field === 'groupesinterets'">
<div
v-if="!reloading_concernements"
@click="addAdresseDoleance"
class="add-adressedoleance-btn btn">
<span>Adresse de la doléance</span>
<svg-icon type="mdi" :path="mdiStickerPlusOutline_path"/>
</div>
<div v-else class="add-adressedoleance-btn btn">
<div class="loading">Chargement</div>
</div>
</template>
<template v-if="opened_concernement.opened_doleance.field === 'leprobleme' || opened_concernement.opened_doleance.field === 'lenquete'">
<div v-if="!reloading_concernements"
@click="addCerclePo"
class="add-cerclepo-btn btn">
<span>Ajouter un cercle politique</span>
<svg-icon type="mdi" :path="mdiStickerPlusOutline_path"/>
</div>
<div v-else class="add-cerclepo-btn btn">
<div class="loading">Chargement</div>
@ -700,6 +854,7 @@ export default {
<!-- <vue-plyr>
<div class="plyr__video-embed"> -->
<iframe
v-if="opened_concernement.opened_doleance.field === 'leprobleme' || opened_concernement.opened_doleance.field === 'lenquete'"
src="https://www.youtube.com/embed/_Uogb4tJ9c4?amp;iv_load_policy=3&amp;modestbranding=1&amp;playsinline=1&amp;showinfo=0&amp;rel=0&amp;enablejsapi=1"
allowfullscreen
allowtransparency

View File

@ -581,9 +581,9 @@ export const ConcernementsStore = defineStore({
date_adresse {
start
}
entite_addresse_doleance
comment_ennonce_doleance
aqui_addresse_doleance
entite_adresse_doleance
comment_enonce_doleance
a_qui_adresse_doleance
reception_traitement {
id
revision_id