<?php 
    require_once("../_ayarlar.php");
    require_once("../_fonksiyonlar.php");
?>
<!DOCTYPE html>
<html lang="tr">

<head>
    <?php include("_head.php") ?>
    <title>Kullanıcılar</title>
</head>

<body id="page-top">

    <!-- Page Wrapper -->
    <div id="wrapper">

        <?php include("_sidebar.php") ?>

        <!-- Content Wrapper -->
        <div id="content-wrapper" class="d-flex flex-column">

            <!-- Main Content -->
            <div id="content">

                <?php include("_topbar.php") ?>

                <!-- Sayfaya Özel İçerik -->
                <div class="container-fluid">

                    <div class="card shadow mb-4">
                        <div class="card-header py-3">
                            <h6 class="m-0 font-weight-bold text-primary">Kullanıcılar</h6>
                        </div>
                        <div class="card-body">

                            <table class="table table-bordered" id="dataTable" width="100%" cellspacing="0">
                                <thead>
                                    <tr>
                                        <th>Sıra No</th>
                                        <th>Ad Soyad</th>
                                        <th>Eposta</th>
                                        <th>Doğum Tarihi</th>
                                        <th>Doğum Yeri</th>
                                        <th>Güncelle</th>
                                        <th>Sil</th>
                                    </tr>
                                </thead>
                                <tfoot>
                                    <tr>
                                        <th>Sıra No</th>
                                        <th>Ad Soyad</th>
                                        <th>Eposta</th>
                                        <th>Doğum Tarihi</th>
                                        <th>Doğum Yeri</th>
                                        <th>Güncelle</th>
                                        <th>Sil</th>
                                    </tr>
                                </tfoot>
                                <tbody>
                                    <?php
                                    $sql = "SELECT * FROM kullanici";
                                    $tablo = $vt->query($sql);
                                    $sira = 1;
                                    while ($satir = $tablo->fetch_assoc()) {
                                        $plaka = $satir["dogum_yeri"];
                                        echo "<tr>
                                                    <td>" . $sira . "</td>
                                                    <td>" . $satir["ad"] . " " . $satir["soyad"] . "</td>
                                                    <td>" . $satir["eposta"] . "</td>
                                                    <td>" . $satir["dogum_tarihi"] . "</td>
                                                    <td>" . $satir["dogum_yeri"] . "</td>
                                                    <td><a href='kullanici-guncelle.php?id=" . $satir["id"] . "'><button class='btn btn-primary'>Güncelle</button></a></td>
                                                    <td><a href='kullanici-sil.php?id=" . $satir["id"] . "'><button class='btn btn-danger' onclick='return sor()'>Sil</button></a></td>
                                                </tr>";
                                        $sira++;
                                    }
                                    ?>
                                </tbody>
                            </table>

                        </div>
                    </div>

                </div>
                <!-- /.container-fluid -->

            </div>
            <!-- End of Main Content -->

            <?php include("_footer.php") ?>

        </div>
        <!-- End of Content Wrapper -->

    </div>
    <!-- End of Page Wrapper -->

    <!-- Scroll to Top Button-->
    <a class="scroll-to-top rounded" href="#page-top">
        <i class="fas fa-angle-up"></i>
    </a>

    <?php include("_script.php") ?>
    <script type="text/javascript">
        function sor(){
            if(confirm("Kayıt siliniyor, onaylıyor musunuz?")){}
            else{ return false; }
        }
    </script>
</body>

</html>