Minor fixes.

This commit is contained in:
Yaro Kasear 2025-07-15 08:32:08 -05:00
parent a87dbc6b81
commit 50573df8d7
6 changed files with 24 additions and 19 deletions

View file

@ -2,7 +2,6 @@ import hashlib
import os import os
from flask import url_for from flask import url_for
from werkzeug.utils import secure_filename
from ..models import Inventory from ..models import Inventory
@ -11,17 +10,16 @@ from ..models.image import ImageAttachable
inventory_headers = { inventory_headers = {
"Date Entered": lambda i: {"text": i.timestamp.strftime("%Y-%m-%d") if i.timestamp else None}, "Date Entered": lambda i: {"text": i.timestamp.strftime("%Y-%m-%d") if i.timestamp else None},
"Identifier": lambda i: {"text": i.identifier}, "Identifier": lambda i: {"text": i.identifier},
"Inventory #": lambda i: {"text": i.name}, "Name": lambda i: {"text": i.name},
"Serial #": lambda i: {"text": i.serial}, "Serial Number": lambda i: {"text": i.serial},
"Bar Code #": lambda i: {"text": i.barcode}, "Bar Code": lambda i: {"text": i.barcode},
"Brand": lambda i: {"text": i.brand.name} if i.brand else {"text": None}, "Brand": lambda i: {"text": i.brand.name} if i.brand else {"text": None},
"Model": lambda i: {"text": i.model}, "Model": lambda i: {"text": i.model},
"Item Type": lambda i: {"text": i.item.description} if i.item else {"text": None}, "Item Type": lambda i: {"text": i.item.description} if i.item else {"text": None},
"Shared?": lambda i: {"text": i.shared, "type": "bool", "html": checked_box if i.shared else unchecked_box}, "Shared?": lambda i: {"text": i.shared, "type": "bool", "html": checked_box if i.shared else unchecked_box},
"Owner": lambda i: {"text": i.owner.full_name, "url": url_for("main.user", id=i.owner.id)} if i.owner else {"text": None}, "Owner": lambda i: {"text": i.owner.full_name, "url": url_for("main.user", id=i.owner.id)} if i.owner else {"text": None},
"Location": lambda i: {"text": i.location.full_name} if i.location else {"Text": None}, "Location": lambda i: {"text": i.location.full_name} if i.location else {"Text": None},
"Condition": lambda i: {"text": i.condition}, "Condition": lambda i: {"text": i.condition}
# "Notes": lambda i: {"text": i.notes}
} }
checked_box = ''' checked_box = '''

View file

@ -37,8 +37,8 @@ def user(id):
) )
inventory = inventory_query.all() inventory = inventory_query.all()
filtered_inventory_headers = {k: v for k, v in inventory_headers.items() if k not in ['Date Entered', 'Inventory #', 'Serial #', filtered_inventory_headers = {k: v for k, v in inventory_headers.items() if k not in ['Date Entered', 'Name', 'Serial Number',
'Bar Code #', 'Condition', 'Owner', 'Notes', 'Bar Code', 'Condition', 'Owner', 'Notes',
'Brand', 'Model', 'Shared?', 'Location']} 'Brand', 'Model', 'Shared?', 'Location']}
worklog_query = eager_load_worklog_relationships(db.session.query(WorkLog)).filter(WorkLog.contact_id == id) worklog_query = eager_load_worklog_relationships(db.session.query(WorkLog)).filter(WorkLog.contact_id == id)
worklog = worklog_query.order_by(WorkLog.start_time.desc()).all() worklog = worklog_query.order_by(WorkLog.start_time.desc()).all()

View file

@ -36,18 +36,18 @@
</div> </div>
<div class="row"> <div class="row">
<div class="col-4"> <div class="col-4">
<label for="name" class="form-label">Inventory #</label> <label for="name" class="form-label">Name</label>
<input type="text" class="form-control" name="name" placeholder="-" value="{{ item.name or '' }}" {% <input type="text" class="form-control" name="name" placeholder="-" value="{{ item.name or '' }}" {%
if item.condition in ["Removed", "Disposed" ] %} disabled{% endif %}> if item.condition in ["Removed", "Disposed" ] %} disabled{% endif %}>
</div> </div>
<div class="col-4"> <div class="col-4">
<label for="serial" class="form-label">Serial #</label> <label for="serial" class="form-label">Serial Number</label>
<input type="text" class="form-control" name="serial" placeholder="-" <input type="text" class="form-control" name="serial" placeholder="-"
value="{{ item.serial if item.serial else '' }}" {% if item.condition in ["Removed", "Disposed" value="{{ item.serial if item.serial else '' }}" {% if item.condition in ["Removed", "Disposed"
] %} disabled{% endif %}> ] %} disabled{% endif %}>
</div> </div>
<div class="col-4"> <div class="col-4">
<label for="barcode" class="form-label">Bar Code #</label> <label for="barcode" class="form-label">Bar Code</label>
<input type="text" class="form-control" name="barcode" placeholder="-" <input type="text" class="form-control" name="barcode" placeholder="-"
value="{{ item.barcode if item.barcode else '' }}" {% if item.condition in value="{{ item.barcode if item.barcode else '' }}" {% if item.condition in
["Removed", "Disposed" ] %} disabled{% endif %}> ["Removed", "Disposed" ] %} disabled{% endif %}>
@ -161,6 +161,7 @@
id = 'updates' + (note.id | string), id = 'updates' + (note.id | string),
title = title, title = title,
content = note.content, content = note.content,
mode = 'view',
enabled = false enabled = false
) }} ) }}
</div> </div>

