User_DaftarKeluhan.php 3.13 KB
Newer Older
Dany Panegratia committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
<?php
session_start();
if (!isset($_SESSION["login"])) {
    header("Location: login.php");
    exit;
}
require 'header.php';

// ambil id data di URL
$id = $_SESSION["akun"];
$mhs = query("SELECT * FROM keluhan WHERE id_user = $id");
?>

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

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Daftar keluhan</title>
    <style>
        .tulisan {
            color: black;
        }
    </style>
</head>

<body>
    <div class="container">
        <table class="table table-striped">
            <thead>
                <tr>
                    <th scope="col">No.</th>
                    <th scope="col">Kategori</th>
                    <th scope="col">Subjek</th>
                    <th scope="col">Date</th>
                    <th scope="col">Status</th>
                    <th scope="col">Aksi</th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <?php $i = 1 ?>
                    <?php foreach ($mhs as $row) : ?>
                        <?php
                        $coba = $row['id_jenis'];
                        $cobalagi = query("SELECT * FROM jeniskeluhan WHERE id_jenis = $coba");
                        ?>
                        <td><?php echo $i; ?></td>
                        <td>
                            <?php foreach ($cobalagi as $row33) : ?>
                                <?= $row33["jenis"]; ?>
                            <?php endforeach; ?>
                        </td>
                        <td>
                            <a href="User_Keluhan.php?id_keluhan=<?php echo $row["id_keluhan"] ?>" class="tulisan"><?= $row["subjek"]; ?></a>
                        </td>
                        <td>
                            <?= $row["tanggal"]; ?>
                        </td>
                        <td>
                            <?php
                            $status = $row["status"] == "sudah";
                            ?>
                            <?php if ($status) : ?>
                                <button type="button" class="btn btn-outline-success">ANSWERED</button>
                            <?php endif; ?>
                            <?php if (!$status) : ?>
                                <button type="button" class="btn btn-outline-danger">WAIT</button>
                            <?php endif; ?>
                        </td>
                        <td>
                            <?php
                            $status = $row["status"] == "sudah";
                            ?>
                            <?php if (!$status) : ?>
                                <a href="hapuskeluhanUser.php?id=<?php echo $row["id_keluhan"] ?>" onclick="return confirm('yakin?');">hapus</a>
                            <?php endif; ?>
                        </td>
                </tr>
                <?php $i++; ?>
            <?php endforeach; ?>
            </tbody>
        </table>
    </div>
    <p align="center">
        Butuh bantuan? Silahkan kirim keluhan anda <a href="User_BuatKeluhan.php"> disini</a>
    </p>
</body>

<?php
require 'footer.php';
?>

</html>