Hide Certain fields on add asset if Asset type is selected under client assets

This commit is contained in:
johnnyq 2022-01-21 15:18:27 -05:00
parent 4d14376370
commit 7327802fb6
2 changed files with 18 additions and 6 deletions

View File

@ -47,7 +47,7 @@
<input type="text" class="form-control" name="name" placeholder="Name the asset" required autofocus>
</div>
</div>
<?php if($_GET['type'] !== 'virtual' AND $_GET['type'] !== 'servers'){ ?>
<div class="form-group">
<label>Type <strong class="text-danger">*</strong></label>
<div class="input-group">
@ -61,8 +61,10 @@
<?php } ?>
</select>
</div>
</div>
</div>
<?php } ?>
<?php if($_GET['type'] !== 'virtual'){ ?>
<div class="form-group">
<label>Make <strong class="text-danger">*</strong></label>
<div class="input-group">
@ -82,7 +84,10 @@
<input type="text" class="form-control" name="model" placeholder="Model Number">
</div>
</div>
<?php } ?>
<?php //Do not display Serial if Virtual is selected
if($_GET['type'] !== 'virtual'){ ?>
<div class="form-group">
<label>Serial Number</label>
<div class="input-group">
@ -92,7 +97,9 @@
<input type="text" class="form-control" name="serial" placeholder="Serial number">
</div>
</div>
<?php } ?>
<?php if($_GET['type'] !== 'network' AND $_GET['type'] !== 'other'){ ?>
<div class="form-group">
<label>Operating System</label>
<div class="input-group">
@ -102,6 +109,7 @@
<input type="text" class="form-control" name="os" placeholder="ex Windows 10 Pro">
</div>
</div>
<?php } ?>
</div>
@ -131,6 +139,7 @@
</div>
</div>
<?php if($_GET['type'] !== 'network' AND $_GET['type'] !== 'servers' AND $_GET['type'] !== 'other'){ ?>
<div class="form-group">
<label>Assigned To</label>
<div class="input-group">
@ -154,6 +163,7 @@
</select>
</div>
</div>
<?php } ?>
<div class="form-group">
<label>Network</label>
@ -239,6 +249,7 @@
</div>
</div>
<?php if($_GET['type'] !== 'virtual'){ ?>
<div class="form-group">
<label>Purchase Date</label>
<div class="input-group">
@ -257,6 +268,7 @@
<input type="date" class="form-control" name="warranty_expire">
</div>
</div>
<?php } ?>
</div>

View File

@ -109,14 +109,14 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<div class="col-md-4">
<div class="input-group mb-3 mb-md-0">
<input type="search" class="form-control" name="q" value="<?php if(isset($q)){echo stripslashes($q);} ?>" placeholder="Search <?php echo ucwords($_GET['tab']); ?>">
<input type="search" class="form-control" name="q" value="<?php if(isset($q)){echo stripslashes($q);} ?>" placeholder="Search">
<div class="input-group-append">
<button class="btn btn-dark"><i class="fa fa-search"></i></button>
</div>
</div>
</div>
<div class="col-sm-6">
<div class="btn-group">
<div class="btn-group btn-group-lg">
<a href="?<?php echo $url_query_strings_sb; ?>&type=%" class="btn <?php if($_GET['type'] == '%' OR empty($_GET['type'])){ echo 'btn-primary'; }else{ echo 'btn-default'; } ?>">All Assets <span class="right badge badge-light"><?php echo $all_count; ?></span></a>
<?php
if($workstation_count > 0){ ?>
@ -174,7 +174,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=asset_os&o=<?php echo $disp; ?>">Operating System</a></th>
<?php } ?>
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=asset_install_date&o=<?php echo $disp; ?>">Install Date</a></th>
<?php if($_GET['type'] !== 'network' AND $_GET['type'] !== 'other'){ ?>
<?php if($_GET['type'] !== 'network' AND $_GET['type'] !== 'servers' AND $_GET['type'] !== 'other'){ ?>
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=contact_name&o=<?php echo $disp; ?>">Contact</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>
@ -325,7 +325,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<td><?php echo $asset_os_display; ?></td>
<?php } ?>
<td><?php echo $asset_install_date_display; ?></td>
<?php if($_GET['type'] !== 'network' AND $_GET['type'] !== 'other'){ ?>
<?php if($_GET['type'] !== 'network' AND $_GET['type'] !== 'other' AND $_GET['type'] !== 'servers'){ ?>
<td><?php echo $contact_name; ?></td>
<?php } ?>
<td><?php echo $location_name; ?></td>