mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
improve and clean socialIssues
This commit is contained in:
parent
3abfb02962
commit
b403569b16
@ -147,7 +147,7 @@ const postResource = (id, payload, method) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
* Endpoint to Add/remove SocialIssue
|
||||||
*/
|
*/
|
||||||
const postSocialIssue = (id, body, method) => {
|
const postSocialIssue = (id, body, method) => {
|
||||||
//console.log('api body and method', body, method);
|
//console.log('api body and method', body, method);
|
||||||
|
@ -9,7 +9,7 @@ export default {
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss" scoped>
|
||||||
span.badge {
|
span.badge {
|
||||||
margin-right: 1em;
|
margin-right: 1em;
|
||||||
}
|
}
|
||||||
|
@ -3,10 +3,10 @@
|
|||||||
<h2><a name="section-30"></a>{{ $t('social_issue.title') }}</h2>
|
<h2><a name="section-30"></a>{{ $t('social_issue.title') }}</h2>
|
||||||
|
|
||||||
<div class="my-4">
|
<div class="my-4">
|
||||||
<!--label for="selectIssues">{{ $t('social_issue.label') }}</label
|
<!--label for="field">{{ $t('social_issue.label') }}</label
|
||||||
name="selectIssues"
|
|
||||||
-->
|
-->
|
||||||
<VueMultiselect
|
<VueMultiselect
|
||||||
|
name="field"
|
||||||
:close-on-select="false"
|
:close-on-select="false"
|
||||||
:allow-empty="true"
|
:allow-empty="true"
|
||||||
:show-labels="false"
|
:show-labels="false"
|
||||||
@ -17,8 +17,7 @@
|
|||||||
:placeholder="$t('social_issue.label')"
|
:placeholder="$t('social_issue.label')"
|
||||||
@update:model-value="updateSocialIssues"
|
@update:model-value="updateSocialIssues"
|
||||||
:model-value="value"
|
:model-value="value"
|
||||||
:options="options"
|
:options="options">
|
||||||
>
|
|
||||||
</VueMultiselect>
|
</VueMultiselect>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -55,35 +54,17 @@ export default {
|
|||||||
})).catch(error => this.$store.commit('catchError', error));
|
})).catch(error => this.$store.commit('catchError', error));
|
||||||
},
|
},
|
||||||
updateSocialIssues(value) {
|
updateSocialIssues(value) {
|
||||||
console.log('@@@ CHANGED value');
|
|
||||||
this.$store.dispatch('updateSocialIssues', this.transformValue(value));
|
this.$store.dispatch('updateSocialIssues', this.transformValue(value));
|
||||||
},
|
},
|
||||||
transformValue(updated) {
|
transformValue(updated) {
|
||||||
let stored = this.value;
|
let stored = this.value;
|
||||||
//console.log('updated', updated, updated.length);
|
|
||||||
//console.log('stored', stored, stored.length);
|
|
||||||
|
|
||||||
let added = updated.filter(x => stored.indexOf(x) === -1).shift();
|
let added = updated.filter(x => stored.indexOf(x) === -1).shift();
|
||||||
//console.log('added', added);
|
|
||||||
|
|
||||||
let removed = stored.filter(x => updated.indexOf(x) === -1).shift();
|
let removed = stored.filter(x => updated.indexOf(x) === -1).shift();
|
||||||
//console.log('removed', removed);
|
let method = (typeof removed === 'undefined') ? 'POST' : 'DELETE';
|
||||||
|
|
||||||
let method = (typeof removed === 'undefined') ? 'POST' : 'DELETE';
|
|
||||||
console.log('method', method);
|
|
||||||
|
|
||||||
//let concat = (...arrays) => [].concat(...arrays.filter(Array.isArray));
|
|
||||||
//let changed = concat(added, removed);
|
|
||||||
//let changed = [...new Set([...added, ...removed ])];
|
|
||||||
|
|
||||||
let changed = (typeof removed === 'undefined') ? added : removed;
|
let changed = (typeof removed === 'undefined') ? added : removed;
|
||||||
//console.log('changed', changed);
|
|
||||||
|
|
||||||
let body = { type: "social_issue", id: changed.id };
|
let body = { type: "social_issue", id: changed.id };
|
||||||
|
//console.log('body', body);
|
||||||
console.log('body', body);
|
console.log('@@@ CHANGED', method, changed.text);
|
||||||
console.log(changed.text);
|
|
||||||
|
|
||||||
let payload = updated;
|
let payload = updated;
|
||||||
return { payload, body, method };
|
return { payload, body, method };
|
||||||
}
|
}
|
||||||
@ -92,8 +73,8 @@ export default {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style src="vue-multiselect/dist/vue-multiselect.css"></style>
|
<style src="vue-multiselect/dist/vue-multiselect.css"></style>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss">
|
||||||
div.vue-component > div {
|
span.multiselect__tag {
|
||||||
//margin: 3em;
|
background: #e2793d;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -75,7 +75,7 @@ let initPromise = getAccompanyingCourse(id)
|
|||||||
state.accompanyingCourse.confidential = value;
|
state.accompanyingCourse.confidential = value;
|
||||||
},
|
},
|
||||||
postFirstComment(state, comment) {
|
postFirstComment(state, comment) {
|
||||||
console.log('### mutation: postFirstComment', comment);
|
//console.log('### mutation: postFirstComment', comment);
|
||||||
state.accompanyingCourse.initialComment = comment;
|
state.accompanyingCourse.initialComment = comment;
|
||||||
},
|
},
|
||||||
updateSocialIssues(state, value) {
|
updateSocialIssues(state, value) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user