Skip to content

Commit 10513a6

Browse files
committed
UP
1 parent ee64c5e commit 10513a6

File tree

3 files changed

+17
-304
lines changed

3 files changed

+17
-304
lines changed

resources/views/livewire/board.blade.php

Lines changed: 2 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -44,58 +44,6 @@ class="absolute inset-0 bg-white/40 dark:bg-gray-900/40 z-10 backdrop-blur-sm fl
4444
</div>
4545
</div>
4646

47-
<x-filament::modal id="create-card-modal" :heading="__('Create New :recordLabel', ['recordLabel' => $config['recordLabel'] ?? 'Card'])">
48-
<x-filament::modal.description>
49-
{{ __('Add a new :recordLabel to the board', ['recordLabel' => strtolower($config['recordLabel'] ?? 'card')]) }}
50-
</x-filament::modal.description>
51-
52-
{{ $this->createForm }}
53-
54-
<x-slot name="footer">
55-
<div class="flex justify-end gap-x-3">
56-
<x-filament::button
57-
color="gray"
58-
x-on:click="$dispatch('close-modal', { id: 'create-card-modal' })"
59-
>
60-
{{ __('Cancel') }}
61-
</x-filament::button>
62-
63-
<x-filament::button
64-
wire:click="createCard"
65-
>
66-
{{ __('Create :recordLabel', ['recordLabel' => $config['recordLabel'] ?? 'Card']) }}
67-
</x-filament::button>
68-
</div>
69-
</x-slot>
70-
</x-filament::modal>
71-
72-
<x-filament::modal id="edit-card-modal" :heading="__('Edit :recordLabel', ['recordLabel' => $config['recordLabel'] ?? 'Card'])">
73-
{{ $this->editForm }}
74-
75-
<x-slot name="footer">
76-
<div class="flex items-center justify-between">
77-
<x-filament::button
78-
color="danger"
79-
wire:click="deleteCard"
80-
>
81-
{{ __('Delete') }}
82-
</x-filament::button>
83-
84-
<div class="flex gap-x-3">
85-
<x-filament::button
86-
color="gray"
87-
x-on:click="$dispatch('close-modal', { id: 'edit-card-modal' })"
88-
>
89-
{{ __('Cancel') }}
90-
</x-filament::button>
91-
92-
<x-filament::button
93-
wire:click="updateCard"
94-
>
95-
{{ __('Save Changes') }}
96-
</x-filament::button>
97-
</div>
98-
</div>
99-
</x-slot>
100-
</x-filament::modal>
47+
<x-flowforge::modals.create-card :config="$config" />
48+
<x-flowforge::modals.edit-card :config="$config" />
10149
</div>

resources/views/livewire/modals/create-card.blade.php

Lines changed: 8 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -1,121 +1,25 @@
11
@props(['config'])
22

