Show 'none' for assets where warranty isn't set

This commit is contained in:
Marcus Hill
2022-02-27 17:40:11 +00:00
parent e481accb79
commit ea7f11f35f

View File

@@ -148,17 +148,21 @@ if(isset($_GET['ticket_id'])){
} }
$client_tags_display = implode(' ', $client_tag_name_display_array); $client_tags_display = implode(' ', $client_tag_name_display_array);
// Get the asset warranty expiry // Get & format asset warranty expiry
$date = date('Y-m-d H:i:s'); $date = date('Y-m-d H:i:s');
$dt_value = $asset_warranty_expire; //sample date $dt_value = $asset_warranty_expire; //sample date
$warranty_check = date('m/d/Y',strtotime('-8 hours')); $warranty_check = date('m/d/Y',strtotime('-8 hours'));
if($dt_value <= $date){ if($dt_value <= $date){
$dt_value = "Expired on $asset_warranty_expire"; $color ='red'; $dt_value = "Expired on $asset_warranty_expire"; $warranty_status_color ='red';
}else{ }else{
$color = 'green'; $warranty_status_color = 'green';
} }
if($asset_warranty_expire == '0000-00-00'){
$dt_value = "None"; $warranty_status_color ='red';
}
?> ?>
@@ -423,34 +427,30 @@ if(isset($_GET['ticket_id'])){
<!-- Ticket asset details card --> <!-- Ticket asset details card -->
<?php if(!empty($asset_id)){ ?> <?php if(!empty($asset_id)){ ?>
<div class="card card-body card-outline card-dark mb-3"> <div class="card card-body card-outline card-dark mb-3">
<div> <div>
<h4 class="text-secondary">Asset</h4> <h4 class="text-secondary">Asset</h4>
<i class="fa fa-fw fa-desktop text-secondary ml-1 mr-2 mb-2"></i> Asset name: <strong><?php echo $asset_name; ?></strong> <i class="fa fa-fw fa-desktop text-secondary ml-1 mr-2 mb-2"></i> Asset name: <strong><?php echo $asset_name; ?></strong>
<br>
<?php
if(!empty($asset_os)) {
?>
<i class="fa fa-fw fa-tag text-secondary ml-1 mr-2 mb-2"></i> OS: <?php echo $asset_os; ?>
<br> <br>
<?php
if (!empty($asset_ip)) { <?php if(!empty($asset_os)) { ?>
?> <i class="fa fa-fw fa-tag text-secondary ml-1 mr-2 mb-2"></i> OS: <?php echo $asset_os; ?>
<br>
<?php
}
if (!empty($asset_ip)) { ?>
<i class="fa fa-fw fa-network-wired text-secondary ml-1 mr-2 mb-2"></i> IP: <?php echo "$asset_ip"; ?> <i class="fa fa-fw fa-network-wired text-secondary ml-1 mr-2 mb-2"></i> IP: <?php echo "$asset_ip"; ?>
<br> <br>
<?php <?php
} }
?>
<?php if (!empty($asset_make)) { ?>
if (!empty($asset_make)) {
?>
<i class="fa fa-fw fa-tag text-secondary ml-1 mr-2 mb-2"></i> Model: <?php echo "$asset_make $asset_model"; ?> <i class="fa fa-fw fa-tag text-secondary ml-1 mr-2 mb-2"></i> Model: <?php echo "$asset_make $asset_model"; ?>
<br> <br>
<?php <?php
} }
?>
<?php
if (!empty($asset_serial)) { if (!empty($asset_serial)) {
?> ?>
<i class="fa fa-fw fa-barcode text-secondary ml-1 mr-2 mb-2"></i> Service Tag: <?php echo $asset_serial; ?> <i class="fa fa-fw fa-barcode text-secondary ml-1 mr-2 mb-2"></i> Service Tag: <?php echo $asset_serial; ?>
@@ -458,21 +458,17 @@ if(isset($_GET['ticket_id'])){
<?php <?php
} }
?>
<?php
if (!empty($asset_warranty_expire)) { if (!empty($asset_warranty_expire)) {
?> ?>
<i class="fa fa-fw fa-tag text-secondary ml-1 mr-2 mb-2"></i> Warranty expire: <strong><font <i class="fa fa-fw fa-tag text-secondary ml-1 mr-2 mb-2"></i> Warranty expires: <strong><font color="<?php echo $warranty_status_color ?>"> <?php echo $dt_value ?></font></strong>
color="<?php echo $color ?>"> <?php echo $dt_value ?></font></strong>
<br> <br>
<?php <?php
} }
} ?>
?>
</div> </div>
</div> </div>
<?php } ?>
<?php } ?>
<form action="post.php" method="post"> <form action="post.php" method="post">
<input type="hidden" name="ticket_id" value="<?php echo $ticket_id; ?>"> <input type="hidden" name="ticket_id" value="<?php echo $ticket_id; ?>">