Files
Vasyka 5e255b7b40 Stage 10 — Bodyshop / PDR / Detailing: damage map + insurance + photos
Completes the 18-stage roadmap (17/18 fully functional, 18 partial).

Schema:
- bodyshop_jobs (type body_repair/pdr/painting/detailing/ceramic/ppf/polishing,
  status workflow, insurance case fields, estimate/approved amounts)
- damage_points (zone, kind, severity) — the damage map

Models:
- BodyshopJob (HasMedia: photos_before/photos_after), auto number BS-YY-NNNN
- DamagePoint with ZONES/KINDS/SEVERITIES

Filament (new "Tinichigerie" nav group):
- BodyshopJobResource: type/status, collapsible insurance section (conditional
  fields), before/after photo upload, estimate/approved amounts
- DamagePointsRelationManager (zone + kind + colour-coded severity)
- Table with type badge, insurance flag, damage count; nav badge = open jobs

Tests (5 new):
- auto number; damage points relation; insurance fields persist;
  detailing types supported; tenant isolation

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-28 06:49:47 +00:00

40 lines
1.0 KiB
PHP

<?php
namespace App\Models\Tenant;
use App\Models\Concerns\BelongsToTenant;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class DamagePoint extends Model
{
use BelongsToTenant;
public const ZONES = [
'Bară față', 'Capotă', 'Aripă FS', 'Aripă FD',
'Ușă FS', 'Ușă FD', 'Ușă SS', 'Ușă SD',
'Aripă SS', 'Aripă SD', 'Bară spate', 'Portbagaj',
'Plafon', 'Parbriz', 'Lunetă', 'Prag S', 'Prag D',
'Oglindă S', 'Oglindă D', 'Jantă',
];
public const KINDS = [
'Zgârietură', 'Lovitură', 'Fisură', 'Rugină', 'Vopsea sărită', 'Spart',
];
public const SEVERITIES = [
'minor' => 'Minoră',
'medium' => 'Medie',
'severe' => 'Gravă',
];
protected $fillable = [
'company_id', 'bodyshop_job_id', 'zone', 'kind', 'severity', 'notes',
];
public function job(): BelongsTo
{
return $this->belongsTo(BodyshopJob::class, 'bodyshop_job_id');
}
}