|
1 | 1 | @props(['config']) |
2 | 2 |
|
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 }} |
126 | 5 |
|
127 | 6 | <x-slot name="footer"> |
128 | 7 | <div class="flex items-center justify-between"> |
129 | 8 | <x-filament::button |
130 | 9 | color="danger" |
131 | | - @click="deleteCard" |
132 | | - class="mr-auto" |
133 | | - wire:loading.attr="disabled" |
134 | | - wire:target="updateCard, deleteCard" |
| 10 | + wire:click="deleteCard" |
135 | 11 | > |
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') }} |
141 | 13 | </x-filament::button> |
142 | 14 |
|
143 | 15 | <div class="flex gap-x-3"> |
144 | 16 | <x-filament::button |
145 | 17 | 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' })" |
149 | 19 | > |
150 | 20 | {{ __('Cancel') }} |
151 | 21 | </x-filament::button> |
152 | 22 |
|
153 | 23 | <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" |
160 | 25 | > |
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') }} |
166 | 27 | </x-filament::button> |
167 | 28 | </div> |
168 | 29 | </div> |
|
0 commit comments