From 3a90e523f253586608e740105333b4a7ecb19a21 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 14 Sep 2025 16:28:28 +0000 Subject: [PATCH] Implement logbook/location quick switcher UI for main logbook view Co-authored-by: magicbug <84308+magicbug@users.noreply.github.com> --- application/controllers/Logbook.php | 5 +++ application/controllers/Logbooks.php | 36 +++++++++++++++ application/views/view_log/index.php | 64 ++++++++++++++++++++++++++- cloudlog-switcher-both-changed.png | Bin 0 -> 41071 bytes cloudlog-switcher-changed.png | Bin 0 -> 40865 bytes cloudlog-switcher-demo.png | Bin 0 -> 40646 bytes 6 files changed, 104 insertions(+), 1 deletion(-) create mode 100644 cloudlog-switcher-both-changed.png create mode 100644 cloudlog-switcher-changed.png create mode 100644 cloudlog-switcher-demo.png diff --git a/application/controllers/Logbook.php b/application/controllers/Logbook.php index 2ed4684b..0eb0c665 100644 --- a/application/controllers/Logbook.php +++ b/application/controllers/Logbook.php @@ -35,6 +35,7 @@ class Logbook extends CI_Controller } $this->load->model('logbook_model'); + $this->load->model('logbooks_model'); $this->load->library('pagination'); $config['base_url'] = base_url() . 'index.php/logbook/index/'; @@ -72,6 +73,10 @@ class Logbook extends CI_Controller + // Get available logbooks and stations for the switcher + $data['available_logbooks'] = $this->logbooks_model->show_all(); + $data['available_stations'] = $this->stations->all_of_user(); + // load the view $data['page_title'] = "Logbook"; diff --git a/application/controllers/Logbooks.php b/application/controllers/Logbooks.php index d99baa8b..70457660 100644 --- a/application/controllers/Logbooks.php +++ b/application/controllers/Logbooks.php @@ -183,4 +183,40 @@ class Logbooks extends CI_Controller { } } + public function switch_logbook_location() { + $this->load->model('logbooks_model'); + $this->load->model('stations'); + + $logbook_id = $this->input->post('logbook_id'); + $station_id = $this->input->post('station_id'); + + $success = true; + $messages = array(); + + // Switch logbook if provided and different from current + if ($logbook_id && $logbook_id != $this->session->userdata('active_station_logbook')) { + $this->logbooks_model->set_logbook_active($logbook_id); + $messages[] = 'Logbook switched to: ' . $this->logbooks_model->find_name($logbook_id); + } + + // Switch station location if provided and different from current + if ($station_id && $station_id != $this->stations->find_active()) { + $current_station = $this->stations->find_active(); + $this->stations->set_active($current_station, $station_id); + $station_name = $this->stations->profile_clean($station_id); + $messages[] = 'Location switched to: ' . $station_name->station_profile_name; + } + + // Update session data + $this->user_model->update_session($this->session->userdata('user_id')); + + // Set flash message + if (!empty($messages)) { + $this->session->set_flashdata('notice', implode('. ', $messages)); + } + + // Redirect back to logbook view + redirect('logbook'); + } + } diff --git a/application/views/view_log/index.php b/application/views/view_log/index.php index 5cd0afa1..fe8b6128 100644 --- a/application/views/view_log/index.php +++ b/application/views/view_log/index.php @@ -1,7 +1,42 @@
: logbooks_model->find_name($this->session->userdata('active_station_logbook')); ?> : stations->find_name(); ?>
++ : logbooks_model->find_name($this->session->userdata('active_station_logbook')); ?> + : stations->find_name(); ?> +
+Ofqe2CyH+u4hQ5&9%>NBi;G6)t+3sW2m5FyG%_dg>zx{*wivl89-rm=?U
zpjf5RB&(!boyN;}erbc@PKis1Th0u+5G}^5Mej##Quha%y7qhxEOg5m82tBfUR~Sz
zHW`@){BduzN}@)ED$Nd5qTdW7jye*9xYgo6oU{55WczWO%l^+S!e+3abv5I2DD+V{
z*{k&(T4Ubw>|4WCa4&MnUPggqFZ2$U%gpqYA*NH!uInV7qPChgn;%GOFY`%S`x3WY
z-rw&cpZq3mCOK1ehot%=>F)mePgl)9+o2b3HV=y(TlhGIG5vO^x2raXbQ4AnM(uIX
zvA7}r=|QE@O8QcDZf$Sk>oj;=xAGhM8<&uq0Pm!e@BCsr_xg>~C@t%I`bdJSv0ZAO
z#tGG2Z>ZoOCj~Uig|V$T)83D0jHtDmv5lxe#gk+OhUmK%HnK6D=OPlFFU&+!-p<5^
zVifN)%OLC>N=68*1soQpa4>t~j_dcNS_=5o-GvnSh!!f3J4;)+AfCG4tgA3k$B>rz
z>`}c`{&$7KWusa{+^Id)3Ou6Zge>--FPd`I-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