mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
show current civility and profession in edit form + fix saving of edited information
This commit is contained in:
parent
d5501bcfbd
commit
ff4b90835e
@ -228,6 +228,8 @@ export default {
|
||||
type = 'thirdparty'
|
||||
data = this.$refs.castThirdparty.$data.thirdparty;
|
||||
console.log('data original', data);
|
||||
data.civility = data.civility ? {type: 'chill_main_civility', id: data.civility.id} : null;
|
||||
data.profession = data.profession ? {type: 'third_party_profession', id: data.profession.id} : null;
|
||||
data.parent = {type: "thirdparty", id: this.parent.id};
|
||||
} else {
|
||||
type = this.$refs.castNew.radioType;
|
||||
|
@ -137,7 +137,7 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
saveFormOnTheFly(payload) {
|
||||
console.log('saveFormOnTheFly: type', payload.type, ', data', payload.data);
|
||||
// console.log('saveFormOnTheFly: type', payload.type, ', data', payload.data);
|
||||
payload.target = 'resource';
|
||||
|
||||
let body = { type: payload.type };
|
||||
@ -167,14 +167,15 @@ export default {
|
||||
})
|
||||
}
|
||||
else if (payload.type === 'thirdparty') {
|
||||
console.log('data', payload.data)
|
||||
body.name = payload.data.name;
|
||||
body.email = payload.data.email;
|
||||
body.telephone = payload.data.telephone;
|
||||
body.civility = payload.data.civility;
|
||||
body.profession = payload.data.profession;
|
||||
body.civility = {type: 'chill_main_civility', id: payload.data.civility.id};
|
||||
body.profession = {type: 'third_party_profession', id: payload.data.profession.id};
|
||||
body.address = payload.data.address ? { id: payload.data.address.address_id } : null;
|
||||
|
||||
console.log('body', body);
|
||||
|
||||
makeFetch('PATCH', `/api/1.0/thirdparty/thirdparty/${payload.data.id}.json`, body)
|
||||
.then(response => {
|
||||
this.$store.dispatch('addThirdparty', { target: payload.target, body: response })
|
||||
|
@ -67,17 +67,17 @@
|
||||
<div v-if="thirdparty.kind === 'child' || thirdparty.kind === 'contact'">
|
||||
<div id="child-info">
|
||||
<div class="input-group mb-3">
|
||||
<select class="form-select form-select-lg" id="profession"
|
||||
<select class="form-select form-select-lg" id="civility"
|
||||
v-model="thirdparty.civility">
|
||||
<option selected disabled :value="null" >{{ $t('thirdparty.civility') }}</option>
|
||||
<option v-for="civility in civilities" :key="civility.id" :value="{type: 'chill_main_civility', id: civility.id }">{{ civility.name.fr }}</option>
|
||||
<option v-for="civility in civilities" :key="civility.id" :value="civility">{{ civility.name.fr }}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="input-group mb-3">
|
||||
<select class="form-select form-select-lg" id="civility"
|
||||
<select class="form-select form-select-lg" id="profession"
|
||||
v-model="thirdparty.profession">
|
||||
<option selected disabled :value="null">{{ $t('thirdparty.profession') }}</option>
|
||||
<option v-for="profession in professions" :key="profession.id" :value="{type: 'third_party_profession', id: profession.id }">{{ profession.name.fr }}</option>
|
||||
<option v-for="profession in professions" :key="profession.id" :value="profession">{{ profession.name.fr }}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
@ -209,7 +209,6 @@ export default {
|
||||
context.addressId = this.thirdparty.address.address_id;
|
||||
context.edit = true;
|
||||
}
|
||||
console.log('context', context);
|
||||
//this.context = context; <--
|
||||
return context;
|
||||
},
|
||||
@ -219,7 +218,6 @@ export default {
|
||||
return getThirdparty(this.id).then(thirdparty => new Promise((resolve, reject) => {
|
||||
this.thirdparty = thirdparty;
|
||||
this.thirdparty.kind = thirdparty.kind;
|
||||
console.log('get thirdparty', thirdparty);
|
||||
if (this.action !== 'show') {
|
||||
if (thirdparty.address !== null) {
|
||||
// bof! we force getInitialAddress because addressId not available when mounted
|
||||
|
Loading…
x
Reference in New Issue
Block a user