def thingsTableWriter(): things = Things() location = things.search_locations() code = request.form['code1'] loca_id = request.form['location2'] if loca_id != "0" and code == "": dados = things.search_things_inactives_by_location(loca_id) if dados == False: msg = "Objects not found." return render_template('/writer.html', locations=location, message=msg) elif loca_id == "0" and code != "": dados = [] dados.append(things.search_things_by_num1(code)) if dados[0] == False: msg = "Objects not found." return render_template('/writer.html', locations=location, message=msg) else: msg = "Please, Enter a Code or Location to Write." return render_template('/writer.html', locations=location, message=msg) return render_template('/writer.html', locations=location, dado=dados)
def thingsTableReader(): things = Things() location = things.search_locations() loca_id = request.form['location1'] if loca_id != "0": #chama metodo de leitura print("Inserir função de leitura") txt = "Waiting for Reading ..." else: msg = "Please, Select a Location to Read." return render_template('/reader.html', locations=location, message=msg) return render_template('/reader.html', locations=location, texto=txt)
def search_locations(token): # valida token user = User() resp = user.verify_token(token) if resp == False: return jsonify({'response': 'Token Invalido'}) elif resp == 'ERRO': return jsonify({'response': 'Erro ao verificar token'}) things = Things() response = things.search_locations() if response == False: return jsonify({'response': 'Nenhuma localizacao encontrada'}) elif response == 'ERRO': return jsonify({'response': 'Ocorreu um erro no servidor'}) else: return json.dumps(para_dict(response))
def listLocationWriter(): things = Things() location = things.search_locations() return render_template('/writer.html', locations=location)
def thingsTable(): things = Things() location = things.search_locations() loca_id = request.form['location'] status = request.form['status'] if loca_id == "0" and status == "1": thingsdata = things.search_all_things_actives() if thingsdata == False: msg = "Object not found." return render_template('/things.html', location=location, message=msg) elif loca_id == "0" and status == "2": thingsdata = things.search_all_things_inactives() if thingsdata == False: msg = "Object not found." return render_template('/things.html', location=location, message=msg) elif loca_id != "0" and status == "0": thingsdata = things.search_things_by_location(loca_id) if thingsdata == False: msg = "Object not found." return render_template('/things.html', location=location, message=msg) elif loca_id != "0" and status == "1": thingsdata = things.search_things_actives_by_location(loca_id) if thingsdata == False: msg = "Object not found." return render_template('/things.html', location=location, message=msg) elif loca_id != "0" and status == "2": thingsdata = things.search_things_inactives_by_location(loca_id) if thingsdata == False: msg = "Object not found." return render_template('/things.html', location=location, message=msg) elif loca_id == "0" and status == "0": msg = "Please select a Location or Status for consultation. Or, if you prefer, select both." return render_template('/things.html', location=location, message=msg) # thingsData = things.search_things_by_location (loca_id) return render_template('/things.html', thingsdata=thingsdata, location=location)
def locations(): things = Things() location = things.search_locations() return render_template('/things.html', location=location)