<?php $__env->startSection('content'); ?>
    <div class="ticket-details">
        <div class="ticket-details-topbar">
            <a href="<?php echo e(route('admin.ticket.list')); ?>" class="back-btn">
                <i class="las la-arrow-left"></i>
                <?php echo app('translator')->get('Ticket List'); ?>
            </a>
            <button class="ticket-details-topbar-btn">
                <i class="las la-bars"></i>
            </button>
        </div>

        <div class="ticket-details-wrapper">
            <div class="ticket-details-body">
                <?php echo $__env->make('admin.ticket.details_top_bar', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
                <?php echo $__env->yieldContent('sub_content'); ?>
            </div>

            <?php echo $__env->make('admin.ticket.sidebar', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
        </div>
    </div>

    <?php echo $__env->yieldPushContent('sub_content'); ?>

    <?php if (isset($component)) { $__componentOriginalbd5922df145d522b37bf664b524be380 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginalbd5922df145d522b37bf664b524be380 = $attributes; } ?>
<?php $component = App\View\Components\ConfirmationModal::resolve([] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('confirmation-modal'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\App\View\Components\ConfirmationModal::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginalbd5922df145d522b37bf664b524be380)): ?>
<?php $attributes = $__attributesOriginalbd5922df145d522b37bf664b524be380; ?>
<?php unset($__attributesOriginalbd5922df145d522b37bf664b524be380); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalbd5922df145d522b37bf664b524be380)): ?>
<?php $component = $__componentOriginalbd5922df145d522b37bf664b524be380; ?>
<?php unset($__componentOriginalbd5922df145d522b37bf664b524be380); ?>
<?php endif; ?>
<?php $__env->stopSection(); ?>


<?php $__env->startPush('script'); ?>
    <script>
        (function($) {
            "use strict";

            let modal = $('#snippetAddModal');
            let action = `<?php echo e(route('admin.predefined.reply.save')); ?>`;

            $('.addSnippet').on('click', function() {
                modal.find('.modalTitle').text(`<?php echo app('translator')->get('Add New Snippet'); ?>`);
                modal.find('form').attr('action', action);
                modal.modal('show');
            });

            $(document).on('click', '.editSnippet', function() {
                let snippet = $(this).data('snippet');
                modal.find('.modalTitle').text(`<?php echo app('translator')->get('Update Snippet'); ?>`);
                modal.find('[name=title]').val(snippet.title);
                modal.find('[name=message]').val(snippet.message);
                modal.find('#snippet-editor').find('.ql-editor').html(snippet.message)
                modal.find('[name=global]').prop('checked', snippet.global);
                modal.find('[name=favorite]').prop('checked', snippet.favorite);
                modal.find('form').attr('action', action + '/' + snippet.id);
                modal.modal('show');
            });

            modal.on('hidden.bs.modal', function() {
                $(this).find('form')[0].reset();
            });

            $(document).on('click', '.pasteIcon', function() {
                let message = $(this).data('message');
                $('#editor').find('.ql-editor').html(message)
                $('.snippet_offcanvas_close').click();
            });

            let snippetTimer;
            let searchRoute = `<?php echo e(route('admin.predefined.reply.list')); ?>`;

            $('.snippetSearch').on('input', function() {

                let query = $(this).val();

                clearTimeout(snippetTimer);
                snippetTimer = setTimeout(function() {
                    $.ajax({
                        url: searchRoute,
                        method: 'GET',
                        data: {
                            search: query
                        },
                        success: function(response) {
                            $('.snippetList').html(response.html);
                        }
                    });
                }, 300);
            });



            const editor = document.getElementById('snippet-editor');
            if (editor) {
                const quill = new Quill(editor, {
                    theme: 'snow',
                    modules: {
                        toolbar: [
                            ['bold', 'italic', 'underline', 'strike'],
                            [{
                                header: [1, 2, false]
                            }],
                            [{
                                'size': ['small', 'normal', 'large', 'huge']
                            }],
                            [{
                                list: 'ordered'
                            }, {
                                list: 'bullet'
                            }],
                            ['link', 'clean'],
                        ]
                    }
                });

                document.querySelector('.snippetForm').addEventListener('submit', function() {
                    document.querySelector('[name="message"]').value = quill.root.innerHTML;
                });
            }

        })(jQuery);
    </script>
<?php $__env->stopPush(); ?>

<?php $__env->startPush('style'); ?>
    <style>
        body:has(.modal-backdrop.fade.show) {
            padding-right: 0 !important;
        }
    </style>
<?php $__env->stopPush(); ?>

<?php echo $__env->make('admin.layouts.master', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\laragon\www\projects\custom_viserdesk\Files\core\resources\views/admin/ticket/details_layout.blade.php ENDPATH**/ ?>