package components
import (
"fmt"
"github.com/LazyBachelor/LazyPM/internal/models"
"github.com/LazyBachelor/LazyPM/pkg/web/components/base"
)
type IssueFormProps struct {
PostAction string
PatchAction string
Title string
Description string
Status string
Priority int
IssueType string
Class string
Attrs templ.Attributes
Target string // Optional: if empty, server controls via HX-Target header
}
templ IssueForm(props IssueFormProps) {
if props.Target == "" {
}
}
type IssueTableProps struct {
Issues []*models.Issue
}
templ IssueTable(props IssueTableProps) {
@base.Table(
[]templ.Component{
base.PlainText("ID"),
base.PlainText("Title"),
base.PlainText("Status"),
base.PlainText("Type"),
base.PlainText("Priority"),
base.PlainText("Actions"),
},
[]templ.Component{
IssueRows(props.Issues),
},
templ.Attributes{},
)
}
templ IssueRows(issues []*models.Issue) {
for _, issue := range issues {
|
{ issue.ID }
|
{ issue.Title }
|
{ string(issue.Status) } |
{ string(issue.IssueType) } |
{ fmt.Sprintf("P%d", issue.Priority) } |
|
}
}