More layout improvements to inventory.
This commit is contained in:
parent
5f7354c055
commit
a87dbc6b81
3 changed files with 27 additions and 10 deletions
|
@ -95,6 +95,7 @@ def inventory_item(id):
|
||||||
rooms = eager_load_room_relationships(db.session.query(Room).order_by(Room.name)).all()
|
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_query = db.session.query(WorkLog).filter(WorkLog.work_item_id == id)
|
||||||
worklog = eager_load_worklog_relationships(worklog_query).all()
|
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()
|
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?']}
|
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=worklog,
|
||||||
worklog_headers=filtered_worklog_headers,
|
worklog_headers=filtered_worklog_headers,
|
||||||
worklog_rows=[{"id": log.id, "cells": [fn(log) for fn in filtered_worklog_headers.values()]} for log in worklog],
|
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"])
|
@main.route("/inventory_item/new", methods=["GET"])
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<ul class="nav nav-tabs">
|
<ul class="nav nav-tabs">
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link text-black">{{ title }}</a>
|
<span class="nav-link text-black">{{ title }}</span>
|
||||||
</li>
|
</li>
|
||||||
{% if enabled %}
|
{% if enabled %}
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
|
@ -29,7 +29,9 @@
|
||||||
<script>
|
<script>
|
||||||
document.addEventListener("DOMContentLoaded", () => {
|
document.addEventListener("DOMContentLoaded", () => {
|
||||||
textEditor{{ id }} = document.getElementById("textEditor{{ id }}");
|
textEditor{{ id }} = document.getElementById("textEditor{{ id }}");
|
||||||
|
{% if enabled %}
|
||||||
editTab{{ id }} = document.getElementById("editTab{{ id }}");
|
editTab{{ id }} = document.getElementById("editTab{{ id }}");
|
||||||
|
{% endif %}
|
||||||
viewer{{ id }} = document.getElementById("viewer{{ id }}")
|
viewer{{ id }} = document.getElementById("viewer{{ id }}")
|
||||||
|
|
||||||
textEditor{{ id }}.addEventListener("input", () => EditorWidget.autoResizeTextarea(textEditor{{ id }}));
|
textEditor{{ id }}.addEventListener("input", () => EditorWidget.autoResizeTextarea(textEditor{{ id }}));
|
||||||
|
@ -37,9 +39,11 @@
|
||||||
|
|
||||||
viewer{{ id }}.innerHTML = marked.parse(textEditor{{ id }}.value);
|
viewer{{ id }}.innerHTML = marked.parse(textEditor{{ id }}.value);
|
||||||
|
|
||||||
|
{% if enabled %}
|
||||||
editTab{{ id }}.addEventListener("click", () => {
|
editTab{{ id }}.addEventListener("click", () => {
|
||||||
EditorWidget.autoResizeTextarea(textEditor{{ id }});
|
EditorWidget.autoResizeTextarea(textEditor{{ id }});
|
||||||
});
|
});
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
textEditor{{ id }}.addEventListener("input", () => {
|
textEditor{{ id }}.addEventListener("input", () => {
|
||||||
viewer{{ id }}.innerHTML = marked.parse(textEditor{{ id }}.value);
|
viewer{{ id }}.innerHTML = marked.parse(textEditor{{ id }}.value);
|
||||||
|
|
|
@ -151,9 +151,20 @@
|
||||||
) }}
|
) }}
|
||||||
</div>
|
</div>
|
||||||
{% if worklog %}
|
{% if worklog %}
|
||||||
<div class="col">
|
<div class="col border overflow-auto" style="max-height: 300px">
|
||||||
{{ tables.render_table(headers=worklog_headers, rows=worklog_rows, id='worklog',
|
{% for note in notes %}
|
||||||
entry_route='worklog_entry', title='Work Log') }}
|
{% 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>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue