1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- @extends('layouts.layout')
- <div class="col-12" style="height: 100vh; overflow: auto;">
- <table id="table-register" class="table table-bordered table-hover" style="width: 100%;">
- <thead>
- <tr>
- <th colspan="9">
- <div class="col-12" style="text-align: center;">
- <h2 style="display: inline-block; margin-right: 10px;">Cetak Data Riwayat Pelaporan</h2>
- </div>
- </th>
- </tr>
- <tr >
- <th style="vertical-align: middle; color: black; text-align: center; padding: 10px;">No</th>
- <th style="vertical-align: middle; color: black; text-align: center; padding: 10px;">Judul Laporan</th>
- <th style="vertical-align: middle; color: black; text-align: center; padding: 10px;">Keterangan Laporan</th>
- <th style="vertical-align: middle; color: black; text-align: center; padding: 10px;">Tanggal Dibuat</th>
- <th style="vertical-align: middle; color: black; text-align: center; padding: 10px;">Lokasi</th>
- <th style="vertical-align: middle; color: black; text-align: center; padding: 10px;">Tingkat Bahaya</th>
- <th style="vertical-align: middle; color: black; text-align: center; padding: 10px;">Status Tindakan</th>
- <th style="vertical-align: middle; color: black; text-align: center; padding: 10px;">Saran Tindakan</th>
- </tr>
-
-
- </thead>
- <!-- Isi tabel -->
- <tbody>
- @php
- $i=1;
- @endphp
- @if($riwayatPelaporan->count() >0)
- @foreach ($riwayatPelaporan as $riwayatPelaporan)
- <tr>
- <td style="text-align: center; vertical-align: middle;">{{ $i++ }}</td>
- <td style="text-align: center; vertical-align: middle;">{{$riwayatPelaporan->judul}}</td>
- <td style="text-align: center; vertical-align: middle;">
- <?php
- $keterangan = $riwayatPelaporan->keterangan;
- $length = strlen($keterangan);
- $maxLength = 20;
-
- if ($length > $maxLength) {
- $keterangan = wordwrap($keterangan, $maxLength, "\n", true);
- }
-
- echo nl2br($keterangan);
- ?>
- </td>
- <td style="text-align: center; vertical-align: middle;">{{$riwayatPelaporan->tanggal}}</td>
- <td style="text-align: center; vertical-align: middle;">{{$riwayatPelaporan->lokasi}}</td>
- <td style="text-align: center; vertical-align: middle;">
- {{ $riwayatPelaporan->status }}
- </td>
- <td style="text-align: center; vertical-align: middle;">
- {{ $riwayatPelaporan->tindakan->statusTindakan }}
- </td>
- <td style="text-align: center; vertical-align: middle; overflow: auto; max-height: 100px;">
- <?php
- $saran = $riwayatPelaporan->saran;
- $length = strlen($saran);
- $maxLength = 20;
-
- if ($length > $maxLength) {
- // Memisahkan teks menjadi baris-baris dengan maksimum 10 karakter
- $saran = wordwrap($saran, $maxLength, "\n", true);
- }
-
- // Mengubah baris baru menjadi elemen <br> dalam HTML
- echo nl2br($saran);
- ?>
- </td>
-
-
- </tr>
- @endforeach
- <!-- Tambahkan baris sesuai data yang ada -->
- @else
- <tr>
- <td class="text-center" colspan="9">Laporan not found</td>
- </tr>
- @endif
- </tbody>
- </table>
- </div>
- <script type="text/javascript">
- window.print();
- </script>
|