@props([
    'id' => 'actionsModal',
])

@php
    $actionsRtl = (bool) ($isRtl ?? false) || app()->getLocale() === 'ar';
    $actionsDir = $actionsRtl ? 'rtl' : 'ltr';
@endphp

<div class="modal fade erp-actions-modal" id="{{ $id }}" tabindex="-1" aria-hidden="true" dir="{{ $actionsDir }}"
     @class(['erp-actions-modal--rtl' => $actionsRtl])>
    <div class="modal-dialog modal-dialog-centered modal-md" dir="{{ $actionsDir }}">
        <div class="modal-content" dir="{{ $actionsDir }}">
            <div class="modal-header bg-gradient-primary text-white erp-actions-modal__header">
                <div class="erp-actions-modal__header-text">
                    <h5 class="modal-title mb-1">{{ __('common.actions') }}</h5>
                    <div class="small opacity-75" id="{{ $id }}SubTitle">{{ __('common.actions_modal.selected_item') }}</div>
                </div>
                <button type="button" class="btn-close-custom" data-bs-dismiss="modal"
                        aria-label="{{ __('common.close') }}">
                    <i class="fe fe-x"></i>
                </button>
            </div>
            <div class="modal-body erp-actions-modal__body">
                <div class="erp-actions-modal__list">
                    <a class="action-card action-card--primary" id="{{ $id }}ViewLink" href="#">
                        <div class="action-icon action-icon--primary" aria-hidden="true">
                            <i class="fe fe-eye"></i>
                        </div>
                        <div class="action-content">
                            <p class="action-title mb-0">{{ __('common.view') }}</p>
                            <small class="action-description">{{ __('common.actions_modal.open_details') }}</small>
                        </div>
                    </a>
                    <button class="action-card action-card--danger delete-action" type="button" id="{{ $id }}DeleteBtn">
                        <div class="action-icon action-icon--danger" aria-hidden="true">
                            <i class="fe fe-trash-2"></i>
                        </div>
                        <div class="action-content">
                            <p class="action-title mb-0">{{ __('common.delete') }}</p>
                            <small class="action-description">{{ __('common.actions_modal.remove_record') }}</small>
                        </div>
                    </button>
                </div>
            </div>
        </div>
    </div>
</div>

@once
    @push('scripts')
        @php
            $erpActionsModalI18n = [
                'deleteConfirm' => __('common.actions_modal.delete_confirm'),
                'deleteConfirmWithId' => __('common.actions_modal.delete_confirm_with_id'),
            ];
        @endphp
        <script>
            window.erpActionsModalI18n = @json($erpActionsModalI18n);
        </script>
        <script src="{{ asset('assets/admin/js/actions-modal.js') }}"></script>
    @endpush
@endonce
