2020use Relaticle \Flowforge \Enums \KanbanColor ;
2121use Relaticle \Flowforge \Filament \Pages \KanbanBoardPage ;
2222
23- class KanbanBoard extends Component implements HasForms, HasActions
23+ class KanbanBoard extends Component implements HasActions, HasForms
2424{
25+ use InteractsWithActions;
2526 use InteractsWithForms;
2627 use WithPagination;
27- use InteractsWithActions;
2828
2929 /**
3030 * The name of the kanban board page class.
3131 */
32- public KanbanBoardPage | string $ pageClass ;
32+ public KanbanBoardPage | string $ pageClass ;
3333
3434 /**
3535 * The Kanban board adapter.
@@ -69,7 +69,7 @@ class KanbanBoard extends Component implements HasForms, HasActions
6969 /**
7070 * The active card for modal operations.
7171 */
72- public string | int | null $ currentRecord = null ;
72+ public string | int | null $ currentRecord = null ;
7373
7474 /**
7575 * Search query for filtering cards.
@@ -91,18 +91,17 @@ class KanbanBoard extends Component implements HasForms, HasActions
9191 /**
9292 * Initialize the Kanban board.
9393 *
94- * @param KanbanAdapterInterface $adapter The Kanban adapter
95- * @param int|null $initialCardsCount The initial number of cards to load per column
96- * @param int|null $cardsIncrement The number of cards to load on "load more"
97- * @param array<int, string> $searchable The searchable fields
94+ * @param KanbanAdapterInterface $adapter The Kanban adapter
95+ * @param int|null $initialCardsCount The initial number of cards to load per column
96+ * @param int|null $cardsIncrement The number of cards to load on "load more"
97+ * @param array<int, string> $searchable The searchable fields
9898 */
9999 public function mount (
100100 KanbanAdapterInterface $ adapter ,
101- ?int $ initialCardsCount = null ,
102- ?int $ cardsIncrement = null ,
103- array $ searchable = []
104- ): void
105- {
101+ ?int $ initialCardsCount = null ,
102+ ?int $ cardsIncrement = null ,
103+ array $ searchable = []
104+ ): void {
106105 $ this ->adapter = $ adapter ;
107106 $ this ->searchable = $ searchable ;
108107 $ this ->config = $ this ->adapter ->getConfig ();
@@ -113,7 +112,7 @@ public function mount(
113112
114113 // Initialize columns
115114 $ this ->columns = collect ($ this ->config ->getColumnValues ())
116- ->map (fn ($ label , $ value ) => [
115+ ->map (fn ($ label , $ value ) => [
117116 'id ' => $ value ,
118117 'label ' => $ label ,
119118 'color ' => $ this ->resolveColumnColors ()[$ value ] ?? null ,
@@ -183,7 +182,9 @@ public function createAction(): ?Action
183182 {
184183 $ boardPage = app ($ this ->pageClass );
185184
186- if (!method_exists ($ boardPage , 'createAction ' )) return null ;
185+ if (! method_exists ($ boardPage , 'createAction ' )) {
186+ return null ;
187+ }
187188
188189 $ action = Action::make ('create ' )
189190 ->model (function (Action $ action , array $ arguments ) {
@@ -209,7 +210,9 @@ public function editAction(): ?Action
209210 {
210211 $ boardPage = app ($ this ->pageClass );
211212
212- if (!method_exists ($ boardPage , 'editAction ' )) return null ;
213+ if (! method_exists ($ boardPage , 'editAction ' )) {
214+ return null ;
215+ }
213216
214217 $ action = Action::make ('edit ' )
215218 ->model (function (Action $ action , array $ arguments ) {
@@ -220,6 +223,7 @@ public function editAction(): ?Action
220223 })
221224 ->fillForm (function (Action $ action , array $ arguments ) {
222225 $ record = $ this ->adapter ->getModelById ($ arguments ['record ' ]);
226+
223227 return $ record ->toArray ();
224228 })
225229 ->action (function (Action $ action , array $ arguments ) {
@@ -236,7 +240,7 @@ public function editAction(): ?Action
236240 $ this ->refreshBoard ();
237241
238242 $ this ->dispatch ('kanban-record-updated ' , [
239- 'record ' => $ this ->adapter ->getModelById ($ arguments ['record ' ])
243+ 'record ' => $ this ->adapter ->getModelById ($ arguments ['record ' ]),
240244 ]);
241245 });
242246
@@ -273,30 +277,30 @@ protected function loadColumnsData(): void
273277 /**
274278 * Get items for a specific column.
275279 *
276- * @param string|int $columnId The column ID
280+ * @param string|int $columnId The column ID
277281 * @return array The formatted items
278282 */
279- public function getItemsForColumn (string | int $ columnId ): array
283+ public function getItemsForColumn (string | int $ columnId ): array
280284 {
281285 return $ this ->columnCards [$ columnId ] ?? [];
282286 }
283287
284288 /**
285289 * Get the total count of items for a specific column.
286290 *
287- * @param string|int $columnId The column ID
291+ * @param string|int $columnId The column ID
288292 * @return int The total count
289293 */
290- public function getColumnItemsCount (string | int $ columnId ): int
294+ public function getColumnItemsCount (string | int $ columnId ): int
291295 {
292296 return $ this ->adapter ->getColumnItemsCount ($ columnId );
293297 }
294298
295299 /**
296300 * Load more items for a column.
297301 *
298- * @param string $columnId The column ID
299- * @param int|null $count The number of items to load
302+ * @param string $columnId The column ID
303+ * @param int|null $count The number of items to load
300304 */
301305 public function loadMoreItems (string $ columnId , ?int $ count = null ): void
302306 {
@@ -314,7 +318,7 @@ public function loadMoreItems(string $columnId, ?int $count = null): void
314318 /**
315319 * Format items for display.
316320 *
317- * @param Collection $items The items to format
321+ * @param Collection $items The items to format
318322 * @return array The formatted items
319323 */
320324 protected function formatItems (Collection $ items ): array
@@ -325,11 +329,11 @@ protected function formatItems(Collection $items): array
325329 /**
326330 * Update the order of cards in a column.
327331 *
328- * @param int|string $columnId The column ID
329- * @param array $cardIds The card IDs in their new order
332+ * @param int|string $columnId The column ID
333+ * @param array $cardIds The card IDs in their new order
330334 * @return bool Whether the operation was successful
331335 */
332- public function updateRecordsOrderAndColumn (int | string $ columnId , array $ cardIds ): bool
336+ public function updateRecordsOrderAndColumn (int | string $ columnId , array $ cardIds ): bool
333337 {
334338 $ success = $ this ->adapter ->updateRecordsOrderAndColumn ($ columnId , $ cardIds );
335339
0 commit comments