chore: update document approval workflow and bug fixes

This commit is contained in:
2026-05-25 13:05:20 +08:00
parent d573c02893
commit 39a8e1d4cd
910 changed files with 49994 additions and 1010 deletions

View File

@@ -0,0 +1,57 @@
<?php
namespace Modules\ProjectManagement\Models;
use App\Models\User;
use App\Traits\HasPublicIdentifier;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Modules\ProjectManagement\Enums\DelayReason;
use Modules\ProjectManagement\Enums\WeatherCondition;
class TaskDelay extends Model
{
use HasPublicIdentifier;
protected $fillable = [
'task_id',
'reason_type',
'weather_condition',
'delay_date',
'lost_hours',
'notes',
'reported_by',
];
protected function casts(): array
{
return [
'reason_type' => DelayReason::class,
'weather_condition' => WeatherCondition::class,
'delay_date' => 'date',
'lost_hours' => 'decimal:2',
];
}
public function task(): BelongsTo
{
return $this->belongsTo(Task::class);
}
public function reporter(): BelongsTo
{
return $this->belongsTo(User::class, 'reported_by');
}
// --- Accessors ---
public function getIsWeatherRelatedAttribute(): bool
{
return $this->reason_type === DelayReason::Weather;
}
public function getLostDaysAttribute(): float
{
return round((float) $this->lost_hours / 8, 1);
}
}