mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 13:24:25 +00:00
bugfix emit saveFormOnTheFly and add newly created contact to suggestion list immediately
This commit is contained in:
parent
256c5688a0
commit
0f2cbbe553
@ -212,7 +212,7 @@ export default {
|
|||||||
type = 'thirdparty'
|
type = 'thirdparty'
|
||||||
data = this.$refs.castThirdparty.$data.thirdparty;
|
data = this.$refs.castThirdparty.$data.thirdparty;
|
||||||
// create the new contact here, bypassing saveFormOnTheFly() -> not working here?
|
// create the new contact here, bypassing saveFormOnTheFly() -> not working here?
|
||||||
const body = {
|
data = {
|
||||||
"type": "thirdparty",
|
"type": "thirdparty",
|
||||||
"kind": "child",
|
"kind": "child",
|
||||||
"name": data.text,
|
"name": data.text,
|
||||||
@ -225,12 +225,6 @@ export default {
|
|||||||
"email": data.email,
|
"email": data.email,
|
||||||
"address": null
|
"address": null
|
||||||
}
|
}
|
||||||
postThirdparty(body)
|
|
||||||
.then(thirdparty => new Promise((resolve, reject) => {
|
|
||||||
// this.$parent.newPriorSuggestion(thirdparty);
|
|
||||||
console.log('thirdparty created', thirdparty)
|
|
||||||
resolve();
|
|
||||||
}));
|
|
||||||
} else {
|
} else {
|
||||||
type = this.$refs.castNew.radioType;
|
type = this.$refs.castNew.radioType;
|
||||||
data = this.$refs.castNew.castDataByType();
|
data = this.$refs.castNew.castDataByType();
|
||||||
|
@ -60,6 +60,7 @@
|
|||||||
v-bind:item="item"
|
v-bind:item="item"
|
||||||
v-bind:search="search"
|
v-bind:search="search"
|
||||||
v-bind:type="checkUniq"
|
v-bind:type="checkUniq"
|
||||||
|
@saveFormOnTheFly="saveFormOnTheFly"
|
||||||
@updateSelected="updateSelected">
|
@updateSelected="updateSelected">
|
||||||
</person-suggestion>
|
</person-suggestion>
|
||||||
|
|
||||||
@ -259,15 +260,15 @@ export default {
|
|||||||
result: entity
|
result: entity
|
||||||
}
|
}
|
||||||
this.search.priorSuggestion = suggestion;
|
this.search.priorSuggestion = suggestion;
|
||||||
console.log('search priorSuggestion', this.search.priorSuggestion);
|
// console.log('search priorSuggestion', this.search.priorSuggestion);
|
||||||
} else {
|
} else {
|
||||||
this.search.priorSuggestion = {};
|
this.search.priorSuggestion = {};
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
saveFormOnTheFly({ type, data }) {
|
saveFormOnTheFly({ type, data }) {
|
||||||
console.log('saveFormOnTheFly from addPersons, type', type, ', data', data);
|
// console.log('saveFormOnTheFly from addPersons, type', type, ', data', data);
|
||||||
if (type === 'person') {
|
if (type === 'person') {
|
||||||
console.log('type person with', data);
|
// console.log('type person with', data);
|
||||||
postPerson(data)
|
postPerson(data)
|
||||||
.then(person => new Promise((resolve, reject) => {
|
.then(person => new Promise((resolve, reject) => {
|
||||||
console.log('onthefly create: post person', person);
|
console.log('onthefly create: post person', person);
|
||||||
@ -276,10 +277,10 @@ export default {
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
else if (type === 'thirdparty') {
|
else if (type === 'thirdparty') {
|
||||||
console.log('type thirdparty with', data);
|
// console.log('type thirdparty with', data);
|
||||||
postThirdparty(data)
|
postThirdparty(data)
|
||||||
.then(thirdparty => new Promise((resolve, reject) => {
|
.then(thirdparty => new Promise((resolve, reject) => {
|
||||||
console.log('onthefly create: post thirdparty', thirdparty);
|
// console.log('onthefly create: post thirdparty', thirdparty);
|
||||||
this.newPriorSuggestion(thirdparty);
|
this.newPriorSuggestion(thirdparty);
|
||||||
resolve();
|
resolve();
|
||||||
}));
|
}));
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
<suggestion-third-party
|
<suggestion-third-party
|
||||||
v-if="item.result.type === 'thirdparty'"
|
v-if="item.result.type === 'thirdparty'"
|
||||||
|
@saveFormOnTheFly="emitEvent"
|
||||||
v-bind:item="item">
|
v-bind:item="item">
|
||||||
</suggestion-third-party>
|
</suggestion-third-party>
|
||||||
|
|
||||||
@ -47,7 +48,7 @@ export default {
|
|||||||
'search',
|
'search',
|
||||||
'type'
|
'type'
|
||||||
],
|
],
|
||||||
emits: ['updateSelected'],
|
emits: ['updateSelected', 'saveFormOnTheFly'],
|
||||||
computed: {
|
computed: {
|
||||||
selected: {
|
selected: {
|
||||||
set(value) {
|
set(value) {
|
||||||
@ -65,6 +66,9 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
setValueByType(value, type) {
|
setValueByType(value, type) {
|
||||||
return (type === 'radio')? [value] : value;
|
return (type === 'radio')? [value] : value;
|
||||||
|
},
|
||||||
|
emitEvent({data, type}) {
|
||||||
|
this.$emit('saveFormOnTheFly', {type: type, data: data})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
</badge-entity>
|
</badge-entity>
|
||||||
<on-the-fly v-if="item.result.kind === 'company'"
|
<on-the-fly v-if="item.result.kind === 'company'"
|
||||||
v-bind:parent="item.result"
|
v-bind:parent="item.result"
|
||||||
|
@saveFormOnTheFly="emitEvent"
|
||||||
action="addContact"
|
action="addContact"
|
||||||
></on-the-fly>
|
></on-the-fly>
|
||||||
<on-the-fly
|
<on-the-fly
|
||||||
@ -58,6 +59,7 @@ export default {
|
|||||||
BadgeEntity
|
BadgeEntity
|
||||||
},
|
},
|
||||||
props: ['item'],
|
props: ['item'],
|
||||||
|
emits: ['saveFormOnTheFly'],
|
||||||
i18n,
|
i18n,
|
||||||
computed: {
|
computed: {
|
||||||
hasAddress() {
|
hasAddress() {
|
||||||
@ -81,6 +83,11 @@ export default {
|
|||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
emitEvent({data, type}) {
|
||||||
|
this.$emit('saveFormOnTheFly', {type: type, data: data})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user