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);
|
||||
data.parent = {type: "thirdparty", id: this.parent.id};
|
||||
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 {
|
||||
type = this.$refs.castNew.radioType;
|
||||
data = this.$refs.castNew.castDataByType();
|
||||
@ -241,8 +241,8 @@ export default {
|
||||
if (typeof data.civility !== 'undefined' && null !== data.civility) {
|
||||
data.civility = data.civility !== null ? {type: 'chill_main_civility', id: data.civility.id} : null;
|
||||
}
|
||||
if (typeof data.profession !== 'undefined' && null !== data.profession) {
|
||||
data.profession = data.profession !== null ? {type: 'third_party_profession', id: data.profession.id} : null;
|
||||
if (typeof data.profession !== 'undefined' && '' !== data.profession) {
|
||||
data.profession = data.profession !== '' ? data.profession : '';
|
||||
}
|
||||
// console.log('onthefly data', data);
|
||||
}
|
||||
|
@ -178,7 +178,7 @@ export default {
|
||||
body.civility = {type: 'chill_main_civility', id: payload.data.civility.id};
|
||||
}
|
||||
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);
|
||||
|
||||
|
@ -73,13 +73,13 @@
|
||||
<option v-for="civility in civilities" :key="civility.id" :value="civility">{{ civility.name.fr }}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="input-group mb-3 input-section">
|
||||
<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="profession">{{ profession.name.fr }}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="input-group mb-3 input-section">
|
||||
<input class="form-control form-control-lg"
|
||||
v-model="thirdparty.profession"
|
||||
v-bind:placeholder="$t('thirdparty.profession')"
|
||||
v-bind:aria-label="$t('thirdparty.profession')"
|
||||
aria-describedby="profession" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="child-info">
|
||||
<div class="input-section">
|
||||
@ -192,9 +192,8 @@ export default {
|
||||
name: '',
|
||||
telephone: '',
|
||||
civility: null,
|
||||
profession: null,
|
||||
profession: '',
|
||||
},
|
||||
professions: [],
|
||||
civilities: [],
|
||||
addAddress: {
|
||||
options: {
|
||||
@ -274,18 +273,6 @@ export default {
|
||||
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) {
|
||||
console.log('submitAddress', payload);
|
||||
if (typeof payload.addressId !== 'undefined') { // <--
|
||||
@ -311,7 +298,6 @@ export default {
|
||||
},
|
||||
mounted() {
|
||||
let dependencies = [];
|
||||
dependencies.push(this.loadProfessions());
|
||||
dependencies.push(this.loadCivilities());
|
||||
if (this.action !== 'create') {
|
||||
if (this.id) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user