Compare commits

...

10 Commits

Author SHA1 Message Date
1da22af863 doleance le problème is editable 2025-02-10 12:09:42 +01:00
0b92ab8e9f restored prev bug fix 2024-12-04 13:00:04 +01:00
7db1608051 bug fix 2024-12-04 11:31:18 +01:00
45a1e25e66 bug fix 2024-10-10 10:31:12 +02:00
d6b3bdf2aa admin front: entite active boolean 2024-10-04 15:46:36 +02:00
984ec07084 fileeditable filename with accent bug fix 2024-10-03 23:02:35 +02:00
6fb04ede84 linkeditable save bug fix 2024-10-03 22:30:39 +02:00
0fae2dee66 bug fix: revisions mismatch 2024-10-03 22:18:45 +02:00
f44d52bc2c bug fix: open boussole from search failed when mapitem_id different from cid 2024-10-03 22:18:11 +02:00
b988b43a66 commented some consolelog 2024-10-03 21:21:31 +02:00
11 changed files with 429 additions and 139 deletions

View File

@ -30,6 +30,7 @@ fragment ConcernementFields on Concernement {
entites { entites {
id id
revision_id revision_id
active
menacemaintien menacemaintien
actuelfuture actuelfuture
entite { entite {
@ -50,6 +51,9 @@ fragment ConcernementFields on Concernement {
revision_id revision_id
changed changed
entites { entites {
id
revision_id
active
menacemaintien menacemaintien
prise prise
actuelfuture actuelfuture

View File

@ -31,6 +31,7 @@ export default {
concernement: null, concernement: null,
active_revision: null, active_revision: null,
entities: null, entities: null,
activeEntites: null,
superposedEntiteID: null, superposedEntiteID: null,
// superposedEntitesIDsList: [], // superposedEntitesIDsList: [],
canvas: null, canvas: null,
@ -95,7 +96,7 @@ export default {
...mapState(UserStore,['csrf_token']), ...mapState(UserStore,['csrf_token']),
}, },
created () { created () {
console.log('ConcernementMapItem created', this.mapitem); // console.log('ConcernementMapItem created', this.mapitem);
// this.id = this.superposition_id ? `${this.cid}___${this.superposition_id}` : this.cid; // this.id = this.superposition_id ? `${this.cid}___${this.superposition_id}` : this.cid;
// console.log(`this.mapitem.id`, this.mapitem.id); // console.log(`this.mapitem.id`, this.mapitem.id);
this.resetConcernement(); this.resetConcernement();
@ -116,9 +117,9 @@ export default {
// //
this.parseEntityPointsValues(); this.parseEntityPointsValues();
let activeEntites = this.getActiveEntites(this.entites);
// this.getSalientPoints() // this.getSalientPoints()
this.sailentEntites = this.concernement.sailentEntites = this.getJarvisEnvelopeConvexeEntites(this.entites) this.sailentEntites = this.concernement.sailentEntites = this.getJarvisEnvelopeConvexeEntites(activeEntites)
// define init position of the item // define init position of the item
this.pos = this.getRandomPos(); this.pos = this.getRandomPos();
@ -268,7 +269,7 @@ export default {
}, },
concernement: { concernement: {
handler (n, o){ handler (n, o){
console.log(`ConcernementMapItem ${this.id} watch concernement o, n`, this.concernement.parsedEntites, o, n); // console.log(`ConcernementMapItem ${this.id} watch concernement o, n`, this.concernement.parsedEntites, o, n);
// check for active_revision changes // check for active_revision changes
// do not trigger on first variable filling (if o is null) // do not trigger on first variable filling (if o is null)
// check for new concernement object // check for new concernement object
@ -297,7 +298,7 @@ export default {
}, },
'concernement.besoins': { 'concernement.besoins': {
handler (n, o){ handler (n, o){
console.log(`ConcernementMapItem ${this.id} watch concernement.besoins o, n`, o, n); // console.log(`ConcernementMapItem ${this.id} watch concernement.besoins o, n`, o, n);
if (this.is_open && this.map_mode === "puissancedagir") { if (this.is_open && this.map_mode === "puissancedagir") {
// this.resetPaperBesoinReponsePos(); // this.resetPaperBesoinReponsePos();
this.setPaperPuissanceagirBesoins(true); // true for update=true this.setPaperPuissanceagirBesoins(true); // true for update=true
@ -307,7 +308,7 @@ export default {
}, },
'concernement.besoins.length': { 'concernement.besoins.length': {
handler (n, o){ handler (n, o){
console.log(`ConcernementMapItem ${this.id} watch concernement.besoins.length o, n`, o, n); // 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) { if (this.is_open && this.map_mode === "puissancedagir" && o != null && n !== o) {
this.resetPaperContents(); this.resetPaperContents();
} }
@ -367,7 +368,7 @@ export default {
}, },
'concernement.entites': { 'concernement.entites': {
handler (n, o) { handler (n, o) {
console.log(`ConcernementMapItem ${this.id} watch concernement.entites o, n`, o, n); // console.log(`ConcernementMapItem ${this.id} watch concernement.entites o, n`, o, n);
// do not trigger on first fill of the property (if o is null) // do not trigger on first fill of the property (if o is null)
if (o) { if (o) {
this.resetPaperEntitesAndContours(); this.resetPaperEntitesAndContours();
@ -400,7 +401,7 @@ export default {
'setDetailsZoomValue', 'setDetailsZoomValue',
]), ]),
resetConcernement(){ resetConcernement(){
console.log(`resetConcernement() ${this.mapitem.id}`); // console.log(`resetConcernement() ${this.mapitem.id}`);
this.id = this.mapitem.id; this.id = this.mapitem.id;
this.concernement = this.concernementsByID[this.mapitem.cid];// this.mapitem.concernement; this.concernement = this.concernementsByID[this.mapitem.cid];// this.mapitem.concernement;
this.cid = this.concernement.id; this.cid = this.concernement.id;
@ -409,10 +410,17 @@ export default {
// console.log(`ConcernementsMapItem ${this.id} created`); // console.log(`ConcernementsMapItem ${this.id} created`);
// this.entites = this.concernement.entites // this.entites = this.concernement.entites
this.entites = this.concernement.revisions_byid[this.concernement.revision_id].entites; // TODO sometimes active revision is not on revisions_by_id ... why ?
let revisions_ids = Object.keys(this.concernement.revisions_byid);
if (revisions_ids.indexOf(this.concernement.revision_id) !== -1) {
this.entites = this.concernement.revisions_byid[this.concernement.revision_id].entites;
} else {
this.entites = this.concernement.revisions_byid[revisions_ids.pop()].entites;
}
}, },
parseEntityPointsValues (){ parseEntityPointsValues (){
console.log(`parseEntityPointsValues`); // console.log(`parseEntityPointsValues`);
// converts data (menace/maintien, actuel/future, prise) into atcual position x,y // converts data (menace/maintien, actuel/future, prise) into atcual position x,y
for (let r = 0; r < this.concernement.revisions.length; r++) { // loop through all revisions for (let r = 0; r < this.concernement.revisions.length; r++) { // loop through all revisions
for (let i = 0; i < this.concernement.revisions[r].entites.length; i++) { // loop through all entite for each revision for (let i = 0; i < this.concernement.revisions[r].entites.length; i++) { // loop through all entite for each revision
@ -458,6 +466,17 @@ export default {
this.concernement.parsedEntites = true; this.concernement.parsedEntites = true;
}, },
getActiveEntites(entites){
// console.log('getActiveEntites', entites);
let activeEntites = [];
for (let i = 0; i < entites.length; i++) {
if (entites[i].active) {
activeEntites.push(entites[i])
}
}
return activeEntites;
},
getSalientPoints_OLD() { getSalientPoints_OLD() {
// debugger // debugger
// console.log(this.entites); // console.log(this.entites);
@ -493,6 +512,12 @@ export default {
// console.log(`this.salientPoints ${this.concernement.id}`, this.salientPoints); // console.log(`this.salientPoints ${this.concernement.id}`, this.salientPoints);
}, },
getJarvisEnvelopeConvexeEntites(entites){ getJarvisEnvelopeConvexeEntites(entites){
// console.log(`getJarvisEnvelopeConvexeEntites cid:${this.cid}`, entites);
if (entites.length === 0) {
console.error('getJarvisEnvelopeConvexeEntites entites must not be empty')
return;
}
let sailentEntites = []; let sailentEntites = [];
// https://www.geeksforgeeks.org/convex-hull-using-jarvis-algorithm-or-wrapping/ // https://www.geeksforgeeks.org/convex-hull-using-jarvis-algorithm-or-wrapping/
// find the most left point // find the most left point
@ -523,19 +548,21 @@ export default {
// clockwise than q, then update q. // clockwise than q, then update q.
q = (p + 1) % entites.length; q = (p + 1) % entites.length;
for (let i = 0; i < entites.length; i++) { for (let i = 0; i < entites.length; i++) {
let p_x = (entites[p].display.ray) * Math.cos(entites[p].display.alpha * (Math.PI/180)); // if (entite.active) {
let p_y = (entites[p].display.ray) * Math.sin(entites[p].display.alpha * (Math.PI/180)); let p_x = (entites[p].display.ray) * Math.cos(entites[p].display.alpha * (Math.PI/180));
let i_x = (entites[i].display.ray) * Math.cos(entites[i].display.alpha * (Math.PI/180)); let p_y = (entites[p].display.ray) * Math.sin(entites[p].display.alpha * (Math.PI/180));
let i_y = (entites[i].display.ray) * Math.sin(entites[i].display.alpha * (Math.PI/180)); let i_x = (entites[i].display.ray) * Math.cos(entites[i].display.alpha * (Math.PI/180));
let q_x = (entites[q].display.ray) * Math.cos(entites[q].display.alpha * (Math.PI/180)); let i_y = (entites[i].display.ray) * Math.sin(entites[i].display.alpha * (Math.PI/180));
let q_y = (entites[q].display.ray) * Math.sin(entites[q].display.alpha * (Math.PI/180)); let q_x = (entites[q].display.ray) * Math.cos(entites[q].display.alpha * (Math.PI/180));
let q_y = (entites[q].display.ray) * Math.sin(entites[q].display.alpha * (Math.PI/180));
let val = (i_y - p_y) * (q_x - i_x) - (i_x - p_x) * (q_y - i_y); let val = (i_y - p_y) * (q_x - i_x) - (i_x - p_x) * (q_y - i_y);
// If i is more clockwise than current q, then update q // If i is more clockwise than current q, then update q
if (val > 0){ if (val > 0){
q = i; q = i;
} }
// }
} }
// Now q is the most clockwise with // Now q is the most clockwise with
@ -810,7 +837,8 @@ export default {
}); });
// rebuild the contours with the new ray // rebuild the contours with the new ray
this.parseEntityPointsValues() this.parseEntityPointsValues()
this.sailentEntites = this.concernement.sailentEntites = this.getJarvisEnvelopeConvexeEntites(this.entites) let activeEntites = this.getActiveEntites(this.entites);
this.sailentEntites = this.concernement.sailentEntites = this.getJarvisEnvelopeConvexeEntites(activeEntites)
// redraw the contours // redraw the contours
this.paper_main_object.addChild(this.setPaperContour()); this.paper_main_object.addChild(this.setPaperContour());
@ -910,7 +938,8 @@ export default {
this.parseEntityPointsValues() this.parseEntityPointsValues()
this.sailentEntites = this.getJarvisEnvelopeConvexeEntites(this.concernement.revisions_byid[this.active_revision].entites); let activeEntites = this.getActiveEntites(this.concernement.revisions_byid[this.active_revision].entites);
this.sailentEntites = this.getJarvisEnvelopeConvexeEntites(activeEntites);
// remove contours if already exists // remove contours if already exists
if (this.paper_main_object.children && this.paper_main_object.children.contours) { if (this.paper_main_object.children && this.paper_main_object.children.contours) {
@ -960,7 +989,7 @@ export default {
} }
}, },
getPaddedRoundedSegments(points, scale){ getPaddedRoundedSegments(points, scale){
console.log(`setPaperContour ${this.concernement.id}, points`, points); // console.log(`setPaperContour ${this.concernement.id}, points`, points);
let getSegmentProps = (b,a,c) => { let getSegmentProps = (b,a,c) => {
const ac = { x: c.x - a.x, y: c.y - a.y } // get ac vecteur const ac = { x: c.x - a.x, y: c.y - a.y } // get ac vecteur
const lac = Math.sqrt(Math.pow(ac.x, 2) + Math.pow(ac.y, 2)); // get ac longueur ac const lac = Math.sqrt(Math.pow(ac.x, 2) + Math.pow(ac.y, 2)); // get ac longueur ac
@ -1077,6 +1106,8 @@ export default {
}, },
setPaperEntites(){ setPaperEntites(){
console.log(`setPaperEntites ${this.cid}`);
let g = new paper.Group({ let g = new paper.Group({
pivot: new paper.Point(this.pos), pivot: new paper.Point(this.pos),
name: 'entites' name: 'entites'
@ -1091,25 +1122,32 @@ export default {
// for (let i = 0; i < this.entites.length; i++) { // for (let i = 0; i < this.entites.length; i++) {
for (let i = 0; i < this.concernement.revisions_byid[this.active_revision].entites.length; i++) { for (let i = 0; i < this.concernement.revisions_byid[this.active_revision].entites.length; i++) {
let entite = this.concernement.revisions_byid[this.active_revision].entites[i]; let entite = this.concernement.revisions_byid[this.active_revision].entites[i];
console.log('entite', entite);
if (!entite.active && !this.concernement.can_update) {
continue;
}
// item type // item type
let item_type = entite.entite ? entite.entite.agissante ? 'entite_action' : 'entite' : 'entite_hidden'; let item_type = entite.entite ? entite.entite.agissante ? 'entite_action' : entite.active ? 'entite' : 'entite_inactive' : 'entite_hidden';
// use paper symbol // use paper symbol
let symbol_name = item_type; let symbol_name = item_type;
switch (item_type) { if(entite.entite && parseInt(this.opened_entite_id) === entite.entite.id){
case 'entite': switch (item_type) {
if(parseInt(this.opened_entite_id) === entite.entite.id){ case 'entite':
symbol_name = 'entite_hover'; symbol_name = 'entite_hover';
} break;
break; case 'inactive_entite':
case 'entite_action': symbol_name = 'entite_inactive_hover';
if(parseInt(this.opened_entite_id) === entite.entite.id){ break;
case 'entite_action':
symbol_name = 'entite_action_hover'; symbol_name = 'entite_action_hover';
} break;
break; }
} }
// console.log(`item_type: ${item_type}, symbol_name: ${symbol_name}`); console.log(`item_type: ${item_type}, symbol_name: ${symbol_name}`);
let instance = new paper.SymbolItem(this.paper_symbol_definitions[symbol_name]); let instance = new paper.SymbolItem(this.paper_symbol_definitions[symbol_name]);
instance.name = 'entite'; instance.name = 'entite';
@ -1122,6 +1160,7 @@ export default {
instance.is_symbol_instance = true; instance.is_symbol_instance = true;
g.addChild(instance); g.addChild(instance);
// instance.bringToFront(); // instance.bringToFront();
console.log('instance', instance);
if (entite.entite && entite.entite.title) { if (entite.entite && entite.entite.title) {
let pad = 2; let pad = 2;
@ -1174,6 +1213,8 @@ export default {
instance.label_item = label; instance.label_item = label;
} }
} }
console.log(`g`, g);
return g; return g;
}, },
setPaperEntitesSuperposees(){ setPaperEntitesSuperposees(){
@ -1391,9 +1432,10 @@ export default {
}); // end of loop on proximite for each main entite }); // end of loop on proximite for each main entite
let activeEntites = this.getActiveEntites(allEntiteRefConcernementContourEntites);
// general contour arround proximité // general contour arround proximité
// console.log('allEntiteRefConcernementContourEntites', allEntiteRefConcernementContourEntites); // console.log('allEntiteRefConcernementContourEntites', allEntiteRefConcernementContourEntites);
let genContoursEntite = this.getJarvisEnvelopeConvexeEntites(allEntiteRefConcernementContourEntites); let genContoursEntite = this.getJarvisEnvelopeConvexeEntites(activeEntites);
// console.log('genContoursEntite', genContoursEntite); // console.log('genContoursEntite', genContoursEntite);
let points = []; let points = [];
genContoursEntite.forEach(ent => { genContoursEntite.forEach(ent => {
@ -2125,11 +2167,15 @@ export default {
group.children.forEach((item) => { group.children.forEach((item) => {
if (this.opened_entite_id && item.item_id === parseInt(this.opened_entite_id) && item.item_type !== 'entite_hidden') { if (this.opened_entite_id && item.item_id === parseInt(this.opened_entite_id) && item.item_type !== 'entite_hidden') {
// switch symbole definition to hover // switch symbole definition to hover
item.definition = item.item_type === 'entite' ? this.paper_symbol_definitions.entite_hover : this.paper_symbol_definitions.entite_action_hover; item.definition = item.item_type === 'entite' ? this.paper_symbol_definitions.entite_hover
: item.item_type === 'entite_inactive' ? this.paper_symbol_definitions.entite_inactive_hover
: this.paper_symbol_definitions.entite_action_hover;
} else { } else {
// switch back symbole definition to normal // switch back symbole definition to normal
if ((!this.hover_elmt || item.item_id !== this.hover_elmt.id) && item.item_type !== 'entite_hidden') { if ((!this.hover_elmt || item.item_id !== this.hover_elmt.id) && item.item_type !== 'entite_hidden') {
item.definition = item.item_type === 'entite' ? this.paper_symbol_definitions.entite : this.paper_symbol_definitions.entite_action; item.definition = item.item_type === 'entite' ? this.paper_symbol_definitions.entite
: item.item_type === 'entite_inactive' ? this.paper_symbol_definitions.entite_inactive
: this.paper_symbol_definitions.entite_action;
} }
} }
}) })

View File

@ -52,12 +52,13 @@ export default {
}, },
methods: { methods: {
parseInfos(){ parseInfos(){
// console.log('mapPopup infos', this.infos); console.log('mapPopup infos', this.infos);
switch (this.infos.type) { switch (this.infos.type) {
case 'concernement': case 'concernement':
this.concernement = this.concernementsByID[this.infos.cid]; this.concernement = this.concernementsByID[this.infos.cid];
break; break;
case 'entite': case 'entite':
case 'entite_inactive':
case 'entite_proximite': case 'entite_proximite':
case 'entite_superpose': case 'entite_superpose':
case 'entite_action': case 'entite_action':
@ -156,7 +157,7 @@ export default {
</div> </div>
</section> </section>
<section v-if="infos.type === 'entite' || infos.type === 'entite_action' || infos.type === 'superposition' || infos.type === 'entite_superpose' || infos.type === 'entite_proximite'" class="entite-map-popup"> <section v-if="infos.type === 'entite' || infos.type === 'entite_inactive' || infos.type === 'entite_action' || infos.type === 'superposition' || infos.type === 'entite_superpose' || infos.type === 'entite_proximite'" class="entite-map-popup">
<template <template
v-for="(entite, index) of entites" v-for="(entite, index) of entites"
:key="index" :key="index"

View File

@ -405,8 +405,10 @@ export default {
// this.addPaperSymbolDefinition('doleance_icon', this.setPaperDoleanceICONSymbol()); // this.addPaperSymbolDefinition('doleance_icon', this.setPaperDoleanceICONSymbol());
if (!update) { if (!update) {
this.addPaperSymbolDefinition('entite', this.setPaperEntiteSymbol()); this.addPaperSymbolDefinition('entite', this.setPaperEntiteSymbol());
this.addPaperSymbolDefinition('entite_hidden', this.setPaperHiddenEntiteSymbol());
this.addPaperSymbolDefinition('entite_hover', this.setPaperEntiteHoverSymbol()); this.addPaperSymbolDefinition('entite_hover', this.setPaperEntiteHoverSymbol());
this.addPaperSymbolDefinition('entite_inactive', this.setPaperInactiveEntiteSymbol());
this.addPaperSymbolDefinition('entite_inactive_hover', this.setPaperInactiveEntiteHoverSymbol());
this.addPaperSymbolDefinition('entite_hidden', this.setPaperHiddenEntiteSymbol());
this.addPaperSymbolDefinition('entite_action_icon', this.setPaperEntiteActionIconSymbol()); this.addPaperSymbolDefinition('entite_action_icon', this.setPaperEntiteActionIconSymbol());
this.addPaperSymbolDefinition('entite_action', this.setPaperEntiteActionSymbol()); this.addPaperSymbolDefinition('entite_action', this.setPaperEntiteActionSymbol());
this.addPaperSymbolDefinition('entite_action_hover', this.setPaperEntiteActionHoverSymbol()); this.addPaperSymbolDefinition('entite_action_hover', this.setPaperEntiteActionHoverSymbol());
@ -1089,6 +1091,16 @@ export default {
strokeWidth:2 strokeWidth:2
}) })
}, },
setPaperEntiteHoverSymbol(){
return new paper.Path.Circle({
pivot: new paper.Point({x:0,y:0}),
center: [0,0],
radius: 0.5,
fillColor: '#01ffe2',
strokeColor: 'rgba(255,255,255,0.05)',
strokeWidth:2
})
},
setPaperHiddenEntiteSymbol(){ setPaperHiddenEntiteSymbol(){
return new paper.Path.Circle({ return new paper.Path.Circle({
pivot: new paper.Point({x:0,y:0}), pivot: new paper.Point({x:0,y:0}),
@ -1099,16 +1111,74 @@ export default {
strokeWidth:2 strokeWidth:2
}) })
}, },
setPaperEntiteHoverSymbol(){ setPaperInactiveEntiteSymbol(){
return new paper.Path.Circle({ return new paper.Path.Circle({
pivot: new paper.Point({x:0,y:0}), pivot: new paper.Point({x:0,y:0}),
center: [0,0], center: [0,0],
radius: 0.5, radius: 0.5, //0.3
fillColor: '#01ffe2', fillColor: '#F00',
strokeColor: 'rgba(255,255,255,0.05)', strokeColor: 'rgba(255,0,0,0.05)',
strokeWidth:2 strokeWidth:2
}) })
}, },
setPaperInactiveEntiteHoverSymbol(){
// let svgIcon = paper.project.importSVG(iconAction);
// svgIcon.strokeColor = '#01ffe2';
// svgIcon.strokeWidth = 0.25;
// svgIcon.scale(0.15);
// svgIcon.fillColor = null;
// svgIcon.position = {x:0, y:0};
// let circle = new paper.Path.Circle({
// radius: 3,
// fillColor: 'rgba(255,255,255,0.05)'
// })
// return new paper.Group({
// children: [circle, svgIcon],
// name: 'action_icon'
// });
let children = [];
let ray = 0.7; //this.map_item_ray;
// let pos = {x:0, y:0};
// let strokewidth = 0.4;
// children.push(new paper.Path.Line({
// from: [- ray, ray],
// to: [ray, - ray],
// strokeColor: '#01ffe2',
// strokeWidth: strokewidth
// }));
// children.push(new paper.Path.Line({
// from: [ray, ray],
// to: [- ray, - ray],
// strokeColor: '#01ffe2',
// strokeWidth: strokewidth
// }));
children.push(new paper.Path.Circle({
radius: ray/2,
fillColor: '#F00'
}))
children.push(new paper.Path.Circle({
radius: ray * 1.2,
strokeColor: '#01ffe2',
strokeWidth: 0.2,
fillColor: 'rgba(0,0,0,0)'
}))
children.push(new paper.Path.Circle({
radius: ray,
fillColor: 'rgba(255,255,255,0.01)'
}))
return new paper.Group({
children: children,
name: 'action_icon'
});
},
setPaperEntiteActionIconSymbol(){ setPaperEntiteActionIconSymbol(){
// let svgIcon = paper.project.importSVG(iconAction); // let svgIcon = paper.project.importSVG(iconAction);
// svgIcon.strokeWidth = 0.8; // svgIcon.strokeWidth = 0.8;

View File

@ -29,7 +29,7 @@ export default {
// let hue = Math.floor(Math.random()*360) // let hue = Math.floor(Math.random()*360)
for (let j = 0; j < num_colors; j++) { for (let j = 0; j < num_colors; j++) {
let pos = (1/num_colors*j + 1/num_colors/3 + Math.random()*1/num_colors/3)*100; let pos = (1/num_colors*j + 1/num_colors/3 + Math.random()*1/num_colors/3)*100;
console.log('gradient pos', pos); // console.log('gradient pos', pos);
colors.push({ colors.push({
color: this.getRandBGColor(), color: this.getRandBGColor(),
@ -43,7 +43,7 @@ export default {
// }) // })
gradients.push(colors) gradients.push(colors)
} }
console.log('gradients', gradients); // console.log('gradients', gradients);
let cssgrad = ''; let cssgrad = '';
gradients.forEach((gradient, index) => { gradients.forEach((gradient, index) => {
@ -55,7 +55,7 @@ export default {
cssgrad += index < gradients.length-1 ? '),' : ')'; cssgrad += index < gradients.length-1 ? '),' : ')';
}); });
// cssgrad += ';'; // cssgrad += ';';
console.log('cssgrad', cssgrad); // console.log('cssgrad', cssgrad);
gradientBackground.style.background = cssgrad; gradientBackground.style.background = cssgrad;
}, },
getRandBGColor (hue) { getRandBGColor (hue) {

View File

@ -11,6 +11,11 @@ import SvgIcon from '@jamescoyle/vue-icon';
import { mdiArrowLeft } from '@mdi/js'; import { mdiArrowLeft } from '@mdi/js';
import { mdiArrowRight } from '@mdi/js'; import { mdiArrowRight } from '@mdi/js';
import ContentEditable from '@components/editable/ContentEditable.vue';
// import CheckboxEditable from '@components/editable/CheckboxEditable.vue';
// import SelectEditable from '@components/editable/SelectEditable.vue';
export default { export default {
props: ['cid'], props: ['cid'],
data(){ data(){
@ -31,7 +36,8 @@ export default {
'p_groupes_interets', 'p_groupes_interets',
'p_reception_et_traitement', 'p_reception_et_traitement',
'p_mise_en_oeuvre_decision', 'p_mise_en_oeuvre_decision',
'p_reception_application_decision' 'p_reception_application_decision',
'reloadConcernementCerclePol'
]), ]),
...mapState(CommonStore,['hover_elmt']) ...mapState(CommonStore,['hover_elmt'])
}, },
@ -44,6 +50,7 @@ export default {
this.doleance_index = index; this.doleance_index = index;
} }
}); });
}, },
mounted() { mounted() {
if (this.doleance_index > 0) if (this.doleance_index > 0)
@ -71,8 +78,9 @@ export default {
this.openDoleance() this.openDoleance()
}, },
openDoleance(){ openDoleance(){
console.log('openDoleance');
this.doleance = this.concernement.doleances[this.doleance_index]; this.doleance = this.concernement.doleances[this.doleance_index];
console.log('openDoleance', this.doleance);
this.setOpenedDoleance(parseInt(this.cid), this.doleance.id); this.setOpenedDoleance(parseInt(this.cid), this.doleance.id);
setTimeout((function(that){ setTimeout((function(that){
return function(){ return function(){
@ -88,7 +96,10 @@ export default {
}, },
components: { components: {
CartoucheLayout, CartoucheLayout,
SvgIcon SvgIcon,
ContentEditable
// CheckboxEditable,
// SelectEditable
} }
} }
@ -112,7 +123,19 @@ export default {
v-if="opened_concernement.opened_doleance.field === 'leprobleme' || !opened_concernement.opened_doleance.field"> v-if="opened_concernement.opened_doleance.field === 'leprobleme' || !opened_concernement.opened_doleance.field">
<span class="date">{{ doleance.date_leprobleme.start }}</span> <span class="date">{{ doleance.date_leprobleme.start }}</span>
<h5>{{ ct_cercle_politique.field_le_probleme.label }}</h5> <h5>{{ ct_cercle_politique.field_le_probleme.label }}</h5>
<h4 name="leprobleme">{{ doleance.leprobleme }}</h4> <!-- <h4 name="leprobleme">{{ doleance.leprobleme }}</h4> -->
<ContentEditable
tag="h4"
:value="doleance.leprobleme"
class="doleance-leprobleme"
:contenteditable="opened_concernement.can_update"
:data="{
entitytype: 'node',
bundle: 'cercle_politique',
id: doleance.id,
field: {field_name: 'field_le_probleme', value:'value'}
}"
v-on:updated="reloadConcernementCerclePol(cid)"/>
</section> </section>
<section <section

View File

@ -233,6 +233,14 @@ export default {
.then(({data: { data: { entite }}}) => { .then(({data: { data: { entite }}}) => {
console.log('load entite loaded', entite) console.log('load entite loaded', entite)
this.entite = entite; this.entite = entite;
// record the paragraphe field id from concernement wher the entity is referenced
this.concernement.entites.forEach(parag_entite => {
if (parag_entite.entite && parag_entite.entite.id === this.entite.id) {
this.parag_entite = parag_entite;
}
});
// this.setProxSuggestions() // this.setProxSuggestions()
this.checkForUserProxmite(); this.checkForUserProxmite();
}) })
@ -567,6 +575,18 @@ export default {
</div> </div>
</section> </section>
<!-- active -->
<CheckboxEditable
v-if="entite && entite.can_update"
:checked="this.parag_entite.active"
label="Active"
:data="{
entitytype: 'paragraph',
bundle: 'entite_concernement',
id: this.parag_entite.id,
field: 'field_active'}"
v-on:updated="reloadConcernementEntites(cid)"/>
<!-- agissante --> <!-- agissante -->
<CheckboxEditable <CheckboxEditable
v-if="entite && entite.can_update" v-if="entite && entite.can_update"
@ -575,9 +595,9 @@ export default {
:data="{ :data="{
entitytype: 'node', entitytype: 'node',
bundle: 'entite', bundle: 'entite',
nid: this.entite.id, id: this.entite.id,
field: 'field_entite_agissante' field: 'field_entite_agissante'}"
}" /> v-on:updated="reloadConcernementEntites(cid)"/>
<SelectEditable <SelectEditable
v-if="entite && entite.can_update" v-if="entite && entite.can_update"
@ -586,15 +606,13 @@ export default {
:options="{ :options="{
'confidentialite_prive': 'privé', 'confidentialite_prive': 'privé',
'confidentialite_interne': 'interne', 'confidentialite_interne': 'interne',
'confidentialite_public': 'public' 'confidentialite_public': 'public'}"
}"
:data="{ :data="{
entitytype: 'node', entitytype: 'node',
bundle: 'entite', bundle: 'entite',
nid: this.entite.id, nid: this.entite.id,
field: 'field_confidentialite' field: 'field_confidentialite'}"
}" /> v-on:updated="reloadConcernementEntites(cid)"/>
</div> </div>

View File

@ -38,17 +38,24 @@ export default {
}, },
save(checked){ save(checked){
// console.log('save csrf_token', this.csrf_token); // console.log('save csrf_token', this.csrf_token);
const params = { let params = {
type: this.data.bundle, type: this.data.bundle,
nid: [{"value":this.data.nid}], // nid: [{"value":this.data.nid}],
[this.data.field]: {value: checked} [this.data.field]: {value: checked}
}; };
if (this.data.entitytype === 'node') {
params.nid = [{"value":this.data.id}];
} else {
params.id = [{"value":this.data.id}];
}
const configs = { const configs = {
headers: {'X-CSRF-Token': this.csrf_token} headers: {'X-CSRF-Token': this.csrf_token}
}; };
REST.patch(`/node/${this.data.nid}?_format=json`, params, configs)
let url_base = `/${this.data.entitytype === 'node' ? '' : 'entity/'}${this.data.entitytype}`;
REST.patch(`${url_base}/${this.data.id}?_format=json`, params, configs)
.then(({ data }) => { .then(({ data }) => {
console.log('user REST post node data', data) console.log(`checkboxEditable REST patch ${this.data.entitytype} data`, data)
// TODO if success update the data in pinia // TODO if success update the data in pinia
// this.reloadConcernements(); // this.reloadConcernements();
this.$emit('updated'); this.$emit('updated');

View File

@ -51,11 +51,14 @@ export default {
this.saveNewFile(file); this.saveNewFile(file);
}, },
saveNewFile(file){ saveNewFile(file){
const filename = file.name.normalize('NFD').replace(/[\u0300-\u036f]/g, "").replace(/[^a-zA-Z0-9_\-\.]/g, "_"); // Normalisation Unicode et suppression des accents
console.log('filename', filename);
const configs = { const configs = {
headers: { headers: {
'X-CSRF-Token': this.csrf_token, 'X-CSRF-Token': this.csrf_token,
'Content-Type': 'application/octet-stream', 'Content-Type': 'application/octet-stream',
'Content-Disposition': `file; filename="${file.name}"`, 'Content-Disposition': `file; filename="${filename}"`,
}, },
}; };

View File

@ -72,11 +72,15 @@ export default {
if ($li.querySelector('input.url').value) { if ($li.querySelector('input.url').value) {
let title = $li.querySelector('input.title').value; let title = $li.querySelector('input.title').value;
let url = $li.querySelector('input.url').value; let url = $li.querySelector('input.url').value;
console.log(`title ${title}, url ${url}`);
list.push({ list.push({
title: title, title: title,
uri: url uri: url
}); });
tobesaved = (typeof this.links[i] === 'undefined' || title !== this.links[i].title || url !== this.links[i].url); console.log(`title ${title} | this.links[i].title ${this.links[i].title}`);
if (!tobesaved) {
tobesaved = (typeof this.links[i] === 'undefined' || title !== this.links[i].title || url !== this.links[i].url);
}
} }
} }
if (!tobesaved) { if (!tobesaved) {

View File

@ -74,7 +74,7 @@ export const ConcernementsStore = defineStore({
// console.log('ast', ast); // console.log('ast', ast);
GQL.post('', { query: print(ast) }) GQL.post('', { query: print(ast) })
.then(({ data : { data : { allconcernements } } }) => { .then(({ data : { data : { allconcernements } } }) => {
console.log('loadconcernements loaded', allconcernements) console.log('|||||||||||| loadconcernements loaded ||||||||||||||||||', allconcernements)
this.concernements = []; this.concernements = [];
this.parseConcernements(allconcernements, true) this.parseConcernements(allconcernements, true)
this.concernements_loaded = true; this.concernements_loaded = true;
@ -108,74 +108,81 @@ export const ConcernementsStore = defineStore({
if (!concernement.entites_byid[entite.entite.id]) { if (!concernement.entites_byid[entite.entite.id]) {
concernement.entites_byid[entite.entite.id] = entite; concernement.entites_byid[entite.entite.id] = entite;
} }
// record entite agissante
if (entite.entite.agissante) {
if (!concernement.entitesagissantes_byid[entite.entite.id]) {
concernement.entitesagissantes_byid[entite.entite.id] = entite;
}
concernement.has_agissantes = true;
}
// record a flat list of all entités of all concernement for map-popup // record a flat list of all entités of all concernement for map-popup
if (!this.allEntitesById[entite.entite.id]) { if (!this.allEntitesById[entite.entite.id]) {
this.allEntitesById[entite.entite.id] = entite; this.allEntitesById[entite.entite.id] = entite;
this.allEntitesById[entite.entite.id].cid = concernement.id; this.allEntitesById[entite.entite.id].cid = concernement.id;
} }
// PROXIMITES // Do not integrate the entite if not active
if (entite.entite.proximite.length) { if(entite.active){
// console.log("proximite", entite.entite.proximite); // record entite agissante
concernement.has_proximites = true; if (entite.entite.agissante) {
} if (!concernement.entitesagissantes_byid[entite.entite.id]) {
concernement.entitesagissantes_byid[entite.entite.id] = entite;
// SUPERPOSITIONS }
if (entite.entite.superposition.length) { concernement.has_agissantes = true;
// create properties for later
if (init) {
concernement.superpositions = {};
concernement.superposition_constraints_id = {};
concernement.all_superposed_concernements_id = [];
concernement.superposed_mapitem_id_by_mapitem_id = {};
} }
entite.entite.superposition.forEach(entite_superpose => { // PROXIMITES
// console.log(`superposition eid:${entite.entite.id}, teid:${entite_superpose.id}`); if (entite.entite.proximite.length) {
let already_recorded = false; // console.log("proximite", entite.entite.proximite);
// loop through all already recorded superposition to complete the array instead of create duplicates concernement.has_proximites = true;
// TODO check if target cid and eid are accessible before recording the superposition }
// check if half of the superpositions is already recorded, if yes complete it (add the missing concernement id)
for(let superposition of temp_allSuperpositions) { // SUPERPOSITIONS
for(let superposition_item of superposition) { if (entite.entite.superposition.length) {
if (superposition_item.eid === entite.entite.id && !superposition_item.cid) { // create properties for later
// console.log(`already_recorded, eid:${entite.entite.id}, teid:${entite_superpose.id}`, entite.entite.title); if (init) {
already_recorded = true; concernement.superpositions = {};
superposition_item.cid = concernement.id; concernement.superposition_constraints_id = {};
concernement.all_superposed_concernements_id = [];
concernement.superposed_mapitem_id_by_mapitem_id = {};
}
entite.entite.superposition.forEach(entite_superpose => {
// console.log(`superposition eid:${entite.entite.id}, teid:${entite_superpose.id}`);
let already_recorded = false;
// loop through all already recorded superposition to complete the array instead of create duplicates
// TODO check if target cid and eid are accessible before recording the superposition
// check if half of the superpositions is already recorded, if yes complete it (add the missing concernement id)
for(let superposition of temp_allSuperpositions) {
for(let superposition_item of superposition) {
if (superposition_item.eid === entite.entite.id && !superposition_item.cid) {
// console.log(`already_recorded, eid:${entite.entite.id}, teid:${entite_superpose.id}`, entite.entite.title);
already_recorded = true;
superposition_item.cid = concernement.id;
break;
}
}
if (already_recorded) {
break; break;
} }
} }
if (already_recorded) { // if not already recorded, add it to the array. It is incomplete has it's missing one concernement id wich will be filled in next loops
break; if (!already_recorded) {
} // console.log(`NOT already_recorded, eid:${entite.entite.id}, teid:${entite_superpose.id}`, entite.entite.title);
} let s = [
// if not already recorded, add it to the array. It is incomplete has it's missing one concernement id wich will be filled in next loops {
if (!already_recorded) { cid: concernement.id,
// console.log(`NOT already_recorded, eid:${entite.entite.id}, teid:${entite_superpose.id}`, entite.entite.title); eid: entite.entite.id
let s = [ },
{ {
cid: concernement.id, cid: null,
eid: entite.entite.id eid: entite_superpose.id
}, }
{ ];
cid: null, // concernement.superpositions.push(s);
eid: entite_superpose.id temp_allSuperpositions.push(s);
}
];
// concernement.superpositions.push(s);
temp_allSuperpositions.push(s);
} }
}) })
}
} }
} }
}); // end of concernement.entites loop }); // end of concernement.entites loop
@ -317,7 +324,7 @@ export const ConcernementsStore = defineStore({
}, },
reloadConcernementEntites(nid){ reloadConcernementEntites(nid){
let tmp_conc = this.concernementsByID[nid]; let tmp_conc = this.concernementsByID[nid];
console.log(`reloadConcernementEntites len: ${tmp_conc.entites.length} revision: ${tmp_conc.revision_id} nid: ${nid}`); console.log(`reloadConcernementEntites len: ${tmp_conc.entites.length} revision: ${tmp_conc.revision_id} nid: ${nid} ${Math.random()*10000}`);
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const ast = gql`{ const ast = gql`{
concernement(id:${nid}) { concernement(id:${nid}) {
@ -325,8 +332,10 @@ export const ConcernementsStore = defineStore({
entites { entites {
id id
revision_id revision_id
active
menacemaintien menacemaintien
actuelfuture actuelfuture
prise
entite { entite {
title title
id id
@ -346,6 +355,9 @@ export const ConcernementsStore = defineStore({
revision_id revision_id
changed changed
entites { entites {
id
revision_id
active
menacemaintien menacemaintien
prise prise
actuelfuture actuelfuture
@ -377,15 +389,17 @@ export const ConcernementsStore = defineStore({
// records and/or merge into general object and on conernement entitites_byid // records and/or merge into general object and on conernement entitites_byid
tmp_conc.entites.forEach(entite => { tmp_conc.entites.forEach(entite => {
entite.cid = tmp_conc.id; entite.cid = tmp_conc.id;
if (this.allEntitesById[entite.entite.id]) { if(entite.entite){
_assign(this.allEntitesById[entite.entite.id], entite); if (this.allEntitesById[entite.entite.id]) {
}else{ _assign(this.allEntitesById[entite.entite.id], entite);
this.allEntitesById[entite.entite.id] = entite; }else{
} this.allEntitesById[entite.entite.id] = entite;
if (tmp_conc.entites_byid[entite.entite.id]) { }
_assign(tmp_conc.entites_byid[entite.entite.id], entite); if (tmp_conc.entites_byid[entite.entite.id]) {
}else{ _assign(tmp_conc.entites_byid[entite.entite.id], entite);
tmp_conc.entites_byid[entite.entite.id] = entite; }else{
tmp_conc.entites_byid[entite.entite.id] = entite;
}
} }
}); });
// add and/or merge revisions // add and/or merge revisions
@ -532,6 +546,106 @@ export const ConcernementsStore = defineStore({
}) })
}); });
}, },
reloadConcernementCerclePol(nid){
// let tmp_conc = this.concernementsByID[nid];
// console.log(`reloadConcernementCerclePol nid: ${nid} ${Math.random()*10000}`);
return new Promise((resolve, reject) => {
const ast = gql`{
concernement(id:${nid}) {
id
doleances {
id
author
bundle
path
title
uuid
#1
date_leprobleme {
start
}
leprobleme
lenquete
groupesinterets {
date {
end
start
}
groupe_interets
accorder_interets
formuler
}
#2
date_adresse {
start
}
entite_addresse_doleance
comment_ennonce_doleance
aqui_addresse_doleance
reception_traitement {
date {
end
start
}
entite_adressee
doleance_formulee
traite_doleance
entite_recoit_doleance
}
#3
date_decision {
start
}
entites_decisionnaires
decision_formule
mise_en_oeuvre_decision {
date {
end
start
}
entite_adresse_decision
formule_decision
entite_metenoeuvre_decisio
}
#4
date_application {
start
}
entite_adresse_application
aqui_adresse_decision
comment_formule_decision
receptions_et_applications {
date {
end
start
}
applique_decision
formule_decision_applic
entite_recoit_decision
}
probleme_initial_resolu
oui_nouvelle_situation
non_adresse_doleance
}
}
}
`
// console.log('ast', ast);
GQL.post('', { query: print(ast) })
.then(({ data : { data : { concernement } } }) => {
console.log(`reloadConcernementCerclePol loaded len: ${concernement.doleances.length} revision: ${concernement.revision_id}`, concernement)
let tmp_conc = this.concernementsByID[concernement.id];
// merge old concernement entites with new once
_assign(tmp_conc.doleances, concernement.doleances);
resolve(concernement);
})
.catch(error => {
console.warn('Issue with reloadConcernementCerclePol', error)
reject(error);
Promise.reject(error)
})
});
},
loadContentTypeDefinition () { loadContentTypeDefinition () {
const body = { const body = {
query: ` query: `
@ -644,7 +758,7 @@ export const ConcernementsStore = defineStore({
openCloseConcernements (cid, mi_id) { openCloseConcernements (cid, mi_id) {
console.log(`openCloseConcernements cid: ${cid}, mi_id: ${mi_id}`); console.log(`openCloseConcernements cid: ${cid}, mi_id: ${mi_id}`);
var state; var state;
let mapitem_id = mi_id ? mi_id : this.concernementsByID[cid].mapitems_ids[0]; let mapitem_id = mi_id ? mi_id : cid ? this.concernementsByID[cid].mapitems_ids[this.concernementsByID[cid].mapitems_ids.length -1] : null;
this.opened_concernement = null; this.opened_concernement = null;
this.opened_recit = null; this.opened_recit = null;
this.concernements.forEach((c, i) => { this.concernements.forEach((c, i) => {
@ -692,7 +806,7 @@ export const ConcernementsStore = defineStore({
// }) // })
}, },
setOpenedDoleance(cid, did){ setOpenedDoleance(cid, did){
console.log(`setOpenedDoleance(${cid}, ${did})`, cid, did); console.log(`setOpenedDoleance cid:${cid}, did:${did})`, cid, did);
this.concernementsByID[cid].opened_doleance = {id: did}; this.concernementsByID[cid].opened_doleance = {id: did};
// console.log('this.opened_concernement.opened_doleance', this.opened_concernement.opened_doleance); // console.log('this.opened_concernement.opened_doleance', this.opened_concernement.opened_doleance);
}, },