[OQRS] Time shortcuts

pull/1885/head
Andreas 2022-12-30 23:16:38 +01:00
rodzic f72d51c005
commit ff869eee57
3 zmienionych plików z 35 dodań i 3 usunięć

Wyświetl plik

@ -16,7 +16,7 @@ checked.<br />
<tr>
<td>1</td>
<td><input class="form-control" type="date" name="date" value="" id="date" placeholder="YYYY-MM-DD"></td>
<td><input class="form-control" type="text" name="time" value="" id="time" maxlength="5" placeholder="HH:MM"></td>
<td><input class="form-control qsotime" type="text" name="time" value="" id="time" maxlength="5" placeholder="HH:MM"></td>
<td><input class="form-control" type="text" name="band" value="" id="band"></td>
<td><input class="form-control" type="text" name="mode" value="" id="mode"></td>
</tr>

Wyświetl plik

@ -25,7 +25,7 @@ The following QSO(s) were found. Please fill out the date and time and submit yo
echo '<tr>';
echo '<td>'. $i++ .'</td>';
echo '<td><input class="form-control" type="date" name="date" value="" id="date" placeholder="YYYY-MM-DD"></td>';
echo '<td><input class="form-control" type="text" name="time" value="" id="time" maxlength="5" placeholder="HH:MM"></td>';
echo '<td><input class="form-control qsotime" type="text" name="time" value="" id="time" maxlength="5" placeholder="HH:MM"></td>';
echo '<td id="band">'. $qso->col_band .'</td>';
echo '<td id="mode">'; echo $qso->col_submode == null ? strtoupper($qso->col_mode) : strtoupper($qso->col_submode); echo '</td>';
echo '</tr>';

Wyświetl plik

@ -48,6 +48,16 @@ function notInLog() {
data: {'station_id': $("#station").val(), 'callsign': $("#oqrssearch").val().toUpperCase()},
success: function(html) {
$(".searchinfo").html(html);
$('.qsotime').change(function() {
var raw_time = $(this).val();
if(raw_time.match(/^\d\[0-6]d$/)) {
raw_time = "0"+raw_time;
}
if(raw_time.match(/^[012]\d[0-5]\d$/)) {
raw_time = raw_time.substring(0,2)+":"+raw_time.substring(2,4);
$(this).val(raw_time);
}
});
}
});
}
@ -102,13 +112,23 @@ function oqrsAddLine() {
var $iterator = $('<td></td>').html(rowCount);
var $date = $('<td></td>').html('<input class="form-control" type="date" name="date" value="" id="date" placeholder="YYYY-MM-DD">');
var $time = $('<td></td>').html('<input class="form-control" type="text" name="time" value="" id="time" maxlength="5" placeholder="HH:MM">');
var $time = $('<td></td>').html('<input class="form-control qsotime" type="text" name="time" value="" id="time" maxlength="5" placeholder="HH:MM">');
var $band = $('<td></td>').html('<input class="form-control" type="text" name="band" value="" id="band">');
var $mode = $('<td></td>').html('<input class="form-control" type="text" name="mode" value="" id="mode">');
$row.append($iterator, $date, $time, $band, $mode);
$myTable.append($row);
$('.qsotime').change(function() {
var raw_time = $(this).val();
if(raw_time.match(/^\d\[0-6]d$/)) {
raw_time = "0"+raw_time;
}
if(raw_time.match(/^[012]\d[0-5]\d$/)) {
raw_time = raw_time.substring(0,2)+":"+raw_time.substring(2,4);
$(this).val(raw_time);
}
});
}
function requestOqrs() {
@ -118,6 +138,17 @@ function requestOqrs() {
data: {'station_id': $("#station").val(), 'callsign': $("#oqrssearch").val().toUpperCase()},
success: function(html) {
$(".searchinfo").html(html);
/* time input shortcut */
$('.qsotime').change(function() {
var raw_time = $(this).val();
if(raw_time.match(/^\d\[0-6]d$/)) {
raw_time = "0"+raw_time;
}
if(raw_time.match(/^[012]\d[0-5]\d$/)) {
raw_time = raw_time.substring(0,2)+":"+raw_time.substring(2,4);
$(this).val(raw_time);
}
});
$('.result-table').DataTable({
"pageLength": 25,
responsive: false,
@ -443,6 +474,7 @@ $(document).ready(function () {
$('#searchForm').submit();
});
});
});
function selectQsoID(qsoID) {