<% include ../partials/header %>

<!--NAVIGATION BAR FOR ADMIN-->


<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm"
    crossorigin="anonymous">
    <link rel="stylesheet" href="/stylesheet/app.css">
  <style>
    img {
      width: 100%;
    }
  </style>
  <title>Admindek</title>
</head>

<body>
  <div class="container">
    <div class="row justify-content-center">
      <div class="col-md-7">
        <div class="card transparent-container ">
          <div class="card-header text-center login-card-header">
            <h4 class="h3-login login-h4">Create a New Assignment</h4>
            <hr class="hr-login">
        <form action="/upload/<%=cl_id%>/<%=u_id%>" method="POST" enctype="multipart/form-data">
            <div class="form-group">
                <label class="form-control-label"><b>Instructions</b></label>
                <textarea name="class[inst]" cols="30" rows="10" class="form-control"></textarea>
              </div>
          <div class="custom-file mb-3">
            <input type="file" name="class[file]" id="file" class="custom-file-input">
            <label for="file" class="custom-file-label">Choose File</label>
          </div>
          <input type="submit" value="Submit" class="addc-btn">
        </form>
        <hr>
        <% if(files){ %>
            <% files.forEach(function(file) { %>
              <div class="card transparent-container card-body mb-3">
                <% if(file.isImage) { %>
                  <img src="image/<%= file.filename %>" alt="">
                  <% } else { %>
                    <%= file.filename %>
                      <% } %>
                        <form method="POST" action="/files/<%= file._id %>?_method=DELETE">
                          <button class="addc-btn">Delete</button>
                        </form>
              </div>
              <% }) %>
                <% } else { %>
                  <p>No files to show</p>
                  <% } %>
      </div>
    </div>
  </div>
</div>
</div>

  <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN"
    crossorigin="anonymous"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q"
    crossorigin="anonymous"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl"
    crossorigin="anonymous"></script>
    <script src="https://cdn.ckeditor.com/4.9.2/standard/ckeditor.js"></script>
<script>
  CKEDITOR.replace('class[inst]');
</script>

</body>
</html>
<% include ../partials/footer %>