:: **Zploit** v1.0 | Current Path: **/home/kreativepixelz/public_html/crm/**
:: Editing File: hosting_details_list.php
<?php include 'header.php'; $page_title = "Clients Hosting Details"; include 'breadcrumb.php'; include 'menu.php'; ?> <style> .btn-warning{ background-color: #c27502 !important; } </style> <div class="page-body"> <div class="container-fluid"> <div class="row"> <div class="col-sm-12"> <div class="card"> <div class="row"> <div class="col-sm-8"> <div class="card-header pb-0 card-no-border"> <h2>Hosting Details</h2> </div> </div> <div class="col-sm-4"> <div class="card-header pb-0 card-no-border text-end"> <a href="hosting_details_add.php" class="btn btn-primary btn-sm"> <i class="fa fa-plus"></i> Add Hosting </a> </div> </div> </div> <div class="card-body"> <div class="dt-ext table-responsive"> <table class="display" id="export-button"> <thead> <tr> <th>#</th> <th>Client Name</th> <th>Start Date</th> <th>Expiry Date</th> <th>Total Days</th> <th>Amount</th> <th>Details</th> <th>Action</th> </tr> </thead> <tbody> <?php $sql = "SELECT h.*, c.name AS client_name FROM hosting_details h JOIN clients c ON h.client_id = c.id ORDER BY h.id DESC"; $result = mysqli_query($conn, $sql); $i = 1; $today = date('Y-m-d'); while ($row = mysqli_fetch_assoc($result)) { $start_date = $row['start_date']; $expiry_date = $row['expiry_date']; // ✅ Calculate total days between start and expiry $date1 = new DateTime($start_date); $date2 = new DateTime($expiry_date); $diff = $date1->diff($date2); $total_days = $diff->days; // ✅ Calculate days left from today until expiry $days_left = (strtotime($expiry_date) - strtotime($today)) / (60 * 60 * 24); // ✅ Set row color based on expiry proximity $row_style = ""; if ($days_left < 0) { $row_style = "style='background-color:#dc3545; color:white;'"; // expired } elseif ($days_left <= 30) { $row_style = "style='background-color:#ff9800; color:white;'"; // expiring soon } echo "<tr {$row_style}> <td {$row_style}>{$i}</td> <td>{$row['client_name']}</td> <td>{$start_date}</td> <td>{$expiry_date}</td> <td>{$total_days} days</td> <td>₹{$row['amount']}</td> <td>{$row['notes']}</td> <td> <a href='hosting_details_edit.php?id={$row['id']}' class='btn btn-warning btn-sm'> <i class='fa fa-edit'></i> </a> <a href='hosting_details_delete.php?id={$row['id']}' class='btn btn-danger btn-sm' onclick=\"return confirm('Are you sure you want to delete this hosting record?');\"> <i class='fa fa-trash'></i> </a> </td> </tr>"; $i++; } ?> </tbody> </table> </div> </div> </div> </div> </div> </div> </div> <?php include 'footer.php'; ?>