<commit_before>{% extends 'base_admin.html' %}
{% load thumbnail_l %}

{% block title %}{{ pagetitle }} {{ volunteer.member.name }}{% endblock %}

{% block css %}
{{ block.super }}
<style>
th {
    vertical-align: top;
}
#roles ul {
    -moz-columns: 3;
    -webkit-columns: 3;
    columns: 3;
}
#roles li {
    list-style-type: none;
    margin: 5px;
}
.standard_role {
    font-weight: bold;
}
#vol_form, #mem_form {
    display: inline-block;
    width: 400px;
    vertical-align: top;
}
input[type="text"], textarea {
    width: 290px;
}
div#webcampreview {
    display: none;
}
canvas {
    display: none;
}
#enablecapturebutton {
    display: none;
}
.training-notes {
    display: none;
}
#form-errors {
    color: red;
    display: none;
}
.training-notes td {
    white-space: pre-line;
}

</style>
{% endblock %}

{% block script %}
{{ block.super }}
<script src="{{ STATIC_URL }}js/lib/jquery.min.js"></script>
<script src="{{ STATIC_URL }}members/js/webcam.js"></script>
<script src="{{ STATIC_URL }}members/js/form_volunteer.js"></script>
<script >
$(document).ready(function() {
    setupPage();
{% if volunteer.id %}
    setupTraining({
        csrf_token: '{{ csrf_token }}',
        add_training_record_url: '{% url "add-volunteer-training-record" volunteer_id=volunteer.id%}',
        delete_training_record_url: '{% url "delete-volunteer-training-record" training_record_id=9999 %}'
    });

{% endif %}
});
</script>
{% endblock %}

{% block body %}
<h3>{{ pagetitle }} {{ volunteer.member.name }}</h3>
{% if message %}<h3>{{ message }}</h3>{% endif %}
<p>Added: {{ volunteer.created_at|date:"d/m/Y" }}<br>
Last updated: {{ volunteer.updated_at|date:"d/m/Y" }}<br>
</p>
<form id="main_form" action="" method="POST" enctype="multipart/form-data">
{% csrf_token %}
<p><input type="submit" value="Save changes"> <a href="{% url "view-volunteer-list" %}">Cancel</a></p>
<div id="mem_form">
<table>
{{ mem_form.as_table }}
<tr><td colspan = "2">&nbsp;</td></tr>
</table>
</div>

<div id="vol_form">
<table>
    <tr><td></td><td>
        <div id="webcampreview">
            <i>Experimental - may not work correctly on all browsers</i>
            <video id="video"></video>
            <button id="capturebutton">Take photo</button>
        </div>
        {% if volunteer.portrait %}
        <a href="{{ volunteer.portrait.url }}">
            <img src="{{ volunteer.portrait|thumbnail_url:'portrait' }}" id="photo" alt="Photo of {{ volunteer.member.name }}" border="0" width="75"></a><br>
        {% else %}
        <img src="{{ default_mugshot }}" id="photo" alt="No photo yet" border="0" width="75"><br>
        {% endif %}
        <button id="enablecapturebutton">Take photo using webcam</button>
        <canvas id="canvas"></canvas>
        {{ vol_form.image_data }}
    </td></tr>
    <tr><th>{{ vol_form.portrait.label_tag }}</th><td> {{ vol_form.portrait.errors }}{{ vol_form.portrait }}</td></tr>
    <tr><th>{{ vol_form.notes.label_tag }}</th><td> {{ vol_form.notes.errors }}{{ vol_form.notes }}</td></tr>
</table>
</div>
<div id="roles">
    {{ vol_form.roles.errors }}
    <ul>
    {% for c in vol_form.roles.field.queryset %}
    {% ifchanged %}</ul><h3>{{ c.standard|yesno:"Event roles,Other roles" }}</h3><ul>{% endifchanged %}
    <li{% if c.standard %} class="standard_role"{% endif %}><label for="{{vol_form.roles.auto_id}}_{{ forloop.counter0 }}"><input id="{{vol_form.roles.auto_id}}_{{ forloop.counter0 }}" type="checkbox"  value={{c.id}} name="{{ vol_form.prefix }}-roles" {% if c.id in vol_form.roles.value %}checked {% endif %}/> {{ c }}</label></li>
    {% endfor %}
    </ul>
