| 1 |
<?php |
| 2 |
/** |
| 3 |
* Subscription Customer Details |
| 4 |
* |
| 5 |
* @package SpringDevs\Subscription\Admin |
| 6 |
*/ |
| 7 |
|
| 8 |
// Exit if accessed directly. |
| 9 |
if ( ! defined( 'ABSPATH' ) ) { |
| 10 |
exit; |
| 11 |
} |
| 12 |
|
| 13 |
$view_subs_endpoint = SpringDevs\Subscription\Illuminate\Subscription\Subscription::get_user_endpoint( 'view_subs' ); |
| 14 |
$subs_frontend_url = wc_get_endpoint_url( $view_subs_endpoint, get_the_ID(), wc_get_page_permalink( 'myaccount' ) ); |
| 15 |
|
| 16 |
?> |
| 17 |
|
| 18 |
<style> |
| 19 |
.customer-details { |
| 20 |
font-size: 13px; |
| 21 |
line-height: 1.4; |
| 22 |
} |
| 23 |
|
| 24 |
.customer-details .info-group { |
| 25 |
margin-bottom: 12px; |
| 26 |
padding-bottom: 12px; |
| 27 |
border-bottom: 1px solid #f0f0f1; |
| 28 |
} |
| 29 |
|
| 30 |
.customer-details .info-group:last-child { |
| 31 |
border-bottom: none; |
| 32 |
margin-bottom: 0; |
| 33 |
padding-bottom: 0; |
| 34 |
} |
| 35 |
|
| 36 |
.customer-details .label { |
| 37 |
color: #646970; |
| 38 |
font-weight: 600; |
| 39 |
margin-bottom: 4px; |
| 40 |
display: block; |
| 41 |
} |
| 42 |
|
| 43 |
.customer-details .value { |
| 44 |
color: #2c3338; |
| 45 |
} |
| 46 |
|
| 47 |
.customer-details a { |
| 48 |
color: #2271b1; |
| 49 |
text-decoration: none; |
| 50 |
box-shadow: none; |
| 51 |
} |
| 52 |
|
| 53 |
.customer-details a:hover { |
| 54 |
color: #135e96; |
| 55 |
} |
| 56 |
|
| 57 |
.customer-details .address { |
| 58 |
color: #50575e; |
| 59 |
font-size: 12px; |
| 60 |
line-height: 1.5; |
| 61 |
margin: 4px 0; |
| 62 |
} |
| 63 |
|
| 64 |
.customer-details .actions { |
| 65 |
margin-top: 12px; |
| 66 |
} |
| 67 |
|
| 68 |
.customer-details .button { |
| 69 |
font-size: 12px; |
| 70 |
height: auto; |
| 71 |
line-height: 2; |
| 72 |
padding: 0 8px; |
| 73 |
margin: 0 4px 4px 0; |
| 74 |
display: inline-block; |
| 75 |
} |
| 76 |
|
| 77 |
.customer-details .button-secondary { |
| 78 |
color: #50575e; |
| 79 |
} |
| 80 |
</style> |
| 81 |
|
| 82 |
<div class="customer-details"> |
| 83 |
<div class="info-group"> |
| 84 |
<span class="label"><?php esc_html_e( 'Customer', 'subscription' ); ?></span> |
| 85 |
<div class="value"> |
| 86 |
<?php if ( $order->get_customer_id() ) : ?> |
| 87 |
<a href="<?php echo esc_url( admin_url( 'user-edit.php?user_id=' . $order->get_customer_id() ) ); ?>" target="_blank"> |
| 88 |
<?php echo esc_html( $order->get_billing_first_name() . ' ' . $order->get_billing_last_name() ); ?> |
| 89 |
</a> |
| 90 |
<?php else : ?> |
| 91 |
<?php echo esc_html( $order->get_billing_first_name() . ' ' . $order->get_billing_last_name() ); ?> |
| 92 |
<?php endif; ?> |
| 93 |
<br> |
| 94 |
<a href="mailto:<?php echo esc_attr( $order->get_billing_email() ); ?>"> |
| 95 |
<?php echo esc_html( $order->get_billing_email() ); ?> |
| 96 |
</a> |
| 97 |
<?php if ( ! empty( $order->get_billing_phone() ) ) : ?> |
| 98 |
<br> |
| 99 |
<a href="tel:<?php echo esc_attr( $order->get_billing_phone() ); ?>"> |
| 100 |
<?php echo esc_html( $order->get_billing_phone() ); ?> |
| 101 |
</a> |
| 102 |
<?php endif; ?> |
| 103 |
</div> |
| 104 |
</div> |
| 105 |
|
| 106 |
<div class="info-group"> |
| 107 |
<span class="label"><?php esc_html_e( 'Billing', 'subscription' ); ?></span> |
| 108 |
<div class="value"> |
| 109 |
<div class="address"> |
| 110 |
<?php echo wp_kses_post( $order->get_formatted_billing_address() ? $order->get_formatted_billing_address() : __( 'No billing address set.', 'subscription' ) ); ?> |
| 111 |
</div> |
| 112 |
</div> |
| 113 |
</div> |
| 114 |
|
| 115 |
<div class="info-group"> |
| 116 |
<span class="label"><?php esc_html_e( 'Shipping', 'subscription' ); ?></span> |
| 117 |
<div class="value"> |
| 118 |
<div class="address"> |
| 119 |
<?php echo wp_kses_post( $order->get_formatted_shipping_address() ? $order->get_formatted_shipping_address() : __( 'No shipping address set.', 'subscription' ) ); ?> |
| 120 |
</div> |
| 121 |
</div> |
| 122 |
</div> |
| 123 |
|
| 124 |
<div class="info-group"> |
| 125 |
<div class="actions"> |
| 126 |
<a class="button button-primary" target="_blank" href="<?php echo esc_url( $order->get_edit_order_url() ); ?>"> |
| 127 |
<?php esc_html_e( 'View Order', 'subscription' ); ?> |
| 128 |
</a> |
| 129 |
<a class="button button-secondary" target="_blank" href="<?php echo esc_url( $subs_frontend_url ); ?>"> |
| 130 |
<?php esc_html_e( 'View Frontend', 'subscription' ); ?> |
| 131 |
</a> |
| 132 |
</div> |
| 133 |
</div> |
| 134 |
</div> |
| 135 |
|