62220186af
- New ExternalImportSource and ExternalWorkHistoryEntry models, controller and migrations - Screening fields on external profile imports - Admin and provider profile views, routes and workflow tests updated - Phase 1 validation, route inventory, gap report template and roadmap docs - Add the Google Sheets work-order parser tool (tools/google-sheets-wo-parser)
88 lines
2.5 KiB
PHP
88 lines
2.5 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
#[Fillable([
|
|
'provider_profile_id', 'external_profile_import_id', 'uploaded_by_id',
|
|
'platform', 'source_type', 'parse_status', 'review_status', 'disk', 'path',
|
|
'original_name', 'mime_type', 'size', 'provider_notes', 'parsed_payload',
|
|
'parse_warnings', 'uploaded_at',
|
|
])]
|
|
class ExternalImportSource extends Model
|
|
{
|
|
public const PLATFORMS = [
|
|
'Field Nation' => 'Field Nation',
|
|
'WorkMarket' => 'WorkMarket',
|
|
'Other' => 'Other',
|
|
];
|
|
|
|
public const SOURCE_TYPES = [
|
|
'profile_pdf' => 'Profile PDF',
|
|
'screenshot' => 'Screenshot',
|
|
'csv_export' => 'CSV export',
|
|
'json_export' => 'JSON export',
|
|
'html_export' => 'HTML copy/export',
|
|
'plain_text' => 'Plain text paste/export',
|
|
'email_export' => 'Email or message export',
|
|
'other' => 'Other source',
|
|
];
|
|
|
|
public const PARSE_STATUSES = [
|
|
'pending' => 'Pending parser',
|
|
'parsed' => 'Parsed',
|
|
'failed' => 'Parse failed',
|
|
'not_parseable' => 'Stored as proof only',
|
|
];
|
|
|
|
public const REVIEW_STATUSES = [
|
|
'needs_review' => 'Needs provider review',
|
|
'provider_reviewed' => 'Provider reviewed',
|
|
'admin_reviewed' => 'Admin reviewed',
|
|
'approved_for_summary' => 'Approved for public summary',
|
|
'rejected_for_public' => 'Rejected for public display',
|
|
];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'parsed_payload' => 'array',
|
|
'parse_warnings' => 'array',
|
|
'uploaded_at' => 'datetime',
|
|
];
|
|
}
|
|
|
|
public function providerProfile(): BelongsTo
|
|
{
|
|
return $this->belongsTo(ProviderProfile::class);
|
|
}
|
|
|
|
public function externalProfileImport(): BelongsTo
|
|
{
|
|
return $this->belongsTo(ExternalProfileImport::class);
|
|
}
|
|
|
|
public function uploadedBy(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class, 'uploaded_by_id');
|
|
}
|
|
|
|
public function sourceTypeLabel(): string
|
|
{
|
|
return self::SOURCE_TYPES[$this->source_type] ?? $this->source_type;
|
|
}
|
|
|
|
public function parseStatusLabel(): string
|
|
{
|
|
return self::PARSE_STATUSES[$this->parse_status] ?? $this->parse_status;
|
|
}
|
|
|
|
public function reviewStatusLabel(): string
|
|
{
|
|
return self::REVIEW_STATUSES[$this->review_status] ?? $this->review_status;
|
|
}
|
|
}
|