<!-- Creado: Félix Ricardo Oliva Alonso, 26/10/2017. Se crea la vista agenda medica de urgencias -->

<?php
  use App\Libraries\ejLib;
  $var = ejLib::getInstance();
  $soapclient = $var->getWs();
  $wsClave = $var->get_wsClave();

  $usuario = $_SESSION['operador'];
  $Centro_Sal = $var->desencriptar_AES($usuario['centro_sal'], $usuario['x']);
  $Centro_Sal = trim($Centro_Sal);
  $IDDOC  = $var->desencriptar_AES($usuario['id_doc'], $usuario['x']);

  $vCat_AreaTrabajo = $soapclient->vCat_Areas($wsClave);
  //echo $vCat_AreaTrabajo;
  $fe_vCat_AreaTrabajo = new SimpleXMLElement(utf8_encode($vCat_AreaTrabajo));

?>


<script type="text/javascript">
$(document).ready(function() {
   $('#fechareg').datepick({dateFormat: 'dd/mm/yyyy', defaultDate: new Date(), selectDefaultDate: true});
   $( "#fechareg" ).datepick( "option", "yearRange", "-99:+0" );
   $( "#fechareg" ).datepick( "option", "maxDate", "+0m +0d" );
   //$( "#fechareg" ).datepick( "option", "minDate", "+0m -7d" );
   //$( "#fechareg" ).keypress(function (evt) {  return false; });
   getHora();
})


function getHora(){
  var date = new Date();
  var h = date.getHours();
  var hour = (h < 10) ? '0' + h : h;
  var mn = date.getMinutes();
  var minutes = (mn < 10) ? '0' + mn : mn;
  var sc = date.getSeconds();
  var seconds = (sc < 10) ? '0' + sc : sc;
  var hora = hour+':'+minutes+':'+seconds;
  $('#horareg').val(hora);
}
//setInterval(getHora, 1000);
</script>

<div class="input-group-sm form-group-sm">
    <div class="box box-primary">

        <div class="box-header with-border">
            <h3 class="box-title">Búsqueda de Expedientes</h3>
            <div class="box-tools pull-right">
                <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
            </div>
        </div>

        <div class="box-body">
          <label id="lblCita2" style="padding-bottom:10px;"><?php if (isset($_POST['dCita']))  { echo $_POST['dCita']; }?> </label>
          <div class="row">
              <div class="col-sm-4">
                <div class="input-group input-group-sm">
                  <span class="input-group-addon" id="sizing-addon3" style="background: #eee">No. Expediente</span>
                  <input id="expedientereg"type="text" class="form-control" readonly value="<?php if(isset($_POST['NumExpediente'])){echo $_POST['NumExpediente'];}?>">
                </div>
              </div>
          </div>
          <br>
          <div class="row">

              <div class="col-sm-2">
                <div class="input-group input-group-sm">
                  <span class="input-group-addon" id="sizing-addon3" style="background: #eee" >Fecha</span>
                  <input type="text" id="fechareg" class="form-control" >
                </div>
              </div>

              <div class="col-sm-2">
                <div class="input-group input-group-sm">
                  <span class="input-group-addon" id="sizing-addon3" style="background: #eee" >Hora</span>
                  <input type="text"  class="form-control"  id="horareg">
                </div>
              </div>

              <div class="col-sm-4">
                <div class="input-group input-group-sm">
                  <span class="input-group-addon" id="sizing-addon3" style="background: #eee">Área de préstamo</span>
                  <select class="form-control" id="areareg">
                    <option disabled selected value="">---------------</option>
                    @foreach ($fe_vCat_AreaTrabajo->respuesta as $fe_als)
                      <option value="{!! $fe_als->idarea !!}">{!! utf8_decode($fe_als->nombre) !!}</option>
                    @endforeach
                  </select>
                </div>
              </div>

              <div class="col-sm-4">
                <div class="input-group input-group-sm">
                  <span class="input-group-addon" id="sizing-addon3" style="background: #eee">Movimiento</span>
                  <select class="form-control" id="movimientoreg">
                    <option disabled selected value="">---------------</option>
                    <option value="1">Préstamo</option>
                    <option value="2">Devolución</option>
                  </select>
                </div>
              </div>

          </div>


          <br>
          <div class="row">

              {{-- <div class="col-sm-12">Solicitante</div> --}}
              <div class="col-sm-7">
                <div class="input-group input-group-sm">
                  <span class="input-group-addon" id="sizing-addon3" style="background: #eee">Nombre del solicitante</span>
                  <input type="text" id="nombrereg" name="nombrereg" class="form-control" placeholder="Nombre completo [Nombre(s), 1er Apellido, 2do Apellido]">
                </div>
              </div>

              <div class="pull-left">
                  <div class="col-sm-2">
                  <a href="#" onclick="bqdSolicitanteShow();" class="btn btn-sm btn-primary">Búsqueda avanzada de solicitantes</a>
                  </div>
              </div>

          </div>
          <br>

          <div id="bqdSol" style="display:none">
              <div class="row">
                <div class="col-sm-7">
                  <div class="input-group input-group-sm col-sm-12">
                    <span class="input-group-addon" id="sizing-addon3" style="background: #eee">Solicitante a buscar</span>
                    <input type="text" id="nombreregbqd"  class="form-control" placeholder="Ingrese nombre y/o apellido(s) del solicitante">
                  </div>
                </div>

                <div class="col-sm-5">
                  <div class="pull-left" ><a href="#" onclick="bqdSolicitante();" class="btn btn-sm btn-primary"><span class="fa fa-search" aria-hidden="true"></span> Buscar</a></div>
                  <div class="pull-right" style="padding-right: 5px; cursor:pointer" onclick="bqdSolicitanteHide();" title="Cerrar búsqueda avanzada" ><small>Cerrar búsqueda</small>  <span class="fa fa-close" aria-hidden="true"></span></div>
                </div>
              </div>

              <div id="contenedor_tabla_sol"></div>
          </div>

          <div class="row">
              <div class="col-xs-7 form-group">
                  Comentarios
                  <textarea id="comentariosreg" class="form-control" rows="3" ></textarea>
              </div>
          </div>

          <hr>
          <p class="text-center">
              <a id="canExp" href="#" class="btn btn-sm  btn-sm btn-danger">Cancelar</a>
              <a id="canGdr" href="#" class="btn btn-sm btn-primary" onclick="nvoMovExp();">Guardar</a>
          </p>

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