Implementing useful UI changes.
This commit is contained in:
parent
7ddfe084ba
commit
de5e5b4a43
6 changed files with 181 additions and 38 deletions
|
|
@ -21,18 +21,25 @@ def init_index_routes(app):
|
|||
"fields": [
|
||||
"start_time",
|
||||
"contact.last_name",
|
||||
"contact.first_name",
|
||||
"work_item.name"
|
||||
],
|
||||
"limit": 10
|
||||
"sort": "start_time"
|
||||
})
|
||||
headers = [
|
||||
"Start Time",
|
||||
"Contact Last Name",
|
||||
"Work Item"
|
||||
]
|
||||
logs = render_table(work_logs, headers)
|
||||
|
||||
return render_template("index.html", logs=logs, headers=headers)
|
||||
columns = [
|
||||
{"field": "start_time", "label": "Start", "format": "date"},
|
||||
{"field": "contact.last_name", "label": "Contact",
|
||||
"link": {"endpoint": "contact.entry", "params": {"id": "{contact.id}"}}},
|
||||
{"field": "work_item.name", "label": "Work Item",
|
||||
"link": {"endpoint": "work_item.entry", "params": {"id": "{work_item.id}"}}},
|
||||
{"field": "complete", "label": "Status",
|
||||
"format": "yesno", "classes": {"true":"badge bg-success","false":"badge bg-warning","none":"text-muted"}},
|
||||
]
|
||||
|
||||
logs = render_table(work_logs, columns=columns)
|
||||
|
||||
return render_template("index.html", logs=logs, columns=columns)
|
||||
|
||||
@bp_index.get("/LICENSE")
|
||||
def license():
|
||||
|
|
|
|||
|
|
@ -37,8 +37,8 @@
|
|||
<footer class="bg-body-tertiary border border-bottom-0 position-absolute bottom-0 w-100 pb-1">
|
||||
<small>
|
||||
<span class="align-middle">© 2025 Conrad Nelson •
|
||||
<a href="/LICENSE">AGPL-3.0-or-later</a> •
|
||||
<a href="https://git.kasear.net/yaro/inventory">Source Code</a>
|
||||
<a href="/LICENSE" class="link-underline link-underline-opacity-0">AGPL-3.0-or-later</a> •
|
||||
<a href="https://git.kasear.net/yaro/inventory" class="link-underline link-underline-opacity-0">Source Code</a>
|
||||
</span>
|
||||
{% block footer %}
|
||||
{% endblock %}
|
||||
|
|
|
|||
26
inventory/templates/crudkit/table.html
Normal file
26
inventory/templates/crudkit/table.html
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
{% for col in columns %}
|
||||
<th>{{ col.label }}</th>
|
||||
{% endfor %}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% if rows %}
|
||||
{% for row in rows %}
|
||||
<tr>
|
||||
{% for cell in row.cells %}
|
||||
{% if cell.href %}
|
||||
<td class="{{ cell.class or '' }}"><a href="{{ cell.href }}">{{ cell.text if cell.text is not none else '-' }}</a></td>
|
||||
{% else %}
|
||||
<td class="{{ cell.class or '' }}">{{ cell.text if cell.text is not none else '-' }}</td>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
<tr><td colspan="{{ columns|length }}">No data.</td></tr>
|
||||
{% endif %}
|
||||
</tbody>
|
||||
</table>
|
||||
Loading…
Add table
Add a link
Reference in a new issue