{% macro input(id, name='', value='', type='text', size='', readonly='', required='', placeholder='', autofocus='', title='', class='form-control', style='') -%}
	{% if name == '' %}
		{% set name = id %}
	{% endif %}
	{# {% if readonly == '' %}
		{% set readonly = 'readonly  onfocus=this.removeAttribute(\'readonly\');' %}
	{% endif %} #}
    <input type="{{ type }}" name="{{name}}" value="{{ value|e }}" id="{{ id }}" data-help="{{title}}" size="{{size}}" style="{{style}}" {{readonly}} {{required}} {{autofocus}} placeholder="{{placeholder}}" title="{{title}}" class="{{class}}" autocomplete="off" />
{%- endmacro %}

{%- macro checkbox(id, name='', checked='', title='', value='', desc='', disabled='', style='') -%}
	{% if name == '' %}
		{% set name = id %}
	{% endif %}
	{% if disabled == 'true' %}
		{% set disabled = 'disabled' %}
	{% endif %}
	<label for="{{id}}" title="{{title}}" class="{{id}}" style="{{style}}" data-help="{{title}}">{{desc}}</label><input name="{{name}}" type="checkbox" id="{{id}}" value="{{value|e}}" {{checked}} {{disabled}} />
{%- endmacro %}

{%- macro select(id, values, name='', required='', first='', class='', selected='', title='', disabled='true') -%}
	{% if name == '' %}
		{% set name = id %}
	{% endif %}
	{% if disabled == 'true' %}
		{% set disabled = 'disabled' %}
	{% else %}
		{% set disabled = '' %}
	{% endif %}
	<select {{required}} name="{{name}}" id="{{id}}" title="{{title}}" data-help="{{title}}" class="{{class}}">
		{% if first %}
			<option {{disabled}} selected>{{first}}</option>
		{% endif %}
		{% for v, des in values.items() %}
			{% if v == selected|string() %}
				<option value="{{v}}" selected>{{des}}</option>
			{% else %}
				<option value="{{v}}">{{des}}</option>
			{% endif %}
		{% endfor %}
	</select>
{%- endmacro %}

{%- macro copy_to_clipboard(id='', value='', show='', style='', class='') -%}
	{% if show == '' %}
		{% set show = value %}
	{% endif %}
	<span id="{{id}}" style="{{style}}" class="copyToClipboard {{class}}" data-copy="{{value}}" title="Copy {{value}} to clipboard">{{show}}</span>
{%- endmacro %}
