<%# locals: { f, field_values, readonly, field_label, field_properties, field_name, ttip } %>
<% field_label = field_label || 'No label defined' %>
<% ttip = nil %>
<div class="col-md-12">
    <%= f.label field_name, field_label, class: 'control-label' %>
</div>
<% if field_values && field_values.kind_of?(Array)  %>
    <% field_values.each_with_index do |value, idx| %>
        <% case field_properties["type"] %>
        <% when "string" %>
            <% if field_properties['format'].nil?%>
                <%= create_text_field(f, value, field_name, field_label, is_multiple: true, readonly: readonly, index: idx, ttip: ttip) %>
            <% elsif field_properties['format'] == 'date' %>
                <%= create_date_field(f, value, field_name, field_label, is_multiple: true, readonly: readonly, index: idx, ttip: ttip) %>
            <% elsif field_properties['format'] == 'uri' %>
                <%= create_url_field(f, value, field_name, field_label, is_multiple: true, readonly: readonly, index: idx, ttip: ttip) %>
            <% elsif field_properties['format'] == 'email' %>
                <%= create_email_field(f, value, field_name, field_label, is_multiple: true, readonly: readonly, index: idx, ttip: ttip) %>
            <%end%>
        <% when "integer" %>
            <%=  create_number_field(f, value, field_name, field_label,  is_multiple: true, readonly: readonly, index: idx)%>
        <% when "boolean" %>
            <%=  create_checkbox_field(f, value, field_name, field_label)%>
        <% end %>
    <% end %>
<% else%>
    <% case field_properties["type"] %>
    <% when "string" %>
        <% if field_properties['format'].nil?%>
            <%= create_text_field(f, nil, field_name, field_label, is_multiple: true, readonly: readonly, index: 0, ttip: ttip) %>
        <% elsif field_properties['format'] == 'date' %>
            <%= create_date_field(f, nil, field_name, field_label, is_multiple: true, readonly: readonly, index: 0, ttip: ttip) %>
        <% elsif field_properties['format'] == 'uri' %>
            <%= create_url_field(f, nil, field_name, field_label, is_multiple: true, readonly: readonly, index: 0, ttip: ttip) %>
        <% elsif field_properties['format'] == 'email' %>
            <%= create_email_field(f, nil, field_name, field_label, is_multiple: true, readonly: readonly, index: 0, ttip: ttip) %>
        <%end%>
    <% when "integer" %>
        <%=  create_number_field(f, nil, field_name, field_label,  is_multiple: true, readonly: readonly, index: 0)%>
    <% when "boolean" %>
        <%=  create_checkbox_field(f, nil, field_name, field_label)%>
    <% end %>
<% end %>