mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 15:13:50 +00:00
Merge conflicts fixed
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
<scopes></scopes>
|
||||
<referrer></referrer>
|
||||
<resources></resources>
|
||||
<start-date v-if="accompanyingCourse.step === 'CONFIRMED'"></start-date>
|
||||
<comment v-if="accompanyingCourse.step === 'DRAFT'"></comment>
|
||||
<confirm v-if="accompanyingCourse.step === 'DRAFT'"></confirm>
|
||||
|
||||
@@ -39,6 +40,7 @@ import Referrer from './components/Referrer.vue';
|
||||
import Resources from './components/Resources.vue';
|
||||
import Comment from './components/Comment.vue';
|
||||
import Confirm from './components/Confirm.vue';
|
||||
import StartDate from './components/StartDate.vue';
|
||||
|
||||
export default {
|
||||
name: 'App',
|
||||
@@ -56,6 +58,7 @@ export default {
|
||||
Resources,
|
||||
Comment,
|
||||
Confirm,
|
||||
StartDate
|
||||
},
|
||||
computed: {
|
||||
...mapState([
|
||||
|
@@ -15,21 +15,15 @@ const getAccompanyingCourse = (id) => {
|
||||
});
|
||||
};
|
||||
|
||||
const getUsers = () => {
|
||||
const url = `/api/1.0/main/user.json`;
|
||||
|
||||
return fetchResults(url);
|
||||
};
|
||||
const getUsers = () => fetchResults('/api/1.0/main/user.json');
|
||||
|
||||
const getReferrersSuggested = (course) => {
|
||||
const url = `/api/1.0/person/accompanying-course/${course.id}/referrers-suggested.json`;
|
||||
|
||||
return fetchResults(url);
|
||||
}
|
||||
|
||||
/*
|
||||
* Endpoint
|
||||
*/
|
||||
const getUserJobs = () => fetchResults('/api/1.0/main/user-job.json');
|
||||
|
||||
const getSocialIssues = () => {
|
||||
const url = `/api/1.0/person/social-work/social-issue.json`;
|
||||
return fetch(url)
|
||||
@@ -54,4 +48,5 @@ export {
|
||||
getAccompanyingCourse,
|
||||
getUsers,
|
||||
getReferrersSuggested,
|
||||
getUserJobs
|
||||
};
|
||||
|
@@ -19,6 +19,9 @@
|
||||
:options="options"
|
||||
group-values="locations"
|
||||
group-label="locationCategories"
|
||||
:select-label="$t('multiselect.select_label')"
|
||||
:deselect-label="$t('multiselect.deselect_label')"
|
||||
:selected-label="$t('multiselect.selected_label')"
|
||||
@select="updateAdminLocation">
|
||||
</VueMultiselect>
|
||||
</div>
|
||||
|
@@ -4,7 +4,7 @@
|
||||
<i class="fa fa-home fa-fw text-light" :title="$t('persons_associated.show_household_number', { id: h.id })"></i>
|
||||
</a>
|
||||
<span v-for="person in h.persons" class="me-1" :key="person.id">
|
||||
<on-the-fly :type="person.type" :id="person.id" :buttonText="person.text" :displayBadge="'true' === 'true'" action="show"></on-the-fly>
|
||||
<on-the-fly :type="person.type" :id="person.id" :buttonText="person.textAge" :displayBadge="'true' === 'true'" action="show"></on-the-fly>
|
||||
</span>
|
||||
</span>
|
||||
</template>
|
||||
|
@@ -59,9 +59,35 @@
|
||||
</template>
|
||||
<template v-slot:body>
|
||||
<p>{{ $t('confirm.sure_description') }}</p>
|
||||
<div v-if="accompanyingCourse.user === null">
|
||||
<div v-if="filteredReferrersSuggested.length === 0">
|
||||
<p class="alert alert-warning">{{ $t('confirm.no_suggested_referrer') }}</p>
|
||||
</div>
|
||||
<div v-if="filteredReferrersSuggested.length === 1" class="alert alert-info">
|
||||
<p>{{ $t('confirm.one_suggested_referrer') }}:</p>
|
||||
<ul class="list-suggest add-items inline">
|
||||
<li>
|
||||
<user-render-box-badge :user="filteredReferrersSuggested[0]"></user-render-box-badge>
|
||||
</li>
|
||||
</ul>
|
||||
<p>{{ $t('confirm.choose_suggested_referrer') }}</p>
|
||||
<ul class="record_actions">
|
||||
<li>
|
||||
<button class="btn btn-save mr-5" @click="chooseSuggestedReferrer">
|
||||
{{ $t('confirm.choose_button') }}
|
||||
</button>
|
||||
</li>
|
||||
<li>
|
||||
<button class="btn btn-secondary" @click="doNotChooseSuggestedReferrer">
|
||||
{{ $t('confirm.do_not_choose_button') }}
|
||||
</button>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<template v-slot:footer>
|
||||
<button class="btn btn-danger" @click="confirmCourse">
|
||||
<button class="btn btn-danger" :disabled="disableConfirm" @click="confirmCourse">
|
||||
{{ $t('confirm.ok') }}
|
||||
</button>
|
||||
</template>
|
||||
@@ -74,11 +100,13 @@
|
||||
<script>
|
||||
import {mapGetters, mapState} from "vuex";
|
||||
import Modal from 'ChillMainAssets/vuejs/_components/Modal';
|
||||
import UserRenderBoxBadge from "ChillMainAssets/vuejs/_components/Entity/UserRenderBoxBadge";
|
||||
|
||||
export default {
|
||||
name: "Confirm",
|
||||
components: {
|
||||
Modal,
|
||||
UserRenderBoxBadge
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -110,26 +138,38 @@ export default {
|
||||
scopes: {
|
||||
msg: 'confirm.set_a_scope',
|
||||
anchor: '#section-70'
|
||||
}
|
||||
}
|
||||
},
|
||||
job: {
|
||||
msg: 'confirm.job_not_valid',
|
||||
anchor: '#section-80'
|
||||
},
|
||||
},
|
||||
clickedDoNotChooseReferrer: false
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapState([
|
||||
'accompanyingCourse'
|
||||
]),
|
||||
...mapState({
|
||||
accompanyingCourse: state => state.accompanyingCourse,
|
||||
filteredReferrersSuggested: state => state.filteredReferrersSuggested
|
||||
}),
|
||||
...mapGetters([
|
||||
'isParticipationValid',
|
||||
'isSocialIssueValid',
|
||||
'isOriginValid',
|
||||
'isAdminLocationValid',
|
||||
'isLocationValid',
|
||||
'isJobValid',
|
||||
'validationKeys',
|
||||
'isValidToBeConfirmed'
|
||||
]),
|
||||
deleteLink() {
|
||||
return `/fr/parcours/${this.accompanyingCourse.id}/delete`; //TODO locale
|
||||
},
|
||||
disableConfirm() {
|
||||
return this.clickedDoNotChooseReferrer
|
||||
? (this.accompanyingCourse.user === null && this.filteredReferrersSuggested.length === 0)
|
||||
: (this.accompanyingCourse.user === null && this.filteredReferrersSuggested.length === 0) || (this.filteredReferrersSuggested.length === 1);
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
confirmCourse() {
|
||||
@@ -141,6 +181,19 @@ export default {
|
||||
this.$toast.open({message: 'An error occurred'})
|
||||
}
|
||||
});
|
||||
},
|
||||
chooseSuggestedReferrer() {
|
||||
this.$store.dispatch('updateReferrer', this.filteredReferrersSuggested[0])
|
||||
.catch(({name, violations}) => {
|
||||
if (name === 'ValidationException' || name === 'AccessException') {
|
||||
violations.forEach((violation) => this.$toast.open({message: violation}));
|
||||
} else {
|
||||
this.$toast.open({message: 'An error occurred'})
|
||||
}
|
||||
});
|
||||
},
|
||||
doNotChooseSuggestedReferrer() {
|
||||
this.clickedDoNotChooseReferrer = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -27,7 +27,7 @@
|
||||
:value="p.person.id"
|
||||
/>
|
||||
<label class="form-check-label">
|
||||
{{ p.person.text }}
|
||||
<person-text :person="p.person"></person-text>
|
||||
</label>
|
||||
</div>
|
||||
<input type="hidden" name="expand_suggestions" value="true">
|
||||
@@ -50,9 +50,9 @@
|
||||
<div v-if="suggestedPersons.length > 0">
|
||||
<ul class="list-suggest add-items inline">
|
||||
<li v-for="p in suggestedPersons" :key="p.id" @click="addSuggestedPerson(p)">
|
||||
<span>{{ p.text }}</span>
|
||||
</li>
|
||||
</ul>
|
||||
<person-text :person="p"></person-text>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
@@ -76,12 +76,14 @@
|
||||
import {mapGetters, mapState} from 'vuex';
|
||||
import ParticipationItem from "./PersonsAssociated/ParticipationItem.vue";
|
||||
import AddPersons from 'ChillPersonAssets/vuejs/_components/AddPersons.vue';
|
||||
import PersonText from 'ChillPersonAssets/vuejs/_components/Entity/PersonText.vue';
|
||||
|
||||
export default {
|
||||
name: 'PersonsAssociated',
|
||||
components: {
|
||||
ParticipationItem,
|
||||
AddPersons
|
||||
AddPersons,
|
||||
PersonText
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -110,15 +112,15 @@ export default {
|
||||
)
|
||||
// filter persons appearing twice in requestor and resources
|
||||
.filter(
|
||||
(e, index, suggested) => {
|
||||
(e, index, suggested) => {
|
||||
for (let i = 0; i < suggested.length; i = i+1) {
|
||||
if (i < index && e.id === suggested[i].id) {
|
||||
return false
|
||||
}
|
||||
if (i < index && e.id === suggested[i].id) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
)
|
||||
}),
|
||||
...mapGetters([
|
||||
|
@@ -28,7 +28,7 @@
|
||||
</a>
|
||||
</li>
|
||||
<li><on-the-fly :type="participation.person.type" :id="participation.person.id" action="show"></on-the-fly></li>
|
||||
<li><on-the-fly :type="participation.person.type" :id="participation.person.id" action="edit" @saveFormOnTheFly="saveFormOnTheFly"></on-the-fly></li>
|
||||
<li><on-the-fly :type="participation.person.type" :id="participation.person.id" action="edit" @saveFormOnTheFly="saveFormOnTheFly" :canCloseModal="canCloseOnTheFlyModal"></on-the-fly></li>
|
||||
<li>
|
||||
<button v-if="!participation.endDate"
|
||||
class="btn btn-sm btn-remove"
|
||||
@@ -63,6 +63,7 @@ import OnTheFly from 'ChillMainAssets/vuejs/OnTheFly/components/OnTheFly.vue';
|
||||
import ButtonLocation from '../ButtonLocation.vue';
|
||||
import PersonRenderBox from 'ChillPersonAssets/vuejs/_components/Entity/PersonRenderBox.vue';
|
||||
import Modal from 'ChillMainAssets/vuejs/_components/Modal';
|
||||
import { makeFetch } from 'ChillMainAssets/lib/api/apiMethods';
|
||||
|
||||
export default {
|
||||
name: 'ParticipationItem',
|
||||
@@ -88,7 +89,8 @@ export default {
|
||||
addAge: false,
|
||||
hLevel: 1
|
||||
}
|
||||
}
|
||||
},
|
||||
canCloseOnTheFlyModal: false
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -110,14 +112,53 @@ export default {
|
||||
saveFormOnTheFly(payload) {
|
||||
console.log('saveFormOnTheFly: type', payload.type, ', data', payload.data);
|
||||
payload.target = 'participation';
|
||||
this.$store.dispatch('patchOnTheFly', payload)
|
||||
.catch(({name, violations}) => {
|
||||
if (name === 'ValidationException' || name === 'AccessException') {
|
||||
violations.forEach((violation) => this.$toast.open({message: violation}));
|
||||
} else {
|
||||
this.$toast.open({message: 'An error occurred'})
|
||||
}
|
||||
});
|
||||
|
||||
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;
|
||||
|
||||
makeFetch('PATCH', `/api/1.0/person/person/${payload.data.id}.json`, body)
|
||||
.then(response => {
|
||||
this.$store.dispatch('addPerson', { target: payload.target, body: response })
|
||||
this.canCloseOnTheFlyModal = true;
|
||||
})
|
||||
.catch((error) => {
|
||||
if (error.name === 'ValidationException') {
|
||||
for (let v of error.violations) {
|
||||
this.$toast.open({message: v });
|
||||
}
|
||||
} else {
|
||||
this.$toast.open({message: 'An error occurred'});
|
||||
}
|
||||
})
|
||||
}
|
||||
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 };
|
||||
|
||||
makeFetch('PATCH', `/api/1.0/third-party/third-party/${payload.data.id}.json`, body)
|
||||
.then(response => {
|
||||
this.$store.dispatch('addThirdparty', { target: payload.target, body: response })
|
||||
this.canCloseOnTheFlyModal = true;
|
||||
})
|
||||
.catch((error) => {
|
||||
if (error.name === 'ValidationException') {
|
||||
for (let v of error.violations) {
|
||||
this.$toast.open({message: v });
|
||||
}
|
||||
} else {
|
||||
this.$toast.open({message: 'An error occurred'});
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -3,6 +3,27 @@
|
||||
<h2><a id="section-80"></a>{{ $t('referrer.title') }}</h2>
|
||||
|
||||
<div>
|
||||
|
||||
<label class="col-form-label" for="selectJob">
|
||||
{{ $t('job.label') }}
|
||||
</label>
|
||||
|
||||
<VueMultiselect
|
||||
name="selectJob"
|
||||
label="text"
|
||||
:custom-label="customJobLabel"
|
||||
track-by="id"
|
||||
:multiple="false"
|
||||
:searchable="true"
|
||||
:placeholder="$t('job.placeholder')"
|
||||
v-model="valueJob"
|
||||
:options="jobs"
|
||||
:select-label="$t('multiselect.select_label')"
|
||||
:deselect-label="$t('multiselect.deselect_label')"
|
||||
:selected-label="$t('multiselect.selected_label')"
|
||||
@select="updateJob">
|
||||
</VueMultiselect>
|
||||
|
||||
<label class="col-form-label" for="selectReferrer">
|
||||
{{ $t('referrer.label') }}
|
||||
</label>
|
||||
@@ -15,16 +36,16 @@
|
||||
:searchable="true"
|
||||
:placeholder="$t('referrer.placeholder')"
|
||||
v-model="value"
|
||||
v-bind:options="users"
|
||||
:options="users"
|
||||
:select-label="$t('multiselect.select_label')"
|
||||
:deselect-label="$t('multiselect.deselect_label')"
|
||||
:selected-label="$t('multiselect.selected_label')"
|
||||
@select="updateReferrer">
|
||||
</VueMultiselect>
|
||||
|
||||
<template v-if="referrersSuggested.length > 0">
|
||||
<template v-if="filteredReferrersSuggested.length > 0">
|
||||
<ul class="list-suggest add-items inline">
|
||||
<li v-for="(u, i) in referrersSuggested" @click="updateReferrer(u)" :key="`referrer-${i}`">
|
||||
<li v-for="(u, i) in filteredReferrersSuggested" @click="updateReferrer(u)" :key="`referrer-${i}`">
|
||||
<span>
|
||||
<user-render-box-badge :user="u"></user-render-box-badge>
|
||||
</span>
|
||||
@@ -47,13 +68,17 @@
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div v-if="!isJobValid" class="alert alert-warning to-confirm">
|
||||
{{ $t('job.not_valid') }}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import VueMultiselect from 'vue-multiselect';
|
||||
import { makeFetch } from 'ChillMainAssets/lib/api/apiMethods';
|
||||
import { mapState } from 'vuex';
|
||||
import { mapState, mapGetters } from 'vuex';
|
||||
import UserRenderBoxBadge from "ChillMainAssets/vuejs/_components/Entity/UserRenderBoxBadge";
|
||||
|
||||
export default {
|
||||
@@ -62,23 +87,33 @@ export default {
|
||||
UserRenderBoxBadge,
|
||||
VueMultiselect,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
jobs: []
|
||||
}
|
||||
},
|
||||
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;
|
||||
})
|
||||
},
|
||||
valueJob: state => state.accompanyingCourse.job,
|
||||
users: state => state.users.filter(u => {
|
||||
if (u.user_job && state.accompanyingCourse.job) {
|
||||
return u.user_job.id === state.accompanyingCourse.job.id;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}),
|
||||
filteredReferrersSuggested: state => state.filteredReferrersSuggested,
|
||||
}),
|
||||
...mapGetters([
|
||||
'isJobValid'
|
||||
])
|
||||
},
|
||||
mounted() {
|
||||
this.getJobs();
|
||||
},
|
||||
methods: {
|
||||
updateReferrer(value) {
|
||||
//console.log('value', value);
|
||||
this.$store.dispatch('updateReferrer', value)
|
||||
.catch(({name, violations}) => {
|
||||
if (name === 'ValidationException' || name === 'AccessException') {
|
||||
@@ -88,6 +123,29 @@ export default {
|
||||
}
|
||||
});
|
||||
},
|
||||
getJobs() {
|
||||
const url = '/api/1.0/main/user-job.json';
|
||||
makeFetch('GET', url)
|
||||
.then(response => {
|
||||
this.jobs = response.results;
|
||||
})
|
||||
.catch((error) => {
|
||||
this.$toast.open({message: error.txt})
|
||||
})
|
||||
},
|
||||
updateJob(value) {
|
||||
this.$store.dispatch('updateJob', value)
|
||||
.catch(({name, violations}) => {
|
||||
if (name === 'ValidationException' || name === 'AccessException') {
|
||||
violations.forEach((violation) => this.$toast.open({message: violation}));
|
||||
} else {
|
||||
this.$toast.open({message: 'An error occurred'})
|
||||
}
|
||||
});
|
||||
},
|
||||
customJobLabel(value) {
|
||||
return value.label.fr;
|
||||
},
|
||||
assignMe() {
|
||||
const url = `/api/1.0/main/whoami.json`;
|
||||
makeFetch('GET', url)
|
||||
|
@@ -45,7 +45,8 @@
|
||||
addInfo: true,
|
||||
hLevel: 3,
|
||||
isMultiline: true,
|
||||
isConfidential: false
|
||||
isConfidential: false,
|
||||
addAge: true,
|
||||
}"
|
||||
>
|
||||
<template v-slot:record-actions>
|
||||
@@ -113,7 +114,7 @@
|
||||
<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>
|
||||
<li><on-the-fly :type="accompanyingCourse.requestor.type" :id="accompanyingCourse.requestor.id" action="edit" @saveFormOnTheFly="saveFormOnTheFly" :canCloseModal="canCloseOnTheFlyModal"></on-the-fly></li>
|
||||
</ul>
|
||||
</template>
|
||||
</person-render-box>
|
||||
@@ -136,9 +137,10 @@
|
||||
<div v-if="accompanyingCourse.requestor === null && suggestedEntities.length > 0">
|
||||
<ul class="list-suggest add-items inline">
|
||||
<li v-for="p in suggestedEntities" :key="uniqueId(p)" @click="addSuggestedEntity(p)">
|
||||
<span>{{ p.text }}</span>
|
||||
</li>
|
||||
</ul>
|
||||
<person-text v-if="p.type === 'person'" :person="p"></person-text>
|
||||
<span v-else>{{ p.text }}</span>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
@@ -162,6 +164,9 @@ import PersonRenderBox from '../../_components/Entity/PersonRenderBox.vue';
|
||||
import ThirdPartyRenderBox from 'ChillThirdPartyAssets/vuejs/_components/Entity/ThirdPartyRenderBox.vue';
|
||||
import Confidential from 'ChillMainAssets/vuejs/_components/Confidential.vue';
|
||||
import { mapState } from 'vuex';
|
||||
import { makeFetch } from 'ChillMainAssets/lib/api/apiMethods';
|
||||
import PersonText from 'ChillPersonAssets/vuejs/_components/Entity/PersonText.vue';
|
||||
|
||||
|
||||
export default {
|
||||
name: 'Requestor',
|
||||
@@ -170,7 +175,8 @@ export default {
|
||||
OnTheFly,
|
||||
PersonRenderBox,
|
||||
ThirdPartyRenderBox,
|
||||
Confidential
|
||||
Confidential,
|
||||
PersonText
|
||||
},
|
||||
props: ['isAnonymous'],
|
||||
data() {
|
||||
@@ -182,7 +188,8 @@ export default {
|
||||
priority: null,
|
||||
uniq: true,
|
||||
}
|
||||
}
|
||||
},
|
||||
canCloseOnTheFlyModal: false
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -246,14 +253,52 @@ export default {
|
||||
saveFormOnTheFly(payload) {
|
||||
console.log('saveFormOnTheFly: type', payload.type, ', data', payload.data);
|
||||
payload.target = 'requestor';
|
||||
this.$store.dispatch('patchOnTheFly', payload)
|
||||
.catch(({name, violations}) => {
|
||||
if (name === 'ValidationException' || name === 'AccessException') {
|
||||
violations.forEach((violation) => this.$toast.open({message: violation}));
|
||||
} else {
|
||||
this.$toast.open({message: 'An error occurred'})
|
||||
}
|
||||
});
|
||||
|
||||
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;
|
||||
|
||||
makeFetch('PATCH', `/api/1.0/person/person/${payload.data.id}.json`, body)
|
||||
.then(response => {
|
||||
this.$store.dispatch('addPerson', { target: payload.target, body: response })
|
||||
this.canCloseOnTheFlyModal = true;
|
||||
})
|
||||
.catch((error) => {
|
||||
if (error.name === 'ValidationException') {
|
||||
for (let v of error.violations) {
|
||||
this.$toast.open({message: v });
|
||||
}
|
||||
} else {
|
||||
this.$toast.open({message: 'An error occurred'});
|
||||
}
|
||||
})
|
||||
}
|
||||
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 };
|
||||
|
||||
makeFetch('PATCH', `/api/1.0/third-party/third-party/${payload.data.id}.json`, body)
|
||||
.then(response => {
|
||||
this.$store.dispatch('addThirdparty', { target: payload.target, body: response })
|
||||
this.canCloseOnTheFlyModal = true;
|
||||
})
|
||||
.catch((error) => {
|
||||
if (error.name === 'ValidationException') {
|
||||
for (let v of error.violations) {
|
||||
this.$toast.open({message: v });
|
||||
}
|
||||
} else {
|
||||
this.$toast.open({message: 'An error occurred'});
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
addSuggestedEntity(e) {
|
||||
this.$store.dispatch('addRequestor', { result: e, type: e.type })
|
||||
|
@@ -22,7 +22,8 @@
|
||||
<div v-if="suggestedEntities.length > 0">
|
||||
<ul class="list-suggest add-items inline">
|
||||
<li v-for="p in suggestedEntities" :key="uniqueId(p)" @click="addSuggestedEntity(p)">
|
||||
<span>{{ p.text }}</span>
|
||||
<person-text v-if="p.type === 'person'" :person="p"></person-text>
|
||||
<span v-else>{{ p.text }}</span>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
@@ -45,12 +46,15 @@
|
||||
import { mapState } from 'vuex';
|
||||
import AddPersons from 'ChillPersonAssets/vuejs/_components/AddPersons.vue';
|
||||
import ResourceItem from './Resources/ResourceItem.vue';
|
||||
import PersonText from 'ChillPersonAssets/vuejs/_components/Entity/PersonText.vue';
|
||||
|
||||
|
||||
export default {
|
||||
name: 'Resources',
|
||||
components: {
|
||||
AddPersons,
|
||||
ResourceItem
|
||||
ResourceItem,
|
||||
PersonText
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
@@ -34,7 +34,8 @@
|
||||
:type="resource.resource.type"
|
||||
:id="resource.resource.id"
|
||||
action="edit"
|
||||
@saveFormOnTheFly="saveFormOnTheFly">
|
||||
@saveFormOnTheFly="saveFormOnTheFly"
|
||||
:canCloseModal="canCloseOnTheFlyModal">
|
||||
</on-the-fly>
|
||||
</li>
|
||||
<li>
|
||||
@@ -80,7 +81,8 @@
|
||||
:type="resource.resource.type"
|
||||
:id="resource.resource.id"
|
||||
action="edit"
|
||||
@saveFormOnTheFly="saveFormOnTheFly">
|
||||
@saveFormOnTheFly="saveFormOnTheFly"
|
||||
:canCloseModal="canCloseOnTheFlyModal">
|
||||
</on-the-fly>
|
||||
</li>
|
||||
<li>
|
||||
@@ -101,6 +103,7 @@ import ButtonLocation from '../ButtonLocation.vue';
|
||||
import PersonRenderBox from 'ChillPersonAssets/vuejs/_components/Entity/PersonRenderBox.vue';
|
||||
import ThirdPartyRenderBox from 'ChillThirdPartyAssets/vuejs/_components/Entity/ThirdPartyRenderBox.vue';
|
||||
import WriteComment from './WriteComment';
|
||||
import { makeFetch } from 'ChillMainAssets/lib/api/apiMethods';
|
||||
|
||||
export default {
|
||||
name: 'ResourceItem',
|
||||
@@ -113,6 +116,11 @@ export default {
|
||||
},
|
||||
props: ['resource'],
|
||||
emits: ['remove'],
|
||||
data() {
|
||||
return {
|
||||
canCloseOnTheFlyModal: false
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
parent() {
|
||||
return {
|
||||
@@ -136,14 +144,52 @@ export default {
|
||||
saveFormOnTheFly(payload) {
|
||||
console.log('saveFormOnTheFly: type', payload.type, ', data', payload.data);
|
||||
payload.target = 'resource';
|
||||
this.$store.dispatch('patchOnTheFly', payload)
|
||||
.catch(({name, violations}) => {
|
||||
if (name === 'ValidationException' || name === 'AccessException') {
|
||||
violations.forEach((violation) => this.$toast.open({message: violation}));
|
||||
} else {
|
||||
this.$toast.open({message: 'An error occurred'})
|
||||
}
|
||||
});
|
||||
|
||||
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;
|
||||
|
||||
makeFetch('PATCH', `/api/1.0/person/person/${payload.data.id}.json`, body)
|
||||
.then(response => {
|
||||
this.$store.dispatch('addPerson', { target: payload.target, body: response })
|
||||
this.canCloseOnTheFlyModal = true;
|
||||
})
|
||||
.catch((error) => {
|
||||
if (error.name === 'ValidationException') {
|
||||
for (let v of error.violations) {
|
||||
this.$toast.open({message: v });
|
||||
}
|
||||
} else {
|
||||
this.$toast.open({message: 'An error occurred'});
|
||||
}
|
||||
})
|
||||
}
|
||||
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 };
|
||||
|
||||
makeFetch('PATCH', `/api/1.0/third-party/third-party/${payload.data.id}.json`, body)
|
||||
.then(response => {
|
||||
this.$store.dispatch('addThirdparty', { target: payload.target, body: response })
|
||||
this.canCloseOnTheFlyModal = true;
|
||||
})
|
||||
.catch((error) => {
|
||||
if (error.name === 'ValidationException') {
|
||||
for (let v of error.violations) {
|
||||
this.$toast.open({message: v });
|
||||
}
|
||||
} else {
|
||||
this.$toast.open({message: 'An error occurred'});
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
updateComment(resource) {
|
||||
console.log('updateComment', resource);
|
||||
|
@@ -7,7 +7,7 @@
|
||||
-->
|
||||
<VueMultiselect
|
||||
name="field"
|
||||
:close-on-select="false"
|
||||
:close-on-select="true"
|
||||
:allow-empty="true"
|
||||
:show-labels="false"
|
||||
track-by="id"
|
||||
|
@@ -0,0 +1,46 @@
|
||||
<template>
|
||||
<div class="vue-component">
|
||||
<h2><a id="section-110"></a>
|
||||
{{ $t('startdate.change') }}
|
||||
</h2>
|
||||
<div>
|
||||
<div class="mb-3 row">
|
||||
<label class="col-form-label col-sm-4">{{ $t('startdate.date') }}</label>
|
||||
<div class="col-sm-8">
|
||||
<input class="form-control" type="date" v-model="startDate" @change="updateStartDate" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import { datetimeToISO, dateToISO, ISOToDate, ISOToDatetime} from 'ChillMainAssets/chill/js/date.js';
|
||||
import { mapState, mapGetters } from 'vuex';
|
||||
|
||||
export default {
|
||||
name: 'startDate',
|
||||
methods: {
|
||||
updateStartDate(event) {
|
||||
const date = event.target.value;
|
||||
// console.log(date)
|
||||
this.$store.dispatch('updateStartDate', date)
|
||||
.catch(({name, violations}) => {
|
||||
if (name === 'ValidationException' || name === 'AccessException') {
|
||||
violations.forEach((violation) => this.$toast.open({message: violation}));
|
||||
} else {
|
||||
this.$toast.open({message: 'An error occurred'})
|
||||
}
|
||||
});
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
...mapState({
|
||||
startDate: state => dateToISO(ISOToDatetime(state.accompanyingCourse.openingDate.datetime))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
@@ -13,7 +13,7 @@ const root = window.vueRootComponent;
|
||||
* Load all App component, for AccompanyingCourse edition page
|
||||
*/
|
||||
if (root === 'app') {
|
||||
initPromise.then(store => {
|
||||
initPromise(root).then(store => {
|
||||
|
||||
const i18n = _createI18n(appMessages);
|
||||
|
||||
@@ -37,7 +37,7 @@ if (root === 'app') {
|
||||
* Load only Banner sub-component, for all others AccompanyingCourse page
|
||||
*/
|
||||
if (root === 'banner') {
|
||||
initPromise.then(store => {
|
||||
initPromise(root).then(store => {
|
||||
|
||||
const i18n = _createI18n(appMessages);
|
||||
|
||||
|
@@ -102,7 +102,7 @@ const appMessages = {
|
||||
no_address: "Il n'y a pas d'adresse associée au parcours"
|
||||
},
|
||||
scopes: {
|
||||
title: "Services",
|
||||
title: "Services concernés",
|
||||
add_at_least_one: "Indiquez au moins un service",
|
||||
},
|
||||
referrer: {
|
||||
@@ -134,11 +134,26 @@ const appMessages = {
|
||||
location_not_valid: "indiquez au minimum une localisation temporaire du parcours",
|
||||
origin_not_valid: "Indiquez une origine à la demande",
|
||||
adminLocation_not_valid: "Indiquez une localisation administrative à la demande",
|
||||
job_not_valid: "Indiquez un métier du référent",
|
||||
set_a_scope: "indiquez au moins un service",
|
||||
sure: "Êtes-vous sûr ?",
|
||||
sure_description: "Une fois le changement confirmé, il ne sera plus possible de le remettre à l'état de brouillon !",
|
||||
ok: "Confirmer le parcours",
|
||||
delete: "Supprimer le parcours"
|
||||
delete: "Supprimer le parcours",
|
||||
no_suggested_referrer: "Il n'y a aucun référent qui puisse être désigné pour ce parcours. Vérifiez la localisation du parcours, les métiers et service indiqués. Si le problème persiste, contactez l'administrateur du logiciel.",
|
||||
one_suggested_referrer: "Un unique référent peut être suggéré pour ce parcours",
|
||||
choose_suggested_referrer: "Voulez-vous le désigner directement ?",
|
||||
choose_button: "Désigner",
|
||||
do_not_choose_button: "Ne pas désigner"
|
||||
},
|
||||
job: {
|
||||
label: "Métier",
|
||||
placeholder: "Choisir un métier",
|
||||
not_valid: "Sélectionnez un métier du référent"
|
||||
},
|
||||
startdate: {
|
||||
change: "Date d'ouverture",
|
||||
date: "Date d'ouverture",
|
||||
},
|
||||
// catch errors
|
||||
'Error while updating AccompanyingPeriod Course.': "Erreur du serveur lors de la mise à jour du parcours d'accompagnement.",
|
||||
|
@@ -8,15 +8,20 @@ import { getAccompanyingCourse,
|
||||
import { patchPerson } from "ChillPersonAssets/vuejs/_api/OnTheFly";
|
||||
import { patchThirdparty } from "ChillThirdPartyAssets/vuejs/_api/OnTheFly";
|
||||
import { makeFetch } from 'ChillMainAssets/lib/api/apiMethods';
|
||||
import { datetimeToISO, ISOToDate, ISOToDatetime } from 'ChillMainAssets/chill/js/date.js';
|
||||
|
||||
|
||||
const debug = process.env.NODE_ENV !== 'production';
|
||||
const id = window.accompanyingCourseId;
|
||||
|
||||
let scopesPromise = fetchScopes();
|
||||
let getScopesPromise = (root) => {
|
||||
if (root === 'app') {
|
||||
return fetchScopes();
|
||||
}
|
||||
}
|
||||
let accompanyingCoursePromise = getAccompanyingCourse(id);
|
||||
|
||||
let initPromise = Promise.all([scopesPromise, accompanyingCoursePromise])
|
||||
let initPromise = (root) => Promise.all([getScopesPromise(root), accompanyingCoursePromise])
|
||||
.then(([scopes, accompanyingCourse]) => new Promise((resolve, reject) => {
|
||||
|
||||
const store = createStore({
|
||||
@@ -35,6 +40,7 @@ let initPromise = Promise.all([scopesPromise, accompanyingCoursePromise])
|
||||
scopesAtBackend: accompanyingCourse.scopes.map(scope => scope),
|
||||
// the users which are available for referrer
|
||||
referrersSuggested: [],
|
||||
filteredReferrersSuggested: [],
|
||||
// all the users available
|
||||
users: [],
|
||||
permissions: {}
|
||||
@@ -55,6 +61,9 @@ let initPromise = Promise.all([scopesPromise, accompanyingCoursePromise])
|
||||
isLocationValid(state) {
|
||||
return state.accompanyingCourse.location !== null;
|
||||
},
|
||||
isJobValid(state) {
|
||||
return state.accompanyingCourse.job !== null;
|
||||
},
|
||||
isScopeValid(state) {
|
||||
//console.log('is scope valid', state.accompanyingCourse.scopes.length > 0);
|
||||
return state.accompanyingCourse.scopes.length > 0;
|
||||
@@ -63,6 +72,7 @@ let initPromise = Promise.all([scopesPromise, accompanyingCoursePromise])
|
||||
let keys = [];
|
||||
if (!getters.isParticipationValid) { keys.push('participation'); }
|
||||
if (!getters.isLocationValid) { keys.push('location'); }
|
||||
if (!getters.isJobValid) { keys.push('job'); }
|
||||
if (!getters.isSocialIssueValid) { keys.push('socialIssue'); }
|
||||
if (!getters.isOriginValid) { keys.push('origin'); }
|
||||
if (!getters.isAdminLocationValid) { keys.push('adminLocation'); }
|
||||
@@ -193,6 +203,9 @@ let initPromise = Promise.all([scopesPromise, accompanyingCoursePromise])
|
||||
//console.log('value', value);
|
||||
state.accompanyingCourse.user = value;
|
||||
},
|
||||
updateJob(state, value) {
|
||||
state.accompanyingCourse.job = value;
|
||||
},
|
||||
setReferrersSuggested(state, users) {
|
||||
state.referrersSuggested = users.map(u => {
|
||||
if (state.accompanyingCourse.user !== null) {
|
||||
@@ -203,6 +216,22 @@ let initPromise = Promise.all([scopesPromise, accompanyingCoursePromise])
|
||||
return u;
|
||||
});
|
||||
},
|
||||
setFilteredReferrersSuggested(state) {
|
||||
state.filteredReferrersSuggested = state.referrersSuggested.filter(u => {
|
||||
if (u.user_job && state.accompanyingCourse.job && state.accompanyingCourse.user) {
|
||||
return u.user_job.id === state.accompanyingCourse.job.id && state.accompanyingCourse.user.id !== u.id
|
||||
} else {
|
||||
if (null === state.accompanyingCourse.user) {
|
||||
if (u.user_job && state.accompanyingCourse.job) {
|
||||
return u.user_job.id === state.accompanyingCourse.job.id
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return state.accompanyingCourse.user.id !== u.id;
|
||||
}
|
||||
})
|
||||
},
|
||||
confirmAccompanyingCourse(state, response) {
|
||||
//console.log('### mutation: confirmAccompanyingCourse: response', response);
|
||||
state.accompanyingCourse.step = response.step;
|
||||
@@ -254,6 +283,10 @@ let initPromise = Promise.all([scopesPromise, accompanyingCoursePromise])
|
||||
if (scopeIds.includes(scope.id)) {
|
||||
state.scopesAtBackend = state.scopesAtBackend.filter(s => s.id !== scope.id);
|
||||
}
|
||||
},
|
||||
updateStartDate(state, date) {
|
||||
console.log('new state date', date)
|
||||
state.accompanyingCourse.openingDate = date;
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
@@ -262,6 +295,12 @@ let initPromise = Promise.all([scopesPromise, accompanyingCoursePromise])
|
||||
commit('removeParticipation', payload);
|
||||
// fetch DELETE request...
|
||||
},
|
||||
addPerson({ commit }, payload) {
|
||||
commit('updatePerson', { target: payload.target, person: payload.body });
|
||||
},
|
||||
addThirdparty({ commit }, payload) {
|
||||
commit('updateThirdparty', { target: payload.target, thirdparty: payload.body });
|
||||
},
|
||||
/**
|
||||
* Add/close participation
|
||||
*/
|
||||
@@ -624,8 +663,8 @@ let initPromise = Promise.all([scopesPromise, accompanyingCoursePromise])
|
||||
})
|
||||
},
|
||||
updateOrigin({ commit }, payload) {
|
||||
const url = `/api/1.0/person/accompanying-course/${id}.json`
|
||||
const body = { type: "accompanying_period", origin: { id: payload.id, type: payload.type }}
|
||||
const url = `/api/1.0/person/accompanying-course/${id}.json`;
|
||||
const body = { type: "accompanying_period", origin: { id: payload.id, type: payload.type }};
|
||||
|
||||
return makeFetch('PATCH', url, body)
|
||||
.then((response) => {
|
||||
@@ -637,8 +676,8 @@ let initPromise = Promise.all([scopesPromise, accompanyingCoursePromise])
|
||||
})
|
||||
},
|
||||
updateAdminLocation({ commit }, payload) {
|
||||
const url = `/api/1.0/person/accompanying-course/${id}.json`
|
||||
const body = { type: "accompanying_period", administrativeLocation: { id: payload.id, type: payload.type }}
|
||||
const url = `/api/1.0/person/accompanying-course/${id}.json`;
|
||||
const body = { type: "accompanying_period", administrativeLocation: { id: payload.id, type: payload.type }};
|
||||
|
||||
return makeFetch('PATCH', url, body)
|
||||
.then((response) => {
|
||||
@@ -650,12 +689,42 @@ let initPromise = Promise.all([scopesPromise, accompanyingCoursePromise])
|
||||
})
|
||||
},
|
||||
updateReferrer({ commit }, payload) {
|
||||
const url = `/api/1.0/person/accompanying-course/${id}.json`
|
||||
const body = { type: "accompanying_period", user: { id: payload.id, type: payload.type }}
|
||||
const url = `/api/1.0/person/accompanying-course/${id}.json`;
|
||||
const body = { type: "accompanying_period", user: { id: payload.id, type: payload.type }};
|
||||
|
||||
return makeFetch('PATCH', url, body)
|
||||
.then((response) => {
|
||||
commit('updateReferrer', response.user);
|
||||
commit('setFilteredReferrersSuggested');
|
||||
})
|
||||
.catch((error) => {
|
||||
commit('catchError', error);
|
||||
throw error;
|
||||
})
|
||||
},
|
||||
updateJob({ commit }, payload) {
|
||||
const url = `/api/1.0/person/accompanying-course/${id}.json`;
|
||||
const body = { type: "accompanying_period", job: { id: payload.id, type: payload.type }};
|
||||
|
||||
return makeFetch('PATCH', url, body)
|
||||
.then((response) => {
|
||||
commit('updateJob', response.job);
|
||||
commit('setFilteredReferrersSuggested');
|
||||
})
|
||||
.catch((error) => {
|
||||
commit('catchError', error);
|
||||
throw error;
|
||||
})
|
||||
},
|
||||
updateStartDate({commit}, payload) {
|
||||
console.log('payload', payload)
|
||||
const date = ISOToDate(payload);
|
||||
const url = `/api/1.0/person/accompanying-course/${id}.json`;
|
||||
const body = { type: "accompanying_period", openingDate: { datetime: datetimeToISO(date) }};
|
||||
console.log('body', body)
|
||||
return makeFetch('PATCH', url, body)
|
||||
.then((response) => {
|
||||
commit('updateStartDate', response.openingDate);
|
||||
})
|
||||
.catch((error) => {
|
||||
commit('catchError', error);
|
||||
@@ -665,11 +734,12 @@ let initPromise = Promise.all([scopesPromise, accompanyingCoursePromise])
|
||||
async fetchReferrersSuggested({ state, commit}) {
|
||||
let users = await getReferrersSuggested(state.accompanyingCourse);
|
||||
commit('setReferrersSuggested', users);
|
||||
commit('setFilteredReferrersSuggested');
|
||||
if (
|
||||
null === state.accompanyingCourse.user
|
||||
&& !state.accompanyingCourse.confidential
|
||||
&& !state.accompanyingCourse.step === 'DRAFT'
|
||||
&& users.length === 1
|
||||
null === state.accompanyingCourse.user
|
||||
&& !state.accompanyingCourse.confidential
|
||||
&& !state.accompanyingCourse.step === 'DRAFT'
|
||||
&& users.length === 1
|
||||
) {
|
||||
// set the user if unique
|
||||
commit('updateReferrer', users[0]);
|
||||
@@ -750,8 +820,11 @@ let initPromise = Promise.all([scopesPromise, accompanyingCoursePromise])
|
||||
}
|
||||
});
|
||||
|
||||
store.dispatch('fetchReferrersSuggested');
|
||||
store.dispatch('fetchUsers');
|
||||
if (root === 'app') {
|
||||
store.dispatch('fetchReferrersSuggested');
|
||||
store.dispatch('fetchUsers');
|
||||
}
|
||||
|
||||
resolve(store);
|
||||
}));
|
||||
|
||||
|
@@ -5,7 +5,7 @@
|
||||
|
||||
<div id="awc_create_form">
|
||||
|
||||
<div id="picking">
|
||||
<div id="picking" class="">
|
||||
<p>{{ $t('pick_social_issue_linked_with_action') }}</p>
|
||||
<div v-for="si in socialIssues" :key="si.id">
|
||||
<input type="radio" v-bind:value="si.id" name="socialIssue" v-model="socialIssuePicked"><span class="badge bg-chill-l-gray text-dark">{{ si.text }}</span>
|
||||
@@ -33,7 +33,7 @@
|
||||
</vue-multiselect>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="hasSocialIssuePicked">
|
||||
<div v-if="hasSocialIssuePicked" class="mb-3">
|
||||
<h2>{{ $t('pick_an_action') }}</h2>
|
||||
<div class="col-11">
|
||||
<vue-multiselect
|
||||
@@ -52,26 +52,43 @@
|
||||
<i class="fa fa-circle-o-notch fa-spin fa-fw"></i>
|
||||
</div>
|
||||
|
||||
<div v-if="hasSocialActionPicked" id="persons">
|
||||
<div v-if="hasSocialActionPicked" id="persons" class="mb-5">
|
||||
<h2>{{ $t('persons_involved') }}</h2>
|
||||
|
||||
<ul>
|
||||
<li v-for="p in personsReachables" :key="p.id">
|
||||
<input type="checkbox" :value="p.id" v-model="personsPicked">
|
||||
<person-render-box render="badge" :options="{}" :person="p"></person-render-box>
|
||||
<div class="form-check">
|
||||
<input type="checkbox" :value="p.id" v-model="personsPicked" class="form-check-input" :id="'person_check'+p.id">
|
||||
<label class="form-check-label" :for="'person_check' + p.id">
|
||||
<person-text :person="p"></person-text>
|
||||
</label>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div v-if="hasSocialActionPicked" id="start_date">
|
||||
<!-- <div v-if="hasSocialActionPicked" id="start_date">
|
||||
<p><label>{{ $t('startDate') }}</label> <input type="date" v-model="startDate" /></p>
|
||||
</div> -->
|
||||
<div class="row">
|
||||
<div v-if="hasSocialActionPicked" id="start_date" class="mb-3 row">
|
||||
<label class="col-form-label col-sm-4">{{ $t('startDate') }}</label>
|
||||
<div class="col-sm-8">
|
||||
<input class="form-control" type="date" v-model="startDate"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="hasSocialActionPicked" id="end_date">
|
||||
<!-- <div v-if="hasSocialActionPicked" id="end_date">
|
||||
<p><label>{{ $t('endDate') }}</label> <input type="date" v-model="endDate" /></p>
|
||||
</div> -->
|
||||
<div v-if="hasSocialActionPicked" id="end_date" class="mb-3 row">
|
||||
<label class="col-form-label col-sm-4">{{ $t('endDate') }}</label>
|
||||
<div class="col-sm-8">
|
||||
<input class="form-control" type="date" v-model="endDate"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="confirm">
|
||||
<div v-if="hasErrors">
|
||||
<p>{{ $t('form_has_errors') }}</p>
|
||||
@@ -111,7 +128,7 @@
|
||||
import { mapState, mapActions, mapGetters } from 'vuex';
|
||||
import VueMultiselect from 'vue-multiselect';
|
||||
import { dateToISO, ISOToDate } from 'ChillMainAssets/chill/js/date.js';
|
||||
import PersonRenderBox from 'ChillPersonAssets/vuejs/_components/Entity/PersonRenderBox.vue';
|
||||
import PersonText from 'ChillPersonAssets/vuejs/_components/Entity/PersonText.vue';
|
||||
|
||||
const i18n = {
|
||||
messages: {
|
||||
@@ -133,7 +150,7 @@ export default {
|
||||
name: 'App',
|
||||
components: {
|
||||
VueMultiselect,
|
||||
PersonRenderBox,
|
||||
PersonText,
|
||||
},
|
||||
methods: {
|
||||
submit() {
|
||||
|
@@ -141,10 +141,12 @@
|
||||
|
||||
<ul class="list-unstyled">
|
||||
<li v-for="p in personsReachables" :key="p.id">
|
||||
<label :for="p.id">
|
||||
<input v-model="personsPicked" :value="p.id" :id="p.id" type="checkbox" class="me-2">
|
||||
{{ p.text }}
|
||||
<div class="form-check">
|
||||
<input v-model="personsPicked" :value="p.id" type="checkbox" class="me-2 form-check-input" :id="'person_check'+p.id">
|
||||
<label :for="'person_check'+p.id" class="form-check-label">
|
||||
<person-text :person="p"></person-text>
|
||||
</label>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
@@ -233,18 +235,6 @@
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<pick-template
|
||||
entityClass="Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork"
|
||||
:templates="this.templatesAvailablesForAction"
|
||||
:entityId="work.id"
|
||||
:beforeMove="beforeGenerateTemplate">
|
||||
<template v-slot:title>
|
||||
<h3>{{ $t('Generate doc') }}</h3>
|
||||
</template>
|
||||
</pick-template>
|
||||
</div>
|
||||
|
||||
<div v-if="errors.length > 0" id="errors" class="alert alert-danger flashbag">
|
||||
<p>{{ $t('fix_these_errors') }}</p>
|
||||
<ul>
|
||||
@@ -253,7 +243,17 @@
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<ul class="record_actions sticky-form-buttons">
|
||||
<ul class="record_actions sticky-form-buttons">
|
||||
<li>
|
||||
<list-workflow-modal
|
||||
:workflows="this.work.workflows"
|
||||
:allowCreate="true"
|
||||
relatedEntityClass="Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork"
|
||||
:relatedEntityId="this.work.id"
|
||||
:workflowsAvailables="this.work.workflows_availables"
|
||||
@go-to-generate-workflow="goToGenerateWorkflow"
|
||||
></list-workflow-modal>
|
||||
</li>
|
||||
|
||||
<li v-if="!isPosting">
|
||||
<button class="btn btn-save" @click="submit">
|
||||
@@ -282,6 +282,10 @@ import AddressRenderBox from 'ChillMainAssets/vuejs/_components/Entity/AddressRe
|
||||
import ThirdPartyRenderBox from 'ChillThirdPartyAssets/vuejs/_components/Entity/ThirdPartyRenderBox.vue';
|
||||
import PickTemplate from 'ChillDocGeneratorAssets/vuejs/_components/PickTemplate.vue';
|
||||
import OnTheFly from 'ChillMainAssets/vuejs/OnTheFly/components/OnTheFly.vue';
|
||||
import ListWorkflowModal from 'ChillMainAssets/vuejs/_components/EntityWorkflow/ListWorkflowModal.vue';
|
||||
import PickWorkflow from 'ChillMainAssets/vuejs/_components/EntityWorkflow/PickWorkflow.vue';
|
||||
import PersonText from 'ChillPersonAssets/vuejs/_components/Entity/PersonText.vue';
|
||||
import {buildLinkCreate} from 'ChillMainAssets/lib/entity-workflow/api.js';
|
||||
|
||||
const i18n = {
|
||||
messages: {
|
||||
@@ -329,7 +333,10 @@ export default {
|
||||
AddressRenderBox,
|
||||
ThirdPartyRenderBox,
|
||||
PickTemplate,
|
||||
OnTheFly
|
||||
ListWorkflowModal,
|
||||
OnTheFly,
|
||||
PickWorkflow,
|
||||
PersonText,
|
||||
},
|
||||
i18n,
|
||||
data() {
|
||||
@@ -359,11 +366,11 @@ export default {
|
||||
display: false
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapState([
|
||||
computed: {
|
||||
...mapState([
|
||||
'work',
|
||||
'resultsForAction',
|
||||
'evaluationsForAction',
|
||||
@@ -455,13 +462,18 @@ export default {
|
||||
removeThirdParty(t) {
|
||||
this.$store.commit('removeThirdParty', t);
|
||||
},
|
||||
goToGenerateWorkflow({link}) {
|
||||
console.log('save before leave to generate workflow')
|
||||
const callback = (data) => {
|
||||
window.location.assign(link);
|
||||
};
|
||||
|
||||
return this.$store.dispatch('submit', callback)
|
||||
.catch(e => { console.log(e); throw e; });
|
||||
},
|
||||
submit() {
|
||||
this.$store.dispatch('submit');
|
||||
},
|
||||
beforeGenerateTemplate() {
|
||||
console.log('before generate');
|
||||
return Promise.resolve();
|
||||
},
|
||||
saveFormOnTheFly(payload) {
|
||||
console.log('saveFormOnTheFly: type', payload.type, ', data', payload.data);
|
||||
payload.target = 'resource';
|
||||
|
@@ -1,12 +1,26 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="item-title">
|
||||
<a id="evaluations"></a>
|
||||
<div class="item-title" :title="evaluation.id || 'no id yet'">
|
||||
<span>{{ evaluation.evaluation.title.fr }}</span>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<form-evaluation ref="FormEvaluation" :key="evaluation.key" :evaluation="evaluation"></form-evaluation>
|
||||
<ul class="record_actions">
|
||||
|
||||
<ul class="record_actions">
|
||||
<li v-if="evaluation.workflows_availables.length > 0">
|
||||
|
||||
<list-workflow-modal
|
||||
:workflows="evaluation.workflows"
|
||||
:allowCreate="true"
|
||||
relatedEntityClass="Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWorkEvaluation"
|
||||
:relatedEntityId="evaluation.id"
|
||||
:workflowsAvailables="evaluation.workflows_availables"
|
||||
@go-to-generate-workflow="goToGenerateWorkflow"
|
||||
></list-workflow-modal>
|
||||
|
||||
</li>
|
||||
<li>
|
||||
<a class="btn btn-delete" @click="modal.showModal = true" :title="$t('action.delete')"></a>
|
||||
</li>
|
||||
@@ -34,6 +48,8 @@
|
||||
<script>
|
||||
import FormEvaluation from './FormEvaluation.vue';
|
||||
import Modal from 'ChillMainAssets/vuejs/_components/Modal';
|
||||
import ListWorkflowModal from 'ChillMainAssets/vuejs/_components/EntityWorkflow/ListWorkflowModal.vue';
|
||||
import {buildLinkCreate} from 'ChillMainAssets/lib/entity-workflow/api.js';
|
||||
|
||||
const i18n = {
|
||||
messages: {
|
||||
@@ -60,7 +76,8 @@ export default {
|
||||
name: "AddEvaluation",
|
||||
components: {
|
||||
FormEvaluation,
|
||||
Modal
|
||||
Modal,
|
||||
ListWorkflowModal,
|
||||
},
|
||||
props: ['evaluation'],
|
||||
i18n,
|
||||
@@ -88,10 +105,18 @@ export default {
|
||||
submitForm() {
|
||||
this.toggleEditEvaluation();
|
||||
},
|
||||
buildEditLink(storedObject) {
|
||||
return `/edit/${storedObject.uuid}?returnPath=` + encodeURIComponent(
|
||||
window.location.pathname + window.location.search + window.location.hash);
|
||||
},
|
||||
goToGenerateWorkflow({event, link, workflowName}) {
|
||||
console.log('goToGenerate in evaluation', event, link, workflowName);
|
||||
|
||||
const callback = (data) => {
|
||||
let evaluationId = data.accompanyingPeriodWorkEvaluations.find(e => e.key === this.evaluation.key).id;
|
||||
window.location.assign(buildLinkCreate(workflowName,
|
||||
'Chill\\PersonBundle\\Entity\\AccompanyingPeriod\\AccompanyingPeriodWorkEvaluation', evaluationId));
|
||||
};
|
||||
|
||||
return this.$store.dispatch('submit', callback)
|
||||
.catch(e => { console.log(e); throw e; });
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
@@ -61,12 +61,39 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="evaluation.documents.length > 0" class="row mb-3">
|
||||
<h5>{{ $t('Documents') }} :</h5>
|
||||
|
||||
<div class="flex-table">
|
||||
<div class="item-bloc" v-for="d in evaluation.documents">
|
||||
<div class="item-row">
|
||||
<div class="item-col"><h6>{{ d.template.name.fr }}</h6></div>
|
||||
<div class="item-col">
|
||||
<p>Créé par {{ d.createdBy.text }}<br/>
|
||||
Le {{ $d(ISOToDatetime(d.createdAt.datetime), 'long') }}</p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="item-row">
|
||||
<ul class="record_actions" >
|
||||
<li>
|
||||
<a :href="buildEditLink(d.storedObject)" class="btn btn-action btn-sm">
|
||||
<i class="fa fa-edit"></i>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<pick-template
|
||||
entityClass="Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWorkEvaluation"
|
||||
:id="evaluation.id"
|
||||
:templates="getTemplatesAvailables"
|
||||
:beforeMove="submitBeforeGenerate"
|
||||
:preventDefaultMoveToGenerate="true"
|
||||
@go-to-generate-document="submitBeforeGenerate"
|
||||
>
|
||||
<template v-slot:title>
|
||||
<label class="col-sm-4 col-form-label">{{ $t('evaluation_generate_a_document') }}</label>
|
||||
@@ -83,6 +110,7 @@ import CKEditor from '@ckeditor/ckeditor5-vue';
|
||||
import ClassicEditor from 'ChillMainAssets/module/ckeditor5/index.js';
|
||||
import { mapGetters, mapState } from 'vuex';
|
||||
import PickTemplate from 'ChillDocGeneratorAssets/vuejs/_components/PickTemplate.vue';
|
||||
import {buildLink} from 'ChillDocGeneratorAssets/lib/document-generator';
|
||||
|
||||
const i18n = {
|
||||
messages: {
|
||||
@@ -97,9 +125,10 @@ const i18n = {
|
||||
evaluation_public_comment: "Note publique",
|
||||
evaluation_comment_placeholder: "Commencez à écrire ...",
|
||||
evaluation_generate_a_document: "Générer un document",
|
||||
evaluation_choose_a_template: "Choisir un gabarit",
|
||||
evaluation_choose_a_template: "Choisir un modèle",
|
||||
evaluation_add_a_document: "Ajouter un document",
|
||||
evaluation_add: "Ajouter une évaluation"
|
||||
evaluation_add: "Ajouter une évaluation",
|
||||
Documents: "Documents",
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -163,6 +192,7 @@ export default {
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
ISOToDatetime,
|
||||
listAllStatus() {
|
||||
console.log('load all status');
|
||||
let url = `/api/`;
|
||||
@@ -175,10 +205,15 @@ export default {
|
||||
})
|
||||
;
|
||||
},
|
||||
submitBeforeGenerate() {
|
||||
buildEditLink(storedObject) {
|
||||
return `/wopi/edit/${storedObject.uuid}?returnPath=` + encodeURIComponent(
|
||||
window.location.pathname + window.location.search + window.location.hash);
|
||||
},
|
||||
submitBeforeGenerate({template}) {
|
||||
const callback = (data) => {
|
||||
let evaluationId = data.accompanyingPeriodWorkEvaluations.find(e => e.key === this.evaluation.key).id;
|
||||
return Promise.resolve({entityId: evaluationId});
|
||||
|
||||
window.location.assign(buildLink(template, evaluationId, 'Chill\\PersonBundle\\Entity\\AccompanyingPeriod\\AccompanyingPeriodWorkEvaluation'));
|
||||
};
|
||||
|
||||
return this.$store.dispatch('submit', callback).catch(e => { console.log(e); throw e; });
|
||||
|
@@ -58,7 +58,11 @@ const store = createStore({
|
||||
return state.thirdParties.length > 0;
|
||||
},
|
||||
getTemplatesAvailablesForEvaluation: (state) => (evaluation) => {
|
||||
return state.templatesAvailablesForEvaluation.get(evaluation.id) || [];
|
||||
if (state.templatesAvailablesForEvaluation.has(evaluation.id)) {
|
||||
return state.templatesAvailablesForEvaluation.get(evaluation.id);
|
||||
}
|
||||
|
||||
return [];
|
||||
},
|
||||
buildPayload(state) {
|
||||
return {
|
||||
@@ -171,7 +175,6 @@ const store = createStore({
|
||||
};
|
||||
g.id = tmpIndex() -1
|
||||
state.goalsPicked.push(g);
|
||||
//console.log('goals picked ids', state.goalsPicked.map(g => g.id))
|
||||
},
|
||||
removeGoal(state, goal) {
|
||||
state.goalsPicked = state.goalsPicked.filter(g => g.id !== goal.id);
|
||||
@@ -205,6 +208,9 @@ const store = createStore({
|
||||
warningInterval: null,
|
||||
comment: "",
|
||||
editEvaluation: true,
|
||||
workflows_availables: state.work.workflows_availables_evaluation,
|
||||
documents: [],
|
||||
workflows: [],
|
||||
};
|
||||
state.evaluationsPicked.push(e);
|
||||
},
|
||||
@@ -367,11 +373,11 @@ const store = createStore({
|
||||
|
||||
return makeFetch('PUT', url, payload)
|
||||
.then(data => {
|
||||
console.log('data received', data);
|
||||
if (typeof(callback) !== 'undefined') {
|
||||
return callback(data);
|
||||
} else {
|
||||
console.info('nothing to do here, bye bye');window.location.assign(`/fr/person/accompanying-period/${state.work.accompanyingPeriod.id}/work`);
|
||||
console.info('nothing to do here, bye bye');
|
||||
window.location.assign(`/fr/person/accompanying-period/${state.work.accompanyingPeriod.id}/work`);
|
||||
}
|
||||
}).catch(error => {
|
||||
console.log('error on submit', error);
|
||||
|
@@ -32,7 +32,7 @@
|
||||
</button>
|
||||
</li>
|
||||
<li v-else>
|
||||
<button class="btn btn-save" @click="confirm" :disabled="hasWarnings">
|
||||
<button class="btn btn-save" @click="confirm" :disabled="hasWarnings || !lastStepIsSaveAllowed">
|
||||
{{ $t('household_members_editor.app.save') }}
|
||||
</button>
|
||||
</li>
|
||||
@@ -104,6 +104,13 @@ export default {
|
||||
|
||||
return false;
|
||||
},
|
||||
lastStepIsSaveAllowed() {
|
||||
let r = !this.$store.getters.isHouseholdNew ||
|
||||
(this.$store.state.numberOfChildren !== null && this.$store.state.householdCompositionType !== null);
|
||||
console.log('is saved allowed ?', r);
|
||||
|
||||
return r;
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
goToNext() {
|
||||
|
@@ -7,18 +7,14 @@
|
||||
</div>
|
||||
</div>
|
||||
<div v-else>
|
||||
<p>
|
||||
{{ $t('household_members_editor.concerned.persons_will_be_moved') }} :
|
||||
<span v-for="c in concerned" :key="c.person.id">
|
||||
<person-render-box render="badge" :options="{addLink: false}" :person="c.person"></person-render-box>
|
||||
<button class="btn" @click="removePerson(c.person)" v-if="c.allowRemove" style="padding-left:0;">
|
||||
<span class="fa-stack fa-lg" :title="$t('household_members_editor.concerned.remove_concerned')">
|
||||
<i class="fa fa-circle fa-stack-1x text-danger"></i>
|
||||
<i class="fa fa-times fa-stack-1x"></i>
|
||||
</span>
|
||||
</button>
|
||||
</span>
|
||||
</p>
|
||||
<p>{{ $t('household_members_editor.concerned.persons_will_be_moved') }} :</p>
|
||||
|
||||
<ul class="list-suggest remove-items inline">
|
||||
<li v-for="c in concerned" :key="c.person.id" @click="removeConcerned(c)">
|
||||
<span><person-text :person="c.person"></person-text></span>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class="alert alert-info" v-if="concernedPersonsWithHouseholds.length > 0">
|
||||
<p>{{ $t('household_members_editor.concerned.persons_with_household') }}</p>
|
||||
<ul v-for="c in concernedPersonsWithHouseholds" :key="c.person.id">
|
||||
@@ -61,12 +57,14 @@
|
||||
import { mapState, mapGetters } from 'vuex';
|
||||
import AddPersons from 'ChillPersonAssets/vuejs/_components/AddPersons.vue';
|
||||
import PersonRenderBox from 'ChillPersonAssets/vuejs/_components/Entity/PersonRenderBox.vue';
|
||||
import PersonText from 'ChillPersonAssets/vuejs/_components/Entity/PersonText.vue';
|
||||
|
||||
export default {
|
||||
name: 'Concerned',
|
||||
components: {
|
||||
AddPersons,
|
||||
PersonRenderBox,
|
||||
PersonText,
|
||||
},
|
||||
computed: {
|
||||
...mapState([
|
||||
@@ -108,9 +106,14 @@ export default {
|
||||
this.$refs.addPersons.resetSearch(); // to cast child method
|
||||
modal.showModal = false;
|
||||
},
|
||||
removePerson(person) {
|
||||
console.log('remove person in concerned', person);
|
||||
this.$store.dispatch('removePerson', person);
|
||||
removeConcerned(concerned) {
|
||||
console.log('removedconcerned', concerned);
|
||||
|
||||
if (!concerned.allowRemove) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.$store.dispatch('removePerson', concerned.person);
|
||||
},
|
||||
makeHouseholdLink(id) {
|
||||
return `/fr/person/household/${id}/summary`
|
||||
|
@@ -4,17 +4,38 @@
|
||||
|
||||
<h2>{{ $t('household_members_editor.dates.dates_title') }}</h2>
|
||||
|
||||
<p>
|
||||
<label for="start_date">
|
||||
<div class="mb-3 row">
|
||||
<label for="start_date" class="col-form-label col-sm-4 required">
|
||||
{{ $t('household_members_editor.dates.start_date') }}
|
||||
</label>
|
||||
<input type="date" v-model="startDate" />
|
||||
</p>
|
||||
<div class="col-sm-8">
|
||||
<input type="date" v-model="startDate" class="form-control" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="this.isHouseholdNew">
|
||||
<h2>{{ $t('household_members_editor.composition.composition') }}</h2>
|
||||
<div class="mb-3 row">
|
||||
<label class="col-form-label col-sm-4 required">{{ $t('household_members_editor.composition.household_composition') }}</label>
|
||||
<div class="col-sm-8">
|
||||
<select v-model="householdCompositionType" class="form-select form-control">
|
||||
<option v-for="t in householdCompositionTypes" :key="t.id" :value="t.id">{{ t.label.fr }}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-3 row">
|
||||
<label class="col-form-label col-sm-4 required">{{ $t('household_members_editor.composition.number_of_children') }}</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="number" v-model="numberOfChildren" min="0" max="30" class="form-control"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import CurrentHousehold from "./CurrentHousehold";
|
||||
import {mapGetters, mapState} from 'vuex';
|
||||
|
||||
export default {
|
||||
name: 'Dates',
|
||||
@@ -22,6 +43,27 @@ export default {
|
||||
CurrentHousehold
|
||||
},
|
||||
computed: {
|
||||
...mapState(['householdCompositionTypes']),
|
||||
...mapGetters(['isHouseholdNew']),
|
||||
householdCompositionType: {
|
||||
get() {
|
||||
if (this.$store.state.householdCompositionType !== null) {
|
||||
return this.$store.state.householdCompositionType.id;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
set(value) {
|
||||
this.$store.commit('setHouseholdCompositionType', value);
|
||||
},
|
||||
},
|
||||
numberOfChildren: {
|
||||
get() {
|
||||
return this.$store.state.numberOfChildren;
|
||||
},
|
||||
set(value) {
|
||||
this.$store.commit('setNumberOfChildren', value);
|
||||
}
|
||||
},
|
||||
startDate: {
|
||||
get() {
|
||||
return [
|
||||
|
@@ -61,6 +61,16 @@
|
||||
<li v-if="hasHousehold">
|
||||
<button @click="resetMode" class="btn btn-sm btn-misc">{{ $t('household_members_editor.household.reset_mode')}}</button>
|
||||
</li>
|
||||
<li v-if="!hasHousehold">
|
||||
<add-persons
|
||||
modalTitle="Chercher un ménage existant"
|
||||
buttonTitle="Chercher un ménage existant"
|
||||
v-bind:key="addPersons.key"
|
||||
v-bind:options="addPersons.options"
|
||||
@addNewPersons="pickHouseholdFound"
|
||||
ref="pickHousehold"> <!-- to cast child method -->
|
||||
</add-persons>
|
||||
</li>
|
||||
<li v-if="!hasHousehold">
|
||||
<button @click="setModeNew" class="btn btn-sm btn-create">{{ $t('household_members_editor.household.create_household') }}</button>
|
||||
</li>
|
||||
@@ -77,16 +87,30 @@
|
||||
import { mapGetters, mapState } from 'vuex';
|
||||
import HouseholdRenderBox from 'ChillPersonAssets/vuejs/_components/Entity/HouseholdRenderBox.vue';
|
||||
import CurrentHousehold from './CurrentHousehold';
|
||||
import AddPersons from 'ChillPersonAssets/vuejs/_components/AddPersons';
|
||||
|
||||
export default {
|
||||
name: 'Household',
|
||||
components: {
|
||||
AddPersons,
|
||||
CurrentHousehold,
|
||||
HouseholdRenderBox,
|
||||
},
|
||||
emits: ['readyToGo'],
|
||||
data() {
|
||||
return {
|
||||
addPersons: {
|
||||
key: 'household_find',
|
||||
options: {
|
||||
type: ['household'],
|
||||
priority: null,
|
||||
uniq: true,
|
||||
button: {
|
||||
size: 'btn-sm',
|
||||
type: 'btn-search',
|
||||
}
|
||||
}
|
||||
},
|
||||
addAddress: {
|
||||
key: 'household_new',
|
||||
options: {
|
||||
@@ -166,6 +190,13 @@ export default {
|
||||
this.$store.dispatch('selectHousehold', h);
|
||||
this.$emit('readyToGo');
|
||||
},
|
||||
pickHouseholdFound({selected, modal}) {
|
||||
selected.forEach(function(item) {
|
||||
this.selectHousehold(item.result);
|
||||
}, this);
|
||||
this.$refs.pickHousehold.resetSearch(); // to cast child method
|
||||
modal.showModal = false;
|
||||
},
|
||||
removeHouseholdAddress() {
|
||||
this.$store.commit('removeHouseholdAddress');
|
||||
},
|
||||
|
@@ -0,0 +1,42 @@
|
||||
<template>
|
||||
<ckeditor
|
||||
name="content"
|
||||
v-bind:placeholder="$t('comment.content')"
|
||||
:editor="editor"
|
||||
v-model="content"
|
||||
tag-name="textarea">
|
||||
</ckeditor>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import CKEditor from '@ckeditor/ckeditor5-vue';
|
||||
import ClassicEditor from "ChillMainAssets/module/ckeditor5";
|
||||
|
||||
export default {
|
||||
name: "PersonComment.vue",
|
||||
components: {
|
||||
ckeditor: CKEditor.component,
|
||||
},
|
||||
props: ['conc'],
|
||||
data() {
|
||||
return {
|
||||
editor: ClassicEditor,
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
content: {
|
||||
get() {
|
||||
return this.$props.conc.comment || '';
|
||||
},
|
||||
set(value) {
|
||||
console.log('set content', value);
|
||||
this.$store.commit('setComment', {conc: this.$props.conc, comment: value})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
@@ -3,15 +3,16 @@
|
||||
|
||||
<h2>{{ $t('household_members_editor.positioning.persons_to_positionnate')}}</h2>
|
||||
|
||||
<div class="list-household-members">
|
||||
<div class="list-household-members flex-table">
|
||||
<div
|
||||
v-for="conc in concerned"
|
||||
class="item-bloc"
|
||||
v-bind:key="conc.person.id"
|
||||
class="item-bloc"
|
||||
v-bind:key="conc.person.id"
|
||||
>
|
||||
<div class="pick-position">
|
||||
<div class="pick-position item-row">
|
||||
<div class="person">
|
||||
<person-render-box render="badge" :options="{}" :person="conc.person"></person-render-box>
|
||||
<!-- <h3>{{ conc.person.text }}</h3> -->
|
||||
<h3><person-text :person="conc.person"></person-text></h3>
|
||||
</div>
|
||||
<div class="holder">
|
||||
<button
|
||||
@@ -37,6 +38,12 @@
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="item-row">
|
||||
<div>
|
||||
<h6>{{ $t('household_members_editor.positioning.comment') }}</h6>
|
||||
<person-comment :conc="conc"></person-comment>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -46,12 +53,16 @@ import MemberDetails from './MemberDetails.vue';
|
||||
import {mapGetters, mapState} from "vuex";
|
||||
import CurrentHousehold from "./CurrentHousehold";
|
||||
import PersonRenderBox from 'ChillPersonAssets/vuejs/_components/Entity/PersonRenderBox.vue';
|
||||
import PersonComment from './PersonComment';
|
||||
import PersonText from '../../_components/Entity/PersonText.vue';
|
||||
|
||||
export default {
|
||||
name: "Positioning",
|
||||
components: {
|
||||
CurrentHousehold,
|
||||
PersonRenderBox,
|
||||
PersonComment,
|
||||
PersonText
|
||||
},
|
||||
computed: {
|
||||
...mapState([
|
||||
|
@@ -52,6 +52,7 @@ const appMessages = {
|
||||
positioning: {
|
||||
persons_to_positionnate: 'Usagers à positionner',
|
||||
holder: "Titulaire",
|
||||
comment: "Commentaire",
|
||||
},
|
||||
app: {
|
||||
next: 'Suivant',
|
||||
@@ -77,7 +78,12 @@ const appMessages = {
|
||||
dates: {
|
||||
start_date: "Début de validité",
|
||||
end_date: "Fin de validité",
|
||||
dates_title: "Période de validité",
|
||||
dates_title: "Depuis le",
|
||||
},
|
||||
composition: {
|
||||
composition: "Composition familiale",
|
||||
household_composition: "Composition du ménage",
|
||||
number_of_children: "Nombre d'enfants mineurs au sein du ménage",
|
||||
},
|
||||
confirmation: {
|
||||
save: "Enregistrer",
|
||||
|
@@ -1,5 +1,6 @@
|
||||
import { createStore } from 'vuex';
|
||||
import { householdMove, fetchHouseholdSuggestionByAccompanyingPeriod, fetchAddressSuggestionByPerson} from './../api.js';
|
||||
import { fetchResults } from 'ChillMainAssets/lib/api/apiMethods.js'
|
||||
import { fetchHouseholdByAddressReference } from 'ChillPersonAssets/lib/household.js';
|
||||
import { datetimeToISO } from 'ChillMainAssets/chill/js/date.js';
|
||||
|
||||
@@ -54,8 +55,11 @@ const store = createStore({
|
||||
*/
|
||||
householdSuggestionByAccompanyingPeriod: [], // TODO rename into householdsSuggestion
|
||||
showHouseholdSuggestion: window.household_members_editor_expand_suggestions === 1,
|
||||
householdCompositionType: null,
|
||||
numberOfChildren: 0,
|
||||
addressesSuggestion: [],
|
||||
showAddressSuggestion: true,
|
||||
householdCompositionTypes: [],
|
||||
warnings: [],
|
||||
errors: []
|
||||
},
|
||||
@@ -250,7 +254,8 @@ const store = createStore({
|
||||
payload_conc,
|
||||
payload = {
|
||||
concerned: [],
|
||||
destination: null
|
||||
destination: null,
|
||||
composition: null,
|
||||
}
|
||||
;
|
||||
|
||||
@@ -261,7 +266,6 @@ const store = createStore({
|
||||
};
|
||||
|
||||
if (getters.isHouseholdNew && state.household.current_address !== null) {
|
||||
console.log(state.household);
|
||||
payload.destination.forceAddress = { id: state.household.current_address.address_id };
|
||||
}
|
||||
}
|
||||
@@ -290,6 +294,19 @@ const store = createStore({
|
||||
payload.concerned.push(payload_conc);
|
||||
}
|
||||
|
||||
if (getters.isHouseholdNew) {
|
||||
payload.composition = {
|
||||
household_composition_type: {
|
||||
type: state.householdCompositionType.type,
|
||||
id: state.householdCompositionType.id,
|
||||
},
|
||||
number_of_children: state.numberOfChildren,
|
||||
start_date: {
|
||||
datetime: datetimeToISO(state.startDate),
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
return payload;
|
||||
},
|
||||
},
|
||||
@@ -409,6 +426,15 @@ const store = createStore({
|
||||
setErrors(state, errors) {
|
||||
state.errors = errors;
|
||||
},
|
||||
setHouseholdCompositionTypes(state, types) {
|
||||
state.householdCompositionTypes = types;
|
||||
},
|
||||
setHouseholdCompositionType(state, id) {
|
||||
state.householdCompositionType = state.householdCompositionTypes.find(t => t.id = id);
|
||||
},
|
||||
setNumberOfChildren(state, number) {
|
||||
state.numberOfChildren = Number.parseInt(number);
|
||||
},
|
||||
addAddressesSuggestion(state, addresses) {
|
||||
let existingIds = state.addressesSuggestion
|
||||
.map(a => a.address_id);
|
||||
@@ -570,4 +596,8 @@ if (concerned.length > 0) {
|
||||
});
|
||||
}
|
||||
|
||||
fetchResults(`/api/1.0/person/houehold/composition/type.json`).then(types => {
|
||||
store.commit('setHouseholdCompositionTypes', types);
|
||||
})
|
||||
|
||||
export { store };
|
||||
|
@@ -0,0 +1,6 @@
|
||||
export const lightGreen = '#43b29d';
|
||||
export const darkGreen = '#368e7e';
|
||||
export const lightBrown = '#a2ac80';
|
||||
export const darkBrown = '#929d69';
|
||||
export const lightBlue = '#8d9dab';
|
||||
export const darkBlue = '#718596';
|
@@ -2,6 +2,7 @@ import { createStore } from 'vuex'
|
||||
import { getHouseholdByPerson, getCoursesByPerson, getRelationshipsByPerson } from './api'
|
||||
import { getHouseholdLabel, getHouseholdWidth, getRelationshipLabel, getRelationshipTitle, getRelationshipDirection, splitId, getGender, getAge } from './vis-network'
|
||||
import {visMessages} from "./i18n";
|
||||
import { darkBlue, darkBrown, darkGreen, lightBlue, lightBrown, lightGreen } from './colors';
|
||||
|
||||
const debug = process.env.NODE_ENV !== 'production'
|
||||
|
||||
@@ -130,7 +131,7 @@ const store = createStore({
|
||||
person.group = person.type
|
||||
person._id = person.id
|
||||
person.id = `person_${person.id}`
|
||||
person.label = `*${person.text}*\n_${getGender(person.gender)}${age}_${debug}`
|
||||
person.label = `*${person.text}${person.deathdate ? ' (‡)' : ''}*\n_${getGender(person.gender)}${age}_${debug}`
|
||||
person.folded = false
|
||||
// folded is used for missing persons
|
||||
if (options.folded) {
|
||||
@@ -172,8 +173,8 @@ const store = createStore({
|
||||
id: 'relationship_' + splitId(link.id,'id')
|
||||
+ '-person_' + link.fromPerson.id + '-person_' + link.toPerson.id,
|
||||
arrows: getRelationshipDirection(link),
|
||||
color: 'lightblue',
|
||||
font: { color: '#33839d' },
|
||||
color: lightGreen,
|
||||
font: { color: darkGreen },
|
||||
dashes: true,
|
||||
label: getRelationshipLabel(link),
|
||||
title: getRelationshipTitle(link),
|
||||
@@ -316,10 +317,10 @@ const store = createStore({
|
||||
to: `${household.id}`,
|
||||
id: `${household.id}-person_${m.person.id}`,
|
||||
arrows: 'from',
|
||||
color: 'pink',
|
||||
font: { color: '#D04A60' },
|
||||
color: lightBrown,
|
||||
font: { color: darkBrown },
|
||||
dashes: (getHouseholdWidth(m) === 1)? [0,4] : false, //edge style: [dash, gap, dash, gap]
|
||||
label: getHouseholdLabel(m),
|
||||
//label: getHouseholdLabel(m),
|
||||
width: getHouseholdWidth(m),
|
||||
})
|
||||
if (!getters.isPersonLoaded(m.person.id)) {
|
||||
@@ -375,8 +376,8 @@ const store = createStore({
|
||||
to: `${course.id}`,
|
||||
id: `accompanying_period_${splitId(course.id,'id')}-person_${p.person.id}`,
|
||||
arrows: 'from',
|
||||
color: 'orange',
|
||||
font: { color: 'darkorange' },
|
||||
color: lightBlue,
|
||||
font: { color: darkBlue },
|
||||
})
|
||||
if (!getters.isPersonLoaded(p.person.id)) {
|
||||
dispatch('addMissingPerson', [p.person, course])
|
||||
@@ -428,8 +429,8 @@ const store = createStore({
|
||||
id: 'relationship_' + splitId(relationship.id,'id')
|
||||
+ '-person_' + relationship.fromPerson.id + '-person_' + relationship.toPerson.id,
|
||||
arrows: getRelationshipDirection(relationship),
|
||||
color: 'lightblue',
|
||||
font: { color: '#33839d' },
|
||||
color: lightGreen,
|
||||
font: { color: darkGreen },
|
||||
dashes: true,
|
||||
label: getRelationshipLabel(relationship),
|
||||
title: getRelationshipTitle(relationship),
|
||||
|
@@ -1,4 +1,5 @@
|
||||
import { visMessages } from './i18n'
|
||||
import { darkGreen, lightBlue, lightBrown, lightGreen } from './colors';
|
||||
import { visMessages } from './i18n';
|
||||
|
||||
/**
|
||||
* Vis-network initial data/configuration script
|
||||
@@ -15,12 +16,12 @@ window.options = {
|
||||
/*
|
||||
*/
|
||||
configure: {
|
||||
enabled: true,
|
||||
enabled: false,
|
||||
filter: 'physics',
|
||||
showButton: true
|
||||
},
|
||||
physics: {
|
||||
enabled: true,
|
||||
enabled: false,
|
||||
barnesHut: {
|
||||
theta: 0.5,
|
||||
gravitationalConstant: -2000,
|
||||
@@ -89,7 +90,7 @@ window.options = {
|
||||
edges: {
|
||||
font: {
|
||||
color: '#b0b0b0',
|
||||
size: 9,
|
||||
size: 14,
|
||||
face: 'arial',
|
||||
background: 'none',
|
||||
strokeWidth: 2, // px
|
||||
@@ -112,30 +113,30 @@ window.options = {
|
||||
},
|
||||
color: {
|
||||
border: '#b0b0b0',
|
||||
background: 'rgb(193,229,222)',
|
||||
background: lightGreen,
|
||||
highlight: {
|
||||
border: '#89c9a9',
|
||||
background: 'rgb(156,213,203)'
|
||||
border: '#216458',
|
||||
background: darkGreen,
|
||||
},
|
||||
hover: {
|
||||
border: '#89c9a9',
|
||||
background: 'rgb(156,213,203)'
|
||||
border: '#216458',
|
||||
background: darkGreen,
|
||||
}
|
||||
},
|
||||
opacity: 0.85,
|
||||
opacity: 0.9,
|
||||
shadow:{
|
||||
enabled: true,
|
||||
color: 'rgba(0,0,0,0.5)',
|
||||
size:10,
|
||||
x:5,
|
||||
y:5
|
||||
y:5,
|
||||
},
|
||||
},
|
||||
household: {
|
||||
color: 'pink'
|
||||
color: lightBrown,
|
||||
},
|
||||
accompanying_period: {
|
||||
color: 'orange',
|
||||
color: lightBlue,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,51 @@
|
||||
<template>
|
||||
<ul class="list-suggest add-items" v-if="suggested.length > 0">
|
||||
<li v-for="r in suggested" @click="setReferrer(r)"><span>{{ r.text }}</span></li>
|
||||
</ul>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import {makeFetch} from 'ChillMainAssets/lib/api/apiMethods.js';
|
||||
|
||||
export default {
|
||||
name: "SetReferrer",
|
||||
props: {
|
||||
suggested: {
|
||||
type: Array,
|
||||
required: false,
|
||||
//default: [],
|
||||
},
|
||||
periodId: {
|
||||
type: Number,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
/*suggested: [
|
||||
{id: 5, text: 'Robert'}, {id: 8, text: 'Monique'},
|
||||
]*/
|
||||
}
|
||||
},
|
||||
emits: ['referrerSet'],
|
||||
methods: {
|
||||
setReferrer: function(ref) {
|
||||
const url = `/api/1.0/person/accompanying-course/${this.periodId}.json`;
|
||||
const body = { type: "accompanying_period", user: { id: ref.id, type: ref.type }};
|
||||
|
||||
return makeFetch('PATCH', url, body)
|
||||
.then((response) => {
|
||||
this.$emit('referrerSet', ref);
|
||||
})
|
||||
.catch((error) => {
|
||||
throw error;
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
@@ -1,12 +1,12 @@
|
||||
<template>
|
||||
<ul class="record_actions">
|
||||
<ul class="record_actions">
|
||||
<li class="add-persons">
|
||||
<a class="btn" :class="getClassButton" :title="$t(buttonTitle)"
|
||||
@click="openModal"><span v-if="displayTextButton">{{ $t(buttonTitle) }}</span></a>
|
||||
<a class="btn" :class="getClassButton" :title="$t(buttonTitle)"
|
||||
@click="openModal"><span v-if="displayTextButton">{{ $t(buttonTitle) }}</span></a>
|
||||
</li>
|
||||
</ul>
|
||||
</ul>
|
||||
|
||||
<teleport to="body">
|
||||
<teleport to="body">
|
||||
<modal v-if="modal.showModal"
|
||||
:modalDialogClass="modal.modalDialogClass"
|
||||
@close="modal.showModal = false">
|
||||
@@ -67,9 +67,10 @@
|
||||
<div class="create-button">
|
||||
<on-the-fly
|
||||
v-if="query.length >= 3"
|
||||
v-bind:buttonText="$t('onthefly.create.button', {q: query})"
|
||||
:buttonText="$t('onthefly.create.button', {q: query})"
|
||||
action="create"
|
||||
@saveFormOnTheFly="saveFormOnTheFly">
|
||||
@saveFormOnTheFly="saveFormOnTheFly"
|
||||
:canCloseModal="canCloseOnTheFlyModal">
|
||||
</on-the-fly>
|
||||
</div>
|
||||
|
||||
@@ -92,8 +93,7 @@ import Modal from 'ChillMainAssets/vuejs/_components/Modal';
|
||||
import OnTheFly from 'ChillMainAssets/vuejs/OnTheFly/components/OnTheFly.vue';
|
||||
import PersonSuggestion from './AddPersons/PersonSuggestion';
|
||||
import { searchEntities } from 'ChillPersonAssets/vuejs/_api/AddPersons';
|
||||
import { postPerson } from "ChillPersonAssets/vuejs/_api/OnTheFly";
|
||||
import { postThirdparty } from "ChillThirdPartyAssets/vuejs/_api/OnTheFly";
|
||||
import { makeFetch } from 'ChillMainAssets/lib/api/apiMethods';
|
||||
|
||||
export default {
|
||||
name: 'AddPersons',
|
||||
@@ -121,7 +121,8 @@ export default {
|
||||
suggested: [],
|
||||
selected: [],
|
||||
priorSuggestion: {}
|
||||
}
|
||||
},
|
||||
canCloseOnTheFlyModal: false
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -181,7 +182,7 @@ export default {
|
||||
},
|
||||
hasPriorSuggestion() {
|
||||
return this.search.priorSuggestion.key ? true : false;
|
||||
}
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
openModal() {
|
||||
@@ -195,18 +196,18 @@ export default {
|
||||
|
||||
setTimeout(function() {
|
||||
if (query === "") {
|
||||
this.loadSuggestions([]);
|
||||
return;
|
||||
this.loadSuggestions([]);
|
||||
return;
|
||||
}
|
||||
if (query === this.search.query) {
|
||||
if (this.currentSearchQueryController !== undefined) {
|
||||
this.currentSearchQueryController.abort()
|
||||
}
|
||||
this.currentSearchQueryController = new AbortController();
|
||||
searchEntities({ query, options: this.options }, this.currentSearchQueryController)
|
||||
if (this.currentSearchQueryController !== undefined) {
|
||||
this.currentSearchQueryController.abort()
|
||||
}
|
||||
this.currentSearchQueryController = new AbortController();
|
||||
searchEntities({ query, options: this.options }, this.currentSearchQueryController)
|
||||
.then(suggested => new Promise((resolve, reject) => {
|
||||
this.loadSuggestions(suggested.results);
|
||||
resolve();
|
||||
this.loadSuggestions(suggested.results);
|
||||
resolve();
|
||||
}));
|
||||
}
|
||||
}.bind(this), query.length > 3 ? 300 : 700);
|
||||
@@ -241,13 +242,12 @@ export default {
|
||||
return item.result.type + item.result.id;
|
||||
},
|
||||
addPriorSuggestion() {
|
||||
//console.log('addPriorSuggestion', this.hasPriorSuggestion);
|
||||
// console.log('prior suggestion', this.priorSuggestion);
|
||||
if (this.hasPriorSuggestion) {
|
||||
console.log('addPriorSuggestion',);
|
||||
// console.log('addPriorSuggestion',);
|
||||
this.suggested.unshift(this.priorSuggestion);
|
||||
this.selected.unshift(this.priorSuggestion);
|
||||
|
||||
console.log('reset priorSuggestion');
|
||||
this.newPriorSuggestion(null);
|
||||
}
|
||||
},
|
||||
@@ -261,6 +261,7 @@ export default {
|
||||
}
|
||||
this.search.priorSuggestion = suggestion;
|
||||
// console.log('search priorSuggestion', this.search.priorSuggestion);
|
||||
this.addPriorSuggestion(suggestion);
|
||||
} else {
|
||||
this.search.priorSuggestion = {};
|
||||
}
|
||||
@@ -268,23 +269,38 @@ export default {
|
||||
saveFormOnTheFly({ type, data }) {
|
||||
// console.log('saveFormOnTheFly from addPersons, type', type, ', data', data);
|
||||
if (type === 'person') {
|
||||
// console.log('type person with', data);
|
||||
postPerson(data)
|
||||
.then(person => new Promise((resolve, reject) => {
|
||||
console.log('onthefly create: post person', person);
|
||||
this.newPriorSuggestion(person);
|
||||
resolve();
|
||||
}));
|
||||
makeFetch('POST', '/api/1.0/person/person.json', data)
|
||||
.then(response => {
|
||||
this.newPriorSuggestion(response);
|
||||
this.canCloseOnTheFlyModal = true;
|
||||
})
|
||||
.catch((error) => {
|
||||
if (error.name === 'ValidationException') {
|
||||
for (let v of error.violations) {
|
||||
this.$toast.open({message: v });
|
||||
}
|
||||
} else {
|
||||
this.$toast.open({message: 'An error occurred'});
|
||||
}
|
||||
})
|
||||
}
|
||||
else if (type === 'thirdparty') {
|
||||
// console.log('type thirdparty with', data);
|
||||
postThirdparty(data)
|
||||
.then(thirdparty => new Promise((resolve, reject) => {
|
||||
// console.log('onthefly create: post thirdparty', thirdparty);
|
||||
this.newPriorSuggestion(thirdparty);
|
||||
resolve();
|
||||
}));
|
||||
makeFetch('POST', '/api/1.0/thirdparty/thirdparty.json', data)
|
||||
.then(response => {
|
||||
this.newPriorSuggestion(response);
|
||||
this.canCloseOnTheFlyModal = true;
|
||||
})
|
||||
.catch((error) => {
|
||||
if (error.name === 'ValidationException') {
|
||||
for (let v of error.violations) {
|
||||
this.$toast.open({message: v });
|
||||
}
|
||||
} else {
|
||||
this.$toast.open({message: 'An error occurred'});
|
||||
}
|
||||
})
|
||||
}
|
||||
this.canCloseOnTheFlyModal = false;
|
||||
}
|
||||
},
|
||||
}
|
||||
|
@@ -26,6 +26,11 @@
|
||||
v-if="item.result.type === 'user'"
|
||||
v-bind:item="item">
|
||||
</suggestion-user>
|
||||
|
||||
<suggestion-household
|
||||
v-if="item.result.type === 'household'"
|
||||
v-bind:item="item">
|
||||
</suggestion-household>
|
||||
</label>
|
||||
|
||||
</div>
|
||||
@@ -35,6 +40,7 @@
|
||||
import SuggestionPerson from './TypePerson';
|
||||
import SuggestionThirdParty from './TypeThirdParty';
|
||||
import SuggestionUser from './TypeUser';
|
||||
import SuggestionHousehold from './TypeHousehold';
|
||||
|
||||
export default {
|
||||
name: 'PersonSuggestion',
|
||||
@@ -42,6 +48,7 @@ export default {
|
||||
SuggestionPerson,
|
||||
SuggestionThirdParty,
|
||||
SuggestionUser,
|
||||
SuggestionHousehold,
|
||||
},
|
||||
props: [
|
||||
'item',
|
||||
@@ -87,11 +94,11 @@ export default {
|
||||
label {
|
||||
display: inline-flex;
|
||||
width: 100%;
|
||||
div.container {
|
||||
div.container:not(.household) {
|
||||
& > input {
|
||||
margin-right: 0.8em;
|
||||
}
|
||||
span:not(.name) {
|
||||
> span:not(.name) {
|
||||
margin-left: 0.5em;
|
||||
opacity: 0.5;
|
||||
font-size: 90%;
|
||||
|
@@ -0,0 +1,27 @@
|
||||
<template>
|
||||
<div class="container household">
|
||||
<household-render-box :household="item.result" :isAddressMultiline="false"></household-render-box>
|
||||
</div>
|
||||
|
||||
<div class="right_actions">
|
||||
<badge-entity
|
||||
:entity="item.result"
|
||||
:options="{ displayLong: true }">
|
||||
</badge-entity>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import BadgeEntity from 'ChillMainAssets/vuejs/_components/BadgeEntity.vue';
|
||||
import HouseholdRenderBox from 'ChillPersonAssets/vuejs/_components/Entity/HouseholdRenderBox.vue';
|
||||
|
||||
export default {
|
||||
name: 'SuggestionHousehold',
|
||||
components: {
|
||||
BadgeEntity,
|
||||
HouseholdRenderBox,
|
||||
},
|
||||
props: ['item'],
|
||||
}
|
||||
</script>
|
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div class="container">
|
||||
<span class="name">
|
||||
{{ item.result.text }}
|
||||
<person-text :person="item.result"></person-text>
|
||||
</span>
|
||||
<span class="birthday" v-if="hasBirthdate">
|
||||
{{ $d(item.result.birthdate.datetime, 'short') }}
|
||||
@@ -28,12 +28,14 @@
|
||||
<script>
|
||||
import OnTheFly from 'ChillMainAssets/vuejs/OnTheFly/components/OnTheFly.vue';
|
||||
import BadgeEntity from 'ChillMainAssets/vuejs/_components/BadgeEntity.vue';
|
||||
import PersonText from 'ChillPersonAssets/vuejs/_components/Entity/PersonText.vue';
|
||||
|
||||
export default {
|
||||
name: 'SuggestionPerson',
|
||||
components: {
|
||||
OnTheFly,
|
||||
BadgeEntity
|
||||
BadgeEntity,
|
||||
PersonText,
|
||||
},
|
||||
props: ['item'],
|
||||
computed: {
|
||||
|
@@ -2,9 +2,9 @@
|
||||
<div class="container tpartycontainer">
|
||||
<div class="tparty-identification">
|
||||
<span class="name">
|
||||
{{ item.result.text }}
|
||||
{{ item.result.text }}
|
||||
</span>
|
||||
<span class="location">
|
||||
<span class="location">
|
||||
<template v-if="hasAddress">
|
||||
{{ getAddress.text }} -
|
||||
{{ getAddress.postcode.name }}
|
||||
@@ -100,5 +100,13 @@ export default {
|
||||
font-variant: all-small-caps;
|
||||
}
|
||||
}
|
||||
.tparty-identification {
|
||||
span:not(.name) {
|
||||
margin-left: 0.5em;
|
||||
opacity: 0.5;
|
||||
font-size: 90%;
|
||||
font-style: italic;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
@@ -1,14 +1,15 @@
|
||||
<template>
|
||||
<div v-if="render === 'bloc'" class="item-bloc">
|
||||
<div v-if="render === 'bloc'" class="item-bloc">
|
||||
<section class="chill-entity entity-person">
|
||||
<div class="item-row entity-bloc">
|
||||
<div class="item-row entity-bloc">
|
||||
|
||||
<div class="item-col">
|
||||
<div class="entity-label">
|
||||
|
||||
<div :class="'denomination h' + options.hLevel">
|
||||
|
||||
<a v-if="options.addLink === true" :href="getUrl">
|
||||
<a v-if="options.addLink === true" :href="getUrl">
|
||||
<!-- use person-text here to avoid code duplication ? TODO -->
|
||||
<span class="firstname">{{ person.firstName }}</span>
|
||||
<span class="lastname">{{ person.lastName }}</span>
|
||||
<span v-if="person.altNames && options.addAltNames == true" class="altnames">
|
||||
@@ -16,19 +17,20 @@
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<span class="firstname">{{ person.firstName }}</span>
|
||||
<span class="lastname">{{ person.lastName }}</span>
|
||||
<span v-if="person.deathdate" class="deathdate"> (‡)</span>
|
||||
<span v-if="person.altNames && options.addAltNames == true" class="altnames">
|
||||
<span :class="'altname altname-' + altNameKey">{{ altNameLabel }}</span>
|
||||
</span>
|
||||
<!-- use person-text here to avoid code duplication ? TODO -->
|
||||
<span class="firstname">{{ person.firstName }}</span>
|
||||
<span class="lastname">{{ person.lastName }}</span>
|
||||
<span v-if="person.deathdate" class="deathdate"> (‡)</span>
|
||||
<span v-if="person.altNames && options.addAltNames == true" class="altnames">
|
||||
<span :class="'altname altname-' + altNameKey">{{ altNameLabel }}</span>
|
||||
</span>
|
||||
|
||||
<span v-if="options.addId == true" class="id-number" :title="'n° ' + person.id">{{ person.id }}</span>
|
||||
<span v-if="options.addId == true" class="id-number" :title="'n° ' + person.id">{{ person.id }}</span>
|
||||
|
||||
<badge-entity v-if="options.addEntity === true"
|
||||
:entity="person"
|
||||
:options="{ displayLong: options.entityDisplayLong }">
|
||||
</badge-entity>
|
||||
<badge-entity v-if="options.addEntity === true"
|
||||
:entity="person"
|
||||
:options="{ displayLong: options.entityDisplayLong }">
|
||||
</badge-entity>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -47,96 +49,96 @@
|
||||
{{ $t('renderbox.deathdate') + ' ' + deathdate }}
|
||||
</time>
|
||||
|
||||
<span v-if="options.addAge && person.birthdate" class="age">{{ getAge }} {{ $t('renderbox.years_old')}}</span>
|
||||
<span v-if="options.addAge && person.birthdate" class="age">{{ $tc('renderbox.years_old', person.age) }}</span>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="item-col">
|
||||
<div class="float-button bottom">
|
||||
<div class="box">
|
||||
<div class="action">
|
||||
<slot name="record-actions"></slot>
|
||||
</div>
|
||||
<ul class="list-content fa-ul">
|
||||
<div class="float-button bottom">
|
||||
<div class="box">
|
||||
<div class="action">
|
||||
<slot name="record-actions"></slot>
|
||||
</div>
|
||||
<ul class="list-content fa-ul">
|
||||
<li v-if="person.current_household_id">
|
||||
<i class="fa fa-li fa-map-marker"></i>
|
||||
<address-render-box v-if="person.current_household_address"
|
||||
:address="person.current_household_address"
|
||||
:isMultiline="isMultiline">
|
||||
</address-render-box>
|
||||
<p v-else class="chill-no-data-statement">
|
||||
{{ $t('renderbox.household_without_address') }}
|
||||
</p>
|
||||
<a v-if="options.addHouseholdLink === true"
|
||||
:href="getCurrentHouseholdUrl"
|
||||
:title="$t('persons_associated.show_household_number', {id: person.current_household_id})">
|
||||
<span class="badge rounded-pill bg-chill-beige">
|
||||
<i class="fa fa-fw fa-home"></i><!--{{ $t('persons_associated.show_household') }}-->
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
<li v-else-if="options.addNoData">
|
||||
<i class="fa fa-li fa-map-marker"></i>
|
||||
<p class="chill-no-data-statement">
|
||||
{{ $t('renderbox.no_data') }}
|
||||
</p>
|
||||
</li>
|
||||
|
||||
<li v-if="person.current_household_id">
|
||||
<i class="fa fa-li fa-map-marker"></i>
|
||||
<address-render-box v-if="person.current_household_address"
|
||||
:address="person.current_household_address"
|
||||
:isMultiline="isMultiline">
|
||||
</address-render-box>
|
||||
<p v-else class="chill-no-data-statement">
|
||||
{{ $t('renderbox.household_without_address') }}
|
||||
</p>
|
||||
<a v-if="options.addHouseholdLink === true"
|
||||
:href="getCurrentHouseholdUrl"
|
||||
:title="$t('persons_associated.show_household_number', {id: person.current_household_id})">
|
||||
<span class="badge rounded-pill bg-chill-beige">
|
||||
<i class="fa fa-fw fa-home"></i><!--{{ $t('persons_associated.show_household') }}-->
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
<li v-else-if="options.addNoData">
|
||||
<i class="fa fa-li fa-map-marker"></i>
|
||||
<p class="chill-no-data-statement">
|
||||
{{ $t('renderbox.no_data') }}
|
||||
</p>
|
||||
</li>
|
||||
<li v-if="person.mobilenumber">
|
||||
<i class="fa fa-li fa-mobile"></i>
|
||||
<a :href="'tel: ' + person.mobilenumber">{{ person.mobilenumber }}</a>
|
||||
</li>
|
||||
<li v-else-if="options.addNoData">
|
||||
<i class="fa fa-li fa-mobile"></i>
|
||||
<p class="chill-no-data-statement">{{ $t('renderbox.no_data') }}</p>
|
||||
</li>
|
||||
<li v-if="person.phonenumber">
|
||||
<i class="fa fa-li fa-phone"></i>
|
||||
<a :href="'tel: ' + person.phonenumber">{{ person.phonenumber }}</a>
|
||||
</li>
|
||||
<li v-else-if="options.addNoData">
|
||||
<i class="fa fa-li fa-phone"></i>
|
||||
<p class="chill-no-data-statement">{{ $t('renderbox.no_data') }}</p>
|
||||
</li>
|
||||
|
||||
<li v-if="person.mobilenumber">
|
||||
<i class="fa fa-li fa-mobile"></i>
|
||||
<a :href="'tel: ' + person.mobilenumber">{{ person.mobilenumber }}</a>
|
||||
</li>
|
||||
<li v-else-if="options.addNoData">
|
||||
<i class="fa fa-li fa-mobile"></i>
|
||||
<p class="chill-no-data-statement">{{ $t('renderbox.no_data') }}</p>
|
||||
</li>
|
||||
<li v-if="person.phonenumber">
|
||||
<i class="fa fa-li fa-phone"></i>
|
||||
<a :href="'tel: ' + person.phonenumber">{{ person.phonenumber }}</a>
|
||||
</li>
|
||||
<li v-else-if="options.addNoData">
|
||||
<i class="fa fa-li fa-phone"></i>
|
||||
<p class="chill-no-data-statement">{{ $t('renderbox.no_data') }}</p>
|
||||
</li>
|
||||
<li v-if="person.centers !== undefined && person.centers.length > 0 && options.addCenter">
|
||||
<i class="fa fa-li fa-long-arrow-right"></i>
|
||||
<template v-for="c in person.centers">{{ c.name }}</template>
|
||||
</li>
|
||||
<li v-else-if="options.addNoData">
|
||||
<i class="fa fa-li fa-long-arrow-right"></i>
|
||||
<p class="chill-no-data-statement">{{ $t('renderbox.no_data') }}</p>
|
||||
</li>
|
||||
<slot name="custom-zone"></slot>
|
||||
|
||||
<li v-if="person.centers !== undefined && person.centers.length > 0 && options.addCenter">
|
||||
<i class="fa fa-li fa-long-arrow-right"></i>
|
||||
<template v-for="c in person.centers">{{ c.name }}</template>
|
||||
</li>
|
||||
<li v-else-if="options.addNoData">
|
||||
<i class="fa fa-li fa-long-arrow-right"></i>
|
||||
<p class="chill-no-data-statement">{{ $t('renderbox.no_data') }}</p>
|
||||
</li>
|
||||
<slot name="custom-zone"></slot>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<span v-if="render === 'badge'" class="chill-entity entity-person badge-person">
|
||||
<a v-if="options.addLink === true" :href="getUrl">
|
||||
<span v-if="options.isHolder" class="fa-stack fa-holder" :title="$t('renderbox.holder')">
|
||||
<i class="fa fa-circle fa-stack-1x text-success"></i>
|
||||
<i class="fa fa-stack-1x">T</i>
|
||||
</span>
|
||||
{{ person.text }}
|
||||
<span v-if="render === 'badge'" class="chill-entity entity-person badge-person">
|
||||
<a v-if="options.addLink === true" :href="getUrl">
|
||||
<span v-if="options.isHolder" class="fa-stack fa-holder" :title="$t('renderbox.holder')">
|
||||
<i class="fa fa-circle fa-stack-1x text-success"></i>
|
||||
<i class="fa fa-stack-1x">T</i>
|
||||
</span>
|
||||
|
||||
<person-text :person="person"></person-text>
|
||||
</a>
|
||||
<span v-else>
|
||||
<span v-if="options.isHolder" class="fa-stack fa-holder" :title="$t('renderbox.holder')">
|
||||
<i class="fa fa-circle fa-stack-1x text-success"></i>
|
||||
<i class="fa fa-stack-1x">T</i>
|
||||
</span>
|
||||
{{ person.text }}
|
||||
<span v-if="options.isHolder" class="fa-stack fa-holder" :title="$t('renderbox.holder')">
|
||||
<i class="fa fa-circle fa-stack-1x text-success"></i>
|
||||
<i class="fa fa-stack-1x">T</i>
|
||||
</span>
|
||||
<person-text :person="person"></person-text>
|
||||
</span>
|
||||
<slot name="post-badge"></slot>
|
||||
</span>
|
||||
</span>
|
||||
|
||||
</template>
|
||||
|
||||
@@ -145,13 +147,15 @@ import {dateToISO} from 'ChillMainAssets/chill/js/date.js';
|
||||
import AddressRenderBox from 'ChillMainAssets/vuejs/_components/Entity/AddressRenderBox.vue';
|
||||
import Confidential from 'ChillMainAssets/vuejs/_components/Confidential.vue';
|
||||
import BadgeEntity from 'ChillMainAssets/vuejs/_components/BadgeEntity.vue';
|
||||
import PersonText from 'ChillPersonAssets/vuejs/_components/Entity/PersonText.vue';
|
||||
|
||||
export default {
|
||||
name: "PersonRenderBox",
|
||||
components: {
|
||||
AddressRenderBox,
|
||||
Confidential,
|
||||
BadgeEntity
|
||||
BadgeEntity,
|
||||
PersonText
|
||||
},
|
||||
props: ['person', 'options', 'render', 'returnPath'],
|
||||
computed: {
|
||||
@@ -166,7 +170,7 @@ export default {
|
||||
return this.person.gender === 'woman' ? 'fa-venus' : this.person.gender === 'man' ? 'fa-mars' : this.person.gender === 'neuter' ? 'fa-neuter' : 'fa-genderless';
|
||||
},
|
||||
getGenderTranslation: function() {
|
||||
return this.person.gender === 'woman' ? 'renderbox.birthday.woman' : 'renderbox.birthday.man';
|
||||
return this.person.gender === 'woman' ? 'renderbox.birthday.woman' : 'renderbox.birthday.man';
|
||||
},
|
||||
getGender() {
|
||||
return this.person.gender === 'woman' ? 'person.gender.woman' : this.person.gender === 'man' ? 'person.gender.man' : this.person.gender === 'neuter' ? 'person.gender.neuter' : 'person.gender.undefined';
|
||||
@@ -198,24 +202,6 @@ export default {
|
||||
getUrl: function() {
|
||||
return `/fr/person/${this.person.id}/general`;
|
||||
},
|
||||
getAge: function() {
|
||||
// TODO only one abstract function
|
||||
if(this.person.birthdate && !this.person.deathdate){
|
||||
const birthday = new Date(this.person.birthdate.datetime)
|
||||
const now = new Date()
|
||||
return (now.getFullYear() - birthday.getFullYear())
|
||||
} else if(this.person.birthdate && this.person.deathdate){
|
||||
const birthday = new Date(this.person.birthdate.datetime)
|
||||
const deathdate = new Date(this.person.deathdate.datetime)
|
||||
return (deathdate.getFullYear() - birthday.getFullYear())
|
||||
} else if(!this.person.birthdate && this.person.deathdate.datetime) {
|
||||
// todo: change this
|
||||
return "Age unknown"
|
||||
} else {
|
||||
// todo: change this
|
||||
return "Age unknown"
|
||||
}
|
||||
},
|
||||
getCurrentHouseholdUrl: function() {
|
||||
let returnPath = this.returnPath ? `?returnPath=${this.returnPath}` : ``;
|
||||
return `/fr/person/household/${this.person.current_household_id}/summary${returnPath}`
|
||||
|
@@ -0,0 +1,50 @@
|
||||
<template>
|
||||
<span v-if="isCut">{{ cutText }}</span>
|
||||
<span v-else class="person-text">
|
||||
<span class="firstname">{{ person.firstName }}</span>
|
||||
<span class="lastname">{{ person.lastName }}</span>
|
||||
<span v-if="person.altNames && person.altNames.length > 0" class="altnames">
|
||||
<span :class="'altname altname-' + altNameKey"> ({{ altNameLabel }})</span>
|
||||
</span>
|
||||
<span class="age" v-if="this.addAge && person.birthdate !== null && person.deathdate === null">{{ $tc('renderbox.years_old', person.age) }}</span>
|
||||
<span v-else-if="this.addAge && person.deathdate !== null"> (‡)</span>
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
export default {
|
||||
name: "PersonText",
|
||||
props: {
|
||||
person: {
|
||||
required: true,
|
||||
},
|
||||
isCut: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
default: false
|
||||
},
|
||||
addAge: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
default: true,
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
altNameLabel: function() {
|
||||
for(let i = 0; i < this.person.altNames.length; i++){
|
||||
return this.person.altNames[i].label
|
||||
}
|
||||
},
|
||||
altNameKey: function() {
|
||||
for(let i = 0; i < this.person.altNames.length; i++){
|
||||
return this.person.altNames[i].key
|
||||
}
|
||||
},
|
||||
cutText: function() {
|
||||
let more = (this.person.text.length > 15) ?'…' : '';
|
||||
return this.person.text.slice(0,15) + more;
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
@@ -22,24 +22,45 @@
|
||||
<div v-else-if="action === 'edit' || action === 'create'">
|
||||
|
||||
<div class="form-floating mb-3">
|
||||
<input class="form-control form-control-lg" id="lastname" v-model="lastName" v-bind:placeholder="$t('person.lastname')" />
|
||||
<input
|
||||
class="form-control form-control-lg"
|
||||
id="lastname"
|
||||
v-model="lastName"
|
||||
:placeholder="$t('person.lastname')"
|
||||
@change="checkErrors"
|
||||
/>
|
||||
<label for="lastname">{{ $t('person.lastname') }}</label>
|
||||
</div>
|
||||
|
||||
<div class="form-floating mb-3">
|
||||
<input class="form-control form-control-lg" id="firstname" v-model="firstName" v-bind:placeholder="$t('person.firstname')" />
|
||||
<input
|
||||
class="form-control form-control-lg"
|
||||
id="firstname"
|
||||
v-model="firstName"
|
||||
:placeholder="$t('person.firstname')"
|
||||
@change="checkErrors"
|
||||
/>
|
||||
<label for="firstname">{{ $t('person.firstname') }}</label>
|
||||
</div>
|
||||
|
||||
<div v-for="(a) in config.altNames" :key="a.key" class="form-floating mb-3">
|
||||
<input class="form-control form-control-lg" :id="a.key" @input="onAltNameInput" />
|
||||
<input
|
||||
class="form-control form-control-lg"
|
||||
:id="a.key"
|
||||
@input="onAltNameInput"
|
||||
/>
|
||||
<label :for="a.key">{{ a.labels.fr }}</label>
|
||||
</div>
|
||||
|
||||
<!-- TODO fix placeholder if undefined
|
||||
-->
|
||||
<div class="form-floating mb-3">
|
||||
<select class="form-select form-select-lg" id="gender" v-model="gender">
|
||||
<select
|
||||
class="form-select form-select-lg"
|
||||
id="gender"
|
||||
v-model="gender"
|
||||
@change="checkErrors"
|
||||
>
|
||||
<option selected disabled >{{ $t('person.gender.placeholder') }}</option>
|
||||
<option value="woman">{{ $t('person.gender.woman') }}</option>
|
||||
<option value="man">{{ $t('person.gender.man') }}</option>
|
||||
@@ -62,8 +83,8 @@
|
||||
<span class="input-group-text" id="phonenumber"><i class="fa fa-fw fa-phone"></i></span>
|
||||
<input class="form-control form-control-lg"
|
||||
v-model="phonenumber"
|
||||
v-bind:placeholder="$t('person.phonenumber')"
|
||||
v-bind:aria-label="$t('person.phonenumber')"
|
||||
:placeholder="$t('person.phonenumber')"
|
||||
:aria-label="$t('person.phonenumber')"
|
||||
aria-describedby="phonenumber" />
|
||||
</div>
|
||||
|
||||
@@ -71,8 +92,8 @@
|
||||
<span class="input-group-text" id="mobilenumber"><i class="fa fa-fw fa-mobile"></i></span>
|
||||
<input class="form-control form-control-lg"
|
||||
v-model="mobilenumber"
|
||||
v-bind:placeholder="$t('person.mobilenumber')"
|
||||
v-bind:aria-label="$t('person.mobilenumber')"
|
||||
:placeholder="$t('person.mobilenumber')"
|
||||
:aria-label="$t('person.mobilenumber')"
|
||||
aria-describedby="mobilenumber" />
|
||||
</div>
|
||||
|
||||
@@ -80,11 +101,17 @@
|
||||
<span class="input-group-text" id="email"><i class="fa fa-fw fa-at"></i></span>
|
||||
<input class="form-control form-control-lg"
|
||||
v-model="email"
|
||||
v-bind:placeholder="$t('person.email')"
|
||||
v-bind:aria-label="$t('person.email')"
|
||||
:placeholder="$t('person.email')"
|
||||
:aria-label="$t('person.email')"
|
||||
aria-describedby="email" />
|
||||
</div>
|
||||
|
||||
<div class="alert alert-warning" v-if="errors.length">
|
||||
<ul>
|
||||
<li v-for="(e, i) in errors" :key="i">{{ e }}</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -108,6 +135,7 @@ export default {
|
||||
config: {
|
||||
altNames: []
|
||||
},
|
||||
errors: []
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -183,6 +211,18 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
checkErrors(e) {
|
||||
this.errors = [];
|
||||
if (!this.person.lastName) {
|
||||
this.errors.push("Le nom ne doit pas être vide.");
|
||||
}
|
||||
if (!this.person.firstName) {
|
||||
this.errors.push("Le prénom ne doit pas être vide.");
|
||||
}
|
||||
if (!this.person.gender) {
|
||||
this.errors.push("Le genre doit être renseigné");
|
||||
}
|
||||
},
|
||||
loadData() {
|
||||
getPerson(this.id)
|
||||
.then(person => new Promise((resolve, reject) => {
|
||||
|
Reference in New Issue
Block a user