<?php include_once("include/head.php"); ?>
<div class="main-panel">
    <div class="content-wrapper">
        <div class="card">
            <div class="card-body">
                <div class="row">
                    <div class="col-md-3">
                        <h4 class="card-title text-uppercase">Custom Proposals list</h4>
                    </div>
                    <!--<div class="col-md-9">-->
                    <!--    <a href="add-custom-container.php" class="btn btn-primary" style="float: right; margin-bottom: 10px;">Add custom Proposal</a>-->
                    <!--</div>-->

                </div>

                <div class="row">
                    <div class="col-12">
                                            
                 <?php
       
                if (isset($_SESSION['success_message'])) {
                    echo '<div class="alert alert-success">' . $_SESSION['success_message'] . '</div>';
                    unset($_SESSION['success_message']); 
                }
        
                if (isset($_SESSION['error_message'])) {
                    echo '<div class="alert alert-danger">' . $_SESSION['error_message'] . '</div>';
                    unset($_SESSION['error_message']); 
                }
                
                $sql = "SELECT * FROM custom_orders ORDER BY created_at DESC";
                $result = $conn->query($sql);
                ?>
                        <div class="table-responsive">
                            <table id="order-listing" class="table">
                                <thead>
                                    <tr>
                                        <th>Order ID</th>
                                        <th>Client Name</th>
                                        <th>Phone</th>
                                        <th>Email</th>
                                        <th>Company Name</th>
                                        <!--<th>GST</th>-->
                                        <!--<th>Address</th>-->
                                        <!--<th>Sub Total</th>-->
                                        <!--<th>Discount</th>-->
                                        <!--<th>Total Tax</th>-->
                                        <th>Total Amount</th>
                                        <th>Actions</th>
                                    </tr>
                                </thead>
                                <tbody>
                                <?php while ($order = $result->fetch_assoc()): ?>
                                    <tr>
                                        <td><?php echo htmlspecialchars($order['id']); ?></td>
                                        <td><?php echo htmlspecialchars($order['client_name']); ?></td>
                                        <td><?php echo htmlspecialchars($order['phone']); ?></td>
                                        <td><?php echo htmlspecialchars($order['email']); ?></td>
                                        <td><?php echo htmlspecialchars($order['company_name']); ?></td>
                                        <!--<td><?php echo htmlspecialchars($order['gst']); ?></td>-->
                                        <!--<td><?php echo htmlspecialchars($order['address']); ?></td>-->
                                        <!--<td><?php echo 'Rs ' . number_format($order['sub_total'], 2); ?></td>-->
                                        <!--<td><?php echo 'Rs ' . number_format($order['discount'], 2); ?></td>-->
                                        <!--<td><?php echo 'Rs ' . number_format($order['total_tax'], 2); ?></td>-->
                                        <td><?php echo 'Rs ' . number_format($order['total_amount'], 2); ?></td>
                                        <td>
                                            <a href="view_custom_order_details.php?id=<?php echo $order['id']; ?>" class="btn btn-info btn-sm">View Details</a>
                                            <a href="custom_container_edit.php?client_id=<?php echo $order['client_id']; ?>&order_id=<?php echo $order['id']; ?>" class="btn btn-success btn-sm">Edit</a>
                                            <a href="client-status-edit.php?id=<?php echo $order['client_id']; ?>" class="btn btn-secondary btn-sm">Calls</a>

                                        </td>
                                    </tr>
                                <?php endwhile; ?>
                            </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
 

<?php include_once("include/footer.php"); ?>
</body>
</html>