coolify/resources/views/components/inputs/button.blade.php

31 lines
1.2 KiB
PHP
Raw Normal View History

2023-05-03 14:09:10 +02:00
@props([
2023-05-18 13:26:35 +02:00
'type' => $attributes->get('type') ?? 'button',
2023-05-09 11:33:50 +02:00
'disabled' => null,
2023-05-03 14:09:10 +02:00
'confirm' => null,
'confirmAction' => null,
])
2023-05-18 13:26:35 +02:00
@if ($type === 'submit')
2023-05-18 15:12:26 +02:00
<button {{ $attributes }} type="submit" @if ($disabled !== null) disabled @endif wire:target="submit"
2023-05-18 13:26:35 +02:00
wire:loading.delay.shorter.class="loading"
@isset($confirm)
2023-05-04 15:45:53 +02:00
x-on:click="toggleConfirmModal('{{ $confirm }}', '{{ explode('(', $confirmAction)[0] }}')"
2023-05-03 15:02:21 +02:00
@endisset
2023-05-18 13:26:35 +02:00
@isset($confirmAction)
2023-05-04 15:45:53 +02:00
x-on:{{ explode('(', $confirmAction)[0] }}.window="$wire.{{ explode('(', $confirmAction)[0] }}"
2023-05-03 15:02:21 +02:00
@endisset>
2023-05-18 13:26:35 +02:00
{{ $slot }}
</button>
@elseif($type === 'button')
<button {{ $attributes }} @if ($disabled !== null) disabled @endif type="button"
wire:target="{{ explode('(', $attributes->whereStartsWith('wire:click')->first())[0] }}"
wire:loading.delay.shorter.class="loading"
@isset($confirm)
x-on:click="toggleConfirmModal('{{ $confirm }}', '{{ explode('(', $confirmAction)[0] }}')"
@endisset
@isset($confirmAction)
x-on:{{ explode('(', $confirmAction)[0] }}.window="$wire.{{ explode('(', $confirmAction)[0] }}"
@endisset>
{{ $slot }}
</button>
@endif