@extends('layouts.app')

@section('content')
<section class="page-header row">
	<h2> {{ $pageTitle }}</h2>
	<ol class="breadcrumb">
		<li><a href="{{ url('') }}"> Dashboard </a></li>
		<li class="active"> {{ $pageTitle }} </li>		
	</ol>
</section>
<div class="page-content row">
	<div class="page-content-wrapper no-margin">
	<h3 class="section-title"> All Tables</h3>
		<div class="sbox">
			<div class="sbox-title toolbar-top">
				
				<div class="sbox-tools">
					<a href="{{ url('central/tables/tableconfig/')}}" class="btn btn-sm  linkConfig btn-primary tips1" title="New Table "><i class="fa fa-plus"></i> Create New Table  </a>
					<a href="{{ url('central/tables/mysqleditor/')}}" class="btn btn-sm linkConfig btn-success tips1" title="MySQL Editor" style="color: #ffffff"><i class="fa fa-pencil"></i> MySQL Editor  </a>	
				</div>				
			</div>
			<div class="sbox-content">
		<div class="row">

					
			<div class="col-md-3">

				<div class="table-scroll m-t" style="height: 450px;     overflow-y: scroll !important;">
				{!! Form::open(array('url'=>'central/tables/tableremove/', 'class'=>'form-horizontal ','id'=>'removeTable' )) !!}
				<div class="m-t" style="height: 450px; " >
					<table class="table table-striped table-hover ">
						<thead>
							<tr>
								
								<th width="30"> <input type="checkbox" class="checkall minimal-green " /></th>
								<th> Table Name </th>
								<th width="50"> Action </th>
							</tr>
						</thead>
						<tbody>
						@foreach($tables as $table)
							<tr>
								<td><input type="checkbox" class="ids  minimal-green" name="id[]" value="{{ $table }}" /> </td>
								<td><a href="{{ URL::TO('central/tables/tableconfig/'.$table)}}" class="linkConfig" > {{ $table }}</a></td>
								<td>
								<a href="javascript:void(0)" onclick="droptable()" class="btn btn-xs btn-danger"><i class="fa fa-trash-o"></i></a>
								</td>
							</tr>
						@endforeach
						</tbody>
					
					</table>
				
				</div>
				{!! Form::close() !!}
				</div>		
			</div>
			<div class="col-md-9">
				
				<div class="tableconfig" style=" padding:10px; min-height:550px; ">

				</div>

			</div>

		</div>
    </div>


			</div>
		</div>
	</div>
</div>
 <script type="text/javascript" src="{{ asset('enadmin/js/simpleclone.js') }}"></script>

<script type="text/javascript">
$(document).ready(function(){
	jQuery('.table-scroll').scrollbar();
	$('.linkConfig').click(function(){
		$('.ajaxLoading').show();
		var url =  $(this).attr('href');
		$.get( url , function( data ) {
			$( ".tableconfig" ).html( data );
			$('.ajaxLoading').hide();
			
			
		});
		return false;
	});
});

function droptable()
{
	if(confirm('are you sure remove selected table(s) ?'))
	{
		$('#removeTable').submit();
	} else {
		return false;
	}
}

</script>
@endsection