Beispiel #1
0
def manage_equipment():
    form = forms.AddEquipmentForm(request.form)
    if request.method == 'POST' and form.validate():
        if not database.add_equipment(form.equipment_title.data, form.equipment_code.data, form.equipment_group.data):
            flash("Unable to add equipment.", "danger")
        return redirect(url_for("admin_routes.manage_equipment"))
    return render_template("admin/manage_equipment.html", form=form, equipment=database.get_all_equipment())
Beispiel #2
0
 def __init__(self, *args, **kwargs):
     super(EquipmentAddToWorkshopForm, self).__init__(*args, **kwargs)
     self.equipment_name.choices = [(str(equipment.equipment_id),
                                     equipment.equipment_name)
                                    for equipment in get_all_equipment()]
Beispiel #3
0
def manage_inventory(inventory_id):
    #equipment = database.get_all_equipment(manual_add_only=True)
    equipment = database.get_all_equipment(manual_add_only=False)
    return render_template("admin/inventory.html", equipment=equipment)
def get_equipment(token):
    if token in api_keys:
        equipment = database.get_all_equipment()
        data = ([dict(equipment_id=e.equipment_id, equipment_name=e.equipment_name, equipment_code=e.equipment_code, equipment_entries=[dict(equipment_entry_id=ee.equipment_entry_id, equipment_entry_number=str(ee.equipment_entry_number).zfill(3)) for ee in e.equipment_entries]) for e in equipment])
        data = json.dumps(data)
        return data