Skip to content

Commit

Permalink
feat: add checked out assets to home page (#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
drahamim authored Feb 25, 2023
1 parent d42fc35 commit 0f3d347
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/invenflask/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,12 @@ def index():
"SELECT asset_type, COUNT() AS TotalCount,"
"SUM(asset_status = 'checkedout') AS AvailCount from assets GROUP BY asset_type;"
).fetchall()
checkouts = conn.execute(
"select * from checkouts").fetchall()
conn.commit()
return render_template(
'index.html', assets=assets, asset_total=asset_total,
asset_type=asset_types, asset_status=asset_status)
asset_type=asset_types, asset_status=asset_status, checkouts=checkouts)


@app.route('/create_asset', methods=('GET', 'POST'))
Expand Down
29 changes: 28 additions & 1 deletion src/invenflask/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,31 @@ <h1>{% block title %} Asset Total "{{ asset_total }}" {% endblock %}</h1>
{% endfor %}
</tbody>
</table>
{% endblock %}
<h4>Checked Out Assets</h4>
<table class="table table-striped">
<thead>
<tr>
<th style="text-align:left">Asset ID</th>
<th style="text-align:left">Staff ID</th>
<th style="text-align:left">Department</th>
<th style="text-align:left">Checked Out</th>

</tr>
</thead>
<tbody>
{% for item in checkouts %}
<tr>
<td>{{ item.assetid }}</td>
<td>{{ item.staffid }}</td>
<td>{{ item.department }}</td>
<td>{{ item.timestamp }}</td>
</td>
</tr>
{% endfor %}
</tbody>
</table>




{% endblock %}

0 comments on commit 0f3d347

Please sign in to comment.