@extends('backend.layouts.master')

@section('title', 'Bank')

@push('css')

@endpush

@section('content')
	<div class="right_col" role="main">
        <div class="">
            <div class="clearfix"></div>
            @if(Session::has('success'))
                <div class="alert alert-success">
                    {{ Session::get('success') }}
                </div>
            @endif
            @if(Session::has('error'))
                <div class="alert alert-danger">
                    {{ Session::get('error') }}
                </div>
            @endif
            <div class="row">
                <div class="col-md-12 col-sm-12 col-xs-12">
                    <div class="x_panel">
                        <div class="x_title">
                            <h2>
								Bank Transaction Management
								<a href="{{route('transaction.create')}}" class="btn btn-xs btn-success">Transaction Entry</a>
							</h2>
                            <ul class="nav navbar-right panel_toolbox">
                                <li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
                                </li>
                                <li class="dropdown">
                                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button"
                                       aria-expanded="false"><i class="fa fa-wrench"></i></a>
                                    <ul class="dropdown-menu" role="menu">
                                        <li><a href="#">Settings 1</a>
                                        </li>
                                        <li><a href="#">Settings 2</a>
                                        </li>
                                    </ul>
                                </li>
                                <li><a class="close-link"><i class="fa fa-close"></i></a>
                                </li>
                            </ul>
                            <div class="clearfix"></div>
                        </div>
                        <div class="x_content">
							<div class="row search-section">
								<form action="{{route('transaction.list')}}" id="searchForm" method="Get">
									<div class="col-sm-2">
										<select class="form-control" name="show" id="show">
											<option value="{{$banks->count()}}">{{$banks->count()}}</option>
											<option value="10">10</option>
											<option value="25">25</option>
											<option value="50">50</option>
											<option value="100">100</option>
											<option value="250">250</option>
											<option value="500">500</option>
										</select>
									</div>
									<div class="col-sm-5"></div>
									<div class="col-sm-5">
										<div class="input-group">
											<input type="text" id="myInput" class="form-control" placeholder="Search">
											<span class="input-group-btn">
												<button type="button" class="btn btn-purple btn-sm">
												<span class="ace-icon fa fa-search icon-on-right bigger-110"></span></button>
											</span>
										</div>
									</div>
								</form> 
							</div>
							<div class="table-responsive">
								<table id="" class="table table-bordered condensed" role="grid" aria-describedby="dynamic-table_info">
									<thead>
										<tr>
											<th>SL</th>
											<th>Tr.Date</th>
											<th>Bank Name</th>
											<th>Account No</th>
											<th>Cheque No</th>
											<th>Status</th>
											<th>Tr. Amount</th>
											<!--<th>Action</th>-->
										</tr>
									</thead>
									<tbody>
										@foreach($banks as $key=>$bran)
											<tr>
												<td>{{$key + 1}}</td>
												<td>{{date('d-m-Y',strtotime($bran->transaction_date))}}</td>
												<td><a href="{{route('transaction.show',$bran->bank_id)}}">{{$bran->bank->bank_name}}</a></td>
												<td>{{$bran->account_no}}</td>
												<td>{{$bran->cheque_no}}</td>
												<td>{{$bran->transaction_status}}</td>
												<td>{{$bran->transaction_amount}}</td>
												<!--<td>
												@can('bank-transaction-edit')
													<a  href="{{route('transaction.edit',$bran->id)}}" title="Edit Bank Transaction Information"><i class="ace-icon fa fa-edit bigger-130"></i></a>
												@endcan
												@can('bank-transaction-delete')
													<a  class="red" href="#" data-toggle="tooltip" title="Delete Bank Transaction Information!" onclick="deleteCategory({{ $bran->id }})"><i class="fa fa-trash-o bigger-130" ></i></a>
													<form id="delete-form-{{ $bran->id }}" action="{{ route('transaction.destroy',$bran->id) }}" method="POST" style="display: none;">
														@csrf
														@method('DELETE')
													</form> 
												@endcan
												</td>-->
											</tr>
										@endforeach
									</tbody>
								</table>
								<div class="text-center">
									{{$banks->links()}}
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
@endsection

@push('js')
<script>
	$(document).ready(function(){
		
	})
	
	function deleteCategory(id) {
		var conf = confirm('Do you want to really Delete?');
		  if(conf == true)
		  {
			document.getElementById('delete-form-'+id).submit();
		  }
        }
	</script>
@endpush									