Core UI updates for helpdesk
This commit is contained in:
@@ -10,6 +10,7 @@ use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Modules\Helpdesk\Models\Category;
|
||||
use Modules\Helpdesk\Models\GitRepository;
|
||||
use Modules\Helpdesk\Models\KanbanBoard;
|
||||
use Modules\Helpdesk\Models\Priority;
|
||||
use Modules\Helpdesk\Models\Project;
|
||||
use Modules\Helpdesk\Models\Status;
|
||||
@@ -137,6 +138,7 @@ trait BuildsHelpdeskFixtures
|
||||
'user_id' => $owner->id,
|
||||
'agent_id' => $agent?->id,
|
||||
'status_id' => $this->ticketStatus()->id,
|
||||
'board_id' => $attributes['board_id'] ?? null,
|
||||
'priority_id' => $this->priority()->id,
|
||||
'category_id' => null,
|
||||
'project_id' => null,
|
||||
@@ -156,8 +158,10 @@ trait BuildsHelpdeskFixtures
|
||||
$category = $this->category(['name' => 'Support', 'slug' => 'support']);
|
||||
$team = $this->team(['name' => 'Support Team', 'slug' => 'support-team']);
|
||||
$project = $this->project(['title' => 'WMS Core', 'slug' => 'wms-core', 'team_id' => $team->id]);
|
||||
$board = KanbanBoard::query()->create(['name' => 'Standard Support', 'slug' => 'standard-support', 'description' => 'Default support board', 'is_default' => true, 'sort_order' => 1]);
|
||||
$board->statuses()->sync([$open->id => ['sort_order' => 10], $closed->id => ['sort_order' => 20]]);
|
||||
|
||||
return compact('open', 'closed', 'normal', 'high', 'category', 'team', 'project');
|
||||
return compact('open', 'closed', 'normal', 'high', 'category', 'team', 'project', 'board');
|
||||
}
|
||||
|
||||
protected function ensureCompanyTableHasOne(): ?int
|
||||
|
||||
@@ -7,6 +7,7 @@ namespace Modules\Helpdesk\Tests\Feature;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Livewire\Livewire;
|
||||
use Modules\Helpdesk\Livewire\KanbanBoard;
|
||||
use Modules\Helpdesk\Models\KanbanBoard as KanbanBoardModel;
|
||||
use Modules\Helpdesk\Tests\Concerns\BuildsHelpdeskFixtures;
|
||||
use Tests\TestCase;
|
||||
|
||||
@@ -25,6 +26,7 @@ final class KanbanBoardTest extends TestCase
|
||||
'owner' => $user,
|
||||
'status_id' => $lookups['open']->id,
|
||||
'priority_id' => $lookups['high']->id,
|
||||
'board_id' => $lookups['board']->id,
|
||||
'subject' => 'Kanban visible ticket',
|
||||
]);
|
||||
|
||||
@@ -47,6 +49,7 @@ final class KanbanBoardTest extends TestCase
|
||||
'owner' => $user,
|
||||
'status_id' => $lookups['open']->id,
|
||||
'priority_id' => $lookups['normal']->id,
|
||||
'board_id' => $lookups['board']->id,
|
||||
]);
|
||||
|
||||
$this->actingAs($user);
|
||||
@@ -58,6 +61,38 @@ final class KanbanBoardTest extends TestCase
|
||||
$ticket->refresh();
|
||||
|
||||
$this->assertSame($lookups['closed']->id, $ticket->status_id);
|
||||
$this->assertSame($lookups['board']->id, $ticket->board_id);
|
||||
$this->assertNotNull($ticket->completed_at);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function kanban_ticket_can_be_moved_to_another_board_and_only_has_one_board(): void
|
||||
{
|
||||
$lookups = $this->seedLookupData();
|
||||
$user = $this->admin();
|
||||
$targetBoard = KanbanBoardModel::query()->create([
|
||||
'name' => 'Development Board',
|
||||
'slug' => 'development-board',
|
||||
'is_default' => false,
|
||||
'sort_order' => 20,
|
||||
]);
|
||||
$targetBoard->statuses()->sync([$lookups['open']->id => ['sort_order' => 10]]);
|
||||
|
||||
$ticket = $this->ticket([
|
||||
'owner' => $user,
|
||||
'status_id' => $lookups['open']->id,
|
||||
'priority_id' => $lookups['normal']->id,
|
||||
'board_id' => $lookups['board']->id,
|
||||
]);
|
||||
|
||||
$this->actingAs($user);
|
||||
|
||||
Livewire::test(KanbanBoard::class)
|
||||
->call('moveTicketToBoard', $ticket->id, $targetBoard->id)
|
||||
->assertHasNoErrors();
|
||||
|
||||
$ticket->refresh();
|
||||
|
||||
$this->assertSame($targetBoard->id, $ticket->board_id);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user