aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/Http/Controllers/ReservationsController.php2
-rw-r--r--public/js/activities.js25
-rw-r--r--resources/views/pages/activities.blade.php7
3 files changed, 31 insertions, 3 deletions
diff --git a/app/Http/Controllers/ReservationsController.php b/app/Http/Controllers/ReservationsController.php
index de1ea76..1865f46 100644
--- a/app/Http/Controllers/ReservationsController.php
+++ b/app/Http/Controllers/ReservationsController.php
@@ -41,7 +41,7 @@ class ReservationsController extends Controller
return response($data);
} else {
$activities = Reservation::where('approved', '1')
- ->select('operatorCall', 'fromTime', 'toTime', 'frequencies', 'qso')
+ ->select('operatorCall', 'fromTime', 'toTime', 'specialCall', 'frequencies', 'qso')
->where('specialCall', $request->input('call-sign'))
->get()
->toArray();
diff --git a/public/js/activities.js b/public/js/activities.js
index f9c19ac..94bee2d 100644
--- a/public/js/activities.js
+++ b/public/js/activities.js
@@ -8,8 +8,31 @@ jQuery('select#call-sign').change(fillTable);
jQuery(document).ready(fillTable);
function fillTable() {
+ tableData = jQuery('table#ajax-table>tbody').first();
+ tableData.html('<tr><td class="font-weight-bold text-center" colspan="6">Loading...</td></tr>');
+
sign = jQuery('select#call-sign').first().val();
+
jQuery.post('/api/activities', {'call-sign': sign}, function (data, status) {
- console.log(data);
+ if (status === 'success') {
+ if (data.data.length > 0) {
+ tableData.empty();
+ for (var i = 0, len = data.data.length; i < len; i++) {
+ tr = '<tr><td>' + data.data[i].operatorCall + '</td>' +
+ '<td>' + data.data[i].fromTime + '</td>' +
+ '<td>' + data.data[i].toTime + '</td>' +
+ '<td>' + data.data[i].specialCall + '</td>' +
+ '<td>' + data.data[i].frequencies + '</td>' +
+ '<td>' + data.data[i].qso + '</td></tr>';
+ tableData.append(tr);
+ }
+ }
+ else {
+ tableData.html('<tr><td class="font-weight-bold text-center" colspan="6">No data...</td></tr>');
+ }
+ }
+ else {
+ tableData.html('<tr><td class="font-weight-bold text-center" colspan="6">Error!</td></tr>');
+ }
});
}
diff --git a/resources/views/pages/activities.blade.php b/resources/views/pages/activities.blade.php
index 0c558af..897c622 100644
--- a/resources/views/pages/activities.blade.php
+++ b/resources/views/pages/activities.blade.php
@@ -16,8 +16,13 @@
@endif
</select>
-<div class="table-responsive">
+<div class="table-responsive mt-2">
<table id="ajax-table" class="table table-striped table-bordered">
+ <thead class="thead-dark">
+ <tr><th>Operator</th><th>From</th><th>To</th><th>Special Callsign</th><th>Frequencies</th><th>QSO</th></tr>
+ </thead>
+ <tbody>
+ </tbody>
</table>
</div>