Files
e-cosplay/assets/admin.js

86 lines
3.5 KiB
JavaScript
Raw Normal View History

import './admin.scss'
import * as Turbo from "@hotwired/turbo"
import {AutoSubmit} from './class/AutoSubmit'
2025-07-21 15:09:18 +02:00
import {ServerCard} from './class/ServerCard'
import {AutoCustomer} from './class/AutoCustomer'
import {RepeatLine} from './class/RepeatLine'
import {RegisterPayment} from './class/RegisterPayment'
import {OrderCtrl} from './class/OrderCtrl'
import {LockdownWall} from './class/LockdownWall'
import {SecurityWall} from './class/SecurityWall'
import {IpWall} from './class/IpWall'
import {ConfirmModal} from './class/ConfirmModal'
import {SearchCustomer} from './class/SearchCustomer'
import preactCustomElement from './functions/preact'
import * as Sentry from "@sentry/browser";
function script() {
customElements.define('confirm-modal',ConfirmModal,{extends:'a'})
customElements.define('auto-submit',AutoSubmit,{extends:'form'})
2025-07-21 15:09:18 +02:00
customElements.define('server-card',ServerCard,{extends:'div'})
customElements.define('auto-customer',AutoCustomer,{extends:'button'})
customElements.define('repeat-line',RepeatLine,{extends:'div'})
customElements.define('lockdown-wall',LockdownWall,{})
customElements.define('security-wall',SecurityWall,{})
customElements.define('ip-wall',IpWall,{})
customElements.define('order-ctrl',OrderCtrl,{extends:'div'})
customElements.define("register-payment",RegisterPayment,{extends:'button'})
customElements.define("search-customer",SearchCustomer,{extends:'select'})
}
function full() {
const sidebar = document.getElementById('sidebar');
const sidebarToggle = document.getElementById('sidebar-toggle');
sidebarToggle.addEventListener('click', function () {
sidebar.classList.toggle('-translate-x-full');
});
const submenuToggles = document.querySelectorAll('[data-submenu-toggle]');
submenuToggles.forEach(button => {
button.addEventListener('click', function () {
const targetId = this.dataset.submenuToggle;
const submenu = document.getElementById(`submenu-${targetId}`);
const arrowIcon = this.querySelector('.arrow-icon');
if (submenu && arrowIcon) {
// Toggle the 'active' class on the submenu
submenu.classList.toggle('active');
// Toggle the 'rotate' class on the arrow icon
arrowIcon.classList.toggle('rotate');
}
});
});
let metaSentry = document.querySelector('meta[name="sentry"]');
if(metaSentry != undefined) {
Sentry.init({
dsn: "https://f134747cc727471fefb197ab5fd4b1b0@o4510197735948288.ingest.de.sentry.io/4510197772320848",
// Setting this option to true will send default PII data to Sentry.
// For example, automatic IP address collection on events
sendDefaultPii: true,
tunnel: "/tunnel",
integrations: [
Sentry.browserTracingIntegration(),
Sentry.replayIntegration()
],
// Tracing
tracesSampleRate: 1.0, // Capture 100% of the transactions
// Session Replay
replaysSessionSampleRate: 0.1, // This sets the sample rate at 10%. You may want to change it to 100% while in development and then sample at a lower rate in production.
replaysOnErrorSampleRate: 1.0 // If you're not already sampling the entire session, change the sample rate to 100% when sampling sessions where errors occur.
});
}
}
document.addEventListener('DOMContentLoaded', ()=>{
script();
});
document.addEventListener("turbo:load", ()=> {
full()
});