<!DOCTYPE html>
<html lang="en">
  <head>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" type="text/css" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css">
     <!-- <link rel="stylesheet" type="text/css" href="app.css"> -->
    <link rel="stylesheet" type="text/css" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<style>
        /* body{
        background: url(https://images.unsplash.com/photo-1486286701208-1d58e9338013?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=750&q=80);
        background-size: cover;
        background-position: center;
        background-attachment: fixed;
        } */
        .h1{
          margin: 50px 50px 50px 250px;
          
        }

        .card{
          margin: 25px 0px;
        }


        .fa-times-circle{
          font-size: 40px;
          padding-left: 0;
          padding-right: 0;
        }
        .form-inline{
              /* margin: 10px 50px 10px 750px;
              padding: 6px 0; */
              
              float: right;
            }

    </style>

    <title>Booking Requests</title>
  
  </head>
  
<body>
    <nav class="navbar navbar-expand-lg navbar-light bg-light">
      
      <div class="container">
        
        <a class="navbar-brand" href="{% url 'resources' %}">Sports Resources</a>
        <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
        <span class="navbar-toggler-icon"></span>
        </button>

          <div class="collapse navbar-collapse" id="navbarSupportedContent">
            
            <ul class="navbar-nav mr-auto">
              <!-- <li class="nav-item active">
              <a class="nav-link" href="#">Home </a>
              </li> -->
              <li class="nav-item">
                <a class="nav-link" href="{% url 'about' %}">About</a>
              </li>
      
              <li class="nav-item">
                <a class="nav-link" href="{% url 'bookingHistory' %}">Booking History</a>
              </li>
      
              <li class="nav-item active">
                <a class="nav-link" href="{% url 'bookingRequests' %}">Booking Requests</a>
              </li>

      
              <li class="nav-item">
                <a class="nav-link" href="{% url 'blockedUsers' %}">Blocked Users</a>
              </li>

              <li class="nav-item">
                <a class="nav-link" href="{% url 'timetable' %}">timetable</a>
              </li>
      
            </ul>
            <ul class="nav navbar-nav navbar-right">
            
              <!--<li class="nav-item"><a class="nav-link" href ="{% url 'logout' %}">Logout</a></li>-->
              <div class="bs-example">
              <div class="btn-group-vertical">
                  <div class="btn-group">
                      <button id="butn-1" type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown">Account</button>
                      <div class="dropdown-menu">
                          <a href="{% url 'updatePassword' %}" class="dropdown-item">Change Password</a>
                          <a href="{% url 'logout' %}" class="dropdown-item">Logout</a>
                      </div>
                  </div>
              <!-- <li class="nav-item"><a class="nav-link"href ="#">Login <i class="fa fa-user-plus" aria-hidden="true"></i></a></li> -->
            
             </ul>
            
          </div>

      </div> 
  
    </nav>

    
    <div class="container">            
    <h1 class="mt-4 pt-4">Booking Requests</h1>
    <div>
      <form class="form-inline my-2 my-lg-0" method="GET" action="{%url 'bookingRequests'%}">
      <input class="form-control mr-sm-2" type="search" placeholder="Search" aria-label="Search" name="search" >
      <button class="btn btn-outline-success my-2 my-sm-0" type='submit'>Search</button>
      </form>
      </div>
    <br>
    {% for i in data %}
    <div class="card bg-light">
      <div class="card-body">

        <i class="btn fa fa-times-circle pull-right text-danger" aria-hidden="true" onclick=reject({{i.user_id}})></i>
        <button class="btn btn-primary pull-right" style="border-radius: 20px; height: 40px; margin-top: 6px;" onclick=accept({{i.user_id}})>Accept <span class="fa fa-check" aria-hidden="true" ></span></button>
        <div class="h3 d-inline">{{ i.resource_name }}</div>
        <div class="small">{{i.user_id}}-{{i.name}}</div>
        <div class="smal">{{i.reservation_time }}</div>
      
      </div>
    </div> 
    {% endfor %} 
    </div>
    <!--<button class="btn btn-primary pull-right" style="border-radius: 20px; height: 40px; margin-top: 6px;">Accept <span class="fa fa-check" aria-hidden="true" onclick=reject({{i.user_id}}></span></button>
        <div class="h3 d-inline">{{i.resource_name}}</div> var time=12+":"+today.getMinutes()+":"+today.getSeconds();-->

    <!-- Bootstrap JS -->
        <script>
          function reject(id){
            $.ajax({
              type:"GET",
              data:{'id':id},
              url:"{{'/sports/reject'}}",
              success:function(data){
                location.reload()
              }
            });
          }
        </script>
        <script>
          function accept(id){
            $.ajax({
              type:"GET",
              data:{'id':id},
              url:"{{'/sports/accept'}}",
              success:function(data){
                location.reload()
              }
            });
          }
        </script>
        
        <script
        src="https://code.jquery.com/jquery-3.5.1.min.js"
        integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0="
        crossorigin="anonymous"></script>
      <script type="text/javascript" src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js"></script>
      <script src="bootstrap/js/bootstrap.min.js"></script>
  </body>
</html>
