mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 23:23:51 +00:00
Merge branch 'parcours/origin-de-la-demande' into 'master'
parcours - origin de la demande See merge request Chill-Projet/chill-bundles!107
This commit is contained in:
@@ -5,8 +5,8 @@
|
||||
<h1 v-if="accompanyingCourse.step === 'DRAFT'">{{ $t('course.title.draft') }}</h1>
|
||||
<h1 v-else>{{ $t('course.title.active') }}</h1>
|
||||
|
||||
<origin-demand></origin-demand>
|
||||
<persons-associated></persons-associated>
|
||||
<origin-demand></origin-demand>
|
||||
<requestor></requestor>
|
||||
<social-issue></social-issue>
|
||||
<referrer></referrer>
|
||||
@@ -68,11 +68,11 @@ export default {
|
||||
}
|
||||
a[name^="section"] {
|
||||
position: absolute;
|
||||
top: -3.5em; // reference for stickNav
|
||||
top: -2.5em; // reference for stickNav
|
||||
}
|
||||
}
|
||||
padding: 0.8em 0em;
|
||||
margin: 2em 0;
|
||||
padding: 0em 0em;
|
||||
margin: 1em 0;
|
||||
border: 1px dotted #718596ab;
|
||||
border-radius: 5px;
|
||||
border-left: 1px dotted #718596ab;
|
||||
|
@@ -192,15 +192,6 @@ const getListOrigins = () => {
|
||||
});
|
||||
}
|
||||
|
||||
const getOrigin = (id) => {
|
||||
const url = `/api/1.0/person/accompanying-period/origin/${id}.json`;
|
||||
return fetch(url)
|
||||
.then(response => {
|
||||
if (response.ok) { return response.json(); }
|
||||
throw Error('Error with request resource response');
|
||||
});
|
||||
}
|
||||
|
||||
export {
|
||||
getAccompanyingCourse,
|
||||
patchAccompanyingCourse,
|
||||
@@ -212,6 +203,5 @@ export {
|
||||
getUsers,
|
||||
whoami,
|
||||
getListOrigins,
|
||||
getOrigin,
|
||||
postSocialIssue
|
||||
};
|
||||
|
@@ -1,17 +1,37 @@
|
||||
<template>
|
||||
<div class="vue-component">
|
||||
<h2><a name="section-05"></a>{{ $t('origin.title') }}</h2>
|
||||
<h2><a name="section-15"></a>{{ $t('origin.title') }}</h2>
|
||||
|
||||
<div class="my-4">
|
||||
<label for="selectOrigin">
|
||||
{{ $t('origin.label') }}
|
||||
</label>
|
||||
|
||||
hop
|
||||
<VueMultiselect
|
||||
name="selectOrigin"
|
||||
label="text"
|
||||
v-bind:custom-label="transText"
|
||||
track-by="id"
|
||||
v-bind:multiple="false"
|
||||
v-bind:searchable="true"
|
||||
v-bind:placeholder="$t('origin.placeholder')"
|
||||
v-model="value"
|
||||
v-bind:options="options"
|
||||
@select="updateOrigin">
|
||||
</VueMultiselect>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getOrigins } from '../api';
|
||||
import VueMultiselect from 'vue-multiselect';
|
||||
import { getListOrigins } from '../api';
|
||||
import { mapState } from 'vuex';
|
||||
|
||||
export default {
|
||||
name: 'OriginDemand',
|
||||
components: { VueMultiselect },
|
||||
data() {
|
||||
return {
|
||||
options: []
|
||||
@@ -27,11 +47,26 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
getOptions() {
|
||||
console.log('loading origins list');
|
||||
}
|
||||
//console.log('loading origins list');
|
||||
getListOrigins().then(response => new Promise((resolve, reject) => {
|
||||
this.options = response.results;
|
||||
resolve();
|
||||
}));
|
||||
},
|
||||
updateOrigin(value) {
|
||||
//console.log('value', value);
|
||||
this.$store.dispatch('updateOrigin', value);
|
||||
},
|
||||
transText ({ text }) {
|
||||
return text.fr //TODO multilang
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
<style src="vue-multiselect/dist/vue-multiselect.css"></style>
|
||||
<style lang="css" scoped>
|
||||
label {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
|
@@ -3,7 +3,7 @@
|
||||
<h2><a name="section-40"></a>{{ $t('referrer.title') }}</h2>
|
||||
|
||||
<div class="my-4">
|
||||
<label for="" class="">
|
||||
<label for="selectReferrer">
|
||||
{{ $t('referrer.label') }}
|
||||
</label>
|
||||
|
||||
@@ -77,3 +77,5 @@ export default {
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style src="vue-multiselect/dist/vue-multiselect.css"></style>
|
||||
|
@@ -28,6 +28,8 @@ const appMessages = {
|
||||
},
|
||||
origin: {
|
||||
title: "Origine de la demande",
|
||||
label: "Origine de la demande",
|
||||
placeholder: "Renseignez l'origine de la demande",
|
||||
},
|
||||
persons_associated: {
|
||||
title: "Usagers concernés",
|
||||
|
@@ -81,8 +81,12 @@ let initPromise = getAccompanyingCourse(id)
|
||||
updateSocialIssues(state, value) {
|
||||
state.accompanyingCourse.socialIssues = value;
|
||||
},
|
||||
updateOrigin(state, value) {
|
||||
//console.log('value', value);
|
||||
state.accompanyingCourse.origin = value;
|
||||
},
|
||||
updateReferrer(state, value) {
|
||||
console.log('value', value);
|
||||
//console.log('value', value);
|
||||
state.accompanyingCourse.user = value;
|
||||
},
|
||||
confirmAccompanyingCourse(state, response) {
|
||||
@@ -191,6 +195,13 @@ let initPromise = getAccompanyingCourse(id)
|
||||
resolve();
|
||||
})).catch((error) => { commit('catchError', error) });
|
||||
},
|
||||
updateOrigin({ commit }, payload) {
|
||||
patchAccompanyingCourse(id, { type: "accompanying_period", origin: { id: payload.id, type: payload.type } })
|
||||
.then(course => new Promise((resolve, reject) => {
|
||||
commit('updateOrigin', course.origin);
|
||||
resolve();
|
||||
})).catch((error) => { commit('catchError', error) });
|
||||
},
|
||||
updateReferrer({ commit }, payload) {
|
||||
patchAccompanyingCourse(id, { type: "accompanying_period", user: { id: payload.id, type: payload.type } })
|
||||
.then(course => new Promise((resolve, reject) => {
|
||||
|
Reference in New Issue
Block a user