admin front: editing besoin description OK

This commit is contained in:
Bachir Soussi Chiadmi 2024-06-03 13:45:52 +02:00
parent 883e7b5896
commit 2d01c43061
2 changed files with 32 additions and 5 deletions

View File

@ -171,7 +171,7 @@ export default {
}, },
opened_concernement: { opened_concernement: {
handler (n, o) { handler (n, o) {
console.log(`concernementMapitem ${this.cid} watch opened_concernement o, n`, o, n); // console.log(`concernementMapitem ${this.cid} watch opened_concernement o, n`, o, n);
if (!n) { // if there is no opened concernement if (!n) { // if there is no opened concernement
this.is_open = false; this.is_open = false;
if (this.active_revision !== this.concernement.active_revision) { if (this.active_revision !== this.concernement.active_revision) {
@ -291,8 +291,15 @@ export default {
// console.log(`concernementMapItem watch concernement o.opened_doleance:${o.opened_doleance.id}, n.opened_doleance:${n.opened_doleance.id}`); // console.log(`concernementMapItem watch concernement o.opened_doleance:${o.opened_doleance.id}, n.opened_doleance:${n.opened_doleance.id}`);
// } // }
if (this.is_open && this.map_mode === "puissancedagir") {
this.setPaperContents(); },
deep: true
},
'concernement.besoins.length': {
handler (n, o){
console.log(`ConcernementMapItem ${this.id} watch concernement.besoins.length o, n`, o, n);
if (this.is_open && this.map_mode === "puissancedagir" && o != null && n !== o) {
this.resetPaperContents();
} }
}, },
deep: true deep: true
@ -1469,6 +1476,7 @@ export default {
// return g; // return g;
// }, // },
setPaperPuissanceagirBesoins(){ setPaperPuissanceagirBesoins(){
console.log(`setPaperPuissanceagirBesoins cid:${this.concernement.id}`);
let g = new paper.Group({ let g = new paper.Group({
pivot: new paper.Point(this.pos), pivot: new paper.Point(this.pos),
name: 'puissanceagir_besoins' name: 'puissanceagir_besoins'
@ -1493,6 +1501,7 @@ export default {
besoin.item_cid = this.concernement.id; besoin.item_cid = this.concernement.id;
besoin.item_type = 'besoin'; besoin.item_type = 'besoin';
besoin.is_symbol_instance = true; besoin.is_symbol_instance = true;
console.log(`paper besoin id:${besoin.id}`); console.log(`paper besoin id:${besoin.id}`);
this.setBesoinPaperId(besoin.id, this.cid, this.concernement.besoins[i].id); this.setBesoinPaperId(besoin.id, this.cid, this.concernement.besoins[i].id);
g.addChild(besoin) g.addChild(besoin)

View File

@ -18,6 +18,7 @@ import { mdiRhombus } from '@mdi/js';
import { mdiRhombusOutline } from '@mdi/js'; import { mdiRhombusOutline } from '@mdi/js';
import { mdiStickerPlusOutline } from '@mdi/js'; import { mdiStickerPlusOutline } from '@mdi/js';
import ContentEditable from '@components/editable/ContentEditable.vue';
export default { export default {
props: ['cid'], props: ['cid'],
@ -87,6 +88,9 @@ export default {
}) })
}) })
}, },
reloadBesoins(){
this.reloadConcernementBesoins(this.cid);
},
createBesoinNode(){ createBesoinNode(){
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
// 1 create entite node // 1 create entite node
@ -153,7 +157,8 @@ export default {
}, },
components: { components: {
CartoucheLayout, CartoucheLayout,
SvgIcon SvgIcon,
ContentEditable
} }
} }
@ -194,7 +199,20 @@ export default {
/> />
Besoin de l'enqueteur Besoin de l'enqueteur
</label> </label>
<h4 class="besoin-description" v-html="besoin.description"/>
<!-- <h4 class="besoin-description" v-html="besoin.description"/> -->
<ContentEditable
tag="p"
:value="besoin.description"
:html="true"
:contenteditable="opened_concernement.can_update"
:data="{
entitytype: 'node',
bundle: 'besoin',
id: besoin.id,
field: {field_name: 'body', value:'value'}
}"
v-on:updated="reloadBesoins" />
</header> </header>
<ul class="reponses"> <ul class="reponses">
<li <li