2025-07-21 09:02:13 +02:00
import './admin.scss'
import * as Turbo from "@hotwired/turbo"
2025-07-21 09:47:40 +02:00
import { AutoSubmit } from './class/AutoSubmit'
2025-07-21 15:09:18 +02:00
import { ServerCard } from './class/ServerCard'
2025-07-23 11:50:33 +02:00
import { AutoCustomer } from './class/AutoCustomer'
2025-07-24 09:17:20 +02:00
import { RepeatLine } from './class/RepeatLine'
2025-09-24 14:23:23 +02:00
import { RegisterPayment } from './class/RegisterPayment'
2025-07-24 10:08:51 +02:00
import { OrderCtrl } from './class/OrderCtrl'
2025-09-27 12:03:00 +02:00
import { LockdownWall } from './class/LockdownWall'
import { SecurityWall } from './class/SecurityWall'
import { IpWall } from './class/IpWall'
2025-09-27 13:02:10 +02:00
import { ConfirmModal } from './class/ConfirmModal'
2025-10-17 10:45:11 +02:00
import { SearchCustomer } from './class/SearchCustomer'
2025-08-02 10:45:16 +02:00
import preactCustomElement from './functions/preact'
2025-10-16 08:42:01 +02:00
import * as Sentry from "@sentry/browser" ;
2025-07-21 09:47:40 +02:00
function script ( ) {
2025-09-27 13:02:10 +02:00
customElements . define ( 'confirm-modal' , ConfirmModal , { extends : 'a' } )
2025-07-21 09:47:40 +02:00
customElements . define ( 'auto-submit' , AutoSubmit , { extends : 'form' } )
2025-07-21 15:09:18 +02:00
customElements . define ( 'server-card' , ServerCard , { extends : 'div' } )
2025-07-23 11:50:33 +02:00
customElements . define ( 'auto-customer' , AutoCustomer , { extends : 'button' } )
2025-07-24 09:17:20 +02:00
customElements . define ( 'repeat-line' , RepeatLine , { extends : 'div' } )
2025-09-27 12:03:00 +02:00
customElements . define ( 'lockdown-wall' , LockdownWall , { } )
customElements . define ( 'security-wall' , SecurityWall , { } )
customElements . define ( 'ip-wall' , IpWall , { } )
2025-07-24 10:08:51 +02:00
customElements . define ( 'order-ctrl' , OrderCtrl , { extends : 'div' } )
2025-09-27 12:03:00 +02:00
customElements . define ( "register-payment" , RegisterPayment , { extends : 'button' } )
2025-10-17 10:45:11 +02:00
customElements . define ( "search-customer" , SearchCustomer , { extends : 'select' } )
2025-07-21 13:25:15 +02:00
}
function full ( ) {
2025-11-06 08:04:11 +01:00
2025-07-21 13:25:15 +02:00
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' ) ;
}
} ) ;
} ) ;
2025-10-16 08:42:01 +02:00
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.
} ) ;
}
2025-07-21 09:47:40 +02:00
}
2025-07-21 13:25:15 +02:00
document . addEventListener ( 'DOMContentLoaded' , ( ) => {
script ( ) ;
} ) ;
document . addEventListener ( "turbo:load" , ( ) => {
full ( )
} ) ;