TIF_E41200115/resources/views/pages/data_penilaian/index.blade.php

115 lines
5.1 KiB
PHP

@extends('layout.master')
@section('title', 'Data Penilaian')
@push('css')
<link href="{{ url('sbAdmin/vendor/datatables/dataTables.bootstrap4.min.css') }}" rel="stylesheet">
@endpush
@section('content')
<div class="card border-top-primary shadow mb-4">
<div class="card-body pt-3">
<div class="table-responsive">
<table class="table table-bordered" id="datatable" width="100%" cellspacing="0">
<thead>
<tr>
<th width="5%">No</th>
<th>Tanggal Timbang</th>
<th>Nama Balita</th>
<th>NIK</th>
<th>Nama Orang Tua</th>
<th>Alamat</th>
<th>Jenis Kelamin</th>
<th>Tanggal Lahir</th>
<th>Umur (bulan)</th>
<th>Berat Badan</th>
<th>Tinggi Badan</th>
<th>Nilai Preferensi</th>
<th>Kategori Gizi</th>
<th>Rangking</th>
<!-- Tambahkan kolom lainnya sesuai kebutuhan -->
<!-- <th>Aksi</th> -->
</tr>
</thead>
<tbody>
@php
$output = collect($output)->sortByDesc('total_preferensi')->values()->all();
@endphp
@foreach($output as $index => $item)
<tr>
<td>{{ $index + 1 }}</td>
<td>{{ $item['tanggal_timbang'] }}</td>
<td>{{ $item['nama_balita'] }}</td>
<td>{{ $item['nik'] }}</td>
<td>{{ $item['nama_orangtua'] }}</td>
<td>{{ $item['alamat'] }}</td>
<td>{{ $item['jenis_kelamin'] }}</td>
<td>{{ $item['tanggal_lahir'] }}</td>
<td>{{ $item['umur_bulan'] }}</td>
<td>{{ $item['berat_badan'] }}</td>
<td>{{ $item['tinggi_badan'] }}</td>
<td>{{ $item['total_preferensi'] }}</td>
<td>{{ $item['kategori_gizi'] }}</td>
<td>{{ $index + 1 }}</td>
<!-- Tambahkan informasi lainnya sesuai kebutuhan -->
<!-- <td>
<a href="javascript:void(0);" class="btn btn-primary btn-sm" onclick="printRow({{ $index }})">Print</a>
</td> -->
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
<div class="text-right mb-3">
<a href="javascript:void(0);" class="btn btn-primary" onclick="printAll()">Print All</a>
</div>
<script src="https://code.jquery.com/jquery-3.7.0.js"></script>
<script src="https://cdn.datatables.net/1.13.6/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/1.13.6/js/dataTables.bootstrap4.min.js"></script>
<script>
$(document).ready(function() {
$('#datatable').DataTable();
});
function printAll() {
var table = $('#datatable').DataTable();
var printWindow = window.open('', '', 'width=800,height=600');
printWindow.document.open();
printWindow.document.write('<html><head><title>SPK Penentuan Status Gizi Balita Berdasarkan Indeks Antropometri BB/Tb Menggunakan Metode Simple Additive Weighting</title>');
printWindow.document.write('<style>');
printWindow.document.write('@page { size: landscape; }'); // Atur mode cetak ke landscape
printWindow.document.write('table { border-collapse: collapse; width: 100%; }'); // Tambahkan CSS untuk mengatur ketebalan garis
printWindow.document.write('table, th, td { border: 1px solid #000; }');
printWindow.document.write('</style>');
printWindow.document.write('</head><body>');
printWindow.document.write('<h2 style="text-align: center;">Data Hasil Penilaian Status Gizi Balita</h2>');
printWindow.document.write('<table>');
// Menyimpan struktur kolom dalam variabel
var columnHeaders = $('#datatable thead tr').html();
printWindow.document.write('<thead>' + columnHeaders + '</thead>'); // Menggunakan struktur kolom yang disimpan
// Menyimpan isi tbody dalam variabel
var tbodyContent = $('#datatable tbody').html();
printWindow.document.write('<tbody>' + tbodyContent + '</tbody>'); // Menggunakan isi tbody yang disimpan
printWindow.document.write('</table>');
printWindow.document.write('</body></html>');
printWindow.document.close();
printWindow.print();
}
</script>
@endsection
@push('js')
<!-- Page level plugins -->
<script src="{{ url('sbAdmin/vendor/datatables/jquery.dataTables.min.js') }}"></script>
<script src="{{ url('sbAdmin/vendor/datatables/dataTables.bootstrap4.min.js') }}"></script>
<!-- Page level custom scripts -->
<script src="{{ url('sbAdmin/js/demo/datatables-demo.js') }}"></script>
@endpush