diff --git a/templates/components/accounts/{acctID.int64}/inventory/sync-groups/draft/listings/{orderIndex.int}.html.tmpl b/templates/components/accounts/{acctID.int64}/inventory/sync-groups/draft/listings/{orderIndex.int}.html.tmpl index bc11006..87e70b4 100644 --- a/templates/components/accounts/{acctID.int64}/inventory/sync-groups/draft/listings/{orderIndex.int}.html.tmpl +++ b/templates/components/accounts/{acctID.int64}/inventory/sync-groups/draft/listings/{orderIndex.int}.html.tmpl @@ -1,3 +1,4 @@ +{{/* optional props: .Listings = .Accounts.GetSyncGroupListingDrafts */}} {{/* TODO: make the save button disabled based on an api call */}} {{- $acctID := .PathParams.acctID }} @@ -7,6 +8,11 @@ {{- $selectedShopID := $entry.ShopID }} {{- $selectedListingID := $entry.ListingID }} +{{- $listings := .Listings }} +{{- if not $listings }} + {{- $listings = .Accounts.GetSyncGroupListingDrafts $acctID }} +{{- end }} + + {{/* TODO: filter out shops that are already selected */}} {{- $shops := .Accounts.GetShops $acctID -}} - {{- range $i, $listing := $listings }} - {{- if eq $selectedListingID $listing.ListingID }} - {{ $selectedListing = $listing }} + {{- range $i, $shopListing := $shopListings }} + {{- if eq $selectedListingID $shopListing.ListingID }} + {{ $selectedListing = $shopListing }} {{- end }} {{- end }} diff --git a/templates/components/accounts/{acctID.int64}/inventory/sync-groups/draft/table.html.tmpl b/templates/components/accounts/{acctID.int64}/inventory/sync-groups/draft/table.html.tmpl index 5ef3379..ff272d6 100644 --- a/templates/components/accounts/{acctID.int64}/inventory/sync-groups/draft/table.html.tmpl +++ b/templates/components/accounts/{acctID.int64}/inventory/sync-groups/draft/table.html.tmpl @@ -56,7 +56,9 @@ > {{- $listings := .Accounts.GetSyncGroupListingDrafts $acctID }} {{- range $listing := $listings }} - {{- component (printf "accounts/%d/inventory/sync-groups/draft/listings/%d" $acctID $listing.OrderIndex) }} + {{- component (printf "accounts/%d/inventory/sync-groups/draft/listings/%d" $acctID $listing.OrderIndex) + "Listings" $listings + }} {{- end }}