mirror of
https://github.com/itflow-org/itflow
synced 2026-11-22 04:17:24 +00:00
QoL 72: assets list badges for any flagged date of your own asset types alongside the UPS battery, and the AI client document listing firewalls, servers, NAS, virtual machines, switches and access points ahead of other types
This commit is contained in:
@@ -59,7 +59,7 @@ $t_detail_row = function ($key, array $d) {
|
||||
<span class="input-group-text">Unit</span>
|
||||
<input type="text" class="form-control" name="detail_unit[<?= $key ?>]" maxlength="20" placeholder="kg, m, ft" value="<?= escapeHtml($d['unit'] ?? '') ?>" aria-label="Its unit">
|
||||
</div>
|
||||
<div class="form-check form-switch small mb-0" data-asset-type-detail-for="date" title="On its page as the date nears, like a warranty - and a notification 45, 7 and 1 days before">
|
||||
<div class="form-check form-switch small mb-0" data-asset-type-detail-for="date" title="On its page and the assets list as the date nears, like a warranty - and a notification 45, 7 and 1 days before">
|
||||
<input class="form-check-input" type="checkbox" role="switch" name="detail_flag[<?= $key ?>]" value="1" id="assetTypeDetailFlag<?= $key ?>"<?= !empty($d['flag']) ? ' checked' : '' ?>>
|
||||
<label class="form-check-label" for="assetTypeDetailFlag<?= $key ?>">Flag as it nears</label>
|
||||
</div>
|
||||
|
||||
@@ -200,7 +200,7 @@ $assets = [];
|
||||
while ($row = mysqli_fetch_assoc($sql)) {
|
||||
$assets[intval($row['asset_id'])] = $row;
|
||||
}
|
||||
// Each one's details - its type's (functions/asset_type.php): a UPS battery due is flagged like a warranty, and Details lists them
|
||||
// Each one's details - its type's (functions/asset_type.php): a UPS battery or another flagged date due is flagged like a warranty, and Details lists them
|
||||
$asset_list_specs = assetSpecsFor(array_keys($assets));
|
||||
|
||||
// Tags, rack positions and what its RMM says of each for the whole page in three queries, not three per row
|
||||
@@ -569,7 +569,10 @@ $search_noun = $type_filter ? $asset_type_tabs[$type_filter]['label'] : 'assets'
|
||||
$asset_tone = assetTypeTone($row['asset_type']);
|
||||
$device_icon = getAssetIcon($row['asset_type']);
|
||||
$asset_spec_rows = assetSpecRows($row['asset_type'], $asset_list_specs[$asset_id] ?? [], $client_id);
|
||||
$asset_battery = $asset_spec_rows['battery_replace']['flag'] ?? null;
|
||||
// Dates its type flags as they near - a UPS battery, or one of your own types' - each a badge once due soon or past
|
||||
$asset_flags = array_filter($asset_spec_rows, function ($spec_row) {
|
||||
return $spec_row['flag'] && $spec_row['flag']['tone'] !== 'success';
|
||||
});
|
||||
|
||||
$contact_name = escapeHtml($row['contact_name']);
|
||||
$contact_archived = !empty($row['contact_archived_at']);
|
||||
@@ -627,9 +630,11 @@ $search_noun = $type_filter ? $asset_type_tabs[$type_filter]['label'] : 'assets'
|
||||
<i class="fas fa-shield-alt me-1"></i>Warranty <?= strtolower($asset_warranty['short']) ?>
|
||||
</span>
|
||||
<?php } ?>
|
||||
<?php if ($asset_battery && $asset_battery['tone'] !== 'success') { ?>
|
||||
<span class="badge rounded-pill bg-<?= $asset_battery['tone'] ?>-subtle text-<?= $asset_battery['tone'] ?>-emphasis border border-<?= $asset_battery['tone'] ?>-subtle fw-normal mt-1" title="Replace battery by <?= escapeHtml($asset_battery['date']) ?>" data-asset-battery>
|
||||
<i class="fas fa-battery-quarter me-1"></i>Battery <?= strtolower(escapeHtml($asset_battery['short'])) ?>
|
||||
<?php foreach ($asset_flags as $flag_key => $flag_row) {
|
||||
$flag = $flag_row['flag'];
|
||||
$battery = $flag_key === 'battery_replace'; ?>
|
||||
<span class="badge rounded-pill bg-<?= $flag['tone'] ?>-subtle text-<?= $flag['tone'] ?>-emphasis border border-<?= $flag['tone'] ?>-subtle fw-normal mt-1" title="<?= escapeHtml($flag_row['label']) ?> <?= escapeHtml($flag['date']) ?>"<?= $battery ? ' data-asset-battery' : '' ?>>
|
||||
<i class="fas <?= escapeHtml($flag_row['icon']) ?> me-1"></i><?= $battery ? 'Battery' : escapeHtml($flag_row['label']) ?> <?= strtolower(escapeHtml($flag['short'])) ?>
|
||||
</span>
|
||||
<?php } ?>
|
||||
</td>
|
||||
|
||||
@@ -76,7 +76,7 @@ function aiClientProfile($client_id) {
|
||||
}
|
||||
$list('Servers and network gear', "SELECT asset_name, asset_type, asset_make, asset_model, asset_os FROM assets
|
||||
WHERE asset_client_id = $client_id AND asset_archived_at IS NULL AND (" . assetTypeGroupSql('server') . " OR " . assetTypeGroupSql('virtual') . " OR " . assetTypeGroupSql('network') . " OR " . assetTypeGroupSql('power') . ")
|
||||
ORDER BY FIELD(asset_type, 'Firewall/Router', 'Server', 'NAS', 'Virtual Machine', 'Switch', 'Access Point'), asset_name LIMIT 25",
|
||||
ORDER BY FIELD(asset_type, 'Firewall/Router', 'Server', 'NAS', 'Virtual Machine', 'Switch', 'Access Point') = 0, FIELD(asset_type, 'Firewall/Router', 'Server', 'NAS', 'Virtual Machine', 'Switch', 'Access Point'), asset_type, asset_name LIMIT 25",
|
||||
function ($r) { return $r['asset_name'] . ' - ' . $r['asset_type'] . (trim($r['asset_make'] . ' ' . $r['asset_model']) !== '' ? ', ' . trim($r['asset_make'] . ' ' . $r['asset_model']) : '') . ($r['asset_os'] ? ", {$r['asset_os']}" : ''); });
|
||||
$list('Networks', "SELECT network_name, network_type, network_vlan, network, network_gateway FROM networks WHERE network_client_id = $client_id AND network_archived_at IS NULL ORDER BY network_name LIMIT 15",
|
||||
function ($r) { return $r['network_name'] . ($r['network_type'] ? " ({$r['network_type']})" : '') . ($r['network'] ? " - {$r['network']}" : '') . ($r['network_vlan'] ? ", VLAN {$r['network_vlan']}" : '') . ($r['network_gateway'] ? ", gateway {$r['network_gateway']}" : ''); });
|
||||
|
||||
Reference in New Issue
Block a user