This commit is contained in:
2026-09-15 23:03:10 +02:00
parent dcb6295091
commit c755a80b47
6 changed files with 31 additions and 7 deletions
@@ -0,0 +1 @@
exit status 1
Binary file not shown.
@@ -41,6 +41,7 @@ func (h *PropertyTypesHandler) GetRootPropertyTypesGroups(ctx *gin.Context) {
) )
if err != nil { if err != nil {
log.Printf("Error parsing template: %v", err)
ctx.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()}) ctx.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
return return
} }
@@ -51,6 +52,7 @@ func (h *PropertyTypesHandler) GetRootPropertyTypesGroups(ctx *gin.Context) {
log.Printf("Executing template with root property types groups") log.Printf("Executing template with root property types groups")
err = tmpl.Execute(ctx.Writer, rootGroups) err = tmpl.Execute(ctx.Writer, rootGroups)
if err != nil { if err != nil {
log.Printf("Error executing template: %v", err)
ctx.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()}) ctx.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
return return
} }
@@ -1,11 +1,11 @@
package models package models
type Property struct { type Property struct {
Id int `json:"id,omitempty"` Id int `json:"id,omitempty"`
Name string `json:"name"` Name string `json:"name"`
Description string `json:"description,omitempty"` Description string `json:"description,omitempty"`
Image_Url string `json:"image_url,omitempty"` Image_Url string `json:"image_url,omitempty"`
Property_Type *Property_Type `json:"property_type,omitempty"` //Property_Type *Property_Type `json:"property_type,omitempty"`
Parent_Property *Property `json:"parent_property,omitempty"` Parent_Property *Property `json:"parent_property,omitempty"`
Products_Group *Product_Group `json:"products_group,omitempty"` Products_Group *Product_Group `json:"products_group,omitempty"`
Product *Product `json:"products,omitempty"` Product *Product `json:"products,omitempty"`
@@ -0,0 +1,14 @@
{{template "pt_treeNode" .}}
{{range .}}
<ul class="node"">
<details closed>
<summary>
{{.Name}}
</summary>
{{template "ptg_treeNode" .Property_Types_Groups}}
{{range .Property_Types}}
<li>{{.Name}}</li>
{{end}}
</details>
</ul>
{{end}}
@@ -1,10 +1,17 @@
{{define "ptg_treeNode"}}
{{range .}} {{range .}}
<ul class="node"> <ul class="node">
<details closed> <details closed>
<summary> <summary>
{{.Name}} {{.Name}}
</summary> </summary>
<!-- Sub nodes --> {{template "ptg_treeNode" .Property_Types_Groups}}
<ul class="node">
{{range .Property_Types}}
<li>{{.Name}}</li>
{{end}}
</ul>
</details> </details>
</ul> </ul>
{{end}} {{end}}
{{end}}