Fixed minor issues

master
Davide Bongiovanni 6 years ago
parent 2efb06ef3c
commit 6670487ac0

@ -112,7 +112,7 @@ def alterLocation(locationID):
@app.route('/parts/getpartinfo/<partID>')
def get_part_info(partID):
s = 'select p.id,partno,description, c.name || l.name as location_descriptor, location_id, container_id datasheet from parts as p inner join locations as l on p.location_id = l.id inner join containers as c on l.container_id = c.id where p.id = :id;'
s = 'select p.id,partno,description, c.name || l.name as location_descriptor, location_id, container_id, datasheet from parts as p inner join locations as l on p.location_id = l.id inner join containers as c on l.container_id = c.id where p.id = :id;'
r = db_engine.execute(text(s), id=partID)
l = []
for row in r:

@ -187,20 +187,13 @@ function perform_query() {
}
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>');
});
}
$.getJSON('parts/getlocationsInContainer/' + selected_container_id, function(data) {
$.each(data, function(location_id, location_name) {
$('#location-dropdown').append('<option val="' + location_id + '">' + location_name + '</option>');
});
});
}

@ -44,13 +44,13 @@
<table id="details">
<tr id="location-head"><td>LOCATION</td></tr>
<tr id="location"><td><p></p>
<select class="pinfo-input" id="container-dorpdown" onchange="container_onchange()">
<select class="pinfo-input" id="container-dropdown" 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>
<option value="-1" selected="true">-- Select a container --</option>
</select>
</td></tr>
<tr id="partno-head"><td>PART NUMBER</td></tr>

Loading…
Cancel
Save