{% extends 'base.html' %}
{% block content%}

<div class="container">
    <div class="row justify-content-center">
      <div class="col-md-6 mt-5">
        <div class="card">
          <div class="card-header bg-primary text-white">Add Book</div>
          <div class="card-body">
            <form method="post" action="{% url 'book-new' %}" enctype="multipart/form-data">
              {% csrf_token %}
              <div class="mb-3">
                <label for="id_title" class="form-label">Book Title</label>
                <input type="text" name="title" id="id_title" placeholder="Book Title" class="form-control" required>
              </div>
              <div class="mb-3">
                <label for="id_category">Category:</label>
                <select name="category" id="id_category" class="form-control" required>
                  {% for category in category %}
                    <option value="{{ category.id }}">{{ category.name }}</option>
                  {% endfor %}
                </select>
              </div>
              <div class="mb-3">
                <label for="id_author" class="form-label">Author</label>
                <input type="text" name="author" id="id_author" placeholder="Author" class="form-control" required>
              </div>
              <div class="mb-3">
                <label for="id_publisher" class="form-label">Publisher</label>
                <input type="text" name="publisher" id="id_publisher" placeholder="Publisher" class="form-control" required>
              </div>
              <div class="mb-3">
                <label for="id_date_publish">Date Publish:</label>
                <input type="number" name="date_publish" id="id_date_publish" class="form-control" required>
              </div>
              <div class="mb-3">
                <label for="id_image">Input Image</label>
                <input type="file" name="image" id="id_image" class="form-control" required>
              </div>
              <div class="mb-3">
                <label for="id_isbn" class="form-label">ISBN</label>
                <input type="text" name="isbn" id="id_isbn" placeholder="ISBN" class="form-control" required>
              </div>
              <button type="submit" class="btn btn-primary" role="button">Add</button>
              <a class="btn btn-warning col-2 mx-2" href="{% url 'book-list' %}"" role="button">Back</a>
            </form>
          </div>
        </div>
      </div>
    </div>
</div>


{% endblock content%}