<div class="content-wrapper">

  <section class="content-header">
    
    <h1>
      
      Administrar estados de servicios
    
    </h1>

    <ol class="breadcrumb">
      
      <li><a href="inicio"><i class="fa fa-dashboard"></i> Inicio</a></li>
      
      <li class="active">Administrar estados de servicios</li>
    
    </ol>

  </section>

  <section class="content">

    <div class="box">

      <div class="box-header with-border">



        <div class="form-row">  

                    <div class="form-group col-md-3">
                      <label for="inputCity">Zona:</label>
                      <div class="input-group">
                      <span class="input-group-addon"><i class="fa fa-flag-checkered"></i></span>
                      <?php 
                        $zonas = ControladorDirecciones::ctrMostrarZona(); ?> 

                      <select class="form-control" id="zonaServicio_" name="zonaServicio_" required>
                              <option value="">Seleccione</option> 
                              <?php foreach($zonas as $fila){ ?>                             
                              <option value="<?= $fila['idzona'] ?>"><?= $fila['nombre_zona'] ?></option>
                              <?php } ?>
                                    
                            </select>  
                      </div>
                    </div>                   
                    
                    <div class="form-group col-md-3">
                      <input type="hidden" id="perfilSession" value="<?php echo $_SESSION["perfil"]; ?>"  name="">
                      <label for="inputCity">Fecha desde:</label>
                      <div class="input-group">
                        <span class="input-group-addon"><i class="fa fa-audio-description"></i></span>
                        <input type="month" class="form-control" id="fecha_desde" name="fecha_desde">
                      </div>
                    </div>
                    
                    <div class="form-group col-md-3">
                      <label for="inputCity">fecha hasta:</label>
                      <div class="input-group">
                      <span class="input-group-addon"><i class="fa fa-flag-checkered"></i></span>
                      <input type="month" class="form-control" id="fecha_hasta" name="fecha_hasta">
                      </div>
                    </div>

                   

                    <div class="form-group col-md-3">
                      <label for="inputCity"><i class="fa fa-file-pdf-o"></i> </label>
                      <div class="input-group">
                      

                      <button class="btn btn-success reportePDFE" >
          
                        Descargar reporte en .pdf <i class="fa fa-file-pdf-o"></i>

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

                  </div>


  
        

      </div>

      <div class="box-body">
        
       <table class="table table-bordered table-striped dt-responsive tablas serviConti">
         
        <thead>
         
         <tr>
           
           <th style="width:10px">#</th>
           <th style="width: 50px;">Código</th>      
           <th>Cliente</th>
           <th>Documento</th>
           <th>zona</th>
           <th>Dirección</th> 
           <th>Tipo de servicio</th>          
           <th>Nombre servicio</th>
           <th>Mes</th>
           <th>Monto</th>
           <th>Estado</th>

         </tr> 

        </thead>

        <tbody id="serviExport">

        <?php

        $item = null;
        $valor = null;

        $contratos = ControladorContratos::ctrMostrarContratosVencidos($item, $valor);

        echo '<script> arrayContratos = '.json_encode($contratos) .'</script>';

        //Parse error: syntax error, unexpected end of file in C:\xampp\htdocs\SisRecoleccion\vistas\modulos\contratos.php on line 111
//var_dump($contratos); exit;
       foreach ($contratos as $key => $value){
         
          echo ' <tr>
                  <td>'.($key+1).'</td>
                  <td>'.$value["codigo"].'</td>';
                 
                echo '<td>'.$value["nombrePersona"].'</td>';

                echo '<td>'.$value["documento"].'</td>';

                echo '<td>'.$value["nombre_zona"].'</td>';

                echo '<td>'.$value["direccion"].'</td>';

                echo '<td>'.$value["tipoServicio"].'</td>';   

                echo '<td>'.$value["nombreServicio"].'</td>';

                 echo '<td>'.$value["fechas_pagos"].'</td>';

                 echo '<td>'.$value["monto"].'</td>';

             if($value["estadoCronograma"] == 0){

                        echo '<td><span class="badge bg-green" idservicios="'.$value["idservicios"].'" estadoPersona="1">Activo</span></td>';

                      }else if($value["estadoCronograma"] == 1){

                        echo '<td><span class="badge bg-yellow" idservicios="'.$value["idservicios"].'" estadoPersona="0">Suspendido</span></td>';

                      }
                      else if($value["estadoCronograma"] == 2){

                        echo '<td><span class="badge bg-red" idservicios="'.$value["idservicios"].'" estadoPersona="0">Vencido</span></td>';  

                      }
                      

                      echo '</div>  

                    </td>            

                  

                </tr>';
        }


        ?> 

        </tbody>

       </table>

      </div>

    </div>

  </section>

</div>



<div id="modalEditarContrato" class="modal fade" role="dialog">
  
<div class="modal-dialog modal-lg">
    <div class="modal-content">

      <form role="form" method="post">

        <!--=====================================
        CABEZA DEL MODAL
        ======================================-->

        <div class="modal-header" style="background:#3c8dbc; color:white">

          <button type="button" class="close" data-dismiss="modal">&times;</button>

          <h4 class="modal-title">Cronograma de Pagos</h4>

        </div>

        <!--=====================================
        CUERPO DEL MODAL
        ======================================-->

        <div class="modal-body">

          <div class="box-body">

            <table class="table table-bordered table-striped dt-responsive tablas tablaContratos" width="100%">
              
         
        <thead>
         
         <tr>
           
           <th style="width:10px">#</th>
           <th>Fechas de pagos</th>
           <th>Monto</th>
           <th>Estado</th>
           
         </tr> 

        </thead>

        <tbody id="tablebody1">
         
   
        </tbody>

       </table>            
            
  
          </div>

        </div>



        <!--=====================================
        PIE DEL MODAL
        ======================================-->

        <div class="modal-footer">

          <button type="button" class="btn btn-danger pull-right" data-dismiss="modal">Close</button>
          

        </div>

      </form>

      </div>

  </div>

</div>
<script src="vistas/js/exportar-reportes.js"></script>