{% if (print_labels is not defined or print_labels==true) %}
<label for="{{fieldinfo.name}}">{{fieldinfo.label|trans}} {% if fieldinfo.mandatory %}*{% endif %}</label>
{% endif %}
	
{% if fieldinfo.type.name == "picklist" %}
	<select name="record[{{fieldinfo.name}}]" id="{{fieldinfo.name}}" {% if fieldinfo.mandatory %}required{% endif %} >
		{% for option in fieldinfo.type.picklistValues %}
			<option value="{{option.value}}"  {% if record[fieldinfo.name] is defined and option.value == record[fieldinfo.name] %}selected="selected"{%endif%}>{{option.label}}</option>
		{% endfor %}
	</select>

{% elseif fieldinfo.type.name == "multipicklist" %}
	{% set multivals = record[fieldinfo.name] | split(' |##| ') %}
	<select name="record[{{fieldinfo.name}}][]" id="{{fieldinfo.name}}" {% if fieldinfo.mandatory %}required{% endif %} multiple >
		{% for option in fieldinfo.type.picklistValues %}
			<option value="{{option.value}}" {% if option.value in multivals %}selected="selected"{%endif%}>{{option.label}}</option>
		{% endfor %}
	</select>
	
{% elseif fieldinfo.type.name == "text" %}	
	<textarea id="{{fieldinfo.name}}" name="record[{{fieldinfo.name}}]" class="materialize-textarea" placeholder="{{fieldinfo.label|trans|raw}}" {% if fieldinfo.mandatory %}required{% endif %}>{% if record[fieldinfo.name] is defined %}{{record[fieldinfo.name]}}{% endif %}</textarea>
	
{% elseif fieldinfo.type.name == "string" %}
	<input id="{{fieldinfo.name}}" name="record[{{fieldinfo.name}}]" type="text" class="validate" placeholder="{{fieldinfo.label|trans|raw}}" {% if record[fieldinfo.name] is defined %}value="{{record[fieldinfo.name]}}"{% endif %} {% if fieldinfo.mandatory %}required{% endif %}>

{% elseif fieldinfo.type.name == "date" %}	
	 <input type="date" class="datepicker" id="{{fieldinfo.name}}" name="record[{{fieldinfo.name}}]" {% if fieldinfo.mandatory %}required{% endif %} {% if record[fieldinfo.name] is defined %}value="{{record[fieldinfo.name]}}"{% endif %} placeholder="{{fieldinfo.label|trans|raw}}">
	
{% elseif fieldinfo.type.name == "datetime" %}	
	 <input type="date" class="datepicker" id="{{fieldinfo.name}}" name="record[{{fieldinfo.name}}]" {% if fieldinfo.mandatory %}required{% endif %} {% if record[fieldinfo.name] is defined %}value="{{record[fieldinfo.name]}}"{% endif %} placeholder="{{fieldinfo.label|trans|raw}}">

{% elseif fieldinfo.type.name == "time" %}	
	 <input type="time" class="timepicker" id="{{fieldinfo.name}}" name="record[{{fieldinfo.name}}]" {% if fieldinfo.mandatory %}required{% endif %} {% if record[fieldinfo.name] is defined %}value="{{record[fieldinfo.name]}}"{% endif %}>
		 
	 

{% elseif fieldinfo.type.name == "double" or  fieldinfo.type.name == "integer" %}	
	 <input id="{{fieldinfo.name}}" name="record[{{fieldinfo.name}}]" type="number" class="validate" step="1" placeholder="{{fieldinfo.label|trans|raw}}" {% if fieldinfo.mandatory %}required{% endif %} {% if record[fieldinfo.name] is defined %}value="{{record[fieldinfo.name]}}"{% endif %}>

{% elseif fieldinfo.type.name == "boolean" %}	
	 <p>
      <input type="checkbox" class="filled-in" name="record[{{fieldinfo.name}}]" id="{{fieldinfo.name}}" {% if record[fieldinfo.name] is defined and record[fieldinfo.name] %}checked="checked"{% endif %} {% if fieldinfo.mandatory %}required{% endif %}/>
      <label for="{{fieldinfo.name}}">{{fieldinfo.name|trans|raw}}</label>
     </p>
     
{% elseif fieldinfo.type.name == "phone" %}	
	<input type="tel" name="record[{{fieldinfo.name}}]" id="{{fieldinfo.name}}" {% if fieldinfo.mandatory %}required{% endif %} {% if record[fieldinfo.name] is defined %}value="{{record[fieldinfo.name]}}"{% endif %}  placeholder="{{fieldinfo.label|trans|raw}}">
	
{% elseif fieldinfo.type.name == "url" %}	
	<input type="url" name="record[{{fieldinfo.name}}]" id="{{fieldinfo.name}}" {% if fieldinfo.mandatory %}required{% endif %} {% if record[fieldinfo.name] is defined %}value="{{record[fieldinfo.name]}}"{% endif %}  placeholder="{{fieldinfo.label|trans|raw}}">	
	
{% elseif fieldinfo.type.name == "email" %}
	<input type="email" name="record[{{fieldinfo.name}}]" id="{{fieldinfo.name}}" {% if fieldinfo.mandatory %}required{% endif %} {% if record[fieldinfo.name] is defined %}value="{{record[fieldinfo.name]}}"{% endif %}  placeholder="{{fieldinfo.label|trans|raw}}">	
{% elseif fieldinfo.type.name == "reference" %}
	<input type="text" readonly id="{{fieldinfo.name}}_label" {% if fieldinfo.mandatory %}required{% endif %} {% if record[fieldinfo.name] is defined %}value="{{record['processed_info'][fieldinfo.name]}}"{% endif %}  placeholder="{{fieldinfo.label|trans|raw}}">
	<input type="hidden" name="record[{{fieldinfo.name}}]" id="{{fieldinfo.name}}" {% if fieldinfo.mandatory %}required{% endif %} {% if record[fieldinfo.name] is defined %}value="{{record[fieldinfo.name]}}"{% endif %}>	
	{% for relmod in fieldinfo.type.refersTo %}
	
	{% if app.assigned_routes[relmod] is defined and app.modules[app.assigned_routes[relmod]] is defined and app.modules[app.assigned_routes[relmod]].enabled %}
	
	<a class="btn btn-small {{app.config.theme_basic_color}}" onclick="window.open('{{app.config.base_url}}/{{app.modules[app.assigned_routes[relmod]].route.route}}/popup/?field={{fieldinfo.name}}', '', 'width=700, height=600, status=no, menubar=no, toolbar=no');"><i class="material-icons left">{{app.modules[app.assigned_routes[relmod]].icon}}</i>{{"LBL_SELECT"|trans}} {{relmod|trans}}</a>&nbsp;
	
	{% endif %}
	
	{% endfor %}
	

{% else %}
	EDIT NOT AVAILABLE FOR THIS FIELD TYPE [{{fieldinfo.type.name}}]

{% endif %}


<script>
	if(typeof setRelatedFieldValueCustomer === "undefined") { 
		function setRelatedFieldValueCustomer(fieldname,recordid,label){
			$("#"+fieldname).val(recordid);
			$("#"+fieldname+"_label").val(label);
		}
	}
</script>

