@extends('layouts.master')

@section('Title')
    Restaurants 
@endsection


@section('content')
<div class="content-header" style="display: flex;">

    <div class="container-fluid" style="display: flex;">
        <div class="toggle">
            <a class="nav-link togg" data-widget=""   id="cll" onclick="CloseNav();">
                <i class="fas fa-bars"></i>
                <span class="sr-only">Toggle navigation</span>
            </a>
            <a class="nav-link togg" data-widget="" id="open" onclick="openNav();">
                <i class="fas fa-bars"></i>
                <span class="sr-only">Toggle navigation</span>
            </a>
        </div>
        <div style="padding: auto 0px;">
					<h1 class="m-0 text-dark">Restaurants</h1> 
          <p style="color: grey;">Manage all restaurants</p>
        </div>
    </div>
    <div style="margin-left: auto;display: flex; align-items: center;">
      <div class="searchicon">
          <i class="fas fa-search" style="color: #8141a1;margin: auto ;"></i>
        </div>
        <div>
        <input id="myInput"  class="search" type="text" placeholder="Search.." style="border: none; ">
        </div>
      <div class="bell">
        <i class="fas fa-bell" style="margin: auto ;"></i>
      </div>
        <div class="imglogo">
            <img src="{{ asset('/img/purple_logo.png') }}" style="margin:auto;width: 100%;height: 100%;">
        </div>
    </div>       
</div>

  <div class="alert alert-success alert-dismissible fade show" id="success-alert">
    <button type="button" class="close" data-dismiss="alert">&times;</button>
     Jay Swaminarayan
    </div>  

<script>
$("#success-alert").fadeTo(20000000000, 500).slideUp(500, function(){
    $("#success-alert").slideUp(500);
});
</script>
<div class="container-fluid">
         <!-- Small boxes (Stat box) -->
<div class="row">
  <div class="col-12">
    <div class="card">
      <div class="card-header">
        <h1 class="card-title mt-1">List of Restaurants</h1>
        <div class="card-tools">
          <a href="{{route('admin.restaurant.create')}}">
          <button type="button" class="btn btn-block  btn-sm" style="background: #8141a1;color: white;">Add  Restaurant</button>
          </a>
        </div>
      </div>
      <!-- /.card-header -->
      <div class="card-body">
        <table id="table-data" class="table table-bordered table-striped">
          <thead>
            <tr>
              <th>ID</th>
              <th>Image</th>
              <th>Restaurant</th>
              <th>Owner Name</th>
              <th>Active</th>
              <th colspan="2">Action</th>
              
            </tr>
          </thead>
          
          <tbody id="myTable">
          @foreach($restaurants as $restaurant)
                        <tr>
              <td>#{{$restaurant->id}}</td>
              <td><img src="{{asset('/upload/'.$restaurant->image)}}"  class="imglist1"/> </td>
              <td>{{$restaurant->name}}</td>
              <td>{{$restaurant->uname}}</td>
              <td class="text-center">
              <span class="badge badge-pill " style="background:#7dd3f6">Active</span>
                              </td>
              <td>
                <a href="restaurant/edit/{{$restaurant->id}}">
                  <button type="button" class="btn" style="background-color: #8141a1;">
                  <i class="fas fa-pencil-alt" style="color: white;"></i>
                  </button>
                </a>
                </td>
                <td>
                <a  onclick="return confirm('Are you sure?')" href="restaurant/delete/{{$restaurant->id}}">
                  <button type="button" class="btn" style="background-color: #8141a1;" >
                  <i class="fas fa-trash" style="color: white;"></i>
                  </button>
                </a>
              </td>
            </tr>
            
                      
           @endforeach
          </tbody>
          <tfoot>
            <tr>
            <th>ID</th>
              <th>Image</th>
              <th>Restaurant</th>
              <th>Owner Name</th>
              <th>Active</th>
              <th colspan="2">Action</th>
              
            </tr>
          </tfoot>
        </table>
      </div>
      <!-- /.card-body -->
    </div>
    <!-- /.card -->
  </div>
  <!-- ./col -->
</div>
<!-- /.row -->
                </div>
            </div>


<!-- /.row -->
@endsection


@section('scripts')

@endsection