mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-04 22:04:59 +00:00
Merge remote-tracking branch 'origin/master' into issue578_display_userjob
This commit is contained in:
@@ -123,6 +123,7 @@ export default {
|
||||
body.email = payload.data.email;
|
||||
body.altNames = payload.data.altNames;
|
||||
body.gender = payload.data.gender;
|
||||
if (payload.data.civility !== null) { body.civility = {id: payload.data.civility.id, type: payload.data.civility.type }; }
|
||||
|
||||
makeFetch('PATCH', `/api/1.0/person/person/${payload.data.id}.json`, body)
|
||||
.then(response => {
|
||||
|
@@ -150,6 +150,7 @@ export default {
|
||||
body.email = payload.data.email;
|
||||
body.altNames = payload.data.altNames;
|
||||
body.gender = payload.data.gender;
|
||||
if (payload.data.civility !== null) { body.civility = {id: payload.data.civility.id, type: payload.data.civility.type}; }
|
||||
|
||||
makeFetch('PATCH', `/api/1.0/person/person/${payload.data.id}.json`, body)
|
||||
.then(response => {
|
||||
|
@@ -24,6 +24,15 @@
|
||||
<input v-model="endDate" type="date" class="form-control" />
|
||||
</div>
|
||||
|
||||
<div id="privateComment" class="action-row">
|
||||
<label class="col-form-label">{{ $t('private_comment') }}</label>
|
||||
<ckeditor
|
||||
v-model="privateComment"
|
||||
:editor="editor"
|
||||
tag-name="textarea"
|
||||
></ckeditor>
|
||||
</div>
|
||||
|
||||
<div id="comment" class="action-row">
|
||||
<label class="col-form-label">{{ $t('comments') }}</label>
|
||||
<ckeditor
|
||||
@@ -33,6 +42,7 @@
|
||||
></ckeditor>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="objectives" class="action-row">
|
||||
<div aria="hidden" class="title">
|
||||
<div><h3>{{ $t('goals_title') }}</h3></div>
|
||||
@@ -141,12 +151,12 @@
|
||||
|
||||
<ul class="list-unstyled">
|
||||
<li v-for="p in personsReachables" :key="p.id">
|
||||
<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>
|
||||
<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>
|
||||
@@ -274,18 +284,18 @@
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<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"
|
||||
:preventDefaultMoveToGenerate="true"
|
||||
@go-to-generate-workflow="goToGenerateWorkflow"
|
||||
></list-workflow-modal>
|
||||
</li>
|
||||
<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"
|
||||
:preventDefaultMoveToGenerate="true"
|
||||
@go-to-generate-workflow="goToGenerateWorkflow"
|
||||
></list-workflow-modal>
|
||||
</li>
|
||||
|
||||
<li v-if="!isPosting">
|
||||
<button class="btn btn-save" @click="submit">
|
||||
@@ -355,7 +365,8 @@ const i18n = {
|
||||
referrers: "Agents traitants",
|
||||
no_referrers: "Aucun agent traitant",
|
||||
choose_referrers: "Choisir des agents traitants",
|
||||
remove_referrer: "Enlever l'agent"
|
||||
remove_referrer: "Enlever l'agent",
|
||||
private_comment: "Commentaire privé"
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -417,8 +428,8 @@ export default {
|
||||
},
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapState([
|
||||
computed: {
|
||||
...mapState([
|
||||
'work',
|
||||
'resultsForAction',
|
||||
'evaluationsForAction',
|
||||
@@ -461,6 +472,14 @@ export default {
|
||||
this.$store.commit('setNote', v);
|
||||
}
|
||||
},
|
||||
privateComment: {
|
||||
get() {
|
||||
return this.$store.state.privateComment;
|
||||
},
|
||||
set(v) {
|
||||
this.$store.commit('setPrivateComment', v);
|
||||
}
|
||||
},
|
||||
availableForCheckGoal() {
|
||||
let pickedIds = this.$store.state.goalsPicked.map(g => g.goal.id);
|
||||
|
||||
@@ -573,6 +592,7 @@ div#workEditor {
|
||||
"title title"
|
||||
"startDate endDate"
|
||||
"comment comment"
|
||||
"privateComment privateComment"
|
||||
"objectives objectives"
|
||||
"evaluations evaluations"
|
||||
"persons persons"
|
||||
@@ -589,6 +609,8 @@ div#workEditor {
|
||||
grid-area: endDate; }
|
||||
#comment {
|
||||
grid-area: comment; }
|
||||
#privateComment {
|
||||
grid-area: privateComment; }
|
||||
#objectives {
|
||||
grid-area: objectives; }
|
||||
#evaluations {
|
||||
|
@@ -17,6 +17,7 @@ const store = createStore({
|
||||
endDate: window.accompanyingCourseWork.endDate !== null ?
|
||||
dateToISO(new Date(window.accompanyingCourseWork.endDate.datetime)) : null,
|
||||
note: window.accompanyingCourseWork.note,
|
||||
privateComment: window.accompanyingCourseWork.privateComment,
|
||||
goalsPicked: window.accompanyingCourseWork.goals,
|
||||
goalsForAction: [],
|
||||
resultsPicked: window.accompanyingCourseWork.results,
|
||||
@@ -79,6 +80,7 @@ const store = createStore({
|
||||
datetime: datetimeToISO(ISOToDate(state.endDate))
|
||||
},
|
||||
note: state.note,
|
||||
privateComment: state.privateComment,
|
||||
persons: state.personsPicked.map(p => ({id: p.id, type: p.type})),
|
||||
handlingThierParty: state.handlingThirdParty === null ? null : {
|
||||
id: state.handlingThirdParty.id,
|
||||
@@ -297,6 +299,9 @@ const store = createStore({
|
||||
setNote(state, note) {
|
||||
state.note = note;
|
||||
},
|
||||
setPrivateComment(state, privateComment) {
|
||||
state.privateComment = privateComment;
|
||||
},
|
||||
setHandlingThirdParty(state, thirdParty) {
|
||||
state.handlingThirdParty = thirdParty;
|
||||
},
|
||||
@@ -454,6 +459,8 @@ const store = createStore({
|
||||
;
|
||||
commit('setIsPosting', true);
|
||||
|
||||
console.log('payload', payload);
|
||||
|
||||
return makeFetch('PUT', url, payload)
|
||||
.then(data => {
|
||||
if (typeof(callback) !== 'undefined') {
|
||||
|
@@ -14,8 +14,13 @@ const getPersonAltNames = () =>
|
||||
fetch('/api/1.0/person/config/alt_names.json').then(response => {
|
||||
if (response.ok) { return response.json(); }
|
||||
throw Error('Error with request resource response');
|
||||
});;
|
||||
});
|
||||
|
||||
const getCivilities = () =>
|
||||
fetch('/api/1.0/main/civility.json').then(response => {
|
||||
if (response.ok) { return response.json(); }
|
||||
throw Error('Error with request resource response');
|
||||
});
|
||||
|
||||
/*
|
||||
* POST a new person
|
||||
@@ -56,6 +61,7 @@ const patchPerson = (id, body) => {
|
||||
export {
|
||||
getPerson,
|
||||
getPersonAltNames,
|
||||
getCivilities,
|
||||
postPerson,
|
||||
patchPerson
|
||||
};
|
||||
|
@@ -277,12 +277,79 @@ export default {
|
||||
}
|
||||
},
|
||||
saveFormOnTheFly({ type, data }) {
|
||||
// console.log('saveFormOnTheFly from addPersons, type', type, ', data', data);
|
||||
console.log('saveFormOnTheFly from addPersons, type', type, ', data', data);
|
||||
if (type === 'person') {
|
||||
|
||||
makeFetch('POST', '/api/1.0/person/person.json', data)
|
||||
.then(response => {
|
||||
this.newPriorSuggestion(response);
|
||||
.then(responsePerson => {
|
||||
|
||||
this.newPriorSuggestion(responsePerson);
|
||||
this.$refs.onTheFly.closeModal();
|
||||
|
||||
if (null !== data.addressId) {
|
||||
const household = {
|
||||
'type': 'household'
|
||||
};
|
||||
const address = {
|
||||
'id': data.addressId
|
||||
};
|
||||
makeFetch('POST', '/api/1.0/person/household.json', household)
|
||||
.then(responseHousehold => {
|
||||
const member = {
|
||||
'concerned': [
|
||||
{
|
||||
'person': {
|
||||
'type': 'person',
|
||||
'id': responsePerson.id
|
||||
},
|
||||
'start_date': {
|
||||
// TODO: use date.js methods (low priority)
|
||||
'datetime': `${new Date().toISOString().split('T')[0]}T00:00:00+02:00`
|
||||
},
|
||||
'holder': false,
|
||||
'comment': null
|
||||
}
|
||||
],
|
||||
'destination': {
|
||||
'type': 'household',
|
||||
'id': responseHousehold.id
|
||||
},
|
||||
'composition': null
|
||||
};
|
||||
return makeFetch('POST', '/api/1.0/person/household/members/move.json', member)
|
||||
.then(_response => {
|
||||
makeFetch('POST', `/api/1.0/person/household/${responseHousehold.id}/address.json`, address)
|
||||
.then(_response => {})
|
||||
.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'});
|
||||
}
|
||||
});
|
||||
})
|
||||
.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'});
|
||||
}
|
||||
});
|
||||
})
|
||||
.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'});
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
if (error.name === 'ValidationException') {
|
||||
@@ -292,7 +359,8 @@ export default {
|
||||
} else {
|
||||
this.$toast.open({message: 'An error occurred'});
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
}
|
||||
else if (type === 'thirdparty') {
|
||||
makeFetch('POST', '/api/1.0/thirdparty/thirdparty.json', data)
|
||||
|
@@ -87,6 +87,20 @@
|
||||
<label>{{ $t('person.gender.title') }}</label>
|
||||
</div>
|
||||
|
||||
<div class="form-floating mb-3">
|
||||
<select
|
||||
class="form-select form-select-lg"
|
||||
id="civility"
|
||||
v-model="civility"
|
||||
>
|
||||
<option selected disabled >{{ $t('person.civility.placeholder') }}</option>
|
||||
<option v-for="c in config.civilities" :value="c.id" :key="c.id">
|
||||
{{ c.name.fr }}
|
||||
</option>
|
||||
</select>
|
||||
<label>{{ $t('person.civility.title') }}</label>
|
||||
</div>
|
||||
|
||||
<div class="input-group mb-3">
|
||||
<span class="input-group-text" id="birthdate"><i class="fa fa-fw fa-birthday-cake"></i></span>
|
||||
<input type="date"
|
||||
@@ -124,6 +138,24 @@
|
||||
aria-describedby="email" />
|
||||
</div>
|
||||
|
||||
<div v-if="action === 'create'" class="input-group mb-3 form-check">
|
||||
<input class="form-check-input"
|
||||
type='checkbox'
|
||||
v-model="showAddressForm"
|
||||
name='showAddressForm'/>
|
||||
<label class="form-check-label">{{ $t('person.address.show_address_form') }}</label>
|
||||
</div>
|
||||
<div v-if="action === 'create' && showAddressFormValue" class="form-floating mb-3">
|
||||
<p>{{ $t('person.address.warning') }}</p>
|
||||
<add-address
|
||||
:context="addAddress.context"
|
||||
:options="addAddress.options"
|
||||
:addressChangedCallback="submitNewAddress"
|
||||
ref="addAddress">
|
||||
</add-address>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="alert alert-warning" v-if="errors.length">
|
||||
<ul>
|
||||
<li v-for="(e, i) in errors" :key="i">{{ e }}</li>
|
||||
@@ -134,24 +166,43 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getPerson, getPersonAltNames } from '../../_api/OnTheFly';
|
||||
import { getCivilities, getPerson, getPersonAltNames } from '../../_api/OnTheFly';
|
||||
import PersonRenderBox from '../Entity/PersonRenderBox.vue';
|
||||
import AddAddress from "ChillMainAssets/vuejs/Address/components/AddAddress.vue";
|
||||
|
||||
export default {
|
||||
name: "OnTheFlyPerson",
|
||||
props: ['id', 'type', 'action', 'query'],
|
||||
//emits: ['createAction'],
|
||||
components: {
|
||||
PersonRenderBox
|
||||
PersonRenderBox,
|
||||
AddAddress
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
person: {
|
||||
type: 'person',
|
||||
altNames: []
|
||||
altNames: [],
|
||||
addressId: null
|
||||
},
|
||||
config: {
|
||||
altNames: []
|
||||
altNames: [],
|
||||
civilities: []
|
||||
},
|
||||
showAddressFormValue: false,
|
||||
addAddress: {
|
||||
options: {
|
||||
button: {
|
||||
text: { create: 'person.address.create_address' },
|
||||
size: 'btn-sm'
|
||||
},
|
||||
title: { create: 'person.address.create_address' },
|
||||
},
|
||||
context: {
|
||||
target: {}, // boilerplate for getting the address id
|
||||
edit: false,
|
||||
addressId: null
|
||||
}
|
||||
},
|
||||
errors: []
|
||||
}
|
||||
@@ -171,6 +222,10 @@ export default {
|
||||
set(value) { this.person.gender = value; },
|
||||
get() { return this.person.gender; }
|
||||
},
|
||||
civility: {
|
||||
set(value) { this.person.civility = {id: value, type: 'chill_main_civility'}; },
|
||||
get() { return this.person.civility ? this.person.civility.id : null; }
|
||||
},
|
||||
birthDate: {
|
||||
set(value) {
|
||||
if (this.person.birthdate) {
|
||||
@@ -195,6 +250,10 @@ export default {
|
||||
set(value) { this.person.email = value; },
|
||||
get() { return this.person.email; }
|
||||
},
|
||||
showAddressForm: {
|
||||
set(value) { this.showAddressFormValue = value; },
|
||||
get() { return this.showAddressFormValue; }
|
||||
},
|
||||
genderClass() {
|
||||
switch (this.person.gender) {
|
||||
case 'woman':
|
||||
@@ -230,6 +289,13 @@ export default {
|
||||
.then(altNames => {
|
||||
this.config.altNames = altNames;
|
||||
});
|
||||
getCivilities()
|
||||
.then(civilities => {
|
||||
if ('results' in civilities) {
|
||||
this.config.civilities = civilities.results;
|
||||
}
|
||||
});
|
||||
|
||||
if (this.action !== 'create') {
|
||||
this.loadData();
|
||||
}
|
||||
@@ -273,6 +339,9 @@ export default {
|
||||
this.person.firstName = queryItem;
|
||||
break;
|
||||
}
|
||||
},
|
||||
submitNewAddress(payload) {
|
||||
this.person.addressId = payload.addressId;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -293,4 +362,9 @@ dl {
|
||||
margin-left: 1em;
|
||||
}
|
||||
}
|
||||
div.form-check {
|
||||
label {
|
||||
margin-left: 0.5em!important;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
@@ -38,6 +38,15 @@ const personMessages = {
|
||||
man: "Masculin",
|
||||
neuter: "Neutre, non binaire",
|
||||
undefined: "Non renseigné"
|
||||
},
|
||||
civility: {
|
||||
title: "Civilité",
|
||||
placeholder: "Choisissez la civilité",
|
||||
},
|
||||
address: {
|
||||
create_address: "Ajouter une adresse",
|
||||
show_address_form: "Créer un ménage et ajouter une adresse",
|
||||
warning: "Un nouveau ménage va être créé. L'usager sera membre de ce ménage."
|
||||
}
|
||||
},
|
||||
error_only_one_person: "Une seule personne peut être sélectionnée !"
|
||||
|
Reference in New Issue
Block a user