Apply prettier rules

This commit is contained in:
2024-11-14 18:47:38 +01:00
parent 610227815a
commit aa0785fc71
291 changed files with 23646 additions and 22071 deletions

View File

@@ -1,16 +1,14 @@
import {download_report} from "../../lib/download-report/download-report";
import { download_report } from "../../lib/download-report/download-report";
window.addEventListener("DOMContentLoaded", function(e) {
window.addEventListener("DOMContentLoaded", function (e) {
const export_generate_url = window.export_generate_url;
if (typeof export_generate_url === 'undefined') {
console.error('Alias not found!');
throw new Error('Alias not found!');
if (typeof export_generate_url === "undefined") {
console.error("Alias not found!");
throw new Error("Alias not found!");
}
const query = window.location.search,
container = document.querySelector("#download_container")
;
container = document.querySelector("#download_container");
download_report(export_generate_url + query.toString(), container);
});

View File

@@ -1,5 +1,5 @@
// old method to show/hide filters when checking checkbox
import { chill } from 'ChillMainAssets/chill/js/chill';
import { chill } from "ChillMainAssets/chill/js/chill";
window.addEventListener("DOMContentLoaded", chill.listenerDisplayCheckbox);
// TODO should be replaced by more recent showHide library

View File

@@ -1,16 +1,15 @@
import { createApp } from 'vue';
import { _createI18n } from 'ChillMainAssets/vuejs/_js/i18n';
import { appMessages } from 'ChillMainAssets/vuejs/HomepageWidget/js/i18n';
import { store } from 'ChillMainAssets/vuejs/HomepageWidget/js/store';
import App from 'ChillMainAssets/vuejs/HomepageWidget/App';
import { createApp } from "vue";
import { _createI18n } from "ChillMainAssets/vuejs/_js/i18n";
import { appMessages } from "ChillMainAssets/vuejs/HomepageWidget/js/i18n";
import { store } from "ChillMainAssets/vuejs/HomepageWidget/js/store";
import App from "ChillMainAssets/vuejs/HomepageWidget/App";
const i18n = _createI18n(appMessages);
const app = createApp({
template: `<app></app>`,
template: `<app></app>`,
})
.use(store)
.use(i18n)
.component('app', App)
.mount('#homepage_widget')
;
.use(store)
.use(i18n)
.component("app", App)
.mount("#homepage_widget");

View File

@@ -1,66 +1,66 @@
const contactDataBlock = document.querySelector('div.location-form-contact');
const addressBlock = document.querySelector('div.location-form-address');
const locationType = document.getElementById('chill_mainbundle_location_locationType');
const getSelectedAttributes =
(select, attr) => select.selectedOptions[0].getAttribute(attr)
const contactDataBlock = document.querySelector("div.location-form-contact");
const addressBlock = document.querySelector("div.location-form-address");
const locationType = document.getElementById(
"chill_mainbundle_location_locationType",
);
const getSelectedAttributes = (select, attr) =>
select.selectedOptions[0].getAttribute(attr);
const removeRequired = (formBlock) => {
formBlock.querySelectorAll('label').forEach(
l => l.classList.remove('required')
);
formBlock.querySelectorAll('input').forEach(
i => i.removeAttribute('required')
);
}
const addRequired = (formBlock) => {
formBlock.querySelectorAll('label').forEach(
l => l.classList.add('required')
);
formBlock.querySelectorAll('input').forEach(
i => i.setAttribute('required', '')
);
}
const onLocationTypeChange = () => {
console.log(getSelectedAttributes(locationType, 'data-address'))
console.log(getSelectedAttributes(locationType, 'data-contact'))
switch (getSelectedAttributes(locationType, 'data-address')) {
case 'optional':
default:
removeRequired(addressBlock);
addressBlock.classList.remove('d-none');
break;
case 'required':
addRequired(addressBlock);
addressBlock.classList.remove('d-none');
break;
case 'never':
removeRequired(addressBlock);
addressBlock.classList.add('d-none');
break;
}
switch (getSelectedAttributes(locationType, 'data-contact')) {
case 'optional':
default:
removeRequired(contactDataBlock);
contactDataBlock.classList.remove('d-none');
break;
case 'required':
addRequired(contactDataBlock);
contactDataBlock.classList.remove('d-none');
break;
case 'never':
removeRequired(contactDataBlock);
contactDataBlock.classList.add('d-none');
break;
}
formBlock
.querySelectorAll("label")
.forEach((l) => l.classList.remove("required"));
formBlock
.querySelectorAll("input")
.forEach((i) => i.removeAttribute("required"));
};
document.addEventListener('DOMContentLoaded', _e => {
onLocationTypeChange();
locationType.addEventListener('change', onLocationTypeChange);
const addRequired = (formBlock) => {
formBlock
.querySelectorAll("label")
.forEach((l) => l.classList.add("required"));
formBlock
.querySelectorAll("input")
.forEach((i) => i.setAttribute("required", ""));
};
const onLocationTypeChange = () => {
console.log(getSelectedAttributes(locationType, "data-address"));
console.log(getSelectedAttributes(locationType, "data-contact"));
switch (getSelectedAttributes(locationType, "data-address")) {
case "optional":
default:
removeRequired(addressBlock);
addressBlock.classList.remove("d-none");
break;
case "required":
addRequired(addressBlock);
addressBlock.classList.remove("d-none");
break;
case "never":
removeRequired(addressBlock);
addressBlock.classList.add("d-none");
break;
}
switch (getSelectedAttributes(locationType, "data-contact")) {
case "optional":
default:
removeRequired(contactDataBlock);
contactDataBlock.classList.remove("d-none");
break;
case "required":
addRequired(contactDataBlock);
contactDataBlock.classList.remove("d-none");
break;
case "never":
removeRequired(contactDataBlock);
contactDataBlock.classList.add("d-none");
break;
}
};
document.addEventListener("DOMContentLoaded", (_e) => {
onLocationTypeChange();
locationType.addEventListener("change", onLocationTypeChange);
});

View File

@@ -1,3 +1 @@
require('./login.scss');
require("./login.scss");

View File

@@ -1,70 +1,62 @@
import {ShowHide} from 'ChillMainAssets/lib/show_hide/show_hide.js';
window.addEventListener('DOMContentLoaded', function() {
let
divTransitions = document.querySelector('#transitions'),
futureDestUsersContainer = document.querySelector('#futureDests')
;
if (null !== divTransitions) {
new ShowHide({
load_event: null,
froms: [divTransitions],
container: [futureDestUsersContainer],
test: function(divs, arg2, arg3) {
for (let div of divs) {
for (let input of div.querySelectorAll('input')) {
if (input.checked) {
if (input.dataset.toFinal === "1") {
return false;
} else {
return true;
}
}
}
}
import { ShowHide } from "ChillMainAssets/lib/show_hide/show_hide.js";
window.addEventListener("DOMContentLoaded", function () {
let divTransitions = document.querySelector("#transitions"),
futureDestUsersContainer = document.querySelector("#futureDests");
if (null !== divTransitions) {
new ShowHide({
load_event: null,
froms: [divTransitions],
container: [futureDestUsersContainer],
test: function (divs, arg2, arg3) {
for (let div of divs) {
for (let input of div.querySelectorAll("input")) {
if (input.checked) {
if (input.dataset.toFinal === "1") {
return false;
} else {
return true;
},
});
}
}
}
}
}
let
transitionFilterContainer = document.querySelector('#transitionFilter'),
transitions = document.querySelector('#transitions')
;
return true;
},
});
}
if (null !== transitionFilterContainer) {
transitions.querySelectorAll('.form-check').forEach(function(row) {
const isForward = row.querySelector('input').dataset.isForward;
new ShowHide({
load_event: null,
froms: [transitionFilterContainer],
container: row,
test: function (containers) {
for (let container of containers) {
for (let input of container.querySelectorAll('input')) {
if (input.checked) {
return isForward === input.value;
}
}
}
},
toggle_callback: function (c, dir) {
for (let div of c) {
let input = div.querySelector('input');
if ('hide' === dir) {
input.checked = false;
input.disabled = true;
} else {
input.disabled = false;
}
}
},
});
});
}
let transitionFilterContainer = document.querySelector("#transitionFilter"),
transitions = document.querySelector("#transitions");
if (null !== transitionFilterContainer) {
transitions.querySelectorAll(".form-check").forEach(function (row) {
const isForward = row.querySelector("input").dataset.isForward;
new ShowHide({
load_event: null,
froms: [transitionFilterContainer],
container: row,
test: function (containers) {
for (let container of containers) {
for (let input of container.querySelectorAll("input")) {
if (input.checked) {
return isForward === input.value;
}
}
}
},
toggle_callback: function (c, dir) {
for (let div of c) {
let input = div.querySelector("input");
if ("hide" === dir) {
input.checked = false;
input.disabled = true;
} else {
input.disabled = false;
}
}
},
});
});
}
});