@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">
							<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>
			<div style="overflow-x:auto; overflow-y:auto; max-height:500px;">
				{!! Form::open(['url' => 'reportmorfologipetak/delete/', 'class' => 'form-horizontal', 'id' => 'SximoTable']) !!}
				<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" style="position: sticky; top: 0; z-index: 2;">
						<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 class="text-center fw-bold" width="30">{{ ++$i }}</td>
								@foreach ($tableGrid as $field)
									@if($field['view'] == '1')
										<?php 
											$limited = isset($field['limited']) ? $field['limited'] : ''; 
											$value = SiteHelpers::formatRows($row->{$field['field']}, $field, $row);
											$containsSaatnya = stripos(strip_tags($value), 'SAATNYA') !== false;
										?>
										@if(SiteHelpers::filterColumn($limited))
											<td @if($containsSaatnya) style="background: #ffe066; color: #d35400; font-weight: bold;" @endif>
												{!! $value !!}
											</td>
										@endif
									@endif
								@endforeach
							</tr>
						@endforeach
					</tbody>
				</table>
				<input type="hidden" name="md" value="" />
				{!! 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