{{- /* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial */ -}} {{- /* SPDX-FileCopyrightText: 2025-2026 Christian Galo */ -}} {{/* operator_entitlement_set_rules_table.html The rules form's body (design D1, D8, D10, D11 of staged-rule-changes; spec form-library "A batch form renders the caller's rows and one tray"). Context: server.EntitlementSetRulesTable, the bound forms.FormView and the rows to draw. Rendered as a fragment by operator_entitlement_set_rules_view.go and handed back to the form part as Binding.Body, which is why the view is already in scope here: every control comes from the field part through Form.RowField and every action from the row-action part through Form.RowAction, so this file writes no control of its own. Two things, in order. The add form, while Add rule holds it open: one dense row above the table and outside it, the key select alone until a key is chosen, then that kind's fields beside it, and Stage change with Cancel at its end; the row aligns to the top under one label line, so a refusal under one control grows that column alone and the buttons stay on the control line, as in every dense row (design D16). A staged addition then appears in the table as a staged row of its kind's group; the form itself never sits in the table (maintainer, 2026-09-19: "it doesn't make sense for it to be within the table before it is added"). Then one table, grouped by rule kind inside it: a row group per kind opened by a row naming the kind, Limit then Boolean. That row is a quiet heading, not a divider: the word small, semibold and in the secondary colour, with air above it and no line under it, so it hugs the rows it heads and the hairline the row above already draws is the whole boundary (round 4 of the exploration, the maintainer's pick of 2026-09-19 over a tinted band; app.css .app-rules-group). The columns are the limit rule's (Resource, Limit, Per unit, Reduction policy, Actions); a boolean row has no value in the three middle columns, so its name spans them and no cell is left empty. The table lays out on fixed column widths (app.css .app-rules-table), so a row that opens for editing or carries an error keeps every column where it was. A row draws in one of three shapes. At rest: its values and its actions, Edit and Remove on a limit rule and Remove alone on a boolean rule, which has no field to edit. Editing: the Limit, Per unit and Reduction policy controls in their own columns, aligned to the top so a refusal under one control grows only its own row, with Stage change and Cancel; below lg the cells stack in reading order and each control's own label shows. Staged: tinted, the old value struck beside the new or the resource name struck on a removal, and Undo alone. */}} {{ with .New }}
| Resource | Limit | Per unit {{ template "helpIcon" (helpIcon "Per unit" "Multiplied by the quantity purchased or granted.") }} | Reduction policy | Actions |
|---|---|---|---|---|
| Limit | ||||
| {{ if .Removed }}{{ template "entitlementSetRuleName" . }}{{ else }}{{ template "entitlementSetRuleName" . }}{{ end }} | {{ if .OldLimit }}{{ .OldLimit }} {{ end }}{{ .NewLimit }} | {{ if .OldPerUnit }}{{ .OldPerUnit }} {{ end }}{{ .NewPerUnit }} | {{ if .OldPolicy }}{{ .OldPolicy }} {{ end }}{{ .NewPolicy }} | {{ template "formRowAction" ($.Form.RowAction "undo" .DeltaKey "Undo" "secondary") }} |
| {{ template "entitlementSetRuleName" . }} | {{ .ResourceValue }} | {{ if .ResourcePerUnit }}Yes{{ else }}No{{ end }} | {{ .Policy }} | {{ template "formRowAction" ($.Form.RowAction "edit" .RuleID "Edit" "secondary") }} {{ template "formRowAction" ($.Form.RowAction "remove" .RuleID "Remove" "danger") }} |
| Boolean | ||||
| {{ if .Removed }}{{ template "entitlementSetRuleName" . }}{{ else }}{{ template "entitlementSetRuleName" . }}{{ end }} | {{ template "formRowAction" ($.Form.RowAction "undo" .DeltaKey "Undo" "secondary") }} | |||
| {{ template "entitlementSetRuleName" . }} | {{ template "formRowAction" ($.Form.RowAction "remove" .RuleID "Remove" "danger") }} | |||
{{ .ResourceKey }}{{ end }}{{ end }}