CRUDKit adjustments and bug fixes.

This commit is contained in:
Yaro Kasear 2025-09-11 10:05:32 -05:00
parent eef7428c2f
commit b68dbfc7ae
5 changed files with 26 additions and 13 deletions

View file

@ -22,7 +22,8 @@ def init_index_routes(app):
"start_time",
"contact.last_name",
"contact.first_name",
"work_item.name"
"work_item.name",
"work_item.device_type.description"
],
"sort": "start_time"
})
@ -33,11 +34,10 @@ def init_index_routes(app):
"link": {"endpoint": "user.get_item", "params": {"id": "{contact.id}"}}},
{"field": "work_item.name", "label": "Work Item",
"link": {"endpoint": "inventory.get_item", "params": {"id": "{work_item.id}"}}},
{"field": "complete", "label": "Status",
"format": "yesno", "classes": {"true":"badge bg-success","false":"badge bg-warning","none":"text-muted"}},
{"field": "work_item.device_type.description", "label": "Device Type"}
]
logs = render_table(work_logs, columns=columns)
logs = render_table(work_logs, columns=columns, opts={"object_class": "worklog"})
return render_template("index.html", logs=logs, columns=columns)

View file

@ -1,4 +1,4 @@
<table>
<table class="table table-light table-striped table-hover table-bordered border-tertiary">
<thead>
<tr>
{% for col in columns %}
@ -9,10 +9,10 @@
<tbody>
{% if rows %}
{% for row in rows %}
<tr>
<tr onclick="location.href='{{ url_for(kwargs['opts']['object_class'] + '.get_item', id=row.id) }}'" style="cursor: pointer;">
{% 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>
<td class="{{ cell.class or '' }}"><a href="{{ cell.href }}" class="link-success link-underline link-underline-opacity-0 fw-semibold">{{ 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 %}