@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 btn-primary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"
							style="background: linear-gradient(90deg,#1e88e5,#42a5f5); border: none; color: #fff; padding: 8px 14px; border-radius: 8px;
								   box-shadow: 0 8px 24px rgba(30,136,229,0.25), 0 2px 6px rgba(66,165,245,0.12);">
							<i class="fa fa-bars" style="margin-right:8px; opacity:0.95;"></i>
							Bulk Action
						</button>
						<ul class="dropdown-menu" style="border-radius:8px; min-width:180px; box-shadow: 0 12px 30px rgba(30,136,229,0.08);">
				         @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>
		<div >
			<div class="col-md-6 text-right">
				{!! Form::open(['method' => 'GET', 'url' => request()->url(), 'class' => 'form-inline justify-content-end', '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-control form-control-sm mr-2">
						</select>
						<button type="submit" class="btn btn-primary btn-sm">Filter</button>
					</div>
				{!! Form::close() !!}
			</div>

		 {!! Form::open(array('url'=>'takdespetakcek/delete/', 'class'=>'form-horizontal' ,'id' =>'SximoTable' )) !!}
		 <div class="table-responsive" style="min-height:300px; max-height:500px; overflow-y:auto;">
		<table class="table table-hover table-striped table-bordered align-middle shadow-sm" style="min-width: 600px;">
			<thead class="thead-dark bg-primary text-white sticky-top">
				<tr>
					<th class="number text-center">No</th>			
					@foreach ($tableGrid as $t)
						@if($t['view'] =='1')
							<th class="text-center">{{ $t['label'] }}</th>
						@endif
					@endforeach
				  </tr>
			</thead>

			<tbody>
							
				@foreach ($rowData as $row)
					<tr>
						<td width="30"> {{ ++$i }} </td>	
					@php $columnIndex = 1; @endphp
					@foreach ($tableGrid as $field)
						 @if($field['view'] =='1')
							<?php $limited = isset($field['limited']) ? $field['limited'] :''; ?>
							@if(SiteHelpers::filterColumn($limited ))
							 <td @if($columnIndex == 21) style="text-align: right !important;" @endif>					 
								{!! SiteHelpers::formatRows($row->{$field['field']},$field ,$row ) !!}						 
							 </td>
							 @php $columnIndex++; @endphp
							@endif	
						 @endif					 
					 @endforeach				 
					
					</tr>
					
				@endforeach
				  
			</tbody>
		  
		</table>
		<input type="hidden" name="md" value="" />
		</div>
		{!! Form::close() !!}
		</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