forked from FrederikBaerentsen/BrickTracker
Massive rewrite
This commit is contained in:
24
templates/part/card.html
Normal file
24
templates/part/card.html
Normal file
@@ -0,0 +1,24 @@
|
||||
{% import 'macro/accordion.html' as accordion %}
|
||||
{% import 'macro/badge.html' as badge %}
|
||||
{% import 'macro/card.html' as card %}
|
||||
|
||||
<div class="card mb-3 flex-fill card-solo">
|
||||
{{ card.header(item, item.fields.name, solo=solo, number=item.fields.part_num, color=item.fields.color_name, icon='shapes-line') }}
|
||||
{{ card.image(item, solo=solo, last=last, caption=item.fields.name, alt=item.fields.part_img_url_id, medium=true) }}
|
||||
<div class="card-body border-bottom {% if not solo %}p-1{% endif %}">
|
||||
{{ badge.total_sets(sets_using | length, solo=solo, last=last) }}
|
||||
{{ badge.total_minifigures(minifigures_using | length, solo=solo, last=last) }}
|
||||
{{ badge.total_quantity(item.fields.total_quantity, solo=solo, last=last) }}
|
||||
{{ badge.total_spare(item.fields.total_spare, solo=solo, last=last) }}
|
||||
{{ badge.total_missing(item.fields.total_missing, solo=solo, last=last) }}
|
||||
{{ badge.rebrickable(item, solo=solo, last=last) }}
|
||||
{{ badge.bricklink(item, solo=solo, last=last) }}
|
||||
</div>
|
||||
<div class="accordion accordion-flush" id="part-details">
|
||||
{{ accordion.cards(sets_using, 'Sets using this part', 'sets-using-inventory', 'part-details', 'set/card.html', icon='hashtag') }}
|
||||
{{ accordion.cards(sets_missing, 'Sets missing this part', 'sets-missing-inventory', 'part-details', 'set/card.html', icon='error-warning-line') }}
|
||||
{{ accordion.cards(minifigures_using, 'Minifigures using this part', 'minifigures-using-inventory', 'part-details', 'minifigure/card.html', icon='group-line') }}
|
||||
{{ accordion.cards(minifigures_missing, 'Minifigures missing this part', 'minifigures-missing-inventory', 'part-details', 'minifigure/card.html', icon='error-warning-line') }}
|
||||
</div>
|
||||
<div class="card-footer"></div>
|
||||
</div>
|
||||
52
templates/part/table.html
Normal file
52
templates/part/table.html
Normal file
@@ -0,0 +1,52 @@
|
||||
{% import 'macro/table.html' as table %}
|
||||
|
||||
<div class="table-responsive-sm">
|
||||
<table class="table table-striped align-middle {% if not all %}sortable mb-0{% endif %}" {% if all %}id="parts"{% endif %}>
|
||||
{{ table.header(color=true, quantity=not no_quantity, missing=not no_missing, sets=all, minifigures=all) }}
|
||||
<tbody>
|
||||
{% for item in table_collection %}
|
||||
<tr>
|
||||
{{ table.image(item.url_for_image(), caption=item.fields.name, alt=item.fields.part_num, accordion=solo) }}
|
||||
<td>
|
||||
<a class="text-reset" href="{{ item.url() }}">{{ item.fields.name }}</a>
|
||||
{% if item.fields.is_spare %}<span class="badge rounded-pill text-bg-warning fw-normal"><i class="ri-loop-left-line"></i> Spare</span>{% endif %}
|
||||
{% if all %}
|
||||
{{ table.rebrickable(item) }}
|
||||
{{ table.bricklink(item) }}
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>{{ item.fields.color_name }}</td>
|
||||
{% if not no_quantity %}
|
||||
<td>{% if quantity %}{{ item.fields.quantity * quantity }}{% else %}{{ item.fields.quantity }}{% endif %}</td>
|
||||
{% endif %}
|
||||
{% if not no_missing %}
|
||||
<td {% if not all %}id="sort-item-{{ item.fields.u_id }}-{{ item.fields.id }}" data-sort="{{ item.fields.total_missing }}"{% endif %} class="table-td-missing">
|
||||
{% if all or read_only_missing %}
|
||||
{{ item.fields.total_missing }}
|
||||
{% else %}
|
||||
<div class="input-group">
|
||||
{% if g.login.is_readonly() %}
|
||||
<input class="form-control form-control-sm" type="text" {% if item.fields.total_missing %}value="{{ item.fields.total_missing }}"{% endif %}
|
||||
disabled autocomplete="off">
|
||||
<span class="input-group-text ri-prohibited-line"></span>
|
||||
{% else %}
|
||||
<input class="form-control form-control-sm flex-shrink-1" type="text" {% if item.fields.total_missing %}value="{{ item.fields.total_missing }}"{% endif %}
|
||||
onchange="change_part_missing_amount(this, '{{ item.fields.u_id }}', '{{ item.fields.id }}', '{{ item.url_for_missing() }}')" autocomplete="off">
|
||||
<span id="status-item-{{ item.fields.u_id }}-{{ item.fields.id }}" class="input-group-text ri-save-line"></span>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</td>
|
||||
{% endif %}
|
||||
{% if all %}
|
||||
<td>{{ item.fields.total_sets }}</td>
|
||||
<td>{{ item.fields.total_minifigures }}</td>
|
||||
{% endif %}
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{% if all %}
|
||||
{{ table.dynamic('parts', no_sort='0', number='3, 4, 5, 6')}}
|
||||
{% endif %}
|
||||
Reference in New Issue
Block a user