[OQRS] Fixed time formatting. Added datatable and submit with enter on search.

pull/2082/head
Andreas 2023-04-26 20:33:45 +02:00
rodzic 0142209022
commit 041aa02b02
2 zmienionych plików z 34 dodań i 0 usunięć

Wyświetl plik

@ -22,6 +22,21 @@
<button onclick="searchOqrsGrouped();" class="btn btn-sm btn-primary" id="stationbuttonsubmit" type="button"><i class="fas fa-search"></i> Search</button>
</form>';
echo '<div class="searchinfo"></div>';
?>
<script>// Get the input field
var input = document.getElementById("oqrssearch");
// Execute a function when the user presses a key on the keyboard
input.addEventListener("keypress", function(event) {
// If the user presses the "Enter" key on the keyboard
if (event.key === "Enter") {
// Cancel the default action, if needed
event.preventDefault();
// Trigger the button element with a click
document.getElementById("stationbuttonsubmit").click();
}
});</script>
<?php
} else {
echo '<div class="resulttable">';
if ($stations->result() != NULL) { ?>

Wyświetl plik

@ -49,6 +49,25 @@ function searchOqrsGrouped() {
data: {'callsign': $("#oqrssearch").val().toUpperCase()},
success: function (data) {
$(".searchinfo").append(data);
$('.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,
ordering: false,
"scrollY": "410px",
"scrollCollapse": true,
"paging": false,
"scrollX": true,
});
}
});
}