1- @php
2- if (! $getAction ()) {
3- $wireClickAction = null ;
4- } else {
5- $wireClickAction = $getAction ();
6-
7- if ($getActionArguments ()) {
8- $wireClickAction .= ' (\' ' ;
9- $wireClickAction .= \Illuminate \Support \Str:: of (json_encode ($getActionArguments ()))-> replace (' "' , ' \\ "' );
10- $wireClickAction .= ' \' )' ;
11- }
12- }
13- @endphp
14-
15- <x-filament::button
16- :form =" $getForm()"
17- :type =" $canSubmitForm() ? 'submit' : 'button'"
18- :tag =" $action->getUrl() ? 'a' : 'button'"
19- :wire:click =" $wireClickAction"
20- :href =" $action->isEnabled() ? $action->getUrl() : null"
21- :target =" $action->shouldOpenUrlInNewTab() ? '_blank' : null"
22- :x-on:click =" $canCancelAction() ? 'close()' : null"
23- :color =" $getColor()"
24- :outlined =" $isOutlined()"
25- :icon =" $getIcon()"
26- :icon-position =" $getIconPosition()"
27- :size =" $getSize()"
28- :attributes =" $getExtraAttributeBag()"
29- class =" filament-tree-modal-button-action"
30- >
31- {{ $getLabel () } }
32- </x-filament::button >
1+ @if ($this instanceof \Filament\Actions\Contracts\ HasActions && (! $this -> hasActionsModalRendered ) )
2+ <form wire:submit.prevent =" callMountedAction" >
3+ @php
4+ $action = $this -> getMountedAction ();
5+ @endphp
6+
7+ <x-filament::modal
8+ :alignment =" $action?->getModalAlignment()"
9+ :close-button =" $action?->hasModalCloseButton()"
10+ :close-by-clicking-away =" $action?->isModalClosedByClickingAway()"
11+ :description =" $action?->getModalDescription()"
12+ display-classes =" block"
13+ :footer-actions =" $action?->getVisibleModalFooterActions()"
14+ :footer-actions-alignment =" $action?->getModalFooterActionsAlignment()"
15+ :heading =" $action?->getModalHeading()"
16+ :icon =" $action?->getModalIcon()"
17+ :icon-color =" $action?->getModalIconColor()"
18+ :id =" $this->getId() . '-action'"
19+ :slide-over =" $action?->isModalSlideOver()"
20+ :sticky-footer =" $action?->isModalFooterSticky()"
21+ :sticky-header =" $action?->isModalHeaderSticky()"
22+ :visible =" filled($action)"
23+ :width =" $action?->getModalWidth()"
24+ :wire:key =" $action ? $this->getId() . '.actions.' . $action->getName() . '.modal' : null"
25+ x-on:closed-form-component-action-modal.window =" if (($event.detail.id === '{{ $this -> getId () } } ') && $wire.mountedActions.length) open()"
26+ x-on:modal-closed.stop ="
27+ const mountedActionShouldOpenModal = {{ \Illuminate \Support \Js:: from ($action && $this -> mountedActionShouldOpenModal ()) } }
28+
29+ if (! mountedActionShouldOpenModal) {
30+ return
31+ }
32+
33+ if ($wire.mountedFormComponentActions.length) {
34+ return
35+ }
36+
37+ $wire.unmountAction(false)
38+ "
39+ x-on:opened-form-component-action-modal.window =" if ($event.detail.id === '{{ $this -> getId () } } ') close()"
40+ >
41+ @if ($action )
42+ {{ $action -> getModalContent () } }
43+
44+ @if (count (($infolist = $action -> getInfolist ())?-> getComponents () ?? []) )
45+ {{ $infolist } }
46+ @elseif ($this -> mountedActionHasForm () )
47+ {{ $this -> getMountedActionForm () } }
48+ @endif
49+
50+ {{ $action -> getModalContentFooter () } }
51+ @endif
52+ </x-filament::modal >
53+ </form >
54+
55+ @php
56+ $this -> hasActionsModalRendered = true ;
57+ @endphp
58+ @endif
59+
60+ @if ($this instanceof \Filament\Infolists\Contracts\ HasInfolists && (! $this -> hasInfolistsModalRendered ) )
61+ <form wire:submit.prevent =" callMountedInfolistAction" >
62+ @php
63+ $action = $this -> getMountedInfolistAction ();
64+ @endphp
65+
66+ <x-filament::modal
67+ :alignment =" $action?->getModalAlignment()"
68+ :close-button =" $action?->hasModalCloseButton()"
69+ :close-by-clicking-away =" $action?->isModalClosedByClickingAway()"
70+ :description =" $action?->getModalDescription()"
71+ display-classes =" block"
72+ :footer-actions =" $action?->getVisibleModalFooterActions()"
73+ :footer-actions-alignment =" $action?->getModalFooterActionsAlignment()"
74+ :heading =" $action?->getModalHeading()"
75+ :icon =" $action?->getModalIcon()"
76+ :icon-color =" $action?->getModalIconColor()"
77+ :id =" $this->getId() . '-infolist-action'"
78+ :slide-over =" $action?->isModalSlideOver()"
79+ :sticky-footer =" $action?->isModalFooterSticky()"
80+ :sticky-header =" $action?->isModalHeaderSticky()"
81+ :visible =" filled($action)"
82+ :width =" $action?->getModalWidth()"
83+ :wire:key =" $action ? $this->getId() . '.infolist.actions.' . $action->getName() . '.modal' : null"
84+ x-on:closed-form-component-action-modal.window =" if (($event.detail.id === '{{ $this -> getId () } } ') && $wire.mountedInfolistActions.length) open()"
85+ x-on:modal-closed.stop ="
86+ const mountedInfolistActionShouldOpenModal = {{ \Illuminate \Support \Js:: from ($action && $this -> mountedInfolistActionShouldOpenModal ()) } }
87+
88+ if (! mountedInfolistActionShouldOpenModal) {
89+ return
90+ }
91+
92+ if ($wire.mountedFormComponentActions.length) {
93+ return
94+ }
95+
96+ $wire.unmountInfolistAction(false)
97+ "
98+ x-on:opened-form-component-action-modal.window =" if ($event.detail.id === '{{ $this -> getId () } } ') close()"
99+ >
100+ @if ($action )
101+ {{ $action -> getModalContent () } }
102+
103+ @if (count (($infolist = $action -> getInfolist ())?-> getComponents () ?? []) )
104+ {{ $infolist } }
105+ @elseif ($this -> mountedInfolistActionHasForm () )
106+ {{ $this -> getMountedInfolistActionForm () } }
107+ @endif
108+
109+ {{ $action -> getModalContentFooter () } }
110+ @endif
111+ </x-filament::modal >
112+ </form >
113+
114+ @php
115+ $this -> hasInfolistsModalRendered = true ;
116+ @endphp
117+ @endif
118+
119+ @if ($this instanceof \Filament\Tables\Contracts\ HasTable && (! $this -> hasTableModalRendered ) )
120+ <form wire:submit.prevent =" callMountedTableAction" >
121+ @php
122+ $action = $this -> getMountedTableAction ();
123+ @endphp
124+
125+ <x-filament::modal
126+ :alignment =" $action?->getModalAlignment()"
127+ :close-button =" $action?->hasModalCloseButton()"
128+ :close-by-clicking-away =" $action?->isModalClosedByClickingAway()"
129+ :description =" $action?->getModalDescription()"
130+ display-classes =" block"
131+ :footer-actions =" $action?->getVisibleModalFooterActions()"
132+ :footer-actions-alignment =" $action?->getModalFooterActionsAlignment()"
133+ :heading =" $action?->getModalHeading()"
134+ :icon =" $action?->getModalIcon()"
135+ :icon-color =" $action?->getModalIconColor()"
136+ :id =" $this->getId() . '-table-action'"
137+ :slide-over =" $action?->isModalSlideOver()"
138+ :sticky-footer =" $action?->isModalFooterSticky()"
139+ :sticky-header =" $action?->isModalHeaderSticky()"
140+ :visible =" filled($action)"
141+ :width =" $action?->getModalWidth()"
142+ :wire:key =" $action ? $this->getId() . '.table.actions.' . $action->getName() . '.modal' : null"
143+ x-on:closed-form-component-action-modal.window =" if (($event.detail.id === '{{ $this -> getId () } } ') && $wire.mountedTableActions.length) open()"
144+ x-on:modal-closed.stop ="
145+ const mountedTableActionShouldOpenModal = {{ \Illuminate \Support \Js:: from ($action && $this -> mountedTableActionShouldOpenModal ()) } }
146+
147+ if (! mountedTableActionShouldOpenModal) {
148+ return
149+ }
150+
151+ if ($wire.mountedFormComponentActions.length) {
152+ return
153+ }
154+
155+ $wire.unmountTableAction(false)
156+ "
157+ x-on:opened-form-component-action-modal.window =" if ($event.detail.id === '{{ $this -> getId () } } ') close()"
158+ >
159+ @if ($action )
160+ {{ $action -> getModalContent () } }
161+
162+ @if (count (($infolist = $action -> getInfolist ())?-> getComponents () ?? []) )
163+ {{ $infolist } }
164+ @elseif ($this -> mountedTableActionHasForm () )
165+ {{ $this -> getMountedTableActionForm () } }
166+ @endif
167+
168+ {{ $action -> getModalContentFooter () } }
169+ @endif
170+ </x-filament::modal >
171+ </form >
172+
173+ <form wire:submit.prevent =" callMountedTableBulkAction" >
174+ @php
175+ $action = $this -> getMountedTableBulkAction ();
176+ @endphp
177+
178+ <x-filament::modal
179+ :alignment =" $action?->getModalAlignment()"
180+ :close-button =" $action?->hasModalCloseButton()"
181+ :close-by-clicking-away =" $action?->isModalClosedByClickingAway()"
182+ :description =" $action?->getModalDescription()"
183+ display-classes =" block"
184+ :footer-actions =" $action?->getVisibleModalFooterActions()"
185+ :footer-actions-alignment =" $action?->getModalFooterActionsAlignment()"
186+ :heading =" $action?->getModalHeading()"
187+ :icon =" $action?->getModalIcon()"
188+ :icon-color =" $action?->getModalIconColor()"
189+ :id =" $this->getId() . '-table-bulk-action'"
190+ :slide-over =" $action?->isModalSlideOver()"
191+ :sticky-footer =" $action?->isModalFooterSticky()"
192+ :sticky-header =" $action?->isModalHeaderSticky()"
193+ :visible =" filled($action)"
194+ :width =" $action?->getModalWidth()"
195+ :wire:key =" $action ? $this->getId() . '.table.bulk-actions.' . $action->getName() . '.modal' : null"
196+ x-on:closed-form-component-action-modal.window =" if (($event.detail.id === '{{ $this -> getId () } } ') && $wire.mountedTableBulkAction) open()"
197+ x-on:modal-closed.stop ="
198+ const mountedTableBulkActionShouldOpenModal = {{ \Illuminate \Support \Js:: from ($action && $this -> mountedTableBulkActionShouldOpenModal ()) } }
199+
200+ if (! mountedTableBulkActionShouldOpenModal) {
201+ return
202+ }
203+
204+ if ($wire.mountedFormComponentActions.length) {
205+ return
206+ }
207+
208+ $wire.mountedTableBulkAction = null
209+ "
210+ x-on:opened-form-component-action-modal.window =" if ($event.detail.id === '{{ $this -> getId () } } ') close()"
211+ >
212+ @if ($action )
213+ {{ $action -> getModalContent () } }
214+
215+ @if (count (($infolist = $action -> getInfolist ())?-> getComponents () ?? []) )
216+ {{ $infolist } }
217+ @elseif ($this -> mountedTableBulkActionHasForm () )
218+ {{ $this -> getMountedTableBulkActionForm () } }
219+ @endif
220+
221+ {{ $action -> getModalContentFooter () } }
222+ @endif
223+ </x-filament::modal >
224+ </form >
225+
226+ @php
227+ $this -> hasTableModalRendered = true ;
228+ @endphp
229+ @endif
230+
231+ @if (! $this -> hasFormsModalRendered )
232+ @php
233+ $action = $this -> getMountedFormComponentAction ();
234+ @endphp
235+
236+ <form wire:submit.prevent =" callMountedFormComponentAction" >
237+ <x-filament::modal
238+ :alignment =" $action?->getModalAlignment()"
239+ :close-button =" $action?->hasModalCloseButton()"
240+ :close-by-clicking-away =" $action?->isModalClosedByClickingAway()"
241+ :description =" $action?->getModalDescription()"
242+ display-classes =" block"
243+ :footer-actions =" $action?->getVisibleModalFooterActions()"
244+ :footer-actions-alignment =" $action?->getModalFooterActionsAlignment()"
245+ :heading =" $action?->getModalHeading()"
246+ :icon =" $action?->getModalIcon()"
247+ :icon-color =" $action?->getModalIconColor()"
248+ :id =" $this->getId() . '-form-component-action'"
249+ :slide-over =" $action?->isModalSlideOver()"
250+ :sticky-footer =" $action?->isModalFooterSticky()"
251+ :sticky-header =" $action?->isModalHeaderSticky()"
252+ :visible =" filled($action)"
253+ :width =" $action?->getModalWidth()"
254+ :wire:key =" $action ? $this->getId() . '.' . $action->getComponent()->getStatePath() . '.actions.' . $action->getName() . '.modal' : null"
255+ x-on:modal-closed.stop ="
256+ const mountedFormComponentActionShouldOpenModal = {{ \Illuminate \Support \Js:: from ($action && $this -> mountedFormComponentActionShouldOpenModal ()) } }
257+
258+ if (mountedFormComponentActionShouldOpenModal) {
259+ $wire.unmountFormComponentAction(false)
260+ }
261+ "
262+ >
263+ @if ($action )
264+ {{ $action -> getModalContent () } }
265+
266+ @if (count (($infolist = $action -> getInfolist ())?-> getComponents () ?? []) )
267+ {{ $infolist } }
268+ @elseif ($this -> mountedFormComponentActionHasForm () )
269+ {{ $this -> getMountedFormComponentActionForm () } }
270+ @endif
271+
272+ {{ $action -> getModalContentFooter () } }
273+ @endif
274+ </x-filament::modal >
275+ </form >
276+
277+ @php
278+ $this -> hasFormsModalRendered = true ;
279+ @endphp
280+ @endif
0 commit comments