From 0143e79fa61fe367a607ade188169d3acb1437bf Mon Sep 17 00:00:00 2001 From: abarrau Date: Wed, 13 Dec 2023 22:54:04 +0100 Subject: [PATCH] on map custom, date to can't be big than date from --- application/controllers/Map.php | 3 +-- application/models/Logbook_model.php | 2 +- application/views/interface_assets/footer.php | 23 ++++++++++++------- application/views/map/custom_date.php | 2 +- 4 files changed, 18 insertions(+), 12 deletions(-) diff --git a/application/controllers/Map.php b/application/controllers/Map.php index 717648e3..5fffb50d 100644 --- a/application/controllers/Map.php +++ b/application/controllers/Map.php @@ -79,8 +79,7 @@ class Map extends CI_Controller { $data['logbook_name'] = $logbook_name; $data['page_title'] = "Map QSOs"; - $data['date_from'] = date('Y-m-d'); - $data['date_to'] = date('Y-m-d', strtotime($data['date_from'].' +1days')); + $data['date_from'] = $data['date_to'] = date('Y-m-d'); $this->load->view('interface_assets/header', $data); $this->load->view('map/custom_date'); diff --git a/application/models/Logbook_model.php b/application/models/Logbook_model.php index 9dfca72b..765bf4cd 100755 --- a/application/models/Logbook_model.php +++ b/application/models/Logbook_model.php @@ -2113,7 +2113,7 @@ function check_if_callsign_worked_in_logbook($callsign, $StationLocationsArray = } $this->db->join('dxcc_entities', $this->config->item('table_name').'.col_dxcc = dxcc_entities.adif', 'left'); - $this->db->where("COL_TIME_ON BETWEEN '".$start."' AND '".$end."'"); + $this->db->where("COL_TIME_ON BETWEEN '".$start." 00:00:00' AND '".$end." 23:59:59'"); $this->db->where_in("station_id", $logbooks_locations_array); if($band != "All" && $band != "SAT") { diff --git a/application/views/interface_assets/footer.php b/application/views/interface_assets/footer.php index ba981d84..0b76acfd 100644 --- a/application/views/interface_assets/footer.php +++ b/application/views/interface_assets/footer.php @@ -750,16 +750,23 @@ function showActivatorsMap(call, count, grids) { var grid = "No"; initmap(grid, 'custommap', {'initmap_only':true}); + // Check and change date if to < from // + $('.custom-map-QSOs input[name="to"]').off('change').on('change', function() { + if ($('.custom-map-QSOs input[name="to"]').val().replaceAll('-','') < $('.custom-map-QSOs input[name="from"]').val().replaceAll('-','')) { + $('.custom-map-QSOs input[name="from"]').val($('.custom-map-QSOs input[name="to"]').val()); + } + }); + $('.custom-map-QSOs input[name="from"]').off('change').on('change', function() { + if ($('.custom-map-QSOs input[name="from"]').val().replaceAll('-','') > $('.custom-map-QSOs input[name="to"]').val().replaceAll('-','')) { + $('.custom-map-QSOs input[name="to"]').val($('.custom-map-QSOs input[name="from"]').val()); + } + }); // Form "submit" // $('.custom-map-QSOs .btn_submit_map_custom').off('click').on('click',function() { - if ($('.custom-map-QSOs input[name="from"]').val().replaceAll('-','') <= $('.custom-map-QSOs input[name="to"]').val().replaceAll('-','')) { - var customdata = {'dataPost':{'date_from': $('.custom-map-QSOs input[name="from"]').val(), 'date_to': $('.custom-map-QSOs input[name="to"]').val(), - 'band': $('.custom-map-QSOs select[name="band"]').val(), 'mode': $('.custom-map-QSOs select[name="mode"]').val(), - 'prop_mode': $('.custom-map-QSOs select[name="prop_mode"]').val(), 'isCustom':true }, 'map_id':'#custommap'}; - initplot(qso_loc, customdata); - } else { - // TODO - } + var customdata = {'dataPost':{'date_from': $('.custom-map-QSOs input[name="from"]').val(), 'date_to': $('.custom-map-QSOs input[name="to"]').val(), + 'band': $('.custom-map-QSOs select[name="band"]').val(), 'mode': $('.custom-map-QSOs select[name="mode"]').val(), + 'prop_mode': $('.custom-map-QSOs select[name="prop_mode"]').val(), 'isCustom':true }, 'map_id':'#custommap'}; + initplot(qso_loc, customdata); }) diff --git a/application/views/map/custom_date.php b/application/views/map/custom_date.php index a5556b3b..ecc255df 100644 --- a/application/views/map/custom_date.php +++ b/application/views/map/custom_date.php @@ -17,7 +17,7 @@
- +