<?php $__env->startSection('title'); ?>
  <?php echo e(config('app.name')); ?> | Editar eRC N° <?php echo e($recibo->recibo_consecutivo_centro); ?>

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

<?php $__env->startSection('header'); ?>
  <a href="<?php echo e(route('home')); ?>" class="w3-bar-item w3-button"><span class="fa fa-home fa-fw"></span> Home</a>
  <a href="<?php echo e(route('erc.recibos.index')); ?>" class="w3-bar-item w3-button"><span class="fa fa-receipt fa-fw"></span> Recibos</a>
  <a href="<?php echo e(route('erc.recibos.create')); ?>" class="w3-bar-item w3-button"><span class="fa fa-plus fa-fw"></span> Crear</a>
  <a href="<?php echo e(url('erc/recibos/download', $recibo)); ?>" class="w3-bar-item w3-button" target="_blank"><span class="fa fa-print fa-fw"></span> Imprimir</a>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('content'); ?>
    <?php if(\Auth::user()->rol->rol_nombre == 'Administrador' || \Auth::user()->rol->rol_nombre == 'Manager' || \Auth::user()->rol->rol_nombre == 'Cartera' || \Auth::user()->rol->rol_nombre == 'Facturador'): ?>
  <div class="w3-content">
    <div class="w3-container">
      <div class="row w3-text-theme">
        <div class="col-sm-12 text-center">
          <h2>
            <b>Recibo de Caja N° <?php echo e($recibo->recibo_consecutivo_centro); ?></b>            
          </h2>
          <?php if($recibo->voided == 1): ?>
            <p class="w3-text-red"><b>Anulado</b></p>
          <?php endif; ?>

          <?php if($recibo->recibo_updated_at != null): ?>
            <p class="w3-right">
              <i>Editado <b><?php echo e($recibo->recibo_updated_at); ?></b> por <b><?php echo e($recibo->usuarioUpdate->email); ?></b></i>
            </p>
          <?php endif; ?>
        </div>
      </div>      
    </div>
    <br>
    <?php 
      // calcula los dias transcurridos entre la fecha de radicación del recibo y la fecha actual
      $diferencia = strtotime('now')-strtotime($recibo->recibo_created_at);
      $dias_tracurridos = intval($diferencia/60/60/24); //convierte a entero la diferencia
     ?>

    <!-- Si los dias trancurridos es menor o igual a 2 días y el estado es 1 (No contabilizado) muestra mensaje de advertencia -->
    <?php if($dias_tracurridos<=2 && $recibo->estado_id == 1): ?>
      <div class="w3-panel w3-orange">
        <h3></h3>
        <p>
          <b>Recuerde</b> que tiene 2 días a partir de radicado el recibo para editar la información o hasta que el recibo sea marcado como <b>Contabilizado</b>; de lo contrario, deberá comunicarse con el <b>Manager</b> o <b>Administrador</b> para editar la información.
        </p>
      </div>
    <?php else: ?>
      <?php if(Auth::user()->rol->rol_nombre != 'Administrador' && Auth::user()->rol->rol_nombre != 'Manager'): ?>
        <div class="w3-panel w3-pale-yellow w3-leftbar w3-border-orange">
          <h3></h3>
          <p>
            El recibo no permite realizar cambios porque
            <?php if($dias_tracurridos>2 && $recibo->estado_id == 2): ?>
              han pasado <?php echo e($dias_tracurridos); ?> días y ha sido marcado como <b>Contabilizado</b>. Comuníquese con el Manager o Administrador del sitio para editar la información del recibo.
            <?php elseif($dias_tracurridos>2): ?>
              han pasado <?php echo e($dias_tracurridos); ?> días desde su fecha de radicación <?php echo e($recibo->recibo_created_at); ?>. Comuníquese con el Manager o Administrador del sitio para editar la información del recibo.
            <?php elseif($recibo->estado_id == 2): ?>
              ha sido marcado como <b>Contabilizado</b>. Comuníquese con el Manager o Administrador del sitio para editar la información del recibo.
            <?php endif; ?>
          </p>
        </div>
      <?php endif; ?>
    <?php endif; ?>
    <div class="row">
      <div class="col-sm-12 w3-padding">
        <div class="row">
          <div class="col-sm-4">
            <div class="form-group">
              <label>Fecha Creación</label>              
              <?php echo Form::text('recibo_created_at', ($recibo->recibo_created_at!=null)?$recibo->recibo_created_at:null, ['class' => 'w3-input w3-text-grey w3-border w3-border-theme w3-disabled' , 'readonly']); ?>

              <?php echo ($recibo->recibo_created_at!=null)?$recibo->usuario->email:null; ?>

            </div>
          </div>
          <div class="col-sm-4">
            <div class="form-group">
              <label>Fecha Edición</label>              
              <?php echo Form::text('recibo_updated_at', ($recibo->recibo_updated_at!=null)?$recibo->recibo_updated_at:null, ['class' => 'w3-input w3-text-grey w3-border w3-border-theme w3-disabled' , 'readonly']); ?>

              <?php echo ($recibo->recibo_updated_at!=null)?$recibo->usuarioUpdate->email:null; ?>

            </div>
          </div>
          <div class="col-sm-4">
            <div class="form-group">
              <label>Fecha Contabilizado</label>
              <?php echo Form::text('recibo_contabilizado_at', ($recibo->recibo_contabilizado_at!=null)?$recibo->recibo_contabilizado_at:null, ['class' => 'w3-input w3-text-grey w3-border w3-border-theme w3-disabled' , 'readonly']); ?>

              <?php echo ($recibo->recibo_contabilizado_at!=null)?$recibo->usuarioContabilizado->email:null; ?>

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

    <?php echo Form::open(['route' => ['erc.recibos.update', $recibo], 'method' => 'put', 'multipart/form-data' => 'true' ]); ?>

  		<div class="row">
  			<div class="col-sm-12 w3-padding">
  				<div class="row">
  					<div class="col-sm-6">
  						<div class="form-group">
  							<label>Centro Operación*</label>
                <?php echo Form::select('centrooperacion_id', $centros_operacion, $recibo->centrooperacion_id, ['class' => 'w3-input w3-text-grey w3-border w3-border-theme w3-disabled' , 'onchange' => 'totalAPagar(); return false', 'placeholder' => 'Seleccionar', 'required' => true, 'disabled']); ?>

  						</div>
  					</div>
  					<div class="col-sm-6">
  						<div class="form-group">
  							<label>N° Liquidación Banner*</label>
                <?php echo Form::text('recibo_codigo_liquidacion', $recibo->recibo_codigo_liquidacion, ['class' => 'w3-input w3-text-grey w3-border w3-border-theme', 'id' => 'liquidacion_banner', 'onchange' => 'totalAPagar(); return false', 'maxlength' => '20', 'placeholder' => 'Código Liquidación', 'required' => 'true']); ?>

  						</div>
  					</div>
  				</div>
  			</div>
  		</div>
      
  		<div class="row">
  			<div class="col-sm-5 w3-padding">
          <div class="row">
            <div class="col-sm-12">
              <div class="w3-panel w3-leftbar w3-border-theme">
                    <h4 style="padding: .2em"><b>Información Personal</b></h4>
              </div>
            </div>
          </div>
          <p>
            <label>Nombres*:</label>
            <?php echo Form::text('recibo_cliente_nombres', $recibo->recibo_cliente_nombres, ['class' => 'w3-input w3-text-grey w3-border w3-border-theme', 'id' => 'nombres', 'maxlength' => '100', 'placeholder' => 'Nombres', 'required' => 'true']); ?>

          </p>
          <p>
			      <label>Identificación*:</label>
            <?php echo Form::text('recibo_cliente_identificacion', $recibo->recibo_cliente_identificacion, ['class' => 'w3-input w3-text-grey w3-border w3-border-theme', 'id' => 'identificacion', 'maxlength' => '20', 'placeholder' => 'Identificación', 'required' => 'true']); ?>

          </p>
          <p>
  				  <label>Programa:</label>
            <?php echo Form::text('recibo_cliente_programa', $recibo->recibo_cliente_programa, ['class' => 'w3-input w3-text-grey w3-border w3-border-theme', 'id' => 'programa', 'maxlength' => '100', 'placeholder' => 'Programa']); ?>

          </p>
          <p>
  				  <label>Dirección:</label>
            <?php echo Form::text('recibo_cliente_direccion', $recibo->recibo_cliente_direccion, ['class' => 'w3-input w3-text-grey w3-border w3-border-theme', 'id' => 'direccion', 'maxlength' => '100', 'placeholder' => 'Dirección']); ?>

          </p>
          <p>
  				  <label>Teléfono*:</label>
            <?php echo Form::text('recibo_cliente_telefono', $recibo->recibo_cliente_telefono, ['class' => 'w3-input w3-text-grey w3-border w3-border-theme', 'id' => 'telefono', 'maxlength' => '20', 'placeholder' => 'Teléfono', 'required' => 'true']); ?>

          </p>
          <p>
  				  <label>Ciudad:</label>
            <?php echo Form::text('recibo_cliente_ciudad', $recibo->recibo_cliente_ciudad, ['class' => 'w3-input w3-text-grey w3-border w3-border-theme', 'id' => 'ciudad', 'maxlength' => '100', 'placeholder' => 'Ciudad']); ?>

          </p>
          <p>
  				  <label>Observaciones:</label>
            <?php echo Form::textarea('recibo_observaciones', $recibo->recibo_observaciones, ['class' => 'w3-input w3-text-grey w3-border w3-border-theme', 'id' => 'observaciones', 'maxlength' => '255', 'rows' => '5', 'placeholder' => 'Observaciones (255 caracteres).']); ?>

          </p>
        </div>
  			<div class="col-sm-offset-1 col-sm-6 w3-padding">
          <div class="row">
            <div class="col-sm-12">
              <div class="w3-panel w3-leftbar w3-border-theme">
                    <h4 style="padding: .2em"><b>Conceptos de Caja</b></h4>
              </div>
            </div>
          </div>

          <div class="row">
            <div class="col-sm-12">
              <div class="w3-panel w3-theme w3-padding">
                <span onclick="this.parentElement.style.display='none'" class="w3-closebtn">&times;</span>
                Utilizar punto (.) sólo para indicar decimales.
              </div>
            </div>
          </div>

          <div class="row">
      			<div class="col-sm-12">
      				<div id="alerta" class="w3-panel w3-pale-red w3-leftbar w3-border-red" hidden><h4><span class="fa fa-exclamation-triangle"></span> El valor debe ser mayor o igual $0 (Cero).</h4></div>
      			</div>
      		</div>

  				<table width="100%" height="320px">
  					<tr>
  						<th width="40%"></th>
  						<th>Valor $0.00</th>
  					</tr>
  					<tr>
  						<th> Matrícula</th>
  						<td>
                <?php echo Form::number('concepto_matricula', ($recibo->concepto != null)?$recibo->concepto->concepto_matricula:null, ['class' => 'w3-input w3-text-grey w3-border w3-border-theme', 'id' => 'matricula', 'onblur' => 'totalAPagar();', 'onkeyup' => 'totalAPagar();', 'maxlength' => '20', 'placeholder' => '0.0', 'required' => 'true']); ?>

              </td>
  					</tr>
  					<tr>
  						<th> Carnet</th>
  						<td>
                <?php echo Form::number('concepto_carnet', ($recibo->concepto != null)?$recibo->concepto->concepto_carnet:null, ['class' => 'w3-input w3-text-grey w3-border w3-border-theme', 'id' => 'carnet', 'onblur' => 'totalAPagar();', 'onkeyup' => 'totalAPagar();', 'maxlength' => '20', 'placeholder' => '0.0', 'required' => 'true']); ?>

              </td>
  					</tr>
  					<tr>
  						<th> Precooperativa</th>
  						<td>
                <?php echo Form::number('concepto_precooperativa', ($recibo->concepto != null)?$recibo->concepto->concepto_precooperativa:null, ['class' => 'w3-input w3-text-grey w3-border w3-border-theme', 'id' => 'precooperativa', 'onblur' => 'totalAPagar();', 'onkeyup' => 'totalAPagar();', 'maxlength' => '20', 'placeholder' => '0.0', 'required' => 'true']); ?>

              </td>
  					</tr>
  					<tr>
  						<th> Curso de Verano</th>
  						<td>
                <?php echo Form::number('concepto_curso_verano', ($recibo->concepto != null)?$recibo->concepto->concepto_curso_verano:null, ['class' => 'w3-input w3-text-grey w3-border w3-border-theme', 'id' => 'curso_verano', 'onblur' => 'totalAPagar();', 'onkeyup' => 'totalAPagar();', 'maxlength' => '20', 'placeholder' => '0.0', 'required' => 'true']); ?>

              </td>
  					</tr>
  					<tr>
  						<th> Certificados</th>
  						<td>
                <?php echo Form::number('concepto_certificado', ($recibo->concepto != null)?$recibo->concepto->concepto_certificado:null, ['class' => 'w3-input w3-text-grey w3-border w3-border-theme', 'id' => 'certificados', 'onblur' => 'totalAPagar();', 'onkeyup' => 'totalAPagar();', 'maxlength' => '20', 'placeholder' => '0.0', 'required' => 'true']); ?>

              </td>
  					</tr>
  					<tr>
  						<th> Derechos de Grado</th>
  						<td>
                <?php echo Form::number('concepto_derechos_grado', ($recibo->concepto != null)?$recibo->concepto->concepto_derechos_grado:null, ['class' => 'w3-input w3-text-grey w3-border w3-border-theme', 'id' => 'derechos_grado', 'onblur' => 'totalAPagar();', 'onkeyup' => 'totalAPagar();', 'maxlength' => '20', 'placeholder' => '0.0', 'required' => 'true']); ?>

              </td>
  					</tr>
  					<tr>
  						<th> Habilitación</th>
  						<td>
                <?php echo Form::number('concepto_habilitacion', ($recibo->concepto != null)?$recibo->concepto->concepto_habilitacion:null, ['class' => 'w3-input w3-text-grey w3-border w3-border-theme', 'id' => 'habilitacion', 'onblur' => 'totalAPagar();', 'onkeyup' => 'totalAPagar();', 'maxlength' => '20', 'placeholder' => '0.0', 'required' => 'true']); ?>

              </td>
  					</tr>
  					<tr>
  						<th> Seguro Estudiantil</th>
  						<td>
                <?php echo Form::number('concepto_seguro_estudiantil', ($recibo->concepto != null)?$recibo->concepto->concepto_seguro_estudiantil:null, ['class' => 'w3-input w3-text-grey w3-border w3-border-theme', 'id' => 'seguro_estudiantil', 'onblur' => 'totalAPagar();', 'onkeyup' => 'totalAPagar();', 'maxlength' => '20', 'placeholder' => '0.0', 'required' => 'true']); ?>

              </td>
  					</tr>
  					<tr>
  						<th> Estampilla Procultura</th>
  						<td>
                <?php echo Form::number('concepto_estampilla', ($recibo->concepto != null)?$recibo->concepto->concepto_estampilla:null, ['class' => 'w3-input w3-text-grey w3-border w3-border-theme', 'id' => 'estampilla', 'onblur' => 'totalAPagar();', 'onkeyup' => 'totalAPagar();', 'maxlength' => '20', 'placeholder' => '0.0', 'required' => 'true']); ?>

              </td>
  					</tr>
  					<tr>
  						<th> Inscripción</th>
  						<td>
                <?php echo Form::number('concepto_inscripcion', ($recibo->concepto != null)?$recibo->concepto->concepto_inscripcion:null, ['class' => 'w3-input w3-text-grey w3-border w3-border-theme', 'id' => 'inscripcion', 'onblur' => 'totalAPagar();', 'onkeyup' => 'totalAPagar();', 'maxlength' => '20', 'placeholder' => '0.0', 'required' => 'true']); ?>

              </td>
  					</tr>
  					<tr>
  						<th> Homologación</th>
  						<td>
                <?php echo Form::number('concepto_homologacion', ($recibo->concepto != null)?$recibo->concepto->concepto_homologacion:null, ['class' => 'w3-input w3-text-grey w3-border w3-border-theme', 'id' => 'homologacion', 'onblur' => 'totalAPagar();', 'onkeyup' => 'totalAPagar();', 'maxlength' => '20', 'placeholder' => '0.0', 'required' => 'true']); ?>

              </td>
  					</tr>
  					<tr>
  						<th> Otros Conceptos</th>
  						<td>
                <?php echo Form::number('concepto_otros', ($recibo->concepto != null)?$recibo->concepto->concepto_otros:null, ['class' => 'w3-input w3-text-grey w3-border w3-border-theme', 'id' => 'otros_conceptos', 'onblur' => 'totalAPagar();', 'onkeyup' => 'totalAPagar();', 'maxlength' => '20', 'placeholder' => '0.0', 'required' => 'true']); ?>

              </td>
  					</tr>
  					<tr>
  						<th> <b>TOTAL</b></th>
  						<th>
                <?php echo Form::number('concepto_total', ($recibo->concepto != null)?$recibo->concepto->concepto_total:null, ['class' => 'w3-input w3-text-grey w3-border w3-border-theme', 'id' => 'total', 'maxlength' => '20', 'placeholder' => '$0.0', 'readonly' => 'true']); ?>

              </th>
  					</tr>
  				</table>
  			</div>
  		</div>
  		<hr>

      <div class="row">
        <div class="col-sm-12">
          <div class="w3-panel w3-leftbar w3-border-theme">
                <h4 style="padding: .2em"><b>Modalidad de Pago</b></h4>
          </div>
        </div>
      </div>

      <div class="row">
  			<div class="col-sm-6 w3-padding">
          <?php $__currentLoopData = $pagos; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $pago): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
            <?php 
              $coincidencia = false; //
             ?>
            <?php if(!empty($recibo->pagos->ToArray())): ?>
              <?php $__currentLoopData = $recibo->pagos->ToArray(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $recibo_pago): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                
                <?php if($recibo_pago['pivot']['pago_id'] == $pago->pago_id): ?>
                    <?php 
                      $coincidencia = true;
                     ?>
                    <p>
                      <?php echo e(Form::checkbox('pago_id[]', $pago->pago_id, true, ['onchange' => 'displayPago(this.value); return false', 'id' => 'checkbox_'.$pago->pago_id])); ?>

                      <?php echo e(Form::label('pago_id', $pago->pago_nombre)); ?>

                    </p>
                    <p class="w3-margin-left">
                      <?php echo e(Form::label('recibopago_valor', 'Valor', ['class' => 'valor_'.$pago->pago_id, 'style' => 'display:block;',])); ?>

                      <?php echo e(Form::number('recibopago_valor[]', $recibo_pago['pivot']['recibopago_valor'], ['class' => 'w3-input w3-text-grey w3-border w3-border-theme valor_'.$pago->pago_id, 'id' => 'valor_'.$pago->pago_id, 'placeholder' => 'Valor', 'style' => 'display:block;',])); ?>

                    </p>
                    <?php if($pago->pago_nombre == 'Cheque'): ?>
                          <p class="w3-margin-left">
                            <?php echo e(Form::label('recibopago_entidad_bancaria', 'Entidad Bancaria', ['class' => 'valor_'.$pago->pago_id, 'style' => 'display:block;'])); ?>

                            <?php echo e(Form::text('recibopago_entidad_bancaria[]', $recibo_pago['pivot']['recibopago_entidad_bancaria'], ['class' => 'w3-input w3-text-grey w3-border w3-border-theme valor_'.$pago->pago_id, 'id' => 'valor_'.$pago->pago_id, 'maxlength' => '100', 'placeholder' => 'Entidad Bancaria', 'style' => 'display:block;',])); ?>

                          </p>
                          <p class="w3-margin-left">
                            <?php echo e(Form::label('recibopago_codigo', 'N° Cheque', ['class' => 'valor_'.$pago->pago_id, 'style' => 'display:block;'])); ?>

                            <?php echo e(Form::number('recibopago_codigo[]', $recibo_pago['pivot']['recibopago_codigo'], ['class' => 'w3-input w3-text-grey w3-border w3-border-theme valor_'.$pago->pago_id, 'id' => 'valor_'.$pago->pago_id, 'placeholder' => $pago->pago_nombre, 'style' => 'display:block;',])); ?>

                          </p>
                          <p class="w3-margin-left">
                            <?php echo e(Form::label('recibopago_plaza', 'Plaza', ['class' => 'valor_'.$pago->pago_id, 'style' => 'display:block;'])); ?>

                            <?php echo e(Form::number('recibopago_plaza[]', $recibo_pago['pivot']['recibopago_plaza'], ['class' => 'w3-input w3-text-grey w3-border w3-border-theme valor_'.$pago->pago_id, 'id' => 'valor_'.$pago->pago_id, 'placeholder' => 'Plaza', 'style' => 'display:block;',])); ?>

                          </p>
                    <?php elseif($pago->pago_nombre == 'Tarjeta'): ?>
                        <!-- visible input -->
                        <p class="w3-margin-left">
                          <?php echo e(Form::label('recibopago_entidad_bancaria', 'Entidad Bancaria', ['class' => 'valor_'.$pago->pago_id, 'style' => 'display:block;'])); ?>

                          <?php echo e(Form::text('recibopago_entidad_bancaria[]', $recibo_pago['pivot']['recibopago_entidad_bancaria'], ['class' => 'w3-input w3-text-grey w3-border w3-border-theme valor_'.$pago->pago_id, 'id' => 'valor_'.$pago->pago_id, 'maxlength' => '100', 'placeholder' => 'Entidad Bancaria', 'style' => 'display:block;'])); ?>

                        </p>
                        <p class="w3-margin-left">
                          <?php echo e(Form::label('recibopago_codigo', 'Voucher', ['class' => 'valor_'.$pago->pago_id, 'style' => 'display:block;'])); ?>

                          <?php echo e(Form::number('recibopago_codigo[]', $recibo_pago['pivot']['recibopago_codigo'], ['class' => 'w3-input w3-text-grey w3-border w3-border-theme valor_'.$pago->pago_id, 'id' => 'valor_'.$pago->pago_id, 'placeholder' => 'Voucher', 'style' => 'display:block;',])); ?>

                        </p>

                        <!-- hidden input -->
                        <p class="w3-margin-left">
                          <?php echo e(Form::number('recibopago_plaza[]', $recibo_pago['pivot']['recibopago_plaza'], ['class' => 'w3-input w3-text-grey w3-border w3-border-theme valor_'.$pago->pago_id.' hide_'.$pago->pago_id, 'id' => 'valor_'.$pago->pago_id, 'placeholder' => 'Plaza', 'style' => 'display:none;',])); ?>

                        </p>
                    <?php elseif($pago->pago_nombre == 'Efectivo'): ?>
                        <!-- hidden input -->
                        <p class="w3-margin-left">
                          <?php echo e(Form::number('recibopago_codigo[]', $recibo_pago['pivot']['recibopago_codigo'], ['class' => 'w3-input w3-text-grey w3-border w3-border-theme valor_'.$pago->pago_id.' hide_'.$pago->pago_id, 'id' => 'valor_'.$pago->pago_id, 'placeholder' => 'Voucher', 'style' => 'display:none;',])); ?>

                        </p>
                        <p class="w3-margin-left">
                          <?php echo e(Form::text('recibopago_entidad_bancaria[]', $recibo_pago['pivot']['recibopago_entidad_bancaria'], ['class' => 'w3-input w3-text-grey w3-border w3-border-theme valor_'.$pago->pago_id.' hide_'.$pago->pago_id, 'id' => 'valor_'.$pago->pago_id, 'maxlength' => '100', 'placeholder' => 'Entidad Bancaria', 'style' => 'display:none;',])); ?>

                        </p>
                        <p class="w3-margin-left">
                          <?php echo e(Form::number('recibopago_plaza[]', $recibo_pago['pivot']['recibopago_plaza'], ['class' => 'w3-input w3-text-grey w3-border w3-border-theme valor_'.$pago->pago_id.' hide_'.$pago->pago_id, 'id' => 'valor_'.$pago->pago_id, 'placeholder' => 'Plaza', 'style' => 'display:none;',])); ?>

                        </p>
                    <?php elseif($pago->pago_nombre == 'Transferencia'): ?>
                        <!-- hidden input -->
                        <p class="w3-margin-left">
                          <?php echo e(Form::number('recibopago_codigo[]', $recibo_pago['pivot']['recibopago_codigo'], ['class' => 'w3-input w3-text-grey w3-border w3-border-theme valor_'.$pago->pago_id.' hide_'.$pago->pago_id, 'id' => 'valor_'.$pago->pago_id, 'placeholder' => 'Voucher', 'style' => 'display:none;',])); ?>

                        </p>
                        <p class="w3-margin-left">
                          <?php echo e(Form::text('recibopago_entidad_bancaria[]', $recibo_pago['pivot']['recibopago_entidad_bancaria'], ['class' => 'w3-input w3-text-grey w3-border w3-border-theme valor_'.$pago->pago_id.' hide_'.$pago->pago_id, 'id' => 'valor_'.$pago->pago_id, 'maxlength' => '100', 'placeholder' => 'Entidad Bancaria', 'style' => 'display:none;',])); ?>

                        </p>
                        <p class="w3-margin-left">
                          <?php echo e(Form::number('recibopago_plaza[]', $recibo_pago['pivot']['recibopago_plaza'], ['class' => 'w3-input w3-text-grey w3-border w3-border-theme valor_'.$pago->pago_id.' hide_'.$pago->pago_id, 'id' => 'valor_'.$pago->pago_id, 'placeholder' => 'Plaza', 'style' => 'display:none;',])); ?>

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

            <?php if($coincidencia == false): ?>
              <p>
                <?php echo e(Form::checkbox('pago_id[]', $pago->pago_id, null, ['onchange' => 'displayPago(this.value); return false', 'id' => 'checkbox_'.$pago->pago_id])); ?>

                <?php echo e(Form::label('pago_id', $pago->pago_nombre)); ?>

              </p>
              <p class="w3-margin-left">
                <?php echo e(Form::label('recibopago_valor', 'Valor', ['class' => 'valor_'.$pago->pago_id, 'style' => 'display:none;'])); ?>

                <?php echo e(Form::number('recibopago_valor[]', null, ['class' => 'w3-input w3-text-grey w3-border w3-border-theme valor_'.$pago->pago_id, 'id' => 'valor_'.$pago->pago_id, 'placeholder' => 'Valor', 'style' => 'display:none;', 'disabled'])); ?>

              </p>
              <?php if($pago->pago_nombre == 'Cheque'): ?>
                    <p class="w3-margin-left">
                      <?php echo e(Form::label('recibopago_entidad_bancaria', 'Entidad Bancaria', ['class' => 'valor_'.$pago->pago_id, 'style' => 'display:none;'])); ?>

                      <?php echo e(Form::text('recibopago_entidad_bancaria[]', null, ['class' => 'w3-input w3-text-grey w3-border w3-border-theme valor_'.$pago->pago_id, 'id' => 'valor_'.$pago->pago_id, 'maxlength' => '100', 'placeholder' => 'Entidad Bancaria', 'style' => 'display:none;', 'disabled'])); ?>

                    </p>
                    <p class="w3-margin-left">
                      <?php echo e(Form::label('recibopago_codigo', 'N° Cheque', ['class' => 'valor_'.$pago->pago_id, 'style' => 'display:none;'])); ?>

                      <?php echo e(Form::number('recibopago_codigo[]', null, ['class' => 'w3-input w3-text-grey w3-border w3-border-theme valor_'.$pago->pago_id, 'id' => 'valor_'.$pago->pago_id, 'placeholder' => $pago->pago_nombre, 'style' => 'display:none;', 'disabled'])); ?>

                    </p>
                    <p class="w3-margin-left">
                      <?php echo e(Form::label('recibopago_plaza', 'Plaza', ['class' => 'valor_'.$pago->pago_id, 'style' => 'display:none;'])); ?>

                      <?php echo e(Form::number('recibopago_plaza[]', null, ['class' => 'w3-input w3-text-grey w3-border w3-border-theme valor_'.$pago->pago_id, 'id' => 'valor_'.$pago->pago_id, 'placeholder' => 'Plaza', 'style' => 'display:none;', 'disabled'])); ?>

                    </p>
              <?php elseif($pago->pago_nombre == 'Tarjeta'): ?>
                  <!-- visible input -->
                  <p class="w3-margin-left">
                    <?php echo e(Form::label('recibopago_entidad_bancaria', 'Entidad Bancaria', ['class' => 'valor_'.$pago->pago_id, 'style' => 'display:none;'])); ?>

                    <?php echo e(Form::text('recibopago_entidad_bancaria[]', null, ['class' => 'w3-input w3-text-grey w3-border w3-border-theme valor_'.$pago->pago_id, 'id' => 'valor_'.$pago->pago_id, 'maxlength' => '100', 'placeholder' => 'Entidad Bancaria', 'style' => 'display:none;', 'disabled'])); ?>

                  </p>
                  <p class="w3-margin-left">
                    <?php echo e(Form::label('recibopago_codigo', 'Voucher', ['class' => 'valor_'.$pago->pago_id, 'style' => 'display:none;'])); ?>

                    <?php echo e(Form::number('recibopago_codigo[]', null, ['class' => 'w3-input w3-text-grey w3-border w3-border-theme valor_'.$pago->pago_id, 'id' => 'valor_'.$pago->pago_id, 'placeholder' => 'Voucher', 'style' => 'display:none;', 'disabled'])); ?>

                  </p>

                  <!-- hidden input -->
                  <p class="w3-margin-left">
                    <?php echo e(Form::number('recibopago_plaza[]', null, ['class' => 'w3-input w3-text-grey w3-border w3-border-theme valor_'.$pago->pago_id.' hide_'.$pago->pago_id, 'id' => 'valor_'.$pago->pago_id, 'placeholder' => 'Plaza', 'style' => 'display:none;', 'disabled'])); ?>

                  </p>
              <?php elseif($pago->pago_nombre == 'Efectivo'): ?>
                  <!-- hidden input -->
                  <p class="w3-margin-left">
                    <?php echo e(Form::number('recibopago_codigo[]', null, ['class' => 'w3-input w3-text-grey w3-border w3-border-theme valor_'.$pago->pago_id.' hide_'.$pago->pago_id, 'id' => 'valor_'.$pago->pago_id, 'placeholder' => 'Voucher', 'style' => 'display:none;', 'disabled'])); ?>

                  </p>
                  <p class="w3-margin-left">
                    <?php echo e(Form::text('recibopago_entidad_bancaria[]', null, ['class' => 'w3-input w3-text-grey w3-border w3-border-theme valor_'.$pago->pago_id.' hide_'.$pago->pago_id, 'id' => 'valor_'.$pago->pago_id, 'maxlength' => '100', 'placeholder' => 'Entidad Bancaria', 'style' => 'display:none;', 'disabled'])); ?>

                  </p>
                  <p class="w3-margin-left">
                    <?php echo e(Form::number('recibopago_plaza[]', null, ['class' => 'w3-input w3-text-grey w3-border w3-border-theme valor_'.$pago->pago_id.' hide_'.$pago->pago_id, 'id' => 'valor_'.$pago->pago_id, 'placeholder' => 'Plaza', 'style' => 'display:none;', 'disabled'])); ?>

                  </p>
              <?php elseif($pago->pago_nombre == 'Transferencia'): ?>
                  <!-- hidden input -->
                  <p class="w3-margin-left">
                    <?php echo e(Form::number('recibopago_codigo[]', null, ['class' => 'w3-input w3-text-grey w3-border w3-border-theme valor_'.$pago->pago_id.' hide_'.$pago->pago_id, 'id' => 'valor_'.$pago->pago_id, 'placeholder' => 'Voucher', 'style' => 'display:none;', 'disabled'])); ?>

                  </p>
                  <p class="w3-margin-left">
                    <?php echo e(Form::text('recibopago_entidad_bancaria[]', null, ['class' => 'w3-input w3-text-grey w3-border w3-border-theme valor_'.$pago->pago_id.' hide_'.$pago->pago_id, 'id' => 'valor_'.$pago->pago_id, 'maxlength' => '100', 'placeholder' => 'Entidad Bancaria', 'style' => 'display:none;', 'disabled'])); ?>

                  </p>
                  <p class="w3-margin-left">
                    <?php echo e(Form::number('recibopago_plaza[]', null, ['class' => 'w3-input w3-text-grey w3-border w3-border-theme valor_'.$pago->pago_id.' hide_'.$pago->pago_id, 'id' => 'valor_'.$pago->pago_id, 'placeholder' => 'Plaza', 'style' => 'display:none;', 'disabled'])); ?>

                  </p>
              <?php endif; ?>
            </p>
            <?php endif; ?>


            
            <?php else: ?>
              <p>
                <?php echo e(Form::checkbox('pago_id[]', $pago->pago_id, null, ['onchange' => 'displayPago(this.value); return false', 'id' => 'checkbox_'.$pago->pago_id])); ?>

                <?php echo e(Form::label('pago_id', $pago->pago_nombre)); ?>

              </p>
              <p class="w3-margin-left">
                <?php echo e(Form::label('recibopago_valor', 'Valor', ['class' => 'valor_'.$pago->pago_id, 'style' => 'display:none;'])); ?>

                <?php echo e(Form::number('recibopago_valor[]', null, ['class' => 'w3-input w3-text-grey w3-border w3-border-theme valor_'.$pago->pago_id, 'id' => 'valor_'.$pago->pago_id, 'placeholder' => 'Valor', 'style' => 'display:none;', 'disabled'])); ?>

              </p>
                <?php if($pago->pago_nombre == 'Cheque'): ?>
                      <p class="w3-margin-left">
                        <?php echo e(Form::label('recibopago_entidad_bancaria', 'Entidad Bancaria', ['class' => 'valor_'.$pago->pago_id, 'style' => 'display:none;'])); ?>

                        <?php echo e(Form::text('recibopago_entidad_bancaria[]', null, ['class' => 'w3-input w3-text-grey w3-border w3-border-theme valor_'.$pago->pago_id, 'id' => 'valor_'.$pago->pago_id, 'maxlength' => '100', 'placeholder' => 'Entidad Bancaria', 'style' => 'display:none;', 'disabled'])); ?>

                      </p>
                      <p class="w3-margin-left">
                        <?php echo e(Form::label('recibopago_codigo', 'N° Cheque', ['class' => 'valor_'.$pago->pago_id, 'style' => 'display:none;'])); ?>

                        <?php echo e(Form::number('recibopago_codigo[]', null, ['class' => 'w3-input w3-text-grey w3-border w3-border-theme valor_'.$pago->pago_id, 'id' => 'valor_'.$pago->pago_id, 'placeholder' => $pago->pago_nombre, 'style' => 'display:none;', 'disabled'])); ?>

                      </p>
                      <p class="w3-margin-left">
                        <?php echo e(Form::label('recibopago_plaza', 'Plaza', ['class' => 'valor_'.$pago->pago_id, 'style' => 'display:none;'])); ?>

                        <?php echo e(Form::number('recibopago_plaza[]', null, ['class' => 'w3-input w3-text-grey w3-border w3-border-theme valor_'.$pago->pago_id, 'id' => 'valor_'.$pago->pago_id, 'placeholder' => 'Plaza', 'style' => 'display:none;', 'disabled'])); ?>

                      </p>
                <?php elseif($pago->pago_nombre == 'Tarjeta'): ?>
                    <!-- visible input -->
                    <p class="w3-margin-left">
                      <?php echo e(Form::label('recibopago_entidad_bancaria', 'Entidad Bancaria', ['class' => 'valor_'.$pago->pago_id, 'style' => 'display:none;'])); ?>

                      <?php echo e(Form::text('recibopago_entidad_bancaria[]', null, ['class' => 'w3-input w3-text-grey w3-border w3-border-theme valor_'.$pago->pago_id, 'id' => 'valor_'.$pago->pago_id, 'maxlength' => '100', 'placeholder' => 'Entidad Bancaria', 'style' => 'display:none;', 'disabled'])); ?>

                    </p>
                    <p class="w3-margin-left">
                      <?php echo e(Form::label('recibopago_codigo', 'Voucher', ['class' => 'valor_'.$pago->pago_id, 'style' => 'display:none;'])); ?>

                      <?php echo e(Form::number('recibopago_codigo[]', null, ['class' => 'w3-input w3-text-grey w3-border w3-border-theme valor_'.$pago->pago_id, 'id' => 'valor_'.$pago->pago_id, 'placeholder' => 'Voucher', 'style' => 'display:none;', 'disabled'])); ?>

                    </p>

                    <!-- hidden input -->
                    <p class="w3-margin-left">
                      <?php echo e(Form::number('recibopago_plaza[]', null, ['class' => 'w3-input w3-text-grey w3-border w3-border-theme valor_'.$pago->pago_id.' hide_'.$pago->pago_id, 'id' => 'valor_'.$pago->pago_id, 'placeholder' => 'Plaza', 'style' => 'display:none;', 'disabled'])); ?>

                    </p>
                <?php elseif($pago->pago_nombre == 'Efectivo'): ?>
                    <!-- hidden input -->
                    <p class="w3-margin-left">
                      <?php echo e(Form::number('recibopago_codigo[]', null, ['class' => 'w3-input w3-text-grey w3-border w3-border-theme valor_'.$pago->pago_id.' hide_'.$pago->pago_id, 'id' => 'valor_'.$pago->pago_id, 'placeholder' => 'Voucher', 'style' => 'display:none;', 'disabled'])); ?>

                    </p>
                    <p class="w3-margin-left">
                      <?php echo e(Form::text('recibopago_entidad_bancaria[]', null, ['class' => 'w3-input w3-text-grey w3-border w3-border-theme valor_'.$pago->pago_id.' hide_'.$pago->pago_id, 'id' => 'valor_'.$pago->pago_id, 'maxlength' => '100', 'placeholder' => 'Entidad Bancaria', 'style' => 'display:none;', 'disabled'])); ?>

                    </p>
                    <p class="w3-margin-left">
                      <?php echo e(Form::number('recibopago_plaza[]', null, ['class' => 'w3-input w3-text-grey w3-border w3-border-theme valor_'.$pago->pago_id.' hide_'.$pago->pago_id, 'id' => 'valor_'.$pago->pago_id, 'placeholder' => 'Plaza', 'style' => 'display:none;', 'disabled'])); ?>

                    </p>
                <?php elseif($pago->pago_nombre == 'Transferencia'): ?>
                    <!-- hidden input -->
                    <p class="w3-margin-left">
                      <?php echo e(Form::number('recibopago_codigo[]', null, ['class' => 'w3-input w3-text-grey w3-border w3-border-theme valor_'.$pago->pago_id.' hide_'.$pago->pago_id, 'id' => 'valor_'.$pago->pago_id, 'placeholder' => 'Voucher', 'style' => 'display:none;', 'disabled'])); ?>

                    </p>
                    <p class="w3-margin-left">
                      <?php echo e(Form::text('recibopago_entidad_bancaria[]', null, ['class' => 'w3-input w3-text-grey w3-border w3-border-theme valor_'.$pago->pago_id.' hide_'.$pago->pago_id, 'id' => 'valor_'.$pago->pago_id, 'maxlength' => '100', 'placeholder' => 'Entidad Bancaria', 'style' => 'display:none;', 'disabled'])); ?>

                    </p>
                    <p class="w3-margin-left">
                      <?php echo e(Form::number('recibopago_plaza[]', null, ['class' => 'w3-input w3-text-grey w3-border w3-border-theme valor_'.$pago->pago_id.' hide_'.$pago->pago_id, 'id' => 'valor_'.$pago->pago_id, 'placeholder' => 'Plaza', 'style' => 'display:none;', 'disabled'])); ?>

                    </p>
                <?php endif; ?>
              </p>
            <?php endif; ?>
        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
        </div>
      </div>
  	<br>
    <div class="w3-row w3-right">
			<div class="w3-col s12">
        
         <?php if($recibo->voided == 0): ?>
          
          <?php if($recibo->estado_id == 1): ?>

            
            <?php if(Auth::user()->rol->rol_nombre == 'Administrador' || Auth::user()->rol->rol_nombre == 'Manager' || $dias_tracurridos<=2): ?>
    				  <button type="submit" id="guardar_formulario" class="w3-btn w3-theme"><span class="fa fa-save fa-fw"></span> Guardar Cambios</button>

              <a href="javascript:void(0)" class="w3-btn w3-orange w3-text-white" onclick="document.getElementById('form_avoid').style.display='block';"><span class="fa fa-ban fa-fw"></span> Anular</a>
            <?php endif; ?>

    				<a href="<?php echo e(route('erc.recibos.index')); ?>" class="w3-btn w3-red"><span class="fa fa-times fa-fw"></span> Cancelar</a>
          
          <?php elseif($recibo->estado_id == 2): ?>
            <?php if(Auth::user()->rol->rol_nombre == 'Administrador' || Auth::user()->rol->rol_nombre == 'Manager'): ?>
    				  <button type="submit" id="guardar_formulario" class="w3-btn w3-theme"><span class="fa fa-save fa-fw"></span> Guardar Cambios</button>
            <?php endif; ?>

    				<a href="<?php echo e(route('erc.recibos.index')); ?>" class="w3-btn w3-red"><span class="fa fa-times fa-fw"></span> Cancelar</a>
          <?php endif; ?>
        <?php elseif($recibo->voided == 1): ?>
          <a href="<?php echo e(route('erc.recibos.index')); ?>" class="w3-btn w3-red"><span class="fa fa-times fa-fw"></span> Cancelar</a>
        <?php endif; ?>
			</div>
		</div>
    <?php echo Form::close(); ?>


    <div class="w3-modal" id="form_avoid">
      <div class="w3-modal-content">        
        <header class="w3-container w3-theme">
          <h2>Anular e-RC #<?php echo e($recibo->recibo_consecutivo_centro); ?></h2>
          <span onclick="document.getElementById('id01').style.display='none'" class="w3-button w3-display-topright">&times;</span>
        </header>

        <div class="w3-container w3-padding w3-center">
          <p>¿Está seguro que desea anular este recibo? Si lo hace, este recibo quedará como inexistente en el sistema.</p>
          <a href="<?php echo e(route('erc.recibos.void', $recibo)); ?>" class="w3-btn w3-theme"><span class="fa fa-ban fa-fw"></span> Sí, Anular</a>
          <a href="javascript:void(0)" class="w3-btn w3-red" onclick="document.getElementById('form_avoid').style.display='none';"><span class="fa fa-times fa-fw"></span> No, Cancelar</a>
        </div>
      </div>
    </div>
  </div>
  <?php else: ?>
    <div class="w3-content">
      <div class="w3-panel w3-pale-red w3-leftbar w3-border-red">
        <p class="w3-padding"><br />¡Lo sentimos! Usuario no autorizado.</p>
      </div>
    </div>
  <?php endif; ?>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.app', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>