Skip to content

Commit

Permalink
fix: Add item details to individual summary page (#33)
Browse files Browse the repository at this point in the history
* fix: Add item details to individual summary page

* refactor: remove useless print statement
  • Loading branch information
drahamim authored Feb 25, 2023
1 parent 0f3d347 commit dfb9371
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/invenflask/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -473,17 +473,19 @@ def single_history(rq_type, item_id):

if rq_type == 'asset':
conn = get_db()
item_info = get_asset(item_id, 'edit')
current = conn.execute(
'select * from checkouts where assetid = ?', (item_id,))
history = conn.execute(
'select * from history where assetid = ?', (item_id,))
conn.commit()
if rq_type == 'staff':
item_info = get_staff(item_id)
conn = get_db()
current = conn.execute(
'select * from checkouts where staffid = ?', (item_id,))
history = conn.execute(
'select * from history where staffid = ?', (item_id,))
conn.commit()
return render_template('single_history.html', hist_type=rq_type,
current=current, history=history)
current=current, history=history, item_info=item_info)
46 changes: 44 additions & 2 deletions src/invenflask/templates/single_history.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,31 @@
{% block content %}
{% if hist_type == 'staff' %}
<h1>Staff History</h1>
<label></label>

<table id="Staff" class="table table-striped">
<thead>
<tr>
<th style="text-align:left">First Name</th>
<th style="text-align:left">Last Name</th>
<th style="text-align:left">Staff ID</th>
<th style="text-align:left">Division</th>
<th style="text-align:left">Department</th>
<th style="text-align:left">Title</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{ item_info.first_name }}</td>
<td>{{ item_info.last_name }}</td>
<td>{{ item_info.id }}</td>
<td>{{ item_info.division }}</td>
<td>{{ item_info.department }}</td>
<td>{{ item_info.title }}</td>
</tr>
</tbody>
</table>

<h4>Current Assets</h4>
<table id="current" class="table table-striped">
<thead>
<tr>
Expand All @@ -21,7 +45,7 @@ <h1>Staff History</h1>
</tbody>
</table>

<label>History</label>
<h4>History</h4>
<table id="history" class="table table-striped">
<thead>
<tr>
Expand All @@ -41,9 +65,27 @@ <h1>Staff History</h1>
</tbody>
</table>


{% else %}


<h1> Asset History </h1>
<table id="Assets" class="table table-striped">
<thead>
<tr>
<th>Radio ID</th>
<th>Type</th>
<th>Status</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{ item_info.id }}</td>
<td>{{ item_info.asset_type }}</td>
<td>{{ item_info.asset_status }}</td>
</tr>
</tbody>
</table>
<label>Current</label>
<table id="Staff" class="table table-striped">
<thead>
Expand Down

0 comments on commit dfb9371

Please sign in to comment.