v0.30: product pages, categories, sale prices and order status timeline

This commit is contained in:
shop
2026-06-25 17:29:43 +03:00
parent 532351e1c9
commit e000264bb1
26 changed files with 1061 additions and 248 deletions
+37
View File
@@ -0,0 +1,37 @@
package orderstatus
type Info struct {
Label string
Class string
Step int
}
var statuses = map[string]Info{
"new": {Label: "Новый", Class: "status--new", Step: 1},
"confirmed": {Label: "Подтверждён", Class: "status--confirmed", Step: 2},
"processing": {Label: "В обработке", Class: "status--processing", Step: 3},
"shipped": {Label: "Отправлен", Class: "status--shipped", Step: 4},
"delivered": {Label: "Доставлен", Class: "status--delivered", Step: 5},
"cancelled": {Label: "Отменён", Class: "status--cancelled", Step: 0},
}
var Timeline = []string{"new", "confirmed", "processing", "shipped", "delivered"}
func Get(code string) Info {
if s, ok := statuses[code]; ok {
return s
}
return Info{Label: code, Class: "status--new", Step: 1}
}
func Label(code string) string {
return Get(code).Label
}
func Class(code string) string {
return Get(code).Class
}
func Step(code string) int {
return Get(code).Step
}