0) { $rack_holders[intval($row['unit_id'])] = [ 'id' => intval($row['unit_id']), 'name' => rackUnitName($row['asset_name'], $row['unit_device'], $row['unit_type']), 'slots' => intval($row['unit_slots']), 'where' => html_entity_decode(rackPositionLabel($row['unit_start_number'], $row['unit_end_number'])) . ', ' . ($row['unit_face'] === 'rear' ? 'rear' : 'front'), 'icon' => rackItemStyle($row['asset_type'], $row['unit_type'], $row['asset_name'] !== null)['icon'], ]; } $rack_other_units[] = [ 'start' => intval($row['unit_start_number']), 'end' => intval($row['unit_end_number']), 'face' => $row['unit_face'] === 'rear' ? 'rear' : 'front', 'full' => intval($row['unit_full_depth']) === 1, 'name' => rackUnitName($row['asset_name'], $row['unit_device'], $row['unit_type']), ]; } // This client's assets that aren't racked anywhere yet (plus the one already // on this item). An archived asset only stays listed if it's this item's. $asset_options = []; $sql = mysqli_query($mysqli, "SELECT asset_id, asset_name, asset_type, asset_make, asset_model FROM assets WHERE asset_client_id = $client_id AND (asset_id = $unit_asset_id OR ( asset_archived_at IS NULL AND NOT EXISTS (SELECT 1 FROM rack_units WHERE unit_asset_id = asset_id) )) ORDER BY FIELD(asset_type, '" . implode("', '", array_map('escapeSql', assetRackTypes())) . "') = 0, asset_type, asset_name"); while ($row = mysqli_fetch_assoc($sql)) { $asset_options[] = $row; } $unit_is_asset = $unit_asset_id > 0 || ($unit_id === 0 && $unit_device === ''); $item_types = rackItemTypes(); // Each holder's slots: what is in them, and how far they go (one row past what is used) foreach ($rack_holders as $holder_id => $holder) { $taken = $rack_holder_taken[$holder_id] ?? []; $rack_holders[$holder_id]['taken'] = (object) $taken; $rack_holders[$holder_id]['limit'] = rackSlotLimit($holder['slots'], $taken ? max(array_keys($taken)) : 0); } // A holder that holds something can't go in one, and one this item is in has to stay listed $unit_children = $unit_id ? rackChildCount($unit_id) : 0; $unit_holder_id = isset($rack_holders[$unit_holder_id]) && !$unit_children ? $unit_holder_id : 0; $unit_in_holder = $unit_holder_id > 0; $rack_slot_order = $rack_units_descending ? 'Slot 1 is at the top left, counting across and then down a row' : 'Slot 1 is at the bottom left, counting across and then up a row'; ?>
> >
Every asset this client has is already racked.
.
U
U
> >
>
>
across
How many fit side by side - more than that wrap onto another row, for stacks. It holds now.
W