first commit
This commit is contained in:
@@ -0,0 +1,250 @@
|
||||
@extends('layouts.main')
|
||||
|
||||
@section('breadcrumb')
|
||||
<ol class="breadcrumb m-0">
|
||||
<li class="breadcrumb-item"><a href="javascript:void(0);">General</a></li>
|
||||
<li class="breadcrumb-item active" aria-current="page">{{ $title }}</li>
|
||||
</ol>
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<div class="row g-3">
|
||||
<div class="col-sm">
|
||||
<div class="card border border-primary">
|
||||
<div class="card-body py-2 px-3">
|
||||
<div class="d-flex align-items-center">
|
||||
<div class="me-2">
|
||||
<i class="uil-clipboard-alt text-primary" style="font-size: 40px;"></i>
|
||||
</div>
|
||||
<div>
|
||||
<p class="mb-0" style="font-size: 13px; font-weight:bold">Total Penunjang <br>
|
||||
<span class="mb-0 count-up" data-target="{{ $penunjangStats['total'] }}" style="font-size: 32px; font-weight: bold;">0</span>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-sm">
|
||||
<div class="card border border-success">
|
||||
<div class="card-body py-2 px-3">
|
||||
<div class="d-flex align-items-center">
|
||||
<div class="me-2">
|
||||
<i class="uil-check-circle text-success" style="font-size: 40px;"></i>
|
||||
</div>
|
||||
<div>
|
||||
<p class="mb-0" style="font-size: 13px; font-weight:bold">Penunjang Diterima <br>
|
||||
<span class="mb-0 count-up" data-target="{{ $penunjangStats['diterima'] }}" style="font-size: 32px; font-weight: bold;">0</span>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-sm">
|
||||
<div class="card border border-danger">
|
||||
<div class="card-body py-2 px-3">
|
||||
<div class="d-flex align-items-center">
|
||||
<div class="me-2">
|
||||
<i class="uil-times-circle text-danger" style="font-size: 40px;"></i>
|
||||
</div>
|
||||
<div>
|
||||
<p class="mb-0" style="font-size: 13px; font-weight:bold">Penunjang Ditolak <br>
|
||||
<span class="mb-0 count-up" data-target="{{ $penunjangStats['ditolak'] }}" style="font-size: 32px; font-weight: bold;">0</span>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-sm">
|
||||
<div class="card border border-warning">
|
||||
<div class="card-body py-2 px-3">
|
||||
<div class="d-flex align-items-center">
|
||||
<div class="me-2">
|
||||
<i class="uil-clock text-warning" style="font-size: 40px;"></i>
|
||||
</div>
|
||||
<div>
|
||||
<p class="mb-0" style="font-size: 13px; font-weight:bold">Penunjang Diajukan <br>
|
||||
<span class="mb-0 count-up" data-target="{{ $penunjangStats['diajukan'] }}" style="font-size: 32px; font-weight: bold;">0</span>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-sm">
|
||||
<div class="card border border-secondary">
|
||||
<div class="card-body py-2 px-3">
|
||||
<div class="d-flex align-items-center">
|
||||
<div class="me-2">
|
||||
<i class="uil-file-question-alt text-secondary" style="font-size: 40px;"></i>
|
||||
</div>
|
||||
<div>
|
||||
<p class="mb-0" style="font-size: 13px; font-weight:bold">Penunjang Belum Diajukan <br>
|
||||
<span class="mb-0 count-up" data-target="{{ $penunjangStats['belum_diajukan'] }}" style="font-size: 32px; font-weight: bold;">0</span>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@if (isset($showTeamModal) && $showTeamModal)
|
||||
@section('modal')
|
||||
<!-- Modal Pilih Team -->
|
||||
<div class="modal fade" id="teamSelectionModal" tabindex="-1" aria-labelledby="teamSelectionModalLabel"
|
||||
aria-hidden="true" data-bs-backdrop="static" data-bs-keyboard="false">
|
||||
<div class="modal-dialog modal-dialog-centered">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header bg-primary text-white">
|
||||
<h5 class="modal-title" id="teamSelectionModalLabel">
|
||||
<i class="mdi mdi-account-group me-1"></i>Pilih Team Verifikator
|
||||
</h5>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="alert alert-info mb-3" role="alert">
|
||||
<i class="mdi mdi-information-outline me-1"></i>
|
||||
Anda terdaftar di lebih dari satu team. Silakan pilih team untuk melanjutkan.
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="team_id" class="form-label">Team <span class="text-danger">*</span></label>
|
||||
<select class="form-select select2" id="team_id" name="team_id" required
|
||||
data-dropdown-parent="#teamSelectionModal" data-placeholder="Pilih Team...">
|
||||
<option value=""></option>
|
||||
@foreach ($teams as $team)
|
||||
<option value="{{ $team->id }}">{{ $team->nama }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-primary" id="btnSelectTeam">
|
||||
<i class="mdi mdi-check me-1"></i>Pilih Team
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
@endif
|
||||
|
||||
@section('js')
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
// Count-up animation
|
||||
function animateCountUp(el) {
|
||||
const target = parseInt(el.getAttribute('data-target'), 10);
|
||||
const duration = 1200;
|
||||
const startTime = performance.now();
|
||||
|
||||
function update(currentTime) {
|
||||
const elapsed = currentTime - startTime;
|
||||
const progress = Math.min(elapsed / duration, 1);
|
||||
const eased = 1 - Math.pow(1 - progress, 3);
|
||||
el.textContent = Math.floor(eased * target);
|
||||
if (progress < 1) {
|
||||
requestAnimationFrame(update);
|
||||
} else {
|
||||
el.textContent = target;
|
||||
}
|
||||
}
|
||||
|
||||
requestAnimationFrame(update);
|
||||
}
|
||||
|
||||
const observer = new IntersectionObserver(function(entries) {
|
||||
entries.forEach(function(entry) {
|
||||
if (entry.isIntersecting) {
|
||||
animateCountUp(entry.target);
|
||||
observer.unobserve(entry.target);
|
||||
}
|
||||
});
|
||||
}, { threshold: 0.3 });
|
||||
|
||||
document.querySelectorAll('.count-up').forEach(function(el) {
|
||||
observer.observe(el);
|
||||
});
|
||||
|
||||
@if (isset($showTeamModal) && $showTeamModal)
|
||||
// Initialize select2 untuk team selection
|
||||
$('#team_id').select2({
|
||||
dropdownParent: $('#teamSelectionModal'),
|
||||
placeholder: 'Pilih Team...',
|
||||
allowClear: true,
|
||||
width: '100%'
|
||||
});
|
||||
|
||||
// Tampilkan modal
|
||||
$('#teamSelectionModal').modal('show');
|
||||
|
||||
// Handle submit team selection
|
||||
$('#btnSelectTeam').off('click').on('click', function(e) {
|
||||
e.preventDefault();
|
||||
e.stopImmediatePropagation();
|
||||
|
||||
const teamId = $('#team_id').val();
|
||||
|
||||
if (!teamId) {
|
||||
showWarning('Perhatian', 'Silakan pilih team terlebih dahulu');
|
||||
return false;
|
||||
}
|
||||
|
||||
const $btn = $(this);
|
||||
const originalHtml = $btn.html();
|
||||
$btn.prop('disabled', true).html(
|
||||
'<i class="mdi mdi-loading mdi-spin me-1"></i>Memproses...');
|
||||
|
||||
const url = '{{ url('/dashboard/set-team') }}';
|
||||
|
||||
fetch(url, {
|
||||
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 => {
|
||||
if (!response.ok) {
|
||||
return response.json().then(err => {
|
||||
throw new Error(err.message || 'Terjadi kesalahan');
|
||||
});
|
||||
}
|
||||
return response.json();
|
||||
})
|
||||
.then(data => {
|
||||
if (data.success) {
|
||||
showSuccess('Berhasil', data.message);
|
||||
setTimeout(() => { window.location.href = data.redirect; }, 500);
|
||||
} else {
|
||||
throw new Error(data.message || 'Terjadi kesalahan');
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
showError('Gagal', error.message || 'Terjadi kesalahan');
|
||||
$btn.prop('disabled', false).html(originalHtml);
|
||||
});
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
$('#team_id').off('keypress').on('keypress', function(e) {
|
||||
if (e.which === 13) {
|
||||
e.preventDefault();
|
||||
$('#btnSelectTeam').trigger('click');
|
||||
}
|
||||
});
|
||||
@endif
|
||||
});
|
||||
</script>
|
||||
@endsection
|
||||
Reference in New Issue
Block a user