@extends('Admin.master_page')


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

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

@section('content')

<div class="table-responsive"> 

 	<br>
 	<table class="table">
 	 <thead>
 	  <tr>
 	   <th class="border-b-2 whitespace-nowrap">#</th>
 	    <th class="border-b-2 whitespace-nowrap">Title</th>
 	     <th class="border-b-2 whitespace-nowrap">Message</th>
 	      <th class="border-b-2 whitespace-nowrap">Date</th>
 	      <th class="border-b-2 whitespace-nowrap">Action</th>
 	       </tr>
 	        </thead> 
 	        <tbody>
 	        @forelse($announces as $data)		
 	         <tr>
 	          <td class="border-b">{{ $data->id }}</td>
 	           <td class="border-b">{{ $data->title }}</td>
 	            <td class="border-b">{{ $data->message }}</td>
 	             <td class="border-b">{{ $data->date }}</td> 
 	            
				  <td>
					<form action="{{ route('announces.destroy', $data->id) }}" method="post"
						id="form-{{ $data->id }}">
						{{ csrf_field() }}
						{{ method_field('DELETE') }}
					</form>

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

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


 	                 </tbody> 
 	             </table> 

 	             

 	         </div> 



@endsection