{% extends "base_view.html" %}
{% load staticfiles %}
{% load widget_tweaks %}

{% block title %} meliza-lab : bird colony : add sample {% endblock title%}

{% block css %}
    <link href="{% static 'local/css/bootstrap-datetimepicker.min.css' %}" rel="stylesheet">
{% endblock %}

{% block scripts %}
<script src="{% static 'local/js/moment.min.js' %}"></script>
<script src="{% static 'local/js/bootstrap-datetimepicker.min.js' %}"></script>
<script type="text/javascript">
  $(function () {
  $('#datetimepicker1').datetimepicker({ pickTime: false});
  });
</script>
{% endblock %}


{% block content %}

<div class="panel panel-default">
  <div class="panel-heading">
    <h3 class="panel-title">New sample: {{ animal }}</h3>
  </div>
  <div class="panel-body">
    <form action="" class="form-horizontal" method="post" role="form">
      {% csrf_token %}
      <p><strong>Instructions</strong>: This form is for adding a sample to the
        database. Samples include brains, plucked feathers, blood draws, genomic DNA,
        etc. Enter a source sample if this sample was generated from another
        sample (e.g., by extracting DNA from plucked feathers).</p>

      {% if form.non_field_errors %}
      <div class="alert alert-danger">{{ form.non_field_errors }}</div>
      {% endif %}

      <div class="form-group {% if form.status.errors %}has-error{% endif %}">
        <label for="id_type" class="col-sm-2 control-label">Sample type * </label>
        <div class="col-sm-5">
          {% render_field form.type class+="form-control" %}
        </div>
      </div>

      <div class="form-group {% if form.animal.errors %}has-error{% endif %}">
        <label for="id_source" class="col-sm-2 control-label">Source sample </label>
        <div class="col-sm-5">
          {% render_field form.source class+="form-control" %}
        </div>
      </div>

      <div class="form-group {% if form.location.errors %}has-error{% endif %}">
        <label for="id_location" class="col-sm-2 control-label">Location *</label>
        <div class="col-sm-5">
          {% render_field form.location class+="form-control" %}
        </div>
      </div>

      <div class="form-group {% if form.date.errors %}has-error{% endif %}">
        <label for="id_date" class="col-sm-2 control-label">Collection date </label>
        <div class="col-sm-3">
          <div class="input-group date" id="datetimepicker1">
            {% render_field form.date class+="form-control" data-format="MM/dd/YYYY" %}
            <span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span>
            </span>
          </div>
        </div>
      </div>

      <div class="form-group {% if form.entered_by.errors %}has-error{% endif %}">
        <label for="id_collected_by" class="col-sm-2 control-label">Collected by * </label>
        <div class="col-sm-3">
          {% render_field form.collected_by class+="form-control" %}
        </div>
      </div>

      <div class="form-group {% if form.description.errors %}has-error{% endif %}">
        <label for="id_description" class="col-sm-2 control-label">Description</label>
        <div class="col-sm-5">
          {% render_field form.comments class+="form-control" rows="3"%}
        </div>
      </div>

      <div class="form-group">
        <div class="col-sm-offset-2 col-sm-10">
          <button type="submit" class="btn btn-default">Add sample</button>
        </div>
      </div>

    </form>
  </div>
</div>

{% endblock %}
