| 1 |
<?php |
| 2 |
|
| 3 |
defined( 'ABSPATH' ) || exit; |
| 4 |
|
| 5 |
if (!$order->items) { |
| 6 |
return ''; |
| 7 |
} |
| 8 |
$currencySign = \FluentBooking\App\Services\CurrenciesHelper::getGlobalCurrencySign(); |
| 9 |
|
| 10 |
$currencySetting = [ |
| 11 |
'currency_sign' => $currencySign, |
| 12 |
]; |
| 13 |
|
| 14 |
?> |
| 15 |
<table class="table fluent_booking_order_items_table fluent_booking_table table_bordered"> |
| 16 |
<thead> |
| 17 |
<th><?php esc_html_e('Item', 'fluent-booking'); ?></th> |
| 18 |
<th><?php esc_html_e('Quantity', 'fluent-booking'); ?></th> |
| 19 |
<th><?php esc_html_e('Price', 'fluent-booking'); ?></th> |
| 20 |
<th><?php esc_html_e('Line Total', 'fluent-booking'); ?></th> |
| 21 |
</thead> |
| 22 |
<tbody> |
| 23 |
<?php $subTotal = 0; ?> |
| 24 |
<?php foreach ($order->items->toArray() as $order_item) { |
| 25 |
if (is_array($order_item)) { |
| 26 |
if ($order_item['item_total']) :?> |
| 27 |
<tr> |
| 28 |
<td><?php echo esc_html($order_item['item_name']); ?></td> |
| 29 |
<td><?php echo esc_html($order_item['quantity']); ?></td> |
| 30 |
<td><?php echo esc_attr(fluentbookingFormattedAmount($order_item['item_price'], $currencySetting)); ?></td> |
| 31 |
<td><?php echo esc_attr(fluentbookingFormattedAmount($order_item['item_total'], $currencySetting)); ?></td> |
| 32 |
</tr> |
| 33 |
<?php |
| 34 |
$subTotal += $order_item['item_total']; |
| 35 |
endif; |
| 36 |
} else { |
| 37 |
if ($order_item->item_total) :?> |
| 38 |
<tr> |
| 39 |
<td><?php echo esc_html($order_item->item_name); ?></td> |
| 40 |
<td><?php echo esc_html($order_item->quantity); ?></td> |
| 41 |
<td><?php echo esc_html(fluentbookingFormattedAmount($order_item->item_price, $currencySetting)); ?></td> |
| 42 |
<td><?php echo esc_html(fluentbookingFormattedAmount($order_item->item_total, $currencySetting)); ?></td> |
| 43 |
</tr> |
| 44 |
<?php |
| 45 |
$subTotal += $order_item->item_total; |
| 46 |
endif; |
| 47 |
} |
| 48 |
|
| 49 |
}; |
| 50 |
?> |
| 51 |
</tbody> |
| 52 |
<tfoot> |
| 53 |
<?php $discountTotal = 0; |
| 54 |
if (isset($order->discounts['applied']) && count($order->discounts['applied'])) : ?> |
| 55 |
<tr class="fluent_booking_total_row"> |
| 56 |
<th style="text-align: right" colspan="3"><?php esc_html_e('Sub-Total', 'fluent-booking'); ?></th> |
| 57 |
<td><?php echo esc_html(fluentbookingFormattedAmount($subTotal, $currencySetting)); ?></td> |
| 58 |
</tr> |
| 59 |
<?php |
| 60 |
foreach ($order->discounts['applied'] as $discount) : |
| 61 |
$discountTotal += $discount->item_total; |
| 62 |
?> |
| 63 |
<tr class="fluent_booking_discount_row"> |
| 64 |
<th style="text-align: right" |
| 65 |
colspan="3"><?php echo 'Discounts (' . esc_html($discount->item_name) . ' )'; ?></th> |
| 66 |
<td><?php echo '-' . esc_html(fluentbookingFormattedAmount($discount->item_total, $currencySetting)); ?></td> |
| 67 |
</tr> |
| 68 |
<?php endforeach; ?> |
| 69 |
<?php endif; ?> |
| 70 |
<tr class="fluent_booking_total_payment_row"> |
| 71 |
<th style="text-align: right" colspan="3"><?php esc_html_e('Total', 'fluent-booking'); ?></th> |
| 72 |
<td> |
| 73 |
<?php if (isset($hasSubscription) && $hasSubscription) : ?> |
| 74 |
<?php echo esc_attr(fluentbookingFormattedAmount($order->total_amount, $currencySetting)); ?> |
| 75 |
<?php else: ?> |
| 76 |
<?php echo esc_attr(fluentbookingFormattedAmount($order->total_amount - $discountTotal, $currencySetting)); ?> |
| 77 |
<?php endif; ?> |
| 78 |
</td> |
| 79 |
</tr> |
| 80 |
</tfoot> |
| 81 |
</table> |
| 82 |
|