@extends('layouts.app')

@section('content')
{{--*/ usort($tableGrid, "SiteHelpers::_sort") /*--}}
<div class="page-titles" style="font-family: 'Segoe UI', 'Roboto', 'Arial', sans-serif;">
  <h2 style="font-size: 2.2rem; font-weight: 600;">{{ $pageTitle }} <small style="font-size: 1.2rem; font-weight: 400;">{{ $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-success 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>
		<div class="table-responsive mt-4">
			{!! Form::open(['url' => 'cekmasterpetak/delete/', 'class' => 'form-horizontal', 'id' => 'SximoTable']) !!}
			<div class="table-responsive" style="overflow-x:auto; max-height: 500px; overflow-y: auto;">
				<table class="table table-bordered table-hover align-middle shadow-sm rounded" style="min-width: 900px;">
					<thead class="thead-light" style="position: sticky; top: 0; z-index: 2; background: #f8f9fa;">
						<tr>
							<th class="number text-center" style="width: 60px; position: sticky; left: 0; background: #f8f9fa; z-index: 3;">No</th>
							@php $colIndex = 1; @endphp
							@foreach ($tableGrid as $t)
								@if($t['view'] == '1')
									<th class="text-nowrap">{{ $t['label'] }}</th>
									@php $colIndex++; @endphp
								@endif
							@endforeach
						</tr>
					</thead>
					<tbody>
						@foreach ($rowData as $row)
							<tr>
								<td class="text-center fw-bold" style="position: sticky; left: 0; background: #fff; z-index: 2;">{{ ++$i }}</td>
								@php $colIndex = 1; @endphp
								@foreach ($tableGrid as $field)
									@if($field['view'] == '1')
										<?php $limited = isset($field['limited']) ? $field['limited'] : ''; ?>
										@if(SiteHelpers::filterColumn($limited))
											<td @if($colIndex >= 6 && $colIndex <= 10) class="text-end" @endif>
												{!! SiteHelpers::formatRows($row->{$field['field']}, $field, $row) !!}
											</td>
											@php $colIndex++; @endphp
										@endif
									@endif
								@endforeach
							</tr>
						@endforeach
					</tbody>
				</table>
			</div>
			<input type="hidden" name="md" value="" />
			{!! Form::close() !!}
		</div>
		
		
		@include('footer')
	</div>  
</div>
@stop