@props([
    'is_custom' => 'no',
])
<div id="formModal" class="modal fade @if ($is_custom == 'yes') custom--modal @endif" tabindex="-1" role="dialog">
    <div class="modal-dialog" role="document" id="form-modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title"></h5>
                <button type="button" class="close" data-bs-dismiss="modal" aria-label="Close">
                    <i class="las la-times"></i>
                </button>
            </div>
            <div class="modal-body">
            </div>
        </div>
    </div>
</div>

@push('script')
    <script>
        (function($) {
            "use strict";
            $(document).on('click', '.formModalBtn', function() {
                var modal = $('#formModal');
                var title = $(this).data('title');
                var url = $(this).data('action');
                $.ajax({
                    url: url,
                    method: 'GET',
                    success: function(response) {
                        modal.find('.modal-title').text(title);
                        modal.find('.modal-body').html(response);
                        modal.modal('show');
                    }
                });
            });
        })(jQuery);
    </script>
@endpush
