<script type="text/html" id="vcl-loop-frame">
    <div class="vc_row">
        <div class="vc_col-sm-12">
            <# if(vc.loop_field_not_hidden('post_type', loop)) { #>
                <label class="wpb_element_label"><span><?php esc_html_e('Post types', 'uncode') ?><span class="toggle-description"></span><small class="description clear"><?php esc_html_e('Select post types to populate posts from. Note: If no post type is selected, WordPress will use default "Post" value.', 'uncode'); ?></small></span></label>

                <div class="post-types-list">
                    {{{ vc.loop_partial('checkboxes', 'post_type', loop) }}}
                </div>
                <# } #>
        </div>
    </div>
    <# if(vc.loop_field_not_hidden('size', loop)) { #>
	    <div class="vc_row">
	            <div class="vc_col-sm-12">
	                <label class="wpb_element_label"><span><?php esc_html_e('Post count', 'uncode') ?><span class="toggle-description"></span><small class="description clear"><?php esc_html_e('Set the number of elements or use "All".', 'uncode'); ?></small></span></label>
	                <div class="edit_form_line">
		                {{{ vc.loop_partial('text-input', 'size', loop) }}}
		            </div>
	            </div>
	    </div>
    <# } #>
    <# if(vc.loop_field_not_hidden('order_by', loop)) { #>
	    <div class="vc_row">
            <div class="vc_col-sm-12">
                <label class="wpb_element_label"><span><?php esc_html_e('Order by', 'uncode') ?><span class="toggle-description"></span><small class="description clear"><?php echo sprintf(__('Select how to sort retrieved posts. More at %s.', 'uncode'), '<a href="http://codex.wordpress.org/Class_Reference/WP_Query#Order_.26_Orderby_Parameters" target="_blank">
	                    WordPress codex page</a>'); ?></small></span></label>
                <div class="edit_form_line">
	                {{{ vc.loop_partial('dropdown', 'order_by', loop) }}}
	            </div>
            </div>
	    </div>
    <# } #>
	<# if(vc.loop_field_not_hidden('meta_key', loop)) { #>
		<div class="vc_row vc_row--meta_key vc_row--meta_key-field">
			<div class="vc_col-sm-12">
				<label class="wpb_element_label"><span><?php esc_html_e('Meta Key', 'uncode') ?><span class="toggle-description"></span><small class="description clear"><?php esc_html_e('Meta key to filter by.', 'uncode-core'); ?></small></span></label>
				<div class="edit_form_line">
					{{{ vc.loop_partial('text-input', 'meta_key', loop) }}}
				</div>
			</div>
		</div>
	<# } #>
    <# if(vc.loop_field_not_hidden('order', loop)) { #>
	    <div class="vc_row">
            <div class="vc_col-sm-12">
                <label class="wpb_element_label"><span><?php esc_html_e('Sort order', 'uncode') ?><span class="toggle-description"></span><small class="description clear"><?php esc_html_e('Designates the ascending or descending order.', 'uncode'); ?></small></span></label>
                <div class="edit_form_line">
		            {{{ vc.loop_partial('dropdown', 'order', loop) }}}
	            </div>
            </div>
	    </div>
    <# } #>

    <# if(vc.loop_field_not_hidden('categories', loop)) { #>
        <div class="vc_row">
            <div class="vc_col-sm-12">
                <div class="vc_suggest-field" data-block="suggestion">
                    <label class="wpb_element_label"><span><?php esc_html_e('Categories', 'uncode') ?><span class="toggle-description"></span><small class="description clear"><?php esc_html_e('Filter output by posts categories, enter category names here.', 'uncode'); ?></small></span></label>
	                <div class="edit_form_line">
	                    {{{ vc.loop_partial('autosuggest', 'categories', loop) }}}
	                </div>
                </div>
            </div>
        </div>
    <# } #>
    <# if(vc.loop_field_not_hidden('tags', loop)) { #>
        <div class="vc_row">
            <div class="vc_col-sm-12">
                <div class="vc_suggest-field" data-block="suggestion">
                    <label class="wpb_element_label"><span><?php esc_html_e('Tags', 'uncode') ?><span class="toggle-description"></span><small class="description clear"><?php esc_html_e('Filter output by posts tags, enter tag names here.', 'uncode'); ?></small></span></label>
	                <div class="edit_form_line">
                        {{{ vc.loop_partial('autosuggest', 'tags', loop) }}}
                    </div>
                </div>
            </div>
        </div>
    <# } #>
    <# if(vc.loop_field_not_hidden('tax_query', loop)) { #>
        <div class="vc_row">
            <div class="vc_col-sm-12">
                <div class="vc_suggest-field" data-block="suggestion">
                    <label class="wpb_element_label"><span><?php esc_html_e('Taxonomies (Post Types)', 'uncode') ?><span class="toggle-description"></span><small class="description clear"><?php esc_html_e('Used to filter Products, Pages or Portfolio. Filter output by custom taxonomies categories, enter category names here.', 'uncode'); ?></small></span></label>
	                <div class="edit_form_line">
                        {{{ vc.loop_partial('autosuggest', 'tax_query', loop) }}}
                    </div>
                </div>
            </div>
        </div>
    <# } #>
	<# if(vc.loop_field_not_hidden('by_id', loop)) { #>
	    <div class="vc_row">
	        <div class="vc_col-sm-12">
	            <div class="vc_suggest-field" data-block="suggestion">
	                <label class="wpb_element_label"><span><?php esc_html_e('Selective Elements', 'uncode') ?><span class="toggle-description"></span><small class="description clear"><?php esc_html_e('Only entered posts/pages will be included or excluded in the output. Note: Works in conjunction with selected "Post types".', 'uncode'); ?></small></span></label>
	                <div class="edit_form_line">
	                    {{{ vc.loop_partial('autosuggest', 'by_id', loop) }}}
	                </div>
	            </div>
	        </div>
	    </div>
	<# } #>
	<# if(vc.loop_field_not_hidden('authors', loop)) { #>
	    <div class="vc_row">
	        <div class="vc_col-sm-12">
	            <div class="vc_suggest-field" data-block="suggestion">
	                <label class="wpb_element_label"><span><?php esc_html_e('Author', 'uncode') ?><span class="toggle-description"></span><small class="description clear"><?php esc_html_e('Filter by author name.', 'uncode'); ?></small></span></label>
	                <div class="edit_form_line">
	                    {{{ vc.loop_partial('autosuggest', 'authors', loop) }}}
	                </div>
	            </div>
	        </div>
	    </div>
	<# } #>
	<?php do_action( 'uncode_vc_loop_settings' ); ?>
	<script type="text/javascript">
		jQuery(document).trigger('vc.display.template');
	</script>
</script>
<script type="text/html" id="_vcl-text-input">
    <#
            var is_locked = vc.is_locked(data),
            disabled = is_locked  ? ' disabled="true"' : '',
            value = _.isObject(data) && !_.isUndefined(data.value) ? data.value : '';
            #>
        <input type="text" name="{{ name }}" value="{{ value }}" class="vc_{{ name }}_field" {{ disabled }}>
</script>
<script type="text/html" id="_vcl-dropdown">
    <#
            var is_locked = vc.is_locked(data),
            disabled = is_locked  ? ' disabled="true"' : '';
            #>
        <select name="{{ name }}" class="vc_dropdown" {{ disabled }}>
            <option value=""></option>
            <# if(_.isObject(data) && _.isArray(data.options)) { #>
                <#
                        _.each(data.options, function(opt) {
                        var value, label;
                        if(_.isArray(opt)) {
                        value = opt[0];
                        label = opt[1];
                        } else {
                        value = opt;
                        label = opt;
                        }#>
                    <option value="{{ value }}"
                            {{ data.value===value ?
                    ' selected="true"' : '' }}>{{ label }}</option>
                    <#
                            });
                            #>
                        <# } #>
        </select>
</script>
<script type="text/html" id="_vcl-checkboxes">
    <#
            var is_locked = vc.is_locked(data);
            #>
        <input type="hidden" name="{{ name }}" value="{{ data.value }}" data-name="{{ name }}">
        <# if(_.isObject(data) && _.isArray(data.options)) {
                _.each(data.options, function(opt) {
                var value, label, params;
                if(_.isArray(opt)) {
                value = opt[0];
                label = opt[1];
                } else {
                value = opt;
                label = opt;
                }
                params = _.indexOf(data.value, value) >=0 ? ' checked="true"' : '';
            if(!_.isEmpty(params) && is_locked) {
				params += ' disabled="true"';
			}
            if ( value !== 'uncodeblock' && value !== 'uncode_gallery' ) {
            #>
            <label><input type="checkbox" data-input="{{ name }}" value="{{ value }}" {{ params }}/> {{ label }}</label>
            <#
	        }
                    });
                    } #>
</script>
<script type="text/html" id="_vcl-autosuggest">
    <# limit_param = _.isObject(settings) && !_.isUndefined(settings.limit) ? ' data-limit="' + settings.limit + '"' : ''; #>
        <input type="hidden" data-suggest-prefill="{{ name }}"
               value="{{ _.isObject(data) && _.isArray(data.options) ? window.encodeURIComponent(JSON.stringify(data.options)) : '' }}">
        <input type="hidden" name="{{ name }}"
               value="{{ _.isObject(data) && _.isArray(data.value) ? data.value.join(',') : '' }}"
               data-suggest-value="{{ name }}">
        <input type="text" name="{{ name }}_autosuggest" value=""
               placeholder="<?php esc_html_e('Click here and start typing...', 'uncode'); ?>" class="vc_{{ name }}_field"
               data-suggest="{{ name }}" {{ limit_param }}/>
</script>
