{% extends get_form_property_template(schema, container_style) %}

{% block property_field %}
  {% include "objects/fields/quantity_field.html" %}
{% endblock %}

{% block property_errors %}
  {% if 'calculation' in schema %}
    <div class="has-warning">
      {% if 'units' in schema.calculation %}
        {% set unit = schema.calculation.units %}
      {% elif schema.units is string %}
        {% set unit = schema.units %}
      {% else %}
        {% set unit = schema.units[0] %}
      {% endif %}
      <span class="help-block" id="{{ id_prefix }}_calculation_help" style="display: none"><strong>{{ _('Calculated Value:') }}</strong> <span></span>&#8239;{{ unit | prettify_units }} ({{ _('Formula:') }} {{ schema.calculation.formula }}) <button type="button" class="btn btn-default btn-xs">{{ _('Apply') }}</button></span>
    </div>
  {% endif %}
  {{ super() }}
{% endblock %}