diff options
Diffstat (limited to 'jimbrella/templates/admin/umbrellas.html')
-rw-r--r-- | jimbrella/templates/admin/umbrellas.html | 42 |
1 files changed, 41 insertions, 1 deletions
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> |