Skip to content

Commit ffb8ca1

Browse files
committed
UP
1 parent c90226f commit ffb8ca1

File tree

5 files changed

+147
-3
lines changed

5 files changed

+147
-3
lines changed

config/flowforge.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
3+
return [
4+
/*
5+
|--------------------------------------------------------------------------
6+
| Flowforge Configuration
7+
|--------------------------------------------------------------------------
8+
|
9+
| This file contains configuration for the Flowforge package.
10+
|
11+
*/
12+
13+
// Default column settings
14+
'columns' => [
15+
'default_limit' => 10, // Maximum number of items per column
16+
],
17+
18+
// User Interface settings
19+
'ui' => [
20+
'show_item_counts' => true, // Whether to show item counts in column headers
21+
'show_board_title' => true, // Whether to show the board title
22+
'show_refresh_button' => true, // Whether to show the refresh button
23+
],
24+
25+
// Animation settings
26+
'animations' => [
27+
'enable_drag_animations' => true, // Whether to enable animations during drag operations
28+
],
29+
];

src/Commands/FlowforgeCommand.php

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?php
2+
3+
namespace Relaticle\Flowforge\Commands;
4+
5+
use Illuminate\Console\Command;
6+
7+
class FlowforgeCommand extends Command
8+
{
9+
/**
10+
* The name and signature of the console command.
11+
*
12+
* @var string
13+
*/
14+
protected $signature = 'flowforge:install';
15+
16+
/**
17+
* The console command description.
18+
*
19+
* @var string
20+
*/
21+
protected $description = 'Install and set up Flowforge resources';
22+
23+
/**
24+
* Execute the console command.
25+
*
26+
* @return int
27+
*/
28+
public function handle(): int
29+
{
30+
$this->info('🔄 Installing Flowforge package...');
31+
32+
// Publish assets and resources
33+
$this->info('Publishing assets...');
34+
$this->call('vendor:publish', [
35+
'--tag' => 'flowforge-assets',
36+
'--force' => true,
37+
]);
38+
39+
$this->info('✅ Flowforge installed successfully!');
40+
41+
return self::SUCCESS;
42+
}
43+
}

src/Contracts/IKanbanAdapter.php

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
<?php
2+
3+
namespace Relaticle\Flowforge\Contracts;
4+
5+
use Illuminate\Database\Eloquent\Model;
6+
use Illuminate\Support\Collection;
7+
8+
/**
9+
* Interface for Kanban board adapters.
10+
*
11+
* Adapters are responsible for the interaction between the Kanban board and models.
12+
*/
13+
interface IKanbanAdapter
14+
{
15+
/**
16+
* Get the model instance.
17+
*
18+
* @return Model
19+
*/
20+
public function getModel(): Model;
21+
22+
/**
23+
* Get the status field name for the model.
24+
*
25+
* @return string
26+
*/
27+
public function getStatusField(): string;
28+
29+
/**
30+
* Get all available status values for the model.
31+
*
32+
* @return array<string, string>
33+
*/
34+
public function getStatusValues(): array;
35+
36+
/**
37+
* Get all items for the Kanban board.
38+
*
39+
* @return Collection
40+
*/
41+
public function getItems(): Collection;
42+
43+
/**
44+
* Update the status of an item.
45+
*
46+
* @param Model $model
47+
* @param string $status
48+
* @return bool
49+
*/
50+
public function updateStatus(Model $model, string $status): bool;
51+
52+
/**
53+
* Get the attributes to display on the card.
54+
*
55+
* @return array<string, string>
56+
*/
57+
public function getCardAttributes(): array;
58+
59+
/**
60+
* Get the title attribute for the card.
61+
*
62+
* @return string
63+
*/
64+
public function getTitleAttribute(): string;
65+
66+
/**
67+
* Get the description attribute for the card.
68+
*
69+
* @return string|null
70+
*/
71+
public function getDescriptionAttribute(): ?string;
72+
}

src/FlowforgeServiceProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public function packageBooted(): void
9191
Livewire::component('relaticle.flowforge.livewire.kanban-board', KanbanBoard::class);
9292

9393
// Testing
94-
Testable::mixin(new TestsFlowforge);
94+
// Testable::mixin(new TestsFlowforge);
9595
}
9696

9797
protected function getAssetPackageName(): ?string

src/Livewire/KanbanBoard.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,8 @@ public function updateItemStatus(string $itemId, string $newStatus): void
191191
$this->dispatch('kanban-count-updated', [
192192
'oldColumn' => $oldStatus,
193193
'newColumn' => $newStatus,
194-
'oldCount' => $this->columns[$oldStatus]->count(),
195-
'newCount' => $this->columns[$newStatus]->count()
194+
'oldCount' => isset($this->columns[$oldStatus]) ? $this->columns[$oldStatus]->count() : 0,
195+
'newCount' => isset($this->columns[$newStatus]) ? $this->columns[$newStatus]->count() : 0
196196
]);
197197
}
198198
}

0 commit comments

Comments
 (0)