mirror of https://github.com/itflow-org/itflow
Add Expiration Date Column to Software Licenses
This commit is contained in:
parent
7e9b924927
commit
273483151f
|
|
@ -74,13 +74,14 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||
</form>
|
||||
<hr>
|
||||
<div class="table-responsive-sm">
|
||||
<table class="table table-striped table-borderless table-hover">
|
||||
<table class="table table-borderless table-hover">
|
||||
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
|
||||
<tr>
|
||||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=software_name&order=<?php echo $disp; ?>">Software</a></th>
|
||||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=software_type&order=<?php echo $disp; ?>">Type</a></th>
|
||||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=software_license_type&order=<?php echo $disp; ?>">License Type</a></th>
|
||||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=software_seats&order=<?php echo $disp; ?>">Seats</a></th>
|
||||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=software_seats&order=<?php echo $disp; ?>">Expire</a></th>
|
||||
<th class="text-center">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
|
@ -98,27 +99,33 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||
$software_seats = nullable_htmlentities($row['software_seats']);
|
||||
$software_purchase = nullable_htmlentities($row['software_purchase']);
|
||||
$software_expire = nullable_htmlentities($row['software_expire']);
|
||||
$software_notes = nullable_htmlentities($row['software_notes']);
|
||||
$software_created_at = nullable_htmlentities($row['software_created_at']);
|
||||
if ($software_expire) {
|
||||
$software_expire_ago = timeAgo($software_expire);
|
||||
$software_expire_display = "<div>$software_expire</div><div><small>$software_expire_ago</small></div>";
|
||||
|
||||
// Convert the expiry date to a timestamp
|
||||
$software_expire_timestamp = strtotime($row['software_expire']);
|
||||
$current_timestamp = time(); // Get current timestamp
|
||||
|
||||
$software_expire_ago = timeAgo($software_expire);
|
||||
// Convert the expiry date to a timestamp
|
||||
$software_expire_timestamp = strtotime($row['software_expire']);
|
||||
$current_timestamp = time(); // Get current timestamp
|
||||
// Calculate the difference in days
|
||||
$days_until_expiry = ($software_expire_timestamp - $current_timestamp) / (60 * 60 * 24);
|
||||
|
||||
// Calculate the difference in days
|
||||
$days_until_expiry = ($software_expire_timestamp - $current_timestamp) / (60 * 60 * 24);
|
||||
|
||||
// Determine the class based on the number of days until expiry
|
||||
if ($days_until_expiry <= 0) {
|
||||
$tr_class = "table-secondary";
|
||||
} elseif ($days_until_expiry <= 14) {
|
||||
$tr_class = "table-danger";
|
||||
} elseif ($days_until_expiry <= 90) {
|
||||
$tr_class = "table-warning";
|
||||
// Determine the class based on the number of days until expiry
|
||||
if ($days_until_expiry <= 0) {
|
||||
$tr_class = "table-secondary";
|
||||
} elseif ($days_until_expiry <= 14) {
|
||||
$tr_class = "table-danger";
|
||||
} elseif ($days_until_expiry <= 90) {
|
||||
$tr_class = "table-warning";
|
||||
}
|
||||
|
||||
} else {
|
||||
$software_expire_display = "-";
|
||||
$tr_class = '';
|
||||
}
|
||||
|
||||
$software_notes = nullable_htmlentities($row['software_notes']);
|
||||
$software_created_at = nullable_htmlentities($row['software_created_at']);
|
||||
|
||||
$seat_count = 0;
|
||||
|
||||
|
|
@ -158,6 +165,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||
<td><?php echo $software_type; ?></td>
|
||||
<td><?php echo $software_license_type; ?></td>
|
||||
<td><?php echo "$seat_count / $software_seats"; ?></td>
|
||||
<td><?php echo $software_expire_display; ?></td>
|
||||
<td>
|
||||
<div class="dropdown dropleft text-center">
|
||||
<button class="btn btn-secondary btn-sm" data-toggle="dropdown">
|
||||
|
|
|
|||
Loading…
Reference in New Issue