Skip to content

Commit 20a57a4

Browse files
committed
UP
1 parent 10513a6 commit 20a57a4

File tree

3 files changed

+62
-20
lines changed

3 files changed

+62
-20
lines changed

resources/dist/flowforge.js

Lines changed: 23 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

resources/js/flowforge.js

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,14 @@ export default function flowforge({state}) {
88

99
init: function () {
1010
console.log('FlowForge Alpine component initialized')
11-
11+
1212
// Listen for form submission success/failure
13-
this.$wire.$on('kanban-card-created', ({id, status}) => {
13+
this.$wire.$on('kanban-card-created', (data) => {
14+
const id = data[0].id;
15+
const status = data[0].status;
16+
17+
this.$dispatch('close-modal', { id: 'create-card-modal' });
18+
1419
// Highlight the new card
1520
setTimeout(() => {
1621
const cardElement = document.querySelector(`[x-sortable-item="${id}"]`);
@@ -20,10 +25,15 @@ export default function flowforge({state}) {
2025
cardElement.classList.remove('animate-kanban-card-add');
2126
}, 500);
2227
}
23-
}, 100);
28+
}, 300);
2429
});
2530

26-
this.$wire.$on('kanban-card-updated', ({id}) => {
31+
this.$wire.$on('kanban-card-updated', (data) => {
32+
33+
const id = data[0].id;
34+
35+
this.$dispatch('close-modal', { id: 'edit-card-modal' });
36+
2737
// Highlight the updated card
2838
setTimeout(() => {
2939
const cardElement = document.querySelector(`[x-sortable-item="${id}"]`);
@@ -33,16 +43,33 @@ export default function flowforge({state}) {
3343
cardElement.classList.remove('animate-kanban-card-move');
3444
}, 500);
3545
}
36-
}, 100);
46+
}, 300);
3747
});
38-
48+
49+
this.$wire.$on('kanban-card-deleted', (data) => {
50+
const id = data[0].id;
51+
52+
this.$dispatch('close-modal', { id: 'edit-card-modal' });
53+
54+
// Highlight the deleted card
55+
setTimeout(() => {
56+
const cardElement = document.querySelector(`[x-sortable-item="${id}"]`);
57+
if (cardElement) {
58+
cardElement.classList.add('animate-kanban-card-delete');
59+
setTimeout(() => {
60+
cardElement.classList.remove('animate-kanban-card-delete');
61+
}, 500);
62+
}
63+
}, 300);
64+
})
65+
3966
// Listen for when items are loaded
4067
this.$wire.$on('kanban-items-loaded', () => {
4168
// Initialize sortable for newly loaded items
4269
this.initSortable();
4370
});
4471
},
45-
72+
4673
initSortable() {
4774
// Re-initialize sortable for all columns if needed
4875
// This could be implemented if needed for dynamically loaded content

src/Livewire/KanbanBoard.php

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -344,16 +344,15 @@ public function createCard(): void
344344
$this->loadColumnsData();
345345
$this->resetCreateForm();
346346

347-
$this->dispatch('close-modal', ['id' => 'create-card-modal']);
348-
$this->dispatch('kanban-card-created', [
349-
'id' => $card->getKey(),
350-
'status' => $card->{$this->adapter->getStatusField()},
351-
]);
352-
353347
Notification::make()
354348
->title(__(':recordLabel created successfully', ['recordLabel' => $this->config['recordLabel']]))
355349
->success()
356350
->send();
351+
352+
$this->dispatch('kanban-card-created', [
353+
'id' => $card->getKey(),
354+
'status' => $card->{$this->adapter->getStatusField()},
355+
]);
357356
}
358357
}
359358

@@ -400,7 +399,6 @@ public function updateCard(): void
400399
$this->loadColumnsData();
401400
$this->resetEditForm();
402401

403-
$this->dispatch('close-modal', ['id' => 'edit-card-modal']);
404402
$this->dispatch('kanban-card-updated', ['id' => $this->activeCardId]);
405403

406404
Notification::make()
@@ -450,7 +448,6 @@ public function deleteCard(): void
450448
$this->loadColumnsData();
451449
$this->resetEditForm();
452450

453-
$this->dispatch('close-modal', ['id' => 'edit-card-modal']);
454451
$this->dispatch('kanban-card-deleted', ['id' => $this->activeCardId]);
455452

456453
Notification::make()

0 commit comments

Comments
 (0)