@extends('layouts.app')

@section('content')
{{--*/ usort($tableGrid, "SiteHelpers::_sort") /*--}}
<div id="loading-indicator" style="display:none; position:fixed; top:0; left:0; width:100%; height:100%; background:rgba(255,255,255,0.7); z-index:9999; text-align:center;">
	<div style="position:absolute; top:50%; left:50%; transform:translate(-50%,-50%);">
		<div class="spinner-border text-primary" role="status">
			<span class="sr-only">Loading...</span>
		</div>
		<div class="mt-2">Loading data, please wait...</div>
	</div>
</div>

<div class="page-titles mb-4">
	<h2 class="h4 font-weight-bold text-primary"> {{ $pageTitle }} <small class="text-muted"> {{ $pageNote }} </small></h2>
</div>
<div class="card shadow rounded">
	<div class="card-body">
		<div class="toolbar-nav mb-3">
			<div class="row align-items-center">
				<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-tasks"></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="dropdown-item">
									<i class="fa fa-file-excel-o text-success"></i> Export CSV
								</a>
							</li>	
						@endif
								</ul>
						</div>	
				</div>    
			</div>
		</div>

@push('scripts')
<script>
document.addEventListener("DOMContentLoaded", function() {
	// Show loading indicator on page load
	document.getElementById('loading-indicator').style.display = 'block';
	window.onload = function() {
		document.getElementById('loading-indicator').style.display = 'none';
	};
});
</script>
@endpush

		{!! Form::open(['url'=>'reportmututeburayon/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" id="freeze-header-table">
				<thead class="thead-light" style="position: sticky; top: 0; z-index: 2; background: #f8f9fa;">
					<tr>
						<th class="number"> No </th>			
						@foreach ($tableGrid as $t)
							@if($t['view'] =='1')
								<th>{{ $t['label'] }}</th>
							@endif
						@endforeach
					</tr>
				</thead>
				<tbody>
					@foreach ($rowData as $row)
						<tr>
							<td width="30"> {{ ++$i }} </td>	
							@foreach ($tableGrid as $field)
								@if($field['view'] =='1')
									<?php $limited = isset($field['limited']) ? $field['limited'] :''; ?>
									@if(SiteHelpers::filterColumn($limited ))
										<td>
											@php
												$value = SiteHelpers::formatRows($row->{$field['field']}, $field, $row);
											@endphp
											@if(is_numeric(strip_tags($value)))
												{{ number_format((float)strip_tags($value), 2) }}
											@else
												{!! $value !!}
											@endif
										</td>
									@endif	
								@endif					 
							@endforeach				 
						</tr>
					@endforeach
				</tbody>
			</table>
			<input type="hidden" name="md" value="" />
		</div>
		{!! Form::close() !!}
		@include('footer')
	</div>  
</div>
@stop