</div>
<p><input type="submit" value="Save changes"> <a href="{% url "view-volunteer-list" %}">Cancel</a></p>
</form>
<a name="training-record"></a>
{% if training_record_form %}
<div id="training-record">
    <h3>Training record</h3>
    <form action="" method="POST" enctype="multipart/form-data">
    <table class="table">
        <tr>
            <th>Role</th>
            <th>Date of training</th>
            <th>Trainer</th>
            <th>Notes</th>
            <th>Delete</th>
        </tr>
    {% for record in volunteer.training_records.all %}
        <tr>
            <td>{{ record.role }}</td>
            <td>{{ record.training_date|date:"d/m/Y" }}</td>
            <td>{{ record.trainer }}</td>
            <td>{% if record.notes %}<a class="toggle-notes" href="#">(+)</a>{% endif %}</td>
            <td>
                <a class="delete-training" title="delete" href="{% url "delete-volunteer-training-record" training_record_id=record.id %}">[X]</a>
            </td>
        </tr>
        <tr class="training-notes">
            <th>Notes:</th>
            <td colspan="4">
                {{ record.notes }}
            </td>
        </tr>
    {% empty %}
        <tr>
            <td colspan="5">No training records for this volunteer</td>
        </tr>
    {% endfor %}
        <tr id="new-record-row"><th colspan="5">New record</td></tr>
        <tr id="form-errors">
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
        </tr>
        <tr>
            <td>{{ training_record_form.role }}</td>
            <td>{{ training_record_form.training_date }}</td>
            <td>{{ training_record_form.trainer }}</td>
            <td><a class="toggle-notes" href="#">(+)</a></td>
            <td></td>
        </tr>
        <tr class="training-notes">
            <th>Notes:</th>
            <td colspan="4" id="training-notes">{{ training_record_form.notes }}</td>
        </tr>
        <tr><td colspan="5"><input type="submit" value="Add training record"></td></tr>
    </table>
    </form>
</div>
{% endif %}
{% endblock %}
<commit_msg>Rearrange volunteer form a little<commit_after>{% extends 'base_admin.html' %}
{% load thumbnail_l %}

{% block title %}{{ pagetitle }} {{ volunteer.member.name }}{% endblock %}

{% block css %}
{{ block.super }}
<style>
th {
    vertical-align: top;
}
#roles ul {
    -moz-columns: 3;
    -webkit-columns: 3;
    columns: 3;
}
#roles li {
    list-style-type: none;
    margin: 5px;
}
.standard_role {
    font-weight: bold;
}
#vol_form, #mem_form {
    display: inline-block;
    width: 400px;
    vertical-align: top;
}
input[type="text"], textarea {
    width: 290px;
}
div#webcampreview {
    display: none;
}
canvas {
    display: none;
}
#enablecapturebutton {
    display: none;
}
.training-notes {
    display: none;
}
#form-errors {
    color: red;
    display: none;
}
.training-notes td {
    white-space: pre-line;
}

</style>
{% endblock %}

{% block script %}
{{ block.super }}
<script src="{{ STATIC_URL }}js/lib/jquery.min.js"></script>
<script src="{{ STATIC_URL }}members/js/webcam.js"></script>
<script src="{{ STATIC_URL }}members/js/form_volunteer.js"></script>
<script >
$(document).ready(function() {
    setupPage();
{% if volunteer.id %}
    setupTraining({
        csrf_token: '{{ csrf_token }}',
        add_training_record_url: '{% url "add-volunteer-training-record" volunteer_id=volunteer.id%}',
        delete_training_record_url: '{% url "delete-volunteer-training-record" training_record_id=9999 %}'
    });

{% endif %}
});
</script>
{% endblock %}

{% block body %}
<h3>{{ pagetitle }} {{ volunteer.member.name }}</h3>
{% if message %}<h3>{{ message }}</h3>{% endif %}
<form id="main_form" action="" method="POST" enctype="multipart/form-data">
{% csrf_token %}
<p><input type="submit" value="Save changes"> <a href="{% url "view-volunteer-list" %}">Cancel</a></p>

<div id="mem_form">
<h4>Contact details</h4>
<table>
{{ mem_form.as_table }}
</table>
</div>