3-
<x-filament::modal
4-
id="create-card-modal"
5-
:heading="__('Create New :recordLabel', ['recordLabel' => $config['recordLabel'] ?? 'Card'])"
6-
:description="__('Add a new :recordLabel to the board', ['recordLabel' => strtolower($config['recordLabel'] ?? 'card')])"
7-
icon="heroicon-o-plus-circle"
8-
icon-color="primary"
9-
width="md"
10-
>
11-
<form @submit.prevent="submitCreateForm" class="space-y-4">
12-
<div wire:loading.delay.shorter wire:target="createCard" class="absolute inset-0 bg-white/50 dark:bg-gray-800/50 z-10 flex items-center justify-center rounded-lg backdrop-blur-sm">
13-
<div class="flex flex-col items-center gap-2">
14-
<x-filament::loading-indicator class="h-8 w-8" />
15-
<span class="text-sm font-medium text-primary-600 dark:text-primary-400">{{ __('Creating :recordLabel...', ['recordLabel' => strtolower($config['recordLabel'] ?? 'card')]) }}</span>
16-
</div>
17-
</div>
18-
19-
<!-- Title field -->
20-
<div class="space-y-2">
21-
<x-filament::input.wrapper>
22-
<label class="inline-flex items-center space-x-1 text-sm font-medium text-gray-700 dark:text-gray-300">
23-
<span>{{ __('Title') }}</span>
24-
<span class="text-danger-500">*</span>
25-
</label>
26-
27-
<x-filament::input
28-
type="text"
29-
x-model="formData.title"
30-
required
31-
autofocus
32-
placeholder="{{ __('Enter :recordLabel title', ['recordLabel' => strtolower($config['recordLabel'] ?? 'card')]) }}"
33-
wire:loading.attr="disabled"
34-
wire:target="createCard"
35-
/>
36-
37-
<div class="text-xs text-gray-500 dark:text-gray-400">
38-
{{ __('A descriptive title for this :recordLabel', ['recordLabel' => strtolower($config['recordLabel'] ?? 'card')]) }}
39-
</div>
40-
</x-filament::input.wrapper>
41-
</div>
42-
43-
<!-- Description field -->
44-
<div class="space-y-2">
45-
<x-filament::input.wrapper>
46-
<label class="text-sm font-medium text-gray-700 dark:text-gray-300">
47-
{{ __('Description') }}
48-
</label>
49-
50-
<x-filament::input
51-
type="textarea"
52-
x-model="formData.description"
53-
placeholder="{{ __('Enter :recordLabel description', ['recordLabel' => strtolower($config['recordLabel'] ?? 'card')]) }}"
54-
wire:loading.attr="disabled"
55-
wire:target="createCard"
56-
/>
57-
58-
<div class="text-xs text-gray-500 dark:text-gray-400">
59-
{{ __('Additional details about this :recordLabel', ['recordLabel' => strtolower($config['recordLabel'] ?? 'card')]) }}
60-
</div>
61-
</x-filament::input.wrapper>
62-
</div>
63-
64-
<!-- Status field (hidden) -->
65-
<input type="hidden" x-model="formData[state.statusField]" />
66-
67-
<!-- Additional attributes -->
68-
@if(!empty($config['cardAttributes']))
69-
<div class="border-t border-gray-200 dark:border-gray-700 pt-4 mt-4">
70-
<h3 class="text-sm font-medium text-gray-900 dark:text-gray-100 mb-3">{{ __('Additional Details') }}</h3>
71-
72-
<div class="space-y-4">
73-
@foreach($config['cardAttributes'] as $attribute => $label)
74-
<div class="space-y-2">
75-
<x-filament::input.wrapper>
76-
<label class="text-sm font-medium text-gray-700 dark:text-gray-300">
77-
{{ $label }}
78-
</label>
3+
<x-filament::modal id="create-card-modal" :heading="__('Create New :recordLabel', ['recordLabel' => $config['recordLabel'] ?? 'Card'])">
4+
<x-filament::modal.description>
5+
{{ __('Add a new :recordLabel to the board', ['recordLabel' => strtolower($config['recordLabel'] ?? 'card')]) }}
6+
</x-filament::modal.description>
797

80-
<x-filament::input
81-
type="text"
82-
x-model="formData.{{ $attribute }}"
83-
placeholder="{{ __('Enter') }} {{ strtolower($label) }}"
84-
wire:loading.attr="disabled"
85-
wire:target="createCard"
86-
/>
87-
</x-filament::input.wrapper>
88-
</div>
89-
@endforeach
90-
</div>
91-
</div>
92-
@endif
93-
</form>
8+
{{ $this->createForm }}
949

9510
<x-slot name="footer">
9611
<div class="flex justify-end gap-x-3">
9712
<x-filament::button
9813
color="gray"
99-
@click="$dispatch('close-modal', { id: 'create-card-modal' })"
100-
wire:loading.attr="disabled"
101-
wire:target="createCard"
14+
x-on:click="$dispatch('close-modal', { id: 'create-card-modal' })"
10215
>
10316
{{ __('Cancel') }}
10417
</x-filament::button>
10518

10619
<x-filament::button
107-
type="submit"
108-
@click="submitCreateForm"
109-
x-bind:disabled="!formData.title"
110-
x-bind:class="{ 'opacity-70 cursor-not-allowed': !formData.title }"
111-
wire:loading.attr="disabled"
112-
wire:target="createCard"
20+
wire:click="createCard"
11321
>
114-
<span wire:loading.remove wire:target="createCard">{{ __('Create :recordLabel', ['recordLabel' => $config['recordLabel'] ?? 'Card']) }}</span>
115-
<span wire:loading wire:target="createCard" class="flex items-center gap-1">
116-
<x-filament::loading-indicator class="h-4 w-4" />
117-
{{ __('Creating...') }}
118-
</span>
22+
{{ __('Create :recordLabel', ['recordLabel' => $config['recordLabel'] ?? 'Card']) }}
11923
</x-filament::button>
12024
</div>
12125
</x-slot>

