Skip to content
Open

V2 0 #145

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
32 changes: 0 additions & 32 deletions app/Console/Kernel.php

This file was deleted.

50 changes: 0 additions & 50 deletions app/Exceptions/Handler.php

This file was deleted.

25 changes: 13 additions & 12 deletions app/Filament/Pages/Board.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php

namespace App\Filament\Pages;
use BackedEnum;

use App\Models\Project;
use Filament\Forms\Components\Card;
use Filament\Forms\Components\Grid;
use Filament\Schemas\Components\Section;
use Filament\Schemas\Components\Grid;
use Filament\Forms\Components\Select;
use Filament\Forms\Concerns\InteractsWithForms;
use Filament\Forms\Contracts\HasForms;
Expand All @@ -15,15 +16,15 @@ class Board extends Page implements HasForms
{
use InteractsWithForms;

protected static ?string $navigationIcon = 'heroicon-o-view-boards';
protected static string | BackedEnum | null $navigationIcon = 'heroicon-o-view-columns';

protected static string $view = 'filament.pages.board';
protected string $view = 'filament.pages.board';

protected static ?string $slug = 'board';

protected static ?int $navigationSort = 4;

protected function getSubheading(): string|Htmlable|null
public function getSubheading(): string|Htmlable|null
{
return __("In this section you can choose one of your projects to show it's Scrum or Kanban board");
}
Expand All @@ -33,20 +34,20 @@ public function mount(): void
$this->form->fill();
}

protected static function getNavigationLabel(): string
public static function getNavigationLabel(): string
{
return __('Board');
}

protected static function getNavigationGroup(): ?string
public static function getNavigationGroup(): ?string
{
return __('Management');
}

