@include('header')
@include('navegador')
<input type="hidden" name="token" id="token" value="{{csrf_token()}}">
<link href="{{asset('components/datatables/media/css/jquery.dataTables.min.css')}}" rel="stylesheet">
<div class="col-md-12">
<h3 class="text-center"> Configuración Score  V2 </h3>
<h5 class="text-left"> Configurar Nuevo Killer </h5>
<form action="score_submit" method="post" accept-charset="utf-8">

	<div class="col-md-2">
		<label for="cant_desde">Grupos</label>
		<select class="form-control" id="grupos" name="grupos">
			<option value="">- Seleccione Grupo -</option>
			@foreach($grupos as $key => $grupo)
			<option value="{{$grupo->id_grupo}}">{{str_replace('_',' ',$grupo->nombre_grupo)}}</option>
			@endforeach
		</select>
	</div>
	<div class="col-md-2">
		<label for="cant_desde">Items</label>
		<select class="form-control" id="items" name="items" disabled>
			<option value="">- Seleccione Item -</option>
		</select>
	</div>
	<div class="col-md-2">
			<label for="cant_desde">Cantidad Desde</label>
			<input type="text" class="form-control" name="cant_desde">
	</div>
	<div class="col-md-2">
			<label for="cant_hasta">Cantidad Hasta</label>
			<input type="text" class="form-control" name="cant_hasta">
	</div>
	<div class="col-md-1">
			<label for="dias_desde">Dias Desde</label>
			<input type="text" class="form-control" name="dias_desde">
	</div>
	<div class="col-md-1">
			<label for="dias_hasta">Dias Hasta</label>
			<input type="text" class="form-control" name="dias_hasta">
	</div>
	<div class="col-md-2">
			<label for="valor">Valor ≥</label>
			<input type="text" class="form-control" name="valor">
	</div>
	<div class="col-md-2">
			<input type="submit" class="btn btn-fidelitas" name="btn_submit"  value="Guardar">
	</div>

</form>
</div>
<div class="col-md-12">
	<table class="table">
		<caption>Killers Configurados</caption>
		<thead>
			<tr>
				<th>Grupo</th>
				<th>Item</th>
				<th>Cantidad Desde</th>
				<th>Cantidad Hasta</th>
				<th>Desde</th>
				<th>Hasta</th>
				<th>Valor ≥</th>
				<th>Fecha Creación</th>
			</tr>
		</thead>
		<tbody>
		@foreach($configuracion_personalizada as $killer)
			<tr>
				<td>{{str_replace('_',' ',$killer->nombre_grupo)}}</td>
				<td>{{str_replace('_',' ',$killer->item)}}</td>
				@if($killer->cant_desde == NULL) 
				<td> 1 o más Items</td> 
				@else
				<td>{{number_format($killer->cant_desde,2,',','.')}}</td>				
				@endif
				@if($killer->cant_desde == NULL and $killer->cant_hasta == NULL)
				<td> - </td> 
				@else
					<td>{{number_format($killer->cant_hasta,2,',','.')}}</td>
				@endif 
				@if($killer->dias_desde == NULL)
				<td> - </td>
				@else
				<td>{{$killer->dias_desde}} días</td>
				@endif
				@if($killer->dias_hasta == NULL)
				<td> - </td>
				@else
				<td>{{$killer->dias_hasta}} días</td>
				@endif
				<td>{{$killer->valor}}</td>
				<td>{{$killer->created}}</td>
			</tr>
		@endforeach
		</tbody>
	</table>
	</div>
<script type="text/javascript" src="{{ URL::asset('components/datatables/media/js/jquery.dataTables.min.js') }}"> </script>
<script type="text/javascript" src="{{ URL::asset('js/Api/scorev2.js') }}"> </script>

@include('footer')