Update Product List
This commit is contained in:
parent
67d3529980
commit
031c36897f
@ -80,10 +80,26 @@ func (e *ProductDB) ToProduct() *Product {
|
|||||||
|
|
||||||
func (b *ProductList) ToProductList() []*Product {
|
func (b *ProductList) ToProductList() []*Product {
|
||||||
var Products []*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()
|
today := time.Now().Weekday()
|
||||||
isWeekend := today == time.Saturday || today == time.Sunday
|
isWeekend := today == time.Saturday || today == time.Sunday
|
||||||
|
|
||||||
for _, p := range *b {
|
for _, p := range *b {
|
||||||
|
if p.Status != "Available" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
if isWeekend && p.IsWeekendTicket {
|
if isWeekend && p.IsWeekendTicket {
|
||||||
Products = append(Products, p.ToProduct())
|
Products = append(Products, p.ToProduct())
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -77,7 +77,7 @@ func (s *ProductService) GetProductPOS(ctx context.Context, search entity.Produc
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return products.ToProductList(), nil
|
return products.ToProductListPOS(), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *ProductService) Delete(ctx mycontext.Context, id int64) error {
|
func (s *ProductService) Delete(ctx mycontext.Context, id int64) error {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user