{{ define "content" }}

<div class="container">

  {{$update := .Options.Get "update"}}

  {{if $update}}
  {{template "breadcrumb" toSlice "Operatori" (all "Operator") (.Data|string) (.Data.ID|show "Operator") "Aggiorna" "current"}}
  {{else}}
  {{template "breadcrumb" toSlice "Operatori" (all "Operator") "Aggiungi" "current"}}
  {{end}}
  
  {{template "add_update_header" dict "update" $update "addTitle" "Crea nuovo operatore" "updateTitle" (printf "Aggiorna operatore %s" (.Data|string))}}

  {{$form := "form_operators_add_update"}}
  <form
    class="needs-validation"
    action="{{if $update}}{{.Data.ID|update "Operator"}}{{else}}{{create "Operator"}}{{end}}"
    method="POST"
    role="form"
    id={{$form}}>

    {{$options := ` { name: "Firstname",id: "operator_firstname",label: "Nome",placeholder: "Nome ",type: "text"} `}}
    {{template "input" dict "options" ($options|yaml) "value" (.Data|field "Firstname") "update" $update}}

    {{$options := ` { name: "Lastname",id: "operator_lastname",label: "Cognome",placeholder: "Cognome",type: "text"} `}}
    {{template "input" dict "options" ($options|yaml) "value" (.Data|field "Lastname") "update" $update}}

    {{$options := ` { name: "Email",id: "operator_email",label: "Email",placeholder: "Email",type: "text"} `}}
    {{template "input" dict "options" ($options|yaml) "value" (.Data|field "Email") "update" $update}}

    {{$options := ` { name: "Description",id: "operator_description",label: "Descrizione",placeholder: "Descrizione",type: "text"} `}}
    {{template "input" dict "options" ($options|yaml) "value" (.Data|field "Description") "update" $update}}

    {{ $options := ` { cancelTitle: "Annulla", saveTitle: "Salva", model: "Student"} ` }}
    {{template "submit_cancel_buttons" dict "options" ($options|yaml) "id" (.Data|field "ID") "update" $update}}  
  </form>
  
</div>

{{ end }}
