From 9bf4da775cad67155a0d75e6ae9e92caef6cdec8 Mon Sep 17 00:00:00 2001 From: Angel Beltran Date: Fri, 27 Feb 2026 17:38:08 -0700 Subject: [PATCH] stubbed simulations page content: set inventory --- server/api/accounts/router.go | 27 ++++++ .../{acctID.int64}/simulations.html.tmpl | 93 +++++++++++++++++++ 2 files changed, 120 insertions(+) diff --git a/server/api/accounts/router.go b/server/api/accounts/router.go index 25f92e9..a0fa731 100644 --- a/server/api/accounts/router.go +++ b/server/api/accounts/router.go @@ -82,6 +82,7 @@ func Routes( simulations := r.Group("/:acctID/simulations") simulations.POST("/sale", response.Handler(as.postNewSale)) simulations.POST("/refund", response.Handler(as.postNewRefund)) + simulations.PUT("/shops/:shopID/listings/:listingID/count", response.Handler(as.setListingCount)) } // POST / @@ -792,6 +793,32 @@ func (s *accountSubrouter) postNewRefund(c *gin.Context) (response.Response, err return response.StatusCreated(), nil } +// PUT /:acctID/simulations/shops/:shopID/listings/:listingID/count +func (s *accountSubrouter) setListingCount(c *gin.Context) (response.Response, error) { + acctID := auth.GetIdentity(c).Account.AccountID + + var ( + shopID string + listingID string + count int + ) + + if err := param.Path("shopID", param.Text(&shopID)). + Path("listingID", param.Text(&listingID)). + Form("count", param.Int(&count)). + Unmarshal(c); err != nil { + return nil, err + } + + s.log.Debugf("listing inventory set:") + s.log.Debugf(" account: %d", acctID) + s.log.Debugf(" shop: %s", shopID) + s.log.Debugf(" listing: %s", listingID) + s.log.Debugf(" count: %d", count) + + return response.StatusOK(), nil +} + func lowerSnakeCase(s accounts.Platform) string { return strings.ToLower(strings.Join(strings.Split(string(s), " "), "_")) } diff --git a/templates/pages/accounts/{acctID.int64}/simulations.html.tmpl b/templates/pages/accounts/{acctID.int64}/simulations.html.tmpl index 99686b0..1953bf3 100644 --- a/templates/pages/accounts/{acctID.int64}/simulations.html.tmpl +++ b/templates/pages/accounts/{acctID.int64}/simulations.html.tmpl @@ -180,3 +180,96 @@ "#accordion-header" "refund-accordion-header" "#accordion-body" "refund-accordion-body" }} + + +{{/* SET INVENTORY */}} +{{- define "set-inventory-accordion-header" }} +

+ Simulate Set Inventory +

+{{ end }} + +{{- define "set-inventory-accordion-body" }} + {{ $acctID := .Identity.Account.AccountID }} +
+ + + + + + +
+ {{ component "button" + "Text" "Submit" + "Background" true + "Class" "m-0" + }} +
+
+{{ end }} + +{{ component "accordion" + "Name" "simulate" + "Class" ` + mx-[1em] + mb-[1em] + ` + "#accordion-header" "set-inventory-accordion-header" + "#accordion-body" "set-inventory-accordion-body" +}}