<?php $__env->startSection('content'); ?>

    <?php if($layout == 'frontend'): ?>
        <section class="pt-80 pb-80">
            <div class="container">
                <div class="row justify-content-center">
                    <div class="col-lg-12">
    <?php endif; ?>

    <div class="card custom--card">
        <div class="card-header">
            <div class="row">
                <div class="col-sm-10 d-flex align-items-center flex-wrap">
                    <?php echo $myTicket->statusBadge; ?>

                    <h6 class="ms-2">[<?php echo app('translator')->get('Ticket'); ?>#<?php echo e($myTicket->ticket); ?>] <?php echo e($myTicket->subject); ?></h6>
                </div>
                <div class="col-sm-2 text-end">
                    <?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)); ?>" <?php if(auth()->guard()->guest()): ?> disabled <?php endif; ?>><i class="la la-lg la-times-circle"></i>
                        </button>
                    <?php endif; ?>
                </div>
            </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 justify-content-between">
                    <div class="col-md-12">
                        <div class="form-group">
                            <textarea name="message" class="form-control form--control" rows="4" required><?php echo e(old('message')); ?></textarea>
                        </div>
                    </div>

                    <div class="col-md-9">
                        <button type="button" class="btn btn--dark btn-sm addAttachment my-2"> <i class="fas fa-plus"></i> <?php echo app('translator')->get('Add Attachment'); ?> </button>
                        <p class="mb-2">
                            <span class="text--info text--small"><?php echo app('translator')->get('Max 5 files can be uploaded | Maximum upload size is ' . convertToReadableSize(ini_get('upload_max_filesize')) . ' | Allowed File Extensions: .jpg, .jpeg, .png, .pdf, .doc, .docx'); ?></span>
                        </p>

                        <div class="row fileUploadsContainer"></div>
                    </div>
                    <div class="col-md-3">
                        <button class="btn btn--base w-100 my-2" type="submit"><i class="la la-fw la-lg la-reply"></i> <?php echo app('translator')->get('Reply'); ?></button>
                    </div>

                </div>
            </form>
        </div>
    </div>

    <div class="card custom--card mt-4 border-0 bg-transparent">
        <?php $__currentLoopData = $messages; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $message): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
            <?php if($message->admin_id == 0): ?>
                <div class="single-reply">
                    <div class="left">
                        <h6><?php echo e($message->ticket->name); ?></h6>
                    </div>
                    <div class="right">
                        <small class="fs--14px text--base mb-2"><?php echo app('translator')->get('Posted on'); ?>
                            <?php echo e($message->created_at->format('l, dS F Y @ H:i')); ?></small>
                        <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="la la-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="single-reply author-reply">
                    <div class="left">
                        <h6><?php echo e($message->admin->name); ?></h6>
                        <small class="lead text-muted"><?php echo app('translator')->get('Staff'); ?></small>
                    </div>
                    <div class="right">
                        <small class="fs--14px text--base mb-2"><?php echo app('translator')->get('Posted on'); ?>
                            <?php echo e($message->created_at->format('l, dS F Y @ H:i')); ?></small>
                        <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="la la-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(); ?>
    </div>

    </div>
    </div>
    </div>
    </div>

    <?php if($layout == 'frontend'): ?>
        </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([]); ?>
<?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;
        }

        #confirmationModal .btn {
            padding: 0.375rem .75rem !important;
        }

        .author-reply {
            background-color: #ab8a625c;
        }
    </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-lg-6 col-md-12 removeFileInput">
                    <div class="form-group">
                        <div class="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 bg--danger border-0"><i class="fas fa-times"></i></button>
                        </div>
                    </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($activeTemplate . 'layouts.' . $layout, \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/ryanupiz/pan.ryangroups.com/hotel/viserhotel/Files/core/resources/views/templates/basic/user/support/view.blade.php ENDPATH**/ ?>