mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 07:03:49 +00:00
Merge branch 'master' into household_filiation
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
<persons-associated></persons-associated>
|
||||
<course-location></course-location>
|
||||
<origin-demand></origin-demand>
|
||||
<requestor></requestor>
|
||||
<requestor v-bind:isAnonymous="accompanyingCourse.requestorAnonymous"></requestor>
|
||||
<social-issue></social-issue>
|
||||
<scopes></scopes>
|
||||
<referrer></referrer>
|
||||
@@ -16,15 +16,15 @@
|
||||
<comment v-if="accompanyingCourse.step === 'DRAFT'"></comment>
|
||||
<confirm v-if="accompanyingCourse.step === 'DRAFT'"></confirm>
|
||||
|
||||
<div v-for="error in errorMsg" class="vue-component errors alert alert-danger">
|
||||
<!-- <div v-for="error in errorMsg" v-bind:key="error.id" class="vue-component errors alert alert-danger">
|
||||
<p>
|
||||
<span>{{ error.sta }} {{ error.txt }}</span><br>
|
||||
<span>{{ $t(error.msg) }}</span>
|
||||
</p>
|
||||
</div>
|
||||
</div> -->
|
||||
</template>
|
||||
<script>
|
||||
import { mapState } from 'vuex'
|
||||
import { mapGetters, mapState } from 'vuex'
|
||||
import Banner from './components/Banner.vue';
|
||||
import StickyNav from './components/StickyNav.vue';
|
||||
import OriginDemand from './components/OriginDemand.vue';
|
||||
@@ -54,11 +54,12 @@ export default {
|
||||
Comment,
|
||||
Confirm,
|
||||
},
|
||||
computed: mapState([
|
||||
'accompanyingCourse',
|
||||
'addressContext',
|
||||
'errorMsg'
|
||||
])
|
||||
computed: {
|
||||
...mapState([
|
||||
'accompanyingCourse',
|
||||
'addressContext'
|
||||
]),
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
|
@@ -1,3 +1,5 @@
|
||||
import { fetchResults } from 'ChillMainAssets/lib/api/download.js';
|
||||
|
||||
/*
|
||||
* Endpoint v.2 chill_api_single_accompanying_course__entity
|
||||
* method GET/HEAD, get AccompanyingCourse Instance
|
||||
@@ -84,7 +86,8 @@ const postParticipation = (id, payload, method) => {
|
||||
})
|
||||
.then(response => {
|
||||
if (response.ok) { return response.json(); }
|
||||
throw { msg: 'Error while sending AccompanyingPeriod Course participation.', sta: response.status, txt: response.statusText, err: new Error(), body: response.body };
|
||||
// TODO: adjust message according to status code? Or how to access the message from the violation array?
|
||||
throw { msg: 'Error while sending AccompanyingPeriod Course participation', sta: response.status, txt: response.statusText, err: new Error(), body: response.body };
|
||||
});
|
||||
};
|
||||
|
||||
@@ -168,11 +171,8 @@ const postSocialIssue = (id, body, method) => {
|
||||
|
||||
const getUsers = () => {
|
||||
const url = `/api/1.0/main/user.json`;
|
||||
return fetch(url)
|
||||
.then(response => {
|
||||
if (response.ok) { return response.json(); }
|
||||
throw { msg: 'Error while retriving users.', sta: response.status, txt: response.statusText, err: new Error(), body: response.body };
|
||||
});
|
||||
|
||||
return fetchResults(url);
|
||||
};
|
||||
|
||||
const whoami = () => {
|
||||
@@ -216,8 +216,6 @@ const addScope = (id, scope) => {
|
||||
|
||||
const removeScope = (id, scope) => {
|
||||
const url = `/api/1.0/person/accompanying-course/${id}/scope.json`;
|
||||
console.log(url);
|
||||
console.log(scope);
|
||||
|
||||
return fetch(url, {
|
||||
method: 'DELETE',
|
||||
@@ -235,6 +233,12 @@ const removeScope = (id, scope) => {
|
||||
});
|
||||
};
|
||||
|
||||
const getReferrersSuggested = (course) => {
|
||||
const url = `/api/1.0/person/accompanying-course/${course.id}/referrers-suggested.json`;
|
||||
|
||||
return fetchResults(url);
|
||||
}
|
||||
|
||||
export {
|
||||
getAccompanyingCourse,
|
||||
patchAccompanyingCourse,
|
||||
@@ -249,4 +253,5 @@ export {
|
||||
postSocialIssue,
|
||||
addScope,
|
||||
removeScope,
|
||||
getReferrersSuggested,
|
||||
};
|
||||
|
@@ -10,13 +10,13 @@
|
||||
<VueMultiselect
|
||||
name="selectOrigin"
|
||||
label="text"
|
||||
v-bind:custom-label="transText"
|
||||
:custom-label="transText"
|
||||
track-by="id"
|
||||
v-bind:multiple="false"
|
||||
v-bind:searchable="true"
|
||||
v-bind:placeholder="$t('origin.placeholder')"
|
||||
:multiple="false"
|
||||
:searchable="true"
|
||||
:placeholder="$t('origin.placeholder')"
|
||||
v-model="value"
|
||||
v-bind:options="options"
|
||||
:options="options"
|
||||
@select="updateOrigin">
|
||||
</VueMultiselect>
|
||||
|
||||
@@ -47,18 +47,18 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
getOptions() {
|
||||
//console.log('loading origins list');
|
||||
getListOrigins().then(response => new Promise((resolve, reject) => {
|
||||
this.options = response.results;
|
||||
resolve();
|
||||
}));
|
||||
},
|
||||
updateOrigin(value) {
|
||||
//console.log('value', value);
|
||||
console.log('value', value);
|
||||
this.$store.dispatch('updateOrigin', value);
|
||||
},
|
||||
transText ({ text }) {
|
||||
return text.fr //TODO multilang
|
||||
const parsedText = JSON.parse(text);
|
||||
return parsedText.fr;
|
||||
},
|
||||
}
|
||||
}
|
||||
|
@@ -9,6 +9,7 @@
|
||||
addAltNames: true,
|
||||
addAge : true,
|
||||
hLevel : 3,
|
||||
isConfidential : false,
|
||||
}"
|
||||
:person="participation.person"
|
||||
:returnPath="getAccompanyingCourseReturnPath">
|
||||
|
@@ -15,9 +15,20 @@
|
||||
v-bind:searchable="true"
|
||||
v-bind:placeholder="$t('referrer.placeholder')"
|
||||
v-model="value"
|
||||
v-bind:options="options"
|
||||
v-bind:options="users"
|
||||
@select="updateReferrer">
|
||||
</VueMultiselect>
|
||||
|
||||
|
||||
<template v-if="referrersSuggested.length > 0">
|
||||
<ul>
|
||||
<li v-for="u in referrersSuggested" @click="updateReferrer(u)">
|
||||
<user-render-box-badge :user="u"></user-render-box-badge>
|
||||
</li>
|
||||
</ul>
|
||||
</template>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div>
|
||||
@@ -41,30 +52,29 @@
|
||||
import VueMultiselect from 'vue-multiselect';
|
||||
import { getUsers, whoami } from '../api';
|
||||
import { mapState } from 'vuex';
|
||||
import UserRenderBoxBadge from "ChillMainAssets/vuejs/_components/Entity/UserRenderBoxBadge";
|
||||
|
||||
export default {
|
||||
name: "Referrer",
|
||||
components: { VueMultiselect },
|
||||
data() {
|
||||
return {
|
||||
options: []
|
||||
}
|
||||
components: {
|
||||
UserRenderBoxBadge,
|
||||
VueMultiselect,
|
||||
},
|
||||
computed: {
|
||||
...mapState({
|
||||
value: state => state.accompanyingCourse.user,
|
||||
users: state => state.users,
|
||||
referrersSuggested: state => {
|
||||
return state.referrersSuggested.filter(u => {
|
||||
if (null === state.accompanyingCourse.user) {
|
||||
return true;
|
||||
}
|
||||
return state.accompanyingCourse.user.id !== u.id;
|
||||
})
|
||||
},
|
||||
}),
|
||||
},
|
||||
mounted() {
|
||||
this.getOptions();
|
||||
},
|
||||
methods: {
|
||||
getOptions() {
|
||||
getUsers().then(response => new Promise((resolve, reject) => {
|
||||
this.options = response.results;
|
||||
resolve();
|
||||
}));
|
||||
},
|
||||
updateReferrer(value) {
|
||||
//console.log('value', value);
|
||||
this.$store.dispatch('updateReferrer', value);
|
||||
|
@@ -3,51 +3,60 @@
|
||||
|
||||
<h2><a id="section-40"></a>{{ $t('requestor.title') }}</h2>
|
||||
|
||||
<div v-if="accompanyingCourse.requestor" class="flex-table">
|
||||
<div v-if="accompanyingCourse.requestor && isAnonymous" class="flex-table">
|
||||
|
||||
<label>
|
||||
<input type="checkbox" v-model="isAnonymous" class="me-2" />
|
||||
{{ $t('requestor.is_anonymous') }}
|
||||
</label>
|
||||
|
||||
<third-party-render-box v-if="accompanyingCourse.requestor.type === 'thirdparty'"
|
||||
:thirdparty="accompanyingCourse.requestor"
|
||||
:options="{
|
||||
addLink: false,
|
||||
addId: false,
|
||||
addEntity: true,
|
||||
addInfo: false,
|
||||
hLevel: 3,
|
||||
isMultiline: true
|
||||
}"
|
||||
>
|
||||
<template v-slot:record-actions>
|
||||
<ul class="record_actions">
|
||||
<li><on-the-fly :type="accompanyingCourse.requestor.type" :id="accompanyingCourse.requestor.id" action="show"></on-the-fly></li>
|
||||
<li><on-the-fly :type="accompanyingCourse.requestor.type" :id="accompanyingCourse.requestor.id" action="edit" @saveFormOnTheFly="saveFormOnTheFly"></on-the-fly></li>
|
||||
</ul>
|
||||
</template>
|
||||
</third-party-render-box>
|
||||
|
||||
<person-render-box render="bloc" v-else-if="accompanyingCourse.requestor.type === 'person'"
|
||||
:person="accompanyingCourse.requestor"
|
||||
:options="{
|
||||
addLink: false,
|
||||
addId: false,
|
||||
addAltNames: false,
|
||||
addEntity: true,
|
||||
addInfo: true,
|
||||
hLevel: 3,
|
||||
isMultiline: true
|
||||
}"
|
||||
>
|
||||
<template v-slot:record-actions>
|
||||
<ul class="record_actions">
|
||||
<li><on-the-fly :type="accompanyingCourse.requestor.type" :id="accompanyingCourse.requestor.id" action="show"></on-the-fly></li>
|
||||
<li><on-the-fly :type="accompanyingCourse.requestor.type" :id="accompanyingCourse.requestor.id" action="edit" @saveFormOnTheFly="saveFormOnTheFly"></on-the-fly></li>
|
||||
</ul>
|
||||
</template>
|
||||
</person-render-box>
|
||||
<confidential v-if="accompanyingCourse.requestor.type === 'thirdparty'">
|
||||
<template v-slot:confidential-content>
|
||||
<third-party-render-box
|
||||
:thirdparty="accompanyingCourse.requestor"
|
||||
:options="{
|
||||
addLink: false,
|
||||
addId: false,
|
||||
addEntity: true,
|
||||
addInfo: false,
|
||||
hLevel: 3,
|
||||
isMultiline: true,
|
||||
isConfidential: true
|
||||
}"
|
||||
>
|
||||
<template v-slot:record-actions>
|
||||
<ul class="record_actions">
|
||||
<li><on-the-fly :type="accompanyingCourse.requestor.type" :id="accompanyingCourse.requestor.id" action="show"></on-the-fly></li>
|
||||
<li><on-the-fly :type="accompanyingCourse.requestor.type" :id="accompanyingCourse.requestor.id" action="edit" @saveFormOnTheFly="saveFormOnTheFly"></on-the-fly></li>
|
||||
</ul>
|
||||
</template>
|
||||
</third-party-render-box>
|
||||
</template>
|
||||
</confidential>
|
||||
|
||||
<confidential v-else-if="accompanyingCourse.requestor.type === 'person'">
|
||||
<template v-slot:confidential-content>
|
||||
<person-render-box render="bloc"
|
||||
:person="accompanyingCourse.requestor"
|
||||
:options="{
|
||||
addLink: false,
|
||||
addId: false,
|
||||
addAltNames: false,
|
||||
addEntity: true,
|
||||
addInfo: true,
|
||||
hLevel: 3,
|
||||
isMultiline: true,
|
||||
isConfidential: false
|
||||
}"
|
||||
>
|
||||
<template v-slot:record-actions>
|
||||
<ul class="record_actions">
|
||||
<li><on-the-fly :type="accompanyingCourse.requestor.type" :id="accompanyingCourse.requestor.id" action="show"></on-the-fly></li>
|
||||
<li><on-the-fly :type="accompanyingCourse.requestor.type" :id="accompanyingCourse.requestor.id" action="edit" @saveFormOnTheFly="saveFormOnTheFly"></on-the-fly></li>
|
||||
</ul>
|
||||
</template>
|
||||
</person-render-box>
|
||||
</template>
|
||||
</confidential>
|
||||
|
||||
<ul class="record_actions">
|
||||
<li>
|
||||
@@ -59,6 +68,57 @@
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div v-else-if="accompanyingCourse.requestor && !isAnonymous" class="flex-table">
|
||||
<label>
|
||||
<input type="checkbox" v-model="isAnonymous" class="me-2" />
|
||||
{{ $t('requestor.is_anonymous') }}
|
||||
</label>
|
||||
|
||||
<third-party-render-box
|
||||
v-if="accompanyingCourse.requestor.type === 'thirdparty'"
|
||||
:thirdparty="accompanyingCourse.requestor"
|
||||
:options="{
|
||||
addLink: false,
|
||||
addId: false,
|
||||
addEntity: true,
|
||||
addInfo: false,
|
||||
hLevel: 3,
|
||||
isMultiline: true,
|
||||
isConfidential: true
|
||||
}"
|
||||
>
|
||||
<template v-slot:record-actions>
|
||||
<ul class="record_actions">
|
||||
<li><on-the-fly :type="accompanyingCourse.requestor.type" :id="accompanyingCourse.requestor.id" action="show"></on-the-fly></li>
|
||||
<li><on-the-fly :type="accompanyingCourse.requestor.type" :id="accompanyingCourse.requestor.id" action="edit" @saveFormOnTheFly="saveFormOnTheFly"></on-the-fly></li>
|
||||
</ul>
|
||||
</template>
|
||||
</third-party-render-box>
|
||||
|
||||
<person-render-box render="bloc"
|
||||
v-if="accompanyingCourse.requestor.type === 'person'"
|
||||
:person="accompanyingCourse.requestor"
|
||||
:options="{
|
||||
addLink: false,
|
||||
addId: false,
|
||||
addAltNames: false,
|
||||
addEntity: true,
|
||||
addInfo: true,
|
||||
hLevel: 3,
|
||||
isMultiline: true,
|
||||
isConfidential: false
|
||||
}"
|
||||
>
|
||||
<template v-slot:record-actions>
|
||||
<ul class="record_actions">
|
||||
<li><on-the-fly :type="accompanyingCourse.requestor.type" :id="accompanyingCourse.requestor.id" action="show"></on-the-fly></li>
|
||||
<li><on-the-fly :type="accompanyingCourse.requestor.type" :id="accompanyingCourse.requestor.id" action="edit" @saveFormOnTheFly="saveFormOnTheFly"></on-the-fly></li>
|
||||
</ul>
|
||||
</template>
|
||||
</person-render-box>
|
||||
</div>
|
||||
|
||||
<div v-else>
|
||||
<label class="chill-no-data-statement">{{ $t('requestor.counter') }}</label>
|
||||
</div>
|
||||
@@ -82,6 +142,7 @@ import AddPersons from 'ChillPersonAssets/vuejs/_components/AddPersons.vue';
|
||||
import OnTheFly from 'ChillMainAssets/vuejs/OnTheFly/components/OnTheFly.vue';
|
||||
import PersonRenderBox from '../../_components/Entity/PersonRenderBox.vue';
|
||||
import ThirdPartyRenderBox from 'ChillThirdPartyAssets/vuejs/_components/Entity/ThirdPartyRenderBox.vue';
|
||||
import Confidential from 'ChillMainAssets/vuejs/_components/Confidential.vue';
|
||||
|
||||
export default {
|
||||
name: 'Requestor',
|
||||
@@ -90,7 +151,9 @@ export default {
|
||||
OnTheFly,
|
||||
PersonRenderBox,
|
||||
ThirdPartyRenderBox,
|
||||
Confidential
|
||||
},
|
||||
props: ['isAnonymous'],
|
||||
data() {
|
||||
return {
|
||||
addPersons: {
|
||||
@@ -149,4 +212,8 @@ div.flex-table {
|
||||
margin-top: 1em;
|
||||
}
|
||||
}
|
||||
|
||||
.confidential {
|
||||
display: block;
|
||||
}
|
||||
</style>
|
||||
|
@@ -2,7 +2,7 @@
|
||||
<person-render-box render="bloc"
|
||||
v-if="resource.resource.type === 'person'"
|
||||
:person="resource.resource"
|
||||
:options="{ addInfo : true, addId : false, addEntity: true, addLink: false, addAltNames: true, addAge : false, hLevel : 3 }"
|
||||
:options="{ addInfo : true, addId : false, addEntity: true, addLink: false, addAltNames: true, addAge : false, hLevel : 3, isConfidential : true }"
|
||||
>
|
||||
<template v-slot:record-actions>
|
||||
<ul class="record_actions">
|
||||
|
@@ -2,6 +2,8 @@ import { createApp } from 'vue'
|
||||
import { _createI18n } from 'ChillMainAssets/vuejs/_js/i18n'
|
||||
import { appMessages } from './js/i18n'
|
||||
import { initPromise } from './store'
|
||||
import VueToast from 'vue-toast-notification';
|
||||
import 'vue-toast-notification/dist/theme-sugar.css';
|
||||
|
||||
import App from './App.vue';
|
||||
import Banner from './components/Banner.vue';
|
||||
@@ -21,6 +23,7 @@ if (root === 'app') {
|
||||
})
|
||||
.use(store)
|
||||
.use(i18n)
|
||||
.use(VueToast)
|
||||
.component('app', App)
|
||||
.mount('#accompanying-course');
|
||||
});
|
||||
|
@@ -10,6 +10,8 @@ import { getAccompanyingCourse,
|
||||
postSocialIssue,
|
||||
addScope,
|
||||
removeScope,
|
||||
getReferrersSuggested,
|
||||
getUsers,
|
||||
} from '../api';
|
||||
import { patchPerson } from "ChillPersonAssets/vuejs/_api/OnTheFly";
|
||||
import { patchThirdparty } from "ChillThirdPartyAssets/vuejs/_api/OnTheFly";
|
||||
@@ -38,6 +40,10 @@ let initPromise = Promise.all([scopesPromise, accompanyingCoursePromise])
|
||||
scopesAtStart: accompanyingCourse.scopes.map(scope => scope),
|
||||
// the scope states at server side
|
||||
scopesAtBackend: accompanyingCourse.scopes.map(scope => scope),
|
||||
// the users which are available for referrer
|
||||
referrersSuggested: [],
|
||||
// all the users available
|
||||
users: [],
|
||||
},
|
||||
getters: {
|
||||
isParticipationValid(state) {
|
||||
@@ -71,7 +77,7 @@ let initPromise = Promise.all([scopesPromise, accompanyingCoursePromise])
|
||||
},
|
||||
mutations: {
|
||||
catchError(state, error) {
|
||||
console.log('### mutation: a new error have been catched and pushed in store !', error);
|
||||
// console.log('### mutation: a new error have been catched and pushed in store !', error);
|
||||
state.errorMsg.push(error);
|
||||
},
|
||||
removeParticipation(state, participation) {
|
||||
@@ -170,6 +176,16 @@ let initPromise = Promise.all([scopesPromise, accompanyingCoursePromise])
|
||||
//console.log('value', value);
|
||||
state.accompanyingCourse.user = value;
|
||||
},
|
||||
setReferrersSuggested(state, users) {
|
||||
state.referrersSuggested = users.map(u => {
|
||||
if (state.accompanyingCourse.user !== null) {
|
||||
if (state.accompanyingCourse.user.id === u.id) {
|
||||
return state.accompanyingCourse.user;
|
||||
}
|
||||
}
|
||||
return u;
|
||||
});
|
||||
},
|
||||
confirmAccompanyingCourse(state, response) {
|
||||
//console.log('### mutation: confirmAccompanyingCourse: response', response);
|
||||
state.accompanyingCourse.step = response.step;
|
||||
@@ -178,6 +194,16 @@ let initPromise = Promise.all([scopesPromise, accompanyingCoursePromise])
|
||||
//console.log('define location context');
|
||||
state.addressContext = context;
|
||||
},
|
||||
setUsers(state, users) {
|
||||
state.users = users.map(u => {
|
||||
if (state.accompanyingCourse.user !== null) {
|
||||
if (state.accompanyingCourse.user.id === u.id) {
|
||||
return state.accompanyingCourse.user;
|
||||
}
|
||||
}
|
||||
return u;
|
||||
});
|
||||
},
|
||||
updateLocation(state, r) {
|
||||
//console.log('### mutation: set location attributes', r);
|
||||
state.accompanyingCourse.locationStatus = r.locationStatus;
|
||||
@@ -272,6 +298,7 @@ let initPromise = Promise.all([scopesPromise, accompanyingCoursePromise])
|
||||
})).catch((error) => { commit('catchError', error) });
|
||||
},
|
||||
patchOnTheFly({ commit }, payload) {
|
||||
// TODO should be into the dedicated component, no ? JF
|
||||
console.log('## action: patch OnTheFly', payload);
|
||||
let body = { type: payload.type };
|
||||
if (payload.type === 'person') {
|
||||
@@ -313,10 +340,12 @@ let initPromise = Promise.all([scopesPromise, accompanyingCoursePromise])
|
||||
},
|
||||
toggleEmergency({ commit }, payload) {
|
||||
patchAccompanyingCourse(id, { type: "accompanying_period", emergency: payload })
|
||||
.then(course => new Promise((resolve, reject) => {
|
||||
commit('toggleEmergency', course.emergency);
|
||||
resolve();
|
||||
})).catch((error) => { commit('catchError', error) });
|
||||
.then(course => new Promise((resolve, reject) => {
|
||||
commit('toggleEmergency', course.emergency);
|
||||
return dispatch('setRefererresAvailable');
|
||||
}))
|
||||
.then(() => Promise.resolve())
|
||||
.catch((error) => { commit('catchError', error) });
|
||||
},
|
||||
toggleConfidential({ commit }, payload) {
|
||||
patchAccompanyingCourse(id, { type: "accompanying_period", confidential: payload })
|
||||
@@ -387,11 +416,15 @@ let initPromise = Promise.all([scopesPromise, accompanyingCoursePromise])
|
||||
// check/uncheck in the UI. I do not know of to avoid it.
|
||||
commit('setScopes', scopes);
|
||||
return Promise.resolve();
|
||||
}).then(() => {
|
||||
return dispatch('fetchReferrersSuggested');
|
||||
});
|
||||
} else {
|
||||
return dispatch('setScopes', state.scopesAtStart).then(() => {
|
||||
commit('setScopes', scopes);
|
||||
return Promise.resolve();
|
||||
}).then(() => {
|
||||
return dispatch('fetchReferrersSuggested');
|
||||
});
|
||||
}
|
||||
},
|
||||
@@ -434,7 +467,7 @@ let initPromise = Promise.all([scopesPromise, accompanyingCoursePromise])
|
||||
resolve();
|
||||
})).catch((error) => { commit('catchError', error) });
|
||||
},
|
||||
updateSocialIssues({ state, commit }, { payload, body, method }) {
|
||||
updateSocialIssues({ state, commit, dispatch }, { payload, body, method }) {
|
||||
//console.log('## action: payload', { payload, body, method });
|
||||
postSocialIssue(id, body, method)
|
||||
.then(response => new Promise((resolve, reject) => {
|
||||
@@ -445,6 +478,7 @@ let initPromise = Promise.all([scopesPromise, accompanyingCoursePromise])
|
||||
return getAccompanyingCourse(state.accompanyingCourse.id);
|
||||
}).then(accompanying_course => {
|
||||
commit('refreshSocialIssues', accompanying_course.socialIssues);
|
||||
dispatch('fetchReferrersSuggested');
|
||||
})
|
||||
.catch((error) => { commit('catchError', error) });
|
||||
},
|
||||
@@ -462,7 +496,24 @@ let initPromise = Promise.all([scopesPromise, accompanyingCoursePromise])
|
||||
resolve();
|
||||
})).catch((error) => { commit('catchError', error) });
|
||||
},
|
||||
updateLocation({ commit }, payload) {
|
||||
async fetchReferrersSuggested({ state, commit}) {
|
||||
let users = await getReferrersSuggested(state.accompanyingCourse);
|
||||
commit('setReferrersSuggested', users);
|
||||
if (
|
||||
null === state.accompanyingCourse.user
|
||||
&& !state.accompanyingCourse.confidential
|
||||
&& !state.accompanyingCourse.step === 'DRAFT'
|
||||
&& users.length === 1
|
||||
) {
|
||||
// set the user if unique
|
||||
commit('updateReferrer', users[0]);
|
||||
}
|
||||
},
|
||||
async fetchUsers({commit}) {
|
||||
let users = await getUsers();
|
||||
commit('setUsers', users);
|
||||
},
|
||||
updateLocation({ commit, dispatch }, payload) {
|
||||
//console.log('## action: updateLocation', payload.locationStatusTo);
|
||||
let body = { 'type': payload.target, 'id': payload.targetId };
|
||||
let location = {};
|
||||
@@ -484,6 +535,7 @@ let initPromise = Promise.all([scopesPromise, accompanyingCoursePromise])
|
||||
personLocation: accompanyingCourse.personLocation
|
||||
});
|
||||
resolve();
|
||||
dispatch('fetchReferrersSuggested');
|
||||
})).catch((error) => { commit('catchError', error) });
|
||||
},
|
||||
confirmAccompanyingCourse({ commit }) {
|
||||
@@ -498,6 +550,9 @@ let initPromise = Promise.all([scopesPromise, accompanyingCoursePromise])
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
store.dispatch('fetchReferrersSuggested');
|
||||
store.dispatch('fetchUsers');
|
||||
resolve(store);
|
||||
}));
|
||||
|
||||
|
Reference in New Issue
Block a user