billwerk_subscriptions-1.x-dev/modules/billwerk_subscriptions_manage/templates/billwerk-order.html.twig
modules/billwerk_subscriptions_manage/templates/billwerk-order.html.twig
{# See billwerk_subscriptions_manage.module for available variables. #}
<div class="billwerk-order">
<h2>
<span class="billwerk-order__plan-variant-name">{{ planVariantName }}</span>
</h2>
<div class="billwerk-order__lineitems">
{% if lineitems is not empty %}
<table class="billwerk-order__lineitems-table" border="1">
<thead>
<tr>
<th>{{ "Line item"|t }}</th>
<th>{{ "Unit price"|t }}</th>
<th>{{ "Quantity"|t }}</th>
<th>{{ "Period"|t }}</th>
<th>{{ "Net"|t }}</th>
<th>{{ "VAT"|t }}</th>
<th>{{ "Gross"|t }}</th>
</tr>
</thead>
<tbody>
{% for lineitem in lineitems %}
<tr>
<td class="billwerk-order-lineitem">
<strong class="label">{{ lineitem.Description }}</strong>
<div class="billwerk-order-lineitem__product-description">{{ lineitem.ProductDescription }}</div>
</td>
<td class="billwerk-order-lineitem__price-per-unit">
{{ lineitem.PricePerUnitFormatted }}
</td>
<td class="billwerk-order-lineitem__quantity">{{ lineitem.QuantityFormatted }}</td>
{#
Ugly date format workaround needed because:
- Core bug makes twig_intl impossible to use: https://www.drupal.org/project/drupal/issues/3419294
- Billwerk doesn't use timestamps, but Drupal does.
So we need to convert the Billwerk format to timestamp and can then use Drupal's format_date()
#}
<td class="billwerk-order-lineitem__period">{{ lineitem.PeriodStart|date('U')|format_date('short') }}
<br>-<br>
{{ lineitem.PeriodEnd|date('U')|format_date('short') }}</td>
<td class="billwerk-order-lineitem__total-net">
{{ lineitem.TotalNetFormatted }}
</td>
<td class="billwerk-order-lineitem__total-vat">
{{ lineitem.TotalVatFormatted }}<br/>
({{ lineitem.VatPercentage }}
%)
</td>
<td class="billwerk-order-lineitem__total-gross">
{{ lineitem.TotalGrossFormatted }}
</td>
</tr>
{% endfor %}
</tbody>
<tfoot>
<tr>
<th colspan="4" class="billwerk-order__sum">
{{ "Sum"|t }}
</th>
<th class="billwerk-order__total">{{ totalFormatted }}</th>
<th class="billwerk-order__total-vat">{{ totalVatFormatted }}</th>
<th class="billwerk-order__total-gross">{{ totalGrossFormatted }}</th>
</tr>
{% if not displayOptions.hideSubsequentBilling and nextTotalGross is not empty %}
<tr class="tr-separator"></tr>
<tr class="billwerk-order__subsequent-billing">
<td colspan="6" class="billwerk-order__next-total-gross-label">
{{ "Subsequent billing"|t }}
<span class="nextTotalGrossDate">({{ nextTotalGrossDate|date('U')|format_date('short') }})</span>:
</td>
<td class="billwerk-order__next-total-gross">
{{ nextTotalGrossFormatted }}
</td>
</tr>
{% endif %}
</tfoot>
</table>
{% else %}
{# No billing required #}
<div class="billwerk-order__no-billing-required">
{{ "No billing required"|t }}
</div>
{% endif %}
</div>
{% if coupon is not empty %}
<br/>
<div class="billwerk-order__coupon messages messages--status">
<div class="message">
<span class="billwerk-order__coupon-label">{{ "Your coupon code:"|t }}</span>
<strong class="billwerk-order__coupon__code">
<code>{{ coupon.CouponCode }}</code>
</strong>
<span class="billwerk-order__coupon-status">
{% if coupon.AppliesToCart is not empty %}
{{ "has been applied successfully"|t }}
{% else %}
{{ "is not applicable to these items"|t }}
{% endif %}
</span>
</div>
</div>
{% endif %}
</div>
