_balance_and_payments.php
1 year ago
_full_summary.php
1 year ago
_price_breakdown.php
1 year ago
_table_body.php
3 months ago
_transaction_box.php
1 year ago
index.php
1 year ago
quick_edit.php
9 months ago
reload_balance_and_payments.php
1 year ago
reload_price_breakdown.php
1 year ago
view_order_log.php
1 year ago
_balance_and_payments.php
82 lines
| 1 | <?php |
| 2 | /* |
| 3 | * Copyright (c) 2024 LatePoint LLC. All rights reserved. |
| 4 | */ |
| 5 | |
| 6 | /* @var $order OsOrderModel */ |
| 7 | |
| 8 | |
| 9 | if ( ! defined( 'ABSPATH' ) ) { |
| 10 | exit; // Exit if accessed directly |
| 11 | } |
| 12 | |
| 13 | |
| 14 | ?> |
| 15 | |
| 16 | <div class="os-form-sub-header"> |
| 17 | <h3><?php esc_html_e( 'Balance & Payments', 'latepoint' ); ?></h3> |
| 18 | <div class="os-form-sub-header-actions"> |
| 19 | <?php echo OsFormHelper::select_field( 'order[payment_status]', false, OsOrdersHelper::get_order_payment_statuses_list(), $order->payment_status, [ 'class' => 'size-small' ] ) ?> |
| 20 | </div> |
| 21 | </div> |
| 22 | <div class="balance-payment-info" data-route="<?php echo esc_attr( OsRouterHelper::build_route_name( 'orders', 'reload_balance_and_payments' ) ); ?>"> |
| 23 | <div class="payment-info-values"> |
| 24 | <?php |
| 25 | $total_paid = $order->get_total_amount_paid_from_transactions(); |
| 26 | $total_balance = $order->get_total_balance_due(); |
| 27 | $deposit_amount = $order->get_deposit_amount_to_charge(); |
| 28 | |
| 29 | ?> |
| 30 | <div class="pi-smaller"> |
| 31 | <?php echo esc_html( OsMoneyHelper::format_price( $total_paid, true, false ) ); ?> |
| 32 | </div> |
| 33 | <div class="pi-balance-due <?php if ( $total_balance > 0 ) { |
| 34 | echo 'pi-red'; |
| 35 | } ?>"> |
| 36 | <?php echo esc_html( OsMoneyHelper::format_price( $total_balance, true, false ) ); ?> |
| 37 | </div> |
| 38 | </div> |
| 39 | <div class="payment-info-labels"> |
| 40 | <div><?php esc_html_e( 'Total Payments', 'latepoint' ) ?></div> |
| 41 | <div><?php esc_html_e( 'Total Balance Due', 'latepoint' ) ?></div> |
| 42 | </div> |
| 43 | </div> |
| 44 | |
| 45 | <?php if ( $order->is_new_record() ) { ?> |
| 46 | <div class="initial-payment-data-wrapper"> |
| 47 | <div class="initial-payment-data-toggler-wrapper"> |
| 48 | <?php echo OsFormHelper::toggler_field('create_payment_request', esc_html__( 'Create a Payment Request', 'latepoint' ), false, 'payNowPortionInfo'); ?> |
| 49 | <a href="#" |
| 50 | data-os-params="<?php echo esc_attr(OsUtilHelper::build_os_params( [ 'topic' => 'payment_request' ] )); ?>" |
| 51 | data-os-action="<?php echo esc_attr(OsRouterHelper::build_route_name( 'support_topics', 'view' )); ?>" |
| 52 | data-os-output-target="lightbox" |
| 53 | class="latepoint-element-info-trigger"><i class="latepoint-icon latepoint-icon-info"></i></a> |
| 54 | </div> |
| 55 | <div class="payment-request-settings-wrapper" id="payNowPortionInfo" style="display: none;"> |
| 56 | <div class="payment-request-row"> |
| 57 | <?php |
| 58 | $payment_portions = []; |
| 59 | if($total_balance > 0) $payment_portions[LATEPOINT_PAYMENT_PORTION_FULL] = sprintf( __( 'Full Price [%s]' ), OsMoneyHelper::format_price( $total_balance, true, false ) ); |
| 60 | if($deposit_amount > 0) $payment_portions[LATEPOINT_PAYMENT_PORTION_DEPOSIT] = sprintf( __( 'Deposit Only [%s]', 'latepoint' ), OsMoneyHelper::format_price( $deposit_amount, true, false ) ); |
| 61 | $payment_portions[LATEPOINT_PAYMENT_PORTION_CUSTOM] = __( 'Custom', 'latepoint' ); |
| 62 | |
| 63 | $selected_portion = array_key_first($payment_portions); |
| 64 | echo '<div class="label-for-select">'.esc_html__('Amount:', 'latepoint').'</div>'; |
| 65 | echo OsFormHelper::select_field( 'payment_request[portion]', false, $payment_portions, $selected_portion, [ 'class' => 'size-small', 'theme' => 'simple' ] ); |
| 66 | echo '<div class="custom-charge-amount-wrapper" style="'.(($selected_portion != LATEPOINT_PAYMENT_PORTION_CUSTOM) ? 'display: none;' : '').'">'; |
| 67 | echo OsFormHelper::money_field( 'payment_request[charge_amount_custom]', false, $total_balance, [ 'class' => 'size-small', 'theme' => 'simple' ] ); |
| 68 | echo OsFormHelper::hidden_field('payment_request[charge_amount_full]', $total_balance); |
| 69 | echo OsFormHelper::hidden_field('payment_request[charge_amount_deposit]', $deposit_amount); |
| 70 | echo '</div>'; |
| 71 | ?> |
| 72 | </div> |
| 73 | <div class="payment-request-row"> |
| 74 | <?php |
| 75 | echo '<div class="label-for-select">'.esc_html__('Due Date:', 'latepoint').'</div>'; |
| 76 | echo OsFormHelper::date_picker_field( 'payment_request[due_at]', OsTimeHelper::get_readable_date_from_string(OsTimeHelper::today_date('Y-m-d')), OsTimeHelper::today_date('Y-m-d'), [ 'class' => 'size-small', 'theme' => 'simple' ] ); |
| 77 | ?> |
| 78 | </div> |
| 79 | </div> |
| 80 | |
| 81 | </div> |
| 82 | <?php } ?> |