inventory/templates/user.html

115 lines
No EOL
4.5 KiB
HTML

<!-- 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')}
]
) }}
<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 }}">
</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 }}">
</div>
</div>
<div class="row mt-2">
<div class="col-6">
<label for="supervisor" class="form-label">Supervisor</label>
<input list="supervisorList" id="supervisor" name="supervisorName" class="form-control"
value="{{ user.supervisor.full_name }}" data-datalist-bind="#supervisorList"
data-hidden-target="#supervisorId">
<input type="hidden" id="supervisorId">
<datalist id="supervisorList">
{% for supervisor in users %}
<option data-id="{{ supervisor.id }}" value="{{ supervisor.full_name }}"></option>
{% endfor %}
</datalist>
</div>
<div class="col-6">
<label for="location" class="form-label">Location</label>
<input list="locationList" id="location" name="locationName" class="form-control"
value="{{ user.location.full_name }}" data-datalist-bind="#locationList"
data-hidden-target="#locationId">
<input type="hidden" id="locationId">
<datalist id="locationList">
{% for location in rooms %}
<option data-id="{{ location.id }}" value="{{ location.full_name }}"></option>
{% endfor %}
</datalist>
</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 %}>
<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 %}>
<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="row">
{{ tables.render_table(inventory_headers, inventory_rows, 'inventory_item', title='Assets') }}
</div>
</div>
{% endif %}
{% if worklog_rows %}
<div class="col-6">
<div class="row">
{{ tables.render_table(worklog_headers, worklog_rows, 'worklog_entry', title='Work Done') }}
</div>
</div>
{% endif %}
</div>
<div class="row">
{% if inventory_pagination['total_pages'] > 1 %}
<div class="col-6">
{{ tables.render_pagination(
page=inventory_pagination['page'],
has_prev=inventory_pagination['has_prev'],
has_next=inventory_pagination['has_next'],
total_pages=inventory_pagination['total_pages'],
endpoint='main.user',
page_variable='asset_page',
extra_args={'id': user.id, 'worklog_page': worklog_page}
) }}
</div>
{% endif %}
{% if worklog_pagination['total_pages'] > 1 %}
<div class="col-6">
{{ tables.render_pagination(
page=worklog_pagination['page'],
has_prev=worklog_pagination['has_prev'],
has_next=worklog_pagination['has_next'],
total_pages=worklog_pagination['total_pages'],
endpoint='main.user',
page_variable='worklog_page',
extra_args={'id': user.id, 'worklog_page': worklog_page}
) }}
</div>
{% endif %}
</div>
</div>
{% endblock %}