<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <tr>
        <td>Nama Device : {{ $nama_device->nama_device }}</td>
    </tr>
    <tr>
        <td>Waktu Awal : {{ date('d, F Y', strtotime($awal)) }}</td>
    </tr>
    <tr>
        <td>Waktu Akhir : {{ date('d, F Y', strtotime($akhir)) }}</td>
    </tr>
    <table border="1">
        <thead>
            <tr>
                <th>#</th>
                <th colspan="4" style="text-align: center">Bantaran Sungai</th>
                <th colspan="4" style="text-align: center">Hulu Sungai</th>
            </tr>
            <tr>
                <th></th>
                <th class="text-center">Nama</th>
                <th class="text-center">Kecamatan</th>
                <th class="text-center">Ketinggian Air</th>
                <th class="text-center">Status</th>


                <th class="text-center">Nama</th>
                <th class="text-center">Ketinggian Air</th>
                <th class="text-center">Status</th>
                <th class="text-center">Waktu</th>
            </tr>
        </thead>
        <tbody>
            @foreach ($result as $row)
                <tr>
                    <td>{{ $loop->iteration }}</td>
                    <td>{{ $row->pengaturan_bantaran_sungai->bantaran_sungai->nama }}</td>
                    <td>{{ $row->pengaturan_bantaran_sungai->bantaran_sungai->kecamatan->nama }}</td>
                    <td>{{ $row->ketinggian_air_bantaran_sungai . ' CM' }}</td>
                    <td>
                        @php
                            if ($row) {
                                $tinggi = $row->status_bantaran_sungai;
                                $namaio = $tinggi;
                            } else {
                                $namaio = '-';
                            }
                            echo $namaio;
                        @endphp
                    </td>
                    <td>{{ $row->pengaturan_bantaran_sungai->bantaran_sungai->device->nama_device }}</td>
                    <td>
                        {{ $row->ketinggian_air_perangkat . ' CM' }}
                    </td>
                    <td>
                        @php
                            if ($row) {
                                $jk = $row->status_perangkat;
                                $span = $jk;
                            } else {
                                $span = '-';
                            }
                            echo $span;
                        @endphp
                    </td>
                    <td>
                        {{ date('d M Y H:i:s', strtotime($row->datetime_calculate)) }}
                    </td>
                </tr>
            @endforeach
        </tbody>
    </table>
</body>

</html>
