<div class="row">
    <div class="@if(!($right ?? null)) offset-md-{{ $offset ?? 4 }} col-md-8 @endif buttons">
        <button type="submit" class="btn btn-primary text-white">{{ $name ?? 'Сохранить' }}</button>
        @if(isset($delete) && !($deleteDisabled ?? false))
            <a href="#" class="btn btn-danger delete">{{ $delete['title'] ?? 'Удалить' }}</a>
        @endif
        <a href="{{ url()->previous() }}" class="btn btn-outline-secondary">Назад</a>
    </div>
</div>

@push('scripts')
    <script type="module">

        $('a.delete').on('click', function (){
            if(confirm('Удалить запись?')) {
                $('#{{ $delete['form_id'] ?? 'destroy_form'}}').submit();
            }
        });

        $('.buttons .btn').on('click', function (){
            $('.buttons').addClass('d-none');


            setTimeout(function () {
                    $('.buttons').removeClass('d-none');
                },
                2000);
        });
    </script>
@endpush
