From adcc4c9cb49939d55bc84610c5dfd2351c452bf8 Mon Sep 17 00:00:00 2001 From: Mateja Date: Tue, 24 Nov 2020 21:45:30 +0100 Subject: Activities special callsign description added. --- public/js/activities.js | 64 ++++++++++++++++++++++++++++--------------------- 1 file changed, 37 insertions(+), 27 deletions(-) (limited to 'public/js') diff --git a/public/js/activities.js b/public/js/activities.js index 6529e6b..82385c8 100644 --- a/public/js/activities.js +++ b/public/js/activities.js @@ -1,38 +1,48 @@ $.ajaxSetup({ - headers: { - 'X-CSRF-TOKEN': $('input[name="csrf-token"]').attr('content') - } + headers: { + 'X-CSRF-TOKEN': $('input[name="csrf-token"]').attr('content') + } }); jQuery('select#call-sign').change(fillTable); jQuery(document).ready(fillTable); function fillTable() { - tableData = jQuery('table#ajax-table>tbody').first(); - tableData.html('Loading...'); + tableData = jQuery('table#ajax-table>tbody').first(); + tableData.html('Loading...'); - sign = jQuery('select#call-sign').first().val(); + sign = jQuery('select#call-sign').first().val(); - jQuery.post('/api/activities', {'call-sign': sign}, function (data, status) { - if (status === 'success') { - if (data.data.length > 0) { - tableData.empty(); - for (i = 0, len = data.data.length; i < len; i++) { - tr = '' + data.data[i].operatorCall + '' + - '' + data.data[i].fromTime + '' + - '' + data.data[i].toTime + '' + - '' + data.data[i].specialCall + '' + - '' + data.data[i].frequencies + '' + - '' + data.data[i].qso + ''; - tableData.append(tr); - } - } - else { - tableData.html('No data...'); - } - } - else { - tableData.html('Error!'); - } + descDiv = jQuery('div#sign-desc-div'); + if (sign === 'all') { + descDiv.empty(); + } else { + jQuery.get('/special-calls/show/' + sign, function (data, status) { + descDiv.html('
' + data + '
'); + console.log(data); }); + } + + jQuery.post('/api/activities', {'call-sign': sign}, function (data, status) { + if (status === 'success') { + if (data.data.length > 0) { + tableData.empty(); + for (i = 0, len = data.data.length; i < len; i++) { + tr = '' + data.data[i].operatorCall + '' + + '' + data.data[i].fromTime + '' + + '' + data.data[i].toTime + '' + + '' + data.data[i].specialCall + '' + + '' + data.data[i].frequencies + '' + + '' + data.data[i].qso + ''; + tableData.append(tr); + } + } + else { + tableData.html('No data...'); + } + } + else { + tableData.html('Error!'); + } + }); } -- cgit v1.2.3