0.2.5 Beads onhand updating working. /JL

This commit is contained in:
2022-12-20 00:13:16 +01:00
parent 41b05473b4
commit 387aef521d
4 changed files with 27 additions and 20 deletions

View File

@@ -40,6 +40,15 @@ func ShowBeads(mw *MyMainWindow, serie string) {
for _, s := range bead.Series {
if s.Name == serie {
bead.Color.SetVisible(true)
bead.InfoTooltip.SetText(bead.info, "Approx. "+fmt.Sprint(s.onHand)+" left on hand")
bead.WarningTooltip.SetText(bead.warning, "Only "+fmt.Sprint(s.onHand)+" left on hand")
if s.onHand <= 200 {
bead.warning.SetVisible(true)
bead.info.SetVisible(false)
} else {
bead.warning.SetVisible(false)
bead.info.SetVisible(true)
}
}
}
}
@@ -59,6 +68,7 @@ func CreateBeadsGroup(mw *MyMainWindow) {
mw.colors, _ = walk.NewScrollView(gb)
mw.colors.SetLayout(walk.NewVBoxLayout())
LoadBeads(mw)
ShowBeads(mw, mw.serie_combo.Text())
}
func LoadBeads(mw *MyMainWindow) {
@@ -76,15 +86,6 @@ func LoadBeads(mw *MyMainWindow) {
se.inStock = s.InStock
se.onHand = s.OnHand
bc.Series = append(bc.Series, se)
bc.InfoTooltip.SetText(bc.info, "Approx. "+fmt.Sprint(se.onHand)+" left on hand")
bc.WarningTooltip.SetText(bc.warning, "Only "+fmt.Sprint(se.onHand)+" left on hand")
if se.onHand <= 200 {
bc.warning.SetVisible(true)
bc.info.SetVisible(false)
} else {
bc.warning.SetVisible(false)
bc.info.SetVisible(true)
}
}
bc.Brand = brand.BrandName
bc.Name = bead.ColorName