moved mock syn group list item to component
This commit is contained in:
+81
@@ -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>
|
||||
Reference in New Issue
Block a user