- Added buttons for assigning diagnosis and starting diagnosis based on job card status in the job card view. - Implemented a modal for assigning technicians for diagnosis, including form validation and technician selection. - Updated routes to include a test route for job cards. - Created a new Blade view for testing inspection inputs. - Developed comprehensive feature tests for the estimate module, including creation, viewing, editing, and validation of estimates. - Added tests for estimate model relationships and statistics calculations. - Introduced a basic feature test for job cards index.
70 lines
1.7 KiB
PHP
70 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
use Illuminate\Database\Eloquent\Relations\HasOne;
|
|
|
|
class Diagnosis extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $fillable = [
|
|
'job_card_id',
|
|
'service_coordinator_id',
|
|
'customer_reported_issues',
|
|
'diagnostic_findings',
|
|
'root_cause_analysis',
|
|
'recommended_repairs',
|
|
'additional_issues_found',
|
|
'priority_level',
|
|
'estimated_repair_time',
|
|
'diagnosis_status',
|
|
'diagnosis_date',
|
|
'photos',
|
|
'diagnostic_codes',
|
|
'test_results',
|
|
'parts_required',
|
|
'labor_operations',
|
|
'special_tools_required',
|
|
'safety_concerns',
|
|
'environmental_impact',
|
|
'customer_authorization_required',
|
|
'notes',
|
|
];
|
|
|
|
protected $casts = [
|
|
'diagnosis_date' => 'datetime',
|
|
'photos' => 'array',
|
|
'diagnostic_codes' => 'array',
|
|
'test_results' => 'array',
|
|
'parts_required' => 'array',
|
|
'labor_operations' => 'array',
|
|
'special_tools_required' => 'array',
|
|
'customer_authorization_required' => 'boolean',
|
|
];
|
|
|
|
public function jobCard(): BelongsTo
|
|
{
|
|
return $this->belongsTo(JobCard::class);
|
|
}
|
|
|
|
public function serviceCoordinator(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class, 'service_coordinator_id');
|
|
}
|
|
|
|
public function estimate(): HasOne
|
|
{
|
|
return $this->hasOne(Estimate::class);
|
|
}
|
|
|
|
public function timesheets(): HasMany
|
|
{
|
|
return $this->hasMany(Timesheet::class);
|
|
}
|
|
}
|