@if($persona_fisica)
  @if(isset($cheques['propio']))
    <div style="padding:10px;font-size:16px; margin-bottom: :5px;" class="col-md-12 col-sm-12 col-xs-12 text-center background-fidelitas">
      <span>{{$cheques['cantidad_propios']}}</span> Cheques Rechazados @if(isset($mensaje)) {{$mensaje}} @endif
    </div>
    <table class="table table-hover" id="tabla_cheques">
      <thead>
        <tr>
          <th>
            Número de Cheque
          </th>
          <th>
            Firmante
          </th>
          <th>
            Importe
          </th>
          <th>
          Fecha Rechazo
          </th>
          <th>
          Fecha Pago
          </th>
          <th>
          Fecha Pago Multa
          </th>
          <th>
          Causa
          </th>
        </tr>
      </thead>
      <tbody>
        @foreach ($cheques['propio'] as $cheque)
        <tr>
          <td>
            {{ $cheque->nro_cheque }}
          </td>
          <td>
            {{ $cheque->nombre_persona_firmante or 'No Informa'}}
          </td>
          <td>
            {{ number_format($cheque->importe,2,',',' ')  }} 
          </td>
          <td>
            {{ $cheque->fecha_rechazo }}
          </td>
          <td>
            {{ $cheque->fecha_levantamiento }}
          </td>
          <td>
            {{ $cheque->fecha_pago }}
          </td>
          <td>
            {{ $cheque->causa }}
          </td>
        </tr>
        @endforeach
      </tbody>
      <tfoot>
        <tr>
          <th>
          Número de Cheque
          </th>
          <th>
          Firmante
          </th>
           <th>
          Importe
          </th>
          <th>
          Fecha Rechazo
          </th>
           <th>
          Fecha Pago
          </th>
          <th>
          Fecha Pago Multa
          </th>
          <th>
          Causa
          </th>
        </tr>
      </tfoot>
    </table>
    @if(!isset($mostrar_cheques_completos) && isset($cheques['propio']) && sizeof($cheques['propio']) > 499 && !Session::get('html') )
      <div class="col-md-12 text-center">
        <a href="#" class="cheques_500_ver_todos" data-cuit="{{ $cuit }}" data-id_persona="{{ $id_persona }}" data-_token="{{ csrf_token() }}" >Ver todos los cheques</a>
      </div>
    @endif
    @if(isset($mostrar_cheques_completos))
      <script type="text/javascript">
        $(function(){
          crearDatatable('#tabla_cheques');
        });
      </script>
    @endif
  @else {{-- else of isset($cheques['propio']) --}}
    <div class="col-md-12 col-sm-12 col-xs-12"><h5 style="padding:10px;" class="text-center alert alert-success">No se registran cheques rechazados en cuentas Personales</h5></div>
  @endif {{-- end of isset($cheques['propio']) --}}


  @if(isset($cheques['empresa']))
    <h5 style="padding:10px;" class="col-md-12 col-sm-12 col-xs-12 text-center background-fidelitas"><span>{{$cheques['cantidad_empresas']}}</span> Cheques Rechazados en cuentas de personas jurídicas</h5>
    <table class="table table-hover" id="tabla_cheques">
      <thead>
        <tr>
          <th>
            Número de Cheque
          </th>
          <th>
            Empresa
          </th>
          <th>
            Importe
          </th>
          <th>
            Fecha Rechazo
          </th>
          <th>
            Fecha Pago
          </th>
          <th>
            Fecha Pago Multa
          </th>
          <th>
            Causa
          </th>
        </tr>
      </thead>
      <tbody>
        @foreach ($cheques['empresa'] as $cheque)
          <tr>
            <td>
              {{ $cheque->nro_cheque }}
            </td>
            <td>
              <form target="iframe{{$cheque->Cuit_relacionado}}" method="POST" action="/informes/compacto" class="text-left">
                <input type="hidden" name="_token" id="token" value="{{ csrf_token() }}">
                <input id="idp" name="idp" value="{{$cheque->idp}}" type="hidden">
                <input id="fcuit" name="cuit" value="{{$cheque->Cuit_relacionado}}" type="hidden">
                <input id="nc" name="nc" value="{{$cheque->nombre_persona_relacionado}} - {{$cheque->Cuit_relacionado}}" type="hidden">
                <input id="rs" name="rs" value="{{$cheque->nombre_persona_relacionado}}" type="hidden">
                <button type="submit" class="nuevo-informe">{{$cheque->nombre_persona_relacionado or ''}}</button>
              </form>
            </td>
            <td>
              {{ number_format($cheque->importe,2,',',' ')  }}
            </td>
            <td>
              {{ $cheque->fecha_rechazo }}
            </td>
            <td>
              {{ $cheque->fecha_levantamiento }}
            </td>
            <td>
              {{ $cheque->fecha_pago }}
            </td>
            <td>
              {{ $cheque->causa }}
            </td>
          </tr>
        @endforeach
      </tbody>
      <tfoot>
        <tr>
          <th>
            Número de Cheque
          </th>
          <th>
            Empresa
          </th>
          <th>
            Importe
          </th>
          <th>
            Fecha Rechazo
          </th>
          <th>
            Fecha Pago
          </th>
          <th>
            Fecha Pago Multa
          </th> 
          <th>
            Causa
          </th>
        </tr>
      </tfoot>
    </table>
    @if(!isset($mostrar_cheques_completos) && isset($cheques['empresa']) && sizeof($cheques['empresa']) > 499 && !Session::get('html') )
      <div class="col-md-12 text-center">
        <a href="#" class="cheques_500_ver_todos" data-cuit="{{ $cuit }}" data-id_persona="{{ $id_persona }}" data-_token="{{ csrf_token() }}" >Ver todos los cheques</a>
      </div>
    @endif
    @if(isset($mostrar_cheques_completos))
      <script type="text/javascript">
        $(function(){
          crearDatatable('#tabla_cheques');
        });
      </script>
    @endif
  @endif {{-- end of isset($cheques['empresa'] --}}
@else {{-- else of $persona_fisica --}}

  @if(isset($cheques['a_nombre_de_empresa']))
    <div class="col-md-12 col-sm-12 col-xs-12">
      <div class="col-md-12 col-sm-12 col-xs-12">
        <div style="padding:10px;font-size:16px; margin-bottom: 50px;" class="col-md-12 col-sm-12 col-xs-12  text-center background-fidelitas">
          <span>{{$cheques['cantidad_propios']}}</span> Cheques Rechazados @if(isset($mensaje)) {{$mensaje}} @endif
        </div>
        <table class="table table-hover" id="tabla_cheques">
          <thead>
            <tr>
              <th>
                Número de Cheque
              </th>
              <th>
                Importe
              </th>
              <th>
                Fecha Rechazo
              </th>
              <th>
                Fecha Pago
              </th>
              <th>
                Fecha Pago Multa
              </th>
              <th>
                Causa
              </th>
            </tr>
          </thead>
          <tbody>
            @foreach ($cheques['a_nombre_de_empresa'] as $cheque)
              <tr>
                <td>
                  {{ $cheque->nro_cheque }}
                </td>
                <td>
                  {{ number_format($cheque->importe,2,'.',' ')  }}
                </td>
                <td>
                  {{ $cheque->fecha_rechazo }}
                </td>
                <td>
                  {{ $cheque->fecha_levantamiento }}
                </td>
                <td>
                  {{ $cheque->fecha_pago }}
                </td>
                <td>
                  {{ $cheque->causa }}
                </td>
              </tr>
            @endforeach
          </tbody>
          <tfoot>
            <tr>
              <th>
                Número de Cheque
              </th>
              <th>
                Importe
              </th>
              <th>
                Fecha Rechazo
              </th>
              <th>
                Fecha Pago
              </th>
              <th>
                Fecha Pago Multa
              </th>
              <th>
                Causa
              </th>
            </tr>
          </tfoot>
        </table>
      </div>
    </div>
    @if(!isset($mostrar_cheques_completos) && isset($cheques['a_nombre_de_empresa']) && sizeof($cheques['a_nombre_de_empresa']) > 499 && !Session::get('html') )
      <div class="col-md-12 text-center">
        <a href="#" class="cheques_500_ver_todos" data-cuit="{{ $cuit }}" data-id_persona="{{ $id_persona }}" data-_token="{{ csrf_token() }}" >Ver todos los cheques</a>
      </div>
    @endif
    @if(isset($mostrar_cheques_completos))
      <script type="text/javascript">
        $(function(){
          crearDatatable('#tabla_cheques');
        });
      </script>
    @endif
  @endif {{-- end of isset($cheques['a_nombre_de_empresa'] --}}

  @if (isset($cheques['vinculaciones']))
    <div class="col-md-12 col-sm-12 col-xs-12 padding10 vinculado_segun_bcra" style="margin-bottom: 25px">
      <h4 class="text-center titulo-fidelitas ">VINCULACIONES SEGÚN BCRA</h4>
    </div>
    <div class="col-md-12 col-sm-12 col-xs-12 vinculado_segun_bcra">
      <div class="col-md-12 col-sm-12 col-xs-12">
        <table class="table table-hover" id="tabla_vinculaciones">
          <thead>
            <tr>
              <th class="text-center">
                Firmante
              </th>
              <th class="text-center">
                CUIT
              </th>
              <th class="text-center">
                Informado a la fecha
              </th> 
            </tr>
          </thead>
          <tbody>
            @if (isset($vinculados_segun_bcra) && sizeof($vinculados_segun_bcra) > 0)
              @foreach ($vinculados_segun_bcra as $cheque)
                <tr>
                  <td class="text-left">
                    <form target="iframe{{$cheque->cuit_firmante}}" method="POST" action="/informes/compacto" >
                      <input type="hidden" name="_token" id="token" value="{{ csrf_token() }}">
                      <input id="idp" name="idp" value="{{$cheque->idp}}" type="hidden">
                      <input id="fcuit" name="cuit" value="{{$cheque->cuit_firmante}}" type="hidden">
                      <input id="nc" name="nc" value="{{$cheque->nombre_persona_firmante}} - {{$cheque->cuit_firmante}}" type="hidden">
                      <input id="rs" name="rs" value="{{$cheque->nombre_persona_firmante}}" type="hidden">
                      <button type="submit" class="text-left nuevo-informe">{{$cheque->nombre_persona_firmante or ''}}</button>
                    </form>
                  </td>
                  <td class="@if(Session::get('html')) text-center @else @endif">
                    {{ $cheque->cuit_firmante or '' }}
                  </td>
                  <td class="text-center">
                    {{ $cheque->fecha_relacion or '' }}
                  </td>
                </tr>
              @endforeach
            @endif
          </tbody>
          <tfoot>
            <tr>
              <th class="text-center">
                Firmante
              </th>  
              <th class="text-center">
                CUIT
              </th>
              <th class="text-center">
                Informado a la fecha
              </th>
            </tr>
          </tfoot>
        </table>
      </div>
    </div>
    @if(!isset($mostrar_cheques_completos) && isset($cheques['vinculaciones']) && sizeof($cheques['vinculaciones']) > 499 && !Session::get('html') )
      <div class="col-md-12 text-center">
        <a href="#" class="cheques_500_ver_todos" data-cuit="{{ $cuit }}" data-id_persona="{{ $id_persona }}" data-_token="{{ csrf_token() }}" >Ver todos los cheques</a>
      </div>
    @endif
    @if(isset($mostrar_cheques_completos))
      <script type="text/javascript">
        $(function(){
          crearDatatable('#tabla_vinculaciones');
        });
      </script>
    @endif
  @endif {{-- end of isset($cheques['vinculaciones'] --}}
@endif {{-- end of else $persona_fisica --}}