Browse Source

admin front: editing besoin description OK

bach 9 months ago
parent
commit
2d01c43061
2 changed files with 32 additions and 5 deletions
  1. 12 3
      src/components/ConcernementMapItem.vue
  2. 20 2
      src/components/contents/PuissanceAgir.vue

+ 12 - 3
src/components/ConcernementMapItem.vue

@@ -171,7 +171,7 @@ export default {
     },
     opened_concernement: {
       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
           this.is_open = false;
           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}`);
         // }
 
-        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
@@ -1469,6 +1476,7 @@ export default {
     //   return g;
     // },
     setPaperPuissanceagirBesoins(){
+      console.log(`setPaperPuissanceagirBesoins cid:${this.concernement.id}`);
       let g = new paper.Group({
         pivot: new paper.Point(this.pos),
         name: 'puissanceagir_besoins'
@@ -1493,6 +1501,7 @@ export default {
         besoin.item_cid = this.concernement.id;
         besoin.item_type = 'besoin';
         besoin.is_symbol_instance = true;
+
         console.log(`paper besoin id:${besoin.id}`);
         this.setBesoinPaperId(besoin.id, this.cid, this.concernement.besoins[i].id);
         g.addChild(besoin)

+ 20 - 2
src/components/contents/PuissanceAgir.vue

@@ -18,6 +18,7 @@ import { mdiRhombus } from '@mdi/js';
 import { mdiRhombusOutline } from '@mdi/js';
 import { mdiStickerPlusOutline } from '@mdi/js';
 
+import ContentEditable from '@components/editable/ContentEditable.vue';
 
 export default {
   props: ['cid'],
@@ -87,6 +88,9 @@ export default {
             })
         })
     },
+    reloadBesoins(){
+      this.reloadConcernementBesoins(this.cid);
+    },
     createBesoinNode(){
       return new Promise((resolve, reject) => {
         // 1 create entite node
@@ -153,7 +157,8 @@ export default {
   },
   components: {
     CartoucheLayout,
-    SvgIcon
+    SvgIcon,
+    ContentEditable
   }
 }
 
@@ -194,7 +199,20 @@ export default {
                  />
                 Besoin de l'enqueteur
             </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>
           <ul class="reponses">
             <li