{{define "company_form"}}
<h2>{{if .Company}}Edit company{{else}}New company{{end}}</h2>
<form hx-post="{{if .Company}}/companies/{{.CompanyID}}{{else}}/companies{{end}}" hx-target="#main">
  <p><label>Name<br><input name="name" value="{{with .Company}}{{.Name}}{{end}}" required></label></p>
  <p><label>Address<br><input name="address" value="{{with .Company}}{{.Address}}{{end}}"></label></p>
  <p><label>Email<br><input name="contact_email" value="{{with .Company}}{{.ContactEmail}}{{end}}"></label></p>
  <p><label>Phone<br><input name="contact_phone" value="{{with .Company}}{{.ContactPhone}}{{end}}"></label></p>
  <p><label>Hourly rate (DKK)<br><input name="hourly_rate" type="number" step="0.01" value="{{with .Company}}{{money .HourlyRate}}{{end}}"></label></p>
  <p>
    <button type="submit">Save</button>
    <button type="button" hx-get="/main?company_id={{.CompanyID}}" hx-target="#main">Cancel</button>
  </p>
</form>
{{end}}
