{% extends "admin/base.html" %} {% import "macros/ui.html" as ui %} {% block title %}{{ t(key="set-discount", lang=lang | default(value='sk')) }}{% endblock title %} {% block crumb %}{{ t(key="admin-discounts", lang=lang | default(value='sk')) }}{% endblock crumb %} {% block content %}

{{ product.name }}

{% if audience == "business" %}{{ t(key="audience-business", lang=lang | default(value='sk')) }}{% else %}{{ t(key="audience-personal", lang=lang | default(value='sk')) }}{% endif %}

{{ ui::button(variant="outline-secondary", label=t(key="cancel", lang=lang | default(value='sk')), href="/admin/catalog/products?audience=" ~ audience, size="px-3 py-2 text-sm") }}
{# One discount row per option (variant). Each row picks a fixed sale price or a #} {# percentage off its own regular price; a blank input clears that option's #} {# discount. Both the fixed and percent inputs always submit (the server reads the #} {# active mode); rows are pre-filled from `rows` (DB values, or submitted values #} {# when repainting after a validation error) and indexed as v[][...]. #}
{{ ui::csrf_field() }} {% if error %} {{ ui::alert_danger(message=t(key=error, lang=lang | default(value='sk'))) }} {% endif %}
{{ ui::button(label=t(key="save", lang=lang | default(value='sk')), type="submit", attrs=`onclick="return confirm('` ~ t(key="discount-apply-confirm", lang=lang | default(value='sk')) ~ `')"`) }} {% if has_discount %} {{ ui::button(variant="outline-danger", label=t(key="remove-discount", lang=lang | default(value='sk')), type="submit", attrs=`formaction="/admin/catalog/products/` ~ product.id ~ `/discount/remove?audience=` ~ audience ~ `" onclick="return confirm('` ~ t(key="discount-remove-confirm", lang=lang | default(value='sk')) ~ `')"`) }} {% endif %}
{% endblock content %}