diff --git a/routes.py b/routes.py index a99296b..b39e427 100644 --- a/routes.py +++ b/routes.py @@ -61,7 +61,7 @@ worklog_headers = { "Start Time": lambda i: {"text": i.start_time.strftime("%Y-%m-%d")}, "End Time": lambda i: {"text": i.end_time.strftime("%Y-%m-%d")} if i.end_time else {"text": None}, "Complete?": lambda i: {"text": i.complete, "type": "bool", "html": checked_box if i.complete else unchecked_box}, - "Follow Up?": lambda i: {"text": i.followup, "type": "bool", "html": checked_box if i.followup else unchecked_box}, + "Follow Up?": lambda i: {"text": i.followup, "type": "bool", "html": checked_box if i.followup else unchecked_box, "highlight": i.followup}, "Quick Analysis?": lambda i: {"text": i.analysis, "type": "bool", "html": checked_box if i.analysis else unchecked_box}, } @@ -136,13 +136,13 @@ def index(): worklog_query = eager_load_worklog_relationships( db.session.query(WorkLog) ).filter( - (WorkLog.start_time < cutoff) & (WorkLog.complete == False) + (WorkLog.complete == False) ) - stale_worklogs = worklog_query.all() + active_worklogs = worklog_query.all() - stale_count = len(stale_worklogs) - stale_worklog_headers = { + active_count = len(active_worklogs) + active_worklog_headers = { k: v for k, v in worklog_headers.items() if k not in ['End Time', 'Quick Analysis?', 'Complete?', 'Follow Up?'] } @@ -179,15 +179,28 @@ def index(): 'name': 'Inventory Conditions' }] + active_worklog_rows = [] + for log in active_worklogs: + # Create a dictionary of {column name: cell dict} + cells_by_key = {k: fn(log) for k, fn in worklog_headers.items()} + + # Use original, full header set for logic + highlight = cells_by_key.get("Follow Up?", {}).get("highlight", False) + + # Use only filtered headers — and in exact order + cells = [cells_by_key[k] for k in active_worklog_headers] + + active_worklog_rows.append({ + "id": log.id, + "cells": cells, + "highlight": highlight + }) + return render_template( "index.html", - title="Inventory Manager", - stale_count=stale_count, - stale_worklog_headers=stale_worklog_headers, - stale_worklog_rows=[{ - "id": log.id, - "cells": [fn(log) for fn in stale_worklog_headers.values()] - } for log in stale_worklogs], + active_count=active_count, + active_worklog_headers=active_worklog_headers, + active_worklog_rows=active_worklog_rows, labels=labels, datasets=datasets ) @@ -416,3 +429,8 @@ def search(): } return render_template('search.html', title=f"Database Search ({query})" if query else "Database Search", results=results, query=query) + +@main.route('/settings') +def settings(): + brands = db.session.query(Brand).order_by(Brand.name).all() + return render_template('settings.html', title="Settings", brands=brands) diff --git a/templates/form.html b/templates/form.html deleted file mode 100644 index d84a94f..0000000 --- a/templates/form.html +++ /dev/null @@ -1,8 +0,0 @@ - -{% extends "layout.html" %} - -{% block title %}{{ title }}{% endblock %} - -{% block content %} - -{% endblock %} diff --git a/templates/fragments/_icon_fragment.html b/templates/fragments/_icon_fragment.html index 877b2cd..1258994 100644 --- a/templates/fragments/_icon_fragment.html +++ b/templates/fragments/_icon_fragment.html @@ -1,3 +1,13 @@ +{% macro gear(size=24) %} + + + + +{% endmacro %} + {% macro home(size=24) %} @@ -23,8 +33,8 @@ {% endmacro %} {% macro link(size=24) %} - + {% endmacro %} +{% macro minus(size=24) %} + + + +{% endmacro %} + {% macro motherboard(size=24) %} @@ -60,6 +77,14 @@ {% endmacro %} +{% macro plus(size=24) %} + + + +{% endmacro %} + {% macro search(size=24) %} diff --git a/templates/fragments/_table_fragment.html b/templates/fragments/_table_fragment.html index 82d7fd3..6f8e96c 100644 --- a/templates/fragments/_table_fragment.html +++ b/templates/fragments/_table_fragment.html @@ -16,7 +16,7 @@ {% for row in rows %}
+ style="cursor: pointer;"{% endif %}{% if row['highlight'] %} class="table-info"{% endif %}> {% for cell in row.cells %} {% if cell.type == 'bool' %} diff --git a/templates/index.html b/templates/index.html index 170afd9..446f0e3 100644 --- a/templates/index.html +++ b/templates/index.html @@ -8,17 +8,16 @@

Welcome to Inventory Manager

Find out about all of your assets.

- {% if stale_worklog_rows %} + {% if active_worklog_rows %}
-
Stale Worklogs
-
You have {{ stale_count }} worklogs - that need attention!
+
Active Worklogs
+
You have {{ active_count }} active worklogs.
{{ tables.render_table( - headers = stale_worklog_headers, - rows = stale_worklog_rows, - id = 'Stale Worklog', + headers = active_worklog_headers, + rows = active_worklog_rows, + id = 'Active Worklog', entry_route = 'worklog_entry', per_page = 10 )}} diff --git a/templates/inventory.html b/templates/inventory.html index 33c0ee2..1e5e10e 100644 --- a/templates/inventory.html +++ b/templates/inventory.html @@ -96,9 +96,10 @@ submit_button=True) }}
diff --git a/templates/inventory_index.html b/templates/inventory_index.html index bed8177..71a21de 100644 --- a/templates/inventory_index.html +++ b/templates/inventory_index.html @@ -10,21 +10,13 @@ title=title
{% if not category %} -
-
-

Find

-
-
-
- {{ links.category_link(endpoint = 'search', label = 'Search', icon_html = icons.search(32)) }} - {{ links.category_link(endpoint = 'list_inventory', label = "List", icon_html = icons.table(32)) }} -

Browse

+ {{ links.category_link(endpoint = 'list_inventory', label = "Full Listing", icon_html = icons.table(32)) }} {{ links.category_link(endpoint = 'inventory_index', label = "By User", icon_html = icons.user(32), arguments = {'category': 'user'}) }} {{ links.category_link(endpoint = 'inventory_index', label = 'By Location', icon_html = icons.map(32), arguments = {'category': 'location'}) }} {{ links.category_link(endpoint = 'inventory_index', label = 'By Type', icon_html = icons.motherboard(32), arguments = {'category': 'type'}) }} diff --git a/templates/layout.html b/templates/layout.html index 1b49fd4..c6fb91d 100644 --- a/templates/layout.html +++ b/templates/layout.html @@ -10,7 +10,7 @@ - {% block title %}Inventory{% endblock %} + Inventory Manager{% if title %} - {% endif %}{% block title %}{% endblock %} +
@@ -66,7 +69,7 @@ - +