Add initial implementation of Simple Gantt chart and sample names list
- Created index.html for the Gantt chart with sample tasks and configurations. - Added styles for the Gantt chart and linked necessary CSS and JS files. - Introduced a names.txt file containing a list of names for potential use in the application.
This commit is contained in:
@@ -5,6 +5,46 @@ class Tasks
|
||||
{
|
||||
public static $statuses = [ 0 => 'nowe', 3 => 'do rozliczenia', 5 => 'do zrobienia', 4 => 'zaplanowane', 1 => 'do sprawdzenia', 6 => 'faktury', 2 => 'zamknięte' ];
|
||||
|
||||
static public function task_change_dates( $task_id, $date_start, $date_end )
|
||||
{
|
||||
global $mdb;
|
||||
|
||||
if ( !$task_id )
|
||||
return false;
|
||||
|
||||
return $mdb -> update( 'tasks', [
|
||||
'date_start' => $date_start,
|
||||
'date_end' => $date_end
|
||||
], [
|
||||
'id' => $task_id
|
||||
] );
|
||||
}
|
||||
|
||||
static public function get_tasks_gantt() {
|
||||
global $mdb;
|
||||
|
||||
$tasks = $mdb -> query( 'SELECT t.id, t.name, t.date_start, t.date_end, t.status, t.client_id FROM tasks AS t WHERE show_in_calendar = 1 AND status != 2 ORDER BY date_start ASC' ) -> fetchAll( \PDO::FETCH_ASSOC );
|
||||
foreach ( $tasks as $task ) {
|
||||
$task_json = [];
|
||||
$task_json['name'] = $task['client_id'] ? \factory\Crm::get_client_name( (int)$task['client_id'] ) : $task['name'];
|
||||
// start
|
||||
$task_json['start'] = $task['date_start'];
|
||||
// end
|
||||
$task_json['end'] = $task['date_end'];
|
||||
// id
|
||||
$task_json['id'] = $task['id'];
|
||||
// custom class
|
||||
if ( $task['date_start'] <= date( 'Y-m-d H:i:s' ) )
|
||||
$task_json['custom_class'] = 'gantt-task-backlog';
|
||||
// progress
|
||||
$task_json['progress'] = 0;
|
||||
|
||||
$data[] = $task_json;
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
static public function work_delete( $work_id ) {
|
||||
global $mdb;
|
||||
return $mdb -> update( 'tasks_work', [ 'deleted' => 1 ], [ 'id' => $work_id ] );
|
||||
|
||||
Reference in New Issue
Block a user