This commit is contained in:
85
components/views/incidents.templ
Normal file
85
components/views/incidents.templ
Normal file
@@ -0,0 +1,85 @@
|
||||
package views
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
"mocksnow/components/core"
|
||||
tpl "github.com/a-h/templ"
|
||||
)
|
||||
|
||||
type IncidentRow struct {
|
||||
ID int64
|
||||
ExternalID string
|
||||
CreatedAt string
|
||||
IncidentNumber string
|
||||
Description string
|
||||
ShortDescription string
|
||||
Urgency int64
|
||||
Impact int64
|
||||
State int64
|
||||
AllNotes string
|
||||
AssignmentGroup string
|
||||
AssignedTo string
|
||||
Category string
|
||||
Subcategory string
|
||||
SysID string
|
||||
}
|
||||
|
||||
templ IncidentsTable(rows []IncidentRow) {
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
@core.Header()
|
||||
<body>
|
||||
<main>
|
||||
<div>
|
||||
<h1>Incidents</h1>
|
||||
<div>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Created At</th>
|
||||
<th>Incident #</th>
|
||||
<th>SysId</th>
|
||||
<th>Description</th>
|
||||
<th>Short Description</th>
|
||||
<th>Urgency</th>
|
||||
<th>Impact</th>
|
||||
<th>State</th>
|
||||
<th>External ID</th>
|
||||
<th>Work Notes</th>
|
||||
<th>Assignment Group</th>
|
||||
<th>Assigned To</th>
|
||||
<th>Category</th>
|
||||
<th>Subcategory</th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
for _, row := range rows {
|
||||
<tr>
|
||||
<td>{ strconv.FormatInt(row.ID, 10) }</td>
|
||||
<td>{ row.CreatedAt }</td>
|
||||
<td>{ row.IncidentNumber }</td>
|
||||
<td>{ row.SysID }</td>
|
||||
<td>{ row.Description }</td>
|
||||
<td>{ row.ShortDescription }</td>
|
||||
<td>{ strconv.FormatInt(row.Urgency, 10) }</td>
|
||||
<td>{ strconv.FormatInt(row.Impact, 10) }</td>
|
||||
<td>{ strconv.FormatInt(row.State, 10) }</td>
|
||||
<td>{ row.ExternalID }</td>
|
||||
<td>@tpl.Raw(row.AllNotes)</td>
|
||||
<td>{ row.AssignmentGroup }</td>
|
||||
<td>{ row.AssignedTo }</td>
|
||||
<td>{ row.Category }</td>
|
||||
<td>{ row.Subcategory }</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
@core.Footer()
|
||||
</body>
|
||||
</html>
|
||||
}
|
Reference in New Issue
Block a user