mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
bind options and key inside AddPersons component (wip)
This commit is contained in:
parent
b24eb93c57
commit
ac67f56b09
@ -25,6 +25,8 @@
|
||||
|
||||
<add-persons
|
||||
buttonTitle="persons_associated.add_persons"
|
||||
v-bind:key="addNewPersons.key"
|
||||
v-bind:options="addNewPersons.options"
|
||||
@addNewPersons="addNewPersons">
|
||||
</add-persons>
|
||||
|
||||
@ -42,6 +44,18 @@ export default {
|
||||
PersonItem,
|
||||
AddPersons
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
addNewPersons: {
|
||||
key: 'persons_associated',
|
||||
options: {
|
||||
type: ['person'],
|
||||
priority: null,
|
||||
uniq: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: mapState({
|
||||
participations: state => state.accompanyingCourse.participations,
|
||||
counter: state => state.accompanyingCourse.participations.length
|
||||
|
@ -40,6 +40,8 @@
|
||||
|
||||
<add-persons
|
||||
buttonTitle="requestor.add_requestor"
|
||||
v-bind:key="addNewPersons.key"
|
||||
v-bind:options="addNewPersons.options"
|
||||
@addNewPersons="addNewPersons">
|
||||
</add-persons>
|
||||
|
||||
@ -56,6 +58,14 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
addNewPersons: {
|
||||
key: 'requestor',
|
||||
options: {
|
||||
type: ['person', 'thirdparty'],
|
||||
priority: null,
|
||||
uniq: true,
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
@ -1,5 +1,4 @@
|
||||
import { searchPersons } from 'ChillPersonAssets/vuejs/_api/AddPersons'
|
||||
import { postParticipation } from '../../api';
|
||||
import { searchPersons } from 'ChillPersonAssets/vuejs/_api/AddPersons';
|
||||
|
||||
|
||||
// initial state
|
||||
@ -46,10 +45,10 @@ const mutations = {
|
||||
// actions
|
||||
const actions = {
|
||||
setQuery({ commit }, payload) {
|
||||
//console.log('## action: setquery: payload', payload);
|
||||
console.log('## action: setquery: payload', payload);
|
||||
commit('setQuery', payload.query);
|
||||
if (payload.query.length >= 3) {
|
||||
searchPersons(payload.query)
|
||||
searchPersons(payload)
|
||||
.then(suggested => new Promise((resolve, reject) => {
|
||||
commit('loadSuggestions', suggested.results);
|
||||
resolve();
|
||||
|
@ -8,7 +8,8 @@ const
|
||||
*
|
||||
* @query string - the query to search for
|
||||
*/
|
||||
let searchPersons = (query) => {
|
||||
let searchPersons = ({ query, options }) => {
|
||||
console.log('options 2', options);
|
||||
let url = `/${locale}/search.${format}?name=person_regular&q=${query}`;
|
||||
return fetch(url)
|
||||
.then(response => {
|
||||
|
@ -72,7 +72,7 @@ import PersonSuggestion from 'ChillPersonAssets/vuejs/_components/PersonSuggesti
|
||||
|
||||
export default {
|
||||
name: 'AddPersons',
|
||||
props: ['buttonTitle'],
|
||||
props: ['buttonTitle', 'options'],
|
||||
components: {
|
||||
Modal,
|
||||
PersonSuggestion,
|
||||
@ -83,7 +83,6 @@ export default {
|
||||
showModal: false,
|
||||
modalDialogClass: "modal-dialog-scrollable modal-xl"
|
||||
},
|
||||
//button: this.buttonTitle
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@ -91,8 +90,8 @@ export default {
|
||||
addPersons: state => state.addPersons
|
||||
}),
|
||||
query: {
|
||||
set(query) {
|
||||
this.$store.dispatch('setQuery', { query });
|
||||
set(query, options) {
|
||||
this.$store.dispatch('setQuery', { query, options });
|
||||
},
|
||||
get() {
|
||||
return this.addPersons.query;
|
||||
@ -112,10 +111,14 @@ export default {
|
||||
},
|
||||
selectedAndSuggested() {
|
||||
return this.$store.getters.selectedAndSuggested;
|
||||
},
|
||||
options() {
|
||||
return this.options;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
openModal() {
|
||||
console.log('options 1', this.options);
|
||||
this.modal.showModal = true;
|
||||
this.$nextTick(function() {
|
||||
this.$refs.search.focus();
|
||||
|
Loading…
x
Reference in New Issue
Block a user