Merge conflicts fixed

This commit is contained in:
2022-02-04 10:25:46 +01:00
403 changed files with 15524 additions and 2846 deletions

View File

@@ -1,12 +1,12 @@
<template>
<ul class="record_actions">
<ul class="record_actions">
<li class="add-persons">
<a class="btn" :class="getClassButton" :title="$t(buttonTitle)"
@click="openModal"><span v-if="displayTextButton">{{ $t(buttonTitle) }}</span></a>
<a class="btn" :class="getClassButton" :title="$t(buttonTitle)"
@click="openModal"><span v-if="displayTextButton">{{ $t(buttonTitle) }}</span></a>
</li>
</ul>
</ul>
<teleport to="body">
<teleport to="body">
<modal v-if="modal.showModal"
:modalDialogClass="modal.modalDialogClass"
@close="modal.showModal = false">
@@ -67,9 +67,10 @@
<div class="create-button">
<on-the-fly
v-if="query.length >= 3"
v-bind:buttonText="$t('onthefly.create.button', {q: query})"
:buttonText="$t('onthefly.create.button', {q: query})"
action="create"
@saveFormOnTheFly="saveFormOnTheFly">
@saveFormOnTheFly="saveFormOnTheFly"
:canCloseModal="canCloseOnTheFlyModal">
</on-the-fly>
</div>
@@ -92,8 +93,7 @@ import Modal from 'ChillMainAssets/vuejs/_components/Modal';
import OnTheFly from 'ChillMainAssets/vuejs/OnTheFly/components/OnTheFly.vue';
import PersonSuggestion from './AddPersons/PersonSuggestion';
import { searchEntities } from 'ChillPersonAssets/vuejs/_api/AddPersons';
import { postPerson } from "ChillPersonAssets/vuejs/_api/OnTheFly";
import { postThirdparty } from "ChillThirdPartyAssets/vuejs/_api/OnTheFly";
import { makeFetch } from 'ChillMainAssets/lib/api/apiMethods';
export default {
name: 'AddPersons',
@@ -121,7 +121,8 @@ export default {
suggested: [],
selected: [],
priorSuggestion: {}
}
},
canCloseOnTheFlyModal: false
}
},
computed: {
@@ -181,7 +182,7 @@ export default {
},
hasPriorSuggestion() {
return this.search.priorSuggestion.key ? true : false;
}
},
},
methods: {
openModal() {
@@ -195,18 +196,18 @@ export default {
setTimeout(function() {
if (query === "") {
this.loadSuggestions([]);
return;
this.loadSuggestions([]);
return;
}
if (query === this.search.query) {
if (this.currentSearchQueryController !== undefined) {
this.currentSearchQueryController.abort()
}
this.currentSearchQueryController = new AbortController();
searchEntities({ query, options: this.options }, this.currentSearchQueryController)
if (this.currentSearchQueryController !== undefined) {
this.currentSearchQueryController.abort()
}
this.currentSearchQueryController = new AbortController();
searchEntities({ query, options: this.options }, this.currentSearchQueryController)
.then(suggested => new Promise((resolve, reject) => {
this.loadSuggestions(suggested.results);
resolve();
this.loadSuggestions(suggested.results);
resolve();
}));
}
}.bind(this), query.length > 3 ? 300 : 700);
@@ -241,13 +242,12 @@ export default {
return item.result.type + item.result.id;
},
addPriorSuggestion() {
//console.log('addPriorSuggestion', this.hasPriorSuggestion);
// console.log('prior suggestion', this.priorSuggestion);
if (this.hasPriorSuggestion) {
console.log('addPriorSuggestion',);
// console.log('addPriorSuggestion',);
this.suggested.unshift(this.priorSuggestion);
this.selected.unshift(this.priorSuggestion);
console.log('reset priorSuggestion');
this.newPriorSuggestion(null);
}
},
@@ -261,6 +261,7 @@ export default {
}
this.search.priorSuggestion = suggestion;
// console.log('search priorSuggestion', this.search.priorSuggestion);
this.addPriorSuggestion(suggestion);
} else {
this.search.priorSuggestion = {};
}
@@ -268,23 +269,38 @@ export default {
saveFormOnTheFly({ type, data }) {
// console.log('saveFormOnTheFly from addPersons, type', type, ', data', data);
if (type === 'person') {
// console.log('type person with', data);
postPerson(data)
.then(person => new Promise((resolve, reject) => {
console.log('onthefly create: post person', person);
this.newPriorSuggestion(person);
resolve();
}));
makeFetch('POST', '/api/1.0/person/person.json', data)
.then(response => {
this.newPriorSuggestion(response);
this.canCloseOnTheFlyModal = true;
})
.catch((error) => {
if (error.name === 'ValidationException') {
for (let v of error.violations) {
this.$toast.open({message: v });
}
} else {
this.$toast.open({message: 'An error occurred'});
}
})
}
else if (type === 'thirdparty') {
// console.log('type thirdparty with', data);
postThirdparty(data)
.then(thirdparty => new Promise((resolve, reject) => {
// console.log('onthefly create: post thirdparty', thirdparty);
this.newPriorSuggestion(thirdparty);
resolve();
}));
makeFetch('POST', '/api/1.0/thirdparty/thirdparty.json', data)
.then(response => {
this.newPriorSuggestion(response);
this.canCloseOnTheFlyModal = true;
})
.catch((error) => {
if (error.name === 'ValidationException') {
for (let v of error.violations) {
this.$toast.open({message: v });
}
} else {
this.$toast.open({message: 'An error occurred'});
}
})
}
this.canCloseOnTheFlyModal = false;
}
},
}