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:
@@ -321,11 +321,12 @@ class MobileApiTest extends TestCase
|
||||
$uuid = (string) Str::uuid();
|
||||
$this->postJson('/api/v1/sync', ['operations' => [[
|
||||
'entity' => 'issue', 'op' => 'create', 'uuid' => $uuid,
|
||||
'data' => ['project_id' => $project->id, 'title' => 'Grieta', 'priority' => 'high'],
|
||||
'data' => ['project_id' => $project->id, 'title' => 'Grieta', 'priority' => 'high', 'type' => 'safety'],
|
||||
]]])->assertOk()->assertJsonPath('results.0.status', 'applied');
|
||||
|
||||
$issue = Issue::where('uuid', $uuid)->firstOrFail();
|
||||
$this->assertEquals('open', $issue->status);
|
||||
$this->assertEquals('safety', $issue->type);
|
||||
|
||||
// update (resolve) → resolved_at set
|
||||
$this->postJson('/api/v1/sync', ['operations' => [[
|
||||
|
||||
@@ -183,6 +183,31 @@ class IssuesEnhancementsTest extends TestCase
|
||||
$this->assertNotNull($task->fresh()->overdue_notified_at);
|
||||
}
|
||||
|
||||
// ── Issue type / category ──────────────────────────────────────────────────────
|
||||
|
||||
public function test_create_form_shows_the_type_field(): void
|
||||
{
|
||||
$this->actingAs($this->user)
|
||||
->get(route('projects.issues.create', $this->project))
|
||||
->assertOk()
|
||||
->assertSee('Tipo de incidencia')
|
||||
->assertSee('Defecto')
|
||||
->assertSee('Seguridad');
|
||||
}
|
||||
|
||||
public function test_editing_an_issue_persists_the_type(): void
|
||||
{
|
||||
$issue = $this->makeIssue(['type' => 'defect']);
|
||||
|
||||
Livewire::actingAs($this->user)
|
||||
->test(IssueForm::class, ['project' => $this->project, 'issue' => $issue])
|
||||
->assertSet('type', 'defect')
|
||||
->set('type', 'safety')
|
||||
->call('save');
|
||||
|
||||
$this->assertEquals('safety', $issue->fresh()->type);
|
||||
}
|
||||
|
||||
// ── Report issue from a map feature ──────────────────────────────────────────
|
||||
|
||||
public function test_issue_form_prelinks_feature_from_query(): void
|
||||
|
||||
Reference in New Issue
Block a user