mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
get SocialIssues List in multiselect
This commit is contained in:
parent
f548121312
commit
9da4c1ebeb
@ -43,7 +43,7 @@ export default {
|
||||
|
||||
<style lang="scss" scoped>
|
||||
div.vue-component {
|
||||
padding: 1.5em;
|
||||
padding: 1.5em 0;
|
||||
margin: 2em 0;
|
||||
border: 2px dotted lightgrey;
|
||||
border-radius: 10px;
|
||||
|
@ -13,6 +13,18 @@ const getAccompanyingCourse = (id) => {
|
||||
});
|
||||
};
|
||||
|
||||
/*
|
||||
* Endpoint
|
||||
*/
|
||||
const getSocialIssues = () => {
|
||||
const url = `/api/1.0/person/social-work/social-issue.json`;
|
||||
return fetch(url)
|
||||
.then(response => {
|
||||
if (response.ok) { return response.json(); }
|
||||
throw Error('Error with request resource response');
|
||||
});
|
||||
};
|
||||
|
||||
/*
|
||||
* Endpoint v.2 chill_api_single_accompanying_course__entity
|
||||
* method PATCH, patch AccompanyingCourse Instance
|
||||
@ -121,6 +133,7 @@ const postResource = (id, payload, method) => {
|
||||
|
||||
export {
|
||||
getAccompanyingCourse,
|
||||
getSocialIssues,
|
||||
patchAccompanyingCourse,
|
||||
postParticipation,
|
||||
postRequestor,
|
||||
|
@ -3,12 +3,18 @@
|
||||
<h3>{{ $t('social_issue.title') }}</h3>
|
||||
|
||||
<div>
|
||||
<label for="selectIssues">{{ $t('social_issue.label') }}</label>
|
||||
<!--label for="selectIssues">{{ $t('social_issue.label') }}</label-->
|
||||
<VueMultiselect
|
||||
name="selectIssues"
|
||||
v-model="selected"
|
||||
track-by="id"
|
||||
label="text"
|
||||
:placeholder="$t('social_issue.label')"
|
||||
:multiple="true"
|
||||
:searchable="true"
|
||||
:close-on-select="false"
|
||||
:allow-empty="true"
|
||||
:show-labels="false"
|
||||
:options="options">
|
||||
</VueMultiselect>
|
||||
</div>
|
||||
@ -18,6 +24,7 @@
|
||||
|
||||
<script>
|
||||
import VueMultiselect from 'vue-multiselect'
|
||||
import { getSocialIssues } from '../api'
|
||||
|
||||
export default {
|
||||
name: "SocialIssue",
|
||||
@ -25,8 +32,22 @@ export default {
|
||||
data () {
|
||||
return {
|
||||
selected: null,
|
||||
options: ['list', 'of', 'options']
|
||||
options: []
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
},
|
||||
mounted() {
|
||||
this.getOptions();
|
||||
},
|
||||
methods: {
|
||||
getOptions() {
|
||||
getSocialIssues().then(socialIssues => new Promise((resolve, reject) => {
|
||||
console.log('socialIssues', socialIssues);
|
||||
this.options = socialIssues.results;
|
||||
resolve();
|
||||
})).catch(error => this.$store.commit('catchError', error));
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
Loading…
x
Reference in New Issue
Block a user