mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Merge branch '51-referent-parcours' into 'master'
parcours référent See merge request Chill-Projet/chill-bundles!106
This commit is contained in:
commit
f7e3be38a7
@ -282,7 +282,7 @@ class Activity implements HasCenterInterface, HasScopeInterface
|
||||
return $this->socialIssues;
|
||||
}
|
||||
|
||||
public function addSocialIssue(?SocialIssue $socialIssue): self
|
||||
public function addSocialIssue(SocialIssue $socialIssue): self
|
||||
{
|
||||
if (!$this->socialIssues->contains($socialIssue)) {
|
||||
$this->socialIssues[] = $socialIssue;
|
||||
@ -303,7 +303,7 @@ class Activity implements HasCenterInterface, HasScopeInterface
|
||||
return $this->socialActions;
|
||||
}
|
||||
|
||||
public function addSocialAction(?SocialAction $socialAction): self
|
||||
public function addSocialAction(SocialAction $socialAction): self
|
||||
{
|
||||
if (!$this->socialActions->contains($socialAction)) {
|
||||
$this->socialActions[] = $socialAction;
|
||||
|
@ -5,6 +5,7 @@
|
||||
<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>
|
||||
<requestor></requestor>
|
||||
<social-issue></social-issue>
|
||||
@ -19,6 +20,7 @@
|
||||
import { mapState } from 'vuex'
|
||||
import Banner from './components/Banner.vue';
|
||||
import StickyNav from './components/StickyNav.vue';
|
||||
import OriginDemand from './components/OriginDemand.vue';
|
||||
import PersonsAssociated from './components/PersonsAssociated.vue';
|
||||
import Requestor from './components/Requestor.vue';
|
||||
import SocialIssue from './components/SocialIssue.vue';
|
||||
@ -32,6 +34,7 @@ export default {
|
||||
components: {
|
||||
Banner,
|
||||
StickyNav,
|
||||
OriginDemand,
|
||||
PersonsAssociated,
|
||||
Requestor,
|
||||
SocialIssue,
|
||||
|
@ -98,7 +98,7 @@ const postParticipation = (id, payload, method) => {
|
||||
const postRequestor = (id, payload, method) => {
|
||||
//console.log('payload', payload);
|
||||
const body = (payload)? { type: payload.type, id: payload.id } : {};
|
||||
console.log('body', body);
|
||||
//console.log('body', body);
|
||||
const url = `/api/1.0/person/accompanying-course/${id}/requestor.json`;
|
||||
return fetch(url, {
|
||||
method: method,
|
||||
@ -131,7 +131,7 @@ const postResource = (id, payload, method) => {
|
||||
default:
|
||||
body['resource'] = { type: payload.type, id: payload.id };
|
||||
}
|
||||
console.log('body', body);
|
||||
//console.log('body', body);
|
||||
const url = `/api/1.0/person/accompanying-course/${id}/resource.json`;
|
||||
return fetch(url, {
|
||||
method: method,
|
||||
@ -165,6 +165,42 @@ 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 Error('Error with request resource response');
|
||||
});
|
||||
};
|
||||
|
||||
const whoami = () => {
|
||||
const url = `/api/1.0/main/whoami.json`;
|
||||
return fetch(url)
|
||||
.then(response => {
|
||||
if (response.ok) { return response.json(); }
|
||||
throw Error('Error with request resource response');
|
||||
});
|
||||
};
|
||||
|
||||
const getListOrigins = () => {
|
||||
const url = `/api/1.0/person/accompanying-period/origin.json`;
|
||||
return fetch(url)
|
||||
.then(response => {
|
||||
if (response.ok) { return response.json(); }
|
||||
throw Error('Error with request resource response');
|
||||
});
|
||||
}
|
||||
|
||||
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,
|
||||
@ -173,5 +209,9 @@ export {
|
||||
postParticipation,
|
||||
postRequestor,
|
||||
postResource,
|
||||
getUsers,
|
||||
whoami,
|
||||
getListOrigins,
|
||||
getOrigin,
|
||||
postSocialIssue
|
||||
};
|
||||
|
@ -0,0 +1,37 @@
|
||||
<template>
|
||||
<div class="vue-component">
|
||||
<h2><a name="section-05"></a>{{ $t('origin.title') }}</h2>
|
||||
|
||||
hop
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getOrigins } from '../api';
|
||||
import { mapState } from 'vuex';
|
||||
|
||||
export default {
|
||||
name: 'OriginDemand',
|
||||
data() {
|
||||
return {
|
||||
options: []
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapState({
|
||||
value: state => state.accompanyingCourse.origin,
|
||||
}),
|
||||
},
|
||||
mounted() {
|
||||
this.getOptions();
|
||||
},
|
||||
methods: {
|
||||
getOptions() {
|
||||
console.log('loading origins list');
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
</style>
|
@ -1,42 +1,43 @@
|
||||
<template>
|
||||
<div class="vue-component">
|
||||
<h2><a name="section-40"></a>{{ $t('referrer.title') }}</h2>
|
||||
|
||||
<div class="my-4">
|
||||
<label for="" class="">
|
||||
{{ $t('referrer.label') }}
|
||||
</label>
|
||||
|
||||
<VueMultiselect
|
||||
track-by="id"
|
||||
label="text"
|
||||
:multiple="false"
|
||||
:searchable="true"
|
||||
:placeholder="$t('referrer.placeholder')"
|
||||
@update:model-value="updateReferrer"
|
||||
:model-value="value"
|
||||
:options="options">
|
||||
</VueMultiselect>
|
||||
|
||||
<ul class="record_actions">
|
||||
<li>
|
||||
<button
|
||||
class="sc-button bt-create"
|
||||
type="button"
|
||||
name="button"
|
||||
@click="assignMe">
|
||||
{{ $t('referrer.assign_me') }}
|
||||
</button>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="vue-component">
|
||||
<h2><a name="section-40"></a>{{ $t('referrer.title') }}</h2>
|
||||
|
||||
<div class="my-4">
|
||||
<label for="" class="">
|
||||
{{ $t('referrer.label') }}
|
||||
</label>
|
||||
|
||||
<VueMultiselect
|
||||
name="selectReferrer"
|
||||
label="text"
|
||||
track-by="id"
|
||||
v-bind:multiple="false"
|
||||
v-bind:searchable="true"
|
||||
v-bind:placeholder="$t('referrer.placeholder')"
|
||||
v-model="value"
|
||||
v-bind:options="options"
|
||||
@select="updateReferrer">
|
||||
</VueMultiselect>
|
||||
|
||||
<ul class="record_actions">
|
||||
<li>
|
||||
<button
|
||||
class="sc-button bt-create"
|
||||
type="button"
|
||||
name="button"
|
||||
@click="assignMe">
|
||||
{{ $t('referrer.assign_me') }}
|
||||
</button>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import VueMultiselect from 'vue-multiselect';
|
||||
//import { getUsers } from '../api';
|
||||
import { getUsers, whoami } from '../api';
|
||||
import { mapState } from 'vuex';
|
||||
|
||||
export default {
|
||||
@ -57,20 +58,21 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
getOptions() {
|
||||
//getUsers().then(response => new Promise((resolve, reject) => {
|
||||
// console.log(response);
|
||||
// resolve();
|
||||
//})).catch(er => this.$store.commit('catchError'), error));
|
||||
getUsers().then(response => new Promise((resolve, reject) => {
|
||||
this.options = response.results;
|
||||
resolve();
|
||||
}));
|
||||
},
|
||||
updateReferrer(value) {
|
||||
//this.$store.dispatch('updateReferrer', this.transformValue(value));
|
||||
},
|
||||
transformValue(value) {
|
||||
let payload = value;
|
||||
return { payload, body, method };
|
||||
//console.log('value', value);
|
||||
this.$store.dispatch('updateReferrer', value);
|
||||
},
|
||||
assignMe() {
|
||||
console.log('assign me');
|
||||
//console.log('assign me');
|
||||
whoami().then(me => new Promise((resolve, reject) => {
|
||||
this.$store.dispatch('updateReferrer', me);
|
||||
resolve();
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -26,6 +26,9 @@ const appMessages = {
|
||||
regular: "régulier",
|
||||
occasional: "ponctuel"
|
||||
},
|
||||
origin: {
|
||||
title: "Origine de la demande",
|
||||
},
|
||||
persons_associated: {
|
||||
title: "Usagers concernés",
|
||||
counter: "Il n'y a pas encore d'usager | 1 usager | {count} usagers",
|
||||
|
@ -81,6 +81,10 @@ let initPromise = getAccompanyingCourse(id)
|
||||
updateSocialIssues(state, value) {
|
||||
state.accompanyingCourse.socialIssues = value;
|
||||
},
|
||||
updateReferrer(state, value) {
|
||||
console.log('value', value);
|
||||
state.accompanyingCourse.user = value;
|
||||
},
|
||||
confirmAccompanyingCourse(state, response) {
|
||||
//console.log('### mutation: confirmAccompanyingCourse: response', response);
|
||||
state.accompanyingCourse.step = response.step;
|
||||
@ -187,12 +191,19 @@ let initPromise = getAccompanyingCourse(id)
|
||||
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) => {
|
||||
commit('updateReferrer', course.user);
|
||||
resolve();
|
||||
})).catch((error) => { commit('catchError', error) });
|
||||
},
|
||||
confirmAccompanyingCourse({ commit }) {
|
||||
//console.log('## action: confirmAccompanyingCourse');
|
||||
confirmAccompanyingCourse(id)
|
||||
.then(response => new Promise((resolve, reject) => {
|
||||
window.location.replace(`/fr/parcours/${id}`);
|
||||
console.log('fetch resolve');
|
||||
//console.log('fetch resolve');
|
||||
commit('confirmAccompanyingCourse', response);
|
||||
resolve();
|
||||
})).catch((error) => { commit('catchError', error) });
|
||||
|
Loading…
x
Reference in New Issue
Block a user