I'm "done." At least for now. Need deletion implementation.

This commit is contained in:
Yaro Kasear 2025-10-15 15:05:49 -05:00
parent ae54277e58
commit 81e02bbabd
5 changed files with 36 additions and 7 deletions

View file

@ -12,7 +12,6 @@ _engine = None
SessionLocal = None
def init_db(database_url: str, engine_kwargs: Dict[str, Any], session_kwargs: Dict[str, Any]) -> None:
print("AM I EVEN BEING RUN?!")
global _engine, SessionLocal
print(database_url)
_engine = create_engine(database_url, **engine_kwargs)

View file

@ -282,6 +282,12 @@ def init_entry_routes(app):
f["label"] = ""
f["label_spec"] = "New User"
break
elif model == "room":
for f in fields_spec:
if f.get("name") == "label" and f.get("type") == "display":
f["label"] = ""
f["label_spec"] = "New Room"
break
obj = cls()
ScopedSession = current_app.extensions["crudkit"]["Session"]
@ -325,6 +331,10 @@ def init_entry_routes(app):
if "work_item" in payload and "work_item_id" not in payload:
payload["work_item_id"] = payload.pop("work_item")
if model == "room":
if "room_function_id" in payload and "function_id" not in payload:
payload["function_id"] = payload.pop("room_function_id")
# Parent first, no commit yet
obj = svc.create(payload, actor="create_entry", commit=False)
@ -422,7 +432,6 @@ def init_entry_routes(app):
return {"status": "success", "payload": payload}
except Exception as e:
print(e)
return {"status": "failure", "error": str(e)}
app.register_blueprint(bp_entry)

View file

@ -43,6 +43,11 @@
<input type="text" id="searchText" class="form-control me-3">
<button type="button" id="searchButton" class="btn btn-primary" disabled>Search</button>
</div>
<a href="{{ url_for('settings.settings') }}" class="link-success fw-semibold ms-3">
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="currentColor" class="bi bi-gear-fill" viewBox="0 0 16 16">
<path d="M9.405 1.05c-.413-1.4-2.397-1.4-2.81 0l-.1.34a1.464 1.464 0 0 1-2.105.872l-.31-.17c-1.283-.698-2.686.705-1.987 1.987l.169.311c.446.82.023 1.841-.872 2.105l-.34.1c-1.4.413-1.4 2.397 0 2.81l.34.1a1.464 1.464 0 0 1 .872 2.105l-.17.31c-.698 1.283.705 2.686 1.987 1.987l.311-.169a1.464 1.464 0 0 1 2.105.872l.1.34c.413 1.4 2.397 1.4 2.81 0l.1-.34a1.464 1.464 0 0 1 2.105-.872l.31.17c1.283.698 2.686-.705 1.987-1.987l-.169-.311a1.464 1.464 0 0 1 .872-2.105l.34-.1c1.4-.413 1.4-2.397 0-2.81l-.34-.1a1.464 1.464 0 0 1-.872-2.105l.17-.31c.698-1.283-.705-2.686-1.987-1.987l-.311.169a1.464 1.464 0 0 1-2.105-.872zM8 10.93a2.929 2.929 0 1 1 0-5.86 2.929 2.929 0 0 1 0 5.858z"/>
</svg>
</a>
</div>
</nav>
</header>

View file

@ -2,7 +2,7 @@
{% macro combobox(id, name, placeholder, items, value_attr='id', label_attr='name',
add_disabled=True, remove_disabled=True, edit_disabled=True) %}
<div class="col combobox">
<div class="combobox">
<div class="d-flex">
<input type="text" class="form-control border-bottom-0 rounded-bottom-0 rounded-end-0"
placeholder="{{ placeholder }}" id="input-{{id}}" oninput="ComboBox.utilities.changeAdd('{{ id }}');">

View file

@ -23,18 +23,34 @@
<div class="tab-pane fade show active" id="device-tab-pane" tabindex="0">
<div class="row">
<div class="col">
<label for="brand" class="form-label">Brand</label>
{{ combobox('brand', 'brand', 'Enter the name of a brand.', brands, 'id', 'name') }}
</div>
<div class="col">
<label for="devicetype" class="form-label">Device Type</label>
{{ combobox('devicetype', 'devicetype', 'Enter the description of a device type.', device_types, 'id', 'description') }}
</div>
</div>
</div>
<div class="tab-pane fade" id="location-tab-pane" tabindex="0">
<div class="row">
<div class="col">
<label for="area" class="form-label">Area</label>
{{ combobox('area', 'area', 'Enter the name of an area.', areas, 'id', 'name') }}
</div>
<div class="col">
<label for="roomfunction" class="form-label">Description</label>
{{ combobox('roomfunction', 'roomfunction', 'Enter a room description.', functions, 'id', 'description') }}
</div>
</div>
<div class="row mt-3">
<label for="rooms" class="form-label">
Rooms
<a href="{{ url_for('entry.entry_new', model='room') }}" class="link-success link-underline-opacity-0"><small>[+]</small></a>
</label>
<div class="col">
{{ rooms | safe }}
</div>