2017-01-20 14:28:59 +01:00
|
|
|
{% extends "base.html" %}
|
|
|
|
|
|
|
|
{% load crispy_forms_tags %}
|
|
|
|
|
|
|
|
{% block content %}
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-sm-12">
|
|
|
|
<div class="panel panel-default">
|
|
|
|
<div class="panel-heading">Log a QSO!</div>
|
|
|
|
<div class="panel-body">
|
|
|
|
<style scoped>
|
2017-01-20 23:36:55 +01:00
|
|
|
#id_call {
|
|
|
|
text-transform: uppercase;
|
|
|
|
}
|
2017-01-20 14:28:59 +01:00
|
|
|
#id_reportRX, #id_reportTX {
|
2017-01-20 23:36:55 +01:00
|
|
|
width: 50px;
|
2017-01-20 14:28:59 +01:00
|
|
|
}
|
|
|
|
#id_ownNo, #id_otherNo {
|
2017-01-20 23:36:55 +01:00
|
|
|
width: 75px;
|
2017-01-20 14:28:59 +01:00
|
|
|
}
|
|
|
|
#id_refStr {
|
|
|
|
width: 100px;
|
|
|
|
}
|
|
|
|
#id_call {
|
|
|
|
width: 100px;
|
|
|
|
}
|
|
|
|
</style>
|
2017-01-20 21:03:54 +01:00
|
|
|
|
2017-01-20 23:36:55 +01:00
|
|
|
{% crispy form %}
|
2017-01-20 14:28:59 +01:00
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-sm-12">
|
|
|
|
<div class="panel panel-default">
|
|
|
|
<div class="panel-heading">Your QSO log</div>
|
|
|
|
<div class="panel-body">
|
|
|
|
<table class="table">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
2017-01-20 23:36:55 +01:00
|
|
|
<th>Nr-S</th>
|
2017-01-20 14:28:59 +01:00
|
|
|
<th>Band</th>
|
2017-01-20 23:36:55 +01:00
|
|
|
<th>UTC</th>
|
|
|
|
<th>Call</th>
|
|
|
|
<th>RST-S</th>
|
|
|
|
<th>RST-R</th>
|
|
|
|
<th>Nr-R</th>
|
|
|
|
<th>EXC</th>
|
|
|
|
<th>Remarks</th>
|
2017-01-20 14:28:59 +01:00
|
|
|
<th></th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
{% for qso in qsos %}
|
|
|
|
<tr>
|
|
|
|
<td>{{ qso.ownNo }}</td>
|
|
|
|
<td>{{ qso.band }}</td>
|
2017-01-20 23:36:55 +01:00
|
|
|
<td>{{ qso.time|date:"H:i" }}</td>
|
|
|
|
<td>{{ qso.call }}</td>
|
2017-01-20 14:28:59 +01:00
|
|
|
<td>{{ qso.reportTX }}</td>
|
|
|
|
<td>{{ qso.reportRX }}</td>
|
|
|
|
<td>{{ qso.otherNo }}</td>
|
|
|
|
<td>{{ qso.refStr }}</td>
|
2017-01-20 23:36:55 +01:00
|
|
|
<td>{{ qso.remarks }}</td>
|
2017-01-20 14:28:59 +01:00
|
|
|
<td><a href="{% url "contest:logEdit" qso.id %}">Edit</a> <a href="{% url "contest:logDelete" qso.id %}">Delete</a></td>
|
|
|
|
</tr>
|
|
|
|
{% endfor %}
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2017-01-20 23:36:55 +01:00
|
|
|
<script type="text/javascript">
|
|
|
|
$(document).ready(function() {
|
|
|
|
// set focus to fucking call field
|
|
|
|
// ...i hate javascript so much.
|
|
|
|
$('#id_call').focus();
|
2017-01-21 00:53:00 +01:00
|
|
|
|
|
|
|
var log = [{% for qso in qsos %}{call: "{{ qso.call }}", band: "{{ qso.band }}"}{% if not forloop.last %}, {% endif %}{% endfor %}];
|
|
|
|
|
|
|
|
function checkForDupes(e) {
|
|
|
|
var call = $("#id_call").val();
|
|
|
|
var band = $("#id_band :selected").text();
|
|
|
|
|
|
|
|
var dupe = false;
|
|
|
|
for(var i=0; i<log.length; i++) {
|
|
|
|
if(call == log[i].call && band == log[i].band) {
|
|
|
|
dupe = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(dupe) {
|
|
|
|
console.log("DUPE");
|
|
|
|
$("#id_call").css('background-color', 'red');
|
|
|
|
$("#id_band").css('background-color', 'red');
|
|
|
|
} else {
|
|
|
|
$("#id_call").css('background-color', 'white');
|
|
|
|
$("#id_band").css('background-color', 'white');
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$("#id_call").on("input", checkForDupes);
|
|
|
|
$("#id_band").change(checkForDupes);
|
2017-01-20 23:36:55 +01:00
|
|
|
});
|
2017-01-21 00:53:00 +01:00
|
|
|
|
2017-01-20 23:36:55 +01:00
|
|
|
</script>
|
|
|
|
|
2017-01-20 14:28:59 +01:00
|
|
|
{% endblock %}
|
|
|
|
|