dari laptop

This commit is contained in:
Saufi
2026-05-14 16:27:38 +08:00
commit 3eef077798
4005 changed files with 1088651 additions and 0 deletions

715
public/js/adminlte.js Normal file
View File

@@ -0,0 +1,715 @@
/*!
* AdminLTE v4.0.0-beta1 (https://adminlte.io)
* Copyright 2014-2024 Colorlib <https://colorlib.com>
* Licensed under MIT (https://github.com/ColorlibHQ/AdminLTE/blob/master/LICENSE)
*/
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.adminlte = {}));
})(this, (function (exports) { 'use strict';
const domContentLoadedCallbacks = [];
const onDOMContentLoaded = (callback) => {
if (document.readyState === 'loading') {
// add listener on the first call when the document is in loading state
if (!domContentLoadedCallbacks.length) {
document.addEventListener('DOMContentLoaded', () => {
for (const callback of domContentLoadedCallbacks) {
callback();
}
});
}
domContentLoadedCallbacks.push(callback);
}
else {
callback();
}
};
/* SLIDE UP */
const slideUp = (target, duration = 500) => {
target.style.transitionProperty = 'height, margin, padding';
target.style.transitionDuration = `${duration}ms`;
target.style.boxSizing = 'border-box';
target.style.height = `${target.offsetHeight}px`;
target.style.overflow = 'hidden';
window.setTimeout(() => {
target.style.height = '0';
target.style.paddingTop = '0';
target.style.paddingBottom = '0';
target.style.marginTop = '0';
target.style.marginBottom = '0';
}, 1);
window.setTimeout(() => {
target.style.display = 'none';
target.style.removeProperty('height');
target.style.removeProperty('padding-top');
target.style.removeProperty('padding-bottom');
target.style.removeProperty('margin-top');
target.style.removeProperty('margin-bottom');
target.style.removeProperty('overflow');
target.style.removeProperty('transition-duration');
target.style.removeProperty('transition-property');
}, duration);
};
/* SLIDE DOWN */
const slideDown = (target, duration = 500) => {
target.style.removeProperty('display');
let { display } = window.getComputedStyle(target);
if (display === 'none') {
display = 'block';
}
target.style.display = display;
const height = target.offsetHeight;
target.style.overflow = 'hidden';
target.style.height = '0';
target.style.paddingTop = '0';
target.style.paddingBottom = '0';
target.style.marginTop = '0';
target.style.marginBottom = '0';
window.setTimeout(() => {
target.style.boxSizing = 'border-box';
target.style.transitionProperty = 'height, margin, padding';
target.style.transitionDuration = `${duration}ms`;
target.style.height = `${height}px`;
target.style.removeProperty('padding-top');
target.style.removeProperty('padding-bottom');
target.style.removeProperty('margin-top');
target.style.removeProperty('margin-bottom');
}, 1);
window.setTimeout(() => {
target.style.removeProperty('height');
target.style.removeProperty('overflow');
target.style.removeProperty('transition-duration');
target.style.removeProperty('transition-property');
}, duration);
};
/**
* --------------------------------------------
* @file AdminLTE layout.ts
* @description Layout for AdminLTE.
* @license MIT
* --------------------------------------------
*/
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
const CLASS_NAME_HOLD_TRANSITIONS = 'hold-transition';
const CLASS_NAME_APP_LOADED = 'app-loaded';
/**
* Class Definition
* ====================================================
*/
class Layout {
constructor(element) {
this._element = element;
}
holdTransition() {
let resizeTimer;
window.addEventListener('resize', () => {
document.body.classList.add(CLASS_NAME_HOLD_TRANSITIONS);
clearTimeout(resizeTimer);
resizeTimer = setTimeout(() => {
document.body.classList.remove(CLASS_NAME_HOLD_TRANSITIONS);
}, 400);
});
}
}
onDOMContentLoaded(() => {
const data = new Layout(document.body);
data.holdTransition();
setTimeout(() => {
document.body.classList.add(CLASS_NAME_APP_LOADED);
}, 400);
});
/**
* --------------------------------------------
* @file AdminLTE push-menu.ts
* @description Push menu for AdminLTE.
* @license MIT
* --------------------------------------------
*/
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
const DATA_KEY$4 = 'lte.push-menu';
const EVENT_KEY$4 = `.${DATA_KEY$4}`;
const EVENT_OPEN = `open${EVENT_KEY$4}`;
const EVENT_COLLAPSE = `collapse${EVENT_KEY$4}`;
const CLASS_NAME_SIDEBAR_MINI = 'sidebar-mini';
const CLASS_NAME_SIDEBAR_COLLAPSE = 'sidebar-collapse';
const CLASS_NAME_SIDEBAR_OPEN = 'sidebar-open';
const CLASS_NAME_SIDEBAR_EXPAND = 'sidebar-expand';
const CLASS_NAME_SIDEBAR_OVERLAY = 'sidebar-overlay';
const CLASS_NAME_MENU_OPEN$1 = 'menu-open';
const SELECTOR_APP_SIDEBAR = '.app-sidebar';
const SELECTOR_SIDEBAR_MENU = '.sidebar-menu';
const SELECTOR_NAV_ITEM$1 = '.nav-item';
const SELECTOR_NAV_TREEVIEW = '.nav-treeview';
const SELECTOR_APP_WRAPPER = '.app-wrapper';
const SELECTOR_SIDEBAR_EXPAND = `[class*="${CLASS_NAME_SIDEBAR_EXPAND}"]`;
const SELECTOR_SIDEBAR_TOGGLE = '[data-lte-toggle="sidebar"]';
const Defaults = {
sidebarBreakpoint: 992
};
/**
* Class Definition
* ====================================================
*/
class PushMenu {
constructor(element, config) {
this._element = element;
this._config = Object.assign(Object.assign({}, Defaults), config);
}
// TODO
menusClose() {
const navTreeview = document.querySelectorAll(SELECTOR_NAV_TREEVIEW);
navTreeview.forEach(navTree => {
navTree.style.removeProperty('display');
navTree.style.removeProperty('height');
});
const navSidebar = document.querySelector(SELECTOR_SIDEBAR_MENU);
const navItem = navSidebar === null || navSidebar === void 0 ? void 0 : navSidebar.querySelectorAll(SELECTOR_NAV_ITEM$1);
if (navItem) {
navItem.forEach(navI => {
navI.classList.remove(CLASS_NAME_MENU_OPEN$1);
});
}
}
expand() {
const event = new Event(EVENT_OPEN);
document.body.classList.remove(CLASS_NAME_SIDEBAR_COLLAPSE);
document.body.classList.add(CLASS_NAME_SIDEBAR_OPEN);
this._element.dispatchEvent(event);
}
collapse() {
const event = new Event(EVENT_COLLAPSE);
document.body.classList.remove(CLASS_NAME_SIDEBAR_OPEN);
document.body.classList.add(CLASS_NAME_SIDEBAR_COLLAPSE);
this._element.dispatchEvent(event);
}
addSidebarBreakPoint() {
var _a, _b, _c;
const sidebarExpandList = (_b = (_a = document.querySelector(SELECTOR_SIDEBAR_EXPAND)) === null || _a === void 0 ? void 0 : _a.classList) !== null && _b !== void 0 ? _b : [];
const sidebarExpand = (_c = Array.from(sidebarExpandList).find(className => className.startsWith(CLASS_NAME_SIDEBAR_EXPAND))) !== null && _c !== void 0 ? _c : '';
const sidebar = document.getElementsByClassName(sidebarExpand)[0];
const sidebarContent = window.getComputedStyle(sidebar, '::before').getPropertyValue('content');
this._config = Object.assign(Object.assign({}, this._config), { sidebarBreakpoint: Number(sidebarContent.replace(/[^\d.-]/g, '')) });
if (window.innerWidth <= this._config.sidebarBreakpoint) {
this.collapse();
}
else {
if (!document.body.classList.contains(CLASS_NAME_SIDEBAR_MINI)) {
this.expand();
}
if (document.body.classList.contains(CLASS_NAME_SIDEBAR_MINI) && document.body.classList.contains(CLASS_NAME_SIDEBAR_COLLAPSE)) {
this.collapse();
}
}
}
toggle() {
if (document.body.classList.contains(CLASS_NAME_SIDEBAR_COLLAPSE)) {
this.expand();
}
else {
this.collapse();
}
}
init() {
this.addSidebarBreakPoint();
}
}
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
onDOMContentLoaded(() => {
var _a;
const sidebar = document === null || document === void 0 ? void 0 : document.querySelector(SELECTOR_APP_SIDEBAR);
if (sidebar) {
const data = new PushMenu(sidebar, Defaults);
data.init();
window.addEventListener('resize', () => {
data.init();
});
}
const sidebarOverlay = document.createElement('div');
sidebarOverlay.className = CLASS_NAME_SIDEBAR_OVERLAY;
(_a = document.querySelector(SELECTOR_APP_WRAPPER)) === null || _a === void 0 ? void 0 : _a.append(sidebarOverlay);
sidebarOverlay.addEventListener('touchstart', event => {
event.preventDefault();
const target = event.currentTarget;
const data = new PushMenu(target, Defaults);
data.collapse();
});
sidebarOverlay.addEventListener('click', event => {
event.preventDefault();
const target = event.currentTarget;
const data = new PushMenu(target, Defaults);
data.collapse();
});
const fullBtn = document.querySelectorAll(SELECTOR_SIDEBAR_TOGGLE);
fullBtn.forEach(btn => {
btn.addEventListener('click', event => {
event.preventDefault();
let button = event.currentTarget;
if ((button === null || button === void 0 ? void 0 : button.dataset.lteToggle) !== 'sidebar') {
button = button === null || button === void 0 ? void 0 : button.closest(SELECTOR_SIDEBAR_TOGGLE);
}
if (button) {
event === null || event === void 0 ? void 0 : event.preventDefault();
const data = new PushMenu(button, Defaults);
data.toggle();
}
});
});
});
/**
* --------------------------------------------
* @file AdminLTE treeview.ts
* @description Treeview plugin for AdminLTE.
* @license MIT
* --------------------------------------------
*/
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
// const NAME = 'Treeview'
const DATA_KEY$3 = 'lte.treeview';
const EVENT_KEY$3 = `.${DATA_KEY$3}`;
const EVENT_EXPANDED$2 = `expanded${EVENT_KEY$3}`;
const EVENT_COLLAPSED$2 = `collapsed${EVENT_KEY$3}`;
// const EVENT_LOAD_DATA_API = `load${EVENT_KEY}`
const CLASS_NAME_MENU_OPEN = 'menu-open';
const SELECTOR_NAV_ITEM = '.nav-item';
const SELECTOR_NAV_LINK = '.nav-link';
const SELECTOR_TREEVIEW_MENU = '.nav-treeview';
const SELECTOR_DATA_TOGGLE$1 = '[data-lte-toggle="treeview"]';
const Default$1 = {
animationSpeed: 300,
accordion: true
};
/**
* Class Definition
* ====================================================
*/
class Treeview {
constructor(element, config) {
this._element = element;
this._config = Object.assign(Object.assign({}, Default$1), config);
}
open() {
var _a, _b;
const event = new Event(EVENT_EXPANDED$2);
if (this._config.accordion) {
const openMenuList = (_a = this._element.parentElement) === null || _a === void 0 ? void 0 : _a.querySelectorAll(`${SELECTOR_NAV_ITEM}.${CLASS_NAME_MENU_OPEN}`);
openMenuList === null || openMenuList === void 0 ? void 0 : openMenuList.forEach(openMenu => {
if (openMenu !== this._element.parentElement) {
openMenu.classList.remove(CLASS_NAME_MENU_OPEN);
const childElement = openMenu === null || openMenu === void 0 ? void 0 : openMenu.querySelector(SELECTOR_TREEVIEW_MENU);
if (childElement) {
slideUp(childElement, this._config.animationSpeed);
}
}
});
}
this._element.classList.add(CLASS_NAME_MENU_OPEN);
const childElement = (_b = this._element) === null || _b === void 0 ? void 0 : _b.querySelector(SELECTOR_TREEVIEW_MENU);
if (childElement) {
slideDown(childElement, this._config.animationSpeed);
}
this._element.dispatchEvent(event);
}
close() {
var _a;
const event = new Event(EVENT_COLLAPSED$2);
this._element.classList.remove(CLASS_NAME_MENU_OPEN);
const childElement = (_a = this._element) === null || _a === void 0 ? void 0 : _a.querySelector(SELECTOR_TREEVIEW_MENU);
if (childElement) {
slideUp(childElement, this._config.animationSpeed);
}
this._element.dispatchEvent(event);
}
toggle() {
if (this._element.classList.contains(CLASS_NAME_MENU_OPEN)) {
this.close();
}
else {
this.open();
}
}
}
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
onDOMContentLoaded(() => {
const button = document.querySelectorAll(SELECTOR_DATA_TOGGLE$1);
button.forEach(btn => {
btn.addEventListener('click', event => {
const target = event.target;
const targetItem = target.closest(SELECTOR_NAV_ITEM);
const targetLink = target.closest(SELECTOR_NAV_LINK);
if ((target === null || target === void 0 ? void 0 : target.getAttribute('href')) === '#' || (targetLink === null || targetLink === void 0 ? void 0 : targetLink.getAttribute('href')) === '#') {
event.preventDefault();
}
if (targetItem) {
const data = new Treeview(targetItem, Default$1);
data.toggle();
}
});
});
});
/**
* --------------------------------------------
* @file AdminLTE direct-chat.ts
* @description Direct chat for AdminLTE.
* @license MIT
* --------------------------------------------
*/
/**
* Constants
* ====================================================
*/
const DATA_KEY$2 = 'lte.direct-chat';
const EVENT_KEY$2 = `.${DATA_KEY$2}`;
const EVENT_EXPANDED$1 = `expanded${EVENT_KEY$2}`;
const EVENT_COLLAPSED$1 = `collapsed${EVENT_KEY$2}`;
const SELECTOR_DATA_TOGGLE = '[data-lte-toggle="chat-pane"]';
const SELECTOR_DIRECT_CHAT = '.direct-chat';
const CLASS_NAME_DIRECT_CHAT_OPEN = 'direct-chat-contacts-open';
/**
* Class Definition
* ====================================================
*/
class DirectChat {
constructor(element) {
this._element = element;
}
toggle() {
if (this._element.classList.contains(CLASS_NAME_DIRECT_CHAT_OPEN)) {
const event = new Event(EVENT_COLLAPSED$1);
this._element.classList.remove(CLASS_NAME_DIRECT_CHAT_OPEN);
this._element.dispatchEvent(event);
}
else {
const event = new Event(EVENT_EXPANDED$1);
this._element.classList.add(CLASS_NAME_DIRECT_CHAT_OPEN);
this._element.dispatchEvent(event);
}
}
}
/**
*
* Data Api implementation
* ====================================================
*/
onDOMContentLoaded(() => {
const button = document.querySelectorAll(SELECTOR_DATA_TOGGLE);
button.forEach(btn => {
btn.addEventListener('click', event => {
event.preventDefault();
const target = event.target;
const chatPane = target.closest(SELECTOR_DIRECT_CHAT);
if (chatPane) {
const data = new DirectChat(chatPane);
data.toggle();
}
});
});
});
/**
* --------------------------------------------
* @file AdminLTE card-widget.ts
* @description Card widget for AdminLTE.
* @license MIT
* --------------------------------------------
*/
/**
* Constants
* ====================================================
*/
const DATA_KEY$1 = 'lte.card-widget';
const EVENT_KEY$1 = `.${DATA_KEY$1}`;
const EVENT_COLLAPSED = `collapsed${EVENT_KEY$1}`;
const EVENT_EXPANDED = `expanded${EVENT_KEY$1}`;
const EVENT_REMOVE = `remove${EVENT_KEY$1}`;
const EVENT_MAXIMIZED$1 = `maximized${EVENT_KEY$1}`;
const EVENT_MINIMIZED$1 = `minimized${EVENT_KEY$1}`;
const CLASS_NAME_CARD = 'card';
const CLASS_NAME_COLLAPSED = 'collapsed-card';
const CLASS_NAME_COLLAPSING = 'collapsing-card';
const CLASS_NAME_EXPANDING = 'expanding-card';
const CLASS_NAME_WAS_COLLAPSED = 'was-collapsed';
const CLASS_NAME_MAXIMIZED = 'maximized-card';
const SELECTOR_DATA_REMOVE = '[data-lte-toggle="card-remove"]';
const SELECTOR_DATA_COLLAPSE = '[data-lte-toggle="card-collapse"]';
const SELECTOR_DATA_MAXIMIZE = '[data-lte-toggle="card-maximize"]';
const SELECTOR_CARD = `.${CLASS_NAME_CARD}`;
const SELECTOR_CARD_BODY = '.card-body';
const SELECTOR_CARD_FOOTER = '.card-footer';
const Default = {
animationSpeed: 500,
collapseTrigger: SELECTOR_DATA_COLLAPSE,
removeTrigger: SELECTOR_DATA_REMOVE,
maximizeTrigger: SELECTOR_DATA_MAXIMIZE
};
class CardWidget {
constructor(element, config) {
this._element = element;
this._parent = element.closest(SELECTOR_CARD);
if (element.classList.contains(CLASS_NAME_CARD)) {
this._parent = element;
}
this._config = Object.assign(Object.assign({}, Default), config);
}
collapse() {
var _a, _b;
const event = new Event(EVENT_COLLAPSED);
if (this._parent) {
this._parent.classList.add(CLASS_NAME_COLLAPSING);
const elm = (_a = this._parent) === null || _a === void 0 ? void 0 : _a.querySelectorAll(`${SELECTOR_CARD_BODY}, ${SELECTOR_CARD_FOOTER}`);
elm.forEach(el => {
if (el instanceof HTMLElement) {
slideUp(el, this._config.animationSpeed);
}
});
setTimeout(() => {
if (this._parent) {
this._parent.classList.add(CLASS_NAME_COLLAPSED);
this._parent.classList.remove(CLASS_NAME_COLLAPSING);
}
}, this._config.animationSpeed);
}
(_b = this._element) === null || _b === void 0 ? void 0 : _b.dispatchEvent(event);
}
expand() {
var _a, _b;
const event = new Event(EVENT_EXPANDED);
if (this._parent) {
this._parent.classList.add(CLASS_NAME_EXPANDING);
const elm = (_a = this._parent) === null || _a === void 0 ? void 0 : _a.querySelectorAll(`${SELECTOR_CARD_BODY}, ${SELECTOR_CARD_FOOTER}`);
elm.forEach(el => {
if (el instanceof HTMLElement) {
slideDown(el, this._config.animationSpeed);
}
});
setTimeout(() => {
if (this._parent) {
this._parent.classList.remove(CLASS_NAME_COLLAPSED);
this._parent.classList.remove(CLASS_NAME_EXPANDING);
}
}, this._config.animationSpeed);
}
(_b = this._element) === null || _b === void 0 ? void 0 : _b.dispatchEvent(event);
}
remove() {
var _a;
const event = new Event(EVENT_REMOVE);
if (this._parent) {
slideUp(this._parent, this._config.animationSpeed);
}
(_a = this._element) === null || _a === void 0 ? void 0 : _a.dispatchEvent(event);
}
toggle() {
var _a;
if ((_a = this._parent) === null || _a === void 0 ? void 0 : _a.classList.contains(CLASS_NAME_COLLAPSED)) {
this.expand();
return;
}
this.collapse();
}
maximize() {
var _a;
const event = new Event(EVENT_MAXIMIZED$1);
if (this._parent) {
this._parent.style.height = `${this._parent.offsetHeight}px`;
this._parent.style.width = `${this._parent.offsetWidth}px`;
this._parent.style.transition = 'all .15s';
setTimeout(() => {
const htmlTag = document.querySelector('html');
if (htmlTag) {
htmlTag.classList.add(CLASS_NAME_MAXIMIZED);
}
if (this._parent) {
this._parent.classList.add(CLASS_NAME_MAXIMIZED);
if (this._parent.classList.contains(CLASS_NAME_COLLAPSED)) {
this._parent.classList.add(CLASS_NAME_WAS_COLLAPSED);
}
}
}, 150);
}
(_a = this._element) === null || _a === void 0 ? void 0 : _a.dispatchEvent(event);
}
minimize() {
var _a;
const event = new Event(EVENT_MINIMIZED$1);
if (this._parent) {
this._parent.style.height = 'auto';
this._parent.style.width = 'auto';
this._parent.style.transition = 'all .15s';
setTimeout(() => {
var _a;
const htmlTag = document.querySelector('html');
if (htmlTag) {
htmlTag.classList.remove(CLASS_NAME_MAXIMIZED);
}
if (this._parent) {
this._parent.classList.remove(CLASS_NAME_MAXIMIZED);
if ((_a = this._parent) === null || _a === void 0 ? void 0 : _a.classList.contains(CLASS_NAME_WAS_COLLAPSED)) {
this._parent.classList.remove(CLASS_NAME_WAS_COLLAPSED);
}
}
}, 10);
}
(_a = this._element) === null || _a === void 0 ? void 0 : _a.dispatchEvent(event);
}
toggleMaximize() {
var _a;
if ((_a = this._parent) === null || _a === void 0 ? void 0 : _a.classList.contains(CLASS_NAME_MAXIMIZED)) {
this.minimize();
return;
}
this.maximize();
}
}
/**
*
* Data Api implementation
* ====================================================
*/
onDOMContentLoaded(() => {
const collapseBtn = document.querySelectorAll(SELECTOR_DATA_COLLAPSE);
collapseBtn.forEach(btn => {
btn.addEventListener('click', event => {
event.preventDefault();
const target = event.target;
const data = new CardWidget(target, Default);
data.toggle();
});
});
const removeBtn = document.querySelectorAll(SELECTOR_DATA_REMOVE);
removeBtn.forEach(btn => {
btn.addEventListener('click', event => {
event.preventDefault();
const target = event.target;
const data = new CardWidget(target, Default);
data.remove();
});
});
const maxBtn = document.querySelectorAll(SELECTOR_DATA_MAXIMIZE);
maxBtn.forEach(btn => {
btn.addEventListener('click', event => {
event.preventDefault();
const target = event.target;
const data = new CardWidget(target, Default);
data.toggleMaximize();
});
});
});
/**
* --------------------------------------------
* @file AdminLTE fullscreen.ts
* @description Fullscreen plugin for AdminLTE.
* @license MIT
* --------------------------------------------
*/
/**
* Constants
* ============================================================================
*/
const DATA_KEY = 'lte.fullscreen';
const EVENT_KEY = `.${DATA_KEY}`;
const EVENT_MAXIMIZED = `maximized${EVENT_KEY}`;
const EVENT_MINIMIZED = `minimized${EVENT_KEY}`;
const SELECTOR_FULLSCREEN_TOGGLE = '[data-lte-toggle="fullscreen"]';
const SELECTOR_MAXIMIZE_ICON = '[data-lte-icon="maximize"]';
const SELECTOR_MINIMIZE_ICON = '[data-lte-icon="minimize"]';
/**
* Class Definition.
* ============================================================================
*/
class FullScreen {
constructor(element, config) {
this._element = element;
this._config = config;
}
inFullScreen() {
const event = new Event(EVENT_MAXIMIZED);
const iconMaximize = document.querySelector(SELECTOR_MAXIMIZE_ICON);
const iconMinimize = document.querySelector(SELECTOR_MINIMIZE_ICON);
void document.documentElement.requestFullscreen();
if (iconMaximize) {
iconMaximize.style.display = 'none';
}
if (iconMinimize) {
iconMinimize.style.display = 'block';
}
this._element.dispatchEvent(event);
}
outFullscreen() {
const event = new Event(EVENT_MINIMIZED);
const iconMaximize = document.querySelector(SELECTOR_MAXIMIZE_ICON);
const iconMinimize = document.querySelector(SELECTOR_MINIMIZE_ICON);
void document.exitFullscreen();
if (iconMaximize) {
iconMaximize.style.display = 'block';
}
if (iconMinimize) {
iconMinimize.style.display = 'none';
}
this._element.dispatchEvent(event);
}
toggleFullScreen() {
if (document.fullscreenEnabled) {
if (document.fullscreenElement) {
this.outFullscreen();
}
else {
this.inFullScreen();
}
}
}
}
/**
* Data Api implementation
* ============================================================================
*/
onDOMContentLoaded(() => {
const buttons = document.querySelectorAll(SELECTOR_FULLSCREEN_TOGGLE);
buttons.forEach(btn => {
btn.addEventListener('click', event => {
event.preventDefault();
const target = event.target;
const button = target.closest(SELECTOR_FULLSCREEN_TOGGLE);
if (button) {
const data = new FullScreen(button, undefined);
data.toggleFullScreen();
}
});
});
});
exports.CardWidget = CardWidget;
exports.DirectChat = DirectChat;
exports.FullScreen = FullScreen;
exports.Layout = Layout;
exports.PushMenu = PushMenu;
exports.Treeview = Treeview;
}));
//# sourceMappingURL=adminlte.js.map

