<!DOCTYPE html>
<html lang="en">
<head>
    {% include "head.html" %}
    <script src="https://code.jquery.com/jquery-3.7.1.js" integrity="sha256-eKhayi8LEQwp4NKxN+CfCh+3qOVUtJn3QNZ0TciWLP4=" crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"
    integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL"
    crossorigin="anonymous"></script>
    <script src="https://cdn.datatables.net/1.11.5/js/jquery.dataTables.min.js"></script>
    <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.11.5/css/jquery.dataTables.min.css">
</head>
<body>
    {% include "navbar.html" %}
    <main class="content px-3 py-4">
        <div class="container-fluid">
            <div class="mb-3">        
                <h3 class="fw-bold fs-4 my-3">Tabel Log</h3>
                <div class="row">
                    <div class="col-12">
                        <table class="table table-striped" id="userDataTable">
                            <thead>
                                <tr class="highlight">
                                    <th scope="col">Id</th>
                                    <th scope="col">Nama</th>
                                    <th scope="col">Divisi</th>
                                    <th scope="col">Added</th>
                                    <th scope="col">Action</th>
                                </tr>
                            </thead>
                            <tbody id="scandata"></tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </main>
    <footer class="footer">
        <div class="container-fluid">
            <div class="row text-body-secondary">
                <div class="col-6 text-start ">
                    <a class="text-body-secondary" href=" #">
                        <strong></strong>
                    </a>
                </div>
                <div class="col-6 text-end text-body-secondary d-none d-md-block">
                    <ul class="list-inline mb-0">
                        <li class="list-inline-item">
                            <a class="text-body-secondary" href="#">Contact</a>
                        </li>
                        <li class="list-inline-item">
                            <a class="text-body-secondary" href="#">About Us</a>
                        </li>
                        <li class="list-inline-item">
                            <a class="text-body-secondary" href="#">Terms & Conditions</a>
                        </li>
                    </ul>
                </div>
            </div>
        </div>
    </footer>

    <script>
        $(document).ready(function() {
            $('#userDataTable').DataTable({
                "ajax": {
                    "url": "/loadDataLog",
                    "dataSrc": "response"
                },
                "columns": [
                    { "data": "1" },
                    { "data": "2" },
                    { "data": "3" },
                    { "data": "4" },
                    { 
                        "data": null,
                        "render": function(data, type, row) {
                            return "pintu terbuka";
                        }
                    }
                ],
                "paging": true,
                "pageLength": 20, // Menampilkan 10 data per slide

            });
        });
    </script>

</body>
</html>
