moved mock syn group list item to component

This commit is contained in:
2026-02-17 17:11:08 -07:00
parent 34a7cf42a7
commit d04a57beec
5 changed files with 194 additions and 99 deletions
@@ -0,0 +1,81 @@
{{/* .SyncGroup: optional for performance */}}
{{- $syncGroupID := .PathParams.syncGroupID }}
{{- $acctID := .PathParams.acctID }}
{{- $grp := .SyncGroup }}
{{- if not $grp }}
{{- $grp = .Accounts.GetMockSyncGroup $acctID $syncGroupID }}
{{- end }}
<li
id="sync-group-{{$grp.SyncGroupID}}"
class="
mx-[1em]
"
>
{{- define "sync-group-accordion-header" }}
<h3 class="text-center">
{{ .Group.Name }}
</h3>
{{- end }}
{{- define "sync-group-accordion-body" }}
{{- $acctID := .Identity.Account.AccountID }}
<table>
<thead>
<tr>
<th>
Name
</th>
<th>
SKU
</th>
<th>
Description
</th>
<th>
Count
</th>
</tr>
</thead>
<tbody>
{{- $dot := . }}
{{- range $listing := .Group.Listings }}
<tr>
{{- $val := $dot.Accounts.GetMockListing $acctID $listing.Platform $listing.ShopID $listing.ListingID }}
<td>
{{ $val.Name }}
</td>
<td>
{{ $val.SKU }}
</td>
<td>
{{ $val.Description }}
</td>
<td>
{{ $val.Count }}
</td>
</tr>
{{- end }}
</tbody>
</table>
{{- component "button"
"Class" "mt-[1em]"
"Text" "Delete Group"
"HXDelete" (printf "/api/accounts/%d/inventory/sync-groups/mock/%d" $acctID .Group.SyncGroupID)
"HXSwap" "none"
}}
{{- end }}
{{ component "accordion"
"Name" "sync-group-page"
"GroupName" "sync-group"
"Group" $grp
"Smooth" false
"#accordion-header" "sync-group-accordion-header"
"#accordion-body" "sync-group-accordion-body"
}}
</li>