<div>
    <?php $__env->startComponent('common.breadcrumb', ['addBtn' => false, 'permission_create' => 'Company_contracts_users_history',
        'breadcrumb_show' => $breadcrumb_show]); ?>
        <?php $__env->slot('breadcrumb_title'); ?>
            <h3><?php echo e($componentName); ?> | <?php echo e($pageTitle); ?></h3>
        <?php $__env->endSlot(); ?>
        <li class="breadcrumb-item">Empresa</li>
        <li class="breadcrumb-item active">Historial Contratos Empleado</li>
    <?php if (isset($__componentOriginal96f5b8f7cb2e3bbc8f06cfd8ecfbc87428561469)): ?>
<?php $component = $__componentOriginal96f5b8f7cb2e3bbc8f06cfd8ecfbc87428561469; ?>
<?php unset($__componentOriginal96f5b8f7cb2e3bbc8f06cfd8ecfbc87428561469); ?>
<?php endif; ?>
<?php echo $__env->renderComponent(); ?>
    <div class="container-fluid">
        <div class="row layout-top-spacing">
            <div class="col-sm-12">
                <div class="card">
                    <div class="card-body">
                        <div class="card-header">
                            <h4>Historial Contratos <b> | <?php echo e($first_name); ?> <?php echo e($last_name); ?></b></h4>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="row justify-content-center">
            <div class="col-lg-2 col-md-2 col-sm-12">
                <a href="<?php echo e(route('contratos-empleados.create', $user_id)); ?>" class="btn btn-outline-primary">
                    <i class="fa fa-arrow-left"></i>
                    Agregar Contrato
                </a>
            </div>
            <div class="col-lg-4 col-md-4 col-sm-12">
                <div class="form-group">
                    <select class="form-select" wire:model="type_contract">
                        <option value="">Todos los tipos de Contratos</option>
                        <?php $__currentLoopData = DataTypeContract(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $value): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <option value="<?php echo e($key); ?>"><?php echo e($value); ?></option>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </select>
                </div>
            </div>
            <div class="col-lg-4 col-md-4 col-sm-12">
                <div class="form-group">
                    <select class="form-select" wire:model="sub_type_contract">
                        <option value="">Todos los Subtipos de Contratos</option>
                        <?php $__currentLoopData = DataSubTypeContract(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $value): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <option value="<?php echo e($key); ?>"><?php echo e($value); ?></option>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </select>
                </div>
            </div>
        </div><!-- row -->

        <div class="row justify-content-between file-content mb-2">
            <div class="col-lg-4 col-md-4 col-sm-12">
                <div class="form-inline">
                    <div class="form-group d-flex mb-0"><i class="fa fa-search"></i>
                        <input class="form-control-plaintext" type="text" wire:model="search" placeholder="Buscar...">
                    </div>
                </div>
            </div>
            <?php if(isset($count_reg)): ?>
                <div class="col-lg-4 col-md-4 col-sm-12">
                    <p class="p-l-20">Total Contratos: <?php echo e($count_reg); ?></p>
                </div>
            <?php endif; ?>

        </div>
    </div><!-- container-fluid -->
    <div class="container-fluid">
        <div class="row layout-top-spacing">
            <div class="col-sm-12">
                <?php if($count_reg > 0): ?>
                    <?php $__currentLoopData = $contracts_user; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <div class="card">
                            <div class="card-body">
                                <div class="card-title">
                                    <h6 class="d-inline">Nombre del Contrato: </h6>
                                    <p class="d-inline float-right"><?php echo e($item->name); ?></p>
                                </div>
                                <div class="card-subtitle mb-2 text-muted">
                                    <h6 class="d-inline">Tipo de Contrato: </h6>
                                    <p class="d-inline float-right"><?php echo e(DataTypeContract($item->type)); ?></p>
                                    <h6 class="d-inline"> - | - </h6>
                                    <h6 class="d-inline">Subtipo de Contrato: </h6>
                                    <p class="d-inline float-right"><?php echo e(DataSubTypeContract($item->sub_type)); ?></p>
                                </div>
                                <div class="card-content">
                                    <h6 class="d-inline">Descripción: </h6>
                                    <p class="d-inline float-right"><?php echo e($item->description); ?></p>
                                    <hr class="my-2">
                                    <h6 class="d-inline">Fecha de Inicio: </h6>
                                    <p class="d-inline float-right">
                                        <?php echo e(\Carbon\Carbon::parse($item->start_date)->day); ?> de
                                        <?php echo e(\Carbon\Carbon::parse($item->start_date)->monthName); ?> de
                                        <?php echo e(\Carbon\Carbon::parse($item->start_date)->year); ?></p>
                                    <h6 class="d-inline"> || </h6>
                                    <h6 class="d-inline">Fecha de Finalización: </h6>
                                    <?php if($item->end_date != null): ?>
                                        <p class="d-inline float-right">
                                            <?php echo e(\Carbon\Carbon::parse($item->end_date)->day); ?> de
                                            <?php echo e(\Carbon\Carbon::parse($item->end_date)->monthName); ?> de
                                            <?php echo e(\Carbon\Carbon::parse($item->end_date)->year); ?></p>
                                    <?php else: ?>
                                        <p class="d-inline float-right">
                                            No definida</p>
                                    <?php endif; ?>
                                    <hr class="my-2">
                                    <h6 class="d-inline">Fecha de Creación: </h6>
                                    <p class="d-inline float-right">
                                        <?php echo e(\Carbon\Carbon::parse($item->created_at)->day); ?> de
                                        <?php echo e(\Carbon\Carbon::parse($item->created_at)->monthName); ?> del
                                        <?php echo e(\Carbon\Carbon::parse($item->created_at)->year); ?></p>
                                    <hr class="my-2">
                                    <h6 class="d-inline">Creado por: </h6> <?php echo e(FullNameUser($item->created_by)); ?> <br>
                                    <?php if($item->status_contract == '3'): ?>
                                    <hr class="my-2">
                                    <h6 class="d-inline text-danger">Razón de la terminacion: </h6> <?php echo e($item->ref_reason_termination); ?> <br>
                                    <h6 class="d-inline text-danger">Fecha de Terminación: </h6> <?php echo e(\Carbon\Carbon::parse($item->date_termination)->day); ?> de
                                    <?php echo e(\Carbon\Carbon::parse($item->date_termination)->monthName); ?> de
                                    <?php echo e(\Carbon\Carbon::parse($item->date_termination)->year); ?><br>
                                    <h6 class="d-inline text-danger">Terminado por: </h6> <?php echo e(FullNameUser($item->user_termination)); ?> <br>
                                    <?php endif; ?>
                                    <hr class="my-2">
                                    <div class="row">
                                        <div class="col-lg-6 col-md-6 col-sm-12">
                                            <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('Company_contracts_users_annex_view')): ?>
                                            <?php if(getAnnexesContractUser($item->id_contract_user, $user_id, $company_id)['count'] > 0): ?>
                                                <a href="<?php echo e(url('/anexos-contrato-empleado/pdf/' . $item->id_contract_user)); ?>" target="_blank"
                                                    class="btn btn-outline-primary m-2" title="Ver">
                                                    <i class="far fa-file-pdf"></i> Ver Otros Sí
                                                </a>
                                            <?php endif; ?>
                                        <?php endif; ?>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <div class="col-lg-8 col-md-8 col-sm-12">
                                            <div class="form-group">
                                                <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('ContractEmployee_pdf')): ?>
                                                    <a href="<?php echo e(url('/contrato-empleado/pdf/' . $item->id_contract_user)); ?>"
                                                        target="_blank" class="btn btn-outline-primary m-2"
                                                        title="Imprimir">
                                                        <i class="far fa-file-pdf"></i> Ver Contrato
                                                    </a>
                                                <?php endif; ?>

                                                <?php if($item->status_contract != '3'): ?>
                                                    <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('Company_contracts_users_add_signature')): ?>
                                                        <?php if($item->signature_company == null): ?>
                                                            <a href="<?php echo e(route('contratos-empleados.firmar', $item->id_contract_user)); ?>"
                                                                class="btn btn-outline-primary m-2" title="Firmar">
                                                                <i class="fas fa-pen"></i> Firmar Contrato
                                                            </a>
                                                        <?php else: ?>
                                                            <span class="border-2 bg-success m-2 p-2"><i
                                                                    class="fas fa-check"></i> Contrato Firmado por el
                                                                empleador</span>
                                                        <?php endif; ?>
                                                    <?php endif; ?>
                                                    <label class="d-inline">
                                                    <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('Company_contracts_active_employee_signature')): ?>
                                                        <?php if($status_employee == 'ACTIVO'): ?>
                                                            <?php if($item->active_signature_employee == 1): ?>
                                                                <?php if($item->signature_employee == null): ?>
                                                                    <span class="border-2 bg-info rounded p-2 m-2">
                                                                        Esperando Firma del Empleado</span>
                                                                <?php else: ?>
                                                                    <span class="border-2 bg-success m-2 p-2"><i
                                                                            class="fas fa-check"></i> Contrato Firmado por
                                                                        el trabajador</span>
                                                                <?php endif; ?>
                                                            <?php else: ?>
                                                                <input type="checkbox"
                                                                    wire:change="ActiveSignatureEmployee(<?php echo e($item->id_contract_user); ?>)"
                                                                    class="m-2 checkbox_animated" id="active_signature"
                                                                    title="Eliminar" class="checkbox_animated">
                                                                Activar Firma para empleado
                                                            <?php endif; ?>
                                                        <?php else: ?>
                                                            <span class="border-2 bg-danger m-2 p-2"><i
                                                                    class="fas fa-exclamation-triangle"></i> El empleado no
                                                                se encuentra activo</span>
                                                        <?php endif; ?>
                                                    <?php endif; ?>
                                                    </label>
                                                <?php endif; ?>
                                            </div>
                                        </div>
                                        <div class="col-lg-4 col-md-4 col-sm-12">
                                            <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('Company_contracts_users_status_approve')): ?>
                                                <?php if($status_employee == 'ACTIVO'): ?>
                                                    <button
                                                        class="btn-sm f-right btn <?php echo e(ColorStatusContract($item->status_contract)); ?>"
                                                        wire:click="StatusApproveContract(<?php echo e($item->id_contract_user); ?>)"
                                                        title="Aprobado / Pendiente"><i
                                                            class="m-r-5 fas <?php echo e(IconStatusContract($item->status_contract)); ?>"></i>
                                                        <?php echo e(DataTypeStatusContract($item->status_contract)); ?></button>
                                                <?php endif; ?>
                                            <?php endif; ?>
                                        </div>
                                    </div><!-- row -->

                                    <div class="row">
                                        <hr class="my-2">
                                        <div class="col-lg-4 col-md-14 col-sm-12">
                                            <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('Company_contracts_users_terminate')): ?>
                                                <?php if($item->status_contract != '3'): ?>
                                                    <button class="btn btn-outline-danger"
                                                        wire:click="OpenTerminateContract(<?php echo e($item->id_contract_user); ?>)"
                                                        title="Terminar Contrato">
                                                        <i class="fas fa-times"></i> Terminar Contrato
                                                    </button>
                                                <?php endif; ?>
                                            <?php endif; ?>
                                        </div>
                                        <div class="col-lg-4 col-md-14 col-sm-12">
                                            <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('Company_contracts_users_annex_add')): ?>
                                                <?php if($item->status_contract == '1'): ?>
                                                    <a href="<?php echo e(route('otro-si-contrato-empleado', $item->id_contract_user)); ?>"
                                                        class="btn btn-outline-primary" title="Agregar Otro Si">
                                                        <i class="fas fa-plus"></i> Agregar Otro Si
                                                    </a>
                                                <?php endif; ?>
                                            <?php endif; ?>
                                        </div>
                                    </div><!-- row -->
                                </div><!-- card-content -->
                            </div><!-- card-body -->
                        </div><!-- card -->
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                <?php else: ?>
                    <div class="card">
                        <div class="card-header text-center">
                            <h5 class="text-danger">No hay Contratos registrados para este Empleado</h5>
                        </div>
                    </div>
                <?php endif; ?>
                <?php echo e($contracts_user->links()); ?>

            </div><!-- col-sm-12 -->
        </div><!-- row -->
        <?php echo $__env->make('livewire.company.contracts.history.form-termination', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
        <?php echo $__env->make('livewire.loading.component', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?> <!--- component loading ,en targetLoading se coloca el id del metodo que se esta cargando --->

    </div><!-- container-fluid -->
</div>
<?php echo $__env->make('common.scriptsCompStandar', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
<?php $__env->startPush('cheditor'); ?>
<script src="<?php echo e(asset('assets/js/ckeditor/ckeditor.js')); ?>"></script>
<script>
    const editor = CKEDITOR.replace('reason_termination',
        {
        language: 'es',
        height: 300,
        removeButtons: 'Cut,Copy,Paste,PasteText,PasteFromWord,Anchor,Underline,Strike,Subscript,Superscript,Image,SpecialChar,Maximize,ShowBlocks,About,Save,NewPage,Preview,Print,Templates,Scayt,Form,Checkbox,Radio,TextField,Textarea,Select,Button,ImageButton,HiddenField,Strike,Blockquote,CreateDiv,BidiLtr,BidiRtl,Language,Unlink,Anchor,Flash,HorizontalRule,Smiley,SpecialChar,PageBreak,Iframe,Styles,Format,Font,FontSize,TextColor,BGColor,Maximize,About,ShowBlocks,Save,NewPage,Preview,Print,Templates,Scayt,Form,Checkbox,Radio,TextField,Textarea,Select,Button,ImageButton,HiddenField,Strike,Blockquote,CreateDiv,BidiLtr,BidiRtl,Language,Unlink,Anchor,Flash,HorizontalRule,Smiley'
        });
    document.querySelector('#save_contract_termination').addEventListener( 'click', () => {
        let contract = $('#reason_termination').data('reason_termination');
        eval (contract).set('reason_termination', editor.getData());
    } );
</script>
<?php $__env->stopPush(); ?>

<script>
    document.addEventListener('DOMContentLoaded', function() {
        $('#theModalTerminate').on('show.bs.modal', function() {
            $('.modal-body:first *:input[type!=hidden]:first').trigger('focus');
        });
        window.livewire.on('hide-modal-terminate', msg => {
            $('#theModalTerminate').modal('hide')
        });
        window.livewire.on('show-modal-terminate', msg => {
            $('#theModalTerminate').modal('show')
        });
    });
</script>
<?php /**PATH /var/www/html/resources/views/livewire/company/contracts/history/component.blade.php ENDPATH**/ ?>