<div class="form">
    {{#unless model.person.IsEditable}}
    <div class="dialogInfo">{{icon 'info'}} {{translate 'personReadOnlyInfo'}}</div>
    {{/unless}}
    {{#unless isPersonComplete}}
    <div class="row">
        <div class="col12">
            <div class="dialogInfo">
                {{icon 'info'}}
                {{translate 'firstTimePersonEdit'}}
            </div>
        </div>
    </div>
    {{/unless}}

    {{#if showValidationErrorMessage}}
    <div class="row">
        <div class="col12">
            <pre class="validationErrorMessage" style="display: none;">{{validationErrorMessage}}</pre>
        </div>
    </div>
    {{/if}}

    <div class="row">
        <div class="col4">
            {{form-control fieldname="FirstName" value=model.person.FirstName label=(translate 'firstName') requiredFields=model.person.RequiredFields disabled=allDisabled }}
        </div>

        <div class="col4">
            {{form-control fieldname="LastName" value=model.person.LastName label=(translate 'lastName') requiredFields=model.person.RequiredFields disabled=allDisabled}}
        </div>

        <div class="col4">
            {{form-control fieldname="MiddleName" value=model.person.MiddleName label=(translate 'middleName') requiredFields=model.person.RequiredFields disabled=allDisabled }}
        </div>

        <div class="col4">
            {{form-control type="select" content=model.formsOfAddress optionValuePath="Key" optionLabelPath="Value" fieldname="FormOfAddress_Id" value=formOfAddress label=(translate 'formOfAddress') requiredFields=model.person.RequiredFields disabled=allDisabled}}
        </div>

        <div class="col4">
            {{form-control type="date" fieldname="Birthdate" value=model.person.Birthdate label=(translate 'birthdate') requiredFields=model.person.RequiredFields disabled=allDisabled hideButton=allDisabled yearRange='-100:-16'}}
        </div>

        <div class="col4">
            {{form-control type="select" content=model.statisticCountries optionValuePath="Key" optionLabelPath="Value" fieldname="HomeCountry_IDLFS" value=model.person.HomeCountry_IDLFS label=(translate 'homeCountry') requiredFields=model.person.RequiredFields disabled=allDisabled}}
        </div>

        <div class="col4">
            {{form-control fieldname="MatriculationNumber" value=model.person.MatriculationNumber label=(translate 'matriculationNumber') requiredFields=model.person.RequiredFields tooltip=(translate 'tooltipMatriculationNumber') disabled=allDisabled mask='99-999-999' placeholder='__-___-__'}}
        </div>

        <div class="col4">
            {{form-control fieldname="SocialSecurityNumber" value=model.person.SocialSecurityNumber label=(translate 'socialSecurityNumberEx') requiredFields=model.person.RequiredFields disabled=allDisabled mask="756.9999.9999.99" placeholder='756.____.____.__'}}
        </div>

        <div class="col4">
            {{form-control type="select" content=model.languages optionValuePath="Key" optionLabelPath="Value" fieldname="NativeLanguage" value=model.person.NativeLanguage label=(translate 'nativeLanguage') requiredFields=model.person.RequiredFields disabled=allDisabled}}
        </div>
        <div class="col4">
            {{form-control type="select" content=model.nationalities fieldname="Nationality_IDLFS" value=nationality label=(translate 'nationality') optionValuePath="Key" optionLabelPath="Value" requiredFields=model.person.RequiredFields disabled=allDisabled}}
        </div>
        {{#if isSwiss}}
        <div class="col4">
            {{form-control fieldname="HomeTown" value=model.person.HomeTown label=(translate 'homeTownEx') requiredFields=model.person.RequiredFields disabled=allDisabled tooltip=(translate 'homeTownToolTip')}}
        </div>
        {{/if}}
        {{#unless isSwiss}}
        <div class="col4">
            {{form-control type="select" content=model.stayPermits fieldname="StayPermit" value=model.person.StayPermit label=(translate 'stayPermitEx') optionValuePath="Key" optionLabelPath="Value" requiredFields=model.person.RequiredFields tooltip=(translate 'tooltipStayPermit') disabled=allDisabled}}
        </div>
        {{#if hasStayPermit}}
        <div class="col4">
            {{form-control type="date" fieldname="StayPermitExpiry" value=model.person.StayPermitExpiry label=(translate 'stayPermitExpiryEx') optionValuePath="Key" optionLabelPath="Value" requiredFields=model.person.RequiredFields disabled=allDisabled hideButton=allDisabled yearRange='+0:+20'}}
        </div>
        {{/if}}
        {{/unless}}
    </div>

    <div class="row">
        <h4 class="rowTitle">{{translate 'homeAddress'}}</h4>

        <div class="col6">
            {{form-control fieldname="AddressLine1" value=model.person.AddressLine1 label=(translate 'streetAndNumber') requiredFields=model.person.RequiredFields disabled=allDisabled}}
        </div>

        <div class="col6">
            {{form-control fieldname="AddressLine2" value=model.person.AddressLine2 label=(translate 'careOfPostBox') requiredFields=model.person.RequiredFields disabled=allDisabled}}
        </div>

        <div class="col2">
            {{form-control fieldname="Zip" value=model.person.Zip label=(translate 'zip') requiredFields=model.person.RequiredFields disabled=allDisabled}}
        </div>

        <div class="col4">
            {{form-control fieldname="Location" value=model.person.Location label=(translate 'location') requiredFields=model.person.RequiredFields disabled=allDisabled}}
        </div>

        <div class="col6">
            {{form-control type="select" content=model.countries optionValuePath="Key" optionLabelPath="Value" fieldname="Country_Id" value=model.person.Country_Id label=(translate 'country') requiredFields=model.person.RequiredFields disabled=allDisabled}}
        </div>
    </div>

    <div class="row">
        <h4 class="rowTitle">{{translate 'availability'}}</h4>
        <div class="col4">
            {{#if model.person.Email}}
            {{form-control fieldname="Email" label=(translate 'email') value=model.person.Email requiredFields=model.person.RequiredFields disabled="disabled" }}
            {{else}}
            {{form-control fieldname="Email2" label=(translate 'email') value=model.person.Email2 requiredFields=model.person.RequiredFields disabled="disabled" }}
            {{/if}}
        </div>
        <div class="col4">
            {{form-control fieldname="PhonePrivate" label=(translate 'privatePhoneEx') value=model.person.PhonePrivate requiredFields=model.person.RequiredFields }}
        </div>
        <div class="col4">
            {{form-control fieldname="PhoneMobile" label=(translate 'mobilePhoneEx') value=model.person.PhoneMobile requiredFields=model.person.RequiredFields }}
        </div>
    </div>

    <div class="row">
        <div class="col1">
            <div class="dialogInfo">
                {{translate 'privacyProtectionNoteToolTip'}}
            </div>
        </div>
    </div>

    <div class="row">
        <div class="col12">
            <div class="formControl">

                {{#if enableSave}}
                <button id="buttonSave" class="textButton" type="button" {{action 'save'}}>
                    {{#if isWorking}}
                    {{icon 'loadingAnimation'}}
                    {{else}}
                    {{icon 'save'}}
                    {{/if}}
                    <div>{{translate 'save'}}</div>
                </button>
                {{else}}
                <button id="buttonSave" class="textButton error" type="button" disabled="disabled">
                    {{icon 'error'}}
                    <div>{{translate 'save'}}</div>
                </button>
                {{/if}}
                {{#if isPersonComplete}}
                <button class="textButton" type="button" {{action 'cancel'}}>
                    {{icon 'close'}}
                    <div>{{translate 'cancel'}}</div>
                </button>
                {{else}}
                <button class="textButton" type="button" {{action 'cancel'}} disabled="disabled">
                    {{icon 'close'}}
                    <div>{{translate 'cancel'}}</div>
                </button>
                {{/if}}
            </div>
        </div>
    </div>
</div>