mirror of
https://github.com/itflow-org/itflow
synced 2026-11-11 15:07:24 +00:00
59 lines
2.4 KiB
PHP
59 lines
2.4 KiB
PHP
<?php
|
|
|
|
require_once '../../../includes/modal_header.php';
|
|
|
|
enforceUserPermission('module_support', 2);
|
|
|
|
$client_id = intval($_GET['client_id'] ?? 0);
|
|
if ($client_id) {
|
|
enforceClientAccess();
|
|
}
|
|
|
|
// The assets list passes the tab it was on - start on that kind of asset
|
|
$type_presets = ['workstation' => 'Desktop', 'server' => 'Server', 'virtual' => 'Virtual Machine', 'network' => 'Switch', 'power' => 'UPS', 'printer' => 'Printer'];
|
|
$type_param = strtolower((string) ($_GET['type'] ?? ''));
|
|
|
|
$asset_form_mode = 'add';
|
|
$asset_id = 0;
|
|
$asset_type = $type_presets[$type_param] ?? '';
|
|
$asset_name = $asset_description = $asset_make = $asset_model = $asset_serial = $asset_os = '';
|
|
$asset_ip = $asset_ipv6 = $asset_nat_ip = $asset_mac = $asset_uri = $asset_uri_2 = $asset_uri_client = '';
|
|
$asset_status = $asset_purchase_reference = $asset_purchase_date = $asset_install_date = $asset_warranty_expire = '';
|
|
$asset_physical_location = $asset_notes = $asset_photo = '';
|
|
$asset_favorite = 0;
|
|
$asset_network_id = 0;
|
|
// Opened from a vendor's page - bought from them
|
|
$asset_vendor_id = $client_id ? assetClientOwnedId('vendor', $_GET['vendor_id'] ?? 0, $client_id) : 0;
|
|
// Opened from a location's page - start at that location
|
|
$asset_location_id = $client_id ? assetClientOwnedId('location', $_GET['location_id'] ?? 0, $client_id) : 0;
|
|
$asset_contact_id = intval($_GET['contact_id'] ?? 0);
|
|
$asset_tag_id_array = [];
|
|
$asset_specs = [];
|
|
|
|
ob_start();
|
|
|
|
?>
|
|
<div class="modal-header bg-dark">
|
|
<h5 class="modal-title"><i class="fa fa-fw fa-desktop me-2"></i>New Asset</h5>
|
|
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal"></button>
|
|
</div>
|
|
|
|
<form action="post.php" method="post" enctype="multipart/form-data" autocomplete="off">
|
|
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
|
<?php if ($client_id) { ?>
|
|
<input type="hidden" name="client_id" value="<?= $client_id ?>">
|
|
<?php } ?>
|
|
|
|
<div class="modal-body ui-front">
|
|
<?php require 'asset_form.php'; ?>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="submit" name="add_asset" class="btn btn-primary text-bold"><i class="fa fa-check me-2"></i>Create</button>
|
|
<button type="button" class="btn btn-light" data-bs-dismiss="modal"><i class="fa fa-times me-2"></i>Cancel</button>
|
|
</div>
|
|
</form>
|
|
|
|
<?php
|
|
|
|
require_once '../../../includes/modal_footer.php';
|