38 lines
1.8 KiB
HTML
38 lines
1.8 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 %}Add logic{% endblock %}
|
|
{% block eyebrow %}Computed column{% endblock %}
|
|
{% block heading %}Add logic{% endblock %}
|
|
{% block lead %}<p>Create or update a Steel script through the existing table-script service.</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">Table
|
|
<select name="table_definition_id" required>
|
|
<option value="0">Choose a 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>Logic name<input name="logic_name" value="{{ page.form.logic_name }}" placeholder="invoice total"></label>
|
|
<label>Target column<input name="target_column" value="{{ page.form.target_column }}" required placeholder="total"></label>
|
|
<label class="wide">Steel expression
|
|
<textarea name="script" rows="12" required placeholder="(+ (get-var "subtotal") (get-var "tax"))">{{ page.form.script }}</textarea>
|
|
</label>
|
|
<label class="wide">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("Could not save the logic", message) %}{% endcall %}{% endif -%}
|
|
</div>
|
|
<div class="form-actions">
|
|
<a href="/admin">Cancel</a>
|
|
<button type="submit">Save logic</button>
|
|
</div>
|
|
</form>
|
|
{% endblock %}
|