first commit

This commit is contained in:
2025-07-07 01:44:12 +02:00
commit bf68bde4ce
72 changed files with 29002 additions and 0 deletions
+285
View File
@@ -0,0 +1,285 @@
package components
import (
"fmt"
"tankstopp/internal/currency"
"tankstopp/internal/models"
)
templ FormGroup(label, hint string) {
<div class="mb-3">
if label != "" {
<label class="form-label">
{ label }
</label>
}
{ children... }
if hint != "" {
<div class="form-hint">{ hint }</div>
}
</div>
}
templ Input(name, inputType, placeholder, value string, required bool) {
<input
type={ inputType }
class="form-control"
name={ name }
id={ name }
placeholder={ placeholder }
value={ value }
if required {
required
}
/>
}
templ NumberInput(name, placeholder string, value float64, step string, min float64, required bool) {
<input
type="number"
class="form-control"
name={ name }
id={ name }
placeholder={ placeholder }
value={ fmt.Sprintf("%.2f", value) }
step={ step }
min={ fmt.Sprintf("%.2f", min) }
if required {
required
}
/>
}
templ DateInput(name, value string, required bool) {
<input
type="date"
class="form-control"
name={ name }
id={ name }
value={ value }
if required {
required
}
/>
}
templ TextArea(name, placeholder, value string, rows int) {
<textarea
class="form-control"
name={ name }
id={ name }
rows={ fmt.Sprintf("%d", rows) }
placeholder={ placeholder }
>{ value }</textarea>
}
templ Select(name string, required bool) {
<select
class="form-select"
name={ name }
id={ name }
if required {
required
}
>
{ children... }
</select>
}
templ Option(value, text string, selected bool) {
<option
value={ value }
if selected {
selected
}
>{ text }</option>
}
templ CurrencySelect(name, selectedCurrency string, currencies []currency.Currency) {
@Select(name, false) {
@Option("", "Select currency...", selectedCurrency == "")
for _, curr := range currencies {
@Option(curr.Code, fmt.Sprintf("%s %s - %s", curr.Symbol, curr.Code, curr.Name), curr.Code == selectedCurrency)
}
}
}
templ VehicleSelect(name string, selectedVehicleID uint, vehicles []models.Vehicle, required bool) {
@Select(name, required) {
@Option("", "Select vehicle...", selectedVehicleID == 0)
for _, vehicle := range vehicles {
if vehicle.LicensePlate != "" {
@Option(fmt.Sprintf("%d", vehicle.ID), fmt.Sprintf("%s (%s)", vehicle.Name, vehicle.LicensePlate), vehicle.ID == selectedVehicleID)
} else {
@Option(fmt.Sprintf("%d", vehicle.ID), vehicle.Name, vehicle.ID == selectedVehicleID)
}
}
}
}
templ FuelTypeSelect(name, selectedFuelType string, required bool) {
@Select(name, required) {
@Option("", "Select fuel type...", selectedFuelType == "")
@Option("Super E5", "Super E5", selectedFuelType == "Super E5")
@Option("Super E10", "Super E10", selectedFuelType == "Super E10")
@Option("Super Plus", "Super Plus", selectedFuelType == "Super Plus")
@Option("Diesel", "Diesel", selectedFuelType == "Diesel")
@Option("Premium Diesel", "Premium Diesel", selectedFuelType == "Premium Diesel")
@Option("LPG", "LPG", selectedFuelType == "LPG")
@Option("CNG", "CNG", selectedFuelType == "CNG")
@Option("Electric", "Electric", selectedFuelType == "Electric")
@Option("Hybrid", "Hybrid (Mixed)", selectedFuelType == "Hybrid")
}
}
templ InputGroup(prefix, suffix string) {
<div class="input-group">
if prefix != "" {
<span class="input-group-text" id={ prefix + "-addon" }>{ prefix }</span>
}
{ children... }
if suffix != "" {
<span class="input-group-text" id={ suffix + "-addon" }>{ suffix }</span>
}
</div>
}
templ PasswordInput(name, placeholder string, required bool) {
<div class="input-group input-group-flat">
<input
type="password"
class="form-control"
name={ name }
placeholder={ placeholder }
autocomplete="off"
if required {
required
}
/>
<span class="input-group-text">
<a href="#" class="link-secondary" onclick="togglePassword(this)" title="Show password" data-target={ name }>
@Icon("eye", 24)
</a>
</span>
</div>
}
templ Switch(name, label string, checked bool) {
<label class="form-check form-switch">
<input
class="form-check-input"
type="checkbox"
name={ name }
if checked {
checked
}
/>
<span class="form-check-label">{ label }</span>
</label>
}
templ FormButtons(cancelHref, submitText, submitIcon string) {
<div class="card-footer bg-transparent mt-auto">
<div class="btn-list justify-content-end">
<a href={ templ.SafeURL(cancelHref) } class="btn">
@Icon("arrow-left", 24)
Cancel
</a>
<button type="submit" class="btn btn-primary ms-auto">
if submitIcon != "" {
@Icon(submitIcon, 24)
}
{ submitText }
</button>
</div>
</div>
}
templ Form(method, action string) {
<form method={ method } action={ action }>
{ children... }
</form>
}
templ FormRow() {
<div class="row">
{ children... }
</div>
}
templ FormCol(size string) {
<div class={ "col-md-" + size }>
{ children... }
</div>
}
templ DeleteButton(action, itemName string) {
<form method="POST" action={ action } style="display: inline;" onsubmit="return confirmDelete(this)" data-item={ itemName }>
<button type="submit" class="btn btn-sm btn-outline-danger">
@Icon("trash", 24)
Delete
</button>
</form>
}
templ EditButton(href string) {
<a href={ templ.SafeURL(href) } class="btn btn-sm btn-outline-primary">
@Icon("edit", 24)
Edit
</a>
}
templ ButtonGroup() {
<div class="btn-list">
{ children... }
</div>
}
templ PrimaryButton(text string, icon string) {
<button type="submit" class="btn btn-primary">
if icon != "" {
@Icon(icon, 24)
}
{ text }
</button>
}
templ SecondaryButton(href, text string, icon string) {
<a href={ templ.SafeURL(href) } class="btn">
if icon != "" {
@Icon(icon, 24)
}
{ text }
</a>
}
templ InputWithIcon(name, inputType, placeholder, value string, icon string, required bool) {
@FormGroup("", "") {
if icon != "" {
@Icon(icon, 24)
}
@Input(name, inputType, placeholder, value, required)
}
}
templ CurrencyInputGroup(name string, value float64, currencySymbol string, step string) {
@InputGroup(currencySymbol, "") {
<input
type="number"
class="form-control"
name={ name }
id={ name }
step={ step }
min="0"
value={ fmt.Sprintf("%.2f", value) }
placeholder="0.00"
required
/>
}
}
templ RefreshButton() {
<button class="btn btn-outline-secondary" type="button">
@Icon("refresh", 24)
</button>
}
File diff suppressed because it is too large Load Diff
+200
View File
@@ -0,0 +1,200 @@
package components
import "fmt"
templ Icon(name string, size int) {
<svg
xmlns="http://www.w3.org/2000/svg"
class="icon"
width={ fmt.Sprintf("%d", size) }
height={ fmt.Sprintf("%d", size) }
viewBox="0 0 24 24"
stroke-width="2"
stroke="currentColor"
fill="none"
stroke-linecap="round"
stroke-linejoin="round"
>
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
switch name {
case "fuel":
<path d="M14 11h1a2 2 0 0 1 2 2v2a1 1 0 0 0 1 1h2a1 1 0 0 0 1 -1v-2a6 6 0 0 0 -6 -6h-1m-4 0a2 2 0 0 1 -2 -2v-4a2 2 0 0 1 2 -2h6a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-6a2 2 0 0 1 -2 -2v-6z"></path>
case "plus":
<line x1="12" y1="5" x2="12" y2="19"></line>
<line x1="5" y1="12" x2="19" y2="12"></line>
case "home":
<polyline points="5,12 3,12 12,3 21,12 19,12"></polyline>
<path d="m5 12v7a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-7"></path>
<path d="m9 21v-6a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2v6"></path>
case "car":
<circle cx="7" cy="17" r="2"></circle>
<circle cx="17" cy="17" r="2"></circle>
<path d="M5 17h-2v-6l2 -5h9l4 5h1a2 2 0 0 1 2 2v4h-2m-4 0h-6m-6 -6h15m-6 0v-5"></path>
case "chart-bar":
<path d="M3 12m0 1a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v6a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1z"></path>
<path d="M9 8m0 1a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v10a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1z"></path>
<path d="M15 4m0 1a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v14a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1z"></path>
case "settings":
<path d="M10.325 4.317c.426 -1.756 2.924 -1.756 3.35 0a1.724 1.724 0 0 0 2.573 1.066c1.543 -.94 3.31 .826 2.37 2.37a1.724 1.724 0 0 0 1.065 2.572c1.756 .426 1.756 2.924 0 3.35a1.724 1.724 0 0 0 -1.066 2.573c.94 1.543 -.826 3.31 -2.37 2.37a1.724 1.724 0 0 0 -2.572 1.065c-.426 1.756 -2.924 1.756 -3.35 0a1.724 1.724 0 0 0 -2.573 -1.066c-1.543 .94 -3.31 -.826 -2.37 -2.37a1.724 1.724 0 0 0 -1.065 -2.572c-1.756 -.426 -1.756 -2.924 0 -3.35a1.724 1.724 0 0 0 1.066 -2.573c-.94 -1.543 .826 -3.31 2.37 -2.37c1 .608 2.296 .07 2.572 -1.065z"></path>
<circle cx="12" cy="12" r="3"></circle>
case "logout":
<path d="M14 8v-2a2 2 0 0 0 -2 -2h-7a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h7a2 2 0 0 0 2 -2v-2"></path>
<path d="M20 12h-13l3 -3m0 6l-3 -3"></path>
case "check":
<path d="M5 12l5 5l10 -10"></path>
case "alert-circle":
<circle cx="12" cy="12" r="9"></circle>
<line x1="12" y1="8" x2="12" y2="12"></line>
<line x1="12" y1="16" x2="12.01" y2="16"></line>
case "alert-triangle":
<path d="M12 9v2m0 4v.01"></path>
<path d="M5 19h14a2 2 0 0 0 1.84 -2.75l-7.1 -12.25a2 2 0 0 0 -3.5 0l-7.1 12.25a2 2 0 0 0 1.75 2.75"></path>
case "info-circle":
<circle cx="12" cy="12" r="9"></circle>
<line x1="12" y1="8" x2="12.01" y2="8"></line>
<polyline points="11,12 12,12 12,16 13,16"></polyline>
case "calendar":
<rect x="4" y="5" width="16" height="16" rx="2"></rect>
<line x1="16" y1="3" x2="16" y2="7"></line>
<line x1="8" y1="3" x2="8" y2="7"></line>
<line x1="4" y1="11" x2="20" y2="11"></line>
case "location":
<circle cx="12" cy="11" r="3"></circle>
<path d="M17.657 16.657l-4.243 4.243a2 2 0 0 1 -2.827 0l-4.244 -4.243a8 8 0 1 1 11.314 0z"></path>
case "edit":
<path d="M7 7h-1a2 2 0 0 0 -2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2 -2v-1"></path>
<path d="M20.385 6.585a2.1 2.1 0 0 0 -2.97 -2.97l-8.415 8.385v3h3l8.385 -8.415z"></path>
<path d="M16 5l3 3"></path>
case "trash":
<path d="M4 7l16 0"></path>
<path d="M10 11l0 6"></path>
<path d="M14 11l0 6"></path>
<path d="M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12"></path>
<path d="M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3"></path>
case "currency":
<circle cx="12" cy="12" r="3"></circle>
<path d="M3 12h6m6 0h6"></path>
case "save":
<path d="M6 4h10l4 4v10a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2v-12a2 2 0 0 1 2 -2"></path>
<circle cx="12" cy="14" r="2"></circle>
<polyline points="14,4 14,8 8,8 8,4"></polyline>
case "arrow-left":
<path d="M5 12l14 -7"></path>
<path d="M5 12l14 7"></path>
case "clock":
<circle cx="12" cy="12" r="9"></circle>
<polyline points="12,7 12,12 15,15"></polyline>
case "gas-station":
<path d="M6.8 11a6 6 0 1 0 10.396 0l-.436 -2.183a4 4 0 1 0 -9.564 0l-.396 2.183z"></path>
<path d="M6 14h12a2 2 0 0 1 2 2v2a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2v-2a2 2 0 0 1 2 -2z"></path>
case "user":
<circle cx="12" cy="7" r="4"></circle>
<path d="M6 21v-2a4 4 0 0 1 4 -4h4a4 4 0 0 1 4 4v2"></path>
case "lock":
<rect x="5" y="11" width="14" height="10" rx="2"></rect>
<circle cx="12" cy="16" r="1"></circle>
<path d="M8 11v-4a4 4 0 0 1 8 0v4"></path>
case "eye":
<circle cx="12" cy="12" r="2"></circle>
<path d="M22 12c-2.667 4.667 -6 7 -10 7s-7.333 -2.333 -10 -7c2.667 -4.667 6 -7 10 -7s7.333 2.333 10 7"></path>
case "eye-off":
<line x1="3" y1="3" x2="21" y2="21"></line>
<path d="M10.584 10.587a2 2 0 0 0 2.828 2.83"></path>
<path d="M9.363 5.365a9.466 9.466 0 0 1 2.637 -.365c4 0 7.333 2.333 10 7c-.778 1.361 -1.612 2.524 -2.503 3.488m-2.14 1.861c-1.631 1.1 -3.415 1.651 -5.357 1.651c-4 0 -7.333 -2.333 -10 -7c1.369 -2.395 2.913 -4.175 4.632 -5.341"></path>
case "gauge":
<circle cx="12" cy="12" r="9"></circle>
<path d="M14.8 9a2 2 0 0 0 -1.8 -1h-2a2 2 0 1 0 0 4h2a2 2 0 1 1 0 4h-2a2 2 0 0 1 -1.8 -1"></path>
<path d="M12 6v2m0 8v2"></path>
case "notes":
<path d="M8 2v4"></path>
<path d="M16 2v4"></path>
<rect x="3" y="4" width="18" height="18" rx="2"></rect>
<path d="M3 10h18"></path>
<path d="M8 14h.01"></path>
<path d="M12 14h.01"></path>
<path d="M16 14h.01"></path>
<path d="M8 18h.01"></path>
<path d="M12 18h.01"></path>
<path d="M16 18h.01"></path>
case "refresh":
<path d="M20 11a8.1 8.1 0 0 0 -15.5 -2m-.5 -4v4h4"></path>
<path d="M4 13a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4"></path>
case "license-plate":
<rect x="4" y="4" width="6" height="6" rx="1"></rect>
<rect x="4" y="14" width="6" height="6" rx="1"></rect>
<rect x="14" y="14" width="6" height="6" rx="1"></rect>
<line x1="14" y1="7" x2="20" y2="7"></line>
<line x1="17" y1="4" x2="17" y2="10"></line>
case "brand":
<path d="M9 11l-4 4l4 4m-4 -4h11a4 4 0 0 0 0 -8h-1"></path>
case "model":
<path d="M12 3l8 4.5l0 9l-8 4.5l-8 -4.5l0 -9z"></path>
<path d="M12 12l8 -4.5"></path>
<path d="M12 12l0 9"></path>
<path d="M12 12l-8 -4.5"></path>
case "status":
<circle cx="12" cy="12" r="9"></circle>
<polyline points="9,11 12,8 15,11"></polyline>
<line x1="12" y1="8" x2="12" y2="16"></line>
case "trip":
<path d="M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0"></path>
<path d="M12 7v5l3 3"></path>
case "database":
<ellipse cx="12" cy="5" rx="9" ry="3"></ellipse>
<path d="M3 5v14a9 3 0 0 0 18 0v-14"></path>
<path d="M3 12a9 3 0 0 0 18 0"></path>
case "download":
<path d="M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"></path>
<polyline points="7,11 12,16 17,11"></polyline>
<line x1="12" y1="2" x2="12" y2="16"></line>
case "upload":
<path d="M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"></path>
<polyline points="7,9 12,4 17,9"></polyline>
<line x1="12" y1="4" x2="12" y2="16"></line>
case "zap":
<polygon points="13,2 3,14 12,14 11,22 21,10 12,10"></polygon>
case "search":
<circle cx="11" cy="11" r="8"></circle>
<line x1="21" y1="21" x2="16.65" y2="16.65"></line>
case "dots-vertical":
<circle cx="12" cy="12" r="1"></circle>
<circle cx="12" cy="5" r="1"></circle>
<circle cx="12" cy="19" r="1"></circle>
case "award":
<circle cx="12" cy="8" r="7"></circle>
<polyline points="8.21,13.89 7,23 12,20 17,23 15.79,13.88"></polyline>
default:
<circle cx="12" cy="12" r="10"></circle>
}
</svg>
}
templ IconWithClass(name string, size int, class string) {
<svg
xmlns="http://www.w3.org/2000/svg"
class={ "icon", class }
width={ fmt.Sprintf("%d", size) }
height={ fmt.Sprintf("%d", size) }
viewBox="0 0 24 24"
stroke-width="2"
stroke="currentColor"
fill="none"
stroke-linecap="round"
stroke-linejoin="round"
>
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
@renderIconPath(name)
</svg>
}
templ renderIconPath(name string) {
switch name {
case "fuel":
<path d="M14 11h1a2 2 0 0 1 2 2v2a1 1 0 0 0 1 1h2a1 1 0 0 0 1 -1v-2a6 6 0 0 0 -6 -6h-1m-4 0a2 2 0 0 1 -2 -2v-4a2 2 0 0 1 2 -2h6a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-6a2 2 0 0 1 -2 -2v-6z"></path>
case "plus":
<line x1="12" y1="5" x2="12" y2="19"></line>
<line x1="5" y1="12" x2="19" y2="12"></line>
default:
<circle cx="12" cy="12" r="10"></circle>
}
}
+397
View File
@@ -0,0 +1,397 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.3.906
package components
//lint:file-ignore SA4006 This context is only used if a nested component is present.
import "github.com/a-h/templ"
import templruntime "github.com/a-h/templ/runtime"
import "fmt"
func Icon(name string, size int) templ.Component {
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
if !templ_7745c5c3_IsBuffer {
defer func() {
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
}()
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Var1 := templ.GetChildren(ctx)
if templ_7745c5c3_Var1 == nil {
templ_7745c5c3_Var1 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "<svg xmlns=\"http://www.w3.org/2000/svg\" class=\"icon\" width=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var2 string
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%d", size))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/views/components/icons.templ`, Line: 9, Col: 33}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "\" height=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var3 string
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%d", size))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/views/components/icons.templ`, Line: 10, Col: 34}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "\" viewBox=\"0 0 24 24\" stroke-width=\"2\" stroke=\"currentColor\" fill=\"none\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"></path> ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
switch name {
case "fuel":
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, "<path d=\"M14 11h1a2 2 0 0 1 2 2v2a1 1 0 0 0 1 1h2a1 1 0 0 0 1 -1v-2a6 6 0 0 0 -6 -6h-1m-4 0a2 2 0 0 1 -2 -2v-4a2 2 0 0 1 2 -2h6a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-6a2 2 0 0 1 -2 -2v-6z\"></path>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
case "plus":
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "<line x1=\"12\" y1=\"5\" x2=\"12\" y2=\"19\"></line> <line x1=\"5\" y1=\"12\" x2=\"19\" y2=\"12\"></line>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
case "home":
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 6, "<polyline points=\"5,12 3,12 12,3 21,12 19,12\"></polyline> <path d=\"m5 12v7a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-7\"></path> <path d=\"m9 21v-6a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2v6\"></path>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
case "car":
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 7, "<circle cx=\"7\" cy=\"17\" r=\"2\"></circle> <circle cx=\"17\" cy=\"17\" r=\"2\"></circle> <path d=\"M5 17h-2v-6l2 -5h9l4 5h1a2 2 0 0 1 2 2v4h-2m-4 0h-6m-6 -6h15m-6 0v-5\"></path>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
case "chart-bar":
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 8, "<path d=\"M3 12m0 1a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v6a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1z\"></path> <path d=\"M9 8m0 1a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v10a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1z\"></path> <path d=\"M15 4m0 1a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v14a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1z\"></path>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
case "settings":
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 9, "<path d=\"M10.325 4.317c.426 -1.756 2.924 -1.756 3.35 0a1.724 1.724 0 0 0 2.573 1.066c1.543 -.94 3.31 .826 2.37 2.37a1.724 1.724 0 0 0 1.065 2.572c1.756 .426 1.756 2.924 0 3.35a1.724 1.724 0 0 0 -1.066 2.573c.94 1.543 -.826 3.31 -2.37 2.37a1.724 1.724 0 0 0 -2.572 1.065c-.426 1.756 -2.924 1.756 -3.35 0a1.724 1.724 0 0 0 -2.573 -1.066c-1.543 .94 -3.31 -.826 -2.37 -2.37a1.724 1.724 0 0 0 -1.065 -2.572c-1.756 -.426 -1.756 -2.924 0 -3.35a1.724 1.724 0 0 0 1.066 -2.573c-.94 -1.543 .826 -3.31 2.37 -2.37c1 .608 2.296 .07 2.572 -1.065z\"></path> <circle cx=\"12\" cy=\"12\" r=\"3\"></circle>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
case "logout":
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 10, "<path d=\"M14 8v-2a2 2 0 0 0 -2 -2h-7a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h7a2 2 0 0 0 2 -2v-2\"></path> <path d=\"M20 12h-13l3 -3m0 6l-3 -3\"></path>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
case "check":
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 11, "<path d=\"M5 12l5 5l10 -10\"></path>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
case "alert-circle":
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 12, "<circle cx=\"12\" cy=\"12\" r=\"9\"></circle> <line x1=\"12\" y1=\"8\" x2=\"12\" y2=\"12\"></line> <line x1=\"12\" y1=\"16\" x2=\"12.01\" y2=\"16\"></line>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
case "alert-triangle":
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 13, "<path d=\"M12 9v2m0 4v.01\"></path> <path d=\"M5 19h14a2 2 0 0 0 1.84 -2.75l-7.1 -12.25a2 2 0 0 0 -3.5 0l-7.1 12.25a2 2 0 0 0 1.75 2.75\"></path>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
case "info-circle":
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 14, "<circle cx=\"12\" cy=\"12\" r=\"9\"></circle> <line x1=\"12\" y1=\"8\" x2=\"12.01\" y2=\"8\"></line> <polyline points=\"11,12 12,12 12,16 13,16\"></polyline>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
case "calendar":
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 15, "<rect x=\"4\" y=\"5\" width=\"16\" height=\"16\" rx=\"2\"></rect> <line x1=\"16\" y1=\"3\" x2=\"16\" y2=\"7\"></line> <line x1=\"8\" y1=\"3\" x2=\"8\" y2=\"7\"></line> <line x1=\"4\" y1=\"11\" x2=\"20\" y2=\"11\"></line>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
case "location":
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 16, "<circle cx=\"12\" cy=\"11\" r=\"3\"></circle> <path d=\"M17.657 16.657l-4.243 4.243a2 2 0 0 1 -2.827 0l-4.244 -4.243a8 8 0 1 1 11.314 0z\"></path>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
case "edit":
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 17, "<path d=\"M7 7h-1a2 2 0 0 0 -2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2 -2v-1\"></path> <path d=\"M20.385 6.585a2.1 2.1 0 0 0 -2.97 -2.97l-8.415 8.385v3h3l8.385 -8.415z\"></path> <path d=\"M16 5l3 3\"></path>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
case "trash":
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 18, "<path d=\"M4 7l16 0\"></path> <path d=\"M10 11l0 6\"></path> <path d=\"M14 11l0 6\"></path> <path d=\"M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12\"></path> <path d=\"M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3\"></path>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
case "currency":
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 19, "<circle cx=\"12\" cy=\"12\" r=\"3\"></circle> <path d=\"M3 12h6m6 0h6\"></path>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
case "save":
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 20, "<path d=\"M6 4h10l4 4v10a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2v-12a2 2 0 0 1 2 -2\"></path> <circle cx=\"12\" cy=\"14\" r=\"2\"></circle> <polyline points=\"14,4 14,8 8,8 8,4\"></polyline>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
case "arrow-left":
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 21, "<path d=\"M5 12l14 -7\"></path> <path d=\"M5 12l14 7\"></path>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
case "clock":
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 22, "<circle cx=\"12\" cy=\"12\" r=\"9\"></circle> <polyline points=\"12,7 12,12 15,15\"></polyline>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
case "gas-station":
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 23, "<path d=\"M6.8 11a6 6 0 1 0 10.396 0l-.436 -2.183a4 4 0 1 0 -9.564 0l-.396 2.183z\"></path> <path d=\"M6 14h12a2 2 0 0 1 2 2v2a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2v-2a2 2 0 0 1 2 -2z\"></path>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
case "user":
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 24, "<circle cx=\"12\" cy=\"7\" r=\"4\"></circle> <path d=\"M6 21v-2a4 4 0 0 1 4 -4h4a4 4 0 0 1 4 4v2\"></path>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
case "lock":
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 25, "<rect x=\"5\" y=\"11\" width=\"14\" height=\"10\" rx=\"2\"></rect> <circle cx=\"12\" cy=\"16\" r=\"1\"></circle> <path d=\"M8 11v-4a4 4 0 0 1 8 0v4\"></path>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
case "eye":
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 26, "<circle cx=\"12\" cy=\"12\" r=\"2\"></circle> <path d=\"M22 12c-2.667 4.667 -6 7 -10 7s-7.333 -2.333 -10 -7c2.667 -4.667 6 -7 10 -7s7.333 2.333 10 7\"></path>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
case "eye-off":
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 27, "<line x1=\"3\" y1=\"3\" x2=\"21\" y2=\"21\"></line> <path d=\"M10.584 10.587a2 2 0 0 0 2.828 2.83\"></path> <path d=\"M9.363 5.365a9.466 9.466 0 0 1 2.637 -.365c4 0 7.333 2.333 10 7c-.778 1.361 -1.612 2.524 -2.503 3.488m-2.14 1.861c-1.631 1.1 -3.415 1.651 -5.357 1.651c-4 0 -7.333 -2.333 -10 -7c1.369 -2.395 2.913 -4.175 4.632 -5.341\"></path>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
case "gauge":
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 28, "<circle cx=\"12\" cy=\"12\" r=\"9\"></circle> <path d=\"M14.8 9a2 2 0 0 0 -1.8 -1h-2a2 2 0 1 0 0 4h2a2 2 0 1 1 0 4h-2a2 2 0 0 1 -1.8 -1\"></path> <path d=\"M12 6v2m0 8v2\"></path>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
case "notes":
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 29, "<path d=\"M8 2v4\"></path> <path d=\"M16 2v4\"></path> <rect x=\"3\" y=\"4\" width=\"18\" height=\"18\" rx=\"2\"></rect> <path d=\"M3 10h18\"></path> <path d=\"M8 14h.01\"></path> <path d=\"M12 14h.01\"></path> <path d=\"M16 14h.01\"></path> <path d=\"M8 18h.01\"></path> <path d=\"M12 18h.01\"></path> <path d=\"M16 18h.01\"></path>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
case "refresh":
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 30, "<path d=\"M20 11a8.1 8.1 0 0 0 -15.5 -2m-.5 -4v4h4\"></path> <path d=\"M4 13a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4\"></path>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
case "license-plate":
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 31, "<rect x=\"4\" y=\"4\" width=\"6\" height=\"6\" rx=\"1\"></rect> <rect x=\"4\" y=\"14\" width=\"6\" height=\"6\" rx=\"1\"></rect> <rect x=\"14\" y=\"14\" width=\"6\" height=\"6\" rx=\"1\"></rect> <line x1=\"14\" y1=\"7\" x2=\"20\" y2=\"7\"></line> <line x1=\"17\" y1=\"4\" x2=\"17\" y2=\"10\"></line>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
case "brand":
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 32, "<path d=\"M9 11l-4 4l4 4m-4 -4h11a4 4 0 0 0 0 -8h-1\"></path>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
case "model":
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 33, "<path d=\"M12 3l8 4.5l0 9l-8 4.5l-8 -4.5l0 -9z\"></path> <path d=\"M12 12l8 -4.5\"></path> <path d=\"M12 12l0 9\"></path> <path d=\"M12 12l-8 -4.5\"></path>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
case "status":
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 34, "<circle cx=\"12\" cy=\"12\" r=\"9\"></circle> <polyline points=\"9,11 12,8 15,11\"></polyline> <line x1=\"12\" y1=\"8\" x2=\"12\" y2=\"16\"></line>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
case "trip":
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 35, "<path d=\"M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0\"></path> <path d=\"M12 7v5l3 3\"></path>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
case "database":
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 36, "<ellipse cx=\"12\" cy=\"5\" rx=\"9\" ry=\"3\"></ellipse> <path d=\"M3 5v14a9 3 0 0 0 18 0v-14\"></path> <path d=\"M3 12a9 3 0 0 0 18 0\"></path>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
case "download":
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 37, "<path d=\"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2\"></path> <polyline points=\"7,11 12,16 17,11\"></polyline> <line x1=\"12\" y1=\"2\" x2=\"12\" y2=\"16\"></line>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
case "upload":
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 38, "<path d=\"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2\"></path> <polyline points=\"7,9 12,4 17,9\"></polyline> <line x1=\"12\" y1=\"4\" x2=\"12\" y2=\"16\"></line>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
case "zap":
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 39, "<polygon points=\"13,2 3,14 12,14 11,22 21,10 12,10\"></polygon>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
case "search":
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 40, "<circle cx=\"11\" cy=\"11\" r=\"8\"></circle> <line x1=\"21\" y1=\"21\" x2=\"16.65\" y2=\"16.65\"></line>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
case "dots-vertical":
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 41, "<circle cx=\"12\" cy=\"12\" r=\"1\"></circle> <circle cx=\"12\" cy=\"5\" r=\"1\"></circle> <circle cx=\"12\" cy=\"19\" r=\"1\"></circle>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
case "award":
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 42, "<circle cx=\"12\" cy=\"8\" r=\"7\"></circle> <polyline points=\"8.21,13.89 7,23 12,20 17,23 15.79,13.88\"></polyline>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
default:
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 43, "<circle cx=\"12\" cy=\"12\" r=\"10\"></circle>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 44, "</svg>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return nil
})
}
func IconWithClass(name string, size int, class string) templ.Component {
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
if !templ_7745c5c3_IsBuffer {
defer func() {
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
}()
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Var4 := templ.GetChildren(ctx)
if templ_7745c5c3_Var4 == nil {
templ_7745c5c3_Var4 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
var templ_7745c5c3_Var5 = []any{"icon", class}
templ_7745c5c3_Err = templ.RenderCSSItems(ctx, templ_7745c5c3_Buffer, templ_7745c5c3_Var5...)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 45, "<svg xmlns=\"http://www.w3.org/2000/svg\" class=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var6 string
templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(templ.CSSClasses(templ_7745c5c3_Var5).String())
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/views/components/icons.templ`, Line: 1, Col: 0}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 46, "\" width=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var7 string
templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%d", size))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/views/components/icons.templ`, Line: 176, Col: 33}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 47, "\" height=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var8 string
templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%d", size))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/views/components/icons.templ`, Line: 177, Col: 34}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 48, "\" viewBox=\"0 0 24 24\" stroke-width=\"2\" stroke=\"currentColor\" fill=\"none\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"></path>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = renderIconPath(name).Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 49, "</svg>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return nil
})
}
func renderIconPath(name string) templ.Component {
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
if !templ_7745c5c3_IsBuffer {
defer func() {
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
}()
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Var9 := templ.GetChildren(ctx)
if templ_7745c5c3_Var9 == nil {
templ_7745c5c3_Var9 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
switch name {
case "fuel":
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 50, "<path d=\"M14 11h1a2 2 0 0 1 2 2v2a1 1 0 0 0 1 1h2a1 1 0 0 0 1 -1v-2a6 6 0 0 0 -6 -6h-1m-4 0a2 2 0 0 1 -2 -2v-4a2 2 0 0 1 2 -2h6a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-6a2 2 0 0 1 -2 -2v-6z\"></path>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
case "plus":
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 51, "<line x1=\"12\" y1=\"5\" x2=\"12\" y2=\"19\"></line> <line x1=\"5\" y1=\"12\" x2=\"19\" y2=\"12\"></line>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
default:
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 52, "<circle cx=\"12\" cy=\"12\" r=\"10\"></circle>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
return nil
})
}
var _ = templruntime.GeneratedTemplate
+405
View File
@@ -0,0 +1,405 @@
package components
import (
"fmt"
"tankstopp/internal/models"
)
templ BaseLayout(title string, user *models.User, username string) {
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>{ title } - TankStopp</title>
<link href="https://cdn.jsdelivr.net/npm/@tabler/core@1.0.0-beta17/dist/css/tabler.min.css" rel="stylesheet"/>
<link href="https://cdn.jsdelivr.net/npm/@tabler/icons@latest/icons-sprite.svg" rel="stylesheet"/>
<link href="/static/style.css" rel="stylesheet"/>
</head>
<body>
<div class="page">
@Navbar(user, username)
<div class="page-wrapper">
{ children... }
@Footer()
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/@tabler/core@1.0.0-beta17/dist/js/tabler.min.js"></script>
</body>
</html>
}
templ Navbar(user *models.User, username string) {
<header class="navbar navbar-expand-md navbar-light d-print-none">
<div class="container-xl">
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar-menu">
<span class="navbar-toggler-icon"></span>
</button>
<h1 class="navbar-brand navbar-brand-autodark d-none-navbar-horizontal pe-0 pe-md-3">
<a href="/dashboard" class="text-decoration-none">
@Icon("fuel", 24)
TankStopp
</a>
</h1>
<div class="navbar-nav flex-row order-md-last">
if user != nil {
<a href="/add" class="btn btn-primary me-2">
@Icon("plus", 24)
Add Stop
</a>
@UserDropdown(user, username)
}
</div>
<div class="collapse navbar-collapse" id="navbar-menu">
<div class="d-flex flex-column flex-md-row flex-fill align-items-stretch align-items-md-center">
<ul class="navbar-nav">
@NavItem("/dashboard", "home", "Dashboard", false)
@NavItem("/vehicles", "car", "Vehicles", false)
@NavItem("/api/stats", "chart-bar", "API", false)
</ul>
</div>
</div>
</div>
</header>
}
templ NavItem(href, icon, title string, active bool) {
<li class={ "nav-item", templ.KV("active", active) }>
<a class="nav-link" href={ templ.SafeURL(href) }>
<span class="nav-link-icon d-md-none d-lg-inline-block">
@Icon(icon, 24)
</span>
<span class="nav-link-title">{ title }</span>
</a>
</li>
}
templ UserDropdown(user *models.User, username string) {
<div class="nav-item dropdown">
<a href="#" class="nav-link d-flex lh-1 text-reset p-0" data-bs-toggle="dropdown" aria-label="Open user menu">
<span class="avatar avatar-sm" style="background: var(--tblr-primary); text-transform: uppercase;">
if username != "" {
{ string(username[0]) }
} else {
{ "U" }
}
</span>
<div class="d-none d-xl-block ps-2">
<div>{ username }</div>
<div class="mt-1 small text-muted">
{ user.BaseCurrency }
</div>
</div>
</a>
<div class="dropdown-menu dropdown-menu-end dropdown-menu-arrow">
<div class="dropdown-item">
<div class="text-muted">Signed in as</div>
<strong>{ username }</strong>
</div>
<div class="dropdown-divider"></div>
<a href="/settings" class="dropdown-item">
@Icon("settings", 24)
Settings
</a>
<div class="dropdown-divider"></div>
<form method="POST" action="/logout" class="d-inline">
<button type="submit" class="dropdown-item text-danger">
@Icon("logout", 24)
Logout
</button>
</form>
</div>
</div>
}
templ Footer() {
<footer class="footer footer-transparent d-print-none">
<div class="container-xl">
<div class="row text-center align-items-center flex-row-reverse">
<div class="col-lg-auto ms-lg-auto">
<ul class="list-inline list-inline-dots mb-0">
<li class="list-inline-item">
<a href="https://github.com/tabler/tabler" class="link-secondary">Built with Tabler</a>
</li>
</ul>
</div>
<div class="col-12 col-lg-auto mt-3 mt-lg-0">
<ul class="list-inline list-inline-dots mb-0">
<li class="list-inline-item">
Copyright &copy; 2024 TankStopp - Fuel Tracking App
</li>
</ul>
</div>
</div>
</div>
</footer>
}
templ PageHeader(pretitle, title string) {
<div class="page-header d-print-none">
<div class="container-xl">
<div class="row g-2 align-items-center">
<div class="col">
if pretitle != "" {
<div class="page-pretitle">{ pretitle }</div>
}
<h2 class="page-title">{ title }</h2>
</div>
</div>
</div>
</div>
}
templ Alert(alertType, message string) {
<div class={ "alert", "alert-" + alertType, "alert-dismissible" } role="alert">
<div class="d-flex">
<div>
switch alertType {
case "success":
@Icon("check", 24)
case "danger":
@Icon("alert-circle", 24)
case "warning":
@Icon("alert-triangle", 24)
case "info":
@Icon("info-circle", 24)
}
</div>
<div>{ message }</div>
</div>
<a class="btn-close" data-bs-dismiss="alert" aria-label="close"></a>
</div>
}
templ Card(title string, icon string) {
<div class="card">
if title != "" {
<div class="card-header">
<h3 class="card-title">
if icon != "" {
@Icon(icon, 24)
}
{ title }
</h3>
</div>
}
<div class="card-body">
{ children... }
</div>
</div>
}
templ EmptyState(icon, title, subtitle, actionText, actionHref string) {
<div class="empty">
<div class="empty-img">
@Icon(icon, 128)
</div>
<p class="empty-title">{ title }</p>
<p class="empty-subtitle text-muted">{ subtitle }</p>
if actionText != "" && actionHref != "" {
<div class="empty-action">
<a href={ templ.SafeURL(actionHref) } class="btn btn-primary">
@Icon("plus", 24)
{ actionText }
</a>
</div>
}
</div>
}
templ LoadingSpinner(size string) {
<div class={ "spinner-border", "spinner-border-" + size } role="status">
<span class="visually-hidden">Loading...</span>
</div>
}
templ Badge(text, variant string) {
<span class={ "badge", "bg-" + variant }>{ text }</span>
}
templ ProgressBar(percentage int, variant string) {
<div class="progress">
<div class={ "progress-bar", "bg-" + variant } role="progressbar" style={ fmt.Sprintf("width: %d%%", percentage) }>
{ fmt.Sprintf("%d%%", percentage) }
</div>
</div>
}
templ Modal(id, title string) {
<div class="modal fade" id={ id } tabindex="-1" aria-labelledby={ id + "Label" } aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id={ id + "Label" }>{ title }</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
{ children... }
</div>
<div class="modal-footer">
{ children... }
</div>
</div>
</div>
</div>
}
templ Tooltip(text string) {
<span data-bs-toggle="tooltip" data-bs-placement="top" title={ text }>
{ children... }
</span>
}
templ Breadcrumb(items []BreadcrumbItem) {
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
for i, item := range items {
if i == len(items)-1 {
<li class="breadcrumb-item active" aria-current="page">{ item.Title }</li>
} else {
<li class="breadcrumb-item">
<a href={ templ.SafeURL(item.Href) }>{ item.Title }</a>
</li>
}
}
</ol>
</nav>
}
type BreadcrumbItem struct {
Title string
Href string
}
templ Tabs(activeTab string, tabs []TabItem) {
<ul class="nav nav-tabs" role="tablist">
for _, tab := range tabs {
<li class="nav-item" role="presentation">
<a
class={ "nav-link", templ.KV("active", tab.ID == activeTab) }
href={ templ.SafeURL(tab.Href) }
role="tab"
>
if tab.Icon != "" {
@Icon(tab.Icon, 24)
}
{ tab.Title }
</a>
</li>
}
</ul>
}
type TabItem struct {
ID string
Title string
Href string
Icon string
}
templ StatCard(title, value, subtitle, icon, variant string) {
<div class="card">
<div class="card-body">
<div class="d-flex align-items-center">
<div class="flex-fill">
<div class="subheader">{ title }</div>
<div class="h2 mb-0">{ value }</div>
if subtitle != "" {
<div class="text-muted">{ subtitle }</div>
}
</div>
<div class="ms-auto">
<div class={ "text-" + variant }>
@Icon(icon, 32)
</div>
</div>
</div>
</div>
</div>
}
templ ActionButton(href, text, icon, variant string) {
<a href={ templ.SafeURL(href) } class={ "btn", "btn-" + variant }>
if icon != "" {
@Icon(icon, 24)
}
{ text }
</a>
}
templ TableResponsive() {
<div class="table-responsive">
<table class="table table-vcenter table-mobile-md card-table">
{ children... }
</table>
</div>
}
templ Pagination(currentPage, totalPages int, baseURL string) {
if totalPages > 1 {
<nav aria-label="Page navigation">
<ul class="pagination">
if currentPage > 1 {
<li class="page-item">
<a class="page-link" href={ templ.SafeURL(fmt.Sprintf("%s?page=%d", baseURL, currentPage-1)) }>Previous</a>
</li>
}
for i := 1; i <= totalPages; i++ {
<li class={ "page-item", templ.KV("active", i == currentPage) }>
<a class="page-link" href={ templ.SafeURL(fmt.Sprintf("%s?page=%d", baseURL, i)) }>{ fmt.Sprintf("%d", i) }</a>
</li>
}
if currentPage < totalPages {
<li class="page-item">
<a class="page-link" href={ templ.SafeURL(fmt.Sprintf("%s?page=%d", baseURL, currentPage+1)) }>Next</a>
</li>
}
</ul>
</nav>
}
}
templ ConfirmDialog(id, title, message, confirmText, cancelText string) {
<div class="modal fade" id={ id } tabindex="-1" aria-labelledby={ id + "Label" } aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id={ id + "Label" }>{ title }</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<p>{ message }</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">{ cancelText }</button>
<button type="button" class="btn btn-danger" onclick="confirmAction(this)" data-action={ id }>{ confirmText }</button>
</div>
</div>
</div>
</div>
}
templ ListGroup() {
<div class="list-group">
{ children... }
</div>
}
templ ListGroupItem(active bool) {
<div class={ "list-group-item", templ.KV("active", active) }>
{ children... }
</div>
}
templ ButtonToolbar() {
<div class="btn-toolbar" role="toolbar">
{ children... }
</div>
}
templ StatusIndicator(status, text string) {
<span class="status-indicator">
<span class={ "status", "status-" + status }></span>
{ text }
</span>
}
File diff suppressed because it is too large Load Diff