|
|
|
|
@ -89,7 +89,7 @@ func RegisterForm(groups []models.Group, isAdmin bool) templ.Component {
|
|
|
|
|
templ_7745c5c3_Var3 = templ.NopComponent
|
|
|
|
|
}
|
|
|
|
|
ctx = templ.ClearChildren(ctx)
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "<div class=\"card\"><div class=\"card-header\"><h3 class=\"h6 mb-0\">Racer Registration</h3></div><div class=\"card-body\"><div id=\"racer-form-message\"></div><form id=\"racer-form\" hx-post=\"/api/racers\" hx-target=\"#racer-form-message\" hx-swap=\"innerHTML\" hx-on::before-request=\"return validateForm()\" hx-on::after-request=\"if(event.detail.successful && !event.detail.xhr.response.includes('danger')) { \r\n\t\t\t\t\tdocument.getElementById('racer-form').reset(); \r\n\t\t\t\t\tsetTimeout(function() {\r\n\t\t\t\t\t\tdocument.getElementById('racer-form-message').innerHTML = '';\r\n\t\t\t\t\t\t// Check if we're on the admin page by looking for the racers-list element\r\n\t\t\t\t\t\tif (document.getElementById('racers-list')) {\r\n\t\t\t\t\t\t\thtmx.ajax('GET', '/admin/racers/list', {target: '#racers-list'});\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}, 3000);\r\n\t\t\t\t}\"><!-- Form fields for racer registration --><div class=\"mb-3\"><label for=\"first-name\" class=\"form-label\">First Name</label> <input type=\"text\" class=\"form-control\" id=\"first-name\" name=\"first_name\" required></div><div class=\"mb-3\"><label for=\"last-name\" class=\"form-label\">Last Name</label> <input type=\"text\" class=\"form-control\" id=\"last-name\" name=\"last_name\" required></div><div class=\"mb-3\"><label for=\"car-number\" class=\"form-label\">Car Number</label> <input type=\"text\" class=\"form-control\" id=\"car-number\" name=\"car_number\" required hx-get=\"/api/validate/car-number\" hx-trigger=\"change\" hx-target=\"#car-number-validation-error\" hx-swap=\"outerHTML\"><div class=\"invalid-feedback\" id=\"car-number-validation-error\"></div></div><div class=\"mb-3\"><label for=\"car-weight\" class=\"form-label\">Car Weight (oz)</label> <input type=\"number\" step=\"0.01\" class=\"form-control\" id=\"car-weight\" name=\"car_weight\" required></div><div class=\"mb-3\"><label for=\"group-id\" class=\"form-label\">Group</label> <select class=\"form-select\" id=\"group-id\" name=\"group_id\" required><option value=\"\">Select a group</option> ")
|
|
|
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "<div class=\"card\"><div class=\"card-header\"><h3 class=\"h6 mb-0\">Racer Registration</h3></div><div class=\"card-body\"><div id=\"racer-form-message\"></div><form id=\"racer-form\" hx-post=\"/api/racers\" hx-target=\"#racer-form-message\" hx-swap=\"innerHTML\" hx-on::before-request=\"return validateForm()\" hx-on::after-request=\"if(event.detail.successful && !event.detail.xhr.response.includes('error')) { \r\n\t\t\t\t\tdocument.getElementById('racer-form').reset(); \r\n\t\t\t\t\tsetTimeout(function() {\r\n\t\t\t\t\t\tdocument.getElementById('racer-form-message').innerHTML = '';\r\n\t\t\t\t\t\t// Check if we're on the admin page by looking for the racers-list element\r\n\t\t\t\t\t\tif (document.getElementById('racers-list')) {\r\n\t\t\t\t\t\t\thtmx.ajax('GET', '/admin/racers/list', {target: '#racers-list'});\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}, 3000);\r\n\t\t\t\t}\"><!-- Form fields for racer registration --><div class=\"mb-3\"><label for=\"first-name\" class=\"form-label\">First Name</label> <input type=\"text\" class=\"form-control\" id=\"first-name\" name=\"first_name\" required></div><div class=\"mb-3\"><label for=\"last-name\" class=\"form-label\">Last Name</label> <input type=\"text\" class=\"form-control\" id=\"last-name\" name=\"last_name\" required></div><div class=\"mb-3\"><label for=\"car-number\" class=\"form-label\">Car Number</label> <input type=\"text\" class=\"form-control\" id=\"car-number\" name=\"car_number\" required hx-get=\"/api/validate/car-number\" hx-trigger=\"change\" hx-target=\"#car-number-validation-error\" hx-swap=\"outerHTML\"><div class=\"invalid-feedback\" id=\"car-number-validation-error\"></div></div><div class=\"mb-3\"><label for=\"car-weight\" class=\"form-label\">Car Weight (oz)</label> <input type=\"number\" step=\"0.01\" class=\"form-control\" id=\"car-weight\" name=\"car_weight\" required></div><div class=\"mb-3\"><label for=\"group-id\" class=\"form-label\">Group</label> <select class=\"form-select\" id=\"group-id\" name=\"group_id\" required><option value=\"\">Select a group</option> ")
|
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
|
}
|
|
|
|
|
|