<?php
include "conn.php";

// only api_id = 1
$sql = "SELECT service_code, service_name, price 
        FROM services 
        WHERE api_id = 1 
        ORDER BY service_name ASC";

$result = mysqli_query($conn, $sql);
?>
<!DOCTYPE html>
<html>
<head>
    <title>Available Services</title>
    <style>
        body{font-family:Arial;background:#f4f4f4;}
        table{
            width:100%;
            max-width:800px;
            margin:30px auto;
            background:#fff;
            border-collapse:collapse;
        }
        th,td{
            padding:10px;
            border:1px solid #ddd;
            text-align:center;
        }
        th{
            background:#111;
            color:#fff;
        }
        tr:hover{
            background:#f1f1f1;
        }
    </style>
</head>
<body>

<h2 style="text-align:center;">🔥 Services (API ID = 1)</h2>

<table>
<tr>
    <th>Service Name</th>
    <th>Service Code</th>
    <th>Price (₹)</th>
</tr>

<?php if(mysqli_num_rows($result) > 0){ ?>
    <?php while($row = mysqli_fetch_assoc($result)){ ?>
        <tr>
            <td><?= htmlspecialchars($row['service_name']) ?></td>
            <td><b><?= htmlspecialchars($row['service_code']) ?></b></td>
            <td>₹ <?= number_format($row['price'],2) ?></td>
        </tr>
    <?php } ?>
<?php }else{ ?>
    <tr>
        <td colspan="3">No services found</td>
    </tr>
<?php } ?>

</table>

</body>
</html>