<div id="vol_form">
<h4>Volunteer facts</h4>
</p>
<table>
    <tr><td></td><td>
        <div id="webcampreview">
            <i>Experimental - may not work correctly on all browsers</i>
            <video id="video"></video>
            <button id="capturebutton">Take photo</button>
        </div>
        {% if volunteer.portrait %}
        <a href="{{ volunteer.portrait.url }}">
            <img src="{{ volunteer.portrait|thumbnail_url:'portrait' }}" id="photo" alt="Photo of {{ volunteer.member.name }}" border="0" width="75"></a><br>
        {% else %}
        <img src="{{ default_mugshot }}" id="photo" alt="No photo yet" border="0" width="75"><br>
        {% endif %}
        <button id="enablecapturebutton">Take photo using webcam</button>
        <canvas id="canvas"></canvas>
        {{ vol_form.image_data }}
    </td></tr>
    <tr><th>{{ vol_form.portrait.label_tag }}</th>
        <td> {{ vol_form.portrait.errors }}{{ vol_form.portrait }}</td></tr>
    <tr><td>Inducted:</td>
{% if volunteer.is_old %}
        <td>Before {{ dawn_of_toolkit|date:"d/m/Y" }} (when the toolkit was rebooted)</td></tr>
{% else %}
        <td>{{ volunteer.created_at|date:"d/m/Y" }}</td></tr>
{% endif %}
    <tr><td>Updated:</td>
        <td>{{ volunteer.updated_at|date:"d/m/Y" }}</td></tr>
    <tr><th>{{ vol_form.notes.label_tag }}</th>
        <td> {{ vol_form.notes.errors }}{{ vol_form.notes }}</td></tr>
</table>
</div>
<div id="roles">
    {{ vol_form.roles.errors }}
    <ul>
    {% for c in vol_form.roles.field.queryset %}
    {% ifchanged %}</ul><h3>{{ c.standard|yesno:"Event roles,Other roles" }}</h3><ul>{% endifchanged %}
    <li{% if c.standard %} class="standard_role"{% endif %}><label for="{{vol_form.roles.auto_id}}_{{ forloop.counter0 }}"><input id="{{vol_form.roles.auto_id}}_{{ forloop.counter0 }}" type="checkbox"  value={{c.id}} name="{{ vol_form.prefix }}-roles" {% if c.id in vol_form.roles.value %}checked {% endif %}/> {{ c }}</label></li>
    {% endfor %}
    </ul>
</div>
<p><input type="submit" value="Save changes"> <a href="{% url "view-volunteer-list" %}">Cancel</a></p>
</form>
<a name="training-record"></a>
{% if training_record_form %}
<div id="training-record">
    <h3>Training record</h3>
    <form action="" method="POST" enctype="multipart/form-data">
    <table class="table">
        <tr>
            <th>Role</th>
            <th>Date of training</th>
            <th>Trainer</th>
            <th>Notes</th>
            <th>Delete</th>
        </tr>
    {% for record in volunteer.training_records.all %}
        <tr>
            <td>{{ record.role }}</td>
            <td>{{ record.training_date|date:"d/m/Y" }}</td>
            <td>{{ record.trainer }}</td>
            <td>{% if record.notes %}<a class="toggle-notes" href="#">(+)</a>{% endif %}</td>
            <td>
                <a class="delete-training" title="delete" href="{% url "delete-volunteer-training-record" training_record_id=record.id %}">[X]</a>
            </td>
        </tr>
        <tr class="training-notes">
            <th>Notes:</th>
            <td colspan="4">
                {{ record.notes }}
            </td>
        </tr>
    {% empty %}
        <tr>
            <td colspan="5">No training records for this volunteer</td>
        </tr>
    {% endfor %}
        <tr id="new-record-row"><th colspan="5">New record</td></tr>
        <tr id="form-errors">
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
        </tr>
        <tr>
            <td>{{ training_record_form.role }}</td>
            <td>{{ training_record_form.training_date }}</td>
            <td>{{ training_record_form.trainer }}</td>
            <td><a class="toggle-notes" href="#">(+)</a></td>
            <td></td>
        </tr>
        <tr class="training-notes">
            <th>Notes:</th>
            <td colspan="4" id="training-notes">{{ training_record_form.notes }}</td>
        </tr>
        <tr><td colspan="5"><input type="submit" value="Add training record"></td></tr>
    </table>
    </form>
</div>
{% endif %}
{% endblock %}

{'fraction_non_alphanumeric': 0.21536888737433976, 'fraction_numerical': 0.006389504174476061, 'mean_word_length': 2.75648, 'pattern_counts': {'":': 0, '<': 375, '<?xml version=': 0, '>': 375, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2265062', 'n_tokens_mistral': 4254, 'n_tokens_neox': 4012, 'n_words': 797}