decimal precision constrained

This commit is contained in:
Filipriec
2026-08-24 19:58:44 +02:00
parent 60aca940ee
commit 16670f4375
13 changed files with 147 additions and 25 deletions

View File

@@ -127,13 +127,22 @@
{% if page.draft.columns.show_link_target() %}<small>{{ nav.tr("td-link-alias-hint") }}</small>{% endif %}
</label>
{% endif %}
<label>{{ nav.tr("td-fixed-decimal-access") }}
<select name="fixed_decimal_input" hx-post="/admin/tables/builder" hx-trigger="change"
hx-include="#table-form" hx-target="#builder" hx-swap="innerHTML"
hx-vals='{"action": "refresh"}'>
<option value="no" {% if !page.draft.columns.fixed_decimal_enabled() %}selected{% endif %}>{{ nav.tr("td-fixed-decimal-disabled") }}</option>
<option value="yes" {% if page.draft.columns.fixed_decimal_enabled() %}selected{% endif %}>{{ nav.tr("td-fixed-decimal-enabled") }}</option>
</select>
<small>{{ nav.tr("td-fixed-decimal-access-hint") }}</small>
</label>
<label>{{ nav.tr("td-column-type") }}
<select name="column_type_input" hx-post="/admin/tables/builder" hx-trigger="change"
hx-include="#table-form" hx-target="#builder" hx-swap="innerHTML"
hx-vals='{"action": "refresh"}'>
<option value="">{{ nav.tr("td-choose-type") }}</option>
{% for column_type in column_types %}
<option value="{{ column_type }}" {% if page.draft.columns.type_input == *column_type %}selected{% endif %}>{% if *column_type == "link" %}{{ nav.tr("td-fk-link") }}{% else %}{{ column_type }}{% endif %}</option>
<option value="{{ column_type }}" {% if page.draft.columns.type_input == *column_type %}selected{% endif %}>{% if *column_type == "link" %}{{ nav.tr("td-fk-link") }}{% else if *column_type == "numeric" %}{{ nav.tr("td-exact-decimal") }}{% else if *column_type == "decimal" %}{{ nav.tr("td-fixed-decimal-type") }}{% else %}{{ column_type }}{% endif %}</option>
{% endfor %}
</select>
</label>
@@ -161,6 +170,10 @@
{% endif %}
{% if page.draft.columns.show_decimal_arguments() %}
<div class="field-note col-span-full">
<span class="field-label">{{ nav.tr("td-fixed-decimal-warning-title") }}</span>
<p class="hint">{{ nav.tr("td-fixed-decimal-warning") }}</p>
</div>
<label>{{ nav.tr("td-precision") }}
<input name="decimal_precision_input" value="{{ page.draft.columns.decimal_precision_input }}"
inputmode="numeric" placeholder="12">

View File

@@ -29,6 +29,17 @@
<input name="column_name_input" value="{{ page.columns.name_input }}" placeholder="issued_on">
{% if page.columns.show_link_target() %}<small>{{ nav.tr("td-link-alias-hint") }}</small>{% endif %}
</label>
<label>{{ nav.tr("td-fixed-decimal-access") }}
<select name="fixed_decimal_input"
hx-post="/admin/tables/columns/add/builder{{ page.selection.query() }}"
hx-trigger="change" hx-include="#column-form"
hx-target="#column-panel" hx-swap="innerHTML"
hx-vals='{"action": "refresh"}'>
<option value="no" {% if !page.columns.fixed_decimal_enabled() %}selected{% endif %}>{{ nav.tr("td-fixed-decimal-disabled") }}</option>
<option value="yes" {% if page.columns.fixed_decimal_enabled() %}selected{% endif %}>{{ nav.tr("td-fixed-decimal-enabled") }}</option>
</select>
<small>{{ nav.tr("td-fixed-decimal-access-hint") }}</small>
</label>
<label>{{ nav.tr("td-column-type") }}
<select name="column_type_input"
hx-post="/admin/tables/columns/add/builder{{ page.selection.query() }}"
@@ -37,7 +48,7 @@
hx-vals='{"action": "refresh"}'>
<option value="">{{ nav.tr("td-choose-type") }}</option>
{% for column_type in column_types %}
<option value="{{ column_type }}" {% if page.columns.type_input == *column_type %}selected{% endif %}>{% if *column_type == "link" %}{{ nav.tr("td-fk-link") }}{% else %}{{ column_type }}{% endif %}</option>
<option value="{{ column_type }}" {% if page.columns.type_input == *column_type %}selected{% endif %}>{% if *column_type == "link" %}{{ nav.tr("td-fk-link") }}{% else if *column_type == "numeric" %}{{ nav.tr("td-exact-decimal") }}{% else if *column_type == "decimal" %}{{ nav.tr("td-fixed-decimal-type") }}{% else %}{{ column_type }}{% endif %}</option>
{% endfor %}
</select>
</label>
@@ -65,6 +76,10 @@
{% endif %}
{% if page.columns.show_decimal_arguments() %}
<div class="field-note col-span-full">
<span class="field-label">{{ nav.tr("td-fixed-decimal-warning-title") }}</span>
<p class="hint">{{ nav.tr("td-fixed-decimal-warning") }}</p>
</div>
<label>{{ nav.tr("td-precision") }}
<input name="decimal_precision_input" value="{{ page.columns.decimal_precision_input }}"
inputmode="numeric" placeholder="12">