11<?php
22
33namespace App \Filament \Pages ;
4+ use BackedEnum ;
45
56use App \Helpers \JiraHelper ;
67use App \Jobs \ImportJiraTicketsJob ;
7- use Filament \Forms \Components \Card ;
8+ use Filament \Schemas \Components \Section ;
89use Filament \Forms \Components \Checkbox ;
910use Filament \Forms \Components \CheckboxList ;
10- use Filament \Forms \Components \Grid ;
11+ use Filament \Schemas \Components \Grid ;
1112use Filament \Forms \Components \Placeholder ;
1213use Filament \Forms \Components \TextInput ;
13- use Filament \Forms \Components \Wizard ;
14+ use Filament \Schemas \Components \Wizard ;
1415use Filament \Forms \Concerns \InteractsWithForms ;
1516use Filament \Forms \Contracts \HasForms ;
17+ use Filament \Notifications \Notification ;
1618use Filament \Pages \Page ;
1719use Illuminate \Contracts \Support \Htmlable ;
1820use Illuminate \Support \HtmlString ;
@@ -22,9 +24,9 @@ class JiraImport extends Page implements HasForms
2224{
2325 use InteractsWithForms, JiraHelper;
2426
25- protected static ? string $ navigationIcon = 'heroicon-o-cloud-download ' ;
27+ protected static string | BackedEnum | null $ navigationIcon = 'heroicon-o-cloud-arrow-down ' ;
2628
27- protected static string $ view = 'filament.pages.jira-import ' ;
29+ protected string $ view = 'filament.pages.jira-import ' ;
2830
2931 protected static ?string $ slug = 'jira-import ' ;
3032
@@ -52,30 +54,30 @@ public function mount(): void
5254 $ this ->form ->fill ();
5355 }
5456
55- protected static function shouldRegisterNavigation (): bool
57+ public static function shouldRegisterNavigation (): bool
5658 {
5759 return auth ()->user ()->can ('Import from Jira ' );
5860 }
5961
60- protected function getSubheading (): string |Htmlable |null
62+ public function getSubheading (): string |Htmlable |null
6163 {
6264 return __ ('Use this section to login into your jira account and import tickets to this application ' );
6365 }
6466
65- protected static function getNavigationLabel (): string
67+ public static function getNavigationLabel (): string
6668 {
6769 return __ ('Jira import ' );
6870 }
6971
70- protected static function getNavigationGroup (): ?string
72+ public static function getNavigationGroup (): ?string
7173 {
7274 return __ ('Settings ' );
7375 }
7476
75- protected function getFormSchema (): array
77+ public function getFormSchema (): array
7678 {
7779 return [
78- Card ::make ()
80+ Section ::make ()
7981 ->schema ([
8082 Wizard::make ([
8183 Wizard \Step::make (__ ('Jira login ' ))
@@ -84,7 +86,7 @@ protected function getFormSchema(): array
8486 ->extraAttributes ([
8587 'class ' => 'bg-primary-500 rounded-lg border border-primary-600 text-white font-medium text-sm py-3 px-4 '
8688 ])
87- ->disableLabel ()
89+ ->hiddenLabel ()
8890 ->content (__ ('Important: Your jira credentials are only used to communicate with jira REST API, and will not be stored in this application ' )),
8991
9092 Grid::make ()
@@ -117,23 +119,23 @@ protected function getFormSchema(): array
117119 ->extraAttributes ([
118120 'class ' => 'bg-primary-500 rounded-lg border border-primary-600 text-white font-medium text-sm py-3 px-4 '
119121 ])
120- ->disableLabel ()
122+ ->hiddenLabel ()
121123 ->visible (fn () => !$ this ->loadingProjects && $ this ->projects )
122124 ->content (__ ('Choose your jira projects to import ' )),
123125
124126 Placeholder::make ('loading ' )
125127 ->extraAttributes ([
126128 'class ' => 'bg-warning-500 rounded-lg border border-warning-600 text-white font-medium text-sm py-3 px-4 '
127129 ])
128- ->disableLabel ()
130+ ->hiddenLabel ()
129131 ->visible (fn () => $ this ->loadingProjects )
130132 ->content (__ ('Loading projects, please wait... ' )),
131133
132134 Placeholder::make ('info ' )
133135 ->extraAttributes ([
134136 'class ' => 'bg-danger-500 rounded-lg border border-danger-600 text-white font-medium text-sm py-3 px-4 '
135137 ])
136- ->disableLabel ()
138+ ->hiddenLabel ()
137139 ->visible (fn () => !$ this ->loadingProjects && !$ this ->projects )
138140 ->content (__ ('Your jira credentials are incorrect, please go to previous step and re-enter your jira credentials ' )),
139141
@@ -173,15 +175,15 @@ protected function getFormSchema(): array
173175 ->extraAttributes ([
174176 'class ' => 'bg-primary-500 rounded-lg border border-primary-600 text-white font-medium text-sm py-3 px-4 '
175177 ])
176- ->disableLabel ()
178+ ->hiddenLabel ()
177179 ->visible (fn () => !$ this ->loadingTickets && $ this ->tickets )
178180 ->content (__ ('Choose your jira projects to import ' ));
179181
180182 $ fields [] = Placeholder::make ('loading ' )
181183 ->extraAttributes ([
182184 'class ' => 'bg-warning-500 rounded-lg border border-warning-600 text-white font-medium text-sm py-3 px-4 '
183185 ])
184- ->disableLabel ()
186+ ->hiddenLabel ()
185187 ->visible (fn () => $ this ->loadingTickets )
186188 ->content (__ ('Loading tickets, please wait... ' ));
187189
@@ -219,7 +221,7 @@ protected function getFormSchema(): array
219221 ->extraAttributes ([
220222 'class ' => 'bg-warning-500 rounded-lg border border-warning-600 text-white font-medium text-sm py-3 px-4 '
221223 ])
222- ->disableLabel ()
224+ ->hiddenLabel ()
223225 ->visible (fn () => !$ this ->projects )
224226 ->content (__ ('No tickets found! ' ));
225227 }
@@ -241,10 +243,16 @@ public function import(): void
241243 $ tickets [] = $ this ->getJiraTicketDetails ($ this ->host , $ this ->username , $ this ->token , $ url );
242244 }
243245 dispatch (new ImportJiraTicketsJob ($ tickets , auth ()->user ()));
244- $ this ->notify ('success ' , __ ('The importation job is started, when finished you will be notified ' ), true );
245- $ this ->redirect (route ('filament.pages.jira-import ' ));
246+ Notification::make ()
247+ ->success ()
248+ ->title (__ ('The importation job is started, when finished you will be notified ' ))
249+ ->send ();
250+ $ this ->redirect (route ('filament.admin.pages.jira-import ' ));
246251 } else {
247- $ this ->notify ('warning ' , __ ('Please choose at least a jira ticket to import ' ));
252+ Notification::make ()
253+ ->warning ()
254+ ->title (__ ('Please choose at least a jira ticket to import ' ))
255+ ->send ();
248256 }
249257 }
250258
0 commit comments