format('Y-m-d') === $value; }; if ($historyRequested && (!$validHistoryDate($historyStart) || !$validHistoryDate($historyEnd) || $historyStart > $historyEnd)) { $historyError = 'Choose valid dates with the start date before or equal to the end date.'; } $notAssignedFilters = array( 'Assignment' => 'Not Assigned', 'Completed' => 'Not Completed', 'StartDate' => $priorityStart, 'EndDate' => $todayEnd ); $assignedFilters = array( 'Assignment' => 'Assigned', 'Completed' => 'Not Completed' ); $completedFilters = array( 'Completed' => 'Completed', 'StartDate' => $historyStart . ' 00:00:00', 'EndDate' => $historyEnd . ' 23:59:59' ); $notAssignedDashes = PA_WEB_FORM_ADMIN_DASHQUEUE_GET_DASHES($MySession, $notAssignedFilters); $assignedDashes = PA_WEB_FORM_ADMIN_DASHQUEUE_GET_DASHES($MySession, $assignedFilters); $completedDashes = $historyError === '' ? PA_WEB_FORM_ADMIN_DASHQUEUE_GET_DASHES($MySession, $completedFilters) : array(); $dueSteps = PA_WEB_DASH_COUNTDOWN_DUE_STEPS(array($notAssignedDashes, $assignedDashes)); $notAssignedCount = PA_WEB_FORM_ADMIN_DASHQUEUE_COUNT($notAssignedDashes); $assignedCount = PA_WEB_FORM_ADMIN_DASHQUEUE_COUNT($assignedDashes); $completedCount = PA_WEB_FORM_ADMIN_DASHQUEUE_COUNT($completedDashes); $historyPageSize = 5; $historyPages = max(1, (int)ceil($completedCount / $historyPageSize)); $historyPage = $historyRequested ? max(1, min($historyPages, (int)filter_var($_GET['history_page'] ?? 1, FILTER_VALIDATE_INT))) : 1; $completedDashes = array_slice($completedDashes, ($historyPage - 1) * $historyPageSize, $historyPageSize); $currentCount = $notAssignedCount + $assignedCount; $phaseCount = PA_WEB_FORM_ADMIN_DASHQUEUE_PHASE_COUNT(array($notAssignedDashes, $assignedDashes)); $metrics = array( array( 'label' => 'Open alerts', 'count' => $currentCount, 'sub' => 'Open alerts needing action', 'color' => '#e83e8c', 'icon' => 'fal fa-exclamation-triangle' ), array( 'label' => 'Not Assigned', 'count' => $notAssignedCount, 'sub' => 'Highest priority', 'color' => '#67e8f9', 'icon' => 'fal fa-user-clock' ), array( 'label' => 'Assigned', 'count' => $assignedCount, 'sub' => 'In progress', 'color' => '#ff8ac5', 'icon' => 'fal fa-user-check' ), array( 'label' => 'Phases', 'count' => $phaseCount, 'sub' => 'Active alert stages', 'color' => '#d1d5db', 'icon' => 'fal fa-layer-group' ) ); ?>