mock events saved to db
This commit is contained in:
@@ -1,275 +1,48 @@
|
||||
<h1 class="text-center">
|
||||
Simulations
|
||||
{{- $acctID := .Identity.Account.AccountID -}}
|
||||
{{- $shops := .Accounts.GetMockShops $acctID -}}
|
||||
{{- $formSelections := .Accounts.GetMockEventFormValues $acctID -}}
|
||||
|
||||
{{- $saleShopListings := "" }}
|
||||
{{- if $formSelections.SaleShopID }}
|
||||
{{ $saleShopListings = .Accounts.GetMockListingsForShop $acctID $formSelections.SalePlatform $formSelections.SaleShopID }}
|
||||
{{- end }}
|
||||
{{- $refundShopListings := "" }}
|
||||
{{- if $formSelections.RefundShopID }}
|
||||
{{ $refundShopListings = .Accounts.GetMockListingsForShop $acctID $formSelections.SalePlatform $formSelections.RefundShopID }}
|
||||
{{- end }}
|
||||
{{- $setInventoryShopListings := "" }}
|
||||
{{- if $formSelections.CountShopID }}
|
||||
{{ $setInventoryShopListings = .Accounts.GetMockListingsForShop $acctID $formSelections.SalePlatform $formSelections.CountShopID }}
|
||||
{{- end }}
|
||||
|
||||
|
||||
<h1 class="text-center my-[0.5em]">
|
||||
Simulate
|
||||
</h1>
|
||||
|
||||
|
||||
{{/* SALES */}}
|
||||
{{- define "sale-accordion-header" }}
|
||||
<h2 class="inline-block">
|
||||
Sale
|
||||
</h2>
|
||||
{{ end }}
|
||||
|
||||
{{- define "sale-accordion-body" }}
|
||||
{{ $acctID := .Identity.Account.AccountID }}
|
||||
<form
|
||||
class="flex flex-col items-center gap-[0.75em]"
|
||||
hx-post="/api/accounts/{{$acctID}}/simulations/sale"
|
||||
hx-swap="none"
|
||||
>
|
||||
<select
|
||||
name="shop-id"
|
||||
class="bg-background"
|
||||
required
|
||||
>
|
||||
<option value="shop-1">
|
||||
Shop 1
|
||||
</option>
|
||||
<option value="shop-2">
|
||||
Shop 2
|
||||
</option>
|
||||
<option value="shop-3">
|
||||
Shop 3
|
||||
</option>
|
||||
<option value="shop-4">
|
||||
Shop 4
|
||||
</option>
|
||||
<option value="shop-5">
|
||||
Shop 5
|
||||
</option>
|
||||
</select>
|
||||
|
||||
<select
|
||||
name="listing-id"
|
||||
class="bg-background"
|
||||
required
|
||||
>
|
||||
<option value="listing-1">
|
||||
Listing 1
|
||||
</option>
|
||||
<option value="listing-2">
|
||||
Listing 2
|
||||
</option>
|
||||
<option value="listing-3">
|
||||
Listing 3
|
||||
</option>
|
||||
<option value="listing-4">
|
||||
Listing 4
|
||||
</option>
|
||||
<option value="listing-5">
|
||||
Listing 5
|
||||
</option>
|
||||
</select>
|
||||
|
||||
<input
|
||||
class="p-[0.5em] border-medium border-border rounded-lg bg-background"
|
||||
type="number"
|
||||
min="1"
|
||||
max="1000000000"
|
||||
name="count"
|
||||
value="0"
|
||||
required
|
||||
/>
|
||||
|
||||
<div>
|
||||
{{ component "button"
|
||||
"Text" "Submit"
|
||||
"Background" true
|
||||
"Class" "m-0"
|
||||
}}
|
||||
</div>
|
||||
</form>
|
||||
{{ end }}
|
||||
|
||||
{{ component "accordion"
|
||||
"Name" "simulate"
|
||||
"Open" true
|
||||
"Class" `
|
||||
mx-[1em]
|
||||
mb-[1em]
|
||||
`
|
||||
"#accordion-header" "sale-accordion-header"
|
||||
"#accordion-body" "sale-accordion-body"
|
||||
{{ component (printf "/accounts/%d/simulations/sales-form" $acctID)
|
||||
"Shops" $shops
|
||||
"SelectedPlatform" $formSelections.SalePlatform
|
||||
"SelectedShopID" $formSelections.SaleShopID
|
||||
"Listings" $saleShopListings
|
||||
}}
|
||||
|
||||
|
||||
{{/* REFUNDS */}}
|
||||
{{- define "refund-accordion-header" }}
|
||||
<h2 class="inline-block">
|
||||
Refund
|
||||
</h2>
|
||||
{{ end }}
|
||||
|
||||
{{- define "refund-accordion-body" }}
|
||||
{{ $acctID := .Identity.Account.AccountID }}
|
||||
<form
|
||||
class="flex flex-col items-center gap-[0.75em]"
|
||||
hx-post="/api/accounts/{{$acctID}}/simulations/refund"
|
||||
hx-swap="none"
|
||||
>
|
||||
<select
|
||||
name="shop-id"
|
||||
class="bg-background"
|
||||
required
|
||||
>
|
||||
<option value="shop-1">
|
||||
Shop 1
|
||||
</option>
|
||||
<option value="shop-2">
|
||||
Shop 2
|
||||
</option>
|
||||
<option value="shop-3">
|
||||
Shop 3
|
||||
</option>
|
||||
<option value="shop-4">
|
||||
Shop 4
|
||||
</option>
|
||||
<option value="shop-5">
|
||||
Shop 5
|
||||
</option>
|
||||
</select>
|
||||
|
||||
<select
|
||||
name="listing-id"
|
||||
class="bg-background"
|
||||
required
|
||||
>
|
||||
<option value="listing-1">
|
||||
Listing 1
|
||||
</option>
|
||||
<option value="listing-2">
|
||||
Listing 2
|
||||
</option>
|
||||
<option value="listing-3">
|
||||
Listing 3
|
||||
</option>
|
||||
<option value="listing-4">
|
||||
Listing 4
|
||||
</option>
|
||||
<option value="listing-5">
|
||||
Listing 5
|
||||
</option>
|
||||
</select>
|
||||
|
||||
<input
|
||||
class="p-[0.5em] border-medium border-border rounded-lg bg-background"
|
||||
type="number"
|
||||
min="1"
|
||||
max="1000000000"
|
||||
name="count"
|
||||
value="0"
|
||||
required
|
||||
/>
|
||||
|
||||
<div>
|
||||
{{ component "button"
|
||||
"Text" "Submit"
|
||||
"Background" true
|
||||
"Class" "m-0"
|
||||
}}
|
||||
</div>
|
||||
</form>
|
||||
{{ end }}
|
||||
|
||||
{{ component "accordion"
|
||||
"Name" "simulate"
|
||||
"Class" `
|
||||
mx-[1em]
|
||||
mb-[1em]
|
||||
`
|
||||
"#accordion-header" "refund-accordion-header"
|
||||
"#accordion-body" "refund-accordion-body"
|
||||
{{ component (printf "/accounts/%d/simulations/refund-form" $acctID)
|
||||
"Shops" $shops
|
||||
"SelectedPlatform" $formSelections.RefundPlatform
|
||||
"SelectedShopID" $formSelections.RefundShopID
|
||||
"Listings" $refundShopListings
|
||||
}}
|
||||
|
||||
|
||||
{{/* SET INVENTORY */}}
|
||||
{{- define "set-inventory-accordion-header" }}
|
||||
<h2 class="inline-block">
|
||||
Set Inventory
|
||||
</h2>
|
||||
{{ end }}
|
||||
|
||||
{{- define "set-inventory-accordion-body" }}
|
||||
{{ $acctID := .Identity.Account.AccountID }}
|
||||
<form
|
||||
class="flex flex-col items-center gap-[0.75em]"
|
||||
hx-put="/api/accounts/{{$acctID}}/simulations/shops/{shopID}/listings/{listingID}/count"
|
||||
hx-vals='js:{
|
||||
shopID: event.target.children.namedItem("shop-id").value,
|
||||
listingID: event.target.children.namedItem("listing-id").value
|
||||
}'
|
||||
hx-swap="none"
|
||||
>
|
||||
<select
|
||||
name="shop-id"
|
||||
class="bg-background"
|
||||
required
|
||||
>
|
||||
<option value="shop-1">
|
||||
Shop 1
|
||||
</option>
|
||||
<option value="shop-2">
|
||||
Shop 2
|
||||
</option>
|
||||
<option value="shop-3">
|
||||
Shop 3
|
||||
</option>
|
||||
<option value="shop-4">
|
||||
Shop 4
|
||||
</option>
|
||||
<option value="shop-5">
|
||||
Shop 5
|
||||
</option>
|
||||
</select>
|
||||
|
||||
<select
|
||||
name="listing-id"
|
||||
class="bg-background"
|
||||
required
|
||||
>
|
||||
<option value="listing-1">
|
||||
Listing 1
|
||||
</option>
|
||||
<option value="listing-2">
|
||||
Listing 2
|
||||
</option>
|
||||
<option value="listing-3">
|
||||
Listing 3
|
||||
</option>
|
||||
<option value="listing-4">
|
||||
Listing 4
|
||||
</option>
|
||||
<option value="listing-5">
|
||||
Listing 5
|
||||
</option>
|
||||
</select>
|
||||
|
||||
<input
|
||||
class="p-[0.5em] border-medium border-border rounded-lg bg-background"
|
||||
type="number"
|
||||
min="1"
|
||||
max="1000000000"
|
||||
name="count"
|
||||
value="0"
|
||||
required
|
||||
/>
|
||||
|
||||
<div>
|
||||
{{ component "button"
|
||||
"Text" "Submit"
|
||||
"Background" true
|
||||
"Class" "m-0"
|
||||
}}
|
||||
</div>
|
||||
</form>
|
||||
{{ end }}
|
||||
|
||||
{{ component "accordion"
|
||||
"Name" "simulate"
|
||||
"Class" `
|
||||
mx-[1em]
|
||||
mb-[1em]
|
||||
`
|
||||
"#accordion-header" "set-inventory-accordion-header"
|
||||
"#accordion-body" "set-inventory-accordion-body"
|
||||
{{ component (printf "/accounts/%d/simulations/set-inventory-form" $acctID)
|
||||
"Shops" $shops
|
||||
"SelectedPlatform" $formSelections.CountPlatform
|
||||
"SelectedShopID" $formSelections.CountShopID
|
||||
"Listings" $setInventoryShopListings
|
||||
}}
|
||||
|
||||
Reference in New Issue
Block a user