Refactor templates and add search functionality with improved navigation and user experience

This commit is contained in:
Yaro Kasear 2025-06-13 08:50:39 -05:00
parent 684a98b216
commit f4f9f84387
15 changed files with 97 additions and 43 deletions

View file

@ -1,31 +1,32 @@
<!-- templates/user.html -->
{% extends "layout.html" %}
{% import "_breadcrumb_fragment.html" as breadcrumbs %}
{% import "_table_fragment.html" as tables %}
{% block title %}{{ title }}{% endblock %}
{% block content %}
{{ breadcrumbs.breadcrumb_header(
title=title,
breadcrumbs=[
{'label': 'Users', 'url': url_for('main.list_users')}
]
) }}
{% if not user.active %}
<div class="alert alert-danger">This user is inactive. You will not be able to make any changes to this record.</div>
{% endif %}
<div class="container">
<form action="POST">
<div class="row">
<div class="col-6">
<label for="lastName" class="form-label">Last Name</label>
<input type="text" class="form-control" id="lastName" placeholder="Doe" value="{{ user.last_name }}">
<input type="text" class="form-control" id="lastName" placeholder="Doe" value="{{ user.last_name }}"{% if not user.active %} disabled readonly{% endif %}>
</div>
<div class="col-6">
<label for="firstName" class="form-label">First Name</label>
<input type="text" class="form-control" id="firstName" placeholder="John" value="{{ user.first_name }}">
<input type="text" class="form-control" id="firstName" placeholder="John" value="{{ user.first_name }}"{% if not user.active %} disabled readonly{% endif %}>
</div>
</div>
@ -47,10 +48,10 @@ breadcrumbs=[
{% endif %}
</label>
<select class="form-select" id="supervisor" name="supervisor"
value="{{ supervisor.id if supervisor else '' }}">
value="{{ supervisor.id if supervisor else '' }}"{% if not user.active %} disabled readonly{% endif %}>
<option>-</option>
{% for supervisor in users %}
<option value="{{ supervisor.id }}"{% if supervisor.id == user.supervisor_id %} selected{% endif %}>
<option value="{{ supervisor.id }}"{% if supervisor.id==user.supervisor_id %} selected{% endif %}>
{{ supervisor.full_name }}</option>
{% endfor %}
</select>
@ -58,35 +59,36 @@ breadcrumbs=[
<div class="col-6">
<label for="location" class="form-label">Location</label>
<select class="form-select" id="location" name="location">
<select class="form-select" id="location" name="location"{% if not user.active %} disabled readonly{% endif %}>
<option>-</option>
{% for location in rooms %}
<option value="{{ location.id }}"{% if location.id == user.location_id %} selected{% endif %}>{{ location.full_name }}</option>
<option value="{{ location.id }}"{% if location.id==user.location_id %} selected{% endif %}>{{
location.full_name }}</option>
{% endfor %}
</select>
</div>
</div>
<div class="row mt-4">
<div class="col-6">
<input type="checkbox" class="form-check-input" id="activeCheck" {% if user.active %}checked{% endif %}>
<input type="checkbox" class="form-check-input" id="activeCheck"{% if user.active %} checked{% endif %}>
<label for="activeCheck" class="form-check-label">Active</label>
</div>
<div class="col-6">
<input type="checkbox" class="form-check-input" id="staffCheck" {% if user.staff %}checked{% endif %}>
<input type="checkbox" class="form-check-input" id="staffCheck"{% if user.staff %} checked{% endif %}{% if not user.active %} disabled readonly{% endif %}>
<label for="staffCheck" class="form-check-label">Staff</label>
</div>
</div>
</form>
<div class="row mt-3">
{% if inventory_rows %}
<div class="col-6">
<div class="col{% if user.worklog_rows %}-6{% endif %}">
<div class="row">
{{ tables.render_table(inventory_headers, inventory_rows, 'inventory_item', title='Assets') }}
</div>
</div>
{% endif %}
{% if worklog_rows %}
<div class="col-6">
<div class="col{% if user.inventory_rows %}-6{% endif %}">
<div class="row">
{{ tables.render_table(worklog_headers, worklog_rows, 'worklog_entry', title='Work Done') }}
</div>