Refactor inventory and layout templates; enhance form handling with dynamic endpoint and argument passing for improved flexibility
This commit is contained in:
parent
be1e56ad93
commit
f2229cdc90
3 changed files with 173 additions and 137 deletions
|
@ -12,118 +12,116 @@ title=title,
|
|||
submit_button=True) }}
|
||||
|
||||
<div class="container">
|
||||
<form method="POST" action="{{ url_for('main.inventory_item', id=item.id) }}">
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<label for="timestamp" class="form-label">Date Entered</label>
|
||||
<input type="date" class="form-control" name="timestamp"
|
||||
value="{{ item.timestamp.date().isoformat() }}">
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<label for="identifier" class="form-label">Identifier</label>
|
||||
<input type="text" class="form-control-plaintext" value="{{ item.identifier }}" readonly>
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<label for="timestamp" class="form-label">Date Entered</label>
|
||||
<input type="date" class="form-control" name="timestamp" value="{{ item.timestamp.date().isoformat() }}">
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<label for="identifier" class="form-label">Identifier</label>
|
||||
<input type="text" class="form-control-plaintext" value="{{ item.identifier }}" readonly>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">
|
||||
<label for="inventory_name" class="form-label">Inventory #</label>
|
||||
<input type="text" class="form-control" name="inventory_name" placeholder="-"
|
||||
value="{{ item.inventory_name or '' }}">
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<label for="serial" class="form-label">Serial #</label>
|
||||
<input type="text" class="form-control" name="serial" placeholder="-"
|
||||
value="{{ item.serial if item.serial else '' }}">
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<label for="barcode" class="form-label">Bar Code #</label>
|
||||
<input type="text" class="form-control" name="barcode" placeholder="-"
|
||||
value="{{ item.barcode if item.barcode else '' }}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">
|
||||
<label for="brand" class="form-label">Brand</label>
|
||||
<select class="form-select" id="brand" name="brand">
|
||||
<option>-</option>
|
||||
{% for brand in brands %}
|
||||
<option value="{{ brand.id }}" {% if brand.id==item.brand_id %} selected{% endif %}>{{ brand.name }}
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<label for="model" class="form-label">Model</label>
|
||||
<input type="text" class="form-control" name="model" placeholder="-" value="{{ item.model }}">
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<label for="type" class="form-label">Category</label>
|
||||
<select name="type" id="type" class="form-select">
|
||||
<option>-</option>
|
||||
{% for t in types %}
|
||||
<option value="{{ t.id }}" {% if t.id==item.type_id %} selected{% endif %}>{{ t.description }}
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">
|
||||
<label for="owner" class="form-label">
|
||||
Contact
|
||||
{% if item.owner %}
|
||||
{{ links.entry_link('user', item.owner_id) }}
|
||||
{% endif %}
|
||||
</label>
|
||||
<select class="form-select" id="userList">
|
||||
<option>-</option>
|
||||
{% for user in users %}
|
||||
<option value="{{ user.id }}" {% if user.id==item.owner_id %} selected{% endif %}>{{ user.full_name
|
||||
}}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<label for="location" class="form-label">Location</label>
|
||||
<select class="form-select" id="room">
|
||||
<option>-</option>
|
||||
{% for room in rooms %}
|
||||
<option value="{{ room.id }}" {% if room.id==item.location_id %} selected{% endif %}>{{
|
||||
room.full_name }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-2">
|
||||
<label for="condition" class="form-label">Condition</label>
|
||||
<select name="condition" id="condition" class="form-select">
|
||||
<option>-</option>
|
||||
{% for condition in ["Working", "Deployed", "Partially Inoperable", "Inoperable", "Unverified",
|
||||
"Removed", "Disposed"] %}
|
||||
<option value="{{ condition }}" {% if item.condition==condition %} selected{% endif %}>{{ condition }}
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-2 d-flex align-items-center justify-content-center" style="margin-top: 1.9rem;">
|
||||
<div class="form-check mb-0">
|
||||
<input type="checkbox" class="form-check-input" id="shared" name="shared" {% if item.shared %}checked{%
|
||||
endif %}>
|
||||
<label for="shared" class="form-check-label">Shared?</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">
|
||||
<label for="inventory_name" class="form-label">Inventory #</label>
|
||||
<input type="text" class="form-control" name="inventory_name" placeholder="-"
|
||||
value="{{ item.inventory_name or '' }}">
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<label for="serial" class="form-label">Serial #</label>
|
||||
<input type="text" class="form-control" name="serial" placeholder="-"
|
||||
value="{{ item.serial if item.serial else '' }}">
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<label for="barcode" class="form-label">Bar Code #</label>
|
||||
<input type="text" class="form-control" name="barcode" placeholder="-"
|
||||
value="{{ item.barcode if item.barcode else '' }}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<label for="notes" class="form-label">Notes & Comments</label>
|
||||
<textarea name="notes" id="notes" class="form-control"
|
||||
rows="10">{{ item.notes if item.notes else '' }}</textarea>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">
|
||||
<label for="brand" class="form-label">Brand</label>
|
||||
<select class="form-select" id="brand" name="brand">
|
||||
<option>-</option>
|
||||
{% for brand in brands %}
|
||||
<option value="{{ brand.id }}" {% if brand.id==item.brand_id %} selected{% endif %}>{{ brand.name }}
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<label for="model" class="form-label">Model</label>
|
||||
<input type="text" class="form-control" name="model" placeholder="-" value="{{ item.model }}">
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<label for="type" class="form-label">Category</label>
|
||||
<select name="type" id="type" class="form-select">
|
||||
<option>-</option>
|
||||
{% for t in types %}
|
||||
<option value="{{ t.id }}" {% if t.id==item.type_id %} selected{% endif %}>{{ t.description }}
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
{% if worklog %}
|
||||
<div class="col">
|
||||
{{ tables.render_table(headers=worklog_headers, rows=worklog_rows, id='worklog',
|
||||
entry_route='worklog_entry', title='Work Log') }}
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">
|
||||
<label for="owner" class="form-label">
|
||||
Contact
|
||||
{% if item.owner %}
|
||||
{{ links.entry_link('user', item.owner_id) }}
|
||||
{% endif %}
|
||||
</label>
|
||||
<select class="form-select" id="userList">
|
||||
<option>-</option>
|
||||
{% for user in users %}
|
||||
<option value="{{ user.id }}" {% if user.id==item.owner_id %} selected{% endif %}>{{ user.full_name
|
||||
}}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<label for="location" class="form-label">Location</label>
|
||||
<select class="form-select" id="room">
|
||||
<option>-</option>
|
||||
{% for room in rooms %}
|
||||
<option value="{{ room.id }}" {% if room.id==item.location_id %} selected{% endif %}>{{
|
||||
room.full_name }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-2">
|
||||
<label for="condition" class="form-label">Condition</label>
|
||||
<select name="condition" id="condition" class="form-select">
|
||||
<option>-</option>
|
||||
{% for condition in ["Working", "Deployed", "Partially Inoperable", "Inoperable", "Unverified",
|
||||
"Removed", "Disposed"] %}
|
||||
<option value="{{ condition }}"{% if item.condition == condition %} selected{% endif %}>{{ condition }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-2 d-flex align-items-center justify-content-center" style="margin-top: 1.9rem;">
|
||||
<div class="form-check mb-0">
|
||||
<input type="checkbox" class="form-check-input" id="shared" name="shared" {% if item.shared
|
||||
%}checked{% endif %}>
|
||||
<label for="shared" class="form-check-label">Shared?</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<label for="notes" class="form-label">Notes & Comments</label>
|
||||
<textarea name="notes" id="notes" class="form-control"
|
||||
rows="10">{{ item.notes if item.notes else '' }}</textarea>
|
||||
</div>
|
||||
{% if worklog %}
|
||||
<div class="col">
|
||||
{{ tables.render_table(headers=worklog_headers, rows=worklog_rows, id='worklog',
|
||||
entry_route='worklog_entry', title='Work Log') }}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</form>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
Loading…
Add table
Add a link
Reference in a new issue