<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">
    <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
    <link rel="stylesheet" href="/css/styles.css" type="text/css">
    <title><%= title %></title>
</head>
<body style="background-color: #f4f4f4;">

  <div class="navbar-fixed " >
    <nav class="turquoise">
      <div class="nav-wrapper  container" >
        <a href="/" class="brand-logo ">Darkroom</a>
        <ul class="right hide-on-med-and-down">
          <li><a href=""></a></li>
          <li><a href=""></a></li>
        </ul>
      </div>
    </nav>
  </div>
    <div class="container">

        <div class="col s12 m7">
            <h2 class="header"><%= image.name %></h2>
            <a href="/"><i class="material-icons ">arrow_back</i></a>
            <div class="card horizontal">
              <div class="card-image">
                <img src="/<%= image.path %>" class="responsive-img" alt="<%= image.name %>">
              </div>
              <div class="card-stacked">
                <div class="card-content">
                    <h3 class="center">Image Information</h3>
                    <table>
                        <tbody>
                          <tr>
                            <td>Name:</td>
                            <td><%= image.name %></td>
                          </tr>
                          <tr>
                            <% if(image.size < 1000000 ){ %>
                              <td>Size:</td>
                              <td><%= image.size/1000 %> Kb</td>
                            <% } else { %>
                              <td>Size:</td>
                              <td><%= image.size %></td>
                            <% } %>
                          </tr>
                          <tr>
                            <td>Date Uploaded:</td>
                            <td><%= image.date %></td>
                          </tr>
                        </tbody>
                      </table>
                </div>
                <div class="card-action">
                    <a class="waves-effect waves-light btn modal-trigger" href="#modal1"><i class="material-icons left">update</i>Update Image Information</a>
                    <a class="waves-effect waves-light btn red right" id="delete" data-id="<%= image._id %>"><i class="material-icons left">delete</i>Delete Image</a>
                  <!-- Modal Body -->
                  <div id="modal1" class="modal">
                      <div class="modal-content">
                      <h4>Update Image Information: </h4>
                      <div class="col s6">
                          <form action="/image/<%= image._id %>" method="" data-id="<%= image.id %>" class="">
                      <div class="row">
                        <div class="input-field col s12">
                            <input id="_id" type="text"  value="<%= image.name %>">
                            <label for="image_title">Image Name</label>
                        </div>
                        <div class="input-field col s12">
                        <button type="submit"  class="waves-effect waves-light btn-large">Update</button>
                        </div>
                          
                      </div>	
                      </form>
                      </div>
                      </div>
                  </div> 
                </div>
              </div>
            </div>
          </div>
        
    </div>
    
    <script src="https://code.jquery.com/jquery-3.5.1.min.js" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script>
    <script src="/javascript/single.js"></script>
    
    <script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
</body>
</html>