aboutsummaryrefslogtreecommitdiff
path: root/public
diff options
context:
space:
mode:
authorMateja Marić <mail@matejamaric.com>2021-03-22 15:21:40 +0100
committerGitHub <noreply@github.com>2021-03-22 15:21:40 +0100
commit6ab102bc4be617255d5eab77faebb1cada65b370 (patch)
tree09fcff5953cc6ca3702335e717ca72f865124d1c /public
parent21e9e94e76a21516edc3d1e4d0462a0ba75aafa4 (diff)
parentdb976a9fb0434df0095ea9f1b8858213d57e7535 (diff)
downloadyota-laravel-master.tar.gz
yota-laravel-master.zip
Merge pull request #4 from MatejaMaric/use-vueHEADv2.0.0master
Use Vue.js and Vuex.
Diffstat (limited to 'public')
-rw-r--r--public/js/activities.js49
-rw-r--r--public/js/reservations.js119
-rw-r--r--public/js/reserve.js9
3 files changed, 0 insertions, 177 deletions
diff --git a/public/js/activities.js b/public/js/activities.js
deleted file mode 100644
index eacf4d3..0000000
--- a/public/js/activities.js
+++ /dev/null
@@ -1,49 +0,0 @@
-$.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('<tr><td class="font-weight-bold text-center" colspan="7">Loading...</td></tr>');
-
- sign = jQuery('select#call-sign').first().val();
-
- descDiv = jQuery('div#sign-desc-div');
- if (sign === 'all') {
- descDiv.empty();
- } else {
- jQuery.get('/special-calls/show/' + sign, function (data, status) {
- descDiv.html('<div class="card mt-1"><div class="card-body pb-1">' + data + '</div></div>');
- 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 = '<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].modes + '</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/public/js/reservations.js b/public/js/reservations.js
deleted file mode 100644
index bc9c6de..0000000
--- a/public/js/reservations.js
+++ /dev/null
@@ -1,119 +0,0 @@
-$.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('<tr><td class="font-weight-bold text-center" colspan="13">Loading...</td></tr>');
-
- sign = jQuery('select#call-sign').first().val();
-
- jQuery.post('/special-calls/reservations', {'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 = '<tr>';
- tr += '<td>' + data.data[i].id + '</td>';
- if (data.data[i].approved === 1)
- tr += '<td class="text-center"><input type="checkbox" checked></td>';
- else
- tr += '<td class="text-center"><input type="checkbox"></td>';
-
- tr +=
- '<td contenteditable="true">' + data.data[i].operatorCall + '</td>' +
- '<td contenteditable="true">' + data.data[i].qso + '</td>' +
- '<td contenteditable="true">' + data.data[i].fromTime + '</td>' +
- '<td contenteditable="true">' + data.data[i].toTime + '</td>' +
- '<td contenteditable="true">' + data.data[i].specialCall + '</td>' +
- '<td contenteditable="true">' + data.data[i].frequencies + '</td>' +
- '<td contenteditable="true">' + data.data[i].modes + '</td>' +
- '<td contenteditable="true">' + data.data[i].operatorName + '</td>' +
- '<td contenteditable="true">' + data.data[i].operatorEmail + '</td>' +
- '<td contenteditable="true">' + data.data[i].operatorPhone + '</td>';
- tr += '<td>';
- tr += "<button class=\"btn btn-primary mr-2\" onclick=\"btnAction('update', this)\">Update</button>";
- tr += "<button class=\"btn btn-warning mr-2\" onclick=\"btnAction('restore', this)\">Restore</button>";
- tr += "<button class=\"btn btn-danger\" onclick=\"btnAction('delete', this)\">Delete</button>";
- tr += '</td>';
- tr += '</tr>';
- tableData.append(tr);
- }
- }
- else {
- tableData.html('<tr><td class="font-weight-bold text-center" colspan="13">No data...</td></tr>');
- }
- }
- else {
- tableData.html('<tr><td class="font-weight-bold text-center" colspan="13">Error!</td></tr>');
- }
- });
-}
-
-function btnAction(action, btn) {
- trDom = btn.parentElement.parentElement;
- trData = trDom.children;
-
- actionData = {
- action: action,
- id: trData[0].innerText,
- approved: trData[1].firstElementChild.checked,
- operatorCall: trData[2].innerText,
- qso: trData[3].innerText,
- fromTime: trData[4].innerText,
- toTime: trData[5].innerText,
- specialCall: trData[6].innerText,
- frequencies: trData[7].innerText,
- modes: trData[8].innerText,
- operatorName: trData[9].innerText,
- operatorEmail: trData[10].innerText,
- operatorPhone: trData[11].innerText
- };
-
- if (actionData.action == 'delete') {
- if (confirm("Are you sure you want to delete reservation #" + actionData.id + " made by " + actionData.operatorCall + "?") === true)
- trDom.remove();
- else return;
- }
-
- jQuery.post('/api/reservations', actionData, function (response, status) {
- if (status === 'success') {
- try {
- // Handle various actions
- if (response.action == "update") {
- jQuery('#notice').html("Record #" + actionData.id + " updated.");
- } else if (response.action == "restore") {
- trData[1].firstElementChild.checked = response.approved == 1;
- trData[2].innerText = response.operatorCall;
- trData[3].innerText = response.qso;
- trData[4].innerText = response.fromTime;
- trData[5].innerText = response.toTime;
- trData[6].innerText = response.specialCall;
- trData[7].innerText = response.frequencies;
- trData[8].innerText = response.modes;
- trData[9].innerText = response.operatorName;
- trData[10].innerText = response.operatorEmail;
- trData[11].innerText = response.operatorPhone;
- jQuery('#notice').html("Record's #" + actionData.id + " data restored.");
- } else if (response.action == "delete") {
- jQuery('#notice').html("Record #" + actionData.id + " deleted.");
- } else {
- console.log("No action?");
- //console.log(data);
- }
- } catch {
- //console.log(data);
- alert("Bad input data!");
- }
- }
- else {
- console.log('AJAX error');
- alert("Bad input data!");
- }
- });
-}
diff --git a/public/js/reserve.js b/public/js/reserve.js
deleted file mode 100644
index 7a20c37..0000000
--- a/public/js/reserve.js
+++ /dev/null
@@ -1,9 +0,0 @@
-jQuery('select#special-call').change(setCallDesc);
-jQuery(document).ready(setCallDesc);
-
-function setCallDesc() {
- sign = jQuery('select#special-call').first().val();
- jQuery.get('/special-calls/show/' + sign, function (data, status) {
- jQuery('div#call-desc').html(data);
- });
-}