work on create calendar

This commit is contained in:
2022-05-13 13:49:24 +02:00
parent 7859439f0b
commit 4be3efc619
10 changed files with 128 additions and 44 deletions

View File

@@ -6,6 +6,7 @@ import { appMessages } from 'ChillMainAssets/vuejs/PickEntity/i18n';
const i18n = _createI18n(appMessages);
let appsOnPage = new Map();
let appsPerInput = new Map();
function loadDynamicPicker(element) {
@@ -23,6 +24,8 @@ function loadDynamicPicker(element) {
null : [ JSON.parse(input.value) ]
)
;
console.log('picked at startup', picked);
console.log('input', input);
if (!isMultiple) {
if (input.value === '[]'){
@@ -78,13 +81,14 @@ function loadDynamicPicker(element) {
.mount(el);
appsOnPage.set(uniqId, app);
appsPerInput.set(input.name, app);
});
}
document.addEventListener('show-hide-show', function(e) {
loadDynamicPicker(e.detail.container)
})
});
document.addEventListener('show-hide-hide', function(e) {
console.log('hiding event caught')
@@ -95,7 +99,23 @@ document.addEventListener('show-hide-hide', function(e) {
appsOnPage.delete(uniqId);
}
})
})
});
document.addEventListener('pick-entity-type', function (e) {
console.log('pick entity event', e);
if (!appsPerInput.has(e.detail.name)) {
console.error('no app with this name');
return;
}
const app = appsPerInput.get(e.detail.name);
if (e.detail.action === 'add') {
app.addNewEntity(e.detail.entity);
} else if (e.detail.action === 'remove') {
app.removeEntity(e.detail.entity);
} else {
console.error('action not supported: '+e.detail.action);
}
});
document.addEventListener('DOMContentLoaded', function(e) {
loadDynamicPicker(document)