{% extends "layout.html" %}
{% block body %}
    <!-- Page Header -->
    <header class="masthead" style="background-image: url('{{ url_for('static', filename='img/home-bg.jpg') }}')">
      <div class="overlay"></div>
      <div class="container">
        <div class="row">
          <div class="col-lg-8 col-md-10 mx-auto">
            <div class="site-heading">
              <h1>Admin Panel</h1>
              <span class="subheading">Manage your posts and change them</span>
            </div>
          </div>
        </div>
      </div>
    </header>

    <!-- Main Content -->
    <div class="container">
      <div class="row">
        <div class="col-lg-8 col-md-10 mx-auto">
          <h1>Basic Actions</h1>
          
           <a href="/edit/0">  <button class="btn btn-primary"> Add a new post</button></a>
           <a href="/logout">  <button class="btn btn-primary"> Logout</button></a>
<hr>
          <h1>Upload A File</h1>
          
            <form action="/uploader" method="post" enctype="multipart/form-data">
              
<input type="file" name="file1">
<button type="submit" class="btn btn-primary">Submit</button>

            </form>
          <hr>
<h1>Edit Posts</h1>
<table class="table">
    <thead>
      <tr>
        <th>Sno</th>
        <th>Title</th>
        <th>Date</th>
        <th>Edit</th>
        <th>Delete</th>
      </tr>
    </thead>
    <tbody>


      {% for post in posts %}
      <tr>
        <td>{{post.sno}}</td>
        <td>{{post.title}}</td>
        <td>{{post.date}}</td>
        <td><a href="/edit/{{post.sno}}"><button class="btn btn-primary" >Edit</button></a></td>
        <td><a href="/delete/{{post.sno}}"><button class="btn btn-primary">Delete</button></a></td>
      </tr>
      

      {% endfor %}





    </tbody>
  </table>


      
        </div>
      </div>
    </div>
    {% endblock %}