t2/views/capture/capture_form.templ

57 lines
1.6 KiB
Plaintext

package capture
import (
"gitea.henriburau.de/haw-lan/cod4watcher/views/layouts"
"gitea.henriburau.de/haw-lan/cod4watcher/views/components"
)
type CaptureFormValues struct {
Host string
Port string
Name string
Active bool
ValidateServer bool
}
templ CaptureForm(formValues CaptureFormValues, errors map[string]string) {
@layouts.Base() {
@components.Form(components.FormProps{
Title: "Create new capture",
Action: "/new/capture",
Method: "post",
SubmitText: "Create capture",
}) {
<div>
<label for="name" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">Name</label>
@components.Input(components.InputProps{
Name: "name",
Type: "text",
Value: formValues.Name,
Error: errors["name"],
Placeholder: "Name for the capture",
})
</div>
<div>
<label for="host" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">Host</label>
@components.Input(components.InputProps{
Name: "host",
Type: "text",
Value: formValues.Host,
Error: errors["host"],
Placeholder: "Host-Address of the capture",
})
</div>
<div>
<label for="port" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">Port</label>
@components.Input(components.InputProps{
Name: "port",
Type: "text",
Value: formValues.Port,
Error: errors["port"],
Placeholder: "Port for the capture",
})
</div>
}
}
}