<?php $__env->startSection("title", env("APP_NAME") . " :: Lista de Boletins"); ?>
<?php $__env->startSection('content'); ?>
    <div class="card shadow-sm">

        <?php $headLine = "<i class='fa-solid fa-newspaper'></i> Lista de Boletins"; ?>

        <?php echo $__env->make('components.buttons._headLineButtonsBackAdd', [
            'headLine' => __($headLine),
//            'routeBack' => 'admin.turismoNautico.index',
//            'routeBackParams' => [],
//            'nameBack' => __("Voltar"),
            'routeAdd' => 'admin.boletins.create',
            'routeAddParams' => [],
            'nameAdd' => __('Novo Boletim'),
            "permission" => "GERENCIADOR_DE_BOLETINS",
        ], array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>

        <div class="card-body">
            <div class="mb-3">
                <span class="badge bg-primary fs-6">
                    <i class="fa-solid fa-file-pdf me-1"></i>
                    <?php echo e(__('Total de boletins')); ?>: <strong><?php echo e(number_format($totalBoletins, 0, ',', '.')); ?></strong>
                </span>
            </div>
            <?php echo $__env->make("errors.messageFlash", array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>

            <div class="mb-3 alert alert-light">
                <div class="mb-3 bg-gray border-0 rounded-4 shadow-sm p-3">
                    <div class="text-center fs-6">Pesquisar por:</div>
                    <ul class="nav nav-tabs border-bottom-0" id="myTab" role="tablist">
                        <li class="nav-item" role="presentation">
                            <button class="nav-link <?php if(request()->has('q') || request()->all() == []): ?> active <?php endif; ?> border-0 rounded-5"
                                id="termos-tab"
                            data-bs-toggle="tab" data-bs-target="#termos" type="button" role="tab" aria-controls="termos" aria-selected="true">Termos</button>
                        </li>
                        <li class="nav-item" role="presentation">
                            <button class="nav-link <?php if(request()->has('dataInicio') && request()->has('dataFim')): ?> active <?php endif; ?> border-0 rounded-5"
                                id="data-tab"
                            data-bs-toggle="tab" data-bs-target="#data" type="button" role="tab" aria-controls="data" aria-selected="false">Data</button>
                        </li>
                        <li class="nav-item" role="presentation">
                            <button class="nav-link <?php if(request()->has('n')): ?> active <?php endif; ?> border-0 rounded-5"
                                id="number-tab"
                            data-bs-toggle="tab" data-bs-target="#number" type="button" role="tab" aria-controls="number" aria-selected="false">Número</button>
                        </li>
                        <li class="nav-item" role="presentation">
                            <button class="nav-link <?php if(request()->has('y')): ?> active <?php endif; ?> border-0 rounded-5"
                                id="year-tab"
                            data-bs-toggle="tab" data-bs-target="#year" type="button" role="tab" aria-controls="year" aria-selected="false">Ano</button>
                        </li>
                    </ul>
                    <div class="tab-content" id="myTabContent">
                        <div class="tab-pane fade <?php if(request()->has('q') || request()->all() == []): ?> show active <?php endif; ?>" id="termos" role="tabpanel" aria-labelledby="termos-tab">
                            <form class="d-flex">
                                <input type="hidden" name="page" value="<?php echo e(request()->input('page', 1)); ?>">
                                <input type="text" class="form-control me-2 border-0" name="q" placeholder="Buscar na publicação" aria-label="Pesquisar">
                                <button class="mobile-btn-atualizar btn btn-success text-secondary fw-bold px-3 py-1 rounded-4" type="submit">Buscar</button>
                            </form>
                        </div>
                        <div class="tab-pane fade <?php if(request()->has('dataInicio') && request()->has('dataFim')): ?> show active <?php endif; ?>" id="data" role="tabpanel" aria-labelledby="data-tab">
                            <form class="d-flex">
                                <input type="hidden" name="page" value="<?php echo e(request()->input('page', 1)); ?>">
                                <input type="date" class="form-control me-2 border-0" name="dataInicio" placeholder="Data início" aria-label="Pesquisar">
                                <input type="date" class="form-control me-2 border-0" name="dataFim" placeholder="Data fim" aria-label="Pesquisar">
                                <button class="btn btn-success text-secondary fw-bold px-4 py-2 rounded-4" type="submit">Buscar</button>
                            </form>
                        </div>
                        <div class="tab-pane fade <?php if(request()->has('n')): ?> show active <?php endif; ?>" id="number" role="tabpanel" aria-labelledby="number-tab">
                            <form class="d-flex">
                                <input type="hidden" name="page" value="<?php echo e(request()->input('page', 1)); ?>">
                                <input type="number" class="form-control me-2 border-0" name="n" placeholder="2025" aria-label="Pesquisar">
                                <button class="btn btn-success text-secondary fw-bold px-4 py-2 rounded-4" type="submit">Buscar</button>
                            </form>
                        </div>
                        <div class="tab-pane fade <?php if(request()->has('y')): ?> show active <?php endif; ?>" id="year" role="tabpanel" aria-labelledby="year-tab">
                            <form class="d-flex">
                                <input type="hidden" name="page" value="<?php echo e(request()->input('page', 1)); ?>">
                                <input type="number" class="form-control me-2 border-0" name="y" placeholder="1996" aria-label="Pesquisar">
                                <button class="btn btn-success text-secondary fw-bold px-4 py-2 rounded-4" type="submit">Buscar</button>
                            </form>
                        </div>
                    </div>
                </div>
            </div>

            <?php if (isset($component)) { $__componentOriginal0650541a119648223455610148c86d0b = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal0650541a119648223455610148c86d0b = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.tables._table','data' => ['thead' => ['Data de Publicação', 'Mês', 'Número', 'Título', 'Arquivo', 'Tipo de Edição', 'Status', 'Ações'],'pagination' => $boletins->links()]] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('tables._table'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['thead' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute(['Data de Publicação', 'Mês', 'Número', 'Título', 'Arquivo', 'Tipo de Edição', 'Status', 'Ações']),'pagination' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute($boletins->links())]); ?>
                 <?php $__env->slot('body', null, []); ?> 

                    <?php $index = 0; ?>
                <?php $__currentLoopData = $boletins; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $boletim): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <tr>
                            <td> <?php echo e(date("d/m/Y", strtotime($boletim->publicationDate))); ?> </td>
                            <td>
                                <?php $__currentLoopData = App\Enums\StatusMonth::cases(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $status): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <?php if($status->name == $boletim->month): ?>
                                        <?php echo e($status->value); ?>

                                    <?php endif; ?>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                            </td>
                            <td><?php echo e($boletim->number); ?></td>
                            <td><?php echo e($boletim->title); ?></td>
                            <td><a class="text-dark text-decoration-none d-inline fs-5" href='<?php echo e(asset($boletim->url)); ?>' target="_blank"><i class="fa-solid fa-file-pdf"></i> <small class="text-info"><?php echo e($boletim->fileSizeKB); ?> KB</small></a></td>
                            <td>
                                <?php if($boletim->extraordinaryEdition): ?>
                        Edição Extraordinária
                                <?php else: ?>
                        ---
                                <?php endif; ?>
                            </td>
                            <td>
                                <?php echo $__env->make('components/buttons/_status', [
                                    "index" => $index,
                                    "route" => "admin.boletins.status",
                                    "id" => [$boletim->id],
                                    "status" => $boletim->status,
                                    "permission" => "GERENCIADOR_DE_BOLETINS",
                                ], array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
                            </td>
                            <td>

                                <div class="d-flex gap-2 justify-content-center">

                                    <?php echo $__env->make('components/buttons/_editButton', [
                                        "route" => "admin.boletins.edit",
                                        "id" => [$boletim->id],
                                        "fontawesome" => null,
                                        "title" => "Editar",
                                        "permission" => "GERENCIADOR_DE_BOLETINS",
                                    ], array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>

                                    <?php echo $__env->make('components/buttons/_deleteButton', [
                                        "message" => __("* Este boletim será excluído e esta ação não poderá ser desfeita, deseja continuar?"),
                                        "route" => "admin.boletins.destroy",
                                        "id" => [$boletim->id],
                                        "fontawesome" => null,
                                        "title" => "Excluir",
                                        "permission" => "GERENCIADOR_DE_BOLETINS",
                                    ], array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>

                                    <?php if($boletim->indexado): ?>
                                        <button class="text-danger text-decoration-none border-0 bg-transparent fs-5 disabled" type="button" style="cursor: initial">
                                            <span class="material-symbols-outlined"> <i class="text-success fa-solid fa-check d-inline fs-5"></i> </span>
                                        </button>
                                    <?php else: ?>
                                        <?php echo $__env->make('components/buttons/_btnActionPost',[
                                            "route" => "admin.boletins.indexacao",
                                            "id" => [$boletim->id],
                                            "fontawesome" => null,
                                            "permission" => "GERENCIADOR_DE_BOLETINS",
                                        ], array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
                                    <?php endif; ?>

                                </div>
                            </td>
                        </tr>
                        <?php $index++; ?>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>

                 <?php $__env->endSlot(); ?>
             <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal0650541a119648223455610148c86d0b)): ?>
<?php $attributes = $__attributesOriginal0650541a119648223455610148c86d0b; ?>
<?php unset($__attributesOriginal0650541a119648223455610148c86d0b); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal0650541a119648223455610148c86d0b)): ?>
<?php $component = $__componentOriginal0650541a119648223455610148c86d0b; ?>
<?php unset($__componentOriginal0650541a119648223455610148c86d0b); ?>
<?php endif; ?>

        </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/boletins/index.blade.php ENDPATH**/ ?>