FIX [post] adjust vue components to allow thirdparty to be posted with new profession type as string

This commit is contained in:
2023-02-22 17:57:30 +01:00
committed by Julien Fastré
parent e50b02a8c7
commit e982e81900
3 changed files with 12 additions and 26 deletions

View File

@@ -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) {