Merge branch 110_extend_thirdparty into 'master'

This commit is contained in:
2021-08-19 12:19:00 +02:00
29 changed files with 657 additions and 518 deletions

View File

@@ -6,15 +6,21 @@
<h1 v-else>{{ $t('course.title.active') }}</h1>
<persons-associated></persons-associated>
<course-location></course-location>
<origin-demand></origin-demand>
<requestor></requestor>
<social-issue></social-issue>
<course-location></course-location>
<referrer></referrer>
<resources></resources>
<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">
<p>
<span>{{ error.sta }} {{ error.txt }}</span><br>
<span>{{ $t(error.msg) }}</span>
</p>
</div>
</template>
<script>
@@ -48,7 +54,8 @@ export default {
},
computed: mapState([
'accompanyingCourse',
'addressContext'
'addressContext',
'errorMsg'
])
};
</script>
@@ -89,6 +96,16 @@ export default {
}
table {
}
&.errors {
//display: flex;
//position: sticky;
//bottom: 0.3em;
//z-index: 1000;
margin: 1em 0;
padding: 1em;
border-radius: 0;
}
}
}
</style>

View File

@@ -9,7 +9,7 @@ const getAccompanyingCourse = (id) => {
return fetch(url)
.then(response => {
if (response.ok) { return response.json(); }
throw Error('Error with request resource response');
throw { msg: 'Error while retriving AccompanyingPeriod Course.', sta: response.status, txt: response.statusText, err: new Error(), body: response.body };
});
};
@@ -32,7 +32,8 @@ const patchAccompanyingCourse = (id, body) => {
})
.then(response => {
if (response.ok) { return response.json(); }
throw Error('Error with request resource response');
console.log(response);
throw { msg: 'Error while updating AccompanyingPeriod Course.', sta: response.status, txt: response.statusText, err: new Error(), body: response.body };
});
};
@@ -47,7 +48,7 @@ const confirmAccompanyingCourse = (id) => {
})
.then(response => {
if (response.ok) { return response.json(); }
throw Error('Error with request resource response');
throw { msg: 'Error while confirming AccompanyingPeriod Course.', sta: response.status, txt: response.statusText, err: new Error(), body: response.body };
});
};
@@ -59,7 +60,7 @@ const getSocialIssues = () => {
return fetch(url)
.then(response => {
if (response.ok) { return response.json(); }
throw Error('Error with request resource response');
throw { msg: 'Error while retriving Social Issues.', sta: response.status, txt: response.statusText, err: new Error(), body: response.body };
});
};
@@ -83,7 +84,7 @@ const postParticipation = (id, payload, method) => {
})
.then(response => {
if (response.ok) { return response.json(); }
throw Error('Error with request resource response');
throw { msg: 'Error while sending AccompanyingPeriod Course participation.', sta: response.status, txt: response.statusText, err: new Error(), body: response.body };
});
};
@@ -109,7 +110,7 @@ const postRequestor = (id, payload, method) => {
})
.then(response => {
if (response.ok) { return response.json(); }
throw Error('Error with request resource response');
throw { msg: 'Error while sending AccompanyingPeriod Course requestor', sta: response.status, txt: response.statusText, err: new Error(), body: response.body };
});
};
@@ -142,7 +143,7 @@ const postResource = (id, payload, method) => {
})
.then(response => {
if (response.ok) { return response.json(); }
throw Error('Error with request resource response');
throw { msg: 'Error while sending AccompanyingPeriod Course resource.', sta: response.status, txt: response.statusText, err: new Error(), body: response.body };
});
};
@@ -161,7 +162,7 @@ const postSocialIssue = (id, body, method) => {
})
.then(response => {
if (response.ok) { return response.json(); }
throw Error('Error with request resource response');
throw { msg: 'Error while updating SocialIssue.', sta: response.status, txt: response.statusText, err: new Error(), body: response.body };
});
};
@@ -170,7 +171,7 @@ const getUsers = () => {
return fetch(url)
.then(response => {
if (response.ok) { return response.json(); }
throw Error('Error with request resource response');
throw { msg: 'Error while retriving users.', sta: response.status, txt: response.statusText, err: new Error(), body: response.body };
});
};
@@ -179,7 +180,7 @@ const whoami = () => {
return fetch(url)
.then(response => {
if (response.ok) { return response.json(); }
throw Error('Error with request resource response');
throw { msg: 'Error while getting whoami.', sta: response.status, txt: response.statusText, err: new Error(), body: response.body };
});
};
@@ -188,7 +189,7 @@ const getListOrigins = () => {
return fetch(url)
.then(response => {
if (response.ok) { return response.json(); }
throw Error('Error with request resource response');
throw { msg: 'Error while retriving origin\'s list.', sta: response.status, txt: response.statusText, err: new Error(), body: response.body };
});
}