resources/views/livewire/modals/edit-card.blade.php

Lines changed: 7 additions & 146 deletions
Original file line numberDiff line numberDiff line change
@@ -1,168 +1,29 @@
11
@props(['config'])
22

3-
<x-filament::modal
4-
id="edit-card-modal"
5-
:heading="__('Edit :recordLabel', ['recordLabel' => $config['recordLabel'] ?? 'Card'])"
6-
width="md"
7-
>
8-
<form @submit.prevent="submitEditForm" class="space-y-4 relative">
9-
<div wire:loading.delay.shorter wire:target="updateCard, deleteCard" class="absolute inset-0 bg-white/50 dark:bg-gray-800/50 z-10 flex items-center justify-center rounded-lg backdrop-blur-sm">
10-
<div class="flex flex-col items-center gap-2">
11-
<x-filament::loading-indicator class="h-8 w-8" />
12-
<span wire:loading wire:target="updateCard" class="text-sm font-medium text-primary-600 dark:text-primary-400">{{ __('Saving changes...') }}</span>
13-
<span wire:loading wire:target="deleteCard" class="text-sm font-medium text-danger-600 dark:text-danger-400">{{ __('Deleting :recordLabel...', ['recordLabel' => strtolower($config['recordLabel'] ?? 'card')]) }}</span>
14-
</div>
15-
</div>
16-
17-
<!-- Title field -->
18-
<div class="space-y-2">
19-
<x-filament::input.wrapper>
20-
<label class="inline-flex items-center space-x-1 text-sm font-medium text-gray-700 dark:text-gray-300">
21-
<span>{{ __('Title') }}</span>
22-
<span class="text-danger-500">*</span>
23-
</label>
24-
25-
<x-filament::input
26-
type="text"
27-
x-model="formData.title"
28-
required
29-
autofocus
30-
placeholder="{{ __('Enter :recordLabel title', ['recordLabel' => strtolower($config['recordLabel'] ?? 'card')]) }}"
31-
wire:loading.attr="disabled"
32-
wire:target="updateCard, deleteCard"
33-
/>
34-
</x-filament::input.wrapper>
35-
</div>
36-
37-
<!-- Description field -->
38-
<div class="space-y-2">
39-
<x-filament::input.wrapper>
40-
<label class="text-sm font-medium text-gray-700 dark:text-gray-300">
41-
{{ __('Description') }}
42-
</label>
43-
44-
<x-filament::input
45-
type="textarea"
46-
x-model="formData.description"
47-
placeholder="{{ __('Enter :recordLabel description', ['recordLabel' => strtolower($config['recordLabel'] ?? 'card')]) }}"
48-
wire:loading.attr="disabled"
49-
wire:target="updateCard, deleteCard"
50-
/>
51-
</x-filament::input.wrapper>
52-
</div>
53-
54-
<!-- Status field -->
55-
<div class="space-y-2">
56-
<x-filament::input.wrapper>
57-
<label class="text-sm font-medium text-gray-700 dark:text-gray-300">
58-
{{ __('Status') }}
59-
</label>
60-
61-
<select
62-
class="w-full rounded-lg border-gray-300 dark:border-gray-600 dark:bg-gray-700 text-gray-900 dark:text-white shadow-sm outline-none focus:border-primary-500 focus:ring-primary-500 dark:focus:border-primary-500"
63-
x-model="formData[state.statusField]"
64-
wire:loading.attr="disabled"
65-
wire:target="updateCard, deleteCard"
66-
>
67-
@foreach($config['statusValues'] as $value => $label)
68-
<option value="{{ $value }}">{{ $label }}</option>
69-
@endforeach
70-
</select>
71-
72-
<div class="text-xs text-gray-500 dark:text-gray-400 mt-1">
73-
{{ __('The column where this :recordLabel will appear', ['recordLabel' => strtolower($config['recordLabel'] ?? 'card')]) }}
74-
</div>
75-
</x-filament::input.wrapper>
76-
</div>
77-
78-
<!-- Additional attributes -->
79-
@if(!empty($config['cardAttributes']))
80-
<div class="border-t border-gray-200 dark:border-gray-700 pt-4 mt-4">
81-
<h3 class="text-sm font-medium text-gray-900 dark:text-gray-100 mb-3">{{ __('Additional Details') }}</h3>
82-
83-
<div class="space-y-4">
84-
@foreach($config['cardAttributes'] as $attribute => $label)
85-
<div class="space-y-2">
86-
<x-filament::input.wrapper>
87-
<label class="text-sm font-medium text-gray-700 dark:text-gray-300">
88-
{{ $label }}
89-
</label>
90-
91-
@if($attribute == 'due_date')
92-
<x-filament::input
93-
type="date"
94-
x-model="formData.{{ $attribute }}"
95-
wire:loading.attr="disabled"
96-
wire:target="updateCard, deleteCard"
97-
/>
98-
@elseif($attribute == 'priority')
99-
<select
100-
class="w-full rounded-lg border-gray-300 dark:border-gray-600 dark:bg-gray-700 text-gray-900 dark:text-white shadow-sm outline-none focus:border-primary-500 focus:ring-primary-500 dark:focus:border-primary-500"
101-
x-model="formData.{{ $attribute }}"
102-
wire:loading.attr="disabled"
103-
wire:target="updateCard, deleteCard"
104-
>
105-
<option value="">{{ __('Select priority') }}</option>
106-
<option value="Low">{{ __('Low') }}</option>
107-
<option value="Medium">{{ __('Medium') }}</option>
108-
<option value="High">{{ __('High') }}</option>
109-
</select>
110-
@else
111-
<x-filament::input
112-
type="text"
113-
x-model="formData.{{ $attribute }}"
114-
placeholder="{{ __('Enter') }} {{ strtolower($label) }}"
115-
wire:loading.attr="disabled"
116-
wire:target="updateCard, deleteCard"
117-
/>
118-
@endif
119-
</x-filament::input.wrapper>
120-
</div>
121-
@endforeach
122-
</div>
123-
</div>
124-
@endif
125-
</form>
3+
<x-filament::modal id="edit-card-modal" :heading="__('Edit :recordLabel', ['recordLabel' => $config['recordLabel'] ?? 'Card'])">
4+
{{ $this->editForm }}
1265

