2021-09-07 13:28:20 +02:00
|
|
|
import '../scss/app.scss';
|
2021-08-19 17:47:20 +02:00
|
|
|
import './_material';
|
2021-10-08 12:29:37 +02:00
|
|
|
import '@mdi/font/css/materialdesignicons.min.css';
|
2021-07-30 22:56:43 +02:00
|
|
|
|
2021-09-10 16:53:40 +02:00
|
|
|
import {InertiaProgress} from '@inertiajs/progress';
|
2021-09-07 13:28:20 +02:00
|
|
|
import {createInertiaApp} from '@maicol07/inertia-mithril';
|
|
|
|
import {waitUntil} from 'async-wait-until';
|
2021-10-08 16:38:46 +02:00
|
|
|
import $ from 'cash-dom';
|
2021-09-07 13:28:20 +02:00
|
|
|
import m from 'mithril';
|
|
|
|
|
|
|
|
// Fix Mithril JSX durante la compilazione
|
|
|
|
m.Fragment = '[';
|
|
|
|
|
|
|
|
// Variabili globali
|
2021-10-08 16:38:46 +02:00
|
|
|
window.$ = $;
|
2021-09-07 13:28:20 +02:00
|
|
|
window.m = m;
|
|
|
|
|
2021-09-10 16:53:40 +02:00
|
|
|
InertiaProgress.init();
|
|
|
|
|
2021-08-02 13:13:02 +02:00
|
|
|
// noinspection JSIgnoredPromiseFromCall
|
|
|
|
createInertiaApp({
|
2021-09-07 13:28:20 +02:00
|
|
|
title: title => `${title} - OpenSTAManager`,
|
|
|
|
resolve: async (name) => {
|
|
|
|
const split = name.split('::');
|
|
|
|
|
|
|
|
if (split.length === 1) {
|
|
|
|
return (await import(`./Views/${name}.jsx`)).default;
|
|
|
|
}
|
|
|
|
|
|
|
|
const [, page] = split;
|
|
|
|
// noinspection JSUnresolvedVariable
|
|
|
|
await waitUntil(() => typeof window.extmodule !== 'undefined');
|
|
|
|
// noinspection JSUnresolvedVariable
|
|
|
|
return window.extmodule[page];
|
|
|
|
},
|
2021-10-08 12:20:07 +02:00
|
|
|
setup({
|
|
|
|
el,
|
|
|
|
app
|
|
|
|
}) {
|
2021-08-02 13:13:02 +02:00
|
|
|
m.mount(el, app);
|
2021-09-07 13:28:20 +02:00
|
|
|
}
|
2021-08-02 13:13:02 +02:00
|
|
|
});
|
2021-10-08 12:20:07 +02:00
|
|
|
|
|
|
|
$.fn.isValid = function () {
|
|
|
|
if (this.prop('tagName')
|
|
|
|
.toLowerCase() === 'form') {
|
|
|
|
let isValid: boolean = true;
|
|
|
|
|
|
|
|
this.find('mwc-textfield, mwc-textarea')
|
|
|
|
.each((index: number, field: HTMLInputElement) => {
|
|
|
|
if (!field.checkValidity()) {
|
|
|
|
isValid = false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
});
|
|
|
|
|
|
|
|
return isValid;
|
|
|
|
}
|
|
|
|
|
|
|
|
return this[0].checkValidity();
|
|
|
|
};
|