fixed path added javascript

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

@ -316,8 +316,10 @@ def alter(partID):
r.close()
return '{"status":"ok", "part_id" : ' + str(new_id) + '}'
@app.route(baseURL+'/parts/report_missing/', methods=['POST'])
@app.route(baseURL+'/report_missing', methods=['POST'])
def report_missing():
if 'partID' not in request.form:
return '{"status":"fail"}'
partID = request.form['partID']
missing = True if request.form['missing']=='missing' else False #must be "missing" or "found"
if missing:

@ -145,6 +145,31 @@ function save(partID) {
perform_query();
}
function report_missing(partID, missing){
var data = new FormData();
data.append('partID', partID);
if(missing){
data.append('missing', 'missing')
}else{
data.append('missing', 'found')
}
$.ajax({
url: rootURL + 'report_missing',
type: 'POST',
data: data,
cache: false,
contentType: false,
processData: false,
success: function(data) {
alert("Thank you for reporting part as " + missing ".");
},
error: function() {
alert("Couldn't update the part information. Please retry.");
}
});
}
function text_filter(string) {
if (string != null)
return string;

Loading…
Cancel
Save