{# Label #}
{% include "objects/property_label.html" %}
{# Content #}
{% if search_query_attribute %}
{% set base_search_query_attribute = search_query_attribute %}
{% else %}
{% set base_search_query_attribute = "" %}
{% endif %}
{% set is_required = False %}
{% set minItems = schema.get('minItems', 0) %}
{% set maxItems = schema.get('maxItems', None) %}
{% if data is not none %}
{% set numItems = (data | length) %}
{% else %}
{% set numItems = 0 %}
{% endif %}
{% if data is not none %}
{% for item in data %}
{% endfor %}
{% endif %}
{% if schema['items']['type'] == 'object' %}
{% set item_property_names = schema["items"].properties.keys() %}
{% set property_order = schema.get('items', {}).get('propertyOrder', []) %}
{% for property_name in property_order %}
{% set hidden = False %}
{% set search_query_attribute = base_search_query_attribute + ".%s.%s" | format('?', property_name) %}
{% if property_name in item_property_names %}
{% if 'tooltip' in schema["items"].properties[property_name] %}
{% endif %}
{{ schema["items"].properties[property_name].title | get_translated_text }}
{% if 'tooltip' in schema["items"].properties[property_name] %}
{% endif %}
{% if schema["items"].properties[property_name].type == 'text' %}
{% elif schema["items"].properties[property_name].type == 'quantity' %}
{% if schema["items"].properties[property_name].units.strip() != '1' %}
{% else %}
{% endif %}
{% elif schema["items"].properties[property_name].type == 'bool' %}
{% else %}
{% endif %}
{% endif %}
{% endfor %}
{% for property_name in item_property_names %}
{% set hidden = False %}
{% set search_query_attribute = base_search_query_attribute + ".%s.%s" | format('?', property_name) %}
{% if property_name not in property_order %}
{% set search_query_attribute = base_search_query_attribute + ".%s.%s" | format('?', property_name) %}
{% if 'tooltip' in schema["items"].properties[property_name] %}
{% endif %}
{{ schema["items"].properties[property_name].title | get_translated_text }}
{% if 'tooltip' in schema["items"].properties[property_name] %}
{% endif %}
{% if schema["items"].properties[property_name].type == 'text' %}
{% elif schema["items"].properties[property_name].type == 'quantity' %}
{% if schema["items"].properties[property_name].units.strip() != '1' %}
{% else %}
{% endif %}
{% elif schema["items"].properties[property_name].type == 'bool' %}
{% else %}
{% endif %}
{% endif %}
{% endfor %}
{% if data is not none %}
{% for item in data %}
{% set name = "item" %}
{% set tmp_style = schema['style'] %}
{% set schema = schema['items'] %}
{% set id_prefix = id_prefix + '_{}_'.format(loop.index0) %}
{% set entry_index = loop.index0 %}
{% set data = item %}
{% for property_name in property_order %}
{% set hidden = False %}
{% if property_name in item_property_names %}
{% set name = property_name %}
{% set schema = schema.properties[property_name] %}
{% set z = schema.update({'parent_style': tmp_style}) %}
{% set parent_id_prefix = id_prefix %}
{% set id_prefix = id_prefix + '_' + name + '_' %}
{% if data is not none and property_name in data %}
{% set data = data[property_name] %}
{% else %}
{% set data = none %}
{% endif %}
{% set search_query_attribute = base_search_query_attribute + ".%d.%s" | format(entry_index, name) %}
{% if 'conditions' in schema %}
{% include "objects/inline_edit/inline_edit_any.html" %}
{% include "objects/forms/conditional_wrapper_script.html" %}
—
{% else %}
{% include "objects/inline_edit/inline_edit_any.html" %}
{% endif %}
{% endif %}
{% endfor %}
{% for property_name in item_property_names %}
{% set hidden = False %}
{% if property_name not in property_order %}
{% set name = property_name %}
{% set schema = schema.properties[property_name] %}
{% set z = schema.update({'parent_style': tmp_style}) %}
{% set parent_id_prefix = id_prefix %}
{% set id_prefix = id_prefix + '_' + name + '_' %}
{% if data is not none and property_name in data %}
{% set data = data[property_name] %}
{% else %}
{% set data = none %}
{% endif %}
{% set search_query_attribute = base_search_query_attribute + ".%d.%s" | format(entry_index, name) %}
{% if 'conditions' in schema %}
{% include "objects/inline_edit/inline_edit_any.html" %}
{% include "objects/forms/conditional_wrapper_script.html" %}
—
{% else %}
{% include "objects/inline_edit/inline_edit_any.html" %}
{% endif %}
{% endif %}
{% endfor %}
{% endfor %}
{% endif %}
{% for property_name in item_property_names %}
{% endfor %}
{% elif schema['items']['type'] == 'array' %}
{% set max_used_fields = 0 %}
{% if data is not none %}
{% set max_used_fields = [0] %}
{% for item in data %}
{% if (item | length) > max_used_fields[-1] %}
{% set tmp = max_used_fields.append(item | length) %}
{% endif %}
{% endfor %}
{% set max_used_fields = max_used_fields [-1] %}
{% for i in range(max_used_fields) %}
{{ _('Field %(index)s', index=(i+1)) }}
{% endfor %}
{% for item in data %}
{% set item_index = loop.index0 %}
{% for field in item %}
{% set name = "field_".format(loop.index0) %}
{% set tmp_style = schema['style'] %}
{% set schema = schema["items"]["items"] %}
{% set z = schema.update({'parent_style': tmp_style}) %}
{% set id_prefix = id_prefix + '_{}__{}_'.format(item_index, loop.index0) %}
{% set data = field %}
{% set entry_index = loop.index0 %}
{% set search_query_attribute = base_search_query_attribute + ".%d.%s" | format(entry_index, name) %}
{% include "objects/inline_edit/inline_edit_any.html" %}
{% endfor %}
{% if (item | length) < max_used_fields %}
{% for i in range((item | length), max_used_fields) %}
{% set name ="field_".format(loop.index0) %}
{% set tmp_style = schema['style'] %}
{% set schema = schema["items"]["items"] %}
{% set z = schema.update({'parent_style': tmp_style}) %}
{% set id_prefix = id_prefix + '_{}__{}_'.format(item_index, i) %}
{% set data = null %}
{% set search_query_attribute = base_search_query_attribute + ".%d.%s" | format(entry_index, name) %}
{% include "objects/forms/form_any.html" %}