1276
<x-slot name="footer">
1287
<div class="flex items-center justify-between">
1298
<x-filament::button
1309
color="danger"
131-
@click="deleteCard"
132-
class="mr-auto"
133-
wire:loading.attr="disabled"
134-
wire:target="updateCard, deleteCard"
10+
wire:click="deleteCard"
13511
>
136-
<span wire:loading.remove wire:target="deleteCard">{{ __('Delete') }}</span>
137-
<span wire:loading wire:target="deleteCard" class="flex items-center gap-1">
138-
<x-filament::loading-indicator class="h-4 w-4" />
139-
{{ __('Deleting...') }}
140-
</span>
12+
{{ __('Delete') }}
14113
</x-filament::button>
14214

14315
<div class="flex gap-x-3">
14416
<x-filament::button
14517
color="gray"
146-
@click="$dispatch('close-modal', { id: 'edit-card-modal' })"
147-
wire:loading.attr="disabled"
148-
wire:target="updateCard, deleteCard"
18+
x-on:click="$dispatch('close-modal', { id: 'edit-card-modal' })"
14919
>
15020
{{ __('Cancel') }}
15121
</x-filament::button>
15222

15323
<x-filament::button
154-
type="submit"
155-
@click="submitEditForm"
156-
x-bind:disabled="!formData.title"
157-
x-bind:class="{ 'opacity-70 cursor-not-allowed': !formData.title }"
158-
wire:loading.attr="disabled"
159-
wire:target="updateCard, deleteCard"
24+
wire:click="updateCard"
16025
>
161-
<span wire:loading.remove wire:target="updateCard">{{ __('Save Changes') }}</span>
162-
<span wire:loading wire:target="updateCard" class="flex items-center gap-1">
163-
<x-filament::loading-indicator class="h-4 w-4" />
164-
{{ __('Saving...') }}
165-
</span>
26+
{{ __('Save Changes') }}
16627
</x-filament::button>
16728
</div>
16829
</div>

0 commit comments

Comments
 (0)