Added container dropdown. Modified container-dropdown onchange event.

master
Davide Bongiovanni 6 years ago
parent 3788060c78
commit 863ce49e98

@ -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('<option val="' + location_id + '">' + location_name + '</option>');
});
}
});
}

@ -44,11 +44,14 @@
<table id="details">
<tr id="location-head"><td>LOCATION</td></tr>
<tr id="location"><td><p></p>
<select class="pinfo-input" onchange="update_map()">
<select class="pinfo-input" id="container-dorpdown" onchange="container_onchange()">
{% for container in containers %}
<option value="{{container['id']}}">{{container['name']}}</option>
{% endfor %}
</select>
<select id="location-dropdown">
<option value="-1">-- Select a container --</option>
</select>
</td></tr>
<tr id="partno-head"><td>PART NUMBER</td></tr>
<tr id="partno"><td><p></p><input type="text" name="partno-input" placeholder="Part Number" class="pinfo-input"/></td></tr>

Loading…
Cancel
Save