<?php $__env->startSection('content'); ?>
    <?php if(auth()->guard()->guest()): ?>
        <section class="py-5">
            <div class="container">
                <div class="row">
                    <div class="col-md-12">
                    <?php endif; ?>

                    <div class="card custom--card">
                        <div class="card-header card-header-bg py-3">
                            <div
                                class="d-flex flex-column flex-sm-row justify-content-between align-items-start align-items-sm-center gap-2">
                                <div class="d-flex align-items-center gap-2">
                                    <?php echo $myTicket->statusBadge; ?>
                                    <h6 class="mb-0">
                                        [<?php echo app('translator')->get('Ticket'); ?>#<?php echo e($myTicket->ticket); ?>] <?php echo e($myTicket->subject); ?>

                                    </h6>
                                </div>
                                <?php if($myTicket->status != Status::TICKET_CLOSE && $myTicket->user): ?>
                                    <button class="btn btn-danger btn-sm confirmationBtn" type="button"
                                        data-question="<?php echo app('translator')->get('Are you sure to close this ticket?'); ?>"
                                        data-action="<?php echo e(route('ticket.close', $myTicket->id)); ?>">
                                        <i class="fas fa-times-circle me-1"></i>
                                        <span><?php echo app('translator')->get('Close Ticket'); ?></span>
                                    </button>
                                <?php endif; ?>
                            </div>
                        </div>
                        <div class="card-body ">
                            <form method="post" class="disableSubmission"
                                action="<?php echo e(route('ticket.reply', $myTicket->id)); ?>" enctype="multipart/form-data">
                                <?php echo csrf_field(); ?>
                                <div class="row gy-4">
                                    <div class="col-md-12">
                                        <textarea name="message" placeholder="<?php echo app('translator')->get('Your Reply'); ?>..." class="form-control form--control bg--gray" rows="4"
                                            required><?php echo e(old('message')); ?></textarea>
                                    </div>

                                    <div class="col-md-12">
                                        <div class="d-flex flex-wrap align-items-center justify-content-between gap-2">
                                            <button type="button" class="btn btn--dark addAttachment h-50">
                                                <i class="fas fa-plus"></i>
                                                <?php echo app('translator')->get('Add Attachment'); ?>
                                            </button>
                                            <button class="btn btn--base btn--lg h-50" type="submit">
                                                <i class="la la-fw la-lg la-reply"></i>
                                                <?php echo app('translator')->get('Reply'); ?>
                                            </button>
                                        </div>

                                        <p class="text--info mt-2"><?php echo app('translator')->get('Max 5 files can be uploaded'); ?> | <?php echo app('translator')->get('Maximum upload size is'); ?>
                                            <?php echo e(convertToReadableSize(ini_get('upload_max_filesize'))); ?> |
                                            <?php echo app('translator')->get('Allowed File Extensions: .jpg, .jpeg, .png, .pdf, .doc, .docx'); ?></p>
                                    </div>
                                    <div class="col-12">
                                        <div class="row gy-4 fileUploadsContainer"></div>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>

                    <div class="card mt-4">
                        <div class="card-body">
                            <?php $__empty_1 = true; $__currentLoopData = $messages; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $message): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                                <?php if($message->admin_id == 0): ?>
                                    <div class="row border border--base border-radius-3 my-3 py-3 mx-2">
                                        <div class="col-md-3 border-end text-end">
                                            <h5 class="my-3"><?php echo e($message->ticket->name); ?></h5>
                                        </div>
                                        <div class="col-md-9">
                                            <p class="text-muted fw-bold my-3">
                                                <?php echo app('translator')->get('Posted on'); ?>
                                                <?php echo e(showDateTime($message->created_at, 'l, dS F Y @ h:i a')); ?>

                                            </p>
                                            <p><?php echo e($message->message); ?></p>
                                            <?php if($message->attachments->count() > 0): ?>
                                                <div class="mt-2">
                                                    <?php $__currentLoopData = $message->attachments; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $k => $image): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                        <a href="<?php echo e(route('ticket.download', encrypt($image->id))); ?>"
                                                            class="me-3"><i class="fa-regular fa-file"></i>
                                                            <?php echo app('translator')->get('Attachment'); ?>
                                                            <?php echo e(++$k); ?> </a>
                                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                                </div>
                                            <?php endif; ?>
                                        </div>
                                    </div>
                                <?php else: ?>
                                    <div class="row border border-warning border-radius-3 my-3 py-3 mx-2 reply-bg">
                                        <div class="col-md-3 border-end text-end">
                                            <h5 class="my-3"><?php echo e($message->admin->name); ?></h5>
                                            <p class="lead text-muted"><?php echo app('translator')->get('Staff'); ?></p>
                                        </div>
                                        <div class="col-md-9">
                                            <p class="text-muted fw-bold my-3">
                                                <?php echo app('translator')->get('Posted on'); ?>
                                                <?php echo e(showDateTime($message->created_at, 'l, dS F Y @ h:i a')); ?>

                                            </p>
                                            <p><?php echo e($message->message); ?></p>
                                            <?php if($message->attachments->count() > 0): ?>
                                                <div class="mt-2">
                                                    <?php $__currentLoopData = $message->attachments; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $k => $image): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                        <a href="<?php echo e(route('ticket.download', encrypt($image->id))); ?>"
                                                            class="me-3"><i class="fa-regular fa-file"></i>
                                                            <?php echo app('translator')->get('Attachment'); ?>
                                                            <?php echo e(++$k); ?> </a>
                                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                                </div>
                                            <?php endif; ?>
                                        </div>
                                    </div>
                                <?php endif; ?>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                                <div class="empty-message text-center">
                                    <img src="<?php echo e(asset('assets/images/empty_list.png')); ?>" alt="empty">
                                    <h5 class="text-muted"><?php echo app('translator')->get('No replies found here!'); ?></h5>
                                </div>
                            <?php endif; ?>
                        </div>
                    </div>

                    <?php if(auth()->guard()->guest()): ?>
                    </div>
                </div>
        </section>
    <?php endif; ?>

    <?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(['class' => 'frontend']); ?>
