From 5fbf307650eeaf074c451aad86ba121f1b53657d Mon Sep 17 00:00:00 2001 From: Andreas <6977712+AndreasK79@users.noreply.github.com> Date: Mon, 11 Oct 2021 19:36:52 +0200 Subject: [PATCH] [Advanced search] Adds dropdown if not exist when storing queries. Also removes dropdown if empty after delete. --- application/views/interface_assets/footer.php | 20 +++++++++++++++++-- application/views/search/filter.php | 8 +++++--- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/application/views/interface_assets/footer.php b/application/views/interface_assets/footer.php index 50778f32..ec156bd8 100644 --- a/application/views/interface_assets/footer.php +++ b/application/views/interface_assets/footer.php @@ -156,6 +156,18 @@ function load_was_map() { .done(function(data) { $(".alert").remove(); $(".card-body.main").append('
×Your query has been saved!
'); + if ($("#querydropdown option").length == 0) { + var dropdowninfo = '

' + + '
' + + '' + + '
' + + '' + + '
' + + '' + + '
'; + $("#btn-save").after(dropdowninfo); + } $('#querydropdown').append(new Option(data.description, data.id)); // We add the saved query to the dropdown }); } @@ -237,6 +249,10 @@ function load_was_map() { $(".bootstrap-dialog-message").prepend('
×The stored query has been deleted!
'); $("#query_" + id).remove(); // removes query from table in dialog $("#querydropdown option[value='" + id + "']").remove(); // removes query from dropdown + if ($("#querydropdown option").length == 0) { + $("#btn-edit").remove(); + $('.querydropdownform').remove(); + }; }, error: function() { $(".bootstrap-dialog-message").prepend('
×The stored query could not be deleted. Please try again!
'); @@ -274,7 +290,7 @@ function load_was_map() { }); } - $('#btn-edit').on('click', function() { + function edit_stored_query_dialog() { $(".alert").remove(); $.ajax({ url: base_url + 'index.php/search/get_stored_queries', @@ -295,7 +311,7 @@ function load_was_map() { }); } }); - }); + } $('#btn-get').on('click', function() { $(".alert").remove(); diff --git a/application/views/search/filter.php b/application/views/search/filter.php index 9b654175..e4c632df 100644 --- a/application/views/search/filter.php +++ b/application/views/search/filter.php @@ -37,10 +37,10 @@ -

+

-
+