BrickTracker/templates/macro/form.html

33 lines
1.3 KiB
HTML

{% macro checkbox(prefix, id, text, url, checked, delete=false) %}
{% if g.login.is_authenticated() %}
<input class="form-check-input" type="checkbox" id="{{ prefix }}-{{ id }}" {% if checked %}checked{% endif %}
{% if not delete %}
data-changer-id="{{ id }}" data-changer-prefix="{{ prefix }}" data-changer-url="{{ url }}" data-changer-parent="set"
{% else %}
disabled
{% endif %}
autocomplete="off">
<label class="form-check-label" for="{{ prefix }}-{{ id }}">
{{ text }} <i id="status-{{ prefix }}-{{ id }}" class="mb-1"></i>
</label>
{% else %}
<input class="form-check-input text-reset" type="checkbox" {% if checked %}checked{% endif %} disabled>
{{ text }}
{% endif %}
{% endmacro %}
{% macro input(id, html_id, url, value) %}
<input class="form-control form-control-sm flex-shrink-1" type="text" value="{% if value %}{{ value }}{% endif %}"
{% if g.login.is_authenticated() %}
onchange="change_part_missing_amount(this, '{{ id }}', '{{ html_id }}', '{{ url }}')"
{% else %}
disabled
{% endif %}
autocomplete="off">
{% if g.login.is_authenticated() %}
<span id="status-part-{{ id }}-{{ html_id }}" class="input-group-text ri-save-line"></span>
{% else %}
<span class="input-group-text ri-prohibited-line"></span>
{% endif %}
{% endmacro %}