diff options
Diffstat (limited to 'jimbrella/templates/admin')
-rw-r--r-- | jimbrella/templates/admin/logs.html | 34 | ||||
-rw-r--r-- | jimbrella/templates/admin/umbrellas.html | 42 |
2 files changed, 75 insertions, 1 deletions
diff --git a/jimbrella/templates/admin/logs.html b/jimbrella/templates/admin/logs.html new file mode 100644 index 0000000..6f0ed71 --- /dev/null +++ b/jimbrella/templates/admin/logs.html @@ -0,0 +1,34 @@ +<!DOCTYPE html> +<html> + <head> + <title>JI Umbrella</title> + <link rel="stylesheet" href="/static/jimbrella.css" /> + <meta name="viewport" content="width=device-width, initial-scale=1" /> + </head> + <body> + <h1>JI Umbrella Logs</h1> + <div id="container"> + {% include "admin/tabs.html" %} + <div class="data-table-container"> + <table class="data"> + <thead> + <tr> + <th>Date</th> + <th>Event</th> + <th>Note</th> + </tr> + </thead> + <tbody> + {% for log in logs %} + <tr class="{{ log.event }}"> + <td>{{ log.date_str }}</td> + <td>{{ log.description }}</td> + <td>{{ log.note }}</td> + </tr> + {% endfor %} + </tbody> + </table> + </div> + </div> + </body> +</html> diff --git a/jimbrella/templates/admin/umbrellas.html b/jimbrella/templates/admin/umbrellas.html index 6bb4af5..15b6f02 100644 --- a/jimbrella/templates/admin/umbrellas.html +++ b/jimbrella/templates/admin/umbrellas.html @@ -15,7 +15,11 @@ {% for umb in umbrellas %} {% if umb.status in ["lent", "overdue"] %} <tr class="{{ umb.status }}"> - <th rowspan=5>{{ umb.serial }} <br /> {{ umb.status }}</th> + <th rowspan=5> + {{ umb.serial }} <br /> + {{ umb.status }} <br /> + <a href="/admin/umbrellas?edit={{ umb.serial }}">Edit</a> + </th> <td>{{ umb.tenant_name }}</td> </tr> <tr class="{{ umb.status }}"><td>{{ umb.tenant_id }}</td></tr> @@ -47,8 +51,40 @@ </tr> </thead> <tbody> + {% macro status_opt(umb, status) -%} + <option value="{{ status }}" + {% if umb.status == status %} + selected + {% endif %}> + {{ status }} + </option> + {%- endmacro %} + {% for umb in umbrellas %} <tr class="{{ umb.status }}"> + {% if umb.serial == edit %} + <form method="post" action="/admin/umbrellas/edit"> + <input name="serial" type="number" value="{{ umb.serial }}" hidden/> + <td>{{ umb.serial }}</td> + <td> + <select name="status"> + {% for status in ["available", "lent", "overdue"] %} + {{ status_opt(umb, status) }} + {% endfor %} + </select> + </td> + <td><input name="tenant_name" value="{{ umb.tenant_name }}" class="db-edit" /></td> + <td><input name="tenant_id" type="number" value="{{ umb.tenant_id }}" class="db-edit" /></td> + <td><input name="tenant_phone" type="tel" value="{{ umb.tenant_phone }}" class="db-edit" /></td> + <td><input name="lent_at" type="datetime-local" value="{{ umb.lent_at_str }}"/></td> + <td>{{ umb.lent_time_ago_str }} + {% if umb.status in ["lent", "overdue"] %} ago {% endif %} + </td> + <td> + <input type="submit" value="Submit" /> + </td> + </form> + {% else %} <td>{{ umb.serial }}</td> <td>{{ umb.status }}</td> <td>{{ umb.tenant_name }}</td> @@ -58,6 +94,10 @@ <td>{{ umb.lent_time_ago_str }} {% if umb.status in ["lent", "overdue"] %} ago {% endif %} </td> + <td> + <a href="/admin/umbrellas?edit={{ umb.serial }}">Edit</a> + </td> + {% endif %} </tr> {% endfor %} </tbody> |