@include('header')
@include('navigator_no_cuit')

<div class="modal fade" id="modalFuentes" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"
    data-backdrop="static">
    <div class="modal-dialog modal-lg" role="document">
        <div class="modal-content">
            @include('modals/modal_fuentes_procesadas')
        </div>
    </div>
</div>


<div class="container">
    <h3 class="text-center heading-block "> Panel De Fuentes </h3>
    <div class="col-md-9" style="padding-bottom:15px;"></div>
    <div class="col-md-3" style="padding-bottom:15px;">
        <button id="btn_alta_fuentes" type="button" class="btn col-md-12 btn-info btn-fidelitas text-center"
            data-toggle="modal" data-target="#modalFuentes">
            Alta Nueva Fuente
        </button>
    </div>
    <div class="col-md-12">
        <table class="table table-hover" id="tabla_fuente_descripciones">
            <thead>
                <tr>
                    <th class=hidden></th>
                    <th class="text-left">Fuente</th>
                    <th class="text-center">Descripcion</th>
                    <th>Última Fecha de datos</th>
                    <th class="hidden">Fecha de carga</th>
                    <th>Última Fecha de carga</th>
                    <th>Periodicidad</th>
                    <th>Proveedor</th>
                    <th class=hidden>Campos</th>
                    <th class=hidden></th>
                    <th class="text-center">Secciones Informe</th>
                    <th class=hidden></th>
                    <th>Estado</th>
                    <th class="no-sort"></th>
                </tr>
            </thead>
            <tbody>
                @foreach($fuentes as $fuente)
                    <tr valign="top">
                        <td class="text-left hidden id_fuente_descripcion">{{$fuente->id_fuente_descripcion}}</td>
                        <td class="text-left nombre">{{$fuente->nombre}}</td>
                        <td class="text-left descripcion">{{$fuente->descripcion}}</td>
                        <td class="text-center fecha_informacion">{{$fuente->fecha_informacion}}</td>
                        <td class="hidden fecha_carga">{{$fuente->fecha_carga}}</td>
                        <td class="text-center fecha_informacion">{{$fuente->fecha_carga_dmy}}</td>
                        <td class="text-center periodicidad">{{$fuente->periodicidad}}</td>
                        <td class="text-center proveedor">{{$fuente->proveedor}}</td>
                        <td class="text-left hidden campos_mostrar">{!! $fuente->campos_mostrar !!}</td>
                        <td class="text-left hidden campos">{{ $fuente->campos }}</td>
                        <td class="text-center secciones_mostrar">{!! $fuente->secciones_mostrar !!}</td>
                        <td class="text-center hidden secciones">{{$fuente->secciones}}</td>
                        <td
                            class="text-center alert @if($fuente->estado == 0) alert-info @endif @if($fuente->estado == 1) alert-success @endif @if($fuente->estado == 2) alert-warning @endif  @if($fuente->estado == 3) alert-danger @endif ">
                            {{$fuente->estado_texto}}</td>
                        <td>
                            <button id="modificar_{{$fuente->id_fuente_descripcion}}" type="button"
                                class="btn btn-info btn-fidelitas text-center" data-toggle="modal"
                                data-target="#modalFuentes">
                                Modificar
                            </button>
                        </td>
                    </tr>
                @endforeach
            </tbody>
        </table>
        Con demora: Acaba de terminar el plazo desde el último proceso.
        <br>Con atraso: Ya pasaron más de dos días en que se debería haber procesado un nuevo lote.

    </div>


    <!--div class="container">
	<h3 class="text-center heading-block mtop20"> Alta de Registro de Fuente </h3>
	<div class="col-md-12">
			<form id="alta_fuente_procesada">
			{{ csrf_field()	}}
			<table  class="table table-bordered text-right ">
					<thead>
						<tr>
							<th>Fecha</th>
							<th>Fuente</th>
							<th>Observaciones</th>
						</tr>
					</thead>
					<tbody>
						<tr>
							<td><input type="text" class="form-control" name="fecha_informacion" id="fecha_informacion" data-date-end-date="0d" data-date-start-date="-1y" data-date-format="yyyy-mm-dd" required class="form-control readonly" ></td>
							<td><select class="form-control" name="fuente" >
								@foreach($fuentes_descripciones as $fuente)
								<option value="{{$fuente->nombre}}" selected>{{$fuente->nombre}} ({{$fuente->descripcion}})</option>
								@endforeach
							</select></td>
							<td><textarea class="form-control" name="observaciones" ></textarea></td>
						</tr>
						<tr>
							<td class="text-left" colspan="6"><button type="submit" class="btn btn-info btn-fidelitas">Grabar</button></td>
						</tr>
					</tbody>
				</table>
		</form>
	</div>
</div-->

    <hr class="col-md-12 col-xs-12" style="padding-left:0px;padding-right:0px;border-color:black;">
    <h3 class="text-center heading-block "> Fuentes Procesadas </h3>

    <div class="col-md-12 text-center">
        <form name="buscar_ftes" id="buscar_ftes" method="post" class="form-signin">
            <input type="hidden" name="_token" id="token" value="{{ csrf_token() }}">
            <div class="col-md-5">
                <label>Fuente</label>
                <select name="fuente_con" id="fuente_con" class="form-control">
                    <option value=''>Seleccione la fuente... </option>
                    @foreach ($fuentes_descripciones as $fte)
                        <option value="{{$fte->nombre}}">{{$fte->nombre}}: {{$fte->descripcion}}</option>
                    @endforeach
                </select>

            </div>
            <div class="col-md-2">
                <label>Fecha Desde</label>
                <input name="fecha_desde_con" type="text" id="fecha_desde_con" data-date-format="yyyy-mm-dd"
                    class="form-control readonly text-center" data-date-end-date="0d" data-date-start-date="-1y">
            </div>
            <div class="col-md-2">
                <label>Fecha Hasta</label>
                <input name="fecha_hasta_con" type="text" id="fecha_hasta_con" data-date-format="yyyy-mm-dd"
                    class="form-control readonly text-center" data-date-end-date="0d" data-date-start-date="-1y">
            </div>
            <div class="col-md-2">
                <br>
                <button type="submit" class="btn btn-info btn-fidelitas">Buscar</button>
                <div class="col-md-1"></div>
            </div>
        </form>
    </div>

    <!--hr class="col-md-12 col-xs-12" style="padding-left:0px;padding-right:0px;"-->

    <div class="col-md-12 text-center">
        <img id="loading" src="/images/loading.gif" class="hidden" width="50px">
        <div class="col-md-12 text-center" id="tabla_procesadas">
        </div>
    </div>

</div>

<script type="text/javascript"
    src="{{ URL::asset('js/tablasgenerales/fuentes_procesadas.js') }}?v={{time()}}"> </script>

<script>
    crearDataTable("#tabla_fuente_descripciones");
</script>
@include('footer')