"project_template_name $order", 'ticket_count' => "ticket_count $order, project_template_name ASC", 'task_count' => "task_count $order, project_template_name ASC", 'project_template_updated_at' => "COALESCE(project_template_updated_at, project_template_created_at) $order", ]; if (!isset($sortable_columns[$sort])) { $sort = 'project_template_name'; } $search = "(project_template_name LIKE '%$q%' OR project_template_description LIKE '%$q%')"; $sql = mysqli_query($mysqli, "SELECT SQL_CALC_FOUND_ROWS project_templates.project_template_id, project_template_name, project_template_description, project_template_created_at, project_template_updated_at, project_template_archived_at, COUNT(DISTINCT ptt.ticket_template_id) AS ticket_count, COUNT(task_template_id) AS task_count FROM project_templates LEFT JOIN project_template_ticket_templates ptt ON ptt.project_template_id = project_templates.project_template_id LEFT JOIN task_templates ON task_template_ticket_template_id = ptt.ticket_template_id WHERE $search AND project_template_archived_at IS " . ($show_archived ? 'NOT NULL' : 'NULL') . " GROUP BY project_templates.project_template_id ORDER BY {$sortable_columns[$sort]} LIMIT $record_from, $record_to"); $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); $counts = mysqli_fetch_row(mysqli_query($mysqli, "SELECT COALESCE(SUM(project_template_archived_at IS NULL), 0), COALESCE(SUM(project_template_archived_at IS NOT NULL), 0) FROM project_templates WHERE $search")); $sort_link = function ($column, $label) use ($url_query_strings_sort, $sort, $disp, $order_icon) { return '' . $label . ($sort === $column ? " $order_icon" : '') . ''; }; ?>

Project Templates

">
-' ?> -' ?>
'project templates', 'icon' => 'fa-cubes', 'filtered' => $q !== '', 'archived' => $show_archived, 'views' => ['show'], 'text' => 'A client onboarding plan is a good first one: one ticket template per step, each with its checklist of tasks.', 'actions' => [['label' => 'New Project Template', 'modal' => 'modals/project_template/project_template_add.php']], ]; require_once "../includes/filter_footer.php"; ?>