Categories, keeping one the asset has that is archived or isn't a status any more $status_colors = []; foreach (categoryPicker('asset_status', [html_entity_decode($asset_status)]) as $status_name => $status_row) { $status_colors[$status_name] = assetStatusColor($status_name, $status_row['category_color'] ?? ''); } // The client's own lists - only once the client is known $location_options = $contact_options = $network_options = $vendor_options = []; if ($client_id) { $sql = mysqli_query($mysqli, "SELECT location_archived_at, location_id, location_name FROM locations WHERE location_client_id = $client_id AND (location_archived_at IS NULL OR location_id = $asset_location_id) ORDER BY location_name ASC"); while ($row = mysqli_fetch_assoc($sql)) { $location_options[] = $row; } $sql = mysqli_query($mysqli, "SELECT contact_archived_at, contact_id, contact_name, contact_client_id, contact_photo, contact_title FROM contacts WHERE contact_client_id = $client_id AND (contact_archived_at IS NULL OR contact_id = $asset_contact_id) ORDER BY contact_name ASC"); while ($row = mysqli_fetch_assoc($sql)) { $contact_options[] = $row; } $sql = mysqli_query($mysqli, "SELECT network, network_archived_at, network_id, network_name FROM networks WHERE network_client_id = $client_id AND (network_archived_at IS NULL OR network_id = $asset_network_id) ORDER BY network_name ASC"); while ($row = mysqli_fetch_assoc($sql)) { $network_options[] = $row; } $sql = mysqli_query($mysqli, "SELECT vendor_archived_at, vendor_id, vendor_name, vendor_description FROM vendors WHERE vendor_client_id = $client_id AND (vendor_archived_at IS NULL OR vendor_id = $asset_vendor_id) ORDER BY vendor_favorite DESC, vendor_name ASC"); while ($row = mysqli_fetch_assoc($sql)) { $vendor_options[] = $row; } } else { $client_options = []; $sql = mysqli_query($mysqli, "SELECT client_id, client_name, client_abbreviation FROM clients WHERE client_archived_at IS NULL " . clientScopeSql('clients.client_id') . " ORDER BY client_name ASC"); while ($row = mysqli_fetch_assoc($sql)) { $client_options[] = $row; } } // OS suggestions - what's already in use, most common first $os_suggestions = []; $sql = mysqli_query($mysqli, "SELECT asset_os FROM assets WHERE asset_archived_at IS NULL AND asset_os IS NOT NULL AND asset_os != '' GROUP BY asset_os ORDER BY COUNT(*) DESC LIMIT 200"); while ($row = mysqli_fetch_assoc($sql)) { $os_suggestions[] = ['label' => $row['asset_os'], 'value' => $row['asset_os']]; } $asset_ip_is_dhcp = $asset_ip === 'DHCP'; // The type's details (functions/asset_type.php) - every one is in the form, its type's shown $asset_specs = $asset_specs ?? []; $asset_type_raw = html_entity_decode($asset_type, ENT_QUOTES, 'UTF-8'); $asset_type_known = assetTypeName($asset_type_raw); // What each type shows, for the script - fields, what the OS field is called, details $asset_form_types = []; foreach (ASSET_TYPES as $asset_form_type => $asset_form_info) { $asset_form_types[$asset_form_type] = ['fields' => $asset_form_info['fields'], 'os' => assetTypeOsLabel($asset_form_type), 'specs' => $asset_form_info['specs'], 'example' => $asset_form_info['example']]; } // Ports it has now, for the counts' hints - copper and SFP cages $asset_port_counts = ['copper' => 0, 'sfp' => 0]; if ($asset_form_mode === 'edit' && $asset_id) { $sql = mysqli_query($mysqli, "SELECT interface_name, interface_type, interface_primary FROM asset_interfaces WHERE interface_asset_id = " . intval($asset_id) . " AND interface_archived_at IS NULL"); while ($row = mysqli_fetch_assoc($sql)) { $port_kind = interfacePortKind($row['interface_type'], $row['interface_name']); if ($port_kind !== '') { $asset_port_counts[$port_kind]++; if ($row['interface_primary']) { $asset_port_counts['primary'] = $port_kind; } } } } $asset_host_options = $client_id ? assetSpecAssetOptions('vm_host', $client_id, $asset_id ?? 0, intval($asset_specs['vm_host'] ?? 0)) : []; // Leading icons that follow what is picked or typed: the status in its // colour, the OS brand and the kind of link - the same as the assets list // shows them (functions/asset.php). Type needs none, its picker already shows // the type's icon. These are the starting ones; the script at the end keeps // them in step. $asset_form_icons = [ 'status' => escapeHtml($status_colors[html_entity_decode($asset_status)] ?? 'var(--bs-secondary-color)'), 'os' => assetOsIcon(html_entity_decode($asset_os)), 'uri' => $asset_uri !== '' ? assetLinkIcon(html_entity_decode($asset_uri)) : 'fas fa-link', 'uri_2' => $asset_uri_2 !== '' ? assetLinkIcon(html_entity_decode($asset_uri_2)) : 'fas fa-link', ]; ?>
Pick the asset's location, contact, network and vendor once it's saved.
>
Hardware
Details
$spec) { $spec_value = (string) ($asset_specs[$spec_key] ?? ''); $spec_id = 'assetFormSpec_' . $spec_key; $spec_shown = in_array($spec_key, assetTypeInfo($asset_type_raw)['specs'], true); ?>
>
min="" max="" step="" inputmode="decimal" max="2999-12-31" maxlength="255" >
Has now. A new count adds the ones missing to its interfaces - none are taken away. Added to its interfaces when it's saved.
Flagged on its page as the date nears, like a warranty.

Asset ID

The location and who it's assigned to come from the client - pick them once it's saved.

The primary interface. Add more ports from the asset's Interfaces tab.

>
>
Links
Shown to the client in their portal.

Saved as a credential on the asset. Leave it empty to skip.

Current photo">

No history recorded yet.