Asset Types - every kind of asset: ITFlow's own, and yours - a * Badge Reader, a Vehicle, a Hypervisor - each with its icon, the group it is * counted in (its tab on the assets list), its details and how many assets * are of it. In use are the ones the type pickers offer, in their order; * switched off ones stay on their assets, but can't be picked. Types that are * on assets but aren't set up - from an import, the API or an older ITFlow - * can be set up from here. The work is functions/asset_type_custom.php; the * handlers are admin/post/asset_type.php. */ // Default Column Sortby Filter - the order the pickers show them in $sort = "order"; $order = "ASC"; require_once "includes/inc_all_admin.php"; $views = [ '' => ['label' => 'In use', 'icon' => 'fa-check-circle', 'title' => 'Offered by the type pickers'], 'off' => ['label' => 'Switched off', 'icon' => 'fa-power-off', 'title' => 'Kept on their assets, but can\'t be picked'], ]; $show = (string) ($_GET['show'] ?? ''); $show = isset($views[$show]) ? $show : ''; [$asset_counts, $not_set_up] = assetTypeAssetCounts(); $search = mb_strtolower(trim((string) ($_GET['q'] ?? ''))); // Every type as a row, in the pickers' order - searched by name, description, group and details $rows = []; $view_counts = array_fill_keys(array_keys($views), 0); $position = 0; foreach (assetTypes() as $name => $info) { $specs = assetTypeSpecs($name); $row = $info + [ 'name' => $name, 'position' => $position++, 'assets' => $asset_counts[$name][0] ?? 0, 'archived' => $asset_counts[$name][1] ?? 0, 'spec_labels' => array_column($specs, 'label'), 'own' => count($info['details']), ]; $haystack = mb_strtolower(implode(' ', array_merge([$name, $info['description'], ASSET_TYPE_GROUPS[$info['group']]['label']], $row['spec_labels']))); if ($search !== '' && mb_strpos($haystack, $search) === false) { continue; } $view_counts[$info['active'] ? '' : 'off']++; if ($info['active'] === ($show === '')) { $rows[] = $row; } } // Only these sort $sortable_columns = ['order', 'name', 'group', 'assets']; if (!in_array($sort, $sortable_columns, true)) { $sort = 'order'; } $group_order = array_flip(array_keys(ASSET_TYPE_GROUPS)); usort($rows, function ($a, $b) use ($sort, $order, $group_order) { switch ($sort) { case 'name': $by = strnatcasecmp($a['name'], $b['name']); break; case 'group': $by = $group_order[$a['group']] <=> $group_order[$b['group']]; break; case 'assets': $by = $a['assets'] <=> $b['assets']; break; default: $by = $a['position'] <=> $b['position']; } $by = $order === 'DESC' ? -$by : $by; return $by !== 0 ? $by : $a['position'] <=> $b['position']; }); $num_rows = [count($rows)]; $rows = array_slice($rows, $record_from, $record_to); $pill_url = function ($view) { return '?' . http_build_query(array_filter(['q' => $_GET['q'] ?? '', 'show' => $view])); }; $csrf = $_SESSION['csrf_token']; ?>

Asset Types

On assets, but not set up - they show as Other: [$live, $archived]) { ?>
">
Details
Built in
count($details) ? ' and ' . (count($row['spec_labels']) - count($details)) . ' more' : '' ?>
of its own
None
> >0
'asset types', 'icon' => 'fa-layer-group', 'filtered' => $search !== '', 'views' => ['show'], 'view' => $show === 'off' ? [ 'title' => 'None switched off', 'icon' => 'fa-power-off', 'text' => 'A type you switch off is kept here - its assets keep it, but it can\'t be picked.', ] : [], 'text' => 'Every kind of asset - add your own, like a Badge Reader or a Vehicle.', 'actions' => [['label' => 'New Type', 'modal' => 'modals/asset_type/asset_type_add.php', 'size' => 'lg']], ]; require_once "../includes/filter_footer.php"; ?>