mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 21:34:25 +00:00
otf: post/patch thirdparty ok, with addAddress creation/edition
This commit is contained in:
parent
a316cb9568
commit
4c9d352c46
@ -325,9 +325,9 @@ export default {
|
|||||||
return (this.validFrom || this.validTo) ? true : false;
|
return (this.validFrom || this.validTo) ? true : false;
|
||||||
},
|
},
|
||||||
hasSuggestions() {
|
hasSuggestions() {
|
||||||
console.log(this.context.suggestions);
|
|
||||||
if (typeof(this.context.suggestions) !== 'undefined') {
|
if (typeof(this.context.suggestions) !== 'undefined') {
|
||||||
return this.context.suggestions.length > 0;
|
console.log('hasSuggestions', this.context.suggestions);
|
||||||
|
return this.context.suggestions.length > 0;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
@ -353,9 +353,9 @@ export default {
|
|||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
|
||||||
console.log('validFrom', this.validFrom);
|
//console.log('validFrom', this.validFrom);
|
||||||
console.log('validTo', this.validTo);
|
//console.log('validTo', this.validTo);
|
||||||
console.log('useDatePane', this.useDatePane);
|
//console.log('useDatePane', this.useDatePane);
|
||||||
|
|
||||||
console.log('Mounted now !');
|
console.log('Mounted now !');
|
||||||
if (this.context.edit) {
|
if (this.context.edit) {
|
||||||
|
@ -160,10 +160,9 @@ export default {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (typeof this.type === 'undefined') {
|
if (typeof this.type === 'undefined') { // action=create
|
||||||
type = this.$refs.castNew.radioType;
|
type = this.$refs.castNew.radioType;
|
||||||
data = this.$refs.castNew.castDataByType();
|
data = this.$refs.castNew.castDataByType();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
throw 'error with object type';
|
throw 'error with object type';
|
||||||
}
|
}
|
||||||
|
@ -72,7 +72,10 @@ export default {
|
|||||||
case 'person':
|
case 'person':
|
||||||
return this.$refs.castPerson.$data.person;
|
return this.$refs.castPerson.$data.person;
|
||||||
case 'thirdparty':
|
case 'thirdparty':
|
||||||
return this.$refs.castThirdparty.$data.thirdparty;
|
let data = this.$refs.castThirdparty.$data.thirdparty;
|
||||||
|
data.name = data.text;
|
||||||
|
data.address = { id: data.address.address_id }
|
||||||
|
return data;
|
||||||
default:
|
default:
|
||||||
throw Error('Invalid type of entity')
|
throw Error('Invalid type of entity')
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,14 @@
|
|||||||
<label for="name">{{ $t('thirdparty.name') }}</label>
|
<label for="name">{{ $t('thirdparty.name') }}</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<add-address
|
||||||
|
key="thirdparty"
|
||||||
|
:context="context"
|
||||||
|
:options="addAddress.options"
|
||||||
|
:address-changed-callback="submitAddress"
|
||||||
|
ref="addAddress">
|
||||||
|
</add-address>
|
||||||
|
|
||||||
<div class="input-group mb-3">
|
<div class="input-group mb-3">
|
||||||
<span class="input-group-text" id="email"><i class="fa fa-fw fa-envelope"></i></span>
|
<span class="input-group-text" id="email"><i class="fa fa-fw fa-envelope"></i></span>
|
||||||
<input class="form-control form-control-lg"
|
<input class="form-control form-control-lg"
|
||||||
@ -43,12 +51,6 @@
|
|||||||
aria-describedby="phonenumber" />
|
aria-describedby="phonenumber" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<add-address
|
|
||||||
:context="this.context"
|
|
||||||
:options="this.addAddress.options"
|
|
||||||
:address-changed-callback="submitAddress">
|
|
||||||
</add-address>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -66,6 +68,7 @@ export default {
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
//context: {},
|
||||||
thirdparty: {
|
thirdparty: {
|
||||||
type: 'thirdparty'
|
type: 'thirdparty'
|
||||||
},
|
},
|
||||||
@ -73,17 +76,13 @@ export default {
|
|||||||
options: {
|
options: {
|
||||||
openPanesInModal: true,
|
openPanesInModal: true,
|
||||||
onlyButton: false,
|
onlyButton: false,
|
||||||
/*
|
|
||||||
button: {
|
button: {
|
||||||
text: {
|
size: 'btn-sm'
|
||||||
create: 'courselocation.add_temporary_address',
|
|
||||||
edit: 'courselocation.edit_temporary_address'
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
title: {
|
title: {
|
||||||
create: 'courselocation.add_temporary_address',
|
create: 'add_an_address_title',
|
||||||
edit: 'courselocation.edit_temporary_address'
|
edit: 'edit_address'
|
||||||
} */
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -98,7 +97,14 @@ export default {
|
|||||||
edit: false,
|
edit: false,
|
||||||
addressId: null
|
addressId: null
|
||||||
};
|
};
|
||||||
|
if ( typeof this.thirdparty.address !== 'undefined'
|
||||||
|
&& this.thirdparty.address.address_id !== null
|
||||||
|
) { // to complete
|
||||||
|
context.addressId = this.thirdparty.address.address_id;
|
||||||
|
context.edit = true;
|
||||||
|
}
|
||||||
console.log('context', context);
|
console.log('context', context);
|
||||||
|
//this.context = context;
|
||||||
return context;
|
return context;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -107,11 +113,20 @@ export default {
|
|||||||
getThirdparty(this.id).then(thirdparty => new Promise((resolve, reject) => {
|
getThirdparty(this.id).then(thirdparty => new Promise((resolve, reject) => {
|
||||||
this.thirdparty = thirdparty;
|
this.thirdparty = thirdparty;
|
||||||
console.log('get thirdparty', thirdparty);
|
console.log('get thirdparty', thirdparty);
|
||||||
|
if (this.action !== 'show') {
|
||||||
|
this.$refs.addAddress.getInitialAddress(thirdparty.address.address_id);
|
||||||
|
}
|
||||||
resolve();
|
resolve();
|
||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
submitAddress(payload) {
|
submitAddress(payload) {
|
||||||
console.log('submitAddress', payload);
|
console.log('submitAddress', payload);
|
||||||
|
if (typeof payload.addressId !== 'undefined') {
|
||||||
|
this.context.edit = true;
|
||||||
|
this.context.addressId = payload.addressId;
|
||||||
|
console.log('switch address to edit mode', this.context);
|
||||||
|
this.thirdparty.address = payload.address;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user