<?php
include('constant/connect.php');

$id = $_GET['id'];

$res = $connect->query("SELECT * FROM complaints WHERE id='$id'");
$row = $res->fetch_assoc();
?>

<div class="complaint-view">

    <h3>Complaint Details</h3>

    <div class="info">
        <span>Name:</span>
        <p><?= $row['name'] ?></p>
    </div>

    <div class="info">
        <span>Phone:</span>
        <p><?= $row['phone'] ?></p>
    </div>

    <div class="info">
        <span>Type:</span>
        <p><?= ucfirst($row['type']) ?></p>
    </div>

    <div class="info">
        <span>Details:</span>
        <p><?= $row['details'] ?></p>
    </div>

    <div class="status">
        <?php if($row['status']=='solved'){ ?>
            <span class="badge success">Solved</span>
        <?php } else { ?>
            <span class="badge pending">Pending</span>
        <?php } ?>
    </div>

</div>
<style>
    .complaint-view{
    min-width:300px;
}

.complaint-view h3{
    margin-bottom:15px;
    color:#111827;
    font-weight:600;
}

.info{
    margin-bottom:12px;
}

.info span{
    font-weight:600;
    color:#374151;
    display:block;
    font-size:13px;
}

.info p{
    margin:2px 0 0;
    color:#111;
    font-size:14px;
}

.badge{
    padding:6px 12px;
    border-radius:20px;
    font-size:12px;
}

.badge.success{
    background:#16a34a;
    color:white;
}

.badge.pending{
    background:#facc15;
    color:black;
}
</style>