added Edit Group button to mock sync group accordion
This commit is contained in:
+34
-11
@@ -2,6 +2,10 @@
|
||||
|
||||
{{- $syncGroupID := .PathParams.syncGroupID }}
|
||||
{{- $acctID := .PathParams.acctID }}
|
||||
{{- $open := false }}
|
||||
{{- if .Request }}
|
||||
{{- $open = eq (.Request.URL.Query.Get "open") "true" }}
|
||||
{{- end }}
|
||||
|
||||
{{- $grp := .SyncGroup }}
|
||||
{{- if not $grp }}
|
||||
@@ -9,11 +13,15 @@
|
||||
{{- end }}
|
||||
|
||||
|
||||
{{- $id := (printf "sync-group-%d" $syncGroupID) }}
|
||||
<li
|
||||
id="sync-group-{{$grp.SyncGroupID}}"
|
||||
class="
|
||||
mx-[1em]
|
||||
"
|
||||
id="{{$id}}"
|
||||
class="mx-[1em]"
|
||||
hx-get="{{ printf "/ui/accounts/%d/inventory/sync-groups/mock/%d/list-item" $acctID $syncGroupID }}"
|
||||
hx-trigger="{{ printf "sse:accounts_%d_inventory_sync-groups_mock_%d" $acctID $syncGroupID }}"
|
||||
hx-swap="morph:outerHTML"
|
||||
hx-select="#{{$id}}"
|
||||
hx-vals="js:{open: this.getElementsByTagName('details')[0].open}"
|
||||
>
|
||||
{{- define "sync-group-accordion-header" }}
|
||||
<h3 class="text-center">
|
||||
@@ -23,6 +31,7 @@
|
||||
|
||||
{{- define "sync-group-accordion-body" }}
|
||||
{{- $acctID := .Identity.Account.AccountID }}
|
||||
{{- $syncGroupID := .Group.SyncGroupID }}
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -62,16 +71,30 @@
|
||||
</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"
|
||||
}}
|
||||
<div>
|
||||
{{- $isBeingEditing := .Accounts.MockSyncGroupIsBeingEdited $acctID $syncGroupID }}
|
||||
{{- if not $isBeingEditing }}
|
||||
{{- component "button"
|
||||
"Class" "mt-[1em]"
|
||||
"Text" "Edit Group"
|
||||
"HXPut" (printf "/api/accounts/%d/inventory/sync-groups/mock/editing" $acctID)
|
||||
"HXVals" (printf `js:{"syncGroupID":%d}` $syncGroupID)
|
||||
"HXSwap" "none"
|
||||
}}
|
||||
{{- end }}
|
||||
|
||||
{{- component "button"
|
||||
"Class" "mt-[1em]"
|
||||
"Text" "Delete Group"
|
||||
"HXDelete" (printf "/api/accounts/%d/inventory/sync-groups/mock/%d" $acctID $syncGroupID)
|
||||
"HXSwap" "none"
|
||||
}}
|
||||
</div>
|
||||
{{- end }}
|
||||
|
||||
{{ component "accordion"
|
||||
"Name" "sync-group-page"
|
||||
"Name" "sync-group-page"
|
||||
"Open" $open
|
||||
"GroupName" "sync-group"
|
||||
"Group" $grp
|
||||
"Smooth" false
|
||||
|
||||
Reference in New Issue
Block a user