Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions app/Filament/Pages/Kanban.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
use App\Models\TicketType;
use App\Models\User;
use Filament\Facades\Filament;
use Filament\Forms\Components\Checkbox;
use Filament\Forms\Components\Grid;
use Filament\Forms\Components\Placeholder;
use Filament\Forms\Components\Select;
Expand All @@ -21,7 +20,6 @@
use Illuminate\Contracts\Support\Htmlable;
use Illuminate\Support\Collection;
use Illuminate\Support\HtmlString;
use Closure;

class Kanban extends Page implements HasForms
{
Expand All @@ -44,8 +42,11 @@ class Kanban extends Page implements HasForms
public $priorities = [];
public $includeNotAffectedTickets = false;

public bool $ticket = false;

protected $listeners = [
'recordUpdated'
'recordUpdated',
'closeTicketDialog'
];

public function mount()
Expand Down Expand Up @@ -253,4 +254,17 @@ public function resetFilters(): void
$this->filter();
}

public function createTicket(): void
{
$this->ticket = true;
}

public function closeTicketDialog(bool $refresh): void
{
$this->ticket = false;
if ($refresh) {
$this->filter();
}
}

}
19 changes: 13 additions & 6 deletions app/Http/Livewire/RoadMap/IssueForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,16 @@ class IssueForm extends Component implements HasForms
{
use InteractsWithForms;

public Project $project;
public Project|null $project = null;
public array $epics;

public function mount()
{
$project = Project::where('id', $this->project->id)->first();
if ($this->project) {
$project = Project::where('id', $this->project->id)->first();
} else {
$project = null;
}
if ($project?->status_type === 'custom') {
$defaultStatus = TicketStatus::where('project_id', $project->id)
->where('is_default', true)
Expand All @@ -34,8 +39,9 @@ public function mount()
->first()
?->id;
}
$this->epics = $this->project ? $this->project->epics->pluck('name', 'id')->toArray() : [];
$this->form->fill([
'project_id' => $this->project->id,
'project_id' => $this->project?->id ?? null,
'owner_id' => auth()->user()->id,
'status_id' => $defaultStatus,
'type_id' => TicketType::where('is_default', true)->first()?->id,
Expand All @@ -59,8 +65,8 @@ protected function getFormSchema(): array
->label(__('Project'))
->searchable()
->reactive()
->disabled()
->columnSpan(1)
->disabled($this->project != null)
->columnSpan(fn () => $this->project == null ? 2 : 1)
->options(fn() => Project::where('owner_id', auth()->user()->id)
->orWhereHas('users', function ($query) {
return $query->where('users.id', auth()->user()->id);
Expand All @@ -74,7 +80,8 @@ protected function getFormSchema(): array
->reactive()
->columnSpan(1)
->required()
->options($this->project->epics->pluck('name', 'id')->toArray()),
->visible($this->project != null)
->options($this->epics),

Forms\Components\TextInput::make('name')
->label(__('Ticket name'))
Expand Down
19 changes: 17 additions & 2 deletions resources/views/partials/kanban/status.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,27 @@
@include('partials.kanban.record')
@endforeach

<!-- href="{{ route('filament.resources.tickets.create', ['project' => request()->get('project')]) }}" -->
@if($status['add_ticket'])
<a class="create-record"
href="{{ route('filament.resources.tickets.create', ['project' => request()->get('project')]) }}"
<a class="create-record hover:cursor-pointer"
wire:click="createTicket"
target="_blank">
<x-heroicon-o-plus class="w-4 h-4" /> {{ __('Create ticket') }}
</a>

@if($ticket)
<!-- Epic modal -->
<div class="dialog-container">
<div class="dialog dialog-xl">
<div class="dialog-header">
{{ __('Create ticket') }}
</div>
<div class="dialog-content">
@livewire('road-map.issue-form', ['project' => null])
</div>
</div>
</div>
@endif
@endif
</div>
</div>