Migrate Add Asset to the new ajax-modal
This commit is contained in:
@@ -37,17 +37,23 @@ enforceUserPermission('module_support');
|
|||||||
//Asset Type from GET
|
//Asset Type from GET
|
||||||
if (isset($_GET['type']) && ($_GET['type']) == 'workstation') {
|
if (isset($_GET['type']) && ($_GET['type']) == 'workstation') {
|
||||||
$type_query = "asset_type = 'desktop' OR asset_type = 'laptop'";
|
$type_query = "asset_type = 'desktop' OR asset_type = 'laptop'";
|
||||||
|
$type_filter = "workstation";
|
||||||
} elseif (isset($_GET['type']) && ($_GET['type']) == 'server') {
|
} elseif (isset($_GET['type']) && ($_GET['type']) == 'server') {
|
||||||
$type_query = "asset_type = 'server'";
|
$type_query = "asset_type = 'server'";
|
||||||
|
$type_filter = "server";
|
||||||
} elseif (isset($_GET['type']) && ($_GET['type']) == 'virtual') {
|
} elseif (isset($_GET['type']) && ($_GET['type']) == 'virtual') {
|
||||||
$type_query = "asset_type = 'Virtual Machine'";
|
$type_query = "asset_type = 'Virtual Machine'";
|
||||||
|
$type_filter = "virtual";
|
||||||
} elseif (isset($_GET['type']) && ($_GET['type']) == 'network') {
|
} elseif (isset($_GET['type']) && ($_GET['type']) == 'network') {
|
||||||
$type_query = "asset_type = 'Firewall/Router' OR asset_type = 'Switch' OR asset_type = 'Access Point'";
|
$type_query = "asset_type = 'Firewall/Router' OR asset_type = 'Switch' OR asset_type = 'Access Point'";
|
||||||
|
$type_filter = "network";
|
||||||
} elseif (isset($_GET['type']) && ($_GET['type']) == 'other') {
|
} elseif (isset($_GET['type']) && ($_GET['type']) == 'other') {
|
||||||
$type_query = "asset_type NOT LIKE 'laptop' AND asset_type NOT LIKE 'desktop' AND asset_type NOT LIKE 'server' AND asset_type NOT LIKE 'virtual machine' AND asset_type NOT LIKE 'firewall/router' AND asset_type NOT LIKE 'switch' AND asset_type NOT LIKE 'access point'";
|
$type_query = "asset_type NOT LIKE 'laptop' AND asset_type NOT LIKE 'desktop' AND asset_type NOT LIKE 'server' AND asset_type NOT LIKE 'virtual machine' AND asset_type NOT LIKE 'firewall/router' AND asset_type NOT LIKE 'switch' AND asset_type NOT LIKE 'access point'";
|
||||||
|
$type_filter = "other";
|
||||||
} else {
|
} else {
|
||||||
$type_query = "asset_type LIKE '%'";
|
$type_query = "asset_type LIKE '%'";
|
||||||
$_GET['type'] = '';
|
$_GET['type'] = '';
|
||||||
|
$type_filter = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$client_url) {
|
if (!$client_url) {
|
||||||
@@ -133,19 +139,6 @@ $sql = mysqli_query(
|
|||||||
|
|
||||||
$num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
$num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||||
|
|
||||||
|
|
||||||
// OS typeahead suggestions
|
|
||||||
$os_sql = mysqli_query($mysqli, "SELECT DISTINCT asset_os AS label FROM assets WHERE asset_archived_at IS NULL");
|
|
||||||
if ($os_sql && mysqli_num_rows($os_sql) > 0) {
|
|
||||||
$os_arr = [];
|
|
||||||
while ($row = mysqli_fetch_assoc($os_sql)) {
|
|
||||||
// jQuery UI Autocomplete expects {label: "...", value: "..."}
|
|
||||||
$label = $row['label'];
|
|
||||||
$os_arr[] = ['label' => $label, 'value' => $label];
|
|
||||||
}
|
|
||||||
$json_os = json_encode($os_arr);
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<div class="col-sm-12 mb-3">
|
<div class="col-sm-12 mb-3">
|
||||||
@@ -185,8 +178,8 @@ if ($os_sql && mysqli_num_rows($os_sql) > 0) {
|
|||||||
<div class="card-tools">
|
<div class="card-tools">
|
||||||
<?php if (lookupUserPermission("module_support") >= 2) { ?>
|
<?php if (lookupUserPermission("module_support") >= 2) { ?>
|
||||||
<div class="btn-group">
|
<div class="btn-group">
|
||||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addAssetModal">
|
<button type="button" class="btn btn-primary ajax-modal" data-modal-url="modals/asset/asset_add.php?<?= $client_url ?>&type=<?= $type_filter ?>">
|
||||||
<i class="fas fa-plus mr-2"></i>New <?php if (!empty($_GET['type'])) { echo ucwords(strip_tags(nullable_htmlentities($_GET['type']))); } else { echo "Asset"; } ?>
|
<i class="fas fa-plus mr-2"></i>New <?php if ($type_filter) { echo ucwords($type_filter); } else { echo "Asset"; } ?>
|
||||||
</button>
|
</button>
|
||||||
<button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown"></button>
|
<button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown"></button>
|
||||||
<div class="dropdown-menu">
|
<div class="dropdown-menu">
|
||||||
@@ -716,24 +709,7 @@ if ($os_sql && mysqli_num_rows($os_sql) > 0) {
|
|||||||
|
|
||||||
<script src="../js/bulk_actions.js"></script>
|
<script src="../js/bulk_actions.js"></script>
|
||||||
|
|
||||||
<!-- JSON Autocomplete / type ahead -->
|
|
||||||
<link rel="stylesheet" href="../plugins/jquery-ui/jquery-ui.min.css">
|
|
||||||
<script src="../plugins/jquery-ui/jquery-ui.min.js"></script>
|
|
||||||
<script>
|
|
||||||
$(function() {
|
|
||||||
var operatingSystems = <?php echo $json_os; ?>;
|
|
||||||
$("#os").autocomplete({
|
|
||||||
source: operatingSystems, // Should be an array of objects with 'label' and 'value'
|
|
||||||
select: function(event, ui) {
|
|
||||||
$("#os").val(ui.item.label); // Set the input field value to the selected label
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
require_once "modals/asset/asset_add.php";
|
|
||||||
require_once "modals/asset/asset_export.php";
|
require_once "modals/asset/asset_export.php";
|
||||||
if ($client_url) {
|
if ($client_url) {
|
||||||
require_once "modals/asset/asset_import.php";
|
require_once "modals/asset/asset_import.php";
|
||||||
|
|||||||
@@ -263,7 +263,7 @@ if (isset($_GET['contact_id'])) {
|
|||||||
<i class="fa fa-fw fa-recycle mr-2"></i>New Recurring Ticket
|
<i class="fa fa-fw fa-recycle mr-2"></i>New Recurring Ticket
|
||||||
</a>
|
</a>
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#addAssetModal">
|
<a class="dropdown-item text-dark ajax-modal" href="#" data-modal-url="modals/asset/asset_add.php?<?= $client_url ?>&contact_id=<?= $contact_id ?>">
|
||||||
<i class="fa fa-fw fa-desktop mr-2"></i>New Asset
|
<i class="fa fa-fw fa-desktop mr-2"></i>New Asset
|
||||||
</a>
|
</a>
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
@@ -1175,7 +1175,6 @@ if (isset($_GET['contact_id'])) {
|
|||||||
|
|
||||||
require_once "modals/ticket/ticket_add.php";
|
require_once "modals/ticket/ticket_add.php";
|
||||||
require_once "modals/recurring_ticket/recurring_ticket_add.php";
|
require_once "modals/recurring_ticket/recurring_ticket_add.php";
|
||||||
require_once "modals/asset/asset_add.php";
|
|
||||||
require_once "modals/credential/credential_add.php";
|
require_once "modals/credential/credential_add.php";
|
||||||
require_once "modals/document/document_add.php";
|
require_once "modals/document/document_add.php";
|
||||||
require_once "modals/file/file_upload.php";
|
require_once "modals/file/file_upload.php";
|
||||||
|
|||||||
@@ -1,15 +1,44 @@
|
|||||||
<div class="modal" id="addAssetModal" tabindex="-1">
|
<?php
|
||||||
<div class="modal-dialog">
|
|
||||||
<div class="modal-content">
|
require_once '../../../includes/modal_header.php';
|
||||||
<div class="modal-header bg-dark">
|
|
||||||
<h5 class="modal-title"><i class="fa fa-fw fa-desktop mr-2"></i>New <?php if (!empty($_GET['type'])) { echo ucwords(strip_tags($_GET['type'])); }else{ echo "Asset"; } ?></h5>
|
$client_id = intval($_GET['client_id'] ?? 0);
|
||||||
|
$contact_id = intval($_GET['contact_id'] ?? 0);
|
||||||
|
$type = nullable_htmlentities($_GET['type'] ?? '');
|
||||||
|
|
||||||
|
if ($client_id) {
|
||||||
|
$sql_network_select = mysqli_query($mysqli, "SELECT * FROM networks WHERE network_archived_at IS NULL AND network_client_id = $client_id ORDER BY network_name ASC");
|
||||||
|
$sql_vendor_select = mysqli_query($mysqli, "SELECT * FROM vendors WHERE vendor_archived_at IS NULL AND vendor_client_id = $client_id ORDER BY vendor_name ASC");
|
||||||
|
$sql_location_select = mysqli_query($mysqli, "SELECT location_id, location_name FROM locations WHERE location_archived_at IS NULL AND location_client_id = $client_id ORDER BY location_name ASC");
|
||||||
|
$sql_contact_select = mysqli_query($mysqli, "SELECT * FROM contacts WHERE contact_archived_at IS NULL AND contact_client_id = $client_id ORDER BY contact_name ASC");
|
||||||
|
} else {
|
||||||
|
$sql_client_select = mysqli_query($mysqli, "SELECT client_id, client_name FROM clients WHERE client_archived_at IS NULL $access_permission_query ORDER BY client_name ASC");
|
||||||
|
}
|
||||||
|
|
||||||
|
// OS typeahead suggestions
|
||||||
|
$os_sql = mysqli_query($mysqli, "SELECT DISTINCT asset_os AS label FROM assets WHERE asset_archived_at IS NULL");
|
||||||
|
if ($os_sql && mysqli_num_rows($os_sql) > 0) {
|
||||||
|
$os_arr = [];
|
||||||
|
while ($row = mysqli_fetch_assoc($os_sql)) {
|
||||||
|
// jQuery UI Autocomplete expects {label: "...", value: "..."}
|
||||||
|
$label = $row['label'];
|
||||||
|
$os_arr[] = ['label' => $label, 'value' => $label];
|
||||||
|
}
|
||||||
|
$json_os = json_encode($os_arr);
|
||||||
|
}
|
||||||
|
|
||||||
|
ob_start();
|
||||||
|
|
||||||
|
?>
|
||||||
|
<div class="modal-header bg-dark">
|
||||||
|
<h5 class="modal-title"><i class="fa fa-fw fa-desktop mr-2"></i>New <?php if ($type) { echo ucwords($type); } else { echo "Asset"; } ?></h5>
|
||||||
<button type="button" class="close text-white" data-dismiss="modal">
|
<button type="button" class="close text-white" data-dismiss="modal">
|
||||||
<span>×</span>
|
<span>×</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<form action="post.php" method="post" enctype="multipart/form-data" autocomplete="off">
|
<form action="post.php" method="post" enctype="multipart/form-data" autocomplete="off">
|
||||||
<input type="hidden" name="csrf_token" value="<?php echo $_SESSION['csrf_token'] ?>">
|
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
||||||
|
|
||||||
<div class="modal-body ui-front">
|
<div class="modal-body ui-front">
|
||||||
|
|
||||||
@@ -40,8 +69,8 @@
|
|||||||
|
|
||||||
<div class="tab-pane fade show active" id="pills-asset-details">
|
<div class="tab-pane fade show active" id="pills-asset-details">
|
||||||
|
|
||||||
<?php if ($client_url) { ?>
|
<?php if ($client_id) { ?>
|
||||||
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
|
<input type="hidden" name="client_id" value="<?= $client_id ?>">
|
||||||
<?php } else { ?>
|
<?php } else { ?>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
@@ -54,11 +83,10 @@
|
|||||||
<option value="">- Select Client -</option>
|
<option value="">- Select Client -</option>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$sql = mysqli_query($mysqli, "SELECT client_id, client_name FROM clients WHERE client_archived_at IS NULL $access_permission_query ORDER BY client_name ASC");
|
while ($row = mysqli_fetch_array($sql_client_select)) {
|
||||||
while ($row = mysqli_fetch_array($sql)) {
|
$client_id_select = intval($row['client_id']);
|
||||||
$client_id = intval($row['client_id']);
|
|
||||||
$client_name = nullable_htmlentities($row['client_name']); ?>
|
$client_name = nullable_htmlentities($row['client_name']); ?>
|
||||||
<option <?php if ($client_id == isset($_GET['client'])) { echo "selected"; } ?> value="<?php echo $client_id; ?>"><?php echo $client_name; ?></option>
|
<option <?php if ($client_id == $client_id_select) { echo "selected"; } ?> value="<?= $client_id_select ?>"><?= $client_name ?></option>
|
||||||
|
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</select>
|
</select>
|
||||||
@@ -96,14 +124,14 @@
|
|||||||
<select class="form-control select2" name="type" required>
|
<select class="form-control select2" name="type" required>
|
||||||
<option value="">- Select Type -</option>
|
<option value="">- Select Type -</option>
|
||||||
<?php foreach($asset_types_array as $asset_type => $asset_icon) { ?>
|
<?php foreach($asset_types_array as $asset_type => $asset_icon) { ?>
|
||||||
<option><?php echo $asset_type; ?></option>
|
<option><?= $asset_type ?></option>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php //Do not display Make Model or Serial if Virtual is selected
|
<?php //Do not display Make Model or Serial if Virtual is selected
|
||||||
if ($_GET['type'] !== 'virtual') { ?>
|
if ($type !== 'virtual') { ?>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Make</label>
|
<label>Make</label>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
@@ -135,7 +163,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
<?php if ($_GET['type'] !== 'network' && $_GET['type'] !== 'other') { ?>
|
<?php if ($type !== 'network' && $type !== 'other') { ?>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Operating System</label>
|
<label>Operating System</label>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
@@ -150,7 +178,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="tab-pane fade" id="pills-asset-network">
|
<div class="tab-pane fade" id="pills-asset-network">
|
||||||
<?php if ($client_url) { ?>
|
<?php if ($client_id) { ?>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Network</label>
|
<label>Network</label>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
@@ -161,14 +189,13 @@
|
|||||||
<option value="">- Select Network -</option>
|
<option value="">- Select Network -</option>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$sql = mysqli_query($mysqli, "SELECT * FROM networks WHERE network_archived_at IS NULL AND network_client_id = $client_id ORDER BY network_name ASC");
|
while ($row = mysqli_fetch_array($sql_network_select)) {
|
||||||
while ($row = mysqli_fetch_array($sql)) {
|
|
||||||
$network_id = intval($row['network_id']);
|
$network_id = intval($row['network_id']);
|
||||||
$network_name = nullable_htmlentities($row['network_name']);
|
$network_name = nullable_htmlentities($row['network_name']);
|
||||||
$network = nullable_htmlentities($row['network']);
|
$network = nullable_htmlentities($row['network']);
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<option value="<?php echo $network_id; ?>"><?php echo $network_name; ?> - <?php echo $network; ?></option>
|
<option value="<?= $network_id ?>"><?= $network_name ?> - <?= $network ?></option>
|
||||||
|
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</select>
|
</select>
|
||||||
@@ -265,7 +292,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php if ($client_url) { ?>
|
<?php if ($client_id) { ?>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Location</label>
|
<label>Location</label>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
@@ -276,12 +303,11 @@
|
|||||||
<option value="">- Select Location -</option>
|
<option value="">- Select Location -</option>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$sql = mysqli_query($mysqli, "SELECT * FROM locations WHERE location_archived_at IS NULL AND location_client_id = $client_id ORDER BY location_name ASC");
|
while ($row = mysqli_fetch_array($sql_location_select)) {
|
||||||
while ($row = mysqli_fetch_array($sql)) {
|
|
||||||
$location_id = intval($row['location_id']);
|
$location_id = intval($row['location_id']);
|
||||||
$location_name = nullable_htmlentities($row['location_name']);
|
$location_name = nullable_htmlentities($row['location_name']);
|
||||||
?>
|
?>
|
||||||
<option value="<?php echo $location_id; ?>"><?php echo $location_name; ?></option>
|
<option value="<?= $location_id ?>"><?= $location_name ?></option>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
@@ -298,16 +324,15 @@
|
|||||||
<option value="">- Select Contact -</option>
|
<option value="">- Select Contact -</option>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$sql = mysqli_query($mysqli, "SELECT * FROM contacts WHERE contact_archived_at IS NULL AND contact_client_id = $client_id ORDER BY contact_name ASC");
|
while ($row = mysqli_fetch_array($sql_contact_select)) {
|
||||||
while ($row = mysqli_fetch_array($sql)) {
|
$contact_id_select = intval($row['contact_id']);
|
||||||
$contact_id = intval($row['contact_id']);
|
|
||||||
$contact_name = nullable_htmlentities($row['contact_name']);
|
$contact_name = nullable_htmlentities($row['contact_name']);
|
||||||
?>
|
?>
|
||||||
<option
|
<option
|
||||||
<?php if (isset($_GET['contact_id']) && $contact_id == intval($_GET['contact_id'])) {
|
<?php if ($contact_id == $contact_id_select) {
|
||||||
echo "selected"; }
|
echo "selected"; }
|
||||||
?>
|
?>
|
||||||
value="<?php echo $contact_id; ?>"><?php echo $contact_name; ?>
|
value="<?= $contact_id_select ?>"><?= $contact_name ?>
|
||||||
</option>
|
</option>
|
||||||
|
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
@@ -336,7 +361,7 @@
|
|||||||
|
|
||||||
<div class="tab-pane fade" id="pills-asset-purchase">
|
<div class="tab-pane fade" id="pills-asset-purchase">
|
||||||
|
|
||||||
<?php if ($client_url) { ?>
|
<?php if ($client_id) { ?>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Vendor</label>
|
<label>Vendor</label>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
@@ -347,8 +372,7 @@
|
|||||||
<option value="">- Select Vendor -</option>
|
<option value="">- Select Vendor -</option>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$sql = mysqli_query($mysqli, "SELECT * FROM vendors WHERE vendor_archived_at IS NULL AND vendor_client_id = $client_id ORDER BY vendor_name ASC");
|
while ($row = mysqli_fetch_array($sql_vendor_select)) {
|
||||||
while ($row = mysqli_fetch_array($sql)) {
|
|
||||||
$vendor_id = intval($row['vendor_id']);
|
$vendor_id = intval($row['vendor_id']);
|
||||||
$vendor_name = nullable_htmlentities($row['vendor_name']);
|
$vendor_name = nullable_htmlentities($row['vendor_name']);
|
||||||
?>
|
?>
|
||||||
@@ -360,7 +384,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
<?php if ($_GET['type'] !== 'virtual') { ?>
|
<?php if ($type !== 'virtual') { ?>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Purchase Reference</label>
|
<label>Purchase Reference</label>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
@@ -392,7 +416,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php if ($_GET['type'] !== 'virtual') { ?>
|
<?php if ($type !== 'virtual') { ?>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Warranty Expire</label>
|
<label>Warranty Expire</label>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
@@ -449,7 +473,24 @@
|
|||||||
<button type="submit" name="add_asset" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Create</button>
|
<button type="submit" name="add_asset" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Create</button>
|
||||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
|
||||||
</div>
|
<!-- JSON Autocomplete / type ahead -->
|
||||||
</div>
|
<link rel="stylesheet" href="/plugins/jquery-ui/jquery-ui.min.css">
|
||||||
|
<script src="/plugins/jquery-ui/jquery-ui.min.js"></script>
|
||||||
|
<script>
|
||||||
|
$(function() {
|
||||||
|
var operatingSystems = <?php echo $json_os; ?>;
|
||||||
|
$("#os").autocomplete({
|
||||||
|
source: operatingSystems, // Should be an array of objects with 'label' and 'value'
|
||||||
|
select: function(event, ui) {
|
||||||
|
$("#os").val(ui.item.label); // Set the input field value to the selected label
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../../../includes/modal_footer.php';
|
||||||
|
|||||||
@@ -53,37 +53,38 @@ $sql_asset_history = mysqli_query($mysqli, "SELECT * FROM asset_history
|
|||||||
// Generate the HTML form content using output buffering.
|
// Generate the HTML form content using output buffering.
|
||||||
ob_start();
|
ob_start();
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<div class="modal-header bg-dark">
|
<div class="modal-header bg-dark">
|
||||||
<h5 class="modal-title"><i class='fa fa-fw fa-<?php echo $device_icon; ?> mr-2'></i>Editing asset: <strong><?php echo $asset_name; ?></strong></h5>
|
<h5 class="modal-title"><i class='fa fa-fw fa-<?= $device_icon ?> mr-2'></i>Editing asset: <strong><?= $asset_name ?></strong></h5>
|
||||||
<button type="button" class="close text-white" data-dismiss="modal">
|
<button type="button" class="close text-white" data-dismiss="modal">
|
||||||
<span>×</span>
|
<span>×</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<form action="post.php" method="post" enctype="multipart/form-data" autocomplete="off">
|
<form action="post.php" method="post" enctype="multipart/form-data" autocomplete="off">
|
||||||
<input type="hidden" name="csrf_token" value="<?php echo $_SESSION['csrf_token'] ?>">
|
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
||||||
<input type="hidden" name="asset_id" value="<?php echo $asset_id; ?>">
|
<input type="hidden" name="asset_id" value="<?= $asset_id ?>">
|
||||||
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
|
<input type="hidden" name="client_id" value="<?= $client_id ?>">
|
||||||
|
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
|
|
||||||
<ul class="nav nav-pills nav-justified mb-3">
|
<ul class="nav nav-pills nav-justified mb-3">
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link active" data-toggle="pill" href="#pills-details<?php echo $asset_id; ?>">Details</a>
|
<a class="nav-link active" data-toggle="pill" href="#pills-details">Details</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" data-toggle="pill" href="#pills-network<?php echo $asset_id; ?>">Network</a>
|
<a class="nav-link" data-toggle="pill" href="#pills-network">Network</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" data-toggle="pill" href="#pills-assignment<?php echo $asset_id; ?>">Assignment</a>
|
<a class="nav-link" data-toggle="pill" href="#pills-assignment">Assignment</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" data-toggle="pill" href="#pills-purchase<?php echo $asset_id; ?>">Purchase</a>
|
<a class="nav-link" data-toggle="pill" href="#pills-purchase">Purchase</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" data-toggle="pill" href="#pills-notes<?php echo $asset_id; ?>">Notes</a>
|
<a class="nav-link" data-toggle="pill" href="#pills-notes">Notes</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" data-toggle="pill" href="#pills-history<?php echo $asset_id; ?>">History</a>
|
<a class="nav-link" data-toggle="pill" href="#pills-history">History</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
@@ -91,7 +92,7 @@ ob_start();
|
|||||||
|
|
||||||
<div class="tab-content" <?php if (lookupUserPermission('module_support') <= 1) { echo 'inert'; } ?>>
|
<div class="tab-content" <?php if (lookupUserPermission('module_support') <= 1) { echo 'inert'; } ?>>
|
||||||
|
|
||||||
<div class="tab-pane fade show active" id="pills-details<?php echo $asset_id; ?>">
|
<div class="tab-pane fade show active" id="pills-details">
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Name <strong class="text-danger">*</strong></label>
|
<label>Name <strong class="text-danger">*</strong></label>
|
||||||
@@ -99,7 +100,7 @@ ob_start();
|
|||||||
<div class="input-group-prepend">
|
<div class="input-group-prepend">
|
||||||
<span class="input-group-text"><i class="fa fa-fw fa-tag"></i></span>
|
<span class="input-group-text"><i class="fa fa-fw fa-tag"></i></span>
|
||||||
</div>
|
</div>
|
||||||
<input type="text" class="form-control" name="name" placeholder="Name the asset" maxlength="200" value="<?php echo $asset_name; ?>" required>
|
<input type="text" class="form-control" name="name" placeholder="Name the asset" maxlength="200" value="<?= $asset_name ?>" required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -109,7 +110,7 @@ ob_start();
|
|||||||
<div class="input-group-prepend">
|
<div class="input-group-prepend">
|
||||||
<span class="input-group-text"><i class="fa fa-fw fa-angle-right"></i></span>
|
<span class="input-group-text"><i class="fa fa-fw fa-angle-right"></i></span>
|
||||||
</div>
|
</div>
|
||||||
<input type="text" class="form-control" name="description" placeholder="Description of the asset" maxlength="255" value="<?php echo $asset_description; ?>">
|
<input type="text" class="form-control" name="description" placeholder="Description of the asset" maxlength="255" value="<?= $asset_description ?>">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -135,7 +136,7 @@ ob_start();
|
|||||||
<div class="input-group-prepend">
|
<div class="input-group-prepend">
|
||||||
<span class="input-group-text"><i class="fa fa-fw fa-tag"></i></span>
|
<span class="input-group-text"><i class="fa fa-fw fa-tag"></i></span>
|
||||||
</div>
|
</div>
|
||||||
<input type="text" class="form-control" name="make" placeholder="Manufacturer" maxlength="200" value="<?php echo $asset_make; ?>">
|
<input type="text" class="form-control" name="make" placeholder="Manufacturer" maxlength="200" value="<?= $asset_make ?>">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -145,7 +146,7 @@ ob_start();
|
|||||||
<div class="input-group-prepend">
|
<div class="input-group-prepend">
|
||||||
<span class="input-group-text"><i class="fa fa-fw fa-tag"></i></span>
|
<span class="input-group-text"><i class="fa fa-fw fa-tag"></i></span>
|
||||||
</div>
|
</div>
|
||||||
<input type="text" class="form-control" name="model" placeholder="Model Number" maxlength="200" value="<?php echo $asset_model; ?>">
|
<input type="text" class="form-control" name="model" placeholder="Model Number" maxlength="200" value="<?= $asset_model ?>">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -155,7 +156,7 @@ ob_start();
|
|||||||
<div class="input-group-prepend">
|
<div class="input-group-prepend">
|
||||||
<span class="input-group-text"><i class="fa fa-fw fa-barcode"></i></span>
|
<span class="input-group-text"><i class="fa fa-fw fa-barcode"></i></span>
|
||||||
</div>
|
</div>
|
||||||
<input type="text" class="form-control" name="serial" placeholder="Serial number" maxlength="200" value="<?php echo $asset_serial; ?>">
|
<input type="text" class="form-control" name="serial" placeholder="Serial number" maxlength="200" value="<?= $asset_serial ?>">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
@@ -167,14 +168,14 @@ ob_start();
|
|||||||
<div class="input-group-prepend">
|
<div class="input-group-prepend">
|
||||||
<span class="input-group-text"><i class="fab fa-fw fa-windows"></i></span>
|
<span class="input-group-text"><i class="fab fa-fw fa-windows"></i></span>
|
||||||
</div>
|
</div>
|
||||||
<input type="text" class="form-control" name="os" placeholder="ex Windows 10 Pro" maxlength="200" value="<?php echo $asset_os; ?>">
|
<input type="text" class="form-control" name="os" id="os" placeholder="ex Windows 10 Pro" maxlength="200" value="<?= $asset_os ?>">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="tab-pane fade" id="pills-network<?php echo $asset_id; ?>">
|
<div class="tab-pane fade" id="pills-network">
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Network</label>
|
<label>Network</label>
|
||||||
@@ -227,7 +228,7 @@ ob_start();
|
|||||||
<div class="input-group-prepend">
|
<div class="input-group-prepend">
|
||||||
<span class="input-group-text"><i class="fa fa-fw fa-random"></i></span>
|
<span class="input-group-text"><i class="fa fa-fw fa-random"></i></span>
|
||||||
</div>
|
</div>
|
||||||
<input type="text" class="form-control" name="nat_ip" value="<?php echo $asset_nat_ip; ?>" placeholder="10.52.4.55" data-inputmask="'alias': 'ip'" maxlength="200" data-mask>
|
<input type="text" class="form-control" name="nat_ip" value="<?= $asset_nat_ip ?>" placeholder="10.52.4.55" data-inputmask="'alias': 'ip'" maxlength="200" data-mask>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -237,7 +238,7 @@ ob_start();
|
|||||||
<div class="input-group-prepend">
|
<div class="input-group-prepend">
|
||||||
<span class="input-group-text"><i class="fa fa-fw fa-ethernet"></i></span>
|
<span class="input-group-text"><i class="fa fa-fw fa-ethernet"></i></span>
|
||||||
</div>
|
</div>
|
||||||
<input type="text" class="form-control" name="ipv6" value="<?php echo $asset_ipv6; ?>" placeholder="ex. 2001:0db8:0000:0000:0000:ff00:0042:8329" maxlength="200">
|
<input type="text" class="form-control" name="ipv6" value="<?= $asset_ipv6 ?>" placeholder="ex. 2001:0db8:0000:0000:0000:ff00:0042:8329" maxlength="200">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -247,7 +248,7 @@ ob_start();
|
|||||||
<div class="input-group-prepend">
|
<div class="input-group-prepend">
|
||||||
<span class="input-group-text"><i class="fa fa-fw fa-ethernet"></i></span>
|
<span class="input-group-text"><i class="fa fa-fw fa-ethernet"></i></span>
|
||||||
</div>
|
</div>
|
||||||
<input type="text" class="form-control" name="mac" value="<?php echo $asset_mac; ?>" placeholder="MAC Address" data-inputmask="'alias': 'mac'" maxlength="200" data-mask>
|
<input type="text" class="form-control" name="mac" value="<?= $asset_mac ?>" placeholder="MAC Address" data-inputmask="'alias': 'mac'" maxlength="200" data-mask>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -257,7 +258,7 @@ ob_start();
|
|||||||
<div class="input-group-prepend">
|
<div class="input-group-prepend">
|
||||||
<span class="input-group-text"><i class="fa fa-fw fa-globe"></i></span>
|
<span class="input-group-text"><i class="fa fa-fw fa-globe"></i></span>
|
||||||
</div>
|
</div>
|
||||||
<input type="text" class="form-control" name="uri" placeholder="URI http:// ftp:// ssh: etc" maxlength="500" value="<?php echo $asset_uri; ?>">
|
<input type="text" class="form-control" name="uri" placeholder="URI http:// ftp:// ssh: etc" maxlength="500" value="<?= $asset_uri ?>">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -282,7 +283,7 @@ ob_start();
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="tab-pane fade" id="pills-assignment<?php echo $asset_id; ?>">
|
<div class="tab-pane fade" id="pills-assignment">
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Physical Location</label>
|
<label>Physical Location</label>
|
||||||
@@ -290,7 +291,7 @@ ob_start();
|
|||||||
<div class="input-group-prepend">
|
<div class="input-group-prepend">
|
||||||
<span class="input-group-text"><i class="fa fa-fw fa-map-marker-alt"></i></span>
|
<span class="input-group-text"><i class="fa fa-fw fa-map-marker-alt"></i></span>
|
||||||
</div>
|
</div>
|
||||||
<input type="text" class="form-control" name="physical_location" placeholder="Physical location eg. Floor 2, Closet B" maxlength="200" value="<?php echo $asset_physical_location; ?>">
|
<input type="text" class="form-control" name="physical_location" placeholder="Physical location eg. Floor 2, Closet B" maxlength="200" value="<?= $asset_physical_location ?>">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -315,7 +316,7 @@ ob_start();
|
|||||||
$location_name_select_display = $location_name_select;
|
$location_name_select_display = $location_name_select;
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<option <?php if ($asset_location_id == $location_id_select) { echo "selected"; } ?> value="<?php echo $location_id_select; ?>"><?php echo $location_name_select_display; ?></option>
|
<option <?php if ($asset_location_id == $location_id_select) { echo "selected"; } ?> value="<?= $location_id_select ?>"><?= $location_name_select_display ?></option>
|
||||||
|
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</select>
|
</select>
|
||||||
@@ -343,8 +344,8 @@ ob_start();
|
|||||||
$contact_name_select_display = $contact_name_select;
|
$contact_name_select_display = $contact_name_select;
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<option <?php if ($asset_contact_id == $contact_id_select) { echo "selected"; } ?> value="<?php echo $contact_id_select; ?>">
|
<option <?php if ($asset_contact_id == $contact_id_select) { echo "selected"; } ?> value="<?= $contact_id_select ?>">
|
||||||
<?php echo $contact_name_select_display; ?>
|
<?= $contact_name_select_display ?>
|
||||||
</option>
|
</option>
|
||||||
|
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
@@ -360,7 +361,7 @@ ob_start();
|
|||||||
</div>
|
</div>
|
||||||
<select class="form-control select2" name="status">
|
<select class="form-control select2" name="status">
|
||||||
<?php foreach($asset_status_array as $asset_status_select) { ?>
|
<?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>
|
<option <?php if ($asset_status_select == $asset_status) { echo "selected"; } ?>><?= $asset_status_select ?></option>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
@@ -368,7 +369,7 @@ ob_start();
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="tab-pane fade" id="pills-purchase<?php echo $asset_id; ?>">
|
<div class="tab-pane fade" id="pills-purchase">
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Vendor</label>
|
<label>Vendor</label>
|
||||||
@@ -391,7 +392,7 @@ ob_start();
|
|||||||
$vendor_name_select_display = $vendor_name_select;
|
$vendor_name_select_display = $vendor_name_select;
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<option <?php if ($asset_vendor_id == $vendor_id_select) { echo "selected"; } ?> value="<?php echo $vendor_id_select; ?>"><?php echo $vendor_name_select_display; ?></option>
|
<option <?php if ($asset_vendor_id == $vendor_id_select) { echo "selected"; } ?> value="<?= $vendor_id_select ?>"><?= $vendor_name_select_display ?></option>
|
||||||
|
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</select>
|
</select>
|
||||||
@@ -405,7 +406,7 @@ ob_start();
|
|||||||
<div class="input-group-prepend">
|
<div class="input-group-prepend">
|
||||||
<span class="input-group-text"><i class="fa fa-fw fa-shopping-cart"></i></span>
|
<span class="input-group-text"><i class="fa fa-fw fa-shopping-cart"></i></span>
|
||||||
</div>
|
</div>
|
||||||
<input type="text" class="form-control" name="purchase_reference" placeholder="eg. Invoice, PO Number" value="<?php echo $asset_purchase_reference; ?>">
|
<input type="text" class="form-control" name="purchase_reference" placeholder="eg. Invoice, PO Number" value="<?= $asset_purchase_reference ?>">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -415,7 +416,7 @@ ob_start();
|
|||||||
<div class="input-group-prepend">
|
<div class="input-group-prepend">
|
||||||
<span class="input-group-text"><i class="fa fa-fw fa-calendar"></i></span>
|
<span class="input-group-text"><i class="fa fa-fw fa-calendar"></i></span>
|
||||||
</div>
|
</div>
|
||||||
<input type="date" class="form-control" name="purchase_date" max="2999-12-31" value="<?php echo $asset_purchase_date; ?>">
|
<input type="date" class="form-control" name="purchase_date" max="2999-12-31" value="<?= $asset_purchase_date ?>">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
@@ -426,7 +427,7 @@ ob_start();
|
|||||||
<div class="input-group-prepend">
|
<div class="input-group-prepend">
|
||||||
<span class="input-group-text"><i class="fa fa-fw fa-calendar-check"></i></span>
|
<span class="input-group-text"><i class="fa fa-fw fa-calendar-check"></i></span>
|
||||||
</div>
|
</div>
|
||||||
<input type="date" class="form-control" name="install_date" max="2999-12-31" value="<?php echo $asset_install_date; ?>">
|
<input type="date" class="form-control" name="install_date" max="2999-12-31" value="<?= $asset_install_date ?>">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -437,18 +438,18 @@ ob_start();
|
|||||||
<div class="input-group-prepend">
|
<div class="input-group-prepend">
|
||||||
<span class="input-group-text"><i class="fa fa-fw fa-calendar-times"></i></span>
|
<span class="input-group-text"><i class="fa fa-fw fa-calendar-times"></i></span>
|
||||||
</div>
|
</div>
|
||||||
<input type="date" class="form-control" name="warranty_expire" max="2999-12-31" value="<?php echo $asset_warranty_expire; ?>">
|
<input type="date" class="form-control" name="warranty_expire" max="2999-12-31" value="<?= $asset_warranty_expire ?>">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="tab-pane fade" id="pills-notes<?php echo $asset_id; ?>">
|
<div class="tab-pane fade" id="pills-notes">
|
||||||
|
|
||||||
<div class="mb-3 text-center">
|
<div class="mb-3 text-center">
|
||||||
<?php if ($asset_photo) { ?>
|
<?php if ($asset_photo) { ?>
|
||||||
<img class="img-fluid" alt="asset_photo" src="<?php echo "../uploads/clients/$client_id/$asset_photo"; ?>">
|
<img class="img-fluid" alt="asset_photo" src="<?= "../uploads/clients/$client_id/$asset_photo" ?>">
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -458,7 +459,7 @@ ob_start();
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<textarea class="form-control" rows="8" placeholder="Enter some notes" name="notes"><?php echo $asset_notes; ?></textarea>
|
<textarea class="form-control" rows="8" placeholder="Enter some notes" name="notes"><?= $asset_notes ?></textarea>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p class="text-muted text-right">Asset ID: <?= $asset_id ?></p>
|
<p class="text-muted text-right">Asset ID: <?= $asset_id ?></p>
|
||||||
@@ -466,7 +467,7 @@ ob_start();
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="tab-pane fade" id="pills-history<?php echo $asset_id; ?>">
|
<div class="tab-pane fade" id="pills-history">
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Asset History</label>
|
<label>Asset History</label>
|
||||||
|
|||||||
@@ -350,5 +350,3 @@ $(document).ready(function() {
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once '../../../includes/modal_footer.php';
|
require_once '../../../includes/modal_footer.php';
|
||||||
|
|
||||||
?>
|
|
||||||
|
|||||||
Reference in New Issue
Block a user