More layout improvements to inventory.

This commit is contained in:
Yaro Kasear 2025-07-14 12:35:04 -05:00
parent 5f7354c055
commit a87dbc6b81
3 changed files with 27 additions and 10 deletions

View file

@ -95,6 +95,7 @@ def inventory_item(id):
rooms = eager_load_room_relationships(db.session.query(Room).order_by(Room.name)).all()
worklog_query = db.session.query(WorkLog).filter(WorkLog.work_item_id == id)
worklog = eager_load_worklog_relationships(worklog_query).all()
notes = [note for log in worklog for note in log.updates]
types = db.session.query(Item).order_by(Item.description).all()
filtered_worklog_headers = {k: v for k, v in worklog_headers.items() if k not in ['Work Item', 'Contact', 'Follow Up?', 'Quick Analysis?']}
@ -113,7 +114,8 @@ def inventory_item(id):
worklog=worklog,
worklog_headers=filtered_worklog_headers,
worklog_rows=[{"id": log.id, "cells": [fn(log) for fn in filtered_worklog_headers.values()]} for log in worklog],
types=types
types=types,
notes=notes
)
@main.route("/inventory_item/new", methods=["GET"])

View file

@ -6,7 +6,7 @@
<div class="col">
<ul class="nav nav-tabs">
<li class="nav-item">
<a class="nav-link text-black">{{ title }}</a>
<span class="nav-link text-black">{{ title }}</span>
</li>
{% if enabled %}
<li class="nav-item">
@ -29,7 +29,9 @@
<script>
document.addEventListener("DOMContentLoaded", () => {
textEditor{{ id }} = document.getElementById("textEditor{{ id }}");
editTab{{ id }} = document.getElementById("editTab{{ id }}");
{% if enabled %}
editTab{{ id }} = document.getElementById("editTab{{ id }}");
{% endif %}
viewer{{ id }} = document.getElementById("viewer{{ id }}")
textEditor{{ id }}.addEventListener("input", () => EditorWidget.autoResizeTextarea(textEditor{{ id }}));
@ -37,9 +39,11 @@
viewer{{ id }}.innerHTML = marked.parse(textEditor{{ id }}.value);
editTab{{ id }}.addEventListener("click", () => {
EditorWidget.autoResizeTextarea(textEditor{{ id }});
});
{% if enabled %}
editTab{{ id }}.addEventListener("click", () => {
EditorWidget.autoResizeTextarea(textEditor{{ id }});
});
{% endif %}
textEditor{{ id }}.addEventListener("input", () => {
viewer{{ id }}.innerHTML = marked.parse(textEditor{{ id }}.value);

View file

@ -151,10 +151,21 @@
) }}
</div>
{% if worklog %}
<div class="col">
{{ tables.render_table(headers=worklog_headers, rows=worklog_rows, id='worklog',
entry_route='worklog_entry', title='Work Log') }}
</div>
<div class="col border overflow-auto" style="max-height: 300px">
{% for note in notes %}
{% set title %}
{{ note.timestamp.strftime('%Y-%m-%d %H:%M:%S') }}{{ links.entry_link('worklog_entry', note.work_log_id) }}
{% endset %}
<div class="row">
{{ editor.render_editor(
id = 'updates' + (note.id | string),
title = title,
content = note.content,
enabled = false
) }}
</div>
{% endfor %}
</div>
{% endif %}
</div>
</div>