From 26bdfee839f4b8fb18beb1a9770fc758ad20c267 Mon Sep 17 00:00:00 2001 From: Mateja Date: Mon, 16 Nov 2020 20:15:43 +0100 Subject: AJAX filtering reservations on admin panel... --- public/js/reservations.js | 42 ++++++++++++++++++++++++++++++++---------- 1 file changed, 32 insertions(+), 10 deletions(-) (limited to 'public/js') diff --git a/public/js/reservations.js b/public/js/reservations.js index 94bee2d..65b2e2e 100644 --- a/public/js/reservations.js +++ b/public/js/reservations.js @@ -9,30 +9,52 @@ jQuery(document).ready(fillTable); function fillTable() { tableData = jQuery('table#ajax-table>tbody').first(); - tableData.html('Loading...'); + tableData.html('Loading...'); sign = jQuery('select#call-sign').first().val(); - jQuery.post('/api/activities', {'call-sign': sign}, function (data, status) { + jQuery.post('/special-calls/reservations', {'call-sign': sign}, function (data, status) { if (status === 'success') { if (data.data.length > 0) { tableData.empty(); for (var 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 + ''; + tr = ''; + tr += '' + data.data[i].id + ''; + if (data.data[i].approved === 1) + tr += ''; + else + tr += ''; + + tr += + '' + data.data[i].operatorCall + '' + + '' + data.data[i].qso + '' + + '' + data.data[i].fromTime + '' + + '' + data.data[i].toTime + '' + + '' + data.data[i].specialCall + '' + + '' + data.data[i].frequencies + '' + + '' + data.data[i].modes + '' + + '' + data.data[i].operatorName + '' + + '' + data.data[i].operatorEmail + '' + + '' + data.data[i].operatorPhone + ''; + tr += ''; + tr += ""; + tr += ""; + tr += ""; + tr += ''; + tr += ''; tableData.append(tr); } } else { - tableData.html('No data...'); + tableData.html('No data...'); } } else { - tableData.html('Error!'); + tableData.html('Error!'); } }); } + +function btnAction(action, btn) { + console.log(action); +} -- cgit v1.2.3