File diff suppressed because one or more lines are too long

7
public/js/adminlte.min.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

137
public/js/papar_dokumen.js Normal file
View File

@@ -0,0 +1,137 @@
/**
* papar_dokumen.js
* Handles document list -> preview rendering (PDF + images) on canvas
* Requires: jQuery, pdfjsLib (global), Bootstrap
*
* Note: Ensure pdfjsLib global is available (use non-module CDN).
*/
(function ($, window, document, undefined) {
'use strict';
$(function () {
const $canvas = $('#pdf-canvas');
const canvas = $canvas.length ? $canvas[0] : null;
const ctx = canvas ? canvas.getContext('2d') : null;
const $container = $('#preview-container');
let currentUrl = null;
let zoom = 1.0;
if (!canvas || !ctx) {
console.warn('Canvas not found for dokumen preview.');
return;
}
// init event bindings
$(document).on('click', '.dokumen-item', function () {
const url = $(this).data('url');
if (!url) return;
currentUrl = url;
loadFile(url);
});
$('#btn-zoom-in').on('click', function (e) {
e.preventDefault();
zoom = Math.min(3, zoom + 0.2);
if (currentUrl) loadFile(currentUrl);
});
$('#btn-zoom-out').on('click', function (e) {
e.preventDefault();
zoom = Math.max(0.2, zoom - 0.2);
if (currentUrl) loadFile(currentUrl);
});
function loadFile(url) {
const ext = (url.split('.').pop() || '').toLowerCase();
if (['pdf'].includes(ext)) {
renderPDF(url);
} else if (['jpg','jpeg','png','gif','webp'].includes(ext)) {
renderImage(url);
} else {
toast('Format tidak disokong untuk preview', 'error');
}
}
// Render first page of PDF
function renderPDF(url) {
// ensure pdfjsLib exists
if (typeof pdfjsLib === 'undefined') {
console.error('pdfjsLib not found. Include PDF.js (non-module) before papar_dokumen.js');
return;
}
// disable workers to avoid CORS/worker issues, or set workerSrc if available
if (pdfjsLib.GlobalWorkerOptions && !pdfjsLib.GlobalWorkerOptions.workerSrc) {
// try use CDN worker (same version assumed)
pdfjsLib.GlobalWorkerOptions.workerSrc = 'https://cdnjs.cloudflare.com/ajax/libs/pdf.js/2.16.105/pdf.worker.min.js';
}
pdfjsLib.getDocument(url).promise.then(function (pdf) {
return pdf.getPage(1).then(function (page) {
const containerWidth = $container.width();
const viewport = page.getViewport({ scale: 1 });
const scale = (containerWidth / viewport.width) * zoom;
const scaledViewport = page.getViewport({ scale: scale });
const outputScale = window.devicePixelRatio || 1;
canvas.width = Math.floor(scaledViewport.width * outputScale);
canvas.height = Math.floor(scaledViewport.height * outputScale);
canvas.style.width = Math.floor(scaledViewport.width) + "px";
canvas.style.height = Math.floor(scaledViewport.height) + "px";
const renderContext = {
canvasContext: ctx,
viewport: scaledViewport,
transform: [outputScale, 0, 0, outputScale, 0, 0],
};
ctx.clearRect(0, 0, canvas.width, canvas.height);
page.render(renderContext);
});
}).catch(function (err) {
console.error('Error rendering PDF', err);
toast('Gagal memaparkan PDF.');
});
}
// Render image to canvas, fit to container and support zoom
function renderImage(url) {
const img = new Image();
img.crossOrigin = 'anonymous';
img.onload = function () {
const containerW = $container.width();
const containerH = $container.height();
const fitScale = Math.min(containerW / img.width, containerH / img.height);
const finalW = Math.max(1, Math.floor(img.width * fitScale * zoom));
const finalH = Math.max(1, Math.floor(img.height * fitScale * zoom));
canvas.width = finalW;
canvas.height = finalH;
canvas.style.width = finalW + 'px';
canvas.style.height = finalH + 'px';
ctx.clearRect(0, 0, canvas.width, canvas.height);
ctx.drawImage(img, 0, 0, finalW, finalH);
};
img.onerror = function () {
console.error('Error loading image', url);
toast('Imej gagal dimuatkan.');
};
img.src = url;
}
function toast(msg, lvl = 'info') {
if ($('#globalToast').length) {
$('#globalToast .toast-body').text(msg);
new bootstrap.Toast($('#globalToast')[0]).show();
} else {
console[lvl === 'error' ? 'error' : 'log'](msg);
}
}
});
})(jQuery, window, document);

