@extends('layouts.app')

@section('content')
{{--*/ usort($tableGrid, "SiteHelpers::_sort") /*--}}
<div class="page-titles">
  <h2> {{ $pageTitle }} <small> {{ $pageNote }} </small></h2>
</div>
<div  class="card">
	<div class="card-body">
		<div class="toolbar-nav">
			<div class="row">
				<div class="col-md-6">
					<div class="btn-group">
						<button type="button" class="btn dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><i class="fa fa-bars"></i> Bulk Action </button>
				        <ul class="dropdown-menu">
				         @if($access['is_excel'] ==1)
							<li class="nav-item"><a href="{{ url( $pageModule .'/export?do=excel&return='.$return) }}" class="nav-link"> Export CSV </a></li>	
						@endif
				        </ul>
				    </div>	
				</div>    
				<div class="col-md-6 text-right">
				{!! Form::open(['method' => 'GET', 'url' => request()->url(), 'class' => 'form-inline', 'style' => 'display:inline-block;']) !!}
					<div class="form-group">
						<label for="filter_rayon" class="mr-2">Filter Rayon:</label>
						<select name="filter_rayon" id="filter_rayon" class="form-sm-control mr-2">
						</select>
						<button type="submit" class="btn btn-primary btn-sm">Filter</button>
					</div>
				{!! Form::close() !!}
				</div>
			</div>
		<div>
			{!! Form::open(array('url'=>'rekaplkpafd/delete/', 'class'=>'form-horizontal', 'id' =>'SximoTable')) !!}
			<div class="table-responsive" style="height:500px;">
				<table class="table table-hover table-striped table-bordered shadow-sm rounded" style="background-color: #f8fafc;">
					<thead style="position: sticky; top: 0; background: linear-gradient(90deg, #4f8cff 0%, #6fd6ff 100%); color: #fff; z-index: 1;">
						<tr>
							<th class="number" style="vertical-align: middle;">No</th>
							@foreach ($tableGrid as $t)
								@if($t['view'] =='1')
									<th style="vertical-align: middle;">{{ $t['label'] }}</th>
								@endif
							@endforeach
						</tr>
					</thead>
					<tbody>
						@foreach ($rowData as $row)
							<tr style="transition: background 0.2s;" onmouseover="this.style.background='#e3f2fd';" onmouseout="this.style.background='';">
								<td width="30" style="font-weight: bold; color: #4f8cff;">{{ ++$i }}</td>
								@foreach ($tableGrid as $field)
									@if($field['view'] =='1')
										<?php $limited = isset($field['limited']) ? $field['limited'] :''; ?>
										@if(SiteHelpers::filterColumn($limited ))
											<td>
												{!! SiteHelpers::formatRows($row->{$field['field']},$field ,$row ) !!}
											</td>
										@endif
									@endif
								@endforeach
							</tr>
						@endforeach
					</tbody>
				</table>
				<input type="hidden" name="md" value="" />
			</div>
			{!! Form::close() !!}
			<style>
				.table thead th {
					border-bottom: 2px solid #4f8cff;
					text-align: center;
				}
				.table tbody tr {
					background-color: #fff;
				}
				.table tbody tr:nth-child(even) {
					background-color: #f1f8ff;
				}
				.table tbody td {
					vertical-align: middle;
				}
			</style>
		</div>
		
		
		@include('footer')
	</div>  
</div>
<script>
	    $("#filter_rayon").jCombo("{!! url('dataprodisconsole/comboselect?filter=master_rayon:kode_rayon:nama_rayon') !!}",
					{  initial_text : 'Pilih Rayon'});   
	</script>
@stop