From 863ce49e989dd60fe8e35620617e3d211e3593b1 Mon Sep 17 00:00:00 2001 From: Davide Bongiovanni Date: Sun, 11 Nov 2018 20:45:08 +0100 Subject: [PATCH] Added container dropdown. Modified container-dropdown onchange event. --- parts/static/script.js | 19 +++++++++++++++---- parts/templates/partsearch.html | 5 ++++- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/parts/static/script.js b/parts/static/script.js index 73c23a9..21a0273 100644 --- a/parts/static/script.js +++ b/parts/static/script.js @@ -186,10 +186,21 @@ function perform_query() { }); } -function update_map() { - var selected_id = $('table#details tr#location td select').val(); - $.ajax('parts/getlocationURL/' + selected_id).done( function(data) { - $('img#map').attr('src', 'parts/map/' + data); +function container_onchange() { + // var selected_id = $('table#details tr#location td select').val(); + // $.ajax('parts/getlocationURL/' + selected_id).done( function(data) { + // $('img#map').attr('src', 'parts/map/' + data); + // }); + var selected_container_id = $('#container-dropdown').val(); + $('img#map').attr('src', 'parts/map/' + selected_container_id); + $('#location-dropdown').empty(); + $.ajax({ + url:'parts/getlocationsInContainer/', + success: function(data) { + $.each(data, function(location_id, location_name) { + $('#location-dropdown').append(''); + }); + } }); } diff --git a/parts/templates/partsearch.html b/parts/templates/partsearch.html index bd531ad..a5f7558 100644 --- a/parts/templates/partsearch.html +++ b/parts/templates/partsearch.html @@ -44,11 +44,14 @@
LOCATION

- {% for container in containers %} {% endfor %} +
PART NUMBER