mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
FIX [post] adjust vue components to allow thirdparty to be posted with new profession type as string
This commit is contained in:
parent
e50b02a8c7
commit
e982e81900
@ -233,7 +233,7 @@ export default {
|
|||||||
// console.log('data original', data);
|
// console.log('data original', data);
|
||||||
data.parent = {type: "thirdparty", id: this.parent.id};
|
data.parent = {type: "thirdparty", id: this.parent.id};
|
||||||
data.civility = data.civility !== null ? {type: 'chill_main_civility', id: data.civility.id} : null;
|
data.civility = data.civility !== null ? {type: 'chill_main_civility', id: data.civility.id} : null;
|
||||||
data.profession = data.profession !== null ? {type: 'third_party_profession', id: data.profession.id} : null;
|
data.profession = data.profession !== '' ? data.profession : '';
|
||||||
} else {
|
} else {
|
||||||
type = this.$refs.castNew.radioType;
|
type = this.$refs.castNew.radioType;
|
||||||
data = this.$refs.castNew.castDataByType();
|
data = this.$refs.castNew.castDataByType();
|
||||||
@ -241,8 +241,8 @@ export default {
|
|||||||
if (typeof data.civility !== 'undefined' && null !== data.civility) {
|
if (typeof data.civility !== 'undefined' && null !== data.civility) {
|
||||||
data.civility = data.civility !== null ? {type: 'chill_main_civility', id: data.civility.id} : null;
|
data.civility = data.civility !== null ? {type: 'chill_main_civility', id: data.civility.id} : null;
|
||||||
}
|
}
|
||||||
if (typeof data.profession !== 'undefined' && null !== data.profession) {
|
if (typeof data.profession !== 'undefined' && '' !== data.profession) {
|
||||||
data.profession = data.profession !== null ? {type: 'third_party_profession', id: data.profession.id} : null;
|
data.profession = data.profession !== '' ? data.profession : '';
|
||||||
}
|
}
|
||||||
// console.log('onthefly data', data);
|
// console.log('onthefly data', data);
|
||||||
}
|
}
|
||||||
|
@ -178,7 +178,7 @@ export default {
|
|||||||
body.civility = {type: 'chill_main_civility', id: payload.data.civility.id};
|
body.civility = {type: 'chill_main_civility', id: payload.data.civility.id};
|
||||||
}
|
}
|
||||||
if (null !== payload.data.profession) {
|
if (null !== payload.data.profession) {
|
||||||
body.profession = {type: 'third_party_profession', id: payload.data.profession.id};
|
body.profession = payload.data.profession;
|
||||||
}
|
}
|
||||||
// console.log('body', body);
|
// console.log('body', body);
|
||||||
|
|
||||||
|
@ -73,13 +73,13 @@
|
|||||||
<option v-for="civility in civilities" :key="civility.id" :value="civility">{{ civility.name.fr }}</option>
|
<option v-for="civility in civilities" :key="civility.id" :value="civility">{{ civility.name.fr }}</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="input-group mb-3 input-section">
|
<div class="input-group mb-3 input-section">
|
||||||
<select class="form-select form-select-lg" id="profession"
|
<input class="form-control form-control-lg"
|
||||||
v-model="thirdparty.profession">
|
v-model="thirdparty.profession"
|
||||||
<option selected disabled :value="null">{{ $t('thirdparty.profession') }}</option>
|
v-bind:placeholder="$t('thirdparty.profession')"
|
||||||
<option v-for="profession in professions" :key="profession.id" :value="profession">{{ profession.name.fr }}</option>
|
v-bind:aria-label="$t('thirdparty.profession')"
|
||||||
</select>
|
aria-describedby="profession" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="child-info">
|
<div class="child-info">
|
||||||
<div class="input-section">
|
<div class="input-section">
|
||||||
@ -192,9 +192,8 @@ export default {
|
|||||||
name: '',
|
name: '',
|
||||||
telephone: '',
|
telephone: '',
|
||||||
civility: null,
|
civility: null,
|
||||||
profession: null,
|
profession: '',
|
||||||
},
|
},
|
||||||
professions: [],
|
|
||||||
civilities: [],
|
civilities: [],
|
||||||
addAddress: {
|
addAddress: {
|
||||||
options: {
|
options: {
|
||||||
@ -274,18 +273,6 @@ export default {
|
|||||||
this.$toast.open({message: error.body})
|
this.$toast.open({message: error.body})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
loadProfessions() {
|
|
||||||
const url = `/api/1.0/thirdparty/professions.json`;
|
|
||||||
return makeFetch('GET', url)
|
|
||||||
.then(response => {
|
|
||||||
this.$data.professions = response.results;
|
|
||||||
return Promise.resolve();
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
console.log(error)
|
|
||||||
this.$toast.open({message: error.body})
|
|
||||||
})
|
|
||||||
},
|
|
||||||
submitAddress(payload) {
|
submitAddress(payload) {
|
||||||
console.log('submitAddress', payload);
|
console.log('submitAddress', payload);
|
||||||
if (typeof payload.addressId !== 'undefined') { // <--
|
if (typeof payload.addressId !== 'undefined') { // <--
|
||||||
@ -311,7 +298,6 @@ export default {
|
|||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
let dependencies = [];
|
let dependencies = [];
|
||||||
dependencies.push(this.loadProfessions());
|
|
||||||
dependencies.push(this.loadCivilities());
|
dependencies.push(this.loadCivilities());
|
||||||
if (this.action !== 'create') {
|
if (this.action !== 'create') {
|
||||||
if (this.id) {
|
if (this.id) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user