updated draft sync group table buttons upon table change

This commit is contained in:
2026-01-21 00:40:33 -07:00
parent de18de49e9
commit c4348d6d3d
8 changed files with 95 additions and 57 deletions
@@ -17,38 +17,10 @@
<h4>
(Draft 2)
</h4>
{{/* component "accounts/{acctID}/inventory/sync-groups/draft/table" "dot" . */}}
{{ component (printf "accounts/%d/inventory/sync-groups/draft/table" $acctID) "dot" . }}
{{ component (printf "accounts/%d/inventory/sync-groups/draft/table" $acctID) }}
<div>
{{ component "button"
"HXPost" (printf "/api/accounts/%d/inventory/sync-groups/draft/listings" $acctID)
"HXTarget" "#accounts-acct-id-inventory-sync-groups-draft-table"
"HXSwap" "outerHTML"
"Class" "mt-[1em] mb-[1em]"
"Text" "Add Listing"
"_" `
on click
send rowUpdated to the first <tbody/> in #accounts-acct-id-inventory-sync-groups-draft-table
`
}}
{{/* TODO: enable the button when all listings are filled and there are at least two listings */}}
{{/* TODO: save the listings as a sync group on click */}}
{{ component "button"
"ID" "create-sync-group-button"
"HXPost" (printf "/api/accounts/%d/sync-groups" $acctID)
"Class" "mt-[1em] mb-[1em]"
"Text" "Save Sync Group"
"Disabled" true
"_" `
on setDisabled(disabled)
if disabled then
add @disabled to me
else
remove @disabled from me
end
`
}}
{{ component (printf "accounts/%d/inventory/sync-groups/draft/table/add-listing-button" $acctID) }}
{{ component (printf "accounts/%d/inventory/sync-groups/draft/table/save-sync-group-button" $acctID) }}
</div>
</section>