Files
komp_ac/web/templates/pages/add_logic/add_logic.html
2026-08-14 20:35:37 +02:00

38 lines
2.0 KiB
HTML

{# GET /admin/logic/new — crate::pages::add_logic::ui::AddLogicPage #}
{% extends "ui/form_page.html" %}
{% import "ui/alert.html" as alert %}
{% block title %}{{ nav.tr("add-logic-title") }}{% endblock %}
{% block eyebrow %}{{ nav.tr("add-logic-eyebrow") }}{% endblock %}
{% block heading %}{{ nav.tr("add-logic-title") }}{% endblock %}
{% block lead %}<p>{{ nav.tr("add-logic-lead") }}</p>{% endblock %}
{% block form %}
<form hx-post="/admin/logic" hx-target="#submission-status" hx-swap="innerHTML"
hx-disabled-elt="button[type=submit]">
<div class="form-grid">
<label class="wide">{{ nav.tr("add-logic-table") }}
<select name="table_definition_id" required>
<option value="0">{{ nav.tr("add-logic-choose-table") }}</option>
{% for table in page.tables %}
<option value="{{ table.id }}" {% if page.form.table_definition_id == table.id %}selected{% endif %}>{{ table.profile_name }}.{{ table.table_name }}</option>
{% endfor %}
</select>
</label>
<label>{{ nav.tr("add-logic-name") }}<input name="logic_name" value="{{ page.form.logic_name }}" placeholder="invoice total"></label>
<label>{{ nav.tr("add-logic-target-column") }}<input name="target_column" value="{{ page.form.target_column }}" required placeholder="total"></label>
<label class="wide">{{ nav.tr("add-logic-script") }}
<textarea name="script" rows="12" required placeholder="(+ (get-var &quot;subtotal&quot;) (get-var &quot;tax&quot;))">{{ page.form.script }}</textarea>
</label>
<label class="wide">{{ nav.tr("add-logic-description") }}<input name="description" value="{{ page.form.description }}"></label>
</div>
<div id="submission-status" aria-live="polite">
{%- if let Some(message) = page.error %}{% call alert::error(nav.locale, nav.tr("add-logic-error-title"), message) %}{% endcall %}{% endif -%}
</div>
<div class="form-actions">
<a href="/admin">{{ nav.tr("common-cancel") }}</a>
<button type="submit">{{ nav.tr("add-logic-save") }}</button>
</div>
</form>
{% endblock %}