View File

@@ -0,0 +1,265 @@
/**
* papar_permohonan.js
* Modular JS untuk papar_permohonan.blade.php
* Requires: jQuery, Leaflet, Bootstrap (for toasts/modals if used)
*
* Usage: ensure window.PermohonanConfig object exists before loading this file.
*/
(function ($, window, document, undefined) {
'use strict';
// read config (set by blade)
const cfg = window.PermohonanConfig || {};
$(function () {
/* ===========================
* Helper / Utilities
* =========================== */
function isEmpty(v) { return v === null || v === undefined || v === ''; }
function toast(msg, level = 'info') {
// simple bootstrap toast fallback (console if not present)
if (typeof bootstrap !== 'undefined' && $('#globalToast').length) {
$('#globalToast .toast-body').text(msg);
let toastEl = new bootstrap.Toast($('#globalToast')[0]);
toastEl.show();
} else {
console[level === 'error' ? 'error' : 'log'](msg);
}
}
/* ============================================================
* 1. FIELD TOGGLE HANDLERS
* ============================================================ */
function handleJenisPenjaja() {
const selected = $("#jenis_penjaja").val();
$("#jenis_penjaja_lain").prop("disabled", selected !== "lain-lain");
if (selected !== "lain-lain") $("#jenis_penjaja_lain").val("");
}
function handleJenisKenderaan() {
const jenis = $("#jenis_kenderaan").val();
const disable = ["kereta sorong", "basikal", ""].includes(jenis);
$("#no_pendaftaran").prop("disabled", disable);
if (disable) $("#no_pendaftaran").val("");
}
$("#jenis_penjaja").on("change", handleJenisPenjaja);
$("#jenis_kenderaan").on("change", handleJenisKenderaan);
// run initial toggles
handleJenisPenjaja();
handleJenisKenderaan();
/* ============================================================
* 2. LEAFLET MAP + NOMINATIM SEARCH (with debounce)
* ============================================================ */
const defaultLat = parseFloat(cfg.latitude) || 1.48348;
const defaultLng = parseFloat(cfg.longitude) || 103.58197;
const defaultZoom = cfg.latitude ? 16 : 12;
const map = L.map('viewDiv', { preferCanvas: true }).setView([defaultLat, defaultLng], defaultZoom);
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
maxZoom: 19,
attribution: '&copy; OpenStreetMap'
}).addTo(map);
let marker = null;
if (!isEmpty(cfg.latitude) && !isEmpty(cfg.longitude)) {
marker = L.marker([cfg.latitude, cfg.longitude], { draggable: true }).addTo(map);
marker.on('dragend', updateInputByMarker);
}
map.on('click', function (e) {
placeMarker(e.latlng);
updateInputFromLatLng(e.latlng);
});
function placeMarker(latlng) {
if (!marker) {
marker = L.marker(latlng, { draggable: true }).addTo(map);
marker.on('dragend', updateInputByMarker);
} else {
marker.setLatLng(latlng);
}
}
function updateInputByMarker(e) {
updateInputFromLatLng(e.target.getLatLng());
}
function updateInputFromLatLng(latlng) {
$('#latitude').val(latlng.lat);
$('#longitude').val(latlng.lng);
}
// Debounce util
function debounce(fn, wait) {
let t;
return function () {
const args = arguments;
clearTimeout(t);
t = setTimeout(function () { fn.apply(null, args); }, wait);
};
}
// Nominatim search (uses fetch)
function _cariKoordinat(rawQuery) {
const query = rawQuery || $('#searchBox').val();
if (typeof query !== 'string' || query.trim().length < 3) {
toast('Masukkan nama tempat yang lebih spesifik.', 'info');
return;
}
const url = 'https://nominatim.openstreetmap.org/search?format=json&q=' + encodeURIComponent(query);
fetch(url, { headers: { 'Accept': 'application/json' } })
.then(res => res.json())
.then(data => {
if (!Array.isArray(data) || data.length === 0) {
toast('Lokasi tak dijumpai.', 'info');
return;
}
const place = data[0];
const lat = parseFloat(place.lat);
const lon = parseFloat(place.lon);
map.setView([lat, lon], 17);
placeMarker({ lat: lat, lng: lon });
updateInputFromLatLng({ lat: lat, lng: lon });
})
.catch(err => {
console.error('Nominatim error', err);
toast('Ralat semasa mencari lokasi.', 'error');
});
}
const cariKoordinat = debounce(_cariKoordinat, 450);
$('#searchBtn').on('click', function (e) {
e.preventDefault();
cariKoordinat($('#searchBox').val());
});
// optional: live suggestions trigger (not heavy)
// $('#searchBox').on('input', debounce(function(){ cariKoordinat($(this).val()); }, 800));
/* ============================================================
* 3. CASCADING DROPDOWN: KAWASAN → TAMAN → JALAN
* ============================================================ */
function loadKawasan() {
return $.getJSON('/get_kawasan').done(function (data) {
const $kawasan = $('#kawasan').empty().append('<option value="">-- Sila Pilih Kawasan --</option>');
data.forEach(k => {
$kawasan.append($('<option>', {
value: k.id,
text: k.nama,
selected: k.id == cfg.defaultKawasanId
}));
});
if (cfg.defaultKawasanId && cfg.defaultTamanId) {
loadTaman(cfg.defaultKawasanId, cfg.defaultTamanId);
}
}).fail(function () {
toast('Gagal load kawasan.', 'error');
});
}
function loadPenempatan() {
return $.getJSON('/get_penempatan').done(function (data) {
const $penempatan = $('#penempatan').empty().append('<option value="">-- Sila Pilih Penempatan --</option>');
data.forEach(p => {
$penempatan.append($('<option>', {
value: p.id,
text: p.nama,
selected: p.id == cfg.defaultPenempatanId
}));
});
}).fail(function () {
toast('Gagal load penempatan.', 'error');
});
}
function loadTaman(kawasanId, selectedId) {
if (!kawasanId) return;
return $.getJSON('/get_taman', { kawasan_id: kawasanId }).done(function (data) {
const $taman = $('#taman').empty().append('<option value="">-- Sila Pilih Taman --</option>');
data.forEach(t => {
$taman.append($('<option>', {
value: t.id,
text: t.nama,
selected: t.id == selectedId
}));
});
$taman.prop('disabled', false);
if (selectedId && cfg.defaultJalanId) {
loadJalan(selectedId, cfg.defaultJalanId);
}
}).fail(function () {
toast('Gagal load taman.', 'error');
});
}
function loadJalan(tamanId, selectedId) {
if (!tamanId) return;
return $.getJSON('/get_jalan', { taman_id: tamanId }).done(function (data) {
const $jalan = $('#jalan').empty().append('<option value="">-- Sila Pilih Jalan --</option>');
data.forEach(j => {
$jalan.append($('<option>', {
value: j.id,
text: j.nama,
selected: j.id == selectedId
}));
});
$jalan.prop('disabled', false);
}).fail(function () {
toast('Gagal load jalan.', 'error');
});
}
// Event listeners
$('#kawasan').on('change', function () {
const kawasanId = $(this).val();
$('#taman').empty().append('<option value="">-- Sila Pilih Taman --</option>');
$('#jalan').empty().append('<option value="">-- Sila Pilih Jalan --</option>').prop('disabled', true);
if (kawasanId) loadTaman(kawasanId);
else $('#taman').prop('disabled', true);
});
$('#taman').on('change', function () {
const tid = $(this).val();
const textTaman = $(this).find('option:selected').text();
$('#jalan').empty().append('<option value="">-- Sila Pilih Jalan --</option>');
if (tid) {
loadJalan(tid);
$('#searchBox').val(textTaman);
cariKoordinat(textTaman);
} else {
$('#jalan').prop('disabled', true);
}
});
$('#jalan').on('change', function () {
const jalanText = $(this).find('option:selected').text();
const tamanText = $('#taman').find('option:selected').text();
if (jalanText) {
$('#searchBox').val(jalanText + ', ' + tamanText);
cariKoordinat(jalanText + ', ' + tamanText);
}
});
// Init
loadKawasan();
loadPenempatan();
}); // end jQuery ready
})(jQuery, window, document);

177
public/js/pdfjs/LICENSE Normal file
View File

@@ -0,0 +1,177 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS

25901
public/js/pdfjs/build/pdf.mjs Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,3 @@
àRCopyright 1990-2009 Adobe Systems Incorporated.
All rights reserved.
See ./LICENSEáCNS2-H

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,3 @@
àRCopyright 1990-2009 Adobe Systems Incorporated.
All rights reserved.
See ./LICENSEá ETen-B5-H` ^

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,4 @@
àRCopyright 1990-2009 Adobe Systems Incorporated.
All rights reserved.
See ./LICENSE!!<21>º]aX!!]`<60>21<32>> <09>p <0B>z<EFBFBD>$]<06>"Rd<E2809A>-Uƒ7<C692>*
4„%<25>+ „Z „{<7B>/%…<<3C>9K…b<E280A6>1]†.<2E>" ‰`]‡,<2C>"]ˆ

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More