Starting export implementation.

This commit is contained in:
Yaro Kasear 2025-07-15 14:42:20 -05:00
parent 71276f9f4b
commit e6847d0504
2 changed files with 10 additions and 3 deletions

View file

@ -49,7 +49,8 @@ def list_inventory():
breadcrumb=[{'label': 'Inventory', 'url': url_for('main.inventory_index')}], breadcrumb=[{'label': 'Inventory', 'url': url_for('main.inventory_index')}],
header=inventory_headers, header=inventory_headers,
rows=[{"id": item.id, "cells": [row_fn(item) for row_fn in inventory_headers.values()]} for item in inventory], rows=[{"id": item.id, "cells": [row_fn(item) for row_fn in inventory_headers.values()]} for item in inventory],
entry_route = 'inventory_item' entry_route = 'inventory_item',
table=inventory
) )
@main.route("/inventory/index") @main.route("/inventory/index")
@ -206,6 +207,10 @@ def delete_inventory_item(id):
db.session.rollback() db.session.rollback()
return jsonify({"success": False, "error": str(e)}), 400 return jsonify({"success": False, "error": str(e)}), 400
@main.route("/api/inventory/export", methods=["GET"])
def get_inventory_csv():
return "Oh boy!"
@main.route("/inventory_available") @main.route("/inventory_available")
def inventory_available(): def inventory_available():
query = eager_load_inventory_relationships(db.session.query(Inventory).filter(Inventory.condition == "Working")) query = eager_load_inventory_relationships(db.session.query(Inventory).filter(Inventory.condition == "Working"))

View file

@ -7,10 +7,12 @@
{% set createButtonLogic %} {% set createButtonLogic %}
window.location.href = '/{{ entry_route }}/new'; window.location.href = '/{{ entry_route }}/new';
{% endset %} {% endset %}
{% set exportButtonLogic %}
{% endset %}
{% set toolbarButtons %} {% set toolbarButtons %}
<div class="btn-group"> <div class="btn-group">
{{ buttons.render_button(id='export', icon='box-arrow-up', style='outline-primary rounded-start') }} {{ buttons.render_button(id='export', icon='box-arrow-up', style='outline-primary rounded-start', logic=exportButtonLogic) }}
{{ buttons.render_button(id='import', icon='box-arrow-in-down', style='outline-primary') }} {{ buttons.render_button(id='import', icon='box-arrow-in-down', style='outline-primary', logic='alert("Not implemented yet!")') }}
{{ buttons.render_button(id='create', icon='plus-lg', logic=createButtonLogic, style='outline-primary rounded-end') }} {{ buttons.render_button(id='create', icon='plus-lg', logic=createButtonLogic, style='outline-primary rounded-end') }}
</div> </div>
{% endset %} {% endset %}