From bef09734b0855c07ad5a45a8efaee7156ca7a230 Mon Sep 17 00:00:00 2001
From: Andreas Kristiansen <6977712+AndreasK79@users.noreply.github.com>
Date: Thu, 14 Mar 2024 14:49:28 +0100
Subject: [PATCH] Added some dialogs
---
application/controllers/Stationsetup.php | 18 ++++
.../views/stationsetup/linkedlocations.php | 42 ++++++++++
.../views/stationsetup/stationsetup.php | 4 +-
application/views/stationsetup/visitor.php | 28 +++++++
assets/js/sections/stationsetup.js | 84 +++++++++++++++++++
5 files changed, 174 insertions(+), 2 deletions(-)
create mode 100644 application/views/stationsetup/linkedlocations.php
create mode 100644 application/views/stationsetup/visitor.php
diff --git a/application/controllers/Stationsetup.php b/application/controllers/Stationsetup.php
index c95bf6008..f724baf3f 100644
--- a/application/controllers/Stationsetup.php
+++ b/application/controllers/Stationsetup.php
@@ -172,6 +172,24 @@ class Stationsetup extends CI_Controller {
$this->stationsetup_model->saveContainer();
}
+ public function editLinkedLocations() {
+ $this->load->model('logbooks_model');
+ $station_logbook_details_query = $this->logbooks_model->logbook(xss_clean($this->input->post('id', true)));
+ $data['station_logbook_details'] = $station_logbook_details_query->row();
+ $data['station_locations_linked'] = $this->logbooks_model->list_logbooks_linked($this->input->post('id', true));
+ $data['page_title'] = "Edit lined locations";
+ $this->load->view('stationsetup/linkedlocations', $data);
+ }
+
+ public function editVisitorLink() {
+ $this->load->model('logbooks_model');
+ $station_logbook_details_query = $this->logbooks_model->logbook(xss_clean($this->input->post('id', true)));
+ $data['station_logbook_details'] = $station_logbook_details_query->row();
+ $data['station_locations_list'] = $this->stations->all_of_user();
+ $data['page_title'] = "Edit visitor site";
+ $this->load->view('stationsetup/visitor', $data);
+ }
+
public function newLocation() {
$this->load->model('stations');
$this->load->model('dxcc');
diff --git a/application/views/stationsetup/linkedlocations.php b/application/views/stationsetup/linkedlocations.php
new file mode 100644
index 000000000..c54087dde
--- /dev/null
+++ b/application/views/stationsetup/linkedlocations.php
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+
+ |
+ |
+ |
+ |
+
+
+
+ result() as $row) {
+ ?>
+
+ | station_profile_name;?> |
+ station_callsign;?> |
+ station_country; if ($row->end != NULL) { echo ' '.lang('gen_hamradio_deleted_dxcc').''; } ?> |
+ |
+
+
+
+ |
+ |
+ |
+ |
+
+
+
+
+
+
+
diff --git a/application/views/stationsetup/stationsetup.php b/application/views/stationsetup/stationsetup.php
index 6ac5fa50d..8643c4152 100644
--- a/application/views/stationsetup/stationsetup.php
+++ b/application/views/stationsetup/stationsetup.php
@@ -47,7 +47,7 @@
}?>
-
+
|
session->userdata('active_station_logbook') != $row->logbook_id) { ?>
@@ -57,7 +57,7 @@
|
- class="btn btn-outline-primary btn-sm">
+
public_slug != '') { ?>
public_slug; ?>"
diff --git a/application/views/stationsetup/visitor.php b/application/views/stationsetup/visitor.php
new file mode 100644
index 000000000..0d68aa9b3
--- /dev/null
+++ b/application/views/stationsetup/visitor.php
@@ -0,0 +1,28 @@
+
+
+
+ /
+
+
+
+ public_slug != "") { ?>
+
+
+
diff --git a/assets/js/sections/stationsetup.js b/assets/js/sections/stationsetup.js
index 9cea13d6a..880feb70c 100644
--- a/assets/js/sections/stationsetup.js
+++ b/assets/js/sections/stationsetup.js
@@ -63,6 +63,14 @@ $(document).ready(function () {
saveContainerName(e);
});
+ $(document).on('click', '.editLinkedLocations', async function (e) { // Dynamic binding, since element doesn't exists when loading this JS
+ editLinkedLocations(e);
+ });
+
+ $(document).on('click', '.editVisitorLink', async function (e) { // Dynamic binding, since element doesn't exists when loading this JS
+ editVisitorLink(e);
+ });
+
$("#station_logbooks_table").DataTable({
stateSave: true,
@@ -145,6 +153,82 @@ $(document).ready(function () {
}
+ function editLinkedLocations(e) {
+ $.ajax({
+ url: base_url + 'index.php/stationsetup/editLinkedLocations',
+ type: 'post',
+ data: {
+ id: e.currentTarget.id,
+ },
+ success: function (data) {
+ BootstrapDialog.show({
+ title: 'Edit linked locations',
+ size: BootstrapDialog.SIZE_WIDE,
+ cssClass: 'options',
+ id: "NewStationLogbookModal",
+ nl2br: false,
+ message: data,
+ onshown: function(dialog) {
+ },
+ buttons: [{
+ label: 'Save',
+ cssClass: 'btn-primary btn-sm',
+ },
+ {
+ label: lang_admin_close,
+ cssClass: 'btn-sm',
+ id: 'closeButton',
+ action: function (dialogItself) {
+ dialogItself.close();
+ }
+ }],
+ });
+ },
+ error: function (data) {
+
+ },
+ });
+ return false;
+ }
+
+ function editVisitorLink(e) {
+ $.ajax({
+ url: base_url + 'index.php/stationsetup/editVisitorLink',
+ type: 'post',
+ data: {
+ id: e.currentTarget.id,
+ },
+ success: function (data) {
+ BootstrapDialog.show({
+ title: 'Edit visitor link',
+ size: BootstrapDialog.SIZE_NORMAL,
+ cssClass: 'options',
+ id: "NewStationLogbookModal",
+ nl2br: false,
+ message: data,
+ onshown: function(dialog) {
+ },
+ buttons: [{
+ label: 'Save',
+ cssClass: 'btn-primary btn-sm',
+ },
+ {
+ label: lang_admin_close,
+ cssClass: 'btn-sm',
+ id: 'closeButton',
+ action: function (dialogItself) {
+ dialogItself.close();
+ }
+ }],
+ });
+ },
+ error: function (data) {
+
+ },
+ });
+ return false;
+ }
+
function reloadLogbooks() {
$.ajax({
|