fix: pricelist selection preserved when opening configurations
- Remove 'auto (latest active)' option from pricelist dropdowns; new configs pre-select the first active pricelist instead - Stop resetting stored pricelist_id to null when it is not in the active list (deactivated pricelists are shown as inactive options) - RefreshPricesNoAuth now accepts an optional pricelist_id; uses the UI-selected pricelist, then the config's stored pricelist, then latest as a last-resort fallback — no longer silently overwrites the stored pricelist on every price refresh - Same fix applied to RefreshPrices (with auth) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1126,7 +1126,12 @@ func setupRouter(cfg *config.Config, local *localdb.LocalDB, connMgr *db.Connect
|
||||
|
||||
configs.POST("/:uuid/refresh-prices", func(c *gin.Context) {
|
||||
uuid := c.Param("uuid")
|
||||
config, err := configService.RefreshPricesNoAuth(uuid)
|
||||
var req struct {
|
||||
PricelistID *uint `json:"pricelist_id"`
|
||||
}
|
||||
// Ignore bind error — pricelist_id is optional
|
||||
_ = c.ShouldBindJSON(&req)
|
||||
config, err := configService.RefreshPricesNoAuth(uuid, req.PricelistID)
|
||||
if err != nil {
|
||||
respondError(c, http.StatusInternalServerError, "internal server error", err)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user