refactor(ssr): render the bulk-code modal fully through Selmer
Move all markup in the Transaction Bulk Code modal out of Clojure and into
Selmer templates so bulk_code.clj only assembles data.
- Replace the inline sel/raw HTML strings and one Hiccup [:p] with templates:
head, form-errors, footer, account-entries, success-body.
- Render the expense-account grid from a {% for %} template (account-grid.html
+ account-row.html) driven by a per-row view-model (account-row-vm); the row
reuses the shared components/typeahead.html via a {% with %} include (no fork).
- Extract behaviour-preserving data-prep helpers reused by the view-model:
sc/typeahead-ctx, sc/money-input-attrs, sc/validated-field-classes,
sc/errors-str, edit/account-typeahead-ctx, edit/location-select-ctx.
Verified: REPL render parity + browser QA (add/remove row, typeahead select,
per-row location swap, percentage validation, submit, vendor auto-populate);
no JS errors.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
22
resources/templates/transaction-bulk-code/account-grid.html
Normal file
22
resources/templates/transaction-bulk-code/account-grid.html
Normal file
@@ -0,0 +1,22 @@
|
||||
{# Expense-account grid -- fully template-driven. A single for-loop over the per-row
|
||||
view-models (bulk-code/account-row-vm), each delegating to account-row.html. Replaces
|
||||
the Clojure data-grid / data-grid-row / data-grid-cell composition. The trailing
|
||||
"New account" button posts the whole #bulk-code-form (op=new-account). #}
|
||||
<div class="shrink overflow-y-scroll">
|
||||
<table class="w-full text-sm text-left text-gray-500 dark:text-gray-400 shrink">
|
||||
<thead class="text-xs text-gray-800 uppercase bg-gray-50 dark:bg-gray-700 dark:text-gray-400 group-[.raw]:sticky group-[.raw]:z-10 group-[.raw]:top-0">
|
||||
<tr>
|
||||
<th class="px-4 py-3" scope="col">Account</th>
|
||||
<th class="px-4 py-3 w-32" scope="col">Location</th>
|
||||
<th class="px-4 py-3 w-16" scope="col">%</th>
|
||||
<th class="px-4 py-3 w-16" scope="col"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for row in rows %}{% include "templates/transaction-bulk-code/account-row.html" %}{% endfor %}
|
||||
<tr class="new-row border-b dark:border-gray-600 group hover:bg-gray-100 dark:hover:bg-gray-700">
|
||||
<td class="px-4 py-2" colspan="4">{{ new_account_button|safe }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
Reference in New Issue
Block a user