Storage filterable and searchable on the Grid

This commit is contained in:
Gregoo 2025-02-03 17:09:59 +01:00
parent 56c926a8ef
commit ac2d2a0b5d
2 changed files with 23 additions and 1 deletions

View File

@ -11,6 +11,11 @@
data-has-minifigures="{{ (item.fields.total_minifigures > 0) | int }}" data-minifigures="{{ item.fields.total_minifigures }}"
data-has-missing="{{ (item.fields.total_missing > 0) | int }}" data-missing="{{ item.fields.total_missing }}"
data-has-damaged="{{ (item.fields.total_damaged > 0) | int }}" data-damaged="{{ item.fields.total_damaged }}"
data-has-storage="{{ item.fields.storage is not none | int }}"
{% if item.fields.storage is not none %}
data-storage="{{ item.fields.storage }}"
{% if item.fields.storage in brickset_storages.mapping %}data-search-storage="{{ brickset_storages.mapping[item.fields.storage].fields.name | lower }}"{% endif %}
{% endif %}
{% for status in brickset_statuses %}
{% with checked=item.fields[status.as_column()] %}
{% if checked %}

View File

@ -10,7 +10,7 @@
<label class="visually-hidden" for="grid-search">Search</label>
<div class="input-group">
<span class="input-group-text"><i class="ri-search-line"></i><span class="ms-1 d-none d-xl-inline"> Search</span></span>
<input id="grid-search" data-search-exact="name,number,parts,theme,year" data-search-list="searchOwner,searchTag" class="form-control form-control-sm" type="text" placeholder="Set, name, number of parts, theme, year, owner, tag" value="">
<input id="grid-search" data-search-exact="name,number,parts,searchStorage,theme,year" data-search-list="searchOwner,searchTag" class="form-control form-control-sm" type="text" placeholder="Set, name, number of parts, theme, year, owner, storage, tag" value="">
</div>
</div>
<div class="col-12">
@ -57,6 +57,7 @@
<option value="has-missing">Set has missing pieces</option>
<option value="has-damaged">Set has damaged pieces</option>
<option value="has-missing-instructions">Set has missing instructions</option>
{% if brickset_storage | length %}<option value="has-storage">Is in storage</option>{% endif %}
{% for status in brickset_statuses %}
<option value="{{ status.as_dataset() }}">{{ status.fields.name }}</option>
<option value="-{{ status.as_dataset() }}">NOT: {{ status.fields.name }}</option>
@ -92,6 +93,22 @@
</select>
</div>
</div>
{% if brickset_storages | length %}
<div class="col-12 flex-grow-1">
<label class="visually-hidden" for="grid-owner">Storage</label>
<div class="input-group">
<span class="input-group-text"><i class="ri-archive-2-line"></i><span class="ms-1 d-none d-xl-inline"> Storage</span></span>
<select id="grid-storage" class="form-select"
data-filter="value" data-filter-attribute="storage"
autocomplete="off">
<option value="" selected>All</option>
{% for storage in brickset_storages %}
<option value="{{ storage.fields.id }}">{{ storage.fields.name }}</option>
{% endfor %}
</select>
</div>
</div>
{% endif %}
<div class="col-12 flex-grow-1">
<label class="visually-hidden" for="grid-tag">Tag</label>
<div class="input-group">