View File

@@ -60,7 +60,7 @@ export default {
personId: this.person.id
};
this.$store.dispatch('updateLocation', payload);
window.location.assign('#section-50');
window.location.assign('#section-20');
this.modal.showModal = false;
}
}

View File

@@ -27,17 +27,19 @@
]) }}
</div>
<ul class="record_actions">
<li>
<button type="submit" class="btn btn-save">{{ $t('action.save') }}</button>
</li>
<li v-if="initialComment !== null">
<a class="btn btn-delete"
@click="removeComment">
{{ $t('action.delete') }}
</a>
</li>
</ul>
<div>
<ul class="record_actions">
<li>
<button type="submit" class="btn btn-save">{{ $t('action.save') }}</button>
</li>
<li v-if="initialComment !== null">
<a class="btn btn-delete"
@click="removeComment">
{{ $t('action.delete') }}
</a>
</li>
</ul>
</div>
</form>
</div>

View File

@@ -3,24 +3,43 @@
<h2><a name="section-90"></a>
{{ $t('confirm.title') }}
</h2>
<div>
<p>
{{ $t('confirm.text_draft') }}
<span class="badge bg-secondary">{{ $t('course.step.draft') }}</span>
</p>
<p>
{{ $t('confirm.text_active') }}
<span class="badge bg-primary">{{ $t('course.step.active') }}</span>
</p>
<p v-html="$t('confirm.text_draft', [$t('course.step.draft')])"></p>
<div v-if="!isValidToBeConfirmed">
<div class="alert alert-warning">
{{ $t('confirm.alert_validation') }}
<ul class="mt-2">
<li v-for="k in validationKeys">
{{ $t(notValidMessages[k].msg) }}
<a :href="notValidMessages[k].anchor">
<i class="fa fa-level-up fa-fw"></i>
</a>
</li>
</ul>
</div>
<ul class="record_actions">
<li>
<button class="btn btn-save" disabled>
{{ $t('confirm.ok') }}
</button>
</li>
</ul>
</div>
<div v-else>
<p v-html="$t('confirm.text_active', [$t('course.step.active')])"></p>
<ul class="record_actions">
<li>
<button
class="btn btn-save"
@click="modal.showModal = true">
{{ $t('confirm.ok') }}
</button>
</li>
</ul>
</div>
<ul class="record_actions">
<li>
<button class="btn btn-save" @click="modal.showModal = true">
{{ $t('confirm.ok') }}
</button>
</li>
</ul>
</div>
<teleport to="body">
@@ -43,6 +62,7 @@
</template>
<script>
import {mapGetters, mapState} from "vuex";
import Modal from 'ChillMainAssets/vuejs/_components/Modal';
export default {
@@ -55,13 +75,34 @@ export default {
modal: {
showModal: false,
modalDialogClass: "modal-dialog-centered modal-md"
},
notValidMessages: {
participation: {
msg: 'confirm.participation_not_valid',
anchor: '#section-10'
},
location: {
msg: 'confirm.location_not_valid',
anchor: '#section-20' //
},
socialIssue: {
msg: 'confirm.socialIssue_not_valid',
anchor: '#section-50'
}
}
}
},
computed: {
accompanyingCourse() {
return this.$store.state.accompanyingCourse
}
...mapState([
'accompanyingCourse'
]),
...mapGetters([
'isParticipationValid',
'isSocialIssueValid',
'isLocationValid',
'validationKeys',
'isValidToBeConfirmed'
])
},
methods: {
confirmCourse() {
@@ -72,9 +113,3 @@ export default {
}
}
</script>
<style lang="scss" scoped>
div.vue-component > div {
//margin: 1em;
}
</style>

View File

@@ -1,28 +1,36 @@
<template>
<div class="vue-component">
<h2><a name="section-50"></a>
<h2><a name="section-20"></a>
{{ $t('courselocation.title') }}
</h2>
<div class="my-4">
<!-- {# include vue_address component #} -->
<div v-for="error in displayErrors" class="alert alert-danger my-2">
{{ error }}
</div>
<!-- {# include vue_address component #} -->
<div v-for="error in displayErrors" class="alert alert-danger my-2">
{{ error }}
</div>
<show-address
v-if="accompanyingCourse.location"
:address="accompanyingCourse.location">
</show-address>
<div v-if="hasNoLocation">
<label class="chill-no-data-statement">
{{ $t('courselocation.no_address') }}
</label>
</div>
<div v-if="isPersonLocation" class="alert alert-success">
<div v-if="isPersonLocation">
<label class="col-form-label">
{{ $t('courselocation.person_locator', [ accompanyingCourse.personLocation.text ]) }}
</div>
</label>
</div>
<div v-if="isTemporaryAddress" class="alert alert-warning">
<p>{{ $t('courselocation.temporary_address_must_be_changed') }}</p>
</div>
<show-address
v-if="accompanyingCourse.location"
:address="accompanyingCourse.location">
</show-address>
<div v-if="isTemporaryAddress" class="alert alert-warning">
<p>{{ $t('courselocation.temporary_address_must_be_changed') }}</p>
</div>
<div>
<ul class="record_actions">
<li>
<add-address
@@ -43,8 +51,8 @@
</button>
</li>
</ul>
</div>
</div>
</template>
@@ -96,6 +104,9 @@ export default {
isPersonLocation() {
return this.accompanyingCourse.locationStatus === 'person';
},
hasNoLocation() {
return this.accompanyingCourse.locationStatus === 'none';
},
isContextEdit() {
return this.context.edit;
}

View File

@@ -1,8 +1,8 @@
<template>
<div class="vue-component">
<h2><a name="section-20"></a>{{ $t('origin.title') }}</h2>
<h2><a name="section-30"></a>{{ $t('origin.title') }}</h2>
<div class="my-4">
<div class="mb-4">
<label for="selectOrigin">
{{ $t('origin.label') }}
</label>

View File

@@ -2,9 +2,12 @@
<div class="vue-component">
<h2><a name="section-10"></a>{{ $t('persons_associated.title')}}</h2>
<div>
<div v-if="participations.length > 0">
<label class="col-form-label">{{ $tc('persons_associated.counter', counter) }}</label>
</div>
<div v-else>
<label class="chill-no-data-statement">{{ $tc('persons_associated.counter', counter) }}</label>
</div>
<table class="table table-bordered table-striped border-dark align-middle" v-if="participations.length > 0">
<thead>

View File

@@ -2,7 +2,7 @@
<div class="vue-component">
<h2><a name="section-60"></a>{{ $t('referrer.title') }}</h2>
<div class="my-4">
<div>
<label class="col-form-label" for="selectReferrer">
{{ $t('referrer.label') }}
</label>
@@ -18,7 +18,9 @@
v-bind:options="options"
@select="updateReferrer">
</VueMultiselect>
</div>
<div>
<ul class="record_actions">
<li>
<button
@@ -30,8 +32,8 @@
</button>
</li>
</ul>
</div>
</div>
</template>

View File

@@ -1,12 +1,12 @@
<template>
<div class="vue-component">
<h2><a name="section-30"></a>{{ $t('requestor.title') }}</h2>
<h2><a name="section-40"></a>{{ $t('requestor.title') }}</h2>
<div v-if="accompanyingCourse.requestor" class="flex-table">
<label>
<input type="checkbox" v-model="isAnonymous" class="me-2" /><!-- :value="value" -->
<input type="checkbox" v-model="isAnonymous" class="me-2" />
{{ $t('requestor.is_anonymous') }}
</label>
@@ -67,7 +67,7 @@
</ul>
</div>
<div v-else>
<label>{{ $t('requestor.counter') }}</label>
<label class="chill-no-data-statement">{{ $t('requestor.counter') }}</label>
</div>
<div>

View File

@@ -3,9 +3,12 @@
<h2><a name="section-70"></a>{{ $t('resources.title')}}</h2>
<div>
<div v-if="resources.length > 0">
<label class="col-form-label">{{ $tc('resources.counter', counter) }}</label>
</div>
<div v-else>
<label class="chill-no-data-statement">{{ $tc('resources.counter', counter) }}</label>
</div>
<table class="table table-bordered table-striped border-dark align-middle" v-if="resources.length > 0">
<thead>

View File

@@ -64,7 +64,7 @@ export default {
emits: ['remove'],
computed: {
hasCurrentHouseholdAddress() {
if ( !this.resource.resource.type === 'person'
if ( this.resource.resource.type === 'person'
&& this.resource.resource.current_household_address !== null ) {
return true;
}

View File

@@ -1,6 +1,6 @@
<template>
<div class="vue-component">
<h2><a name="section-40"></a>{{ $t('social_issue.title') }}</h2>
<h2><a name="section-50"></a>{{ $t('social_issue.title') }}</h2>
<div class="my-4">
<!--label for="field">{{ $t('social_issue.label') }}</label

View File

@@ -34,7 +34,7 @@ const appMessages = {
},
persons_associated: {
title: "Usagers concernés",
counter: "Il n'y a pas encore d'usager | 1 usager | {count} usagers",
counter: "Il n'y a pas encore d'usagers | 1 usager | {count} usagers",
firstname: "Prénom",
lastname: "Nom",
name: "Nom",
@@ -70,11 +70,12 @@ const appMessages = {
edit_temporary_address: "Modifier l'adresse temporaire",
assign_course_address: "Désigner comme l'adresse du parcours",
remove_button: "Enlever l'adresse",
temporary_address_must_be_changed: "Cette addresse est temporaire et doit être remplacée par celle d'un usager de référence.",
temporary_address_must_be_changed: "Cette addresse est temporaire et devrait être remplacée par celle d'un usager de référence.",
sure: "Êtes-vous sûr ?",
sure_description: "Voulez-vous faire de cette adresse l'adresse du parcours ?",
ok: "Désigner comme adresse du parcours",
person_locator: "Parcours localisé auprès de {0}",
no_address: "Il n'y a pas d'adresse associée au parcours"
},
referrer: {
title: "Référent du parcours",
@@ -97,13 +98,28 @@ const appMessages = {
},
confirm: {
title: "Confirmation",
text_draft: "Le parcours est actuellement à l'état de ",
text_active: "En validant cette étape, vous lui donnez le statut ",
text_draft: "Le parcours est actuellement à l'état de <b>{0}</b>.",
text_active: "En validant cette étape, vous lui donnez le statut <b>{0}</b>.",
alert_validation: "Certaines conditions ne sont pas remplies pour pouvoir confirmer le parcours :",
participation_not_valid: "sélectionnez au minimum 1 usager",
socialIssue_not_valid: "sélectionnez au minimum une problématique sociale",
location_not_valid: "indiquez au minimum une localisation temporaire du parcours",
sure: "Êtes-vous sûr ?",
sure_description: "Une fois le changement confirmé, il n'est plus possible de le remettre à l'état de brouillon !",
sure_description: "Une fois le changement confirmé, il ne sera plus possible de le remettre à l'état de brouillon !",
ok: "Confirmer le parcours"
},
// catch errors
'Error while updating AccompanyingPeriod Course.': "Erreur du serveur lors de la mise à jour du parcours d'accompagnement.",
'Error while retriving AccompanyingPeriod Course.': "Erreur du serveur lors du chargement du parcours d'accompagnement.",
'Error while confirming AccompanyingPeriod Course.': "Erreur du serveur lors de la confirmation du parcours d'accompagnement.",
'Error while retriving Social Issues.': "Erreur du serveur lors du chargement des problématique sociales.",
'Error while sending AccompanyingPeriod Course participation.': "Erreur du serveur lors de l'envoi des infos d'un usager.",
'Error while sending AccompanyingPeriod Course requestor': "Erreur du serveur lors de l'envoi des infos du demandeur.",
'Error while sending AccompanyingPeriod Course resource.': "Erreur du serveur lors de l'envoi des infos d'un interlocuteur privilégié.",
'Error while updating SocialIssue.': "Erreur du serveur lors de la mise à jour d'une problématique sociale.",
'Error while retriving users.': "Erreur du serveur lors du chargement de la liste des travailleurs.",
'Error while getting whoami.': "Erreur du serveur lors de la requête 'qui suis-je ?'",
'Error while retriving origin\'s list.': "Erreur du serveur lors du chargement de la liste des origines de la demande.",
}
};

View File

@@ -25,9 +25,33 @@ let initPromise = getAccompanyingCourse(id)
errorMsg: []
},
getters: {
isParticipationValid(state) {
return state.accompanyingCourse.participations.length > 0;
},
isSocialIssueValid(state) {
return state.accompanyingCourse.socialIssues.length > 0;
},
isLocationValid(state) {
return state.accompanyingCourse.location !== null;
},
validationKeys(state, getters) {
let keys = [];
if (!getters.isParticipationValid) { keys.push('participation'); }
if (!getters.isLocationValid) { keys.push('location'); }
if (!getters.isSocialIssueValid) { keys.push('socialIssue'); }
//console.log('getter keys', keys);
return keys;
},
isValidToBeConfirmed(state, getters) {
if (getters.validationKeys.length === 0) {
return true;
}
return false;
}
},
mutations: {
catchError(state, error) {
console.log('### mutation: a new error have been catched and pushed in store !', error);
state.errorMsg.push(error);
},
removeParticipation(state, participation) {