protected function getFormSchema(): array
public function getFormSchema(): array
{
return [
Card::make()
Section::make()
->schema([
Grid::make()
->columns(1)
Expand All @@ -55,7 +56,7 @@ protected function getFormSchema(): array
->label(__('Project'))
->required()
->searchable()
->reactive()
->live()
->afterStateUpdated(fn () => $this->search())
->helperText(__("Choose a project to show it's board"))
->options(fn() => Project::where('owner_id', auth()->user()->id)
Expand All @@ -72,9 +73,9 @@ public function search(): void
$data = $this->form->getState();
$project = Project::find($data['project']);
if ($project->type === "scrum") {
$this->redirect(route('filament.pages.scrum/{project}', ['project' => $project]));
$this->redirect(route('filament.admin.pages.scrum.{project}', ['project' => $project]));
} else {
$this->redirect(route('filament.pages.kanban/{project}', ['project' => $project]));
$this->redirect(route('filament.admin.pages.kanban.{project}', ['project' => $project]));
}
}
}
4 changes: 2 additions & 2 deletions app/Filament/Pages/Dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ class Dashboard extends BasePage
{
protected static bool $shouldRegisterNavigation = false;

protected function getColumns(): int | array
public function getColumns(): int | array
{
return 6;
}

protected function getWidgets(): array
public function getWidgets(): array
{
return [
FavoriteProjects::class,
Expand Down
50 changes: 29 additions & 21 deletions app/Filament/Pages/JiraImport.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
<?php

namespace App\Filament\Pages;
use BackedEnum;

use App\Helpers\JiraHelper;
use App\Jobs\ImportJiraTicketsJob;
use Filament\Forms\Components\Card;
use Filament\Schemas\Components\Section;
use Filament\Forms\Components\Checkbox;
use Filament\Forms\Components\CheckboxList;
use Filament\Forms\Components\Grid;
use Filament\Schemas\Components\Grid;
use Filament\Forms\Components\Placeholder;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Wizard;
use Filament\Schemas\Components\Wizard;
use Filament\Forms\Concerns\InteractsWithForms;
use Filament\Forms\Contracts\HasForms;
use Filament\Notifications\Notification;
use Filament\Pages\Page;
use Illuminate\Contracts\Support\Htmlable;
use Illuminate\Support\HtmlString;
Expand All @@ -22,9 +24,9 @@ class JiraImport extends Page implements HasForms
{
use InteractsWithForms, JiraHelper;

protected static ?string $navigationIcon = 'heroicon-o-cloud-download';
protected static string | BackedEnum | null $navigationIcon = 'heroicon-o-cloud-arrow-down';

protected static string $view = 'filament.pages.jira-import';
protected string $view = 'filament.pages.jira-import';

protected static ?string $slug = 'jira-import';

Expand Down Expand Up @@ -52,30 +54,30 @@ public function mount(): void
$this->form->fill();
}

protected static function shouldRegisterNavigation(): bool
public static function shouldRegisterNavigation(): bool
{
return auth()->user()->can('Import from Jira');
}

protected function getSubheading(): string|Htmlable|null
public function getSubheading(): string|Htmlable|null
{
return __('Use this section to login into your jira account and import tickets to this application');
}

protected static function getNavigationLabel(): string
public static function getNavigationLabel(): string
{
return __('Jira import');
}

protected static function getNavigationGroup(): ?string
public static function getNavigationGroup(): ?string
{
return __('Settings');
}

protected function getFormSchema(): array
public function getFormSchema(): array
{
return [
Card::make()
Section::make()
->schema([
Wizard::make([
Wizard\Step::make(__('Jira login'))
Expand All @@ -84,7 +86,7 @@ protected function getFormSchema(): array
->extraAttributes([
'class' => 'bg-primary-500 rounded-lg border border-primary-600 text-white font-medium text-sm py-3 px-4'
])
->disableLabel()
->hiddenLabel()
->content(__('Important: Your jira credentials are only used to communicate with jira REST API, and will not be stored in this application')),

Grid::make()
Expand Down Expand Up @@ -117,23 +119,23 @@ protected function getFormSchema(): array
->extraAttributes([
'class' => 'bg-primary-500 rounded-lg border border-primary-600 text-white font-medium text-sm py-3 px-4'
])
->disableLabel()
->hiddenLabel()
->visible(fn() => !$this->loadingProjects && $this->projects)
->content(__('Choose your jira projects to import')),

Placeholder::make('loading')
->extraAttributes([
'class' => 'bg-warning-500 rounded-lg border border-warning-600 text-white font-medium text-sm py-3 px-4'
])
->disableLabel()
->hiddenLabel()
->visible(fn() => $this->loadingProjects)
->content(__('Loading projects, please wait...')),

Placeholder::make('info')
->extraAttributes([
'class' => 'bg-danger-500 rounded-lg border border-danger-600 text-white font-medium text-sm py-3 px-4'
])
->disableLabel()
->hiddenLabel()
->visible(fn() => !$this->loadingProjects && !$this->projects)
->content(__('Your jira credentials are incorrect, please go to previous step and re-enter your jira credentials')),

Expand Down Expand Up @@ -173,15 +175,15 @@ protected function getFormSchema(): array
->extraAttributes([
'class' => 'bg-primary-500 rounded-lg border border-primary-600 text-white font-medium text-sm py-3 px-4'
])
->disableLabel()
->hiddenLabel()
->visible(fn() => !$this->loadingTickets && $this->tickets)
->content(__('Choose your jira projects to import'));

$fields[] = Placeholder::make('loading')
->extraAttributes([
'class' => 'bg-warning-500 rounded-lg border border-warning-600 text-white font-medium text-sm py-3 px-4'
])
->disableLabel()
->hiddenLabel()
->visible(fn() => $this->loadingTickets)
->content(__('Loading tickets, please wait...'));

Expand Down Expand Up @@ -219,7 +221,7 @@ protected function getFormSchema(): array
->extraAttributes([
'class' => 'bg-warning-500 rounded-lg border border-warning-600 text-white font-medium text-sm py-3 px-4'
])
->disableLabel()
->hiddenLabel()
->visible(fn() => !$this->projects)
->content(__('No tickets found!'));
}
Expand All @@ -241,10 +243,16 @@ public function import(): void
$tickets[] = $this->getJiraTicketDetails($this->host, $this->username, $this->token, $url);
}
dispatch(new ImportJiraTicketsJob($tickets, auth()->user()));
$this->notify('success', __('The importation job is started, when finished you will be notified'), true);
$this->redirect(route('filament.pages.jira-import'));
Notification::make()
->success()
->title(__('The importation job is started, when finished you will be notified'))
->send();
$this->redirect(route('filament.admin.pages.jira-import'));
} else {
$this->notify('warning', __('Please choose at least a jira ticket to import'));
Notification::make()
->warning()
->title(__('Please choose at least a jira ticket to import'))
->send();
}
}

Expand Down
Loading
Loading