@php

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

	$data = $soapclient->ConsultaExterna_getLstNotas_xPaciente($paciente->clave_pac, $_POST['todas'], $wsClave);
	$data = new SimpleXMLElement(utf8_encode($data));
	$notas = $data->respuesta;

	$f_nac = explode('/',$paciente->f_nac);	
	$FNac = new DateTime($f_nac[2]."-".$f_nac[1]."-".$f_nac[0]);
    $hoy = new DateTime();
    $edad = $hoy->diff($FNac); 
    $todas = trim($_POST['todas']);
    

    if($todas == '1') $todas = explode(',','0,Últimas 10'); else $todas = explode(',','1,Todas');

@endphp
			<div class="box box-primary primary_objHojaFrontal"> <!-- Inicio de HojaFrontal -->
              <div class="box-header with-border">
                  <h3 class="box-title">Hoja Frontal</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" id="objBuscarNotasPaciente" name="objBuscarNotasPaciente">
                
                <div class="row">                  	
                  	<div class="col-sm-6">
                      <div class="input-group input-group-sm">
                          <span class="input-group-addon" id="sizing-addon3" >Nombre del Paciente</span>
                          <span class="form-control">{{  trim(utf8_decode($paciente->nombre)) }} {{  trim(utf8_decode($paciente->primer_apellido)) }} {{  trim(utf8_decode($paciente->segundo_apellido)) }}</span>
                      </div> 
                    </div>

                    <div class="col-sm-6">
                      <div class="input-group input-group-sm">
                          <span class="input-group-addon" id="sizing-addon3" >Edad</span>
                          <span class="form-control">{{  $edad->y }} años</span>
                      </div> 
                    </div>
                </div>
                <div class="row">
                    <div class="col-sm-6">
                      <div class="input-group input-group-sm">
                          <span class="input-group-addon" id="sizing-addon3" >Fecha de Nacimiento</span>
                          <span class="form-control">{{  trim(utf8_decode($paciente->f_nac)) }}</span>
                      </div> 
                    </div>

                    <div class="col-sm-6">
                      <div class="input-group input-group-sm">
                          <span class="input-group-addon" id="sizing-addon3" >CURP</span>
                          <span class="form-control">{{  trim(utf8_decode($paciente->curp)) }}</span>
                      </div> 
                    </div>
                </div>

                <div class="row">
                    <div class="col-sm-6">
                      <div class="input-group input-group-sm">
                          <span class="input-group-addon" id="sizing-addon3" >Derecho Habiencia</span>
                          <span class="form-control">{{  trim(utf8_decode($paciente->afil_descripcion)) }}</span>
                      </div> 
                    </div>

                    <div class="col-sm-6">
                      <div class="input-group input-group-sm">
                          <span class="input-group-addon" id="sizing-addon3" >Sexo</span>
                          <span class="form-control">{{  trim(utf8_decode($paciente->sex_nombre)) }}</span>
                      </div> 
                    </div>
                </div>

                <div class="row">
                    <div class="col-sm-6">
                      <div class="input-group input-group-sm">
                          <span class="input-group-addon" id="sizing-addon3" >Folio</span>
                          <span class="form-control">{{  trim(utf8_decode($paciente->folio_afil)) }}</span>
                      </div> 
                    </div>

                    <div class="col-sm-6">
                      <div class="input-group input-group-sm" style="position: absolute; right: 15px;">
                        <button type="button" class="btn btn-primary btn-sm" title="Generar PDF" 
                        onclick=" jqGetAjaxShort('imprime_HojaFrontal_pdf','primary_Hoja_Frontal', {'clave_pac':'{{  $paciente->clave_pac }}', 'todas': '0'});"><span class="fa fa-file-pdf-o" aria-hidden="true"></span> 
                            Generar PDF  
                        </button>
                        &nbsp;
                        <button type="button" class="btn btn-primary btn-sm" title="Buscar Paciente" onclick="jqGetAjaxShort('Consulta_revisarNotas','primary_Hoja_Frontal', {'clave_pac': '{{  $paciente->clave_pac }}', 'todas': '{{ $todas[0] }}'});">
                          	Mostrar {{$todas[1]}}
                      	</button>
                      </div> 
                    </div>
                </div>

                <div class="row" id="resultadosContainer" name="resultadosContainer">
                	<div class="txtSepVertical txtAltura10px"></div>

                	<table style="font-size: 12px; width: 98%; margin:auto;" class="table table-bordered table-hover">
                	  <tr>
						<th style="text-align: center;">FECHA</th>
						<th style="text-align: center;">DIAGNOSTICO</th>
						<th style="text-align: center;">TIPO DE NOTA</th>
						<th style="text-align: center;">ESTADO SALUD</th>
						<th style="text-align: center;">OPCIONES</th>						
					  </tr>
				<?php foreach($notas as $reg){	
		 		
		 		echo '<tr class="tr_notas_find" data-folio="'.$reg->folio.'" data-centro_sal="'.$reg->centro_sal.'">		 			
		 			<td style="text-align: center; width: 100px;">'.utf8_decode($reg->fecha).'</td>
		 			<td style="text-align: justify;">'.utf8_decode($reg->diagnosticos).'</td>
		 			<td style="text-align: center; width: 150px;">'.utf8_decode($reg->titulonota).'</td>
		 			<td style="text-align: center; width: 150px;">'.utf8_decode($reg->estadosalud).'</td>
		 			
					<td style="text-align: center; width: 100px;" data-esopciones="1"> 
						<span class="fa fa-file-pdf-o" aria-hidden="true" style="cursor: pointer;" id="cmd_get_nota" name="cmd_get_nota" data-folio="'.$reg->folio.'" data-centro_sal="'.$reg->centro_sal.'" title="Nota Médica"></span> &nbsp			
            <span class="fa fa-file-text-o" aria-hidden="true" style="cursor: pointer;" id="cmd_get_indicaciones" name="cmd_get_indicaciones" data-folio="'.$reg->folio.'" data-centro_sal="'.$reg->centro_sal.'" title="Indicaciones"></span>  	
					</td>

		 			</tr>';
		 		}  ?>
                	
                </div>

              </div>

            </div><!-- Fin de HojaFrontal -->


            