mock sync group editing: made tables columns more consistent; initialize database rows upon editing

This commit is contained in:
2026-02-20 23:04:18 -07:00
parent 5ec4fe67b0
commit 4352062227
9 changed files with 479 additions and 232 deletions
@@ -2,7 +2,10 @@
{{- $acctID := .PathParams.acctID }}
{{- $orderIndex := .PathParams.orderIndex }}
{{- $entry := .Accounts.GetMockSyncGroupListingDraft $acctID $orderIndex }}
{{- $entry := .Entry }}
{{- if not $entry }}
{{- $entry = .Accounts.GetMockSyncGroupListingDraft $acctID $orderIndex }}
{{- end }}
{{- $selectedShopPlatform := $entry.Platform }}
{{- $selectedShopID := $entry.ShopID }}
{{- $selectedListingID := $entry.ListingID }}
@@ -31,7 +34,7 @@
call setFilledOut(false)
"
>
<td>
<td class="text-nowrap">
{{/* TODO: filter out shops that are already selected */}}
{{- $shops := .Accounts.GetMockShops $acctID -}}
<select
@@ -80,7 +83,7 @@
{{- if $entry.Platform }}{{ $entry.Platform }}{{ else }}-{{ end }}
</td>
<td>
<td class="text-nowrap">
{{- $selectedListing := "" }}
{{- if $selectedShopID }}
{{- $shopListings := .Accounts.GetMockListingsForShop $acctID $selectedShopPlatform $selectedShopID }}
@@ -125,7 +128,7 @@
{{- end }}
</td>
<td data-id="sku">
<td data-id="sku" class="text-nowrap">
{{if $selectedListing}}{{$selectedListing.SKU}}{{else}}-{{end}}
</td>
@@ -133,6 +136,10 @@
{{if $selectedListing}}{{$selectedListing.Description}}{{else}}-{{end}}
</td>
<td data-id="count">
{{if $selectedListing}}{{$selectedListing.Count}}{{else}}-{{end}}
</td>
<td data-id="remove">
{{ component "button"
"HXDelete" (printf "/api/accounts/%d/inventory/sync-groups/mock/draft/listings/%d" $acctID $orderIndex)
@@ -10,7 +10,7 @@
class="
max-w-full overflow-x-auto
grid-table-[1fr_1fr_1fr_1fr_1fr_1fr]
grid-table-[1fr_1fr_1fr_1fr_1fr_1fr_1fr]
max-h-[50vh]
"
hx-get="{{ printf "/ui/accounts/%d/inventory/sync-groups/mock/draft/table" $acctID }}"
@@ -35,6 +35,9 @@
<th>
Description
</th>
<th>
Count
</th>
<th>
</th>
@@ -67,6 +70,7 @@
{{- range $listing := $listings }}
{{- component (printf "accounts/%d/inventory/sync-groups/mock/draft/listings/%d" $acctID $listing.OrderIndex)
"Listings" $listings
"Entry" $listing
}}
{{- end }}
</tbody>
@@ -88,6 +92,9 @@
<th>
Description
</th>
<th>
Count
</th>
<th>
</th>
@@ -45,6 +45,12 @@
<table id="sync-group-data-{{$syncGroupID}}">
<thead>
<tr>
<th>
Shop
</th>
<th>
Platform
</th>
<th>
Name
</th>
@@ -64,13 +70,19 @@
{{- range $listing := .Group.Listings }}
<tr>
{{- $val := $dot.Accounts.GetMockListing $acctID $listing.Platform $listing.ShopID $listing.ListingID }}
<td class="text-nowrap">
{{ $val.ShopName }}
</td>
<td>
{{ $val.Platform }}
</td>
<td class="text-nowrap">
{{ $val.Name }}
</td>
<td>
<td class="text-nowrap">
{{ $val.SKU }}
</td>
<td>
<td class="text-nowrap">
{{ $val.Description }}
</td>
<td>
@@ -109,6 +121,12 @@
<table id="sync-group-{{$syncGroupID}}-form">
<thead>
<tr>
<th>
Shop
</th>
<th>
Platform
</th>
<th>
Name
</th>
@@ -128,6 +146,12 @@
{{- range $listing := .Group.Listings }}
<tr>
{{- $val := $dot.Accounts.GetMockListing $acctID $listing.Platform $listing.ShopID $listing.ListingID }}
<td>
{{ $val.ShopName }}
</td>
<td>
{{ $val.Platform }}
</td>
<td>
{{ $val.Name }}
</td>