diff --git a/package-lock.json b/package-lock.json index 8ab62d8..3013f77 100644 --- a/package-lock.json +++ b/package-lock.json @@ -25,6 +25,7 @@ "vue-easy-lightbox": "^1.16.0", "vue-plyr": "^7.0.0", "vue-router": "^4.1.5", + "vue-select": "^4.0.0-beta.6", "vue-slider-component": "^4.1.0-beta.7" }, "devDependencies": { @@ -3801,6 +3802,14 @@ "vue": "^3.2.0" } }, + "node_modules/vue-select": { + "version": "4.0.0-beta.6", + "resolved": "https://registry.npmjs.org/vue-select/-/vue-select-4.0.0-beta.6.tgz", + "integrity": "sha512-K+zrNBSpwMPhAxYLTCl56gaMrWZGgayoWCLqe5rWwkB8aUbAUh7u6sXjIR7v4ckp2WKC7zEEUY27g6h1MRsIHw==", + "peerDependencies": { + "vue": "3.x" + } + }, "node_modules/vue-slider-component": { "version": "4.1.0-beta.7", "resolved": "https://registry.npmjs.org/vue-slider-component/-/vue-slider-component-4.1.0-beta.7.tgz", @@ -6589,6 +6598,12 @@ "@vue/devtools-api": "^6.5.0" } }, + "vue-select": { + "version": "4.0.0-beta.6", + "resolved": "https://registry.npmjs.org/vue-select/-/vue-select-4.0.0-beta.6.tgz", + "integrity": "sha512-K+zrNBSpwMPhAxYLTCl56gaMrWZGgayoWCLqe5rWwkB8aUbAUh7u6sXjIR7v4ckp2WKC7zEEUY27g6h1MRsIHw==", + "requires": {} + }, "vue-slider-component": { "version": "4.1.0-beta.7", "resolved": "https://registry.npmjs.org/vue-slider-component/-/vue-slider-component-4.1.0-beta.7.tgz", diff --git a/package.json b/package.json index 24079f3..36c6de7 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,7 @@ "vue-easy-lightbox": "^1.16.0", "vue-plyr": "^7.0.0", "vue-router": "^4.1.5", + "vue-select": "^4.0.0-beta.6", "vue-slider-component": "^4.1.0-beta.7" }, "devDependencies": { diff --git a/src/assets/main.scss b/src/assets/main.scss index 0c3cc1c..ce60898 100644 --- a/src/assets/main.scss +++ b/src/assets/main.scss @@ -299,15 +299,11 @@ body{ // CERCLE POLITIQUE section.content-doleances{ - >section.doleance{ - >header{ - + >main{ + padding: 1em 0; + h5{ + margin: 0 0 1em 0; } - >main{ - overflow-y: hidden; - height:0.1px; - } - } label{ margin:0; @@ -320,7 +316,44 @@ body{ ul{ // padding:0 0 0 1em; } - + + .v-select{ + input.vs__search{ + display: none; + } + div.vs__dropdown-toggle{ + border-radius: 0; + border: none; + } + div.vs__selected-options{ + padding: 0; + span.vs__selected{ + padding: 0; + margin: 0; + font-weight: 400; + font-size: 1.323em; + color:inherit; + line-height: 1.15; + } + } + ul.vs__dropdown-menu{ + border-radius: 0; + border: none; + li.vs__dropdown-option{ + white-space:normal; + padding:1em 1em 0 1em; + &:last-of-type{ + padding:1em; + } + color: #aaa; + transition: color 0.2s ease-in-out; + &.vs__dropdown-option--highlight{ + color:#000; + background-color: #fff; + } + } + } + } } } diff --git a/src/components/ConcernementMapItem.vue b/src/components/ConcernementMapItem.vue index 137dce2..32ea5c0 100644 --- a/src/components/ConcernementMapItem.vue +++ b/src/components/ConcernementMapItem.vue @@ -727,37 +727,6 @@ export default { // let fontsize = 4; - // TODO POINTS CARDINAUX - // // - // // le problème - // // - // g.addChild(new paper.Path.Circle({ - // center: [this.pos.x, this.pos.y + r], - // radius: 0.5, - // style: { - // fillColor: '#fff' - // } - // })); - // g.addChild(new paper.Path.Line({ - // from: [this.pos.x, this.pos.y + r], - // to: [this.pos.x, this.pos.y + r + 8], - // strokeColor: '#fff' - // })); - // g.addChild(new paper.PointText({ - // point: [this.pos.x, this.pos.y + r + 10], - // content: "Début du cercle\nLe problème (injustice, indignation, plainte...)", - // fontSize: fontsize, - // fillColor: '#000', - // justification: 'center' - // })); - // g.addChild(new paper.PointText({ - // point: [this.pos.x, this.pos.y + r + 16], - // content: doleance['leprobleme'], - // fontSize: 2.3, - // fillColor: '#fff', - // justification: 'center' - // })); - // // CAMENBERT STATIQUES // @@ -889,6 +858,70 @@ export default { } }); + + // POINTS CARDINAUX + // + // // leprobleme + // g.addChild(new paper.Path.Circle({ + // center: [this.pos.x, this.pos.y + r], + // radius: 3, + // style: { + // strokeColor: '#fff', + // strokeWidth: 2, + // fillColor: "rgba(255, 255, 255, 0.4)", + // }, + // item_type: 'doleance_step', + // item_id: `leprobleme`, + // did: doleance.id, + // field: 'leprobleme' + // })); + + // adresse de la doleance + g.addChild(new paper.Path.Circle({ + center: [this.pos.x - r, this.pos.y], + radius: 3, + style: { + strokeColor: '#fff', + strokeWidth: 2, + fillColor: "rgba(255, 255, 255, 0.9)", + }, + item_type: 'doleance_step', + item_id: `adresse_de_la_doleance`, + did: doleance.id, + field: 'adresse_de_la_doleance' + })); + + // decision + g.addChild(new paper.Path.Circle({ + center: [this.pos.x, this.pos.y - r], + radius: 3, + style: { + strokeColor: '#fff', + strokeWidth: 2, + fillColor: "rgba(255, 255, 255, 0.9)", + }, + item_type: 'doleance_step', + item_id: `decision`, + did: doleance.id, + field: 'decision' + })); + + // adresse_de_la_decision + g.addChild(new paper.Path.Circle({ + center: [this.pos.x + r, this.pos.y], + radius: 3, + style: { + strokeColor: '#fff', + strokeWidth: 2, + fillColor: "rgba(255, 255, 255, 0.9)", + }, + item_type: 'doleance_step', + item_id: `adresse_de_la_decision`, + did: doleance.id, + field: 'adresse_de_la_decision' + })); + + return g; }, // PAPER VISIBILITY @@ -1001,7 +1034,7 @@ export default { this.paper_main_object.children.doleances.visible = true; // display the right (opened) doleance this.concernement.doleances.forEach((d) => { - this.paper_main_object.children.doleances.children[`doleance_${d.id}`].visible = d.id === this.concernement.opened_doleance; + this.paper_main_object.children.doleances.children[`doleance_${d.id}`].visible = d.id === this.concernement.opened_doleance.id; }) } } else { @@ -1049,7 +1082,7 @@ export default { paper_group_tohit = this.paper_main_object.children['puissanceagir_besoins']; break; case "doleancer": - paper_group_tohit = this.paper_main_object.children['doleances'].children[`doleance_${this.concernement.opened_doleance}`]; + paper_group_tohit = this.paper_main_object.children['doleances'].children[`doleance_${this.concernement.opened_doleance.id}`]; break; } @@ -1112,7 +1145,7 @@ export default { group_to_hit = this.paper_main_object.children['agissantes']; break; case "doleancer": - group_to_hit = this.paper_main_object.children['doleances'].children[`doleance_${this.concernement.opened_doleance}`]; + group_to_hit = this.paper_main_object.children['doleances'].children[`doleance_${this.concernement.opened_doleance.id}`]; break; } if (group_to_hit) { diff --git a/src/components/MapConcernements.vue b/src/components/MapConcernements.vue index 7f2da95..b555895 100644 --- a/src/components/MapConcernements.vue +++ b/src/components/MapConcernements.vue @@ -444,7 +444,7 @@ export default { let pos = {x:0,y:0}; var r = ray * 0.8; // ray var dr = r/2; // demi ray - var pcr = 2; // petits cercle rayon + var pcr = 3; // petits cercle rayon // https://fr.wikipedia.org/wiki/Trigonom%C3%A9trie#/media/Fichier:Unit_circle_angles_color.svg // https://fr.wikipedia.org/wiki/Identit%C3%A9_trigonom%C3%A9trique_pythagoricienne#Preuve_utilisant_le_cercle_unit%C3%A9 @@ -530,7 +530,7 @@ export default { new paper.Path.Circle({ center: [0, r], radius: pcr, - style: style + style: {...style, ...{fillColor: 'rgba(255,255,255,0.9)'}}, }), new paper.Path.Circle({ center: [r, 0], @@ -586,36 +586,36 @@ export default { // haut new paper.Path({ segments: [ - [-2, -dr*1.5 - 2], + [-4, -dr*1.5 - 4], [0, -dr*1.5], - [-2, -dr*1.5 + 2] + [-4, -dr*1.5 + 4] ], style: felchesstyle }), // bas new paper.Path({ segments: [ - [2, dr*1.5 - 2], + [4, dr*1.5 - 4], [0, dr*1.5], - [2, dr*1.5 + 2] + [4, dr*1.5 + 4] ], style: felchesstyle }), // gauche new paper.Path({ segments: [ - [-dr*1.5 - 2, 2], + [-dr*1.5 - 4, 4], [-dr*1.5, 0], - [-dr*1.5 + 2, 2] + [-dr*1.5 + 4, 4] ], style: felchesstyle }), // droite new paper.Path({ segments: [ - [dr*1.5 - 2, -2], + [dr*1.5 - 4, -4], [dr*1.5, 0], - [dr*1.5 + 2, -2] + [dr*1.5 + 4, -4] ], style: felchesstyle }), diff --git a/src/components/contents/Doleancer.vue b/src/components/contents/Doleancer.vue index a00664b..bfa47d3 100644 --- a/src/components/contents/Doleancer.vue +++ b/src/components/contents/Doleancer.vue @@ -7,11 +7,15 @@ import { CommonStore } from '@/stores/common' import CartoucheLayout from '@components/layout/CartoucheLayout.vue'; +import vSelect from 'vue-select'; +import 'vue-select/dist/vue-select.css'; + export default { props: ['id'], data(){ return { - + doleance: null, + doleance_selected: null } }, computed: { @@ -25,21 +29,58 @@ export default { 'p_mise_en_oeuvre_decision', 'p_reception_application_decision' ]), - ...mapState(CommonStore,['hover_elmt']) - + ...mapState(CommonStore,['hover_elmt']), + doleances_select_options () { + let os = []; + this.opened_concernement.doleances.forEach((doleance, index) => { + let o = { + label: doleance.leprobleme, + id: doleance.id + } + if (doleance.id === this.opened_concernement.opened_doleance.id) { + this.doleance_selected = o; + } + os.push(o); + }) + return os; + }, + // doleances_select_value () { + // let value; + // this.opened_concernement.doleances.forEach((doleance, index) => { + // if (doleance.id === this.opened_concernement.opened_doleance.id) { + // value = { + // label: doleance.leprobleme, + // id: doleance.id + // } + // } + // }); + // return value; + // } }, created () { console.log(`Doleancer content created, id: ${this.id}, opened_concernement:`,this.opened_concernement); + this.opened_concernement.doleances.forEach((doleance, index) => { + if (doleance.id === this.opened_concernement.opened_doleance.id) { + this.doleance = doleance; + } + }); }, methods: { ...mapActions(ConcernementsStore,['setOpenedDoleance']), - openDoleance(did){ - console.log('openDoleance', did); - this.setOpenedDoleance(parseInt(this.id), did) + onDoleanceSelected(option){ + console.log('openDoleance', option); + this.setOpenedDoleance(parseInt(this.id), option.id) + + this.opened_concernement.doleances.forEach((doleance, index) => { + if (option.id === this.opened_concernement.opened_doleance.id) { + this.doleance = doleance; + } + }); } }, components: { - CartoucheLayout + CartoucheLayout, + vSelect } } @@ -56,108 +97,179 @@ export default { diff --git a/src/stores/concernements.js b/src/stores/concernements.js index 5b921db..08fc0eb 100644 --- a/src/stores/concernements.js +++ b/src/stores/concernements.js @@ -88,7 +88,9 @@ export const ConcernementsStore = defineStore({ // doleance concernement.has_doleance = concernement.doleances.length ? true : false; if (concernement.has_doleance) { - concernement.opened_doleance = concernement.doleances[0].id; + concernement.opened_doleance = { + id: concernement.doleances[0].id + }; } // recit @@ -268,16 +270,16 @@ export const ConcernementsStore = defineStore({ }, setOpenedDoleance(cid, did){ console.log(`setOpenedDoleance(${cid}, ${did})`, cid, did); - this.concernementsByID[cid].opened_doleance = did; + this.concernementsByID[cid].opened_doleance = {id: did}; // console.log('this.opened_concernement.opened_doleance', this.opened_concernement.opened_doleance); }, setOpenedDoleanceField(cid, did, field, index){ - console.log(`setOpenedDoleanceField`, cid, did, field, index); - this.concernementsByID[cid].opened_doleance_field = { + console.log(`setOpenedDoleanceField cid, did, field, index`, cid, did, field, index); + this.concernementsByID[cid].opened_doleance = { cid: cid, - did: did, + id: did, field: field, - index: index + field_index: index }; } }