@extends('Admin.master_page')

@section('title') <h5 class="m-0 font-weight-bold text-primary" style="float: left;">Financing List</h5> 

<a href="{{ route('Financing.create') }}" style="float: right;"><i class="fas fa-plus-circle"></i></a>
@endsection

@section('content') 

@if(Session::has('success_message'))
<div class="alert alert-success">{{ Session::get('success_message') }}</div>
@endif


{{-- <div class="col-lg-5">
	<form action="" method="get">
		<div class="input-group">
			<input type="text" name="domain" class="form-control" placeholder="Enter Domain Name">
		</div>
	</form>
</div> --}}


<div class="table-responsive"> 

 	<br>
 	<table class="table">
 	 <thead>
 	  <tr>
 	    <th>Domain Name</th>
 	    <th>From</th>
 	     <th>Term</th>
 	      <th>Action</th>
 	       </tr>
 	        </thead> 
 	        <tbody>
 	        @foreach($financings as $financing)		
 	         <tr>
 	            <td >{{ $financing->domain_sales->name }}</td>
 	            <td >{{ $financing->from }}</td>
 	            <td >{{ $financing->term }}</td>
  	             <td>
			
				  <form action="{{route('Financing.destroy' , $financing->id)}}" method="post" id="form-{{$financing->id}}">
                        {{csrf_field()}}
                        {{method_field("DELETE")}}
                    </form>

                    <a href="{{ route('Financing.edit' , $financing->id) }}" ><i class="fas fa-edit"></i></a>

                    &nbsp;
                                   <a href=""
                       onclick="if(confirm('Are you sure to delete?')) {
                               event.preventDefault();
                               document.getElementById('form-{{$financing->id}}').submit();
                               }else{ event.preventDefault(); }"
                       ><i class="fas fa-trash-alt"></i></a>
   
 	             </td> 
 	            
 	         </tr>
 	         @endforeach


 	                 </tbody> 
 	             </table> 

		
		@if(isset($_GET['search']) and $_GET['search'] != null)
		<br>
		<br>
		<div class="container">
			<div class="row justify-content-center">
			{{ $financings->appends(['search'=>$_GET['search']])->links() }}
		</div>
		</div>

		<br>
		<br>
		<br>
		
		@else
		<br>
		<br>
		<div class="container">
			<div class="row justify-content-center">
			{{ $financings->links() }}
		</div>
		</div>

		<br>
		<br>
		<br>

		@endif
 	          

 	         </div> 


@stop