package templates import ( "fmt" "git.ma-al.com/goc_marek/ps_shop/internal/viewmodel" ) templ ProductPage(data viewmodel.ProductPageData, cssPath string, jsPath string) { @Layout(data.Product.Name, cssPath, jsPath, data.Menu, data.Locale, layoutCartItems(data.CartSummary)) {

Product

{ data.Product.Name }

if data.Product.CategoryName != "" {

{ data.Product.CategoryName }

}
if data.Customer != nil {

{ fmt.Sprintf("%s %s", data.Customer.FirstName, data.Customer.LastName) }

} else {

Guest session

} if data.CartSummary != nil {

{ fmt.Sprintf("Cart items: %d", data.CartSummary.TotalItems) }

}
if len(data.Product.GalleryImages) > 1 {
    for i, image := range data.Product.GalleryImages { if image.URL != "" {
  • } }
    for _, image := range data.Product.GalleryImages { if image.ThumbURL != "" && image.URL != "" {
  • {
  • } }
} else if data.Product.ImageURL != "" { }
if data.Product.ShortDescription != "" {

Summary

At a glance

{ plainTextHTML(data.Product.ShortDescription) }

} if data.Product.Description != "" {

Description

About this product

@templ.Raw(data.Product.Description)
} if len(data.Product.Features) > 0 {

Features

Product details

for _, feature := range data.Product.Features {

{ feature.Name }

{ plainTextHTML(feature.Value) }

}
} if len(data.Product.Accessories) > 0 {

Related products

Accessories

} if len(data.Product.GalleryImages) > 0 { }
} }