<?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('style'); ?>
    <style>
        .input-group-text:focus {
            box-shadow: none !important;
        }

        .reply-bg {
            background-color: #ffd96729
        }

        .empty-message img {
            width: 120px;
            margin-bottom: 15px;
        }

        .input--group .input-group-text {
            border-radius: 4px;
            color: hsl(var(--white)) !important;
            background-color: hsl(var(--danger)) !important;
        }
    </style>
<?php $__env->stopPush(); ?>
<?php $__env->startPush('script'); ?>
    <script>
        (function($) {
            "use strict";
            var fileAdded = 0;
            $('.addAttachment').on('click', function() {
                fileAdded++;
                if (fileAdded == 5) {
                    $(this).attr('disabled', true)
                }
                $(".fileUploadsContainer").append(`
                    <div class="col-md-6 removeFileInput">
                        <div class="input-group input--group">
                            <input type="file" name="attachments[]" class="form-control form--control" accept=".jpeg,.jpg,.png,.pdf,.doc,.docx" required>
                            <button type="button" class="input-group-text removeFile"><i class="fas fa-times"></i></button>
                        </div>
                    </div>
                `)
            });
            $(document).on('click', '.removeFile', function() {
                $('.addAttachment').removeAttr('disabled', true)
                fileAdded--;
                $(this).closest('.removeFileInput').remove();
            });
        })(jQuery);
    </script>
<?php $__env->stopPush(); ?>

<?php echo $__env->make('Template::layouts.' . $layout, array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /home/u710135641/domains/compulancer.com/public_html/core/resources/views/templates/basic/user/support/view.blade.php ENDPATH**/ ?>