v0.30: product pages, categories, sale prices and order status timeline
This commit is contained in:
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user