View file

@ -17,8 +17,8 @@
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.6/dist/css/bootstrap.min.css" rel="stylesheet" <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.6/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-4Q6Gf2aSP4eDXB8Miphtr37CMZZQ5oXLH2yaXMJ2w8e2ZtHTl7GptT4jmndRuHDT" crossorigin="anonymous"> integrity="sha384-4Q6Gf2aSP4eDXB8Miphtr37CMZZQ5oXLH2yaXMJ2w8e2ZtHTl7GptT4jmndRuHDT" crossorigin="anonymous">
<link <link
href="https://cdn.datatables.net/v/bs5/jq-3.7.0/moment-2.29.4/dt-2.3.2/b-3.2.3/b-colvis-3.2.3/b-print-3.2.3/cr-2.1.1/cc-1.0.4/r-3.0.4/rg-1.5.1/rr-1.5.0/sc-2.4.3/sr-1.4.1/datatables.min.css" href="https://cdn.datatables.net/v/bs5/jq-3.7.0/moment-2.29.4/jszip-3.10.1/dt-2.3.2/b-3.2.4/b-html5-3.2.4/fh-4.0.3/r-3.0.5/datatables.min.css"
rel="stylesheet" integrity="sha384-gdnBcErvPbrURVoR9w3NhVMliw+ZmcTCmq+64xj2Ksx21nRJFX3qW0zFvBotL5rm" rel="stylesheet" integrity="sha384-hSj3bXMT805MYGWJ+03fwhNIuAiFbC0OFMeKgQeB0ndGAdPMSutk5qr9WHSXzHU/"
crossorigin="anonymous"> crossorigin="anonymous">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.13.1/font/bootstrap-icons.min.css"> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.13.1/font/bootstrap-icons.min.css">
<link rel="stylesheet" <link rel="stylesheet"
@ -27,8 +27,7 @@
crossorigin="anonymous" referrerpolicy="no-referrer" /> crossorigin="anonymous" referrerpolicy="no-referrer" />
<link rel="stylesheet" href="{{ url_for('static', filename='css/widget.css') }}"> <link rel="stylesheet" href="{{ url_for('static', filename='css/widget.css') }}">
<style> <style>
{% block style %} {% block style %}{% endblock %}
{% endblock %}
</style> </style>
</head> </head>
@ -68,8 +67,8 @@
crossorigin="anonymous" referrerpolicy="no-referrer"></script> crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdn.plot.ly/plotly-3.0.1.min.js" charset="utf-8"></script> <script src="https://cdn.plot.ly/plotly-3.0.1.min.js" charset="utf-8"></script>
<script <script
src="https://cdn.datatables.net/v/bs5/jq-3.7.0/moment-2.29.4/dt-2.3.2/b-3.2.3/b-colvis-3.2.3/b-print-3.2.3/cr-2.1.1/cc-1.0.4/r-3.0.4/rg-1.5.1/rr-1.5.0/sc-2.4.3/sr-1.4.1/datatables.min.js" src="https://cdn.datatables.net/v/bs5/jq-3.7.0/moment-2.29.4/dt-2.3.2/b-3.2.4/r-3.0.5/sc-2.4.3/sp-2.3.3/datatables.min.js"
integrity="sha384-tNYRX2RiDDDRKCJgPF8Pw3rTxC1GUe1pt5qH1SBmwcazrEUj7Ii4C1Tz9wCCRUI4" integrity="sha384-zqgMe4cx+N3TuuqXt4kWWDluM5g1CiRwqWBm3vpvY0GcDoXTwU8d17inavaLy3p3"
crossorigin="anonymous"></script> crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/marked/lib/marked.umd.js"></script> <script src="https://cdn.jsdelivr.net/npm/marked/lib/marked.umd.js"></script>
<script src="{{ url_for('static', filename='js/widget.js') }}"></script> <script src="{{ url_for('static', filename='js/widget.js') }}"></script>

View file

@ -11,6 +11,13 @@
create_button=True create_button=True
) }} ) }}
{#
<div class="btn-group">
<button class="btn btn-primary">{{ icons.render_icon('box-arrow-in-up', 16) }}</button>
<button class="btn btn-primary">{{ icons.render_icon('box-arrow-up', 16) }}</button>
</div>
#}
{{ tables.render_table(headers=header, rows=rows, id='table', entry_route=entry_route) }} {{ tables.render_table(headers=header, rows=rows, id='table', entry_route=entry_route) }}
{% endblock %} {% endblock %}

View file

@ -164,8 +164,8 @@
complete: document.querySelector("input[name='complete']").checked, complete: document.querySelector("input[name='complete']").checked,
analysis: document.querySelector("input[name='analysis']").checked, analysis: document.querySelector("input[name='analysis']").checked,
followup: document.querySelector("input[name='followup']").checked, followup: document.querySelector("input[name='followup']").checked,
contact_id: document.querySelector("select[name='contact']").value || null, contact_id: parseInt(document.querySelector("select[name='contact']").value) || null,
work_item_id: document.querySelector("select[name='item']").value || null, work_item_id: parseInt(document.querySelector("select[name='item']").value) || null,
updates: updates updates: updates
}; };