{% if order.payments is not empty %} {% set payment = order.payments|first %} {% set Paymentamount = payment.paymentamount %} {# Check if the payment has subscriptions #} {% if payment.subscriptions is not empty %} {% set subscription = payment.subscriptions|first %} {% set subscriptionduration = subscription.duration ~ ' ' ~ (subscription.duration == 1 ? 'Month' : 'Months') %} {# Check if subscription has auto-renewal enabled #} {% if subscription.autorenewal == 1 %} {# Calculate next payment date if auto-renewal is enabled #} {% set nextpayment = subscription.enddate|date('Y-m-d') %} {% else %} {% set nextpayment = 'No next payment' %} {% endif %} {% else %} {% set subscriptionduration = 'No subscription found' %} {% set nextpayment = 'N/A' %} {% endif %} {% else %} {% set Paymentamount = 'No payment found' %} {% set subscriptionduration = 'N/A' %} {% set nextpayment = 'N/A' %} {% endif %} {{ order.id }} {% if order.userid is null %} N/A {% else %} {{ order.userid.firstname }} {{ order.userid.lastname }} {% endif %} {% if order.productid is empty %} N/A {% else %} {{ order.productid.name }} {% endif %} {% if order.customeremailid is null %} N/A {% else %} {{ order.customeremailid }} {% endif %} {% set badgeClass = '' %} {% set statusText = order.status is not null ? order.status : 'N/A' %} {% if order.status is null %} N/A {% elseif order.createdby is not null and 'ROLE_ADMINISTRATOR' in order.createdby.getRoles and statusText != 'completed' %} {% else %} {% if statusText == 'completed' %} {% set badgeClass = 'badge bg-success' %} {% elseif statusText in ['refunded', 'cancelled', 'expired','failed'] %} {% set badgeClass = 'badge bg-danger' %} {% elseif statusText in ['processing', 'pending'] %} {% set badgeClass = 'badge bg-warning' %} {% elseif statusText in ['on hold', 'on-hold'] %} {% set badgeClass = 'badge bg-info' %} {% else %} {% set badgeClass = 'badge bg-secondary' %} {% endif %} {{ statusText|upper }} {% endif %} {% if order.getCreatedAt is null %} N/A {% else %} {{ order.getCreatedAt|date('Y-m-d H:i:s') }} {% endif %} {{ subscriptionduration }} {{ Paymentamount|number_format(2,',','.') }} € {{ nextpayment }} {# {% if order.wordpressorderId is empty %} No {% else %} Yes {% endif %} #}