feat: Phase 6.1 - Split ProjectMap into traits (part 1)
- Create MapLayers trait (layer/phase visibility, filters) - Create MapInspections trait (inspection CRUD, viewer, editor) - Create MapIssues trait (issue count listeners) - Create MapFeatures trait (feature selection, progress, images) Tests: 101 passing (319 assertions)
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Livewire\Projects\Traits;
|
||||
|
||||
use App\Models\Feature;
|
||||
use App\Models\Issue;
|
||||
use Livewire\Attributes\On;
|
||||
|
||||
trait MapIssues
|
||||
{
|
||||
public $openIssuesCount = 0;
|
||||
|
||||
#[On('issue-created')]
|
||||
public function handleIssueCreated()
|
||||
{
|
||||
$this->openIssuesCount = Issue::where('project_id', $this->project->id)
|
||||
->where('status', 'open')
|
||||
->count();
|
||||
}
|
||||
|
||||
#[On('issue-updated')]
|
||||
public function handleIssueUpdated()
|
||||
{
|
||||
$this->openIssuesCount = Issue::where('project_id', $this->project->id)
|
||||
->where('status', 'open')
|
||||
->count();
|
||||
}
|
||||
|
||||
#[On('issue-deleted')]
|
||||
public function handleIssueDeleted()
|
||||
{
|
||||
$this->openIssuesCount = Issue::where('project_id', $this->project->id)
|
||||
->where('status', 'open')
|
||||
->count();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user