{% extends "base.html" %}
{% load csrffaker %} 
{% block title %}File{% endblock %}
{% block head %}
<script>
	$(function() {
		$("#id_date").datepicker({dateFormat: "yy-mm-dd"});
                $("#id_cave").change(function() {
                         $('#id_entrance').load('{% url "get_entrances" caveslug="" %}' + this.value);
                                                 });
                $("#id_cave").change(function() {
                         $('#id_qm').load('{% url "get_qms" caveslug="" %}' + this.value);
                                                 });
                $("#id_expedition").change(function() {
                         $('#id_logbookentry').load('{% url "get_logbook_entries" expeditionslug="" %}' + this.value);
                                                 });
                $("#id_expedition").change(function() {
                         $('#id_person').load('{% url "get_people" expeditionslug="" %}' + this.value);
                                                 });
	});

</script>

<link rel="stylesheet" href="{{ settings.JSLIB_URL }}jquery-ui/css/lightness/jquery-ui.css" type="text/css" media="all" />
<script src="{{ settings.JSLIB_URL }}jquery-ui/jquery-ui.min.js" type="text/javascript"></script>
<script src="{{ settings.MEDIA_URL }}js/jquery.formset.min.js" type="text/javascript"></script>
<!--<script src="{{ settings.TINY_MCE_MEDIA_URL }}tiny_mce.js" type="text/javascript"></script>
-->
{{ fileForm.media }}
{% endblock %}
{% block content %}

<form action="" method="post">{% csrf_token %}
    {{ fileForm.non_field_errors }}
    <div class="fieldWrapper">
        {{ fileForm.title.errors }}
        <label for="id_title">Title:</label>
        {{ fileForm.title }}
    </div>
    <div class="fieldWrapper">
        {{ fileForm.slug.errors }}
        <label for="id_slug">Slug:</label>
        {{ fileForm.slug }}
    </div>
    <div class="fieldWrapper">
        {{ fileForm.date.errors }}
        <label for="id_date">Date:</label>
        {{ fileForm.date }}
    </div>
    <div class="fieldWrapper" id="lon_utm">
        {{ fileForm.lon_utm.errors }}
        <label for="id_lon_utm">Longitude:</label>
        {{ fileForm.lon_utm }}
    </div>
    <div class="fieldWrapper" id="lat_utm">
        {{ fileForm.lat_utm.errors }}
        <label for="id_lat_utm">Latitude:</label>
        {{ fileForm.lat_utm }}
    </div>
    <div class="fieldWrapper" id="cave">
        {{ fileForm.cave.errors }}
        <label for="id_cave">Cave:</label>
        {{ fileForm.cave }}
    </div>
    <div class="fieldWrapper" id="entrance">
        {{ fileForm.entrance.errors }}
        <label for="id_entrance">Entrance:</label>
        {{ fileForm.entrance }}
    </div>
    <div class="fieldWrapper" id="qm">
        {{ fileForm.qm.errors }}
        <label for="id_cavem">QM:</label>
        {{ fileForm.qm }}
    </div>
    <div class="fieldWrapper" id="expedition">
        {{ fileForm.expedition.errors }}
        <label for="id_expediton">Expedition:</label>
        {{ fileForm.expedition }}
    </div>
    <div class="fieldWrapper" id="logbookentry">
        {{ fileForm.logbookentry.errors }}
        <label for="id_logbookentry">Logbook Entry:</label>
        {{ fileForm.logbookentry }}
    </div>
    <div class="fieldWrapper" id="person">
        {{ fileForm.person.errors }}
        <label for="id_expediton">Person:</label>
        {{ fileForm.person }}
    </div>
    <div class="fieldWrapper">
        {{ fileForm.html.errors }}
        <label for="id_date">Content:</label>
        {{ fileForm.html }}
    </div>
    <p><input type="submit" value="Submit Trip Report" /></p>
</form>

{% endblock %}
