{% extends "base.html" %}

{% block container %}

<div class="container">

<form class="form-horizontal" method="POST" role="form">
  {{ form.hidden_tag() }}
  <br><br>
  <div class="panel panel-default">
    <div class="panel-heading">Subscribe</div>
    <div class="panel-content">
      <br><br>
      <div class="form-group">
	<label class="control-label col-md-3" for="Analysis"> Analysis </label>
	<div class="col-md-offset-1 col-md-6">
	  <h4> {{analysis.title }}</h4>
	</div>
      </div>
      
      <br>
      <div class="form-group required">    
	<label class="control-label col-md-3" for="{{ form.subscription_type.id }}"> {{ form.subscription_type.label }} </label>
	<div class="col-md-offset-1 col-md-6">
	  {{ form.subscription_type(class='radio-inline', onchange="hide()") }}
	</div>
      </div>
      
      <br>
      <div class="form-group" id="authorize">
	<label class="control-label col-md-3" for="{{ form.authoritative.id }}"> {{ form.authoritative.label }} </label>
	<div class="col-md-offset-1 col-md-6">
	  {{ form.authoritative(class='checkbox-inline') }}
	</div>
      </div>

      <br>
      <div class="form-group">
	<label class="control-label col-md-3" for="{{ form.description.id }}"><i class="fa fa-pencil"></i>&nbsp;{{ form.description.label }}</label>
	<div class="col-md-offset-1 col-md-6">
	  {{ form.description(class='form-control', rows="12") }}
	  <p class="text-muted"><small>Optional.</small></p>
	</div>
      </div>
      
      <br>
      <div class="form-group">
	<label class="control-label col-md-3" for="{{ form.requirements.id }}"><i class="fa fa-pencil"></i>&nbsp;{{ form.requirements.label }}</label>
	<div class="col-md-offset-1 col-md-6">
	  {{ form.requirements(class='form-control', rows="6") }}
	  <p class="text-muted"><small>Optional. One requirement per line</small></p>
	</div>
      </div>

      <br>
      <div class="form-group">
	<label class="control-label col-md-3" for="{{ form.notifications.id }}"> {{ form.notifications.label }}</label>
	<div class="col-md-offset-1 col-md-6">
	  {{ form.notifications(class='checkbox-inline') }}
	</div>
      </div>
      <br>
    </div>
    </div>
          
    <br><br>
    <div class="col-md-12">
      <button type="submit" class="btn btn-primary pull-right"><i class="glyphicon glyphicon-ok"></i>&nbsp;Submit</button>
      <button type="text" class="btn btn-warning pull-left"><i class="glyphicon glyphicon-remove"></i>&nbsp;Cancel</button>
    </div>
</form>
</div>

<script type="text/javascript">

 function hide() {
     if (document.getElementById("subscription_type-1").checked) {
         document.getElementById("authoritative").checked = false;
         document.getElementById("authorize").style.display = 'none';
     }
     else{
         document.getElementById("authorize").style.display = 'block';
     }
 }


</script>
  

{% endblock %}

