Add product features, Heleket crypto payments and order status icons.
This commit is contained in:
@@ -14,6 +14,11 @@ type Product struct {
|
||||
CategoryID *int
|
||||
CategorySlug string
|
||||
IsActive bool
|
||||
AttrSize string
|
||||
AttrColor string
|
||||
AttrMaterial string
|
||||
AttrWeight string
|
||||
AttrBrand string
|
||||
CreatedAt time.Time
|
||||
UpdatedAt time.Time
|
||||
Images []ProductImage
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
package models
|
||||
|
||||
import "time"
|
||||
|
||||
type ProductSpec struct {
|
||||
Label string
|
||||
Value string
|
||||
}
|
||||
|
||||
func (p Product) Specs() []ProductSpec {
|
||||
var specs []ProductSpec
|
||||
if p.AttrBrand != "" {
|
||||
specs = append(specs, ProductSpec{"Бренд", p.AttrBrand})
|
||||
}
|
||||
if p.AttrSize != "" {
|
||||
specs = append(specs, ProductSpec{"Размер", p.AttrSize})
|
||||
}
|
||||
if p.AttrColor != "" {
|
||||
specs = append(specs, ProductSpec{"Цвет", p.AttrColor})
|
||||
}
|
||||
if p.AttrMaterial != "" {
|
||||
specs = append(specs, ProductSpec{"Материал", p.AttrMaterial})
|
||||
}
|
||||
if p.AttrWeight != "" {
|
||||
specs = append(specs, ProductSpec{"Вес", p.AttrWeight})
|
||||
}
|
||||
return specs
|
||||
}
|
||||
|
||||
type PriceHistoryEntry struct {
|
||||
ID int
|
||||
ProductID int
|
||||
Price float64
|
||||
SalePrice float64
|
||||
RecordedAt time.Time
|
||||
}
|
||||
|
||||
type Reservation struct {
|
||||
ID int
|
||||
ProductID int
|
||||
SessionKey string
|
||||
UserID *int
|
||||
CustomerName string
|
||||
CustomerPhone string
|
||||
ExpiresAt time.Time
|
||||
CreatedAt time.Time
|
||||
}
|
||||
+19
-10
@@ -28,16 +28,25 @@ type CartItem struct {
|
||||
}
|
||||
|
||||
type Order struct {
|
||||
ID int
|
||||
UserID *int
|
||||
GuestName string
|
||||
GuestEmail string
|
||||
GuestPhone string
|
||||
Address string
|
||||
Total float64
|
||||
Status string
|
||||
CreatedAt time.Time
|
||||
Items []OrderItem
|
||||
ID int
|
||||
UserID *int
|
||||
GuestName string
|
||||
GuestEmail string
|
||||
GuestPhone string
|
||||
Address string
|
||||
Total float64
|
||||
Status string
|
||||
PaymentMethod string
|
||||
HeleketUUID string
|
||||
HeleketOrderID string
|
||||
HeleketPaymentURL string
|
||||
HeleketPaymentStatus string
|
||||
CreatedAt time.Time
|
||||
Items []OrderItem
|
||||
}
|
||||
|
||||
func (o Order) IsHeleket() bool {
|
||||
return o.PaymentMethod == "heleket"
|
||||
}
|
||||
|
||||
type OrderItem struct {
|
||||
|
||||
Reference in New Issue
Block a user