fixed path added javascript
This commit is contained in:
+3
-1
@@ -316,8 +316,10 @@ def alter(partID):
|
|||||||
r.close()
|
r.close()
|
||||||
return '{"status":"ok", "part_id" : ' + str(new_id) + '}'
|
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():
|
def report_missing():
|
||||||
|
if 'partID' not in request.form:
|
||||||
|
return '{"status":"fail"}'
|
||||||
partID = request.form['partID']
|
partID = request.form['partID']
|
||||||
missing = True if request.form['missing']=='missing' else False #must be "missing" or "found"
|
missing = True if request.form['missing']=='missing' else False #must be "missing" or "found"
|
||||||
if missing:
|
if missing:
|
||||||
|
|||||||
@@ -145,6 +145,31 @@ function save(partID) {
|
|||||||
perform_query();
|
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) {
|
function text_filter(string) {
|
||||||
if (string != null)
|
if (string != null)
|
||||||
return string;
|
return string;
|
||||||
|
|||||||
Reference in New Issue
Block a user