feat(issues): tipo/categoría de incidencia (defecto/seguridad/calidad/documentación/otro)
- Issue::TYPES + typeLabels() (ES) + accessors type_label/type_color; columna type (string, default 'other') + fillable. - IssueForm: select "Tipo de incidencia" con validación/carga/guardado. - IssueTable: columna Tipo (badge) + SelectFilter por tipo. - IssueDetail: badge de tipo en la cabecera. - Sync offline: issue.create/update aceptan type; bundle (mapIssue) lo incluye. Tests: IssuesEnhancementsTest (create muestra el campo vía HTTP, edición persiste) + MobileApiTest (create con type). Suite 61 passing (solo 2 pre-existentes sqlite). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
+30
-1
@@ -12,10 +12,11 @@ class Issue extends Model
|
||||
|
||||
const STATUSES = ['open', 'in_review', 'resolved', 'closed'];
|
||||
const PRIORITIES = ['low', 'medium', 'high', 'critical'];
|
||||
const TYPES = ['defect', 'safety', 'quality', 'documentation', 'other'];
|
||||
|
||||
protected $fillable = [
|
||||
'project_id', 'feature_id', 'inspection_id',
|
||||
'title', 'description', 'status', 'priority',
|
||||
'title', 'description', 'status', 'priority', 'type',
|
||||
'reported_by', 'assigned_to', 'resolved_at', 'resolution_notes',
|
||||
'uuid', 'client_updated_at',
|
||||
];
|
||||
@@ -71,4 +72,32 @@ class Issue extends Model
|
||||
default => '#6b7280',
|
||||
};
|
||||
}
|
||||
|
||||
/** Human label (Spanish) for each issue type. */
|
||||
public static function typeLabels(): array
|
||||
{
|
||||
return [
|
||||
'defect' => 'Defecto',
|
||||
'safety' => 'Seguridad',
|
||||
'quality' => 'Calidad',
|
||||
'documentation' => 'Documentación',
|
||||
'other' => 'Otro',
|
||||
];
|
||||
}
|
||||
|
||||
public function getTypeLabelAttribute(): string
|
||||
{
|
||||
return self::typeLabels()[$this->type] ?? ucfirst((string) $this->type);
|
||||
}
|
||||
|
||||
public function getTypeColorAttribute(): string
|
||||
{
|
||||
return match($this->type) {
|
||||
'defect' => '#ef4444',
|
||||
'safety' => '#f97316',
|
||||
'quality' => '#0ea5e9',
|
||||
'documentation' => '#8b5cf6',
|
||||
default => '#6b7280',
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user