2121use Relaticle \Flowforge \Enums \KanbanColor ;
2222use Relaticle \Flowforge \Filament \Pages \KanbanBoardPage ;
2323
24- class KanbanBoard extends Component implements HasForms, HasActions
24+ class KanbanBoard extends Component implements HasActions, HasForms
2525{
26+ use InteractsWithActions;
2627 use InteractsWithForms;
2728 use WithPagination;
28- use InteractsWithActions;
2929
3030 /**
3131 * The name of the kanban board page class.
3232 */
33- public KanbanBoardPage | string $ pageClass ;
33+ public KanbanBoardPage | string $ pageClass ;
3434
3535 /**
3636 * The Kanban board adapter.
@@ -70,7 +70,7 @@ class KanbanBoard extends Component implements HasForms, HasActions
7070 /**
7171 * The active card for modal operations.
7272 */
73- public string | int | null $ currentRecord = null ;
73+ public string | int | null $ currentRecord = null ;
7474
7575 /**
7676 * Search query for filtering cards.
@@ -94,18 +94,17 @@ class KanbanBoard extends Component implements HasForms, HasActions
9494 /**
9595 * Initialize the Kanban board.
9696 *
97- * @param KanbanAdapterInterface $adapter The Kanban adapter
98- * @param int|null $initialCardsCount The initial number of cards to load per column
99- * @param int|null $cardsIncrement The number of cards to load on "load more"
100- * @param array<int, string> $searchable The searchable fields
97+ * @param KanbanAdapterInterface $adapter The Kanban adapter
98+ * @param int|null $initialCardsCount The initial number of cards to load per column
99+ * @param int|null $cardsIncrement The number of cards to load on "load more"
100+ * @param array<int, string> $searchable The searchable fields
101101 */
102102 public function mount (
103103 KanbanAdapterInterface $ adapter ,
104- ?int $ initialCardsCount = null ,
105- ?int $ cardsIncrement = null ,
106- array $ searchable = []
107- ): void
108- {
104+ ?int $ initialCardsCount = null ,
105+ ?int $ cardsIncrement = null ,
106+ array $ searchable = []
107+ ): void {
109108 $ this ->adapter = $ adapter ;
110109 $ this ->searchable = $ searchable ;
111110 $ this ->config = $ this ->adapter ->getConfig ();
@@ -122,7 +121,7 @@ public function mount(
122121
123122 // Initialize columns
124123 $ this ->columns = collect ($ this ->config ->getColumnValues ())
125- ->map (fn ($ label , $ value ) => [
124+ ->map (fn ($ label , $ value ) => [
126125 'id ' => $ value ,
127126 'label ' => $ label ,
128127 'color ' => $ this ->resolveColumnColors ()[$ value ] ?? null ,
@@ -192,7 +191,9 @@ public function createAction(): ?Action
192191 {
193192 $ boardPage = app ($ this ->pageClass );
194193
195- if (!method_exists ($ boardPage , 'createAction ' )) return null ;
194+ if (! method_exists ($ boardPage , 'createAction ' )) {
195+ return null ;
196+ }
196197
197198 $ action = Action::make ('create ' )
198199 ->model (function (Action $ action , array $ arguments ) {
@@ -218,7 +219,9 @@ public function editAction(): ?Action
218219 {
219220 $ boardPage = app ($ this ->pageClass );
220221
221- if (!method_exists ($ boardPage , 'editAction ' )) return null ;
222+ if (! method_exists ($ boardPage , 'editAction ' )) {
223+ return null ;
224+ }
222225
223226 $ action = Action::make ('edit ' )
224227 ->model (function (Action $ action , array $ arguments ) {
@@ -229,6 +232,7 @@ public function editAction(): ?Action
229232 })
230233 ->fillForm (function (Action $ action , array $ arguments ) {
231234 $ record = $ this ->adapter ->getModelById ($ arguments ['record ' ]);
235+
232236 return $ record ->toArray ();
233237 })
234238 ->action (function (Action $ action , array $ arguments ) {
@@ -243,9 +247,9 @@ public function editAction(): ?Action
243247 })
244248 ->after (function (Action $ action , array $ arguments ) {
245249 $ this ->refreshBoard ();
246-
250+
247251 $ this ->dispatch ('kanban-record-updated ' , [
248- 'record ' => $ this ->adapter ->getModelById ($ arguments ['record ' ])
252+ 'record ' => $ this ->adapter ->getModelById ($ arguments ['record ' ]),
249253 ]);
250254 });
251255
@@ -282,30 +286,30 @@ protected function loadColumnsData(): void
282286 /**
283287 * Get items for a specific column.
284288 *
285- * @param string|int $columnId The column ID
289+ * @param string|int $columnId The column ID
286290 * @return array The formatted items
287291 */
288- public function getItemsForColumn (string | int $ columnId ): array
292+ public function getItemsForColumn (string | int $ columnId ): array
289293 {
290294 return $ this ->columnCards [$ columnId ] ?? [];
291295 }
292296
293297 /**
294298 * Get the total count of items for a specific column.
295299 *
296- * @param string|int $columnId The column ID
300+ * @param string|int $columnId The column ID
297301 * @return int The total count
298302 */
299- public function getColumnItemsCount (string | int $ columnId ): int
303+ public function getColumnItemsCount (string | int $ columnId ): int
300304 {
301305 return $ this ->adapter ->getColumnItemsCount ($ columnId );
302306 }
303307
304308 /**
305309 * Load more items for a column.
306310 *
307- * @param string $columnId The column ID
308- * @param int|null $count The number of items to load
311+ * @param string $columnId The column ID
312+ * @param int|null $count The number of items to load
309313 */
310314 public function loadMoreItems (string $ columnId , ?int $ count = null ): void
311315 {
@@ -323,7 +327,7 @@ public function loadMoreItems(string $columnId, ?int $count = null): void
323327 /**
324328 * Format items for display.
325329 *
326- * @param Collection $items The items to format
330+ * @param Collection $items The items to format
327331 * @return array The formatted items
328332 */
329333 protected function formatItems (Collection $ items ): array
@@ -334,11 +338,11 @@ protected function formatItems(Collection $items): array
334338 /**
335339 * Update the order of cards in a column.
336340 *
337- * @param int|string $columnId The column ID
338- * @param array $cardIds The card IDs in their new order
341+ * @param int|string $columnId The column ID
342+ * @param array $cardIds The card IDs in their new order
339343 * @return bool Whether the operation was successful
340344 */
341- public function updateRecordsOrderAndColumn (int | string $ columnId , array $ cardIds ): bool
345+ public function updateRecordsOrderAndColumn (int | string $ columnId , array $ cardIds ): bool
342346 {
343347 $ success = $ this ->adapter ->updateRecordsOrderAndColumn ($ columnId , $ cardIds );
344348
@@ -354,7 +358,7 @@ public function updateRecordsOrderAndColumn(int|string $columnId, array $cardIds
354358 */
355359 public function deleteRecord (): void
356360 {
357- if (!$ this ->permissions ['canDelete ' ]) {
361+ if (! $ this ->permissions ['canDelete ' ]) {
358362 Notification::make ()
359363 ->title (__ ('You do not have permission to delete :records ' , ['records ' => $ this ->config ->getPluralCardLabel ()]))
360364 ->danger ()
@@ -365,7 +369,7 @@ public function deleteRecord(): void
365369
366370 $ record = $ this ->adapter ->getModelById ($ this ->currentRecord );
367371
368- if (!$ record ) {
372+ if (! $ record ) {
369373 Notification::make ()
370374 ->title ('Record not found ' )
371375 ->danger ()
0 commit comments