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 {
id
revision_id
active
menacemaintien
actuelfuture
entite {
@ -50,6 +51,9 @@ fragment ConcernementFields on Concernement {
revision_id
changed
entites {
id
revision_id
active
menacemaintien
prise
actuelfuture

View File

@ -31,6 +31,7 @@ export default {
concernement: null,
active_revision: null,
entities: null,
activeEntites: null,
superposedEntiteID: null,
// superposedEntitesIDsList: [],
canvas: null,
@ -95,7 +96,7 @@ export default {
...mapState(UserStore,['csrf_token']),
},
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;
// console.log(`this.mapitem.id`, this.mapitem.id);
this.resetConcernement();
@ -116,9 +117,9 @@ export default {
//
this.parseEntityPointsValues();
let activeEntites = this.getActiveEntites(this.entites);
// 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
this.pos = this.getRandomPos();
@ -268,7 +269,7 @@ export default {
},
concernement: {
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
// do not trigger on first variable filling (if o is null)
// check for new concernement object
@ -297,7 +298,7 @@ export default {
},
'concernement.besoins': {
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") {
// this.resetPaperBesoinReponsePos();
this.setPaperPuissanceagirBesoins(true); // true for update=true
@ -307,7 +308,7 @@ export default {
},
'concernement.besoins.length': {
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) {
this.resetPaperContents();
}
@ -367,7 +368,7 @@ export default {
},
'concernement.entites': {
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)
if (o) {
this.resetPaperEntitesAndContours();
@ -400,7 +401,7 @@ export default {
'setDetailsZoomValue',
]),
resetConcernement(){
console.log(`resetConcernement() ${this.mapitem.id}`);
// console.log(`resetConcernement() ${this.mapitem.id}`);
this.id = this.mapitem.id;
this.concernement = this.concernementsByID[this.mapitem.cid];// this.mapitem.concernement;
this.cid = this.concernement.id;
@ -409,10 +410,17 @@ export default {
// console.log(`ConcernementsMapItem ${this.id} created`);
// 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 (){
console.log(`parseEntityPointsValues`);
// console.log(`parseEntityPointsValues`);
// 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 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;
},
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() {
// debugger
// console.log(this.entites);
@ -493,6 +512,12 @@ export default {
// console.log(`this.salientPoints ${this.concernement.id}`, this.salientPoints);
},
getJarvisEnvelopeConvexeEntites(entites){
// console.log(`getJarvisEnvelopeConvexeEntites cid:${this.cid}`, entites);
if (entites.length === 0) {
console.error('getJarvisEnvelopeConvexeEntites entites must not be empty')
return;
}
let sailentEntites = [];
// https://www.geeksforgeeks.org/convex-hull-using-jarvis-algorithm-or-wrapping/
// find the most left point
@ -523,19 +548,21 @@ export default {
// clockwise than q, then update q.
q = (p + 1) % entites.length;
for (let i = 0; i < entites.length; i++) {
let p_x = (entites[p].display.ray) * Math.cos(entites[p].display.alpha * (Math.PI/180));
let p_y = (entites[p].display.ray) * Math.sin(entites[p].display.alpha * (Math.PI/180));
let i_x = (entites[i].display.ray) * Math.cos(entites[i].display.alpha * (Math.PI/180));
let i_y = (entites[i].display.ray) * Math.sin(entites[i].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);
// If i is more clockwise than current q, then update q
if (val > 0){
q = i;
}
// if (entite.active) {
let p_x = (entites[p].display.ray) * Math.cos(entites[p].display.alpha * (Math.PI/180));
let p_y = (entites[p].display.ray) * Math.sin(entites[p].display.alpha * (Math.PI/180));
let i_x = (entites[i].display.ray) * Math.cos(entites[i].display.alpha * (Math.PI/180));
let i_y = (entites[i].display.ray) * Math.sin(entites[i].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);
// If i is more clockwise than current q, then update q
if (val > 0){
q = i;
}
// }
}
// Now q is the most clockwise with
@ -810,7 +837,8 @@ export default {
});
// rebuild the contours with the new ray
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
this.paper_main_object.addChild(this.setPaperContour());
@ -909,8 +937,9 @@ export default {
console.log(`entite len : ${this.concernement.revisions_byid[this.active_revision].entites.length}`);
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
if (this.paper_main_object.children && this.paper_main_object.children.contours) {
@ -960,7 +989,7 @@ export default {
}
},
getPaddedRoundedSegments(points, scale){
console.log(`setPaperContour ${this.concernement.id}, points`, points);
// console.log(`setPaperContour ${this.concernement.id}, points`, points);
let getSegmentProps = (b,a,c) => {
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
@ -1077,6 +1106,8 @@ export default {
},
setPaperEntites(){
console.log(`setPaperEntites ${this.cid}`);
let g = new paper.Group({
pivot: new paper.Point(this.pos),
name: 'entites'
@ -1091,25 +1122,32 @@ export default {
// for (let i = 0; i < this.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];
console.log('entite', entite);
if (!entite.active && !this.concernement.can_update) {
continue;
}
// 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
let symbol_name = item_type;
switch (item_type) {
case 'entite':
if(parseInt(this.opened_entite_id) === entite.entite.id){
if(entite.entite && parseInt(this.opened_entite_id) === entite.entite.id){
switch (item_type) {
case 'entite':
symbol_name = 'entite_hover';
}
break;
case 'entite_action':
if(parseInt(this.opened_entite_id) === entite.entite.id){
break;
case 'inactive_entite':
symbol_name = 'entite_inactive_hover';
break;
case 'entite_action':
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]);
instance.name = 'entite';
@ -1122,7 +1160,8 @@ export default {
instance.is_symbol_instance = true;
g.addChild(instance);
// instance.bringToFront();
console.log('instance', instance);
if (entite.entite && entite.entite.title) {
let pad = 2;
let label_pos = new paper.Point({
@ -1174,6 +1213,8 @@ export default {
instance.label_item = label;
}
}
console.log(`g`, g);
return g;
},
setPaperEntitesSuperposees(){
@ -1391,9 +1432,10 @@ export default {
}); // end of loop on proximite for each main entite
let activeEntites = this.getActiveEntites(allEntiteRefConcernementContourEntites);
// general contour arround proximité
// console.log('allEntiteRefConcernementContourEntites', allEntiteRefConcernementContourEntites);
let genContoursEntite = this.getJarvisEnvelopeConvexeEntites(allEntiteRefConcernementContourEntites);
let genContoursEntite = this.getJarvisEnvelopeConvexeEntites(activeEntites);
// console.log('genContoursEntite', genContoursEntite);
let points = [];
genContoursEntite.forEach(ent => {
@ -2125,11 +2167,15 @@ export default {
group.children.forEach((item) => {
if (this.opened_entite_id && item.item_id === parseInt(this.opened_entite_id) && item.item_type !== 'entite_hidden') {
// 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 {
// switch back symbole definition to normal
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: {
parseInfos(){
// console.log('mapPopup infos', this.infos);
console.log('mapPopup infos', this.infos);
switch (this.infos.type) {
case 'concernement':
this.concernement = this.concernementsByID[this.infos.cid];
break;
case 'entite':
case 'entite_inactive':
case 'entite_proximite':
case 'entite_superpose':
case 'entite_action':
@ -156,7 +157,7 @@ export default {
</div>
</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
v-for="(entite, index) of entites"
:key="index"

View File

@ -405,8 +405,10 @@ export default {
// this.addPaperSymbolDefinition('doleance_icon', this.setPaperDoleanceICONSymbol());
if (!update) {
this.addPaperSymbolDefinition('entite', this.setPaperEntiteSymbol());
this.addPaperSymbolDefinition('entite_hidden', this.setPaperHiddenEntiteSymbol());
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', this.setPaperEntiteActionSymbol());
this.addPaperSymbolDefinition('entite_action_hover', this.setPaperEntiteActionHoverSymbol());
@ -1089,6 +1091,16 @@ export default {
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(){
return new paper.Path.Circle({
pivot: new paper.Point({x:0,y:0}),
@ -1099,16 +1111,74 @@ export default {
strokeWidth:2
})
},
setPaperEntiteHoverSymbol(){
setPaperInactiveEntiteSymbol(){
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)',
radius: 0.5, //0.3
fillColor: '#F00',
strokeColor: 'rgba(255,0,0,0.05)',
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(){
// let svgIcon = paper.project.importSVG(iconAction);
// svgIcon.strokeWidth = 0.8;

View File

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

View File

@ -11,6 +11,11 @@ import SvgIcon from '@jamescoyle/vue-icon';
import { mdiArrowLeft } 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 {
props: ['cid'],
data(){
@ -31,7 +36,8 @@ export default {
'p_groupes_interets',
'p_reception_et_traitement',
'p_mise_en_oeuvre_decision',
'p_reception_application_decision'
'p_reception_application_decision',
'reloadConcernementCerclePol'
]),
...mapState(CommonStore,['hover_elmt'])
},
@ -44,6 +50,7 @@ export default {
this.doleance_index = index;
}
});
},
mounted() {
if (this.doleance_index > 0)
@ -71,8 +78,9 @@ export default {
this.openDoleance()
},
openDoleance(){
console.log('openDoleance');
this.doleance = this.concernement.doleances[this.doleance_index];
console.log('openDoleance', this.doleance);
this.setOpenedDoleance(parseInt(this.cid), this.doleance.id);
setTimeout((function(that){
return function(){
@ -88,7 +96,10 @@ export default {
},
components: {
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">
<span class="date">{{ doleance.date_leprobleme.start }}</span>
<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

View File

@ -233,6 +233,14 @@ export default {
.then(({data: { data: { entite }}}) => {
console.log('load entite loaded', 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.checkForUserProxmite();
})
@ -567,6 +575,18 @@ export default {
</div>
</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 -->
<CheckboxEditable
v-if="entite && entite.can_update"
@ -575,9 +595,9 @@ export default {
:data="{
entitytype: 'node',
bundle: 'entite',
nid: this.entite.id,
field: 'field_entite_agissante'
}" />
id: this.entite.id,
field: 'field_entite_agissante'}"
v-on:updated="reloadConcernementEntites(cid)"/>
<SelectEditable
v-if="entite && entite.can_update"
@ -586,15 +606,13 @@ export default {
:options="{
'confidentialite_prive': 'privé',
'confidentialite_interne': 'interne',
'confidentialite_public': 'public'
}"
'confidentialite_public': 'public'}"
:data="{
entitytype: 'node',
bundle: 'entite',
nid: this.entite.id,
field: 'field_confidentialite'
}" />
field: 'field_confidentialite'}"
v-on:updated="reloadConcernementEntites(cid)"/>
</div>

View File

@ -38,17 +38,24 @@ export default {
},
save(checked){
// console.log('save csrf_token', this.csrf_token);
const params = {
let params = {
type: this.data.bundle,
nid: [{"value":this.data.nid}],
// nid: [{"value":this.data.nid}],
[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 = {
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 }) => {
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
// this.reloadConcernements();
this.$emit('updated');

View File

@ -51,11 +51,14 @@ export default {
this.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 = {
headers: {
'X-CSRF-Token': this.csrf_token,
'Content-Type': 'application/octet-stream',
'Content-Disposition': `file; filename="${file.name}"`,
'Content-Disposition': `file; filename="${filename}"`,
},
};

View File

@ -71,12 +71,16 @@ export default {
const $li = this.$refs.links_list.children[i];
if ($li.querySelector('input.url').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({
title: title,
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) {

View File

@ -74,7 +74,7 @@ export const ConcernementsStore = defineStore({
// console.log('ast', ast);
GQL.post('', { query: print(ast) })
.then(({ data : { data : { allconcernements } } }) => {
console.log('loadconcernements loaded', allconcernements)
console.log('|||||||||||| loadconcernements loaded ||||||||||||||||||', allconcernements)
this.concernements = [];
this.parseConcernements(allconcernements, true)
this.concernements_loaded = true;
@ -108,73 +108,80 @@ export const ConcernementsStore = defineStore({
if (!concernement.entites_byid[entite.entite.id]) {
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
if (!this.allEntitesById[entite.entite.id]) {
this.allEntitesById[entite.entite.id] = entite;
this.allEntitesById[entite.entite.id].cid = concernement.id;
}
// PROXIMITES
if (entite.entite.proximite.length) {
// console.log("proximite", entite.entite.proximite);
concernement.has_proximites = true;
}
// SUPERPOSITIONS
if (entite.entite.superposition.length) {
// create properties for later
if (init) {
concernement.superpositions = {};
concernement.superposition_constraints_id = {};
concernement.all_superposed_concernements_id = [];
concernement.superposed_mapitem_id_by_mapitem_id = {};
// Do not integrate the entite if not active
if(entite.active){
// 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;
}
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;
// PROXIMITES
if (entite.entite.proximite.length) {
// console.log("proximite", entite.entite.proximite);
concernement.has_proximites = true;
}
// SUPERPOSITIONS
if (entite.entite.superposition.length) {
// 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 => {
// 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;
}
}
if (already_recorded) {
break;
// 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) {
// console.log(`NOT already_recorded, eid:${entite.entite.id}, teid:${entite_superpose.id}`, entite.entite.title);
let s = [
{
cid: concernement.id,
eid: entite.entite.id
},
{
cid: null,
eid: entite_superpose.id
}
];
// concernement.superpositions.push(s);
temp_allSuperpositions.push(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) {
// console.log(`NOT already_recorded, eid:${entite.entite.id}, teid:${entite_superpose.id}`, entite.entite.title);
let s = [
{
cid: concernement.id,
eid: entite.entite.id
},
{
cid: null,
eid: entite_superpose.id
}
];
// concernement.superpositions.push(s);
temp_allSuperpositions.push(s);
}
})
})
}
}
}
}); // end of concernement.entites loop
@ -317,7 +324,7 @@ export const ConcernementsStore = defineStore({
},
reloadConcernementEntites(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) => {
const ast = gql`{
concernement(id:${nid}) {
@ -325,8 +332,10 @@ export const ConcernementsStore = defineStore({
entites {
id
revision_id
active
menacemaintien
actuelfuture
prise
entite {
title
id
@ -346,6 +355,9 @@ export const ConcernementsStore = defineStore({
revision_id
changed
entites {
id
revision_id
active
menacemaintien
prise
actuelfuture
@ -377,15 +389,17 @@ export const ConcernementsStore = defineStore({
// records and/or merge into general object and on conernement entitites_byid
tmp_conc.entites.forEach(entite => {
entite.cid = tmp_conc.id;
if (this.allEntitesById[entite.entite.id]) {
_assign(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);
}else{
tmp_conc.entites_byid[entite.entite.id] = entite;
if(entite.entite){
if (this.allEntitesById[entite.entite.id]) {
_assign(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);
}else{
tmp_conc.entites_byid[entite.entite.id] = entite;
}
}
});
// 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 () {
const body = {
query: `
@ -644,7 +758,7 @@ export const ConcernementsStore = defineStore({
openCloseConcernements (cid, mi_id) {
console.log(`openCloseConcernements cid: ${cid}, mi_id: ${mi_id}`);
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_recit = null;
this.concernements.forEach((c, i) => {
@ -692,7 +806,7 @@ export const ConcernementsStore = defineStore({
// })
},
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};
// console.log('this.opened_concernement.opened_doleance', this.opened_concernement.opened_doleance);
},