Update Product List

This commit is contained in:
aditya.siregar
2024-08-22 03:07:40 +07:00
parent 67d3529980
commit 031c36897f
2 changed files with 17 additions and 1 deletions
+16
View File
@@ -80,10 +80,26 @@ func (e *ProductDB) ToProduct() *Product {
func (b *ProductList) ToProductList() []*Product {
var Products []*Product
for _, p := range *b {
if p.Status == "Available" {
Products = append(Products, p.ToProduct())
}
}
return Products
}
func (b *ProductList) ToProductListPOS() []*Product {
var Products []*Product
today := time.Now().Weekday()
isWeekend := today == time.Saturday || today == time.Sunday
for _, p := range *b {
if p.Status != "Available" {
continue
}
if isWeekend && p.IsWeekendTicket {
Products = append(Products, p.ToProduct())
} else {