I'm "done." At least for now. Need deletion implementation.
This commit is contained in:
parent
ae54277e58
commit
81e02bbabd
5 changed files with 36 additions and 7 deletions
|
|
@ -12,7 +12,6 @@ _engine = None
|
||||||
SessionLocal = None
|
SessionLocal = None
|
||||||
|
|
||||||
def init_db(database_url: str, engine_kwargs: Dict[str, Any], session_kwargs: Dict[str, Any]) -> 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
|
global _engine, SessionLocal
|
||||||
print(database_url)
|
print(database_url)
|
||||||
_engine = create_engine(database_url, **engine_kwargs)
|
_engine = create_engine(database_url, **engine_kwargs)
|
||||||
|
|
|
||||||
|
|
@ -282,6 +282,12 @@ def init_entry_routes(app):
|
||||||
f["label"] = ""
|
f["label"] = ""
|
||||||
f["label_spec"] = "New User"
|
f["label_spec"] = "New User"
|
||||||
break
|
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()
|
obj = cls()
|
||||||
ScopedSession = current_app.extensions["crudkit"]["Session"]
|
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:
|
if "work_item" in payload and "work_item_id" not in payload:
|
||||||
payload["work_item_id"] = payload.pop("work_item")
|
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
|
# Parent first, no commit yet
|
||||||
obj = svc.create(payload, actor="create_entry", commit=False)
|
obj = svc.create(payload, actor="create_entry", commit=False)
|
||||||
|
|
||||||
|
|
@ -422,7 +432,6 @@ def init_entry_routes(app):
|
||||||
|
|
||||||
return {"status": "success", "payload": payload}
|
return {"status": "success", "payload": payload}
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
|
||||||
return {"status": "failure", "error": str(e)}
|
return {"status": "failure", "error": str(e)}
|
||||||
|
|
||||||
app.register_blueprint(bp_entry)
|
app.register_blueprint(bp_entry)
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,11 @@
|
||||||
<input type="text" id="searchText" class="form-control me-3">
|
<input type="text" id="searchText" class="form-control me-3">
|
||||||
<button type="button" id="searchButton" class="btn btn-primary" disabled>Search</button>
|
<button type="button" id="searchButton" class="btn btn-primary" disabled>Search</button>
|
||||||
</div>
|
</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>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
</header>
|
</header>
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
{% macro combobox(id, name, placeholder, items, value_attr='id', label_attr='name',
|
{% macro combobox(id, name, placeholder, items, value_attr='id', label_attr='name',
|
||||||
add_disabled=True, remove_disabled=True, edit_disabled=True) %}
|
add_disabled=True, remove_disabled=True, edit_disabled=True) %}
|
||||||
<div class="col combobox">
|
<div class="combobox">
|
||||||
<div class="d-flex">
|
<div class="d-flex">
|
||||||
<input type="text" class="form-control border-bottom-0 rounded-bottom-0 rounded-end-0"
|
<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 }}');">
|
placeholder="{{ placeholder }}" id="input-{{id}}" oninput="ComboBox.utilities.changeAdd('{{ id }}');">
|
||||||
|
|
|
||||||
|
|
@ -23,18 +23,34 @@
|
||||||
|
|
||||||
<div class="tab-pane fade show active" id="device-tab-pane" tabindex="0">
|
<div class="tab-pane fade show active" id="device-tab-pane" tabindex="0">
|
||||||
<div class="row">
|
<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') }}
|
{{ 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') }}
|
{{ combobox('devicetype', 'devicetype', 'Enter the description of a device type.', device_types, 'id', 'description') }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="tab-pane fade" id="location-tab-pane" tabindex="0">
|
<div class="tab-pane fade" id="location-tab-pane" tabindex="0">
|
||||||
<div class="row">
|
<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') }}
|
{{ 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') }}
|
{{ combobox('roomfunction', 'roomfunction', 'Enter a room description.', functions, 'id', 'description') }}
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="row mt-3">
|
<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">
|
<div class="col">
|
||||||
{{ rooms | safe }}
|
{{ rooms | safe }}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue