missing-part-reporting
Marek Baczynski 2 years ago
parent 4988f0eebd
commit e21ec9065d

@ -164,7 +164,7 @@ def alterUser(userID):
@app.route(baseURL+'/getpartinfo/<partID>') @app.route(baseURL+'/getpartinfo/<partID>')
def get_part_info(partID): def get_part_info(partID):
s = 'select p.id,partno,description,notes, c.name || l.name as location_descriptor, location_id, container_id, datasheet, EXTRACT(EPOCH from now()-reported_missing) as missing_for 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,notes,EXTRACT(EPOCH from now()-reported_missing) as missing_for, 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) r = db_engine.execute(text(s), id=partID)
l = [] l = []
for row in r: for row in r:

@ -149,10 +149,11 @@ function report_missing(partID, missing){
var data = new FormData(); var data = new FormData();
data.append('partID', partID); data.append('partID', partID);
if(missing){ if(missing){
data.append('missing', 'missing') missing = 'missing'
}else{ }else{
data.append('missing', 'found') missing = 'found'
} }
data.append('missing', missing)
$.ajax({ $.ajax({
url: rootURL + 'report_missing', url: rootURL + 'report_missing',
type: 'POST', type: 'POST',
@ -161,7 +162,7 @@ function report_missing(partID, missing){
contentType: false, contentType: false,
processData: false, processData: false,
success: function(data) { success: function(data) {
alert("Thank you for reporting part as " + missing "."); alert("Thank you for reporting part as " + missing + ".");
}, },
error: function() { error: function() {
alert("Couldn't update the part information. Please retry."); alert("Couldn't update the part information. Please retry.");

Loading…
Cancel
Save