{% extends '_base.html' %}
{% load static from staticfiles %}
{% load render_table from django_tables2 %}
{% load form_helpers %}

{% block title %}Secret Import{% endblock %}

{% block content %}
<h1>Secret Import</h1>
<div class="row">
	<div class="col-md-6">
        {% if form.non_field_errors %}
            <div class="panel panel-danger">
                <div class="panel-heading"><strong>Errors</strong></div>
                <div class="panel-body">
                    {{ form.non_field_errors }}
                </div>
            </div>
        {% endif %}
		<form action="." method="post" class="form requires-private-key">
		    {% csrf_token %}
		    {% render_form form %}
		    <div class="form-group">
		        <button type="submit" class="btn btn-primary">Submit</button>
		        <a href="{{ cancel_url }}" class="btn btn-default">Cancel</a>
		    </div>
		</form>
	</div>
	<div class="col-md-6">
		<h4>CSV Format</h4>
		<table class="table">
			<thead>
				<tr>
					<th>Field</th>
					<th>Description</th>
					<th>Example</th>
				</tr>
			</thead>
			<tbody>
				<tr>
					<td>Device</td>
					<td>Name of the parent device</td>
					<td>edge-router1</td>
				</tr>
				<tr>
					<td>Role</td>
					<td>Functional role</td>
					<td>Login Credentials</td>
				</tr>
				<tr>
					<td>Name (optional)</td>
					<td>Username or other label</td>
					<td>root</td>
				</tr>
				<tr>
					<td>Secret</td>
					<td>Secret data</td>
					<td>MyP@ssw0rd!</td>
				</tr>
			</tbody>
		</table>
		<h4>Example</h4>
		<pre>edge-router1,Login Credentials,root,MyP@ssw0rd!</pre>
	</div>
</div>

{% include 'secrets/inc/private_key_modal.html' %}
{% endblock %}

{% block javascript %}
<script src="{% static 'js/secrets.js' %}"></script>
{% endblock %}
