| 1 |
<?php |
| 2 |
defined( 'ABSPATH' ) || exit; |
| 3 |
|
| 4 |
/** |
| 5 |
* @var object $order |
| 6 |
* @var array $currency_settings |
| 7 |
* @var bool $hasSubscription |
| 8 |
*/ |
| 9 |
|
| 10 |
if (!$order->items) { |
| 11 |
return ''; |
| 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 $fluentBookingSubTotal = 0; ?> |
| 24 |
<?php foreach ($order->items->toArray() as $fluentBookingOrderItem) { |
| 25 |
if (is_array($fluentBookingOrderItem)) { |
| 26 |
if (!empty($fluentBookingOrderItem['item_total'])) :?> |
| 27 |
<tr> |
| 28 |
<td><?php echo esc_html($fluentBookingOrderItem['item_name']); ?></td> |
| 29 |
<td><?php echo esc_html($fluentBookingOrderItem['quantity']); ?></td> |
| 30 |
<td><?php echo esc_attr(fluentbookingFormattedAmount($fluentBookingOrderItem['item_price'], $currency_settings)); ?></td> |
| 31 |
<td><?php echo esc_attr(fluentbookingFormattedAmount($fluentBookingOrderItem['item_total'], $currency_settings)); ?></td> |
| 32 |
</tr> |
| 33 |
<?php |
| 34 |
$fluentBookingSubTotal += $fluentBookingOrderItem['item_total']; |
| 35 |
endif; |
| 36 |
} else { |
| 37 |
if (isset($fluentBookingOrderItem->item_total) && $fluentBookingOrderItem->item_total) :?> |
| 38 |
<tr> |
| 39 |
<td><?php echo esc_html($fluentBookingOrderItem->item_name); ?></td> |
| 40 |
<td><?php echo esc_html($fluentBookingOrderItem->quantity); ?></td> |
| 41 |
<td><?php echo esc_html(fluentbookingFormattedAmount($fluentBookingOrderItem->item_price, $currency_settings)); ?></td> |
| 42 |
<td><?php echo esc_html(fluentbookingFormattedAmount($fluentBookingOrderItem->item_total, $currency_settings)); ?></td> |
| 43 |
</tr> |
| 44 |
<?php |
| 45 |
$fluentBookingSubTotal += $fluentBookingOrderItem->item_total; |
| 46 |
endif; |
| 47 |
} |
| 48 |
|
| 49 |
}; |
| 50 |
?> |
| 51 |
</tbody> |
| 52 |
<tfoot> |
| 53 |
<?php $fluentBookingDiscountTotal = 0; |
| 54 |
if (isset($order->discounts) && count($order->discounts)) : ?> |
| 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($fluentBookingSubTotal, $currency_settings)); ?></td> |
| 58 |
</tr> |
| 59 |
<?php |
| 60 |
foreach ($order->discounts as $fluentBookingDiscount) : |
| 61 |
$fluentBookingDiscountTotal += $fluentBookingDiscount->item_total; |
| 62 |
?> |
| 63 |
<tr class="fluent_booking_discount_row"> |
| 64 |
<?php /* translators: %s: Discount name */ ?> |
| 65 |
<th style="text-align: right" colspan="3"><?php printf(esc_html__('Discounts(%s)', 'fluent-booking'), esc_html($fluentBookingDiscount->item_name)); ?></th> |
| 66 |
<td><?php echo '-' . esc_html(fluentbookingFormattedAmount($fluentBookingDiscount->item_total, $currency_settings)); ?></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, $currency_settings)); ?> |
| 75 |
<?php else: ?> |
| 76 |
<?php echo esc_attr(fluentbookingFormattedAmount($order->total_amount, $currency_settings)); ?> |
| 77 |
<?php endif; ?> |
| 78 |
</td> |
| 79 |
</tr> |
| 80 |
</tfoot> |
| 81 |
</table> |
| 82 |
|