{namespace neos=Neos\Neos\ViewHelpers}
<div class="neos-row neos-module-container">
	<fieldset class="neos-span12">
		<f:form.hidden property="site" value="{f:if(condition: domain.site, then: domain.site, else: site)}" />
		<legend>{neos:backend.translate(id: 'domainform.domainData', value: 'Domain data', source: 'Modules')}</legend>

		<div class="neos-row">
			<div class="neos-span2">
				<div class="neos-control-group{f:validation.ifHasErrors(for: 'domain.scheme', then: ' neos-error')}">
					<label class="neos-control-label" for="scheme">{neos:backend.translate(id: 'scheme', value: 'Scheme')}</label>
					<div class="neos-controls">
						<f:form.select property="scheme" value="{domain.scheme}" id="scheme" options="{schemes}" class="neos-span2" />
						<f:render partial="Module/Shared/FieldValidationResults" arguments="{fieldname: 'domain.scheme'}"/>
					</div>
				</div>
			</div>
			<div class="neos-span6">
				<f:validation.results for="domain">
					<f:if condition="{validationResults.errors}">
						<f:then>
							<div class="neos-control-group neos-error">
								<label class="neos-control-label" for="host">{neos:backend.translate(id: 'host', value: 'Host')}</label>
								<div class="neos-controls">
									<f:form.textfield property="hostname" value="{domain.hostname}" id="host" class="neos-span6" placeholder="{neos:backend.translate(id: 'domainform.hostPlaceholder', value: 'e.g. www.neos.io', source: 'Modules')}" />
									<ul class="errors">
										<f:for each="{validationResults.errors}" as="error">
											<li><span class="neos-help-block">{error}</span></li>
										</f:for>
									</ul>
								</div>
							</div>
						</f:then>
						<f:else>
							<div class="neos-control-group{f:validation.ifHasErrors(for: 'domain.hostname', then: ' neos-error')}">
								<label class="neos-control-label" for="host">{neos:backend.translate(id: 'host', value: 'Host')}</label>
								<div class="neos-controls">
									<f:form.textfield property="hostname" value="{domain.hostname}" id="host" class="neos-span6" placeholder="{neos:backend.translate(id: 'domainform.hostPlaceholder', value: 'e.g. www.neos.io', source: 'Modules')}" />
									<f:render partial="Module/Shared/FieldValidationResults" arguments="{fieldname: 'domain.hostname'}"/>
								</div>
							</div>
						</f:else>
					</f:if>
				</f:validation.results>
			</div>
			<div class="neos-span4">
				<div class="neos-control-group{f:validation.ifHasErrors(for: 'domain.port', then: ' neos-error')}">
					<label class="neos-control-label" for="port">{neos:backend.translate(id: 'port', value: 'Port')}</label>
					<div class="neos-controls">
						<f:form.textfield property="port" value="{domain.port}" id="port" class="neos-span2" placeholder="{neos:backend.translate(id: 'domainform.portPlaceholder', value: '0-49151')}" />
						<f:render partial="Module/Shared/FieldValidationResults" arguments="{fieldname: 'domain.port'}"/>
					</div>
				</div>
			</div>
		</div>
		<div class="neos-control-group">
			<label class="neos-control-label" for="active">{neos:backend.translate(id: 'domainform.state', value: 'State', source: 'Modules')}</label>
			<div class="neos-controls">
				<label class="neos-radio neos-inline">
					<f:if condition="{domain}">
						<f:then><f:form.radio property="active" value="1" id="active" checked="{f:if(condition: domain.active, then: 'checked')}"/></f:then>
						<f:else><f:form.radio property="active" value="1" id="active" checked="checked" /></f:else>
					</f:if>
					<span></span>
					{neos:backend.translate(id: 'active', value: 'Active')}
				</label>
				<label class="neos-radio neos-inline">
					<f:form.radio property="active" value="0" /><span></span>
					{neos:backend.translate(id: 'inactive', value: 'Inactive')}
				</label>
			</div>
		</div>
	</fieldset>
</div>
<div class="neos-footer">
	<f:link.action action="edit" arguments="{site: '{f:if(condition: domain.site, then: domain.site, else: site)}'}" class="neos-button">{neos:backend.translate(id: 'cancel', value: 'Cancel')}</f:link.action>
	<f:form.submit value="{f:if(condition: saveText, then: saveText, else: '{neos:backend.translate(id: \'save\', value: \'Save\')}')}" class="neos-button neos-button-primary" />
</div>
