feat(tasks): complete task management system with Kanban, Calendar, notifications
- Add Task model with subtasks, priorities, status transitions, dates, hours - Add Comment polymorphic model for tasks/issues/projects - Livewire components: TaskManager (list+filters), TaskForm (modal), TaskDetail, TaskKanban (drag&drop), TaskCalendar (FullCalendar) - TaskPolicy with permissions (view/create/edit/delete/assign/manage all) - Notifications: assigned, status change, overdue, comment added - Daily overdue notification job scheduled - Dashboard widget unifies IssueTask + Task - i18n: en/es/fr/ru (393 keys each) - Routes, navigation, offline sync support - 101 tests passing, Pint compliant on new files
This commit is contained in:
+49
-12
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
@@ -9,28 +11,63 @@ class Phase extends Model
|
||||
|
||||
protected $fillable = [
|
||||
'project_id', 'name', 'description', 'order', 'color', 'progress_percent',
|
||||
'planned_start', 'planned_end', 'actual_start', 'actual_end'
|
||||
'planned_start', 'planned_end', 'actual_start', 'actual_end',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'planned_start' => 'date',
|
||||
'planned_end' => 'date',
|
||||
'actual_start' => 'date',
|
||||
'actual_end' => 'date',
|
||||
'planned_end' => 'date',
|
||||
'actual_start' => 'date',
|
||||
'actual_end' => 'date',
|
||||
];
|
||||
|
||||
public function project() { return $this->belongsTo(Project::class); }
|
||||
public function layers() { return $this->hasMany(Layer::class); }
|
||||
public function progressUpdates() { return $this->hasMany(ProgressUpdate::class); }
|
||||
public function currentLayer() { return $this->hasOne(Layer::class)->latestOfMany(); }
|
||||
public function features() { return $this->hasManyThrough(Feature::class, Layer::class); }
|
||||
public function media() { return $this->morphMany(Media::class, 'mediable'); }
|
||||
public function images() { return $this->morphMany(Media::class, 'mediable')->where('category', 'image'); }
|
||||
public function project()
|
||||
{
|
||||
return $this->belongsTo(Project::class);
|
||||
}
|
||||
|
||||
public function layers()
|
||||
{
|
||||
return $this->hasMany(Layer::class);
|
||||
}
|
||||
|
||||
public function progressUpdates()
|
||||
{
|
||||
return $this->hasMany(ProgressUpdate::class);
|
||||
}
|
||||
|
||||
public function currentLayer()
|
||||
{
|
||||
return $this->hasOne(Layer::class)->latestOfMany();
|
||||
}
|
||||
|
||||
public function features()
|
||||
{
|
||||
return $this->hasManyThrough(Feature::class, Layer::class);
|
||||
}
|
||||
|
||||
public function media()
|
||||
{
|
||||
return $this->morphMany(Media::class, 'mediable');
|
||||
}
|
||||
|
||||
public function images()
|
||||
{
|
||||
return $this->morphMany(Media::class, 'mediable')->where('category', 'image');
|
||||
}
|
||||
|
||||
public function tasks()
|
||||
{
|
||||
return $this->hasMany(Task::class);
|
||||
}
|
||||
|
||||
public function getDeviationDaysAttribute(): ?int
|
||||
{
|
||||
if (!$this->planned_end) return null;
|
||||
if (! $this->planned_end) {
|
||||
return null;
|
||||
}
|
||||
$end = $this->actual_end ?? now();
|
||||
|
||||
return $this->planned_end->diffInDays($end, false);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user