mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
bugfix onthefly thirdparty edit form
phonenumber was interchanged with telephone. Editing phonenumber was therefore not possible
This commit is contained in:
parent
265c8b776b
commit
b65dacca72
@ -21,42 +21,42 @@
|
||||
</div>
|
||||
<div v-else-if="action === 'edit' || action === 'create'">
|
||||
|
||||
<div class="form-floating mb-3" v-if="thirdparty.kind !== 'child'">
|
||||
<div class="form-check">
|
||||
<input class="form-check-input mt-0" type="radio" v-model="kind" value="company" id="tpartyKindInstitution">
|
||||
<label for="tpartyKindInstitution" class="required">
|
||||
<badge-entity
|
||||
:entity="{ type: 'thirdparty', kind: 'company' }"
|
||||
:options="{ displayLong: true }">
|
||||
</badge-entity>
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input mt-0" type="radio" v-model="kind" value="contact" id="tpartyKindContact">
|
||||
<label for="tpartyKindContact" class="required">
|
||||
<badge-entity
|
||||
:entity="{ type: 'thirdparty', kind: 'contact' }"
|
||||
:options="{ displayLong: true }">
|
||||
</badge-entity>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else>
|
||||
<p>Contact de :</p>
|
||||
<third-party-render-box :thirdparty="thirdparty.parent"
|
||||
:options="{
|
||||
addInfo: true,
|
||||
addEntity: false,
|
||||
addAltNames: true,
|
||||
addId: false,
|
||||
addLink: false,
|
||||
addAge: false,
|
||||
hLevel: 4,
|
||||
addCenter: false,
|
||||
addNoData: true,
|
||||
isMultiline: false
|
||||
}"></third-party-render-box>
|
||||
</div>
|
||||
<div class="form-floating mb-3" v-if="thirdparty.kind !== 'child'">
|
||||
<div class="form-check">
|
||||
<input class="form-check-input mt-0" type="radio" v-model="kind" value="company" id="tpartyKindInstitution">
|
||||
<label for="tpartyKindInstitution" class="required">
|
||||
<badge-entity
|
||||
:entity="{ type: 'thirdparty', kind: 'company' }"
|
||||
:options="{ displayLong: true }">
|
||||
</badge-entity>
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input mt-0" type="radio" v-model="kind" value="contact" id="tpartyKindContact">
|
||||
<label for="tpartyKindContact" class="required">
|
||||
<badge-entity
|
||||
:entity="{ type: 'thirdparty', kind: 'contact' }"
|
||||
:options="{ displayLong: true }">
|
||||
</badge-entity>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else>
|
||||
<p>Contact de :</p>
|
||||
<third-party-render-box :thirdparty="thirdparty.parent"
|
||||
:options="{
|
||||
addInfo: true,
|
||||
addEntity: false,
|
||||
addAltNames: true,
|
||||
addId: false,
|
||||
addLink: false,
|
||||
addAge: false,
|
||||
hLevel: 4,
|
||||
addCenter: false,
|
||||
addNoData: true,
|
||||
isMultiline: false
|
||||
}"></third-party-render-box>
|
||||
</div>
|
||||
<div class="form-floating mb-3">
|
||||
<input class="form-control form-control-lg" id="name" v-model="thirdparty.text" v-bind:placeholder="$t('thirdparty.name')" />
|
||||
<label for="name">{{ $t('thirdparty.name') }}</label>
|
||||
@ -69,16 +69,16 @@
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<template
|
||||
v-if="thirdparty.kind !== 'child'">
|
||||
<add-address
|
||||
key="thirdparty"
|
||||
:context="context"
|
||||
:options="addAddress.options"
|
||||
:address-changed-callback="submitAddress"
|
||||
ref="addAddress">
|
||||
</add-address>
|
||||
</template>
|
||||
<template
|
||||
v-if="thirdparty.kind !== 'child'">
|
||||
<add-address
|
||||
key="thirdparty"
|
||||
:context="context"
|
||||
:options="addAddress.options"
|
||||
:address-changed-callback="submitAddress"
|
||||
ref="addAddress">
|
||||
</add-address>
|
||||
</template>
|
||||
|
||||
<div class="input-group mb-3">
|
||||
<span class="input-group-text" id="email"><i class="fa fa-fw fa-envelope"></i></span>
|
||||
@ -92,7 +92,7 @@
|
||||
<div class="input-group mb-3">
|
||||
<span class="input-group-text" id="phonenumber"><i class="fa fa-fw fa-phone"></i></span>
|
||||
<input class="form-control form-control-lg"
|
||||
v-model="thirdparty.telephone"
|
||||
v-model="thirdparty.phonenumber"
|
||||
v-bind:placeholder="$t('thirdparty.phonenumber')"
|
||||
v-bind:aria-label="$t('thirdparty.phonenumber')"
|
||||
aria-describedby="phonenumber" />
|
||||
@ -134,27 +134,27 @@ export default {
|
||||
size: 'btn-sm'
|
||||
},
|
||||
title: {
|
||||
create: 'add_an_address_title',
|
||||
edit: 'edit_address'
|
||||
create: 'add_an_address_title',
|
||||
edit: 'edit_address'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
kind: {
|
||||
get() {
|
||||
// note: there are also default to 'institution' set in the "mounted" method
|
||||
if (this.$data.thirdparty.kind !== undefined) {
|
||||
return this.$data.thirdparty.kind;
|
||||
} else {
|
||||
return 'company';
|
||||
}
|
||||
},
|
||||
set(v) {
|
||||
this.$data.thirdparty.kind = v;
|
||||
}
|
||||
},
|
||||
kind: {
|
||||
get() {
|
||||
// note: there are also default to 'institution' set in the "mounted" method
|
||||
if (this.$data.thirdparty.kind !== undefined) {
|
||||
return this.$data.thirdparty.kind;
|
||||
} else {
|
||||
return 'company';
|
||||
}
|
||||
},
|
||||
set(v) {
|
||||
this.$data.thirdparty.kind = v;
|
||||
}
|
||||
},
|
||||
context() {
|
||||
let context = {
|
||||
target: {
|
||||
@ -165,10 +165,10 @@ export default {
|
||||
addressId: null
|
||||
};
|
||||
if ( !(this.thirdparty.address === undefined || this.thirdparty.address === null)
|
||||
&& this.thirdparty.address.address_id !== null
|
||||
&& this.thirdparty.address.address_id !== null
|
||||
) { // to complete
|
||||
context.addressId = this.thirdparty.address.address_id;
|
||||
context.edit = true;
|
||||
context.addressId = this.thirdparty.address.address_id;
|
||||
context.edit = true;
|
||||
}
|
||||
console.log('context', context);
|
||||
//this.context = context; <--
|
||||
@ -182,10 +182,10 @@ export default {
|
||||
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
|
||||
this.$refs.addAddress.getInitialAddress(thirdparty.address.address_id);
|
||||
}
|
||||
if (thirdparty.address !== null) {
|
||||
// bof! we force getInitialAddress because addressId not available when mounted
|
||||
this.$refs.addAddress.getInitialAddress(thirdparty.address.address_id);
|
||||
}
|
||||
}
|
||||
resolve();
|
||||
}));
|
||||
@ -193,11 +193,11 @@ export default {
|
||||
submitAddress(payload) {
|
||||
console.log('submitAddress', payload);
|
||||
if (typeof payload.addressId !== 'undefined') { // <--
|
||||
this.context.edit = true;
|
||||
this.context.addressId = payload.addressId; // bof! use legacy and not legacy in payload
|
||||
this.thirdparty.address = payload.address; // <--
|
||||
console.log('switch address to edit mode', this.context);
|
||||
}
|
||||
this.context.edit = true;
|
||||
this.context.addressId = payload.addressId; // bof! use legacy and not legacy in payload
|
||||
this.thirdparty.address = payload.address; // <--
|
||||
console.log('switch address to edit mode', this.context);
|
||||
}
|
||||
},
|
||||
addQuery(query) {
|
||||
this.thirdparty.text = query;
|
||||
@ -208,7 +208,7 @@ export default {
|
||||
if (this.action !== 'create') {
|
||||
this.loadData();
|
||||
} else {
|
||||
this.thirdparty.kind = 'company';
|
||||
this.thirdparty.kind = 'company';
|
||||
}
|
||||
},
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user