{% load custom_tags_and_filters %}
{% if "requests"|customization:"adjustment_requests_enabled" %}
{% with content_type=charge|content_type %}
{% url 'create_adjustment_request' content_type.id charge.id as create_adjustment_request %}
{% if not charge.validated %}
{% if not existing_adjustments or content_type.id not in existing_adjustments or charge.id not in existing_adjustments|get_item:content_type.id %}
{% if "requests"|customization:"charges_validation_enabled" == "enabled" %}
{% url 'validate_charge' content_type.id charge.id as validate_charge_url %}
{% button size="small" type="save" onclick="validate_charge('"|concat:validate_charge_url|concat:"', this)" value="Validate" icon="glyphicon-check" %}
{% endif %}
{% button size="small" type="warn" url=create_adjustment_request value="Request an adjustment" icon="glyphicon-flag" %}
{% else %}
{% button size="small" type="warn" url=create_adjustment_request value="Request an adjustment" icon="glyphicon-flag" disabled="true" %}
{% endif %}
{% endif %}
{% endwith %}
{% endif %}