Skip to content

Commit fda31fe

Browse files
committed
UPGRADE
1 parent 800f5b7 commit fda31fe

File tree

7 files changed

+151
-317
lines changed

7 files changed

+151
-317
lines changed

bin/build.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,6 @@ const defaultOptions = {
4545

4646
compile({
4747
...defaultOptions,
48-
entryPoints: ['./resources/js/index.js'],
48+
entryPoints: ['./resources/js/flowforge.js'],
4949
outfile: './resources/dist/flowforge.js',
5050
})

resources/dist/flowforge.js

Lines changed: 59 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

resources/js/flowforge.js

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
export default function flowforge({state}) {
2+
return {
3+
state,
4+
currentColumn: null,
5+
currentCard: null,
6+
formData: {
7+
a: '23',
8+
},
9+
10+
init: function () {
11+
console.log('FlowForge Alpine component initialized')
12+
// Initialise the Alpine component here, if you need to.
13+
},
14+
15+
openCreateModal(columnId) {
16+
this.currentColumn = columnId;
17+
this.formData = {
18+
[state.statusField]: columnId
19+
};
20+
this.$dispatch('open-modal', { id: 'create-card-modal' })
21+
},
22+
23+
submitCreateForm() {
24+
console.log(this.formData);
25+
this.$wire.createCard(this.formData).then(cardId => {
26+
if (cardId) {
27+
this.$dispatch('close-modal', { id: 'create-card-modal' });
28+
this.formData = {};
29+
}
30+
});
31+
},
32+
33+
openEditModal(card, columnId) {
34+
this.currentCard = card;
35+
this.currentColumn = columnId;
36+
37+
// Initialize form data with current card values
38+
this.formData = {...card};
39+
this.formData[state.statusField] = columnId;
40+
41+
this.$dispatch('open-modal', { id: 'edit-card-modal' })
42+
},
43+
44+
submitEditForm() {
45+
this.$wire.updateCard(this.currentCard.id, this.formData).then(result => {
46+
if (result) {
47+
this.$dispatch('close-modal', { id: 'edit-card-modal' });
48+
this.formData = {};
49+
}
50+
});
51+
},
52+
53+
deleteCard() {
54+
if (confirm('Are you sure you want to delete this card? This action cannot be undone.')) {
55+
this.$wire.deleteCard(this.currentCard.id).then(result => {
56+
if (result) {
57+
this.$dispatch('close-modal', { id: 'delete-card-modal' });
58+
this.formData = {};
59+
}
60+
});
61+
}
62+
},
63+
}
64+
}

resources/js/index.js

Lines changed: 0 additions & 246 deletions
This file was deleted.

0 commit comments

Comments
 (0)