{#
POST /admin/tables/builder — crate::pages::add_table::ui::BuilderFragment.
The whole builder, which is also what `add_table.html` embeds on first load.
Every control posts the entire draft back to /admin/tables/builder and swaps
this markup in again, so the rules live on the server exactly as they do in
the TUI client. The hidden inputs in the columns, relations and display
sections are what carry the draft across requests.
#}
{% import "ui/alert.html" as alert %}
{%- if let Some(message) = page.error %}{% call alert::error("Could not continue", message) %}{% endcall %}{% endif -%}
{%- if let Some(message) = page.status %}{% call alert::success("Draft updated", message) %}{% endcall %}{% endif -%}
Table
{% if page.draft.show_profile_name_input() %}
{% endif %}
{% if page.draft.show_accounting_currency() %}
{% else %}
{% endif %}
Add a column
{% if page.draft.show_temporal_type() %}
{% endif %}
{% if page.draft.show_gtin_type() %}
{% endif %}
{% if page.draft.show_money_options() %}
{% endif %}
Columns {{ page.draft.columns.len() }}
{% if page.draft.columns.is_empty() %}
No columns yet. Describe one above and press Add column.
{% else %}
Name
Type
Indexed
Options
{% for column in page.draft.columns %}
{{ column.name }}
{{ column.data_type }}
{% if column.quantity_ledger %}quantity ledger{% endif %}
{% if !column.option_label().is_empty() %}{{ column.option_label() }}{% endif %}
{% endfor %}
{% endif %}
{# The draft itself: one set of fields per column, in order. #}
{% for column in page.draft.columns %}
{% endfor %}
Relations
{% if page.draft.links.is_empty() %}
No other tables in this profile to link to.
{% else %}
Each active relation adds a <table>_id column.
{% for link in page.draft.links %}
{{ link.linked_table_name }}
{% endfor %}
{% endif %}
{% for link in page.draft.links %}
{% endfor %}
Row display columns
What identifies a row to users, in the order chosen. Pick id to clear the list.
{% for candidate in page.row_display_candidates() %}
{{ candidate.name }}
{% endfor %}
{% for display in page.draft.row_display_columns %}
{% endfor %}