From ff869eee573a9fcd73a6c7334dc4e1c934a42a46 Mon Sep 17 00:00:00 2001 From: Andreas <6977712+AndreasK79@users.noreply.github.com> Date: Fri, 30 Dec 2022 23:16:38 +0100 Subject: [PATCH] [OQRS] Time shortcuts --- application/views/oqrs/notinlogform.php | 2 +- application/views/oqrs/request.php | 2 +- assets/js/sections/oqrs.js | 34 ++++++++++++++++++++++++- 3 files changed, 35 insertions(+), 3 deletions(-) diff --git a/application/views/oqrs/notinlogform.php b/application/views/oqrs/notinlogform.php index 9e8d7f42..726a94e2 100644 --- a/application/views/oqrs/notinlogform.php +++ b/application/views/oqrs/notinlogform.php @@ -16,7 +16,7 @@ checked.
1 - + diff --git a/application/views/oqrs/request.php b/application/views/oqrs/request.php index 008125d0..50220dee 100644 --- a/application/views/oqrs/request.php +++ b/application/views/oqrs/request.php @@ -25,7 +25,7 @@ The following QSO(s) were found. Please fill out the date and time and submit yo echo ''; echo ''. $i++ .''; echo ''; - echo ''; + echo ''; echo ''. $qso->col_band .''; echo ''; echo $qso->col_submode == null ? strtoupper($qso->col_mode) : strtoupper($qso->col_submode); echo ''; echo ''; diff --git a/assets/js/sections/oqrs.js b/assets/js/sections/oqrs.js index 683429dd..a08c40bc 100644 --- a/assets/js/sections/oqrs.js +++ b/assets/js/sections/oqrs.js @@ -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 = $('').html(rowCount); var $date = $('').html(''); - var $time = $('').html(''); + var $time = $('').html(''); var $band = $('').html(''); var $mode = $('').html(''); $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) {