Files
verifikator/resources/views/layouts/main.blade.php
T
2026-08-07 10:47:09 +07:00

1087 lines
42 KiB
PHP

<!DOCTYPE html>
<html lang="en">
<head>
@include('layouts.header')
@yield('css')
<style>
/* ===== Styled DataTable (.dt-styled) ===== */
.dt-styled td, .dt-styled th {
border-color: #ced4da !important;
}
.dt-styled thead th,
.dt-styled thead th.sorting,
.dt-styled thead th.sorting_asc,
.dt-styled thead th.sorting_desc,
.dt-styled thead th.sorting_asc_disabled,
.dt-styled thead th.sorting_desc_disabled,
.dt-styled thead th.font-monospace,
.dt-styled thead th.nip-col,
.dt-styled thead th.nominal-cell {
background: linear-gradient(135deg, #2080f5 0%, #0166d2 100%) !important;
color: #fff !important;
white-space: nowrap;
border-color: #0166d2 !important;
}
.dt-styled thead th.sorting:before,
.dt-styled thead th.sorting:after,
.dt-styled thead th.sorting_asc:before,
.dt-styled thead th.sorting_asc:after,
.dt-styled thead th.sorting_desc:before,
.dt-styled thead th.sorting_desc:after,
.dt-styled thead th.sorting_asc_disabled:before,
.dt-styled thead th.sorting_asc_disabled:after,
.dt-styled thead th.sorting_desc_disabled:before,
.dt-styled thead th.sorting_desc_disabled:after {
color: #fff !important;
}
.dt-styled tbody tr {
cursor: pointer;
}
.dt-styled tbody tr > * {
transition: background-color 0.25s ease;
}
.dt-styled tbody tr:hover > * {
background-color: rgba(13, 110, 253, 0.08) !important;
}
.dt-styled tbody tr:active > * {
background-color: rgba(13, 110, 253, 0.22) !important;
transition: background-color 0s;
}
.dt-styled tbody tr.row-selected > * {
background-color: rgba(13, 110, 253, 0.18) !important;
}
.dt-styled tbody tr.row-selected:hover > * {
background-color: rgba(13, 110, 253, 0.26) !important;
}
.dt-styled thead th .form-check-input {
border-color: rgba(255, 255, 255, 0.7);
cursor: pointer;
margin: 0;
}
.dt-styled tbody .row-checkbox {
cursor: pointer;
}
/* ===== End Styled DataTable ===== */
/* ===== Global Page Loading Cursor ===== */
body.page-loading,
body.page-loading * {
cursor: wait !important;
}
/* ===== End Global Page Loading Cursor ===== */
/* Custom Button Purple Outline */
.btn-outline-purple {
border-color: #6f42c1;
color: #6f42c1;
}
.btn-outline-purple:hover {
background-color: #6f42c1;
border-color: #6f42c1;
color: #fff;
}
.btn-outline-purple:focus,
.btn-outline-purple:active {
background-color: #6f42c1;
border-color: #6f42c1;
color: #fff;
box-shadow: 0 0 0 0.2rem rgba(111, 66, 193, 0.25);
}
.footer {
background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 50%, #1d4ed8 100%) !important;
color: white !important;
}
.footer .footer-links a {
color: rgba(255, 255, 255, 0.8) !important;
}
.footer .footer-links a:hover {
color: white !important;
}
/* Team Name Marquee */
.team-name-container {
width: 100%;
overflow: hidden;
position: relative;
}
.team-name-text {
display: inline-block;
white-space: nowrap;
}
.team-name-text.marquee {
animation: marquee 5s ease-in-out 1s infinite alternate;
}
@keyframes marquee {
0% {
transform: translateX(0);
}
100% {
transform: translateX(var(--marquee-distance));
}
}
/* Hilangkan box-shadow bawaan sidebar */
.leftside-menu {
box-shadow: none !important;
-webkit-box-shadow: none !important;
}
/* Sidebar Active Menu dengan Background Biru dan Border Radius */
/* Submenu yang aktif mendapat highlight */
.side-nav .side-nav-second-level .active.badge-primary-lighten {
background-color: transparent !important;
}
.side-nav .side-nav-second-level .active.badge-primary-lighten a {
background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 50%, #1d4ed8 100%) !important;
color: white !important;
border-radius: 8px !important;
margin-left: 8px !important;
margin-right: 8px !important;
}
.side-nav .side-nav-second-level .active.badge-primary-lighten a:hover {
background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 70%, #1d4ed8 100%) !important;
}
.side-nav .side-nav-second-level .active.badge-primary-lighten a i {
color: white !important;
}
/* Menu tunggal (tanpa submenu) yang aktif mendapat highlight */
.side-nav .menuitem-active:not(:has(.side-nav-second-level))>a,
body[data-leftbar-theme="light"] .side-nav .menuitem-active:not(:has(.side-nav-second-level))>a,
body[data-leftbar-theme="dark"] .side-nav .menuitem-active:not(:has(.side-nav-second-level))>a {
background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 50%, #1d4ed8 100%) !important;
color: white !important;
border-radius: 8px !important;
margin-left: 8px !important;
margin-right: 8px !important;
}
.side-nav .menuitem-active:not(:has(.side-nav-second-level))>a:hover {
background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 70%, #1d4ed8 100%) !important;
}
.side-nav .menuitem-active:not(:has(.side-nav-second-level))>a i {
color: white !important;
}
/* Hilangkan background biru pada parent menu ketika ada submenu */
.side-nav .menuitem-active:has(.side-nav-second-level)>a,
body[data-leftbar-theme="light"] .side-nav .menuitem-active:has(.side-nav-second-level)>a,
body[data-leftbar-theme="dark"] .side-nav .menuitem-active:has(.side-nav-second-level)>a {
background: transparent !important;
}
/* Topbar Marquee */
.topbar-marquee {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
width: 90%;
overflow: hidden;
white-space: nowrap;
background: rgba(187, 187, 187, 0.301);
border: 1px solid rgba(53, 53, 101, 0.129);
border-radius: 6px;
padding: 6px 12px;
}
.marquee-content {
display: inline-block;
position: relative;
animation: marquee-scroll 22s linear infinite;
color: #dc3545;
font-weight: 600;
font-size: 14px;
}
@keyframes marquee-scroll {
0% {
left: 100%;
}
100% {
left: -100%;
}
}
/* Responsive untuk mobile */
@media (max-width: 768px) {
.topbar-marquee {
width: 40%;
left: 30%;
transform: translate(0, -50%);
}
}
.tooltip-tolak .tooltip-inner {
max-width: 320px;
text-align: left;
}
</style>
</head>
<body data-layout-color="light" data-leftbar-theme="light" data-layout-mode="fluid" data-rightbar-onstart="false">
<!-- Begin page -->
<div class="wrapper">
<!-- ========== Left Sidebar Start ========== -->
<div class="leftside-menu">
@include('layouts.sidebar')
</div>
<!-- Left Sidebar End -->
<!-- ============================================================== -->
<!-- Start Page Content here -->
<!-- ============================================================== -->
<div class="content-page">
<div class="content">
<!-- Topbar Start -->
@include('layouts.topbar')
<!-- end Topbar -->
<!-- Start Content-->
<div class="container-fluid">
<!-- start page title -->
<div class="row">
<div class="col-12">
<div class="page-title-box">
<div class="page-title-right">
<nav aria-label="breadcrumb">
@yield('breadcrumb')
</nav>
</div>
<h4 class="page-title">{{ $title }}</h4>
</div>
</div>
</div>
<!-- end page title -->
@yield('content')
@yield('modal')
@yield('modal-alert-blade')
<!-- Modal Ganti Team (Global) -->
@php
$authUser = Auth::user();
$authUserTeams = $authUser->teams;
@endphp
@if ($authUserTeams->count() > 1)
<div class="modal fade" id="changeTeamModal" tabindex="-1"
aria-labelledby="changeTeamModalLabel" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header bg-primary text-white">
<h5 class="modal-title" id="changeTeamModalLabel">
<i class="mdi mdi-account-switch me-1"></i>Ganti Team Verifikator
</h5>
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal"
aria-label="Close"></button>
</div>
<div class="modal-body">
<div class="alert alert-info mb-3" role="alert">
<i class="mdi mdi-information-outline me-1"></i>
Pilih team yang ingin Anda gunakan. Team aktif saat ini:
<strong>{{ $authUserTeams->where('id', session('team_id'))->first()->nama ?? 'Belum dipilih' }}</strong>
</div>
<div class="mb-3">
<label for="change_team_id" class="form-label">Team <span
class="text-danger">*</span></label>
<select class="form-select select2" id="change_team_id"
name="change_team_id" required data-dropdown-parent="#changeTeamModal"
data-placeholder="Pilih Team...">
<option value=""></option>
@foreach ($authUserTeams as $team)
<option value="{{ $team->id }}"
{{ session('team_id') == $team->id ? 'selected' : '' }}>
{{ $team->nama }}
</option>
@endforeach
</select>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">
<i class="mdi mdi-close me-1"></i>Batal
</button>
<button type="button" class="btn btn-primary" id="btnConfirmChangeTeam">
<i class="mdi mdi-check me-1"></i>Ganti Team
</button>
</div>
</div>
</div>
</div>
@endif
</div>
<!-- container -->
</div>
<!-- content -->
<!-- Footer Start -->
<footer class="footer">
<div class="container-fluid">
<div class="row">
<div class="col-md-6">
Verifikator Universitas Tanjungpura 2025 | All Rights Reserved.
</div>
<div class="col-md-6">
<div class="text-md-end footer-links d-none d-md-block">
<a href="javascript: void(0);">About</a>
<a href="javascript: void(0);">Support</a>
<a href="javascript: void(0);">Contact Us</a>
</div>
</div>
</div>
</div>
</footer>
<!-- end Footer -->
</div>
<!-- ============================================================== -->
<!-- End Page content -->
<!-- ============================================================== -->
</div>
<!-- END wrapper -->
<!-- WhatsApp Helpdesk Button -->
<div class="whatsapp-helpdesk-wrapper">
<div class="whatsapp-helpdesk-bubble" id="waHelpdeskBubble">
<button class="whatsapp-helpdesk-bubble-close" id="waHelpdeskClose" title="Tutup">&times;</button>
<div class="whatsapp-helpdesk-bubble-header">
<div class="whatsapp-helpdesk-bubble-avatar">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" width="20" height="20">
<path d="M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413z"/>
</svg>
</div>
<div>
<div class="whatsapp-helpdesk-bubble-name">Tim Helpdesk</div>
<div class="whatsapp-helpdesk-bubble-status">
<span class="whatsapp-helpdesk-online-dot"></span> Online
</div>
</div>
</div>
<div class="whatsapp-helpdesk-bubble-body">
Halo! Ada yang bisa kami bantu? &#128075;<br>
<span style="font-size:12px; opacity:0.85;">Klik tombol di bawah untuk chat langsung via WhatsApp.</span>
</div>
<div class="whatsapp-helpdesk-bubble-arrow"></div>
</div>
@php
$waName = Auth::user()->name ?? 'Pengguna';
$waText = "Halo Tim Helpdesk Verifikator Universitas Tanjungpura\n\nPerkenalkan, nama saya {$waName}. Saya membutuhkan bantuan terkait aplikasi Verifikator. Mohon informasinya, terima kasih.";
$waUrl = 'https://wa.me/6285845408925?text=' . rawurlencode($waText);
@endphp
<a href="{{ $waUrl }}" target="_blank" rel="noopener noreferrer"
class="whatsapp-helpdesk-btn" title="Hubungi Helpdesk via WhatsApp">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" width="28" height="28">
<path d="M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413z"/>
</svg>
<span class="whatsapp-helpdesk-label">Helpdesk</span>
</a>
</div>
<style>
.content-page {
padding-bottom: 90px;
}
.whatsapp-helpdesk-wrapper {
position: fixed;
bottom: 28px;
right: 28px;
z-index: 9999;
display: flex;
flex-direction: column;
align-items: flex-end;
gap: 10px;
pointer-events: none;
}
.whatsapp-helpdesk-wrapper > * {
pointer-events: all;
}
/* Gelembung sapaan */
.whatsapp-helpdesk-bubble {
position: relative;
background: #fff;
border-radius: 12px;
box-shadow: 0 4px 20px rgba(0,0,0,0.15);
padding: 14px 16px 14px 14px;
width: 230px;
opacity: 0;
transform: translateY(10px) scale(0.95);
transform-origin: bottom right;
transition: opacity 0.3s ease, transform 0.3s ease;
pointer-events: none;
}
.whatsapp-helpdesk-bubble.show {
opacity: 1;
transform: translateY(0) scale(1);
pointer-events: auto;
}
.whatsapp-helpdesk-bubble-close {
position: absolute;
top: 6px;
right: 8px;
background: none;
border: none;
font-size: 16px;
line-height: 1;
color: #999;
cursor: pointer;
padding: 0 2px;
}
.whatsapp-helpdesk-bubble-close:hover {
color: #333;
}
.whatsapp-helpdesk-bubble-header {
display: flex;
align-items: center;
gap: 10px;
margin-bottom: 10px;
}
.whatsapp-helpdesk-bubble-avatar {
background-color: #25D366;
color: #fff;
border-radius: 50%;
width: 38px;
height: 38px;
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
}
.whatsapp-helpdesk-bubble-name {
font-weight: 700;
font-size: 13px;
color: #111;
}
.whatsapp-helpdesk-bubble-status {
font-size: 11px;
color: #25D366;
display: flex;
align-items: center;
gap: 4px;
}
.whatsapp-helpdesk-online-dot {
display: inline-block;
width: 7px;
height: 7px;
background: #25D366;
border-radius: 50%;
}
.whatsapp-helpdesk-bubble-body {
font-size: 13px;
color: #333;
line-height: 1.5;
background: #f0fdf4;
border-radius: 8px;
padding: 8px 10px;
}
/* Segitiga penunjuk ke tombol */
.whatsapp-helpdesk-bubble-arrow {
position: absolute;
bottom: -8px;
right: 24px;
width: 0;
height: 0;
border-left: 8px solid transparent;
border-right: 8px solid transparent;
border-top: 8px solid #fff;
filter: drop-shadow(0 2px 2px rgba(0,0,0,0.08));
}
/* Tombol utama */
.whatsapp-helpdesk-btn {
display: flex;
align-items: center;
gap: 8px;
background-color: #25D366;
color: #fff;
border-radius: 50px;
padding: 12px 18px;
text-decoration: none;
box-shadow: 0 4px 16px rgba(37, 211, 102, 0.45);
transition: background-color 0.2s, box-shadow 0.2s, transform 0.2s;
font-weight: 600;
font-size: 14px;
}
.whatsapp-helpdesk-btn:hover {
background-color: #1ebe5d;
box-shadow: 0 6px 20px rgba(37, 211, 102, 0.6);
color: #fff;
transform: translateY(-2px);
}
.whatsapp-helpdesk-btn:active {
transform: translateY(0);
}
@media (max-width: 576px) {
.whatsapp-helpdesk-wrapper {
bottom: 20px;
right: 16px;
}
.whatsapp-helpdesk-btn {
padding: 12px;
border-radius: 50%;
}
.whatsapp-helpdesk-label {
display: none;
}
.whatsapp-helpdesk-bubble {
width: 200px;
}
}
</style>
<script>
(function () {
var STORAGE_KEY = 'wa_helpdesk_bubble_closed';
var bubble = document.getElementById('waHelpdeskBubble');
var closeBtn = document.getElementById('waHelpdeskClose');
if (sessionStorage.getItem(STORAGE_KEY)) {
return;
}
setTimeout(function () {
bubble.classList.add('show');
}, 1500);
closeBtn.addEventListener('click', function (e) {
e.preventDefault();
bubble.classList.remove('show');
sessionStorage.setItem(STORAGE_KEY, '1');
});
})();
</script>
<!-- End WhatsApp Helpdesk Button -->
<!-- Right Sidebar -->
<div class="end-bar">
<div class="rightbar-title">
<a href="javascript:void(0);" class="end-bar-toggle float-end">
<i class="dripicons-cross noti-icon"></i>
</a>
<h5 class="m-0">Settings</h5>
</div>
<div class="rightbar-content h-100" data-simplebar>
<div class="p-3">
<div class="alert alert-warning" role="alert">
<strong>Customize </strong> the overall color scheme, sidebar menu, etc.
</div>
<!-- Settings -->
<h5 class="mt-3">Color Scheme</h5>
<hr class="mt-1" />
<div class="form-check form-switch mb-1">
<input class="form-check-input" type="checkbox" name="color-scheme-mode" value="light"
id="light-mode-check" checked>
<label class="form-check-label" for="light-mode-check">Light Mode</label>
</div>
<div class="form-check form-switch mb-1">
<input class="form-check-input" type="checkbox" name="color-scheme-mode" value="dark"
id="dark-mode-check">
<label class="form-check-label" for="dark-mode-check">Dark Mode</label>
</div>
<!-- Width -->
<h5 class="mt-4">Width</h5>
<hr class="mt-1" />
<div class="form-check form-switch mb-1">
<input class="form-check-input" type="checkbox" name="width" value="fluid" id="fluid-check"
checked>
<label class="form-check-label" for="fluid-check">Fluid</label>
</div>
<div class="form-check form-switch mb-1">
<input class="form-check-input" type="checkbox" name="width" value="boxed" id="boxed-check">
<label class="form-check-label" for="boxed-check">Boxed</label>
</div>
<!-- Left Sidebar-->
<h5 class="mt-4">Left Sidebar</h5>
<hr class="mt-1" />
<div class="form-check form-switch mb-1">
<input class="form-check-input" type="checkbox" name="theme" value="default"
id="default-check">
<label class="form-check-label" for="default-check">Default</label>
</div>
<div class="form-check form-switch mb-1">
<input class="form-check-input" type="checkbox" name="theme" value="light" id="light-check"
checked>
<label class="form-check-label" for="light-check">Light</label>
</div>
<div class="form-check form-switch mb-3">
<input class="form-check-input" type="checkbox" name="theme" value="dark" id="dark-check">
<label class="form-check-label" for="dark-check">Dark</label>
</div>
<div class="form-check form-switch mb-1">
<input class="form-check-input" type="checkbox" name="compact" value="fixed" id="fixed-check"
checked>
<label class="form-check-label" for="fixed-check">Fixed</label>
</div>
<div class="form-check form-switch mb-1">
<input class="form-check-input" type="checkbox" name="compact" value="condensed"
id="condensed-check">
<label class="form-check-label" for="condensed-check">Condensed</label>
</div>
<div class="form-check form-switch mb-1">
<input class="form-check-input" type="checkbox" name="compact" value="scrollable"
id="scrollable-check">
<label class="form-check-label" for="scrollable-check">Scrollable</label>
</div>
<div class="d-grid mt-4">
<button class="btn btn-primary" id="resetBtn">Reset to Default</button>
<a href="https://themes.getbootstrap.com/product/hyper-responsive-admin-dashboard-template/"
class="btn btn-danger mt-3" target="_blank"><i class="mdi mdi-basket me-1"></i>
Purchase Now</a>
</div>
</div> <!-- end padding-->
</div>
</div>
<div class="rightbar-overlay"></div>
<!-- /End-bar -->
<!-- bundle -->
<script src="{{ asset('assets/js/vendor.min.js') }}"></script>
<script src="{{ asset('assets/js/app.min.js') }}"></script>
<!-- Setup CSRF Token for AJAX -->
<script>
// Hapus semua cursor loading ketika halaman tampil (termasuk restore dari bfcache)
window.addEventListener('pageshow', function() {
$('body').css('cursor', '').removeClass('navigating-row page-loading');
$('tr').css('cursor', '');
});
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
</script>
<!-- Global Navigation Loading Cursor -->
<script>
(function() {
var loadingTimer;
function startLoading() {
clearTimeout(loadingTimer);
$('body').addClass('page-loading');
}
function stopLoading() {
loadingTimer = setTimeout(function() {
$('body').removeClass('page-loading');
}, 50);
}
// Klik pada link navigasi nyata (bukan #, javascript:, atau modal trigger)
$(document).on('click', 'a[href]', function() {
var href = $(this).attr('href');
var isNavigation = href
&& href !== '#'
&& href !== ''
&& !/^javascript/i.test(href)
&& !/^blob:/i.test(href)
&& !$(this).attr('download')
&& !$(this).is('[data-bs-toggle],[data-bs-dismiss]');
if (isNavigation) {
startLoading();
}
});
// Klik pada baris tabel dengan data-detail-url
$(document).on('click', '[data-detail-url]', function(e) {
if ($(e.target).closest('.form-check, .btn').length) {
return;
}
startLoading();
});
// Safety net: hapus saat semua AJAX selesai (mencegah cursor stuck jika navigasi dibatalkan)
$(document).ajaxStop(stopLoading);
})();
</script>
<!-- third party js -->
<script src="{{ asset('assets/js/vendor/apexcharts.min.js') }}"></script>
<script src="{{ asset('assets/js/vendor/jquery-jvectormap-1.2.2.min.js') }}"></script>
<script src="{{ asset('assets/js/vendor/jquery-jvectormap-world-mill-en.js') }}"></script>
<!-- third party js ends -->
<!-- Datatables js -->
<script src="{{ asset('assets/js/vendor/jquery.dataTables.min.js') }}"></script>
<script src="{{ asset('assets/js/vendor/dataTables.bootstrap5.js') }}"></script>
<script src="{{ asset('assets/js/vendor/dataTables.responsive.min.js') }}"></script>
<script src="{{ asset('assets/js/vendor/responsive.bootstrap5.min.js') }}"></script>
<!-- Simple Notify JS -->
<script src="https://cdn.jsdelivr.net/npm/simple-notify/dist/simple-notify.min.js"></script>
<!-- SweetAlert2 JS -->
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<!-- Plotly JS -->
<script src="https://cdn.plot.ly/plotly-2.35.2.min.js" charset="utf-8"></script>
<!-- Simple Notify JS -->
<script>
function showNotification(options = {}) {
const defaultOptions = {
status: 'info',
title: 'Notification',
text: 'Default notification message',
effect: 'fade',
speed: 300,
customClass: null,
customIcon: null,
showIcon: true,
showCloseButton: true,
autoclose: true,
autotimeout: 3000,
gap: 20,
distance: 20,
type: 'outline',
position: 'right top'
};
const config = {
...defaultOptions,
...options
};
new Notify(config);
}
// Fungsi khusus untuk notifikasi sukses
function showSuccess(title = 'Success', text = 'Operation completed successfully') {
showNotification({
status: 'success',
title: title,
text: text,
});
}
// Fungsi khusus untuk notifikasi error
function showError(title = 'Error', text = 'An error occurred') {
showNotification({
status: 'error',
title: title,
text: text,
autotimeout: 5000
});
}
// Fungsi khusus untuk notifikasi warning
function showWarning(title = 'Warning', text = 'Please check your input') {
showNotification({
status: 'warning',
title: title,
text: text,
autotimeout: 5000
});
}
// Fungsi khusus untuk notifikasi info
function showInfo(title = 'Information', text = 'Here is some information') {
showNotification({
status: 'info',
title: title,
text: text,
});
}
// Fungsi untuk menangani error dari jQuery AJAX
function handleAjaxError(xhr, status, error) {
let errorMessage = 'An unexpected error occurred';
let errorTitle = 'Error';
// Fungsi helper untuk extract message dari response
function getMessageFromResponse(xhr) {
try {
const responseData = JSON.parse(xhr.responseText);
return responseData.message || responseData.error || responseData.msg || null;
} catch (e) {
return xhr.responseText || null;
}
}
// Parse error berdasarkan status code
switch (xhr.status) {
case 400:
errorTitle = 'Bad Request';
errorMessage = getMessageFromResponse(xhr) || 'Bad request. Please check your input.';
break;
case 401:
errorTitle = 'Unauthorized';
errorMessage = getMessageFromResponse(xhr) || 'You are not authorized to perform this action.';
break;
case 403:
errorTitle = 'Forbidden';
errorMessage = getMessageFromResponse(xhr) || 'Access denied. You do not have permission.';
break;
case 404:
errorTitle = 'Not Found';
errorMessage = getMessageFromResponse(xhr) || 'The requested resource was not found.';
break;
case 422:
errorTitle = 'Validation Error';
// Coba parse validation errors dari response
try {
const responseData = JSON.parse(xhr.responseText);
if (responseData.errors) {
const errors = Object.values(responseData.errors).flat();
errorMessage = errors.join('<br>');
} else if (responseData.message) {
errorMessage = responseData.message;
} else {
errorMessage = 'Validation failed. Please check your input.';
}
} catch (e) {
errorMessage = 'Validation failed. Please check your input.';
}
break;
case 500:
errorTitle = 'Server Error';
errorMessage = getMessageFromResponse(xhr) || 'Internal server error. Please try again later.';
break;
default:
// Coba parse pesan error dari response
try {
const responseData = JSON.parse(xhr.responseText);
if (responseData.message) {
errorMessage = responseData.message;
}
if (responseData.title) {
errorTitle = responseData.title;
}
} catch (e) {
errorMessage = getMessageFromResponse(xhr) || `Error ${xhr.status}: ${error}`;
}
}
showError(errorTitle, errorMessage);
}
</script>
<!-- Select2 -->
<script>
$('.select2').each(function() {
const $this = $(this);
const dropdownParent = $this.data('dropdown-parent');
const placeholder = $this.data('placeholder');
const options = {
allowClear: true,
placeholder: placeholder || "Pilih salah satu...",
width: '100%'
};
if (dropdownParent) {
options.dropdownParent = $(dropdownParent);
}
$this.select2(options);
});
</script>
<!-- Team Name Marquee -->
<script>
$(document).ready(function() {
const container = $('.team-name-container');
const text = $('.team-name-text');
if (container.length && text.length) {
// Check if text is wider than container
const textWidth = text.outerWidth();
const containerWidth = container.outerWidth();
if (textWidth > containerWidth) {
// Calculate the distance to scroll (negative value to move left)
const distance = -(textWidth - containerWidth);
text.css('--marquee-distance', distance + 'px');
text.addClass('marquee');
}
}
});
</script>
<!-- Flash Message Alert -->
<script>
@if (session('error'))
showError('Akses Ditolak', '{{ session('error') }}');
@endif
@if (session('success'))
showSuccess('Berhasil', '{{ session('success') }}');
@endif
@if (session('info'))
showInfo('Informasi', '{{ session('info') }}');
@endif
@if (session('warning'))
showWarning('Peringatan', '{{ session('warning') }}');
@endif
</script>
<!-- Change Team Modal Script -->
<script>
$(document).ready(function() {
// Initialize select2 untuk change team
if ($('#change_team_id').length) {
$('#change_team_id').select2({
dropdownParent: $('#changeTeamModal'),
placeholder: 'Pilih Team...',
allowClear: true,
width: '100%'
});
}
// Handle click button Ganti Team di topbar
$('#btnChangeTeamTopbar').off('click').on('click', function(e) {
e.preventDefault();
$('#changeTeamModal').modal('show');
});
// Handle submit ganti team
$('#btnConfirmChangeTeam').off('click').on('click', function(e) {
e.preventDefault();
e.stopImmediatePropagation();
const teamId = $('#change_team_id').val();
console.log('Changing team to:', teamId);
if (!teamId) {
showWarning('Perhatian', 'Silakan pilih team terlebih dahulu');
return false;
}
// Disable button dan tampilkan loading
const $btn = $(this);
const originalHtml = $btn.html();
$btn.prop('disabled', true).html(
'<i class="mdi mdi-loading mdi-spin me-1"></i>Memproses...');
// Kirim request
fetch('{{ url('/dashboard/set-team') }}', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-CSRF-TOKEN': '{{ csrf_token() }}',
'Accept': 'application/json',
'X-Requested-With': 'XMLHttpRequest'
},
body: JSON.stringify({
team_id: teamId
}),
redirect: 'manual'
})
.then(response => {
console.log('Response status:', response.status);
if (!response.ok) {
return response.json().then(err => {
throw new Error(err.message || 'Terjadi kesalahan');
});
}
return response.json();
})
.then(data => {
console.log('Success response:', data);
if (data.success) {
showSuccess('Berhasil', data.message);
$('#changeTeamModal').modal('hide');
setTimeout(() => {
window.location.reload();
}, 500);
} else {
throw new Error(data.message || 'Terjadi kesalahan');
}
})
.catch(error => {
console.error('Error:', error);
showError('Gagal', error.message || 'Terjadi kesalahan');
$btn.prop('disabled', false).html(originalHtml);
});
return false;
});
// Handle enter key di select
$('#change_team_id').off('keypress').on('keypress', function(e) {
if (e.which === 13) {
e.preventDefault();
$('#btnConfirmChangeTeam').trigger('click');
}
});
});
</script>
@yield('js')
@yield('modal-alert-js')
</body>
</html>