{# The append-columns panel — crate::pages::admin::table_definition::ui::ColumnPanelFragment, and what workspace.html embeds inside #column-form. Staging a column writes nothing, so these buttons swap this panel alone. Saving is the form's own submit, which swaps the whole workspace. The field names are the ones crate::schema::ColumnForm declares — the same set the Add-table builder posts, decoded by the same code. #} {# Staging swaps this panel and nothing else, so a refused column has nowhere else to be reported. When the workspace embeds the panel it reports the outcome at the top instead, and this block stays out of the way. #} {% import "ui/alert.html" as panel_alert %} {% import "ui/dialog.html" as panel_dialog %} {% import "ui/toast.html" as panel_toast %} {% if standalone_column_panel %} {%- if let Some(message) = page.error %}{% call panel_alert::error(nav.locale, nav.tr("td-could-not-add-column"), message) %}{% endcall %}{% endif -%} {%- if let Some(message) = page.status %}{% call panel_toast::success(nav.tr("td-staged"), message) %}{% endcall %}{% endif -%} {%- if let Some(message) = page.error %}{% call panel_dialog::error(nav.locale, nav.tr("td-could-not-add-column"), message) %}{% endcall %}{% endif -%} {% endif %}

{{ nav.tr("builder-add-column-heading") }}

{% if page.columns.show_temporal_type() %} {% endif %} {% if page.columns.show_gtin_type() %} {% endif %} {% if page.columns.show_link_target() %} {% endif %} {% if page.columns.show_money_options() %} {% endif %} {# A link is left out rather than defaulted to "no": the server builds an index for every foreign key as it adds the column, and refuses a request that asks for one on top. #} {% if page.columns.show_indexing() %} {% else if page.columns.pending_is_auto_indexed() %}
{{ nav.tr("td-indexing") }}

{{ nav.tr("td-indexed-automatically") }}

{% endif %} {% if page.columns.show_quantity_ledger() %} {% else %}

{{ nav.tr("td-shared-no-quantity-ledger") }}

{% endif %}
{% let existing_count = page.existing_column_count() %}

{{ nav.tr("builder-columns-heading") }} {{ existing_count + page.columns.added.len() }}

{% if existing_count == 0 && page.columns.added.is_empty() %}

{{ nav.tr("td-no-staged-columns") }} {{ nav.tr("td-stage-column") }}.

{% else %} {% if !page.columns.added.is_empty() %}

{{ nav.tr("builder-columns-order-hint") }}

{% endif %} {# The table as it already exists, shown exactly the way the create builder shows a generated companion: a locked row with nothing to reorder. Unlike a freshly staged column, removing one is a checkbox to tick rather than an action that fires immediately — the same control as before, just carried into this column's own cell so the row lines up with the staged ones below it. #} {% if let Some(detail) = page.detail %} {% for column in detail.columns %} {% endfor %} {% endif %} {% for column in page.columns.added %} {% endfor %}
{{ nav.tr("builder-th-order") }}{{ nav.tr("builder-th-name") }}{{ nav.tr("builder-th-type") }}{{ nav.tr("builder-th-indexed") }}{{ nav.tr("builder-th-options") }}
{{ column.name }} {{ column.field_type }} {% if column.generated %}{{ nav.tr("column-flag-generated") }}{% endif %} {% if column.read_only %}{{ nav.tr("column-flag-read-only") }}{% endif %} {% if !column.currency.is_empty() %}{{ column.currency }}{% if column.rounded %}, {{ nav.tr("td-rounding-half-up") }}{% endif %}{% endif %} {% if column.quantity_ledger %}{{ nav.tr("column-flag-quantity-ledger") }}{% endif %} {# A normal button, styled and worded exactly like the create builder's own remove button — but this one deletes a column that already holds nothing but empty rows, so it carries a confirm() the builder's has no need for. The checkbox itself is what still travels with the save; only its default look is hidden. #} {% if page.can_adjust_definition() && column.is_removal_choice() %} {% endif %}
{{ column.name }} {{ column.data_type }} {# A compound column expands into schema-managed companions, so there is no column of its own name to index. #} {% if page.columns.is_indexable(*loop.index0) %} {% else if column.is_indexed() %} {{ nav.tr("td-indexed-automatically-tag") }} {% else %} {% endif %} {% if column.required %}{{ nav.tr("column-flag-required") }}{% endif %} {% if column.quantity_ledger %}{{ nav.tr("column-flag-quantity-ledger") }}{% endif %} {% if !column.currency.is_empty() %}{{ column.currency }}, {{ column.money_mode.display_label(nav.locale) }}{% endif %}
{% endif %} {# The staged columns themselves: one set of fields per column, in order. #} {% for column in page.columns.added %} {% endfor %}
{{ nav.tr("common-cancel") }}