From 55cb0698bd48012a05b49e0a303c793eb32f8677 Mon Sep 17 00:00:00 2001 From: bach Date: Fri, 29 Sep 2023 14:47:29 +0200 Subject: [PATCH] doleancer added arrow btn to go to previous and next doleance #2303 --- src/assets/main.scss | 21 ++++- src/components/ConcernementMapItem.vue | 8 +- src/components/contents/Doleancer.vue | 108 ++++++++++++------------- src/stores/concernements.js | 5 +- src/views/Concernement.vue | 4 +- 5 files changed, 80 insertions(+), 66 deletions(-) diff --git a/src/assets/main.scss b/src/assets/main.scss index e7075c5..a92bb3b 100644 --- a/src/assets/main.scss +++ b/src/assets/main.scss @@ -123,14 +123,14 @@ body{ } } } - + $cartouch_width : 450px; #content{ display: flex; gap: 0.5rem; @mixin main-cartouche{ background-color: rgba(255, 255, 255, 0.9); box-sizing: border-box; - width:450px; + width:$cartouch_width; height: 100%; padding: 1rem 1rem 1rem; overflow-y: auto; @@ -493,7 +493,6 @@ body{ list-style: none; } - } section.search{ @@ -578,6 +577,22 @@ body{ text-decoration: underline; } } + + nav.doleance-switch{ + div{ + position: fixed; + top: calc(100vh * 0.49); + cursor: pointer; + + &.prev{ + left: 1rem; + } + &.next{ + right:calc($cartouch_width + 2rem); + } + } + } + } #recit-player{ diff --git a/src/components/ConcernementMapItem.vue b/src/components/ConcernementMapItem.vue index 79fb9db..ca507da 100644 --- a/src/components/ConcernementMapItem.vue +++ b/src/components/ConcernementMapItem.vue @@ -69,12 +69,12 @@ export default { 'paper_symbol_definitions']) }, 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.mapitem.id; this.concernement = this.mapitem.concernement; this.cid = this.concernement.id; - console.log('mapitem this.cid', this.cid); + // console.log('mapitem this.cid', this.cid); this.active_revision = this.concernement.active_revision; // console.log(`ConcernementsMapItem ${this.id} created`); @@ -198,7 +198,7 @@ export default { }, active_revision: { handler (n, o) { - console.log(`concernementMapItem watch active_revision o:${o}, n:${n}`); + // console.log(`concernementMapItem watch active_revision o:${o}, n:${n}`); if(o & n){ // do not trigger on first variable filling (if o is null) this.resetPaperActiveRevision(); } @@ -406,7 +406,7 @@ export default { } } } - console.log('superposedEntitesIDsList', this.superposedEntitesIDsList); + // console.log('superposedEntitesIDsList', this.superposedEntitesIDsList); }, // MATTER BODY diff --git a/src/components/contents/Doleancer.vue b/src/components/contents/Doleancer.vue index 017f25c..1402ab8 100644 --- a/src/components/contents/Doleancer.vue +++ b/src/components/contents/Doleancer.vue @@ -7,21 +7,25 @@ import { CommonStore } from '@/stores/common' import CartoucheLayout from '@components/layout/CartoucheLayout.vue'; - -// import vSelect from 'vue-select'; -// import 'vue-select/dist/vue-select.css'; +import SvgIcon from '@jamescoyle/vue-icon'; +import { mdiArrowLeft } from '@mdi/js'; +import { mdiArrowRight } from '@mdi/js'; export default { props: ['cid'], data(){ return { doleance: null, - doleance_selected: null + doleance_selected: null, + doleance_index: null, + arrowleft_path: mdiArrowLeft, + arrowright_path: mdiArrowRight } }, computed: { ...mapState(ConcernementsStore,['map_mode', 'opened_concernement', + 'concernementsByID', 'concernements_loaded', 'ct_concernement', 'ct_cercle_politique', @@ -30,58 +34,37 @@ export default { 'p_mise_en_oeuvre_decision', 'p_reception_application_decision' ]), - ...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; - // } + ...mapState(CommonStore,['hover_elmt']) }, 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.concernement = this.concernementsByID[this.cid]; + console.log(`Doleancer content created, id: ${this.cid}, doleances:`,this.concernement.doleances); + this.concernement.doleances.forEach((doleance, index) => { + if (doleance.id === this.concernement.opened_doleance.id) { this.doleance = doleance; + this.doleance_index = index; } }); }, methods: { ...mapActions(ConcernementsStore,['setOpenedDoleance']), - 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; - } - }); + nextDoleance(){ + this.doleance_index ++; + this.openDoleance() + }, + prevDoleance(){ + this.doleance_index --; + this.openDoleance() + }, + openDoleance(){ + console.log('openDoleance'); + this.doleance = this.concernement.doleances[this.doleance_index]; + this.setOpenedDoleance(parseInt(this.cid), this.doleance.id); } }, components: { CartoucheLayout, - // vSelect + SvgIcon } } @@ -99,17 +82,6 @@ export default {
- -
@@ -294,6 +266,32 @@ export default { + diff --git a/src/stores/concernements.js b/src/stores/concernements.js index 1c51722..c318b56 100644 --- a/src/stores/concernements.js +++ b/src/stores/concernements.js @@ -109,7 +109,7 @@ export const ConcernementsStore = defineStore({ 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); + // console.log(`already_recorded, eid:${entite.entite.id}, teid:${entite_superpose.id}`, entite.entite.title); already_recorded = true; superposition_item.cid = concernement.id; break; @@ -121,7 +121,7 @@ export const ConcernementsStore = defineStore({ } // 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); + // console.log(`NOT already_recorded, eid:${entite.entite.id}, teid:${entite_superpose.id}`, entite.entite.title); let s = [ { cid: concernement.id, @@ -159,6 +159,7 @@ export const ConcernementsStore = defineStore({ // doleance concernement.has_doleance = concernement.doleances.length ? true : false; if (concernement.has_doleance) { + console.log('concernement has doleance', concernement.doleances); concernement.opened_doleance = { id: concernement.doleances[0].id }; diff --git a/src/views/Concernement.vue b/src/views/Concernement.vue index 2bc522e..e6bb045 100644 --- a/src/views/Concernement.vue +++ b/src/views/Concernement.vue @@ -161,8 +161,7 @@ export default { components: { TerrainDeVie, PuissanceAgir, - Doleancer, - SvgIcon + Doleancer } } @@ -186,6 +185,7 @@ export default { +