7d854ffb0a
- Translation system: lang/es/ PHP files (auth, validation, pagination, passwords)
- Rappasoft vendor translations published (lang/vendor/livewire-tables/es/)
- JSON files synced to 391 keys (EN + ES, full parity)
- APP_LOCALE changed to 'es', users.locale column default changed to 'es'
- Language switcher fixed: JS event + window.location.reload() avoids /livewire/update redirect
- SetLocale middleware fallback uses config('app.locale') instead of hardcoded 'en'
- setSortingPillsEnabled(false) on ProjectTable, CompanyTable, UserTable
- Translated 17 blade views: project-map, template-manager, layer-manager,
company-management, phase-list, media-manager, reports-dashboard,
client-projects, layer-upload, project-form, project-map-editor-tab,
admin/users, projects/media, projects/templates, layouts/client
- Navigation 'Empresas' link uses __('Companies')
- Fixed typo key 'Fases and layers' -> 'Phases and layers'
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
72 lines
1.6 KiB
PHP
72 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
use App\Traits\LogsActivity;
|
|
|
|
class Feature extends Model
|
|
{
|
|
use SoftDeletes, LogsActivity;
|
|
|
|
const STATUSES = ['planned', 'started', 'in_progress', 'completed', 'verified'];
|
|
|
|
protected $fillable = [
|
|
'layer_id', 'name', 'geometry', 'properties', 'template_id',
|
|
'progress', 'status', 'responsible', 'responsible_user_id',
|
|
];
|
|
|
|
protected $casts = [
|
|
'geometry' => 'array',
|
|
'properties' => 'array',
|
|
];
|
|
|
|
public function layer()
|
|
{
|
|
return $this->belongsTo(Layer::class);
|
|
}
|
|
|
|
public function template()
|
|
{
|
|
return $this->belongsTo(InspectionTemplate::class);
|
|
}
|
|
|
|
public function inspections()
|
|
{
|
|
return $this->hasMany(Inspection::class, 'feature_id');
|
|
}
|
|
|
|
public function issues()
|
|
{
|
|
return $this->hasMany(Issue::class);
|
|
}
|
|
|
|
public function responsibleUser()
|
|
{
|
|
return $this->belongsTo(User::class, 'responsible_user_id');
|
|
}
|
|
|
|
public function media()
|
|
{
|
|
return $this->morphMany(Media::class, 'mediable');
|
|
}
|
|
|
|
public function images()
|
|
{
|
|
return $this->morphMany(Media::class, 'mediable')->where('category', 'image');
|
|
}
|
|
|
|
public function getStatusColorAttribute(): string
|
|
{
|
|
return match($this->status) {
|
|
'planned' => '#6b7280',
|
|
'started' => '#3b82f6',
|
|
'in_progress' => '#f59e0b',
|
|
'completed' => '#10b981',
|
|
'verified' => '#8b5cf6',
|
|
default => '#6b7280',
|
|
};
|
|
}
|
|
}
|