Dodaj funkcję filtr_get do klasy Tasks oraz aktualizuj widok zadań o dynamiczne ładowanie filtrów
This commit is contained in:
@@ -533,4 +533,15 @@ class Tasks
|
||||
echo json_encode( $response );
|
||||
exit;
|
||||
}
|
||||
|
||||
static function filtr_get() {
|
||||
$filtr = \factory\Tasks::filtr_details( \S::get( 'filtr_id' ) );
|
||||
|
||||
echo json_encode( [
|
||||
'status' => 'success',
|
||||
'projects' => $filtr['projects'],
|
||||
'users' => $filtr['users']
|
||||
] );
|
||||
exit;
|
||||
}
|
||||
}
|
||||
@@ -385,7 +385,7 @@ class Projects
|
||||
. 'tasks AS t '
|
||||
. 'LEFT JOIN task_user AS tu ON tu.task_id = t.id '
|
||||
. 'WHERE '
|
||||
. '( user_id = ' . (int)$user_id . ' OR created_by = ' . (int)$user_id . ' ) AND project_id = ' . $row['id'] . ' AND ( status = 0 OR status = 1 ) AND deleted = 0 AND ( date_complete IS NULL OR date_complete > \'' . date( 'Y-m-d', strtotime( "-21 days") ) . '\' ) '
|
||||
. '( user_id = ' . (int)$user_id . ' OR created_by = ' . (int)$user_id . ' ) AND project_id = ' . $row['id'] . ' AND ( status = 0 OR status = 5 ) AND deleted = 0 AND ( date_complete IS NULL OR date_complete > \'' . date( 'Y-m-d', strtotime( "-21 days") ) . '\' ) '
|
||||
. 'GROUP BY t.id'
|
||||
) -> fetchAll( \PDO::FETCH_ASSOC );
|
||||
$row['total_tasks'] = count( $count );
|
||||
|
||||
@@ -6,6 +6,11 @@ class Tasks
|
||||
public static $statuses = [ 0 => 'nowe', 3 => 'do rozliczenia', 5 => 'do zrobienia', 1 => 'do sprawdzenia', 2 => 'zamknięte' ];
|
||||
public static $priorities = [ 0 => 'niski', 1 => 'normalny', 2 => 'wysoki', 3 => 'pilny' ];
|
||||
|
||||
static public function filtr_details( $filtr_id ) {
|
||||
global $mdb;
|
||||
return $mdb -> get( 'tasks_filtrs', '*', [ 'id' => $filtr_id ] );
|
||||
}
|
||||
|
||||
|
||||
static public function get_priorities()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user