339 lines
15 KiB
PHP
339 lines
15 KiB
PHP
<!DOCTYPE html>
|
|
<html lang="en">
|
|
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta content="width=device-width, initial-scale=1.0" name="viewport">
|
|
|
|
<title>J-Classify Tracer Study MIF</title>
|
|
<meta content="" name="description">
|
|
<meta content="" name="keywords">
|
|
|
|
<!-- Favicons -->
|
|
<link href="{{ asset('assets/img/favicon.png') }}" rel="icon">
|
|
<link href="{{ asset('assets/img/apple-touch-icon.png') }}" rel="apple-touch-icon">
|
|
|
|
<!-- Google Fonts -->
|
|
<link href="https://fonts.gstatic.com" rel="preconnect">
|
|
<link
|
|
href="https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i,700,700i|Nunito:300,300i,400,400i,600,600i,700,700i|Poppins:300,300i,400,400i,500,500i,600,600i,700,700i"
|
|
rel="stylesheet">
|
|
|
|
<!-- Tambahkan ini di bagian <head> atau sebelum penutup </body> -->
|
|
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
|
|
|
|
|
<!-- Vendor CSS Files -->
|
|
<link href="{{ asset('assets/vendor/bootstrap/css/bootstrap.min.css') }}" rel="stylesheet">
|
|
<link href="{{ asset('assets/vendor/bootstrap-icons/bootstrap-icons.css') }}" rel="stylesheet">
|
|
<link href="{{ asset('assets/vendor/boxicons/css/boxicons.min.css') }}" rel="stylesheet">
|
|
<link href="{{ asset('assets/vendor/quill/quill.snow.css') }}" rel="stylesheet">
|
|
<link href="{{ asset('assets/vendor/quill/quill.bubble.css') }}" rel="stylesheet">
|
|
<link href="{{ asset('assets/vendor/remixicon/remixicon.css') }}" rel="stylesheet">
|
|
<link href="{{ asset('assets/vendor/simple-datatables/style.css') }}" rel="stylesheet">
|
|
|
|
<!-- Template Main CSS File -->
|
|
<link href="{{ asset('assets/css/style.css') }}" rel="stylesheet">
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<!-- ======= Header ======= -->
|
|
@include('header')
|
|
<!-- ======= Sidebar ======= -->
|
|
@include('sidebar')
|
|
|
|
<main id="main" class="main">
|
|
<div class="pagetitle">
|
|
<h1>Export Hasil Klasifikasi</h1>
|
|
<nav>
|
|
<ol class="breadcrumb">
|
|
<li class="breadcrumb-item"><a href="index.html">Home</a></li>
|
|
<li class="breadcrumb-item">Export dokumen</li>
|
|
</ol>
|
|
</nav>
|
|
</div><!-- End Page Title -->
|
|
|
|
{{-- @section('content') --}}
|
|
<section class="section">
|
|
<div class="row">
|
|
<div class="col-lg-12">
|
|
<div class="card">
|
|
|
|
<div class="card-body">
|
|
<h5 class="card-title">Export dokumen Hasil Klasifikasi K-Means</h5>
|
|
|
|
<div class="mb-4">
|
|
{{-- Form & Export Button dalam 1 baris --}}
|
|
<div class="row align-items-end g-2">
|
|
{{-- Form Pilih Angkatan --}}
|
|
<div class="col-md-4">
|
|
<form method="GET" action="{{ route('export.kmeans.index') }}">
|
|
<label for="id_angkatan" class="form-label">Pilih Tahun Angkatan:</label>
|
|
<div class="input-group">
|
|
<select name="id_angkatan" class="form-select">
|
|
<option value="">-- Pilih Angkatan --</option>
|
|
@foreach($angkatanList as $angkatan)
|
|
<option value="{{ $angkatan->id_angkatan }}" {{ ($id_angkatan == $angkatan->id_angkatan) ? 'selected' : '' }}>
|
|
{{ $angkatan->tahun }}
|
|
</option>
|
|
@endforeach
|
|
</select>
|
|
<button type="submit" class="btn btn-primary">Tampilkan</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
|
|
{{-- Tombol Export --}}
|
|
@if($id_angkatan && count($data))
|
|
<div class="col-md-4 d-flex gap-2">
|
|
<a href="{{ route('export.kmeans.pdf', $id_angkatan) }}" class="btn btn-danger">
|
|
<i class="bi bi-file-earmark-pdf"></i> Export PDF
|
|
</a>
|
|
<a href="{{ route('export.kmeans.excel', $id_angkatan) }}" class="btn btn-success">
|
|
<i class="bi bi-file-earmark-excel"></i> Export Excel
|
|
</a>
|
|
</div>
|
|
@endif
|
|
</div>
|
|
</div>
|
|
|
|
{{-- Tabel hasil klasifikasi --}}
|
|
@if($id_angkatan && count($data))
|
|
<table class="table table-bordered mt-3">
|
|
<thead class="table-light">
|
|
<tr>
|
|
<th>No</th>
|
|
<th>Nama</th>
|
|
<th>Nim</th>
|
|
<th>Kelompok Jabatan</th>
|
|
<th>Bidang Kerja</th>
|
|
<th>Cluster</th>
|
|
<th>Klasifikasi</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@foreach($data as $alumni)
|
|
<tr>
|
|
<td>{{ $loop->iteration }}</td>
|
|
<td>{{ $alumni->nama }}</td>
|
|
<td>{{ $alumni->nim }}</td>
|
|
<td>{{ $jabatanMap[$alumni->jabatan] ?? '-'}}</td>
|
|
<td>{{ $alumni->kualifikasiBidang->kualifikasi_bidang ?? '-' }}</td>
|
|
<td>{{ $alumni->hasilKlasifikasi->cluster ?? '-' }}</td>
|
|
<td> @php
|
|
$cluster = $alumni->hasilKlasifikasi->cluster ?? null;
|
|
$label = '-';
|
|
if ($cluster === 0) $label = 'Cluster 0 - TIDAK SESUAI';
|
|
elseif ($cluster === 1) $label = 'Cluster 1 - KURANG SESUAI';
|
|
elseif ($cluster === 2) $label = 'Cluster 2 - SESUAI';
|
|
@endphp
|
|
{{ $label }}
|
|
</td>
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
@elseif($id_angkatan)
|
|
<p class="text-muted mt-3">Data tidak ditemukan untuk angkatan ini.</p>
|
|
@endif
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
{{-- @endsection --}}
|
|
|
|
|
|
</main><!-- End #main -->
|
|
|
|
|
|
|
|
|
|
<!-- ======= Footer ======= -->
|
|
@include('footer')
|
|
|
|
<a href="#" class="back-to-top d-flex align-items-center justify-content-center"><i
|
|
class="bi bi-arrow-up-short"></i></a>
|
|
|
|
<!-- Vendor JS Files -->
|
|
<script src="{{ asset('assets/vendor/apexcharts/apexcharts.min.js') }}"></script>
|
|
<script src="{{ asset('assets/vendor/bootstrap/js/bootstrap.bundle.min.js') }}"></script>
|
|
<script src="{{ asset('assets/vendor/chart.js/chart.umd.js') }}"></script>
|
|
<script src="{{ asset('assets/vendor/echarts/echarts.min.js') }}"></script>
|
|
<script src="{{ asset('assets/vendor/quill/quill.js') }}"></script>
|
|
<script src="{{ asset('assets/vendor/simple-datatables/simple-datatables.js') }}"></script>
|
|
<script src="{{ asset('assets/vendor/tinymce/tinymce.min.js') }}"></script>
|
|
<script src="{{ asset('assets/vendor/php-email-form/validate.js') }}"></script>
|
|
|
|
<!-- Template Main JS File -->
|
|
<script src="{{ asset('assets/js/main.js') }}"></script>
|
|
|
|
<script>
|
|
document.getElementById('searchInput').addEventListener('keyup', function() {
|
|
let filter = this.value.toLowerCase();
|
|
let rows = document.querySelectorAll('tbody tr');
|
|
|
|
rows.forEach(row => {
|
|
let text = row.innerText.toLowerCase();
|
|
row.style.display = text.includes(filter) ? '' : 'none';
|
|
});
|
|
});
|
|
</script>
|
|
|
|
|
|
<!-- Ini buat sweet alert Konfirmasi Hapus-->
|
|
<script>
|
|
function confirmDelete(userId) {
|
|
Swal.fire({
|
|
title: 'Apakah Anda Yakin?',
|
|
text: "Pengguna ini akan dihapus!",
|
|
icon: 'warning',
|
|
showCancelButton: true,
|
|
confirmButtonColor: '#d33',
|
|
cancelButtonColor: '#3085d6',
|
|
confirmButtonText: 'Ya, Hapus!',
|
|
cancelButtonText: 'Batal'
|
|
}).then((result) => {
|
|
if (result.isConfirmed) {
|
|
// Mengirimkan request delete ke server
|
|
fetch(`/user/delete/${userId}`, {
|
|
method: 'DELETE',
|
|
headers: {
|
|
'X-CSRF-TOKEN': '{{ csrf_token() }}'
|
|
}
|
|
}).then(response => response.json())
|
|
.then(data => {
|
|
if (data.success) {
|
|
Swal.fire(
|
|
'Dihapus!',
|
|
'Pengguna berhasil dihapus.',
|
|
'success'
|
|
).then(() => {
|
|
location.reload(); // Reload halaman setelah konfirmasi berhasil
|
|
});
|
|
} else {
|
|
Swal.fire(
|
|
'Gagal!',
|
|
'Pengguna gagal dihapus.',
|
|
'error'
|
|
);
|
|
}
|
|
})
|
|
.catch(error => console.error('Terjadi kesalahan:', error));
|
|
}
|
|
})
|
|
}
|
|
</script>
|
|
|
|
<!-- Ini buat datatables Custom Rownya dengan Sorting --> <!--Pencarian-->
|
|
<script>
|
|
document.addEventListener("DOMContentLoaded", function() {
|
|
const table = document.getElementById("userTable");
|
|
const tbody = table.querySelector("tbody");
|
|
const rows = Array.from(tbody.querySelectorAll("tr"));
|
|
const headers = table.querySelectorAll("thead th");
|
|
const paginationContainer = document.createElement("div");
|
|
paginationContainer.className = "pagination-container mt-3 d-flex justify-content-end";
|
|
|
|
const searchInput = document.getElementById("searchInput");
|
|
const entriesPerPageSelect = document.getElementById("entriesPerPage");
|
|
|
|
let currentPage = 1;
|
|
let rowsPerPage = parseInt(entriesPerPageSelect.value) || 5;
|
|
let currentSortColumn = null;
|
|
let currentSortDirection = "asc";
|
|
|
|
function filterRows() {
|
|
const filter = searchInput.value.toLowerCase();
|
|
return rows.filter(row => row.innerText.toLowerCase().includes(filter));
|
|
}
|
|
|
|
function sortRows(columnIndex, direction) {
|
|
rows.sort((a, b) => {
|
|
const aText = a.cells[columnIndex].innerText.trim().toLowerCase();
|
|
const bText = b.cells[columnIndex].innerText.trim().toLowerCase();
|
|
|
|
if (!isNaN(aText) && !isNaN(bText)) {
|
|
return direction === "asc" ? aText - bText : bText - aText;
|
|
}
|
|
|
|
return direction === "asc" ? aText.localeCompare(bText) : bText.localeCompare(aText);
|
|
});
|
|
}
|
|
|
|
function displayTablePage(page) {
|
|
const filteredRows = filterRows();
|
|
const totalPages = Math.ceil(filteredRows.length / rowsPerPage);
|
|
|
|
if (page > totalPages) page = totalPages;
|
|
if (page < 1) page = 1;
|
|
|
|
tbody.innerHTML = "";
|
|
|
|
if (entriesPerPageSelect.value === "all") {
|
|
filteredRows.forEach(row => tbody.appendChild(row));
|
|
} else {
|
|
const startIndex = (page - 1) * rowsPerPage;
|
|
const endIndex = startIndex + rowsPerPage;
|
|
|
|
const rowsToDisplay = filteredRows.slice(startIndex, endIndex);
|
|
rowsToDisplay.forEach(row => tbody.appendChild(row));
|
|
|
|
updatePagination(page, totalPages);
|
|
}
|
|
}
|
|
|
|
function updatePagination(currentPage, totalPages) {
|
|
paginationContainer.innerHTML = "";
|
|
|
|
if (totalPages <= 1) return;
|
|
|
|
for (let i = 1; i <= totalPages; i++) {
|
|
const button = document.createElement("button");
|
|
button.textContent = i;
|
|
button.className = "btn btn-sm btn-outline-primary mx-1";
|
|
if (i === currentPage) button.classList.add("active");
|
|
|
|
button.addEventListener("click", () => {
|
|
displayTablePage(i);
|
|
});
|
|
|
|
paginationContainer.appendChild(button);
|
|
}
|
|
}
|
|
|
|
headers.forEach((header, index) => {
|
|
header.addEventListener("click", () => {
|
|
if (currentSortColumn === index) {
|
|
currentSortDirection = currentSortDirection === "asc" ? "desc" : "asc";
|
|
} else {
|
|
currentSortColumn = index;
|
|
currentSortDirection = "asc";
|
|
}
|
|
|
|
sortRows(index, currentSortDirection);
|
|
displayTablePage(1);
|
|
});
|
|
});
|
|
|
|
searchInput.addEventListener("keyup", () => displayTablePage(1));
|
|
entriesPerPageSelect.addEventListener("change", function() {
|
|
rowsPerPage = entriesPerPageSelect.value === "all" ? rows.length : parseInt(
|
|
entriesPerPageSelect.value);
|
|
displayTablePage(1);
|
|
});
|
|
|
|
displayTablePage(1);
|
|
table.parentNode.appendChild(paginationContainer);
|
|
});
|
|
</script>
|
|
|
|
|
|
|
|
</body>
|
|
|
|
</html>
|
|
|
|
|