add-edit-order.php
2 years ago
digital-products-metabox.php
3 years ago
download-logs-sidebar.php
3 years ago
eu-vat-sidebar.php
4 years ago
order-data-metabox.php
5 months ago
order-item-metabox.php
4 years ago
order-notes-sidebar.php
4 years ago
order-submit-sidebar.php
4 years ago
order-subscription-sidebar.php
4 years ago
order-item-metabox.php
113 lines
| 1 | <?php |
| 2 | |
| 3 | use ProfilePress\Core\Membership\CheckoutFields; |
| 4 | use ProfilePress\Core\Membership\Models\Order\OrderEntity; |
| 5 | use ProfilePress\Core\Membership\Models\Plan\PlanFactory; |
| 6 | use ProfilePress\Core\Membership\Services\Calculator; |
| 7 | use ProfilePress\Core\Membership\Services\TaxService; |
| 8 | |
| 9 | /** @global OrderEntity $order_data */ |
| 10 | /** @global int $order_id */ |
| 11 | $plan = PlanFactory::fromId($order_data->plan_id); |
| 12 | $plan_price = ppress_display_amount($plan->price, $order_data->currency); |
| 13 | $coupon_code = $order_data->coupon_code; |
| 14 | $billing_country = $order_data->get_meta($order_data::EU_VAT_COUNTRY_CODE); |
| 15 | if (empty($billing_country)) { |
| 16 | $billing_country = $order_data->billing_country; |
| 17 | } |
| 18 | ?> |
| 19 | <div id="ppress-submetabox-items"> |
| 20 | <div class="ppress-submetabox-items-table-wrapper"> |
| 21 | <table cellpadding="0" cellspacing="0" class="ppress-submetabox-items-table"> |
| 22 | <thead> |
| 23 | <tr> |
| 24 | <th class="ppress-submetabox-item-column-course"><?php esc_html_e('Item', 'wp-user-avatar') ?></th> |
| 25 | <th class="ppress-submetabox-item-column-price"></th> |
| 26 | <th class="ppress-submetabox-item-column-total"><?php esc_html_e('Price', 'wp-user-avatar') ?></th> |
| 27 | <th class="ppress-submetabox-item-column-action"></th> |
| 28 | </tr> |
| 29 | </thead> |
| 30 | <tbody> |
| 31 | <tr class="ppress-submetabox-item-row"> |
| 32 | <td class="ppress-submetabox-item-column-course"> |
| 33 | <a target="_blank" href="<?= $plan->get_edit_plan_url() ?>"><?php echo $plan->name ?></a> |
| 34 | </td> |
| 35 | <td class="ppress-submetabox-item-column-price"></td> |
| 36 | <td class="ppress-submetabox-item-column-total"><?= $plan_price ?></td> |
| 37 | <td class="ppress-submetabox-item-column-action action-delete"></td> |
| 38 | </tr> |
| 39 | </tbody> |
| 40 | <tfoot> |
| 41 | <tr class="ppress-submetabox-items-row-sub-total"> |
| 42 | <td colspan="2" class="ppress-submetabox-items-column-sub-total-label"> |
| 43 | <strong><?php esc_html_e('Subtotal', 'wp-user-avatar') ?>:</strong></td> |
| 44 | <td class="ppress-submetabox-items-column-sub-total"><?= ppress_display_amount($order_data->subtotal, $order_data->currency) ?></td> |
| 45 | <td class="ppress-submetabox-items-column-action"></td> |
| 46 | </tr> |
| 47 | <tr class="ppress-submetabox-items-row-border"> |
| 48 | <td colspan="1"></td> |
| 49 | <td colspan="3" style="border-bottom: 1px solid #f8f8f8;"></td> |
| 50 | </tr> |
| 51 | |
| 52 | <?php if ( ! empty($coupon_code)) : ?> |
| 53 | <tr class="ppress-submetabox-items-row-discounts"> |
| 54 | <td colspan="2" class="ppress-submetabox-items-column-discounts-label"> |
| 55 | <span class="coupon-wrap"> |
| 56 | <span class="coupons-label"><?php esc_html_e('Applied Coupon', 'wp-user-avatar') ?></span> |
| 57 | <span class="coupon-code"><?= $coupon_code ?></span> |
| 58 | </span> |
| 59 | <span class="label-text"> |
| 60 | <strong><?php esc_html_e('Discount:', 'wp-user-avatar') ?></strong> |
| 61 | </span> |
| 62 | </td> |
| 63 | <td class="ppress-submetabox-items-column-discounts-total">−<?= ppress_display_amount($order_data->discount, $order_data->currency) ?></td> |
| 64 | <td class="ppress-submetabox-items-column-action"></td> |
| 65 | </tr> |
| 66 | <?php endif; ?> |
| 67 | |
| 68 | <?php if (TaxService::init()->is_tax_enabled() || Calculator::init($order_data->tax)->isGreaterThan('0')) : ?> |
| 69 | <tr class="ppress-submetabox-items-row-tax"> |
| 70 | <td colspan="2" class="ppress-submetabox-items-column-tax-label"> |
| 71 | <strong><?= TaxService::init()->get_tax_label($billing_country) ?> |
| 72 | <?php if (Calculator::init($order_data->tax_rate)->isGreaterThan('0')) : ?> |
| 73 | (<?= $order_data->tax_rate ?>%) |
| 74 | <?php endif; ?> |
| 75 | </td> |
| 76 | <td class="ppress-submetabox-items-column-tax"><?= ppress_display_amount($order_data->tax, $order_data->currency) ?></td> |
| 77 | <td class="ppress-submetabox-items-column-action"></td> |
| 78 | </tr> |
| 79 | <?php endif; ?> |
| 80 | |
| 81 | <tr class="ppress-submetabox-items-row-border"> |
| 82 | <td colspan="1"></td> |
| 83 | <td colspan="3" style="border-bottom: 1px solid #f8f8f8;"></td> |
| 84 | </tr> |
| 85 | <tr class="ppress-submetabox-items-row-total"> |
| 86 | <td colspan="2" class="ppress-submetabox-items-column-total-label"> |
| 87 | <strong><?php esc_html_e('Total:', 'wp-user-avatar') ?></strong> |
| 88 | </td> |
| 89 | <td class="ppress-submetabox-items-column-total"><?= ppress_display_amount($order_data->total, $order_data->currency) ?></td> |
| 90 | <td class="ppress-submetabox-items-column-action"></td> |
| 91 | </tr> |
| 92 | <tr class="ppress-submetabox-items-row-actions"> |
| 93 | <td colspan="4" class="ppress-submetabox-items-column-actions"> |
| 94 | <?php if ($order_data->is_refundable()) : ?> |
| 95 | <a href="<?= $order_data->get_refund_url() ?>" id="order-refund" class="button button-secondary pp-confirm-delete order-refund"><?php esc_html_e('Refund Order', 'wp-user-avatar') ?></a> |
| 96 | <?php endif; ?> |
| 97 | |
| 98 | <?php if ( ! $order_data->is_pending()) : ?> |
| 99 | <span class="ppress-hint-tooltip ppress-hint-wrap hint--top hint--medium hint--bounce" aria-label="<?= esc_html__('To edit this order, change the order status back to "Pending"', 'wp-user-avatar') ?>"> |
| 100 | <span class="dashicons dashicons-editor-help"></span> |
| 101 | </span> |
| 102 | <span class="message"><?php esc_html_e('This order is no longer editable.', 'wp-user-avatar') ?></span> |
| 103 | <?php else : ?> |
| 104 | <input type="hidden" id="ppress_order_id" value="<?= absint($_GET['id']) ?>"> |
| 105 | <button type="button" class="button add-replace-order-item"><?php esc_html_e('Add/Replace Order Item', 'wp-user-avatar') ?></button> |
| 106 | <?php endif; ?> |
| 107 | </td> |
| 108 | </tr> |
| 109 | </tfoot> |
| 110 | </table> |
| 111 | |
| 112 | </div> |
| 113 | </div> |