diff --git a/CHANGELOG.md b/CHANGELOG.md index f2ad6b2ab..e3090d723 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,7 +21,13 @@ and this project adheres to * https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/13 * https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/199 +* [Person form] "accept sms" not required: + + https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/37 + https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/221 + ## Test release yyyy-mm-dd - +* On-The-Fly modale works for showing, editing and creating person and thirdparty ; +* AccompanyingCourse Resume page: list associated persons by household, see household when hover, and show on-the-fly modale when clicking on person ; diff --git a/src/Bundle/ChillMainBundle/Resources/public/lib/api/scope.js b/src/Bundle/ChillMainBundle/Resources/public/lib/api/scope.js index a8df4ed88..9073822bb 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/lib/api/scope.js +++ b/src/Bundle/ChillMainBundle/Resources/public/lib/api/scope.js @@ -4,9 +4,9 @@ const fetchScopes = () => { return response.json(); } }).then(data => { - console.log(data); + //console.log(data); return new Promise((resolve, reject) => { - console.log(data); + //console.log(data); resolve(data.results); }); }); diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/ActionButtons.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/ActionButtons.vue index 501d14e03..a90cb4bb9 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/ActionButtons.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/ActionButtons.vue @@ -1,17 +1,18 @@ diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress.vue index 265b45d70..55d8a93d1 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress.vue @@ -271,7 +271,7 @@ export default { validFrom: false, validTo: false }, - hideAddress: false + onlyButton: false }, entity: { address: {}, // <== loaded and returned @@ -325,11 +325,10 @@ export default { return (this.validFrom || this.validTo) ? true : false; }, hasSuggestions() { - console.log(this.context.suggestions); if (typeof(this.context.suggestions) !== 'undefined') { - return this.context.suggestions.length > 0; + console.log('hasSuggestions', this.context.suggestions); + return this.context.suggestions.length > 0; } - //return addressSuggestions.length > 0 return false; }, displaySuggestions() { @@ -354,9 +353,9 @@ export default { }, mounted() { - console.log('validFrom', this.validFrom); - console.log('validTo', this.validTo); - console.log('useDatePane', this.useDatePane); + //console.log('validFrom', this.validFrom); + //console.log('validTo', this.validTo); + //console.log('useDatePane', this.useDatePane); console.log('Mounted now !'); if (this.context.edit) { @@ -752,19 +751,6 @@ export default { this.closeSuggestPane(); }); } - - /* - * Method just add closing pane to the callback method - * (get out step1 show pane, submit button) - closePaneAndCallbackSubmit(payload) - { - //this.initForm(); - //this.resetPane(); // because parent callback will cast afterLastPaneAction() - console.log('will call parent callback method', payload); - // callback props method from parent - this.addressChangedCallback(payload); - } - */ } } diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/ShowPane.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/ShowPane.vue index a4e5c571d..8f80b840e 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/ShowPane.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/ShowPane.vue @@ -1,6 +1,6 @@ @@ -22,7 +24,7 @@ @@ -31,7 +33,7 @@ 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 b1da665a7..f742a6ea0 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/js/i18n.js +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/js/i18n.js @@ -1,5 +1,7 @@ -import { personMessages } from 'ChillPersonAssets/vuejs/_js/i18n' +import { personMessages } from 'ChillPersonAssets/vuejs/_js/i18n'; +import { thirdpartyMessages } from 'ChillThirdPartyAssets/vuejs/_js/i18n'; import { addressMessages } from 'ChillMainAssets/vuejs/Address/i18n'; +import { ontheflyMessages } from 'ChillMainAssets/vuejs/OnTheFly/i18n'; const appMessages = { fr: { @@ -48,7 +50,7 @@ const appMessages = { ok: "Oui, l'usager quitte le parcours", show_household_number: "Voir le ménage (n° {id})", show_household: "Voir le ménage", - person_without_household_warning: "Certaines personnes n'appartiennent à aucun ménage actuellement. Renseignez leur appartenance à un ménage dès que possible.", + person_without_household_warning: "Certaines usagers n'appartiennent actuellement à aucun ménage. Renseignez leur appartenance dès que possible.", update_household: "Modifier l'appartenance", participation_not_valid: "Sélectionnez ou créez au minimum 1 usager", }, @@ -82,7 +84,7 @@ const appMessages = { assign_course_address: "Désigner comme l'adresse du parcours", remove_button: "Enlever l'adresse", temporary_address_must_be_changed: "Cette adresse est temporaire. Le parcours devrait être localisé auprès d'un usager concerné.", - associate_at_least_one_person_with_one_household_with_address: "Associez au moins un membre du parcours à un ménage, et indiquez une adresse à ce ménage.", + associate_at_least_one_person_with_one_household_with_address: "Commencez d'abord par associer un membre du parcours à un ménage, et indiquez une adresse à ce ménage.", sure: "Êtes-vous sûr ?", sure_description: "Voulez-vous faire de cette adresse l'adresse du parcours ?", ok: "Désigner comme adresse du parcours", @@ -141,7 +143,7 @@ const appMessages = { } }; -Object.assign(appMessages.fr, personMessages.fr, addressMessages.fr); +Object.assign(appMessages.fr, personMessages.fr, thirdpartyMessages.fr, addressMessages.fr, ontheflyMessages.fr); export { appMessages diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/store/index.js b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/store/index.js index 5784e8d4c..ca1a89aa9 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/store/index.js +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/store/index.js @@ -11,6 +11,8 @@ import { getAccompanyingCourse, addScope, removeScope, } from '../api'; +import { patchPerson } from "ChillPersonAssets/vuejs/_api/OnTheFly"; +import { patchThirdparty } from "ChillThirdPartyAssets/vuejs/_api/OnTheFly"; const debug = process.env.NODE_ENV !== 'production'; @@ -48,7 +50,7 @@ let initPromise = Promise.all([scopesPromise, accompanyingCoursePromise]) return state.accompanyingCourse.location !== null; }, isScopeValid(state) { - console.log('is scope valid', state.accompanyingCourse.scopes.length > 0); + //console.log('is scope valid', state.accompanyingCourse.scopes.length > 0); return state.accompanyingCourse.scopes.length > 0; }, validationKeys(state, getters) { @@ -107,6 +109,36 @@ let initPromise = Promise.all([scopesPromise, accompanyingCoursePromise]) //console.log('### mutation: addResource', resource); state.accompanyingCourse.resources.push(resource); }, + updatePerson(state, payload) { + console.log('### mutation: updatePerson', payload); + let i = null; + switch (payload.target) { + case 'participation': + i = state.accompanyingCourse.participations.findIndex(e => e.person.id === payload.person.id ); + state.accompanyingCourse.participations[i].person = payload.person; + break; + case 'requestor': + state.accompanyingCourse.requestor = payload.person; + break; + case 'resource': + i = state.accompanyingCourse.resources.findIndex(e => e.resource.id === payload.person.id ); + state.accompanyingCourse.resources[i].resource = payload.person; + break; + } + }, + updateThirdparty(state, payload) { + console.log('### mutation: updateThirdparty', payload); + let i = null; + switch (payload.target) { + case 'requestor': + state.accompanyingCourse.requestor = payload.thirdparty; + break; + case 'resource': + i = state.accompanyingCourse.resources.findIndex(e => e.resource.id === payload.thirdparty.id ); + state.accompanyingCourse.resources[i].resource = payload.thirdparty; + break; + } + }, toggleIntensity(state, value) { state.accompanyingCourse.intensity = value; }, @@ -239,6 +271,38 @@ let initPromise = Promise.all([scopesPromise, accompanyingCoursePromise]) resolve(); })).catch((error) => { commit('catchError', error) }); }, + patchOnTheFly({ commit }, payload) { + console.log('## action: patch OnTheFly', payload); + let body = { type: payload.type }; + if (payload.type === 'person') { + body.firstName = payload.data.firstName; + body.lastName = payload.data.lastName; + if (payload.data.birthdate !== null) { body.birthdate = payload.data.birthdate; } + body.phonenumber = payload.data.phonenumber; + body.mobilenumber = payload.data.mobilenumber; + body.gender = payload.data.gender; + console.log('id', payload.data.id, 'and body', body); + patchPerson(payload.data.id, body) + .then(person => new Promise((resolve, reject) => { + console.log('patch person', person); + commit('updatePerson', { target: payload.target, person: person }); + resolve(); + })); + } + else if (payload.type === 'thirdparty') { + body.name = payload.data.text; + body.email = payload.data.email; + body.telephone = payload.data.phonenumber; + body.address = { id: payload.data.address.address_id }; + console.log('id', payload.data.id, 'and body', body); + patchThirdparty(payload.data.id, body) + .then(thirdparty => new Promise((resolve, reject) => { + console.log('patch thirdparty', thirdparty); + commit('updateThirdparty', { target: payload.target, thirdparty: thirdparty }); + resolve(); + })); + } + }, toggleIntensity({ commit }, payload) { //console.log(payload); patchAccompanyingCourse(id, { type: "accompanying_period", intensity: payload }) diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/Household.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/Household.vue index 98f5b0e45..5904737c8 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/Household.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/Household.vue @@ -146,7 +146,7 @@ export default { validFrom: false, validTo: false, }, - hideAddress: true, + onlyButton: true, button: { text: { create: 'household_members_editor.household.set_address', diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_api/OnTheFly.js b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_api/OnTheFly.js index 6adbc7028..c8031da58 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_api/OnTheFly.js +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_api/OnTheFly.js @@ -27,8 +27,27 @@ const postPerson = (body) => { throw Error('Error with request resource response'); }); }; - -export { - getPerson, - postPerson + +/* +* PATCH an existing person +*/ +const patchPerson = (id, body) => { + const url = `/api/1.0/person/person/${id}.json`; + return fetch(url, { + method: 'PATCH', + headers: { + 'Content-Type': 'application/json;charset=utf-8' + }, + body: JSON.stringify(body) + }) + .then(response => { + if (response.ok) { return response.json(); } + throw Error('Error with request resource response'); + }); +}; + +export { + getPerson, + postPerson, + patchPerson }; diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons.vue index 160d5d00b..e2415d1e4 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons.vue @@ -88,10 +88,11 @@ diff --git a/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_components/OnTheFly/ThirdParty.vue b/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_components/OnTheFly/ThirdParty.vue index 1b1207131..21b79a1c7 100644 --- a/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_components/OnTheFly/ThirdParty.vue +++ b/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_components/OnTheFly/ThirdParty.vue @@ -1,5 +1,5 @@