{% extends 'creme_core/bricks/base/paginated-table.html' %} {% load i18n creme_widgets creme_bricks %} {% load and_op format_amount has_perm_to print_field url from creme_core_tags %} {% block brick_extra_class %}{{block.super}} billing-cnotes-brick{% endblock %} {% block brick_header_title %} {% brick_header_title title=_('{count} Credit Note') plural=_('{count} Credit Notes') empty=_('Credit Notes') icon='invoice' %} {% endblock %} {% block brick_header_actions %} {% has_perm_to link object as link_perm %} {% brick_header_action id='link' url='billing__link_to_cnotes'|url:object.id label=_('Link to existing credit notes') enabled=link_perm %} {% endblock %} {% block brick_table_columns %} {% brick_table_column title='#' %} {% brick_table_column title=_('Name') status='primary' %} {% brick_table_column title=_('Number') class='cnotes-number' %} {% brick_table_column title=_('Status') class='cnotes-status' %} {% if 'comment' not in hidden_fields %} {% brick_table_column title=_('Comment') class='cnotes-comment' %} {% endif %} {% if 'issuing_date' not in hidden_fields %} {% brick_table_column title=_('Issuing date') data_type='date' class='cnotes-issuing-date' %} {% endif %} {% if 'expiration_date' not in hidden_fields %} {% brick_table_column title=_('Expiration date') data_type='date' class='cnotes-expiration-date' %} {% endif %} {% brick_table_column title=_('Total (exclusive of tax)') data_type='money' class='cnotes-total-no-vat' %} {% brick_table_column title=_('Total (inclusive of tax)') data_type='money' class='cnotes-total-vat' %} {% brick_table_column title=_('Action') status='action' %} {% endblock %} {% block brick_table_rows %} {% has_perm_to unlink object as unlink_perm %} {% for credit_note in page.object_list %}{% has_perm_to view credit_note as credit_note_view_perm %} {% if credit_note_view_perm %} {% has_perm_to change credit_note as credit_note_edit_perm %}{% has_perm_to unlink credit_note as credit_note_unlink_perm %} {{forloop.counter}} {% widget_entity_hyperlink credit_note user %} {{credit_note.number}} {{credit_note.status}} {% if 'comment' not in hidden_fields %}
{% if credit_note.comment %}

{{credit_note.comment|linebreaksbr}}

{% else %}{% endif %} {% brick_table_action id='edit' url='billing__edit_cnote_comment'|url:credit_note.id label=_('Edit this credit note') enabled=credit_note_edit_perm %}
{% endif %} {% if 'issuing_date' not in hidden_fields %} {% print_field object=credit_note field='issuing_date' %} {% endif %} {% if 'expiration_date' not in hidden_fields %} {% print_field object=credit_note field='expiration_date' %} {% endif %} -{{credit_note.total_no_vat|format_amount:credit_note.currency}} -{{credit_note.total_vat|format_amount:credit_note.currency}} {% url 'billing__delete_related_cnote' credit_note.id object.id as unlink_url %} {% brick_table_action id='delete' url=unlink_url __subject_id=object.id __type=rtype_id __object_id=credit_note.id label=_('Unlink this credit note') icon='unlink' enabled=unlink_perm|and_op:credit_note_unlink_perm %} {% else %} {{forloop.counter}} {% widget_entity_hyperlink credit_note user %} {% endif %} {% endfor %} {% endblock %} {% block brick_table_empty %} {% translate 'No related credit note for the moment' %} {% endblock %}