<form class="field-form">
	<input type="hidden" name="unique" value="{{ unique }}" />
	<input type="hidden" name="nonce" value="{{ nonce }}" />
	<input type="hidden" name="object" value="{{ item.json|default("") }}" />
	<input type="hidden" name="position" value="{{ item.position|default(position) }}" />
	<input type="hidden" name="taxonomy" value="{{ item.taxonomy|default(taxonomy) }}" />
	<input type="hidden" name="ID" value="{{ item.ID|default(0) }}" />

	<table class="tef-form" id="form-field">

		<thead>

		</thead>
		<tbody>
			<tr>
				<th><label for="label">{{ translation.label|default('Label') }}<span class="required">*</span></label></th>
				<td><input type="text" name="label" placeholder="" value="{{ item.label|default("") }}" required="required"></td>
			</tr>
			<tr>
				<th><label for="name">{{ translation.name|default('Name') }}<span class="required">*</span></label></th>
				<td>
					<input type="text" name="name" placeholder="" value="{{ item.name|default("") }}" required="required"  pattern=".{3,250}" {% if(item.name|default(0)) %} readonly="readonly" {% endif %}>
					<a class="unlock-field"><i class="fa fa-unlock-alt"></i> {{ translation.unlock|default('Unlock') }}</a>
				</td>
			</tr>
			<tr>
				<th><label for="type">{{ translation.type|default('Type') }}<span class="required">*</span></label></th>
				<td>
					<select name="type" required="required">
						<option value="">{{ translation.select_option|default('Select an option') }}</option>
						{% for key, field_type in field_types %}
							<option value="{{ key }}" {% if item.type == key %} selected="selected" {% endif %}>{{ field_type.name }}</option>
						{% endfor %}
					</select>
				</td>
			</tr>
			<tr>
				<th><label for="description">{{ translation.description|default('Description') }}</label></th>
				<td><textarea name="description">{{ item.description|default("") }}</textarea></td>
			</tr>
			<tr>
				<th><label for="required">{{ translation.required|default('Required') }}</label></th>
				<td><input type="checkbox" name="required" {% if item.required|default(0) %} checked="checked" {% endif %}></td>
			</tr>


			<tr class="{% if item.type not in ["select","radio","checkbox"] %}no-display{% endif %}" data-for="select radio checkbox">
				<th><label for="option[options]">{{ translation.options|default('Options list') }}</label></th>
				<td class="options_list">
					<div class="options">
						{% if not item.options.options is empty %}
							{% for key, value in item.options.options %}

								<div class="option">
									<input type="text" name="options[options][keys][]" value="{% if item.options.split|default(0) %}{{ key }}{% endif %}" placeholder="{{  translation.placeholder.key|default('Key') }}" class="key {% if not item.options.split|default(0) %}no-display{% endif %}">
									<input type="text" name="options[options][values][]" value="{{ value }}" placeholder="{{ translation.placeholder.value|default('Value') }}" class="value">
								</div>
							{% endfor %}
						{%  endif %}
						<div class="option">
							<input type="text" name="options[options][keys][]" placeholder="{{  translation.placeholder.key|default('Key') }}" class="key {% if not item.options.split|default(0) %}no-display{% endif %}">
							<input type="text" name="options[options][values][]" placeholder="{{ translation.placeholder.value|default('Value') }}" class="value">
						</div>
					</div>
					<hr>
					<div>
						<label><input type="checkbox" class="split_options" name="options[split]" {% if item.options.split|default(0) %} checked="checked" {% endif %}> {{ translation.split|default('Split Key/Value') }}</label>
					</div>
				</td>
			</tr>


			<tr>
				<th><label for="required">{{ translation.placeholder|default('Placeholder') }}</label></th>
				<td>
					<div>
						<input type="text" name="options[placeholder]">
					</div>
				</td>
			</tr>

			<tr>
				<th><label for="required">{{ translation.default|default('Defaul value') }}</label></th>
				<td>
					<input type="text" name="options[default]">
					<p class="description">{{ translation.empty_for_none|default('Empty for no value') }}</p>
				</td>
			</tr>

			<tr>
				<th></th>
				<td class="actions">
					<button type="submit" name="save" class="button button-primary button-large" disabled="disabled"><i class="fa fa-floppy-o" aria-hidden="true"></i> {{ translation.save|default('Save') }}</button>
					<button type="button" name="cancel" class="button">{{ translation.cancel|default('Cancel') }}</button>
				</td>
			</tr>
		</tbody>
		<tfoot>

		</tfoot>
	</table>
</form>
