From 3e8389174462a396df0cd815b26cb77927dd3dc6 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Fri, 25 Jun 2021 13:44:01 +0200 Subject: [PATCH] prepare new originDemand sub-component --- .../public/vuejs/AccompanyingCourse/App.vue | 3 ++ .../public/vuejs/AccompanyingCourse/api.js | 30 +++++++++++++++ .../components/OriginDemand.vue | 37 +++++++++++++++++++ .../vuejs/AccompanyingCourse/js/i18n.js | 3 ++ 4 files changed, 73 insertions(+) create mode 100644 src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/OriginDemand.vue diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/App.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/App.vue index 617c0e4dd..d06a4c001 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/App.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/App.vue @@ -5,6 +5,7 @@

{{ $t('course.title.draft') }}

{{ $t('course.title.active') }}

+ @@ -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, diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/api.js b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/api.js index 70b2ba56e..317485006 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/api.js +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/api.js @@ -165,6 +165,33 @@ const postSocialIssue = (id, body, method) => { }); }; +const getUsers = () => { + const url = `/api/1.0/...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 +200,8 @@ export { postParticipation, postRequestor, postResource, + getUsers, + getListOrigins, + getOrigin, postSocialIssue }; diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/OriginDemand.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/OriginDemand.vue new file mode 100644 index 000000000..8706601e2 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/OriginDemand.vue @@ -0,0 +1,37 @@ + + + + + diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/js/i18n.js b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/js/i18n.js index f5741b34a..f41424462 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/js/i18n.js +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/js/i18n.js @@ -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",