{% extends "base.html" %}

{% block title %}
	&raquo;List of Local Reports &raquo; {{report.name}}
{% endblock %}

{% block nav %}
	&raquo; <a href="/local_reports">List of Local Reports</a> &raquo; {{report.name}}
{% endblock %}

{% block content %}
	{% if request.method == 'GET' and request.values.confirm_delete %}
		<!-- Layer Section -->
		<div class="layer-section">
			<!-- Section Header -->
			<div class="section-header">
				<h2>Are you sure you want to delete this report?</h2>	
			</div>
			<!-- End Section Header -->
			<!-- Section Content -->
			<div class="section-content">
				<div class="section-data">
					<div class="standardForm">
						<form method="delete">
							<fieldset>
								<input type="submit" value="Delete">
								<input type="reset" value="Cancel" onClick="window.location='/local_reports/{{report.id}}'" />
							</fieldset>
						</form>
					</div>
				</div>
			</div>
			<!-- End Section Content -->
		</div>
		<!-- End Layer Section -->
	
		
	{% else %}
		<!-- Layer Section -->
		<div class="layer-section">
			<!-- Section Header -->
			<div class="section-header">
				<h2>Minority Report</h2>	
			</div>
			<!-- End Section Header -->
			<!-- Section Content -->
			<div class="section-content">
				<div class="section-data">
					<ul>
						<li>
							<a href="{{report.id}}/output">Output</a>
						</li>
					</ul>	
					
					<div class="standardForm">
						<form method="post">
							<fieldset>
								<legend>Update Report</legend>
								<div class="row">
									<div class="col-sm-6">
										<label>
											Name
										</label>
											<input name="name" size="100"
												{% if request.args['name'] %}
													value="{{request.args['name']}}"
												{% else %}
													value="{{report.name}}"
												{% endif %}
											>
									</div>
								</div>
								
								<label>Script</label>
								</br>
								<textarea name="script" cols="80" rows="50">
									{%- if request.values['script'] -%}
										{{request.values['script']}}
									{%- else -%}
										{{report.script}}
									{%- endif -%}
								</textarea>
								</br>
								<label>Template</label>
								</br>
								<textarea name="template" cols="80" rows="50">
									{%- if request.values['template'] -%}
										{{request.values['template']}}
									{%- else -%}
										{{report.template}}
									{%- endif -%}
								</textarea>
								</br>
								<input type="submit" value="Save">
							</fieldset>
						</form>
					</div>
				</div>
			</div>
			<!-- End Section Content -->
		</div>
		<!-- End Layer Section -->
	
		<!-- Layer Section -->
		<div class="layer-section">
			<!-- Section Header -->
			<div class="section-header">
				<h2>Delete this report</h2>	
			</div>
			<!-- End Section Header -->
			<!-- Section Content -->
			<div class="section-content">
				<div class="section-data">
					<div class="standardForm">
						<form>
							<fieldset>
								<input type="hidden" name="view" value="Delete">
								<input type="submit" name="confirm_delete" value="Delete">
							</fieldset>
						</form>
					</div>
				</div>
			</div>
			<!-- End Section Content -->
		</div>
		<!-- End Layer Section -->

	{% endif %}
{% endblock %}
