Enhance inventory templates with new SVG icons and refactor category links for improved navigation

This commit is contained in:
Yaro Kasear 2025-06-13 10:33:20 -05:00
parent f4f9f84387
commit a5feeeee1d
3 changed files with 41 additions and 54 deletions

View file

@ -16,6 +16,40 @@
</svg> </svg>
{% endset %} {% endset %}
{% set map %}
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="currentColor" class="bi bi-map align-self-center"
viewBox="0 0 16 16">
<path fill-rule="evenodd"
d="M15.817.113A.5.5 0 0 1 16 .5v14a.5.5 0 0 1-.402.49l-5 1a.5.5 0 0 1-.196 0L5.5 15.01l-4.902.98A.5.5 0 0 1 0 15.5v-14a.5.5 0 0 1 .402-.49l5-1a.5.5 0 0 1 .196 0L10.5.99l4.902-.98a.5.5 0 0 1 .415.103M10 1.91l-4-.8v12.98l4 .8zm1 12.98 4-.8V1.11l-4 .8zm-6-.8V1.11l-4 .8v12.98z" />
</svg>
{% endset %}
{% set motherboard %}
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="currentColor"
class="bi bi-motherboard align-self-center" viewBox="0 0 16 16">
<path
d="M11.5 2a.5.5 0 0 1 .5.5v7a.5.5 0 0 1-1 0v-7a.5.5 0 0 1 .5-.5m2 0a.5.5 0 0 1 .5.5v7a.5.5 0 0 1-1 0v-7a.5.5 0 0 1 .5-.5m-10 8a.5.5 0 0 0 0 1h6a.5.5 0 0 0 0-1zm0 2a.5.5 0 0 0 0 1h6a.5.5 0 0 0 0-1zM5 3a1 1 0 0 0-1 1h-.5a.5.5 0 0 0 0 1H4v1h-.5a.5.5 0 0 0 0 1H4a1 1 0 0 0 1 1v.5a.5.5 0 0 0 1 0V8h1v.5a.5.5 0 0 0 1 0V8a1 1 0 0 0 1-1h.5a.5.5 0 0 0 0-1H9V5h.5a.5.5 0 0 0 0-1H9a1 1 0 0 0-1-1v-.5a.5.5 0 0 0-1 0V3H6v-.5a.5.5 0 0 0-1 0zm0 1h3v3H5zm6.5 7a.5.5 0 0 0-.5.5v1a.5.5 0 0 0 .5.5h2a.5.5 0 0 0 .5-.5v-1a.5.5 0 0 0-.5-.5z" />
<path
d="M1 2a2 2 0 0 1 2-2h11a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2v-2H.5a.5.5 0 0 1-.5-.5v-1A.5.5 0 0 1 .5 9H1V8H.5a.5.5 0 0 1-.5-.5v-1A.5.5 0 0 1 .5 6H1V5H.5a.5.5 0 0 1-.5-.5v-2A.5.5 0 0 1 .5 2zm1 11a1 1 0 0 0 1 1h11a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1H3a1 1 0 0 0-1 1z" />
</svg>
{% endset %}
{% set search %}
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="currentColor"
class="bi bi-search align-self-center" viewBox="0 0 16 16">
<path
d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001q.044.06.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1 1 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0" />
</svg>
{% endset %}
{% set table %}
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="currentColor" class="bi bi-table align-self-center"
viewBox="0 0 16 16">
<path
d="M0 2a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2zm15 2h-4v3h4zm0 4h-4v3h4zm0 4h-4v3h3a1 1 0 0 0 1-1zm-5 3v-3H6v3zm-5 0v-3H1v2a1 1 0 0 0 1 1zm-4-4h4V8H1zm0-4h4V4H1zm5-3v3h4V4zm4 4H6v3h4z" />
</svg>
{% endset %}
{% set user %} {% set user %}
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="currentColor" <svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="currentColor"
class="bi bi-person align-self-center" viewBox="0 0 16 16"> class="bi bi-person align-self-center" viewBox="0 0 16 16">

View file

@ -1,5 +1,5 @@
{% macro category_link(endpoint, label, icon_html=None, arguments={}) %} {% macro category_link(endpoint, label, icon_html=None, arguments={}) %}
<div class="col"> <div class="col text-center">
<a href="{{ url_for('main.' + endpoint, **arguments) }}" <a href="{{ url_for('main.' + endpoint, **arguments) }}"
class="d-flex flex-column justify-content-center link-success link-underline-opacity-0"> class="d-flex flex-column justify-content-center link-success link-underline-opacity-0">
{% if icon_html %} {% if icon_html %}

View file

