Nice work on the user entry.
This commit is contained in:
parent
4ef4d5e23f
commit
d0551d52a1
4 changed files with 84 additions and 45 deletions
|
|
@ -85,7 +85,12 @@ def _fields_for_model(model: str):
|
|||
"inventory.label",
|
||||
"inventory.brand.name",
|
||||
"inventory.model",
|
||||
"inventory.device_type.description"
|
||||
"inventory.device_type.description",
|
||||
"inventory.condition.category",
|
||||
"work_logs.work_item",
|
||||
"work_logs.start_time",
|
||||
"work_logs.end_time",
|
||||
"work_logs.complete",
|
||||
]
|
||||
fields_spec = [
|
||||
{"name": "label", "row": "label", "label": "", "type": "display",
|
||||
|
|
@ -93,24 +98,27 @@ def _fields_for_model(model: str):
|
|||
{"name": "buttons", "label": "", "row": "label", "type": "template", "template": "entry_buttons.html",
|
||||
"wrap": {"class": "col-auto text-end me-2"}, "attrs": {"data-model": model}},
|
||||
{"name": "last_name", "label": "Last Name", "label_attrs": {"class": "form-label"},
|
||||
"attrs": {"placeholder": "Doe", "class": "form-control"}, "row": "name", "wrap": {"class": "col-3"}},
|
||||
"attrs": {"placeholder": "Doe", "class": "form-control"}, "row": "name", "wrap": {"class": "col"}},
|
||||
{"name": "first_name", "label": "First Name", "label_attrs": {"class": "form-label"},
|
||||
"attrs": {"placeholder": "John", "class": "form-control"}, "row": "name", "wrap": {"class": "col-3"}},
|
||||
"attrs": {"placeholder": "John", "class": "form-control"}, "row": "name", "wrap": {"class": "col"}},
|
||||
{"name": "title", "label": "Title", "label_attrs": {"class": "form-label"},
|
||||
"attrs": {"placeholder": "President of the Universe", "class": "form-control"},
|
||||
"row": "name", "wrap": {"class": "col-3"}},
|
||||
"row": "name", "wrap": {"class": "col"}},
|
||||
{"name": "supervisor", "label": "Supervisor", "label_attrs": {"class": "form-label"},
|
||||
"label_spec": "{label}", "row": "details", "wrap": {"class": "col-3"},
|
||||
"label_spec": "{label}", "row": "details", "wrap": {"class": "col"},
|
||||
"attrs": {"class": "form-control"}, "link": {"endpoint": "entry.entry", "params": {"id": "{supervisor.id}", "model": "user"}},
|
||||
"options_params": {"active__eq": True, "staff__eq": True}},
|
||||
{"name": "location", "label": "Room", "label_attrs": {"class": "form-label"},
|
||||
"label_spec": "{name} - {room_function.description}",
|
||||
"row": "details", "wrap": {"class": "col-3"}, "attrs": {"class": "form-control"}},
|
||||
"row": "details", "wrap": {"class": "col"}, "attrs": {"class": "form-control"}},
|
||||
{"name": "active", "label": "Active", "label_attrs": {"class": "form-check-label"},
|
||||
"row": "checkboxes", "attrs": {"class": "form-check-input"}, "wrap": {"class": "form-check"}},
|
||||
{"name": "staff", "label": "Staff Member", "label_attrs": {"class": "form-check-label"},
|
||||
"row": "checkboxes", "attrs": {"class": "form-check-input"}, "wrap": {"class": "form-check"}},
|
||||
{"name": "inventory", "label": "Inventory", "type": "template", "row": "inventory", "template": "user_inventory.html"},
|
||||
{"name": "inventory", "label": "Inventory", "type": "template", "row": "inventory",
|
||||
"template": "user_inventory.html", "wrap": {"class": "col"}},
|
||||
{"name": "work_logs", "label": "Work Logs", "row": "inventory", "type": "template",
|
||||
"template": "user_worklogs.html", "wrap": {"class": "col"}},
|
||||
]
|
||||
layout = [
|
||||
{"name": "label", "order": 0, "attrs": {"class": "row align-items-center"}},
|
||||
|
|
@ -118,7 +126,7 @@ def _fields_for_model(model: str):
|
|||
{"name": "details", "order": 20, "attrs": {"class": "row mt-2"}},
|
||||
{"name": "checkboxes", "order": 30, "parent": "details",
|
||||
"attrs": {"class": "col d-flex flex-column justify-content-end"}},
|
||||
{"name": "inventory", "order": 40},
|
||||
{"name": "inventory", "order": 40, "attrs": {"class": "row"}},
|
||||
]
|
||||
|
||||
elif model == "worklog":
|
||||
|
|
|
|||
|
|
@ -1,17 +1,11 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% block style %}
|
||||
thead.sticky-top th {
|
||||
z-index: 2;
|
||||
}
|
||||
{% endblock %}
|
||||
|
||||
{% block main %}
|
||||
<h1 class="display-4 text-center mb-3">Inventory Summary</h1>
|
||||
<div class="table-responsive mx-5 overflow-y-auto border" style="max-height: 70vh;">
|
||||
<table class="table table-sm table-striped table-hover table-bordered align-middle mb-0">
|
||||
<thead>
|
||||
<tr class="position-sticky top-0 bg-body border">
|
||||
<tr>
|
||||
<th class="text-nowrap position-sticky top-0 bg-body border">Device Type</th>
|
||||
{% for col in col_headers %}
|
||||
{% if col.href %}
|
||||
|
|
|
|||
|
|
@ -1,19 +1,19 @@
|
|||
<label class="form-label mt-2">Assigned Inventory</label>
|
||||
{% set inv = field['template_ctx']['values']['inventory'] %}
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table table-sm table-bordered table-striped table-hover">
|
||||
<div class="table-responsive border overflow-y-auto" style="max-height: 45vh;">
|
||||
<table class="table table-sm table-bordered table-striped table-hover mb-0">
|
||||
{% if inv %}
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Device</th>
|
||||
<th>Brand</th>
|
||||
<th>Model</th>
|
||||
<th>Type</th>
|
||||
<th class="position-sticky top-0 bg-body z-1 border">Device</th>
|
||||
<th class="position-sticky top-0 bg-body z-1 border">Brand</th>
|
||||
<th class="position-sticky top-0 bg-body z-1 border">Model</th>
|
||||
<th class="position-sticky top-0 bg-body z-1 border">Type</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for i in inv %}
|
||||
{% for i in inv if i['condition.category'] not in ['Disposed', 'Administrative'] %}
|
||||
<tr style="cursor: pointer;" onclick="location.href='{{ url_for('entry.entry', model='inventory', id=i.id) }}'">
|
||||
<td>{{ i.label }}</td>
|
||||
<td>{{ i['brand.name'] }}</td>
|
||||
|
|
|
|||
37
inventory/templates/user_worklogs.html
Normal file
37
inventory/templates/user_worklogs.html
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
<!-- WORK LOGS -->
|
||||
|
||||
<label class="form-label mt-2">Work Logs</label>
|
||||
{% set wl = field['template_ctx']['values']['work_logs'] %}
|
||||
{% set check %}
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-check text-success" viewBox="0 0 16 16">
|
||||
<path d="M10.97 4.97a.75.75 0 0 1 1.07 1.05l-3.99 4.99a.75.75 0 0 1-1.08.02L4.324 8.384a.75.75 0 1 1 1.06-1.06l2.094 2.093 3.473-4.425z"/>
|
||||
</svg>
|
||||
{% endset %}
|
||||
{% set x %}
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-x text-danger" viewBox="0 0 16 16">
|
||||
<path d="M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708"/>
|
||||
</svg>
|
||||
{% endset %}
|
||||
|
||||
<div class="table-responsive border overflow-y-auto" style="max-height: 45vh;">
|
||||
<table class="table table-sm table-striped table-bordered table-hover mb-0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="position-sticky top-0 bg-body z-1 border">Device</th>
|
||||
<th class="position-sticky top-0 bg-body z-1 border">Start</th>
|
||||
<th class="position-sticky top-0 bg-body z-1 border">End</th>
|
||||
<th class="position-sticky top-0 bg-body z-1 border"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for l in wl %}
|
||||
<tr onclick="location.href='{{ url_for('entry.entry', model='worklog', id=l.id) }}'" style="cursor: pointer;">
|
||||
<td>{{ l['work_item']['label'] if l['work_item'] else '-' }}</td>
|
||||
<td>{{ l.start_time if l.start_time else '-' }}</td>
|
||||
<td>{{ l.end_time if l.end_time else '-' }}</td>
|
||||
<td class="text-center">{{ check if l.complete else x }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
Loading…
Add table
Add a link
Reference in a new issue