| 1 |
<?php |
| 2 |
/** |
| 3 |
* Admin order detail: pending refund request panel. |
| 4 |
* |
| 5 |
* Rendered via learn_press_admin_view() from learn_press_admin_order_refund_request_panel(). |
| 6 |
* |
| 7 |
* @since 4.3.4 |
| 8 |
* @version 1.0.0 |
| 9 |
* |
| 10 |
* @var int $order_id |
| 11 |
* @var bool $is_pending |
| 12 |
* @var float $order_total |
| 13 |
* @var string $order_total_formatted |
| 14 |
* @var string $refund_amount_formatted Empty unless the refund has been approved/auto-approved. |
| 15 |
* @var string $requested_by |
| 16 |
* @var string $requested_at |
| 17 |
* @var string $requester_email |
| 18 |
* @var string $refund_reason |
| 19 |
* @var string $status_label |
| 20 |
*/ |
| 21 |
defined( 'ABSPATH' ) || exit(); |
| 22 |
?> |
| 23 |
<?php if ( ! $is_pending ) : ?> |
| 24 |
<?php if ( ! empty( $refund_amount_formatted ) ) : ?> |
| 25 |
<div class="order-data-field order-data-refund-request"> |
| 26 |
<p class="description order-data-refund-amount"> |
| 27 |
<strong><?php esc_html_e( 'Refund amount:', 'learnpress' ); ?></strong> |
| 28 |
<?php echo wp_kses_post( $refund_amount_formatted ); ?> |
| 29 |
</p> |
| 30 |
</div> |
| 31 |
<?php endif; ?> |
| 32 |
<?php return; ?> |
| 33 |
<?php endif; ?> |
| 34 |
<div |
| 35 |
class="order-data-field order-data-refund-request" |
| 36 |
data-order-id="<?php echo esc_attr( $order_id ); ?>" |
| 37 |
data-order-total="<?php echo esc_attr( $order_total ); ?>" |
| 38 |
data-order-total-formatted="<?php echo esc_attr( $order_total_formatted ); ?>" |
| 39 |
data-confirm-title="<?php esc_attr_e( 'Approve refund?', 'learnpress' ); ?>" |
| 40 |
data-confirm-text="<?php esc_attr_e( 'Enter an optional message and the amount to refund.', 'learnpress' ); ?>" |
| 41 |
data-message-label="<?php esc_attr_e( 'Message to payer', 'learnpress' ); ?>" |
| 42 |
data-message-placeholder="<?php esc_attr_e( 'Enter an optional refund message.', 'learnpress' ); ?>" |
| 43 |
data-amount-label="<?php esc_attr_e( 'Refund amount', 'learnpress' ); ?>" |
| 44 |
data-amount-invalid="<?php echo esc_attr( sprintf( __( 'Refund amount must be greater than 0 and must not exceed %s.', 'learnpress' ), $order_total_formatted ) ); ?>" |
| 45 |
data-confirm-button="<?php esc_attr_e( 'Approve Refund', 'learnpress' ); ?>" |
| 46 |
data-cancel-button="<?php esc_attr_e( 'Cancel', 'learnpress' ); ?>" |
| 47 |
> |
| 48 |
<label><?php esc_html_e( 'Refund Request', 'learnpress' ); ?></label> |
| 49 |
<p class="description"> |
| 50 |
<?php |
| 51 |
echo wp_kses_post( |
| 52 |
sprintf( |
| 53 |
__( 'Requested by <strong>%1$s</strong> at %2$s.', 'learnpress' ), |
| 54 |
$requested_by, |
| 55 |
$requested_at |
| 56 |
) |
| 57 |
); |
| 58 |
?> |
| 59 |
</p> |
| 60 |
<?php if ( ! empty( $requester_email ) ) : ?> |
| 61 |
<p class="description"> |
| 62 |
<?php echo esc_html( sprintf( __( 'Requester email: %s', 'learnpress' ), $requester_email ) ); ?> |
| 63 |
</p> |
| 64 |
<?php endif; ?> |
| 65 |
<?php if ( ! empty( $refund_reason ) ) : ?> |
| 66 |
<p class="description"> |
| 67 |
<strong><?php esc_html_e( 'Reason:', 'learnpress' ); ?></strong> |
| 68 |
<?php echo wp_kses_post( nl2br( esc_html( $refund_reason ) ) ); ?> |
| 69 |
</p> |
| 70 |
<?php endif; ?> |
| 71 |
|
| 72 |
<?php if ( ! empty( $status_label ) ) : ?> |
| 73 |
<p class="description"> |
| 74 |
<?php echo esc_html( sprintf( __( 'Request status: %s', 'learnpress' ), $status_label ) ); ?> |
| 75 |
</p> |
| 76 |
<?php endif; ?> |
| 77 |
<p> |
| 78 |
<button type="button" class="button button-primary lp-button lp-admin-refund-order-action" data-refund-action="approve"> |
| 79 |
<?php esc_html_e( 'Approve Refund', 'learnpress' ); ?> |
| 80 |
</button> |
| 81 |
<button type="button" class="button lp-button lp-admin-refund-order-action" data-refund-action="reject"> |
| 82 |
<?php esc_html_e( 'Reject Refund', 'learnpress' ); ?> |
| 83 |
</button> |
| 84 |
</p> |
| 85 |
</div> |
| 86 |
|