@ -16,25 +16,8 @@ title=title
</div> </div>
</div> </div>
<div class="row text-center"> <div class="row text-center">
<div class="col d-flex flex-column justify-content-center"> {{ links.category_link(endpoint = 'search', label = 'Search', icon_html = icons.search, arguments={'category': 'inventory'}) }}
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="currentColor" {{ links.category_link(endpoint = 'list_inventory', label = "List", icon_html = icons.table) }}
class="bi bi-search align-self-center" viewBox="0 0 16 16">
<path
d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001q.044.06.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1 1 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0" />
</svg>
Search
</div>
<div class="col">
<a href="{{ url_for('main.list_inventory') }}"
class="d-flex flex-column justify-content-center link-success link-underline-opacity-0">
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="currentColor"
class="bi bi-table align-self-center" viewBox="0 0 16 16">
<path
d="M0 2a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2zm15 2h-4v3h4zm0 4h-4v3h4zm0 4h-4v3h3a1 1 0 0 0 1-1zm-5 3v-3H6v3zm-5 0v-3H1v2a1 1 0 0 0 1 1zm-4-4h4V8H1zm0-4h4V4H1zm5-3v3h4V4zm4 4H6v3h4z" />
</svg>
List
</a>
</div>
</div> </div>
<div class="row"> <div class="row">
<div class="col"> <div class="col">
@ -42,46 +25,16 @@ title=title
</div> </div>
</div> </div>
<div class="row text-center"> <div class="row text-center">
<div class="col"> {{ links.category_link(endpoint = 'inventory_index', label = "By User", icon_html = icons.user, arguments = {'category': 'user'}) }}
<a href="{{ url_for('main.inventory_index', category='user') }}" {{ links.category_link(endpoint = 'inventory_index', label = 'By Location', icon_html = icons.map, arguments = {'category': 'location'}) }}
class="d-flex flex-column justify-content-center link-success link-underline-opacity-0"> {{ links.category_link(endpoint = 'inventory_index', label = 'By Type', icon_html = icons.motherboard, arguments = {'category': 'type'}) }}
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="currentColor"
class="bi bi-person align-self-center" viewBox="0 0 16 16">
<path
d="M8 8a3 3 0 1 0 0-6 3 3 0 0 0 0 6m2-3a2 2 0 1 1-4 0 2 2 0 0 1 4 0m4 8c0 1-1 1-1 1H3s-1 0-1-1 1-4 6-4 6 3 6 4m-1-.004c-.001-.246-.154-.986-.832-1.664C11.516 10.68 10.289 10 8 10s-3.516.68-4.168 1.332c-.678.678-.83 1.418-.832 1.664z" />
</svg>
By User
</a>
</div>
<div class="col"><a href="{{ url_for('main.inventory_index', category='location') }}"
class="d-flex flex-column justify-content-center link-success link-underline-opacity-0">
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="currentColor"
class="bi bi-map align-self-center" viewBox="0 0 16 16">
<path fill-rule="evenodd"
d="M15.817.113A.5.5 0 0 1 16 .5v14a.5.5 0 0 1-.402.49l-5 1a.5.5 0 0 1-.196 0L5.5 15.01l-4.902.98A.5.5 0 0 1 0 15.5v-14a.5.5 0 0 1 .402-.49l5-1a.5.5 0 0 1 .196 0L10.5.99l4.902-.98a.5.5 0 0 1 .415.103M10 1.91l-4-.8v12.98l4 .8zm1 12.98 4-.8V1.11l-4 .8zm-6-.8V1.11l-4 .8v12.98z" />
</svg>
By Location
</a></div>
<div class="col"><a href="{{ url_for('main.inventory_index', category='type') }}"
class="d-flex flex-column justify-content-center link-success link-underline-opacity-0">
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="currentColor"
class="bi bi-motherboard align-self-center" viewBox="0 0 16 16">
<path
d="M11.5 2a.5.5 0 0 1 .5.5v7a.5.5 0 0 1-1 0v-7a.5.5 0 0 1 .5-.5m2 0a.5.5 0 0 1 .5.5v7a.5.5 0 0 1-1 0v-7a.5.5 0 0 1 .5-.5m-10 8a.5.5 0 0 0 0 1h6a.5.5 0 0 0 0-1zm0 2a.5.5 0 0 0 0 1h6a.5.5 0 0 0 0-1zM5 3a1 1 0 0 0-1 1h-.5a.5.5 0 0 0 0 1H4v1h-.5a.5.5 0 0 0 0 1H4a1 1 0 0 0 1 1v.5a.5.5 0 0 0 1 0V8h1v.5a.5.5 0 0 0 1 0V8a1 1 0 0 0 1-1h.5a.5.5 0 0 0 0-1H9V5h.5a.5.5 0 0 0 0-1H9a1 1 0 0 0-1-1v-.5a.5.5 0 0 0-1 0V3H6v-.5a.5.5 0 0 0-1 0zm0 1h3v3H5zm6.5 7a.5.5 0 0 0-.5.5v1a.5.5 0 0 0 .5.5h2a.5.5 0 0 0 .5-.5v-1a.5.5 0 0 0-.5-.5z" />
<path
d="M1 2a2 2 0 0 1 2-2h11a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2v-2H.5a.5.5 0 0 1-.5-.5v-1A.5.5 0 0 1 .5 9H1V8H.5a.5.5 0 0 1-.5-.5v-1A.5.5 0 0 1 .5 6H1V5H.5a.5.5 0 0 1-.5-.5v-2A.5.5 0 0 1 .5 2zm1 11a1 1 0 0 0 1 1h11a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1H3a1 1 0 0 0-1 1z" />
</svg>
By Type
</a></div>
</div> </div>
{% else %} {% else %}
<div class="container"> <div class="container">
{% for line in listing %} {% for line in listing %}
<div class="row my-3"> <div class="row my-3">
{% for id, name in line %} {% for id, name in line %}
<div class="col text-center"> {{ links.category_link(endpoint = 'list_inventory', label = name, arguments = {'filter_by': category, 'id': id}) }}
<a href="{{ url_for('main.list_inventory', filter_by=category, id=id) }}" class="link-success link-underline-opacity-0">{{ name }}</a>
</div>
{% endfor %} {% endfor %}
</div> </div>
{% endfor %} {% endfor %}