43 lines
2.3 KiB
HTML
43 lines
2.3 KiB
HTML
{# GET /admin/tables/new — crate::pages::add_table::ui::AddTablePage #}
|
|
{% extends "ui/form_page.html" %}
|
|
{% import "ui/alert.html" as alert %}
|
|
|
|
{% block title %}Add table{% endblock %}
|
|
{% block eyebrow %}Table definition{% endblock %}
|
|
{% block heading %}Add table{% endblock %}
|
|
{% block lead %}<p>Create a table through the existing gRPC table-definition service.</p>{% endblock %}
|
|
|
|
{% block form %}
|
|
<form hx-post="/admin/tables" hx-target="#submission-status" hx-swap="innerHTML"
|
|
hx-disabled-elt="button[type=submit]">
|
|
<div class="form-grid">
|
|
<label>Profile
|
|
<select name="profile_name" required>
|
|
<option value="">Choose a profile</option>
|
|
{% for profile in page.profiles %}
|
|
<option value="{{ profile }}" {% if page.form.profile_name == *profile %}selected{% endif %}>{{ profile }}</option>
|
|
{% endfor %}
|
|
</select>
|
|
</label>
|
|
<label>Table name<input name="table_name" value="{{ page.form.table_name }}" required placeholder="invoices"></label>
|
|
<label class="wide">Columns
|
|
<textarea name="columns" rows="9" required
|
|
placeholder="number: text:indexed issued_on: date stock: int:quantity-ledger">{{ page.form.columns }}</textarea>
|
|
<small>One per line: <code>name: type: optional flags</code>. Flags: indexed, half-up, quantity-ledger.</small>
|
|
</label>
|
|
<label>Additional indexed columns<input name="indexed_columns" value="{{ page.form.indexed_columns }}" placeholder="number, issued_on"></label>
|
|
<label>Base currency<input name="base_currency" value="{{ page.form.base_currency }}" maxlength="3" placeholder="EUR"></label>
|
|
<label>Required links<input name="required_links" value="{{ page.form.required_links }}" placeholder="customer, address"></label>
|
|
<label>Optional links<input name="optional_links" value="{{ page.form.optional_links }}" placeholder="project"></label>
|
|
<label>Row display columns<input name="row_display_columns" value="{{ page.form.row_display_columns }}" placeholder="name, ico"></label>
|
|
</div>
|
|
<div id="submission-status" aria-live="polite">
|
|
{%- if let Some(message) = page.error %}{% call alert::error("Could not create the table", message) %}{% endcall %}{% endif -%}
|
|
</div>
|
|
<div class="form-actions">
|
|
<a href="/admin">Cancel</a>
|
|
<button type="submit">Create table</button>
|
|
</div>
|
|
</form>
|
|
{% endblock %}
|