Added Client Asset Status functionality need to work on the names

This commit is contained in:
johnnyq 2022-05-25 16:09:20 -04:00
parent 5052a92f8e
commit 93e45dc7c4
6 changed files with 57 additions and 3 deletions

View File

@ -162,6 +162,21 @@
</div>
<?php } ?>
<div class="form-group">
<label>Status</label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-info"></i></span>
</div>
<select class="form-control select2" name="status">
<option value="">- Status -</option>
<?php foreach($asset_status_array as $asset_status) { ?>
<option><?php echo $asset_status; ?></option>
<?php } ?>
</select>
</div>
</div>
<div class="form-group">
<label>Network</label>
<div class="input-group">

View File

@ -160,6 +160,20 @@
</div>
<?php } ?>
<div class="form-group">
<label>Status</label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-info"></i></span>
</div>
<select class="form-control select2" name="status">
<?php foreach($asset_status_array as $asset_status_select) { ?>
<option <?php if($asset_status_select == $asset_status) { echo "selected"; } ?>><?php echo $asset_status_select; ?></option>
<?php } ?>
</select>
</div>
</div>
<div class="form-group">
<label>Network</label>
<div class="input-group">

View File

@ -161,6 +161,20 @@
</div>
</div>
<div class="form-group">
<label>Status</label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-info"></i></span>
</div>
<select class="form-control select2" name="status">
<?php foreach($asset_status_array as $asset_status_select) { ?>
<option <?php if($asset_status_select == $asset_status) { echo "selected"; } ?>><?php echo $asset_status_select; ?></option>
<?php } ?>
</select>
</div>
</div>
<div class="form-group">
<label>Network</label>
<div class="input-group">

View File

@ -154,6 +154,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=contact_name&o=<?php echo $disp; ?>">Assigned To</a></th>
<?php } ?>
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=location_name&o=<?php echo $disp; ?>">Location</a></th>
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=asset_status&o=<?php echo $disp; ?>">Status</a></th>
<th class="text-center">Action</th>
</tr>
</thead>
@ -185,6 +186,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
$asset_ip_display = "$asset_ip<button class='btn btn-sm' data-clipboard-text='$asset_ip'><i class='far fa-copy text-secondary'></i></button>";
}
$asset_mac = $row['asset_mac'];
$asset_status = $row['asset_status'];
$asset_purchase_date = $row['asset_purchase_date'];
$asset_warranty_expire = $row['asset_warranty_expire'];
$asset_install_date = $row['asset_install_date'];
@ -318,6 +320,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<td><?php echo $contact_name; ?></td>
<?php } ?>
<td><?php echo $location_name; ?></td>
<td><?php echo $asset_status; ?></td>
<td>
<div class="dropdown dropleft text-center">
<button class="btn btn-secondary btn-sm" type="button" data-toggle="dropdown"><i class="fas fa-ellipsis-h"></i></button>

View File

@ -86,7 +86,6 @@ $config_currency_format = "US_en";
// Theme
$config_enable_dark_mode = "dark_mode";
$colors_array = array(
'green',
'olive',
@ -921,4 +920,11 @@ $document_types_array = array(
'2'=>'Global Template'
);
$asset_status_array = array(
'In Storage',
'In Use',
'In Service',
'Retired'
);
?>

View File

@ -4993,6 +4993,7 @@ if(isset($_POST['add_asset'])){
$os = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['os'])));
$ip = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['ip'])));
$mac = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['mac'])));
$status = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['status'])));
$location = intval($_POST['location']);
$vendor = intval($_POST['vendor']);
$contact = intval($_POST['contact']);
@ -5011,7 +5012,7 @@ if(isset($_POST['add_asset'])){
}
$notes = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['notes'])));
mysqli_query($mysqli,"INSERT INTO assets SET asset_name = '$name', asset_type = '$type', asset_make = '$make', asset_model = '$model', asset_serial = '$serial', asset_os = '$os', asset_ip = '$ip', asset_mac = '$mac', asset_location_id = $location, asset_vendor_id = $vendor, asset_contact_id = $contact, asset_purchase_date = '$purchase_date', asset_warranty_expire = '$warranty_expire', asset_install_date = '$install_date', asset_notes = '$notes', asset_network_id = $network, asset_client_id = $client_id, company_id = $session_company_id");
mysqli_query($mysqli,"INSERT INTO assets SET asset_name = '$name', asset_type = '$type', asset_make = '$make', asset_model = '$model', asset_serial = '$serial', asset_os = '$os', asset_ip = '$ip', asset_mac = '$mac', asset_location_id = $location, asset_vendor_id = $vendor, asset_contact_id = $contact, asset_status = '$status', asset_purchase_date = '$purchase_date', asset_warranty_expire = '$warranty_expire', asset_install_date = '$install_date', asset_notes = '$notes', asset_network_id = $network, asset_client_id = $client_id, company_id = $session_company_id");
if(!empty($_POST['username'])) {
$asset_id = mysqli_insert_id($mysqli);
@ -5046,6 +5047,7 @@ if(isset($_POST['edit_asset'])){
$os = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['os'])));
$ip = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['ip'])));
$mac = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['mac'])));
$status = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['status'])));
$location = intval($_POST['location']);
$vendor = intval($_POST['vendor']);
$contact = intval($_POST['contact']);
@ -5066,7 +5068,7 @@ if(isset($_POST['edit_asset'])){
$username = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['username'])));
$password = trim(mysqli_real_escape_string($mysqli,encryptLoginEntry($_POST['password'])));
mysqli_query($mysqli,"UPDATE assets SET asset_name = '$name', asset_type = '$type', asset_make = '$make', asset_model = '$model', asset_serial = '$serial', asset_os = '$os', asset_ip = '$ip', asset_mac = '$mac', asset_location_id = $location, asset_vendor_id = $vendor, asset_contact_id = $contact, asset_purchase_date = '$purchase_date', asset_warranty_expire = '$warranty_expire', asset_install_date = '$install_date', asset_notes = '$notes', asset_network_id = $network WHERE asset_id = $asset_id AND company_id = $session_company_id");
mysqli_query($mysqli,"UPDATE assets SET asset_name = '$name', asset_type = '$type', asset_make = '$make', asset_model = '$model', asset_serial = '$serial', asset_os = '$os', asset_ip = '$ip', asset_mac = '$mac', asset_location_id = $location, asset_vendor_id = $vendor, asset_contact_id = $contact, asset_status = '$status', asset_purchase_date = '$purchase_date', asset_warranty_expire = '$warranty_expire', asset_install_date = '$install_date', asset_notes = '$notes', asset_network_id = $network WHERE asset_id = $asset_id AND company_id = $session_company_id");
//If login exists then update the login
if($login_id > 0){