<?php if (isset($component)) { $__componentOriginal8e2ce59650f81721f93fef32250174d77c3531da = $component; } ?>
<?php $component = App\View\Components\AppLayout::resolve([] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? (array) $attributes->getIterator() : [])); ?>
<?php $component->withName('app-layout'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag && $constructor = (new ReflectionClass(App\View\Components\AppLayout::class))->getConstructor()): ?>
<?php $attributes = $attributes->except(collect($constructor->getParameters())->map->getName()->all()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>
     <?php $__env->slot('title', null, []); ?> 
        Listado de partidas contables periodo  <?php echo e(Help::getNameMothByNumber(  ltrim(Help::periodoContable()->mes, "0"))); ?> <?php echo e(Help::periodoContable()->year); ?>

     <?php $__env->endSlot(); ?>

     <?php $__env->slot('subtitle', null, []); ?> 
        
     <?php $__env->endSlot(); ?>

    <div class="col-md-12">
        <ol class="breadcrumb">
            <li class="breadcrumb-item"><a href="/">Dasboard</a></li>
            <li class="breadcrumb-item active" aria-current="page">Partidas contables</li>
        </ol>
    </div>
    <div class="col-md-12">
        <?php if (isset($component)) { $__componentOriginalc254754b9d5db91d5165876f9d051922ca0066f4 = $component; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.alert','data' => []] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? (array) $attributes->getIterator() : [])); ?>
<?php $component->withName('alert'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag && $constructor = (new ReflectionClass(Illuminate\View\AnonymousComponent::class))->getConstructor()): ?>
<?php $attributes = $attributes->except(collect($constructor->getParameters())->map->getName()->all()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?> <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalc254754b9d5db91d5165876f9d051922ca0066f4)): ?>
<?php $component = $__componentOriginalc254754b9d5db91d5165876f9d051922ca0066f4; ?>
<?php unset($__componentOriginalc254754b9d5db91d5165876f9d051922ca0066f4); ?>
<?php endif; ?>
    </div>

    <div class="col-md-12 text-end mt-2 mb-2">
        <!-- Button trigger modal -->
        <a style="color: white" type="button" class="btn btn-primary" href="<?php echo e(route('contabilidad.partidas.create')); ?>">
            <i class="fas fa-save"></i>
        </a>


    </div>


    <div class="col-md-12">

        <div class="card">
            <div class="card-body">
                <h5>Partidas contables del periodo: <?php echo Help::periodoContable()?->codigo ??
                "<span class='badge bg-danger'>No hay periodo activo</span>"; ?> </h5>
                <?php if(count($partidas) > 0): ?>
                    <table class="table table-sm" id="datatable-responsive">
                        <thead>
                            <tr>
                                <th width="40" scope="col">#</th>
                                <th scope="col" width="110">N° Partida</th>
                                <th scope="col" width="90">Tipo</th>
                                <th scope="col" width="90">DEBE</th>
                                <th scope="col" width="90">HABER</th>

                                <th width="100" scope="col">Fecha</th>

                                <th width="120" class="text-center" scope="col">Acciones</th>
                                <th width="60" class="text-center" scope="col">Anular</th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php $__currentLoopData = $partidas; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <tr
                                    class="  <?php if($item->anulada == true): ?> table-danger <?php endif; ?> <?php if($item->cerrada == true): ?> table-warning <?php endif; ?>">

                                    <th scope="row"><?php echo e($key + 1); ?></th>

                                    <td><?php echo e(Help::codigoPartida($item)); ?> </td>
                                    <td><?php echo e($item->tipoPartida->tipo); ?> </td>
                                    <td><?php echo e($item->debe); ?> </td>
                                    <td><?php echo e($item->haber); ?> </td>

                                    <td> <?php echo e(Help::date($item->fecha_contable)); ?></td>
                                    <td class="text-center">
                                        <a target="_blank"
                                            href="<?php echo e(route('contabilidad.reportePartidaContable', ['id' => $item->id, 'reporte' => 'pdf'])); ?>">
                                            <i class="fa-solid fa-file-pdf fa-2x"></i></a>

                                        <?php if($item->anulada == false && $item->cerrada == false): ?>
                                            <a
                                                href="<?php echo e(route('contabilidad.partidas.edit', $item->id)); ?>"
                                               ><i class="fa-solid fa-file-pen fa-2x"></i></a>
                                        <?php endif; ?>
                                    </td>
                                    <td class="text-center">

                                        <?php if(!$item->anulada): ?>
                                            <?php if($item->cerrada): ?>
                                            <i class="fa-solid fa-lock"></i>
                                            <?php else: ?>
                                                <form id="form<?php echo e($item->id); ?>"
                                                    action="<?php echo e(route('contabilidad.partidas.destroy', $item->id)); ?>"
                                                    method="post">
                                                    <?php echo method_field('DELETE'); ?>
                                                    <?php echo csrf_field(); ?>
                                                    <button
                                                        onclick="confirm('form<?php echo e($item->id); ?>','¿Desea anular la partida?')"
                                                        class="btn <?php if($item->cerrada): ?> btn-success <?php else: ?> btn-danger <?php endif; ?> "
                                                        type="button"><i class="fas fa-ban"></i></button>
                                                </form>
                                            <?php endif; ?>
                                        <?php else: ?>
                                            <div class="text-center">ANULADA</div>
                                        <?php endif; ?>

                                    </td>

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


                        </tbody>
                    </table>
                <?php else: ?>
                    <?php if (isset($component)) { $__componentOriginalc254754b9d5db91d5165876f9d051922ca0066f4 = $component; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.message','data' => ['color' => 'danger','message' => 'No hay partidas contables para el periodo solicitado']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? (array) $attributes->getIterator() : [])); ?>
<?php $component->withName('message'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag && $constructor = (new ReflectionClass(Illuminate\View\AnonymousComponent::class))->getConstructor()): ?>
<?php $attributes = $attributes->except(collect($constructor->getParameters())->map->getName()->all()); ?>
<?php endif; ?>
<?php $component->withAttributes(['color' => 'danger','message' => 'No hay partidas contables para el periodo solicitado']); ?>
                     <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalc254754b9d5db91d5165876f9d051922ca0066f4)): ?>
<?php $component = $__componentOriginalc254754b9d5db91d5165876f9d051922ca0066f4; ?>
<?php unset($__componentOriginalc254754b9d5db91d5165876f9d051922ca0066f4); ?>
<?php endif; ?>
                <?php endif; ?>
            </div>
        </div>

    </div>

 <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal8e2ce59650f81721f93fef32250174d77c3531da)): ?>
<?php $component = $__componentOriginal8e2ce59650f81721f93fef32250174d77c3531da; ?>
<?php unset($__componentOriginal8e2ce59650f81721f93fef32250174d77c3531da); ?>
<?php endif; ?>
<?php /**PATH C:\laragon\www\sistema-contable-laravel\resources\views/contabilidad/partidas_contables/index.blade.php ENDPATH**/ ?>