mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Merge branch '208-export-fix-loading-by-type-goal-result' into 'master'
Resolve "Export: le chargement de l'app vue de "filtrer les actions par type, objectif et résultat" ne se charge pas sur certains exports" Closes #208 See merge request Chill-Projet/chill-bundles!615
This commit is contained in:
commit
8719b4dedd
5
.changes/unreleased/Fixed-20231116-105642.yaml
Normal file
5
.changes/unreleased/Fixed-20231116-105642.yaml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
kind: Fixed
|
||||||
|
body: 'Export: fix loading of form for "filter action by type, goal and result"'
|
||||||
|
time: 2023-11-16T10:56:42.771516508+01:00
|
||||||
|
custom:
|
||||||
|
Issue: "208"
|
@ -1,7 +1,6 @@
|
|||||||
import {ShowHide} from 'ChillMainAssets/lib/show_hide/index';
|
import {ShowHide} from 'ChillMainAssets/lib/show_hide/index';
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', function(_e) {
|
document.addEventListener('DOMContentLoaded', function(_e) {
|
||||||
console.log('pick-rolling-date');
|
|
||||||
document.querySelectorAll('div[data-rolling-date]').forEach( (picker) => {
|
document.querySelectorAll('div[data-rolling-date]').forEach( (picker) => {
|
||||||
const
|
const
|
||||||
roll_wrapper = picker.querySelector('div.roll-wrapper'),
|
roll_wrapper = picker.querySelector('div.roll-wrapper'),
|
||||||
@ -11,12 +10,8 @@ document.addEventListener('DOMContentLoaded', function(_e) {
|
|||||||
froms: [roll_wrapper],
|
froms: [roll_wrapper],
|
||||||
container: [fixed_wrapper],
|
container: [fixed_wrapper],
|
||||||
test: function (elems) {
|
test: function (elems) {
|
||||||
console.log('testing');
|
|
||||||
console.log('elems', elems);
|
|
||||||
for (let el of elems) {
|
for (let el of elems) {
|
||||||
for (let select_roll of el.querySelectorAll('select[data-roll-picker]')) {
|
for (let select_roll of el.querySelectorAll('select[data-roll-picker]')) {
|
||||||
console.log('select_roll', select_roll);
|
|
||||||
console.log('value', select_roll.value);
|
|
||||||
return select_roll.value === 'fixed_date';
|
return select_roll.value === 'fixed_date';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,9 +28,7 @@
|
|||||||
{% block js %}
|
{% block js %}
|
||||||
{{ encore_entry_script_tags('mod_pickentity_type') }}
|
{{ encore_entry_script_tags('mod_pickentity_type') }}
|
||||||
{{ encore_entry_script_tags('page_export') }}
|
{{ encore_entry_script_tags('page_export') }}
|
||||||
{% if export_alias == 'count_social_work_actions' %}
|
{{ encore_entry_script_tags('vue_export_action_goal_result') }}
|
||||||
{{ encore_entry_script_tags('vue_export_action_goal_result') }}
|
|
||||||
{% endif %}
|
|
||||||
{{ encore_entry_script_tags('mod_pick_rolling_date') }}
|
{{ encore_entry_script_tags('mod_pick_rolling_date') }}
|
||||||
{% endblock js %}
|
{% endblock js %}
|
||||||
|
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
<template>
|
<template>
|
||||||
<teleport to="#export_filters_social_work_type_filter_form">
|
<teleport to="#export_filters_social_work_type_filter_form">
|
||||||
|
|
||||||
<fieldset class="mb-3" id="actionType">
|
<fieldset class="mb-3" id="actionType">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<legend class="col-sm-4 col-form-label">{{ $t('action.label')}}</legend>
|
<legend class="col-sm-4 col-form-label">{{ $t('action.label')}}</legend>
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
|
|
||||||
<VueMultiselect
|
<VueMultiselect
|
||||||
v-model="action"
|
v-model="action"
|
||||||
:options="actions.options"
|
:options="actions.options"
|
||||||
@ -18,16 +18,16 @@
|
|||||||
track-by="id"
|
track-by="id"
|
||||||
:searchable="true"
|
:searchable="true"
|
||||||
></VueMultiselect>
|
></VueMultiselect>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
<fieldset class="mb-3" id="goal">
|
<fieldset class="mb-3" id="goal">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<legend class="col-sm-4 col-form-label">{{ $t('goal.label')}}</legend>
|
<legend class="col-sm-4 col-form-label">{{ $t('goal.label')}}</legend>
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
|
|
||||||
<VueMultiselect
|
<VueMultiselect
|
||||||
v-model="goal"
|
v-model="goal"
|
||||||
:options="goals.options"
|
:options="goals.options"
|
||||||
@ -41,16 +41,16 @@
|
|||||||
track-by="id"
|
track-by="id"
|
||||||
:searchable="true"
|
:searchable="true"
|
||||||
></VueMultiselect>
|
></VueMultiselect>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
<fieldset class="mb-3" id="result">
|
<fieldset class="mb-3" id="result">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<legend class="col-sm-4 col-form-label">{{ $t('result.label')}}</legend>
|
<legend class="col-sm-4 col-form-label">{{ $t('result.label')}}</legend>
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
|
|
||||||
<VueMultiselect
|
<VueMultiselect
|
||||||
v-model="result"
|
v-model="result"
|
||||||
:options="results.options"
|
:options="results.options"
|
||||||
@ -64,11 +64,11 @@
|
|||||||
track-by="id"
|
track-by="id"
|
||||||
:searchable="true"
|
:searchable="true"
|
||||||
></VueMultiselect>
|
></VueMultiselect>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
</teleport>
|
</teleport>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -152,18 +152,18 @@ export default {
|
|||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.getSocialActionsList();
|
this.getSocialActionsList();
|
||||||
|
|
||||||
this.actions.hiddenField.value = '';
|
this.actions.hiddenField.value = '';
|
||||||
this.goals.hiddenField.value = '';
|
this.goals.hiddenField.value = '';
|
||||||
this.results.hiddenField.value = '';
|
this.results.hiddenField.value = '';
|
||||||
|
|
||||||
//console.log(this.actions.hiddenField, this.goals.hiddenField, this.results.hiddenField);
|
//console.log(this.actions.hiddenField, this.goals.hiddenField, this.results.hiddenField);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async getSocialActionsList() {
|
async getSocialActionsList() {
|
||||||
this.actions.options = await getSocialActions();
|
this.actions.options = await getSocialActions();
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Select/unselect in Action Multiselect
|
* Select/unselect in Action Multiselect
|
||||||
* @param value
|
* @param value
|
||||||
@ -172,7 +172,7 @@ export default {
|
|||||||
//console.log('----'); console.log('select action', value.id);
|
//console.log('----'); console.log('select action', value.id);
|
||||||
let children = this.getChildrensFromParent(value);
|
let children = this.getChildrensFromParent(value);
|
||||||
this.addSelectedElement('actions', children);
|
this.addSelectedElement('actions', children);
|
||||||
|
|
||||||
let parentAndChildren = [...[value], ...children];
|
let parentAndChildren = [...[value], ...children];
|
||||||
parentAndChildren.forEach(elem => {
|
parentAndChildren.forEach(elem => {
|
||||||
getGoalByAction(elem.id).then(response => new Promise((resolve, reject) => {
|
getGoalByAction(elem.id).then(response => new Promise((resolve, reject) => {
|
||||||
@ -185,7 +185,7 @@ export default {
|
|||||||
})).catch;
|
})).catch;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
unselectAction(value) {
|
unselectAction(value) {
|
||||||
//console.log('----'); console.log('unselect action', value.id);
|
//console.log('----'); console.log('unselect action', value.id);
|
||||||
getGoalByAction(value.id).then(response => new Promise((resolve, reject) => {
|
getGoalByAction(value.id).then(response => new Promise((resolve, reject) => {
|
||||||
@ -197,7 +197,7 @@ export default {
|
|||||||
resolve();
|
resolve();
|
||||||
})).catch;
|
})).catch;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Select/unselect in Goal Multiselect
|
* Select/unselect in Goal Multiselect
|
||||||
* @param value
|
* @param value
|
||||||
@ -209,7 +209,7 @@ export default {
|
|||||||
resolve();
|
resolve();
|
||||||
})).catch;
|
})).catch;
|
||||||
},
|
},
|
||||||
|
|
||||||
unselectGoal(value) {
|
unselectGoal(value) {
|
||||||
//console.log('----'); console.log('unselect goal', value.id);
|
//console.log('----'); console.log('unselect goal', value.id);
|
||||||
getResultByGoal(value.id).then(response => new Promise((resolve, reject) => {
|
getResultByGoal(value.id).then(response => new Promise((resolve, reject) => {
|
||||||
@ -217,7 +217,7 @@ export default {
|
|||||||
resolve();
|
resolve();
|
||||||
})).catch;
|
})).catch;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Select/unselect in Result Multiselect
|
* Select/unselect in Result Multiselect
|
||||||
* @param value
|
* @param value
|
||||||
@ -225,11 +225,11 @@ export default {
|
|||||||
selectResult(value) {
|
selectResult(value) {
|
||||||
//console.log('----'); console.log('select result', value.id);
|
//console.log('----'); console.log('select result', value.id);
|
||||||
},
|
},
|
||||||
|
|
||||||
unselectResult(value) {
|
unselectResult(value) {
|
||||||
//console.log('----'); console.log('unselect result', value.id);
|
//console.log('----'); console.log('unselect result', value.id);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Choose parent action will involve retaining the "children" actions.
|
* Choose parent action will involve retaining the "children" actions.
|
||||||
* @param value
|
* @param value
|
||||||
@ -244,7 +244,7 @@ export default {
|
|||||||
}
|
}
|
||||||
return [];
|
return [];
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add response elements in data target
|
* Add response elements in data target
|
||||||
* @param target string -> 'actions', 'goals' or 'results'
|
* @param target string -> 'actions', 'goals' or 'results'
|
||||||
@ -264,7 +264,7 @@ export default {
|
|||||||
//console.log('push ' + dump.length + ' elems in', target, dump);
|
//console.log('push ' + dump.length + ' elems in', target, dump);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove response elements from data target
|
* Remove response elements from data target
|
||||||
* @param target string -> 'actions', 'goals' or 'results'
|
* @param target string -> 'actions', 'goals' or 'results'
|
||||||
@ -279,7 +279,7 @@ export default {
|
|||||||
if (found) {
|
if (found) {
|
||||||
data.options = data.options.filter(e => e.id !== elem.id);
|
data.options = data.options.filter(e => e.id !== elem.id);
|
||||||
dump.push(elem.id);
|
dump.push(elem.id);
|
||||||
|
|
||||||
this.removeSelectedElement(target, elem);
|
this.removeSelectedElement(target, elem);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -288,7 +288,7 @@ export default {
|
|||||||
}
|
}
|
||||||
return [ data.options, data.value ];
|
return [ data.options, data.value ];
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param target
|
* @param target
|
||||||
@ -300,10 +300,10 @@ export default {
|
|||||||
elements.forEach(elem => {
|
elements.forEach(elem => {
|
||||||
let selected = data.value.some(e => e.id === elem.id);
|
let selected = data.value.some(e => e.id === elem.id);
|
||||||
if (!selected) {
|
if (!selected) {
|
||||||
|
|
||||||
data.value.push(elem);
|
data.value.push(elem);
|
||||||
dump.push(elem.id);
|
dump.push(elem.id);
|
||||||
|
|
||||||
// add in hiddenField
|
// add in hiddenField
|
||||||
this.rebuildHiddenFieldValues(target);
|
this.rebuildHiddenFieldValues(target);
|
||||||
}
|
}
|
||||||
@ -312,7 +312,7 @@ export default {
|
|||||||
//console.log('add ' + dump.length + ' selected elems in', target, dump);
|
//console.log('add ' + dump.length + ' selected elems in', target, dump);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove element from selected and from hiddenField
|
* Remove element from selected and from hiddenField
|
||||||
* @param target
|
* @param target
|
||||||
@ -322,19 +322,19 @@ export default {
|
|||||||
let data = this[target];
|
let data = this[target];
|
||||||
let selected = data.value.some(e => e.id === elem.id);
|
let selected = data.value.some(e => e.id === elem.id);
|
||||||
if (selected) {
|
if (selected) {
|
||||||
|
|
||||||
// remove from selected
|
// remove from selected
|
||||||
data.value = data.value.filter(e => e.id !== elem.id);
|
data.value = data.value.filter(e => e.id !== elem.id);
|
||||||
//console.log('remove ' + elem.id + ' from selected ' + target);
|
//console.log('remove ' + elem.id + ' from selected ' + target);
|
||||||
|
|
||||||
// remove from hiddenField
|
// remove from hiddenField
|
||||||
this.rebuildHiddenFieldValues(target);
|
this.rebuildHiddenFieldValues(target);
|
||||||
|
|
||||||
// in any cases, remove should be recursive
|
// in any cases, remove should be recursive
|
||||||
this.unselectToNextField(target, elem);
|
this.unselectToNextField(target, elem);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When unselect Action, it could remove elements in goals multiselect.
|
* When unselect Action, it could remove elements in goals multiselect.
|
||||||
* In that case, we have to unselect Goal to remove elements in results too.
|
* In that case, we have to unselect Goal to remove elements in results too.
|
||||||
@ -348,7 +348,7 @@ export default {
|
|||||||
//console.log('!!!! done');
|
//console.log('!!!! done');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rebuild values serie (string) in target HiddenField
|
* Rebuild values serie (string) in target HiddenField
|
||||||
* @param target
|
* @param target
|
||||||
@ -362,14 +362,14 @@ export default {
|
|||||||
})
|
})
|
||||||
//console.log(data.hiddenField);
|
//console.log(data.hiddenField);
|
||||||
},
|
},
|
||||||
|
|
||||||
addIdToValue(string, id) {
|
addIdToValue(string, id) {
|
||||||
let array = string ? string.split(',') : [];
|
let array = string ? string.split(',') : [];
|
||||||
array.push(id.toString());
|
array.push(id.toString());
|
||||||
let str = array.join();
|
let str = array.join();
|
||||||
return str;
|
return str;
|
||||||
},
|
},
|
||||||
|
|
||||||
transTitle ({ title }) {
|
transTitle ({ title }) {
|
||||||
return title.fr //TODO multilang
|
return title.fr //TODO multilang
|
||||||
},
|
},
|
||||||
@ -378,4 +378,4 @@ export default {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
</style>
|
</style>
|
||||||
|
@ -2,12 +2,13 @@ import { createApp } from "vue";
|
|||||||
import { _createI18n } from 'ChillMainAssets/vuejs/_js/i18n';
|
import { _createI18n } from 'ChillMainAssets/vuejs/_js/i18n';
|
||||||
import App from './App.vue';
|
import App from './App.vue';
|
||||||
|
|
||||||
const i18n = _createI18n({});
|
if (null !== document.getElementById('export_filters_social_work_type_filter_enabled')) {
|
||||||
|
const i18n = _createI18n({});
|
||||||
|
|
||||||
const app = createApp({
|
const app = createApp({
|
||||||
template: `<app></app>`,
|
template: `<app></app>`,
|
||||||
})
|
})
|
||||||
.use(i18n)
|
.use(i18n)
|
||||||
.component('app', App)
|
.component('app', App)
|
||||||
.mount('#export_export')
|
.mount('#export_export');
|
||||||
;
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user