From aed493eb95bf660145003f024434296c91d1c8c3 Mon Sep 17 00:00:00 2001 From: Mateja Date: Mon, 16 Nov 2020 18:18:19 +0100 Subject: Validate from and to date on reserve from. Copy activities.js to reservations.js --- public/js/reservations.js | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'public') diff --git a/public/js/reservations.js b/public/js/reservations.js index e69de29..94bee2d 100644 --- a/public/js/reservations.js +++ b/public/js/reservations.js @@ -0,0 +1,38 @@ +$.ajaxSetup({ + 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...'); + + 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 (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 + ''; + tableData.append(tr); + } + } + else { + tableData.html('No data...'); + } + } + else { + tableData.html('Error!'); + } + }); +} -- cgit v1.2.3