mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 23:23:51 +00:00
otf: patch person and thirdparty from the store, emit parent method saveFormOnTheFly()
This commit is contained in:
@@ -92,6 +92,7 @@ import OnTheFly from 'ChillMainAssets/vuejs/_components/OnTheFly.vue';
|
||||
import PersonSuggestion from './AddPersons/PersonSuggestion';
|
||||
import { searchPersons, searchPersons_2 } from 'ChillPersonAssets/vuejs/_api/AddPersons';
|
||||
import { postPerson } from "ChillPersonAssets/vuejs/_api/OnTheFly";
|
||||
import { postThirdparty } from "ChillThirdPartyAssets/vuejs/_api/OnTheFly";
|
||||
|
||||
export default {
|
||||
name: 'AddPersons',
|
||||
@@ -254,25 +255,25 @@ export default {
|
||||
}
|
||||
},
|
||||
saveFormOnTheFly({ type, data }) {
|
||||
console.log('saveFormOnTheFly from addPersons', { type, data });
|
||||
|
||||
// create/edit person
|
||||
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) => {
|
||||
//this.person = person;
|
||||
console.log('onthefly create: post person', person);
|
||||
this.newPriorSuggestion(person);
|
||||
resolve();
|
||||
}));
|
||||
}
|
||||
|
||||
// create/edit thirdparty
|
||||
else if (type === 'thirdparty') {
|
||||
console.log('not yet implemented: type thirdparty with', type, data);
|
||||
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();
|
||||
}));
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
}
|
||||
|
@@ -75,7 +75,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getPerson, postPerson } from '../../_api/OnTheFly';
|
||||
import { getPerson } from '../../_api/OnTheFly';
|
||||
import PersonRenderBox from '../Entity/PersonRenderBox.vue';
|
||||
|
||||
export default {
|
||||
@@ -162,15 +162,6 @@ export default {
|
||||
console.log('get person', this.person);
|
||||
resolve();
|
||||
}));
|
||||
},
|
||||
patchData() {
|
||||
console.log('id', this.id, 'and body', this.person);
|
||||
patchPerson(this.id, this.person)
|
||||
.then(person => new Promise((resolve, reject) => {
|
||||
this.person = person;
|
||||
console.log('patch person', this.person);
|
||||
resolve();
|
||||
}))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user