<?php $__env->startSection("title", env("APP_NAME") . " :: Chamados - Página de Acompanhamento"); ?>
<?php $__env->startSection('content'); ?>

<div class="card shadow">

    <?php $headLine = "<i class='fa-solid fa-headset'></i> Chamados - Página de Acompanhamento"; ?>

    <?php echo $__env->make('components.buttons._headLineButtonsBackAdd', [
        'headLine' => __($headLine),
        'routeBack' => 'admin.contaAngra.chamados.index',
        'routeBackParams' => [], 
        'nameBack' => __("Voltar"),
        "permission" => "GERENCIADOR_DE_CONTA_ANGRA",
    ], array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>

    <div class="card-body">


        <?php echo $__env->make("errors.messageFlash", array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
        <?php echo $__env->make('components.modal._modelProfile', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>

        <div class="tab-content">

            <?php $__currentLoopData = $mensagens; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $mensagem): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <?php if($mensagem->solicitacao): ?>

                    <div class="row">
                        <div class="col-12">
                            <ul class="list-group">
                                <li class="list-group-item bg-dark text-white"><h3><?php echo e(__("Data")); ?>: <?php echo e(date("d/m/Y H:i", strtotime($chamado->created_at))); ?></h3></li>
                                <li class="list-group-item"><strong><?php echo e(__("Solicitação")); ?></strong>: <?php echo e($chamado->numeroChamado); ?></li>
                                <li class="list-group-item"><strong><?php echo e(__("Criado por")); ?></strong>: <?php echo e($chamado->user->name); ?></li>
                                <li class="list-group-item"><strong><?php echo e(__("Demanda iniciada em")); ?></strong>: <?php echo e($chamado->convenio); ?></li>
                                <li class="list-group-item"><strong><?php echo e(__("Estado atual da demanda")); ?></strong>: <?php echo e($chamado->convenioAtual); ?></li>
                                <li class="list-group-item"><strong><?php echo e(__("Assunto")); ?></strong>: <?php echo e($chamado->assunto); ?></li>
                                <li class="list-group-item"><strong><?php echo e(__("Solicitação")); ?></strong>: <?php echo $mensagem->mensagem; ?></li>
                                <li class="list-group-item"><strong><?php echo e(__("Status")); ?></strong>: <?php echo e($chamado->statusChamado); ?></li>
                                <?php $index = 0; ?>
                                <?php $__currentLoopData = $mensagem->arquivos; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $arquivo): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <li class="list-group-item">
                                        
                                        <?php echo $__env->make('components.tables._openPhotoAndPdf', [
                                            'asset' => $arquivo->link,
                                            'alt' => $arquivo->nome,
                                            'title' => $arquivo->nome,
                                            'text' => $arquivo->nome,
                                            'index' => $index,
                                        ], array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
                                    
                                    </li>
                                    <?php $index++; ?>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                            </ul>
                            <hr/>
                        </div>
                    </div>

                <?php endif; ?>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>

            <?php $__currentLoopData = $mensagens; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $mensagem): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <?php if(!$mensagem->solicitacao): ?>

                    <div class="row">
                        <div class="col-12">
                            <ul class="list-group">
                                <li class="list-group-item bg-dark text-white"><h3><?php echo e(__("Data")); ?>: <?php echo e(date("d/m/Y H:i", strtotime($mensagem->created_at))); ?></h3></li>
                                <li class="list-group-item"><strong><?php echo e(__("Criado por")); ?></strong>: <?php echo e($mensagem->user->name); ?></li>
                                <li class="list-group-item"><strong><?php echo e(__("Mensagem")); ?></strong>: <?php echo $mensagem->mensagem; ?></li>
                                <?php $index = 100; ?>
                                <?php $__currentLoopData = $mensagem->arquivos; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $arquivo): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <li class="list-group-item">
                                        
                                        <?php echo $__env->make('components.tables._openPhotoAndPdf',[
                                            'asset' => $arquivo->link,
                                            'alt' => $arquivo->nome,
                                            'title' => $arquivo->nome,
                                            'text' => $arquivo->nome,
                                            'index' => $index,
                                        ], array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
                                    
                                    </li>
                                    <?php $index++; ?>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                            </ul>
                            <hr/>
                        </div>
                    </div>

                <?php endif; ?>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>

            <?php if($chamado->statusChamado != "Finalizado"): ?>
                <form action="<?php echo e(route("admin.contaAngra.chamados.novaMensagem", $chamado->id)); ?>" method="post" enctype="multipart/form-data">
                    <div class="row">
                        <div class="col-12  text-wrap">

                            <?php echo csrf_field(); ?>
                            <?php echo method_field('post'); ?>

                            <!-- Nova mensagem -->
                            <?php echo $__env->make('components.inputs._textarea', [
                                'label' => 'Nova mensagem',
                                'name' => 'mensagem',
                                'id' => 'limiteCaracter',
                                'rows' => 5,
                                'required' => true,
                                'height' => '200px',
                                'class' => "textarea-body",
                                'style' => null,
                                "oninput" => null,
                                'value' => old('mensagem'),
                                'small' => null,
                            ], array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
                        </div>
                        <div class="col-12">
                            <!-- Campo Arquivos -->
                            <?php echo $__env->make('components.inputs._inputType',[
                                "for" => "link",
                                "label" => "Arquivos",
                                "name" => "link[]",
                                "id" => 'link',
                                "required" => false,
                                "type" => 'file',
                                "old" => null,
                                "oninput" => null,
                                "readonly" => true,
                                "multiple" => true,
                                "small" => "* Apenas documentos de imagem: PDF, JPG, JPEG, PNG, GIF, BMP, WEBP.",
                                "accept" => 'application/pdf,image/*',
                            ], array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
                        </div>
                        <div class="col-12 mb-3">
                           <div class="form-check">
                                <input class="form-check-input" type="checkbox" name="finalizado" id="finalizado"
                                       value="1"
                                       <?php echo e(old('finalizado', $finalizado ?? false) ? 'checked' : ''); ?>>
                                <label class="form-check-label" for="finalizado">
                                    <?php echo e(__("Sim, desejo finalizar minha solicitação")); ?>

                                </label>
                            </div>
                        </div>
                        <div class="col-12 mb-3">
                            <?php echo $__env->make('components.buttons._backAndSend', [
                                'textBack' => 'Voltar', 
                                'textSend' => 'Nova mensagem', 
                                'routeBack' => 'admin.contaAngra.chamados.index'
                            ], array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
                        </div>
                    </div>
                </form>
            <?php endif; ?>
            
        </div>
    </div>
</div>

<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.admin.theme', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /var/www/html/portal/resources/views/admin/contaAngra/chamados/show.blade.php ENDPATH**/ ?>