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:
@@ -23,6 +23,7 @@ class IssueForm extends Component
|
||||
public $description = '';
|
||||
public $status = 'open';
|
||||
public $priority = 'medium';
|
||||
public $type = 'defect';
|
||||
public $assignedTo = '';
|
||||
public $resolutionNotes = '';
|
||||
|
||||
@@ -48,6 +49,7 @@ class IssueForm extends Component
|
||||
$this->description = $issue->description ?? '';
|
||||
$this->status = $issue->status;
|
||||
$this->priority = $issue->priority;
|
||||
$this->type = $issue->type ?? 'defect';
|
||||
$this->assignedTo = $issue->assigned_to ?? '';
|
||||
$this->resolutionNotes = $issue->resolution_notes ?? '';
|
||||
$this->featureId = $issue->feature_id;
|
||||
@@ -77,6 +79,7 @@ class IssueForm extends Component
|
||||
'description' => 'nullable|string',
|
||||
'status' => 'required|in:' . implode(',', Issue::STATUSES),
|
||||
'priority' => 'required|in:' . implode(',', Issue::PRIORITIES),
|
||||
'type' => 'required|in:' . implode(',', Issue::TYPES),
|
||||
'assignedTo' => 'nullable|exists:users,id',
|
||||
'resolutionNotes' => 'nullable|string',
|
||||
];
|
||||
@@ -92,6 +95,7 @@ class IssueForm extends Component
|
||||
'description' => $this->description,
|
||||
'status' => $this->status,
|
||||
'priority' => $this->priority,
|
||||
'type' => $this->type,
|
||||
'feature_id' => $this->featureId,
|
||||
'inspection_id' => $this->inspectionId,
|
||||
'assigned_to' => $this->assignedTo ?: null,
|
||||
|
||||
@@ -91,6 +91,12 @@ class IssueTable extends DataTableComponent
|
||||
})
|
||||
->html(),
|
||||
|
||||
Column::make('Tipo', 'type')
|
||||
->sortable()
|
||||
->format(fn ($value, $row) =>
|
||||
'<span class="badge badge-sm" style="background-color:'.$row->type_color.';color:#fff;border-color:transparent;">'.e($row->type_label).'</span>')
|
||||
->html(),
|
||||
|
||||
Column::make('Feature')
|
||||
->label(fn ($row) => $row->feature
|
||||
? '<span class="badge badge-outline badge-sm">'.e($row->feature->name).'</span>'
|
||||
@@ -185,6 +191,10 @@ class IssueTable extends DataTableComponent
|
||||
'low' => 'Baja',
|
||||
])
|
||||
->filter(fn (Builder $query, string $value) => $query->where('issues.priority', $value)),
|
||||
|
||||
SelectFilter::make('Tipo', 'type')
|
||||
->options(['' => 'Tipo: todos'] + \App\Models\Issue::typeLabels())
|
||||
->filter(fn (Builder $query, string $value) => $query->where('issues.type', $value)),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user