| 1 |
<?php |
| 2 |
/* |
| 3 |
* Transactions parial content |
| 4 |
* All undefined vars comes from 'render_better_payment_admin_pages' method |
| 5 |
* $bp_admin_all_transactions : contains all values |
| 6 |
*/ |
| 7 |
|
| 8 |
use Better_Payment\Lite\Classes\Helper; |
| 9 |
|
| 10 |
?> |
| 11 |
|
| 12 |
<?php |
| 13 |
$transaction_filter_paged = !empty($args['paged']) ? $args['paged'] : 1; |
| 14 |
$transaction_filter_per_page = !empty($args['per_page']) ? $args['per_page'] : 20; |
| 15 |
?> |
| 16 |
|
| 17 |
<div class="transaction-table-wrapper"> |
| 18 |
<div class="transactions"> |
| 19 |
<!-- Hidden Fields Start --> |
| 20 |
<div class="hidden-fields"> |
| 21 |
<input type="hidden" name="paged" class="paged" value="<?php echo esc_attr($transaction_filter_paged); ?>"> |
| 22 |
<input type="hidden" name="per_page1" class="per-page1" value="<?php echo esc_attr($transaction_filter_per_page); ?>"> |
| 23 |
<input type="hidden" name="total_entry" class="total-entry" value="<?php echo esc_attr($bp_admin_all_transactions_count); ?>"> |
| 24 |
<input type="hidden" name="completed_entry" class="completed-entry" value="<?php echo esc_attr($bp_admin_completed_transactions_count); ?>"> |
| 25 |
<input type="hidden" name="incomplete_entry" class="incomplete-entry" value="<?php echo esc_attr($bp_admin_incomplete_transactions_count); ?>"> |
| 26 |
</div> |
| 27 |
<!-- Hidden Fields End --> |
| 28 |
|
| 29 |
<div class="transaction__table mb30"> |
| 30 |
<div class="table__row row__head"> |
| 31 |
<div class="table__col col__head col__name"> |
| 32 |
<p><?php esc_html_e('Name', 'better-payment'); ?></p> |
| 33 |
</div> |
| 34 |
<div class="table__col col__head col__email"> |
| 35 |
<p><?php esc_html_e('Email Address', 'better-payment'); ?></p> |
| 36 |
</div> |
| 37 |
<div class="table__col col__head col__amount"> |
| 38 |
<p><?php esc_html_e('Amount', 'better-payment'); ?></p> |
| 39 |
</div> |
| 40 |
<div class="table__col col__head col__amount"> |
| 41 |
<p><?php esc_html_e('Payment Type', 'better-payment'); ?></p> |
| 42 |
</div> |
| 43 |
<div class="table__col col__head col__trans"> |
| 44 |
<p><?php esc_html_e('Transaction ID', 'better-payment'); ?></p> |
| 45 |
</div> |
| 46 |
<div class="table__col col__head col__source"> |
| 47 |
<p><?php esc_html_e('Source', 'better-payment'); ?></p> |
| 48 |
</div> |
| 49 |
<div class="table__col col__head col__status"> |
| 50 |
<p><?php esc_html_e('Status', 'better-payment'); ?></p> |
| 51 |
</div> |
| 52 |
<div class="table__col col__head col__amount"> |
| 53 |
<p><?php esc_html_e('Date', 'better-payment'); ?></p> |
| 54 |
</div> |
| 55 |
<div class="table__col col__head col__action"> |
| 56 |
<p><?php esc_html_e('Action', 'better-payment'); ?></p> |
| 57 |
</div> |
| 58 |
</div> |
| 59 |
|
| 60 |
<?php |
| 61 |
$bp_txn_counter = 0; |
| 62 |
$allowed_sources = ['paypal', 'stripe', 'paystack']; |
| 63 |
$td_source_image_url = BETTER_PAYMENT_ASSETS . '/img/stripe.svg'; |
| 64 |
$td_source_image_alt = 'Stripe'; |
| 65 |
?> |
| 66 |
|
| 67 |
<?php foreach ($bp_admin_all_transactions as $bp_transaction) : ?> |
| 68 |
<?php $bp_txn_counter++; ?> |
| 69 |
<?php $bp_customer_info = maybe_unserialize($bp_transaction->customer_info); //obj |
| 70 |
?> |
| 71 |
<?php $bp_form_fields_info = maybe_unserialize($bp_transaction->form_fields_info); //array |
| 72 |
?> |
| 73 |
|
| 74 |
<?php |
| 75 |
$is_imported = ! empty( $bp_form_fields_info['is_imported'] ) && 1 === intval($bp_form_fields_info['is_imported']) ? 1 : 0; |
| 76 |
$bp_transaction_customer_name = isset($bp_form_fields_info['primary_first_name']) ? sanitize_text_field($bp_form_fields_info['primary_first_name']) : ''; |
| 77 |
$bp_transaction_customer_name .= ' '; |
| 78 |
$bp_transaction_customer_name .= isset($bp_form_fields_info['primary_last_name']) ? sanitize_text_field($bp_form_fields_info['primary_last_name']) : ''; |
| 79 |
|
| 80 |
//legacy |
| 81 |
if( empty($bp_transaction_customer_name) || $bp_transaction_customer_name == ' ' ){ |
| 82 |
$bp_transaction_customer_name = isset($bp_form_fields_info['first_name']) ? sanitize_text_field($bp_form_fields_info['first_name']) : ''; |
| 83 |
$bp_transaction_customer_name .= ' '; |
| 84 |
$bp_transaction_customer_name .= isset($bp_form_fields_info['last_name']) ? sanitize_text_field($bp_form_fields_info['last_name']) : ''; |
| 85 |
} |
| 86 |
|
| 87 |
|
| 88 |
$bp_transaction_customer_email = isset($bp_form_fields_info['primary_email']) ? sanitize_text_field($bp_form_fields_info['primary_email']) : ''; |
| 89 |
//legacy |
| 90 |
if( empty($bp_transaction_customer_email) ){ |
| 91 |
$bp_transaction_customer_email = isset($bp_form_fields_info['email']) ? sanitize_text_field($bp_form_fields_info['email']) : ''; |
| 92 |
} |
| 93 |
|
| 94 |
$is_subscription = ! empty( $bp_form_fields_info['subscription_id'] ) ? 'Subscription' : 'One Time'; |
| 95 |
?> |
| 96 |
|
| 97 |
<div class="table__row"> |
| 98 |
<div class="table__col col__name"> |
| 99 |
<p><?php if ( $is_imported ) : ?> <span title="<?php esc_attr_e('Imported', 'better-payment'); ?>" class="bp-icon bp-imported imported-icon"></span> <?php endif; ?> <?php echo esc_html( $bp_transaction_customer_name ); ?> </p> |
| 100 |
</div> |
| 101 |
<div class="table__col col__email"> |
| 102 |
<p> |
| 103 |
<span id="bp_email_copy_clipboard_input_<?php echo esc_html($bp_txn_counter); ?>"><?php echo esc_html($bp_transaction_customer_email); ?></span> |
| 104 |
<span id="bp_email_copy_clipboard_<?php echo esc_attr($bp_txn_counter); ?>" class="bp-icon bp-copy-square bp-email-copy-clipboard" title="<?php esc_html_e('Copy', 'better-payment'); ?>" data-bp_txn_counter="<?php echo esc_attr($bp_txn_counter); ?>" ></span> |
| 105 |
<span id="bp_email_copy_clipboard_info_<?php echo esc_attr($bp_txn_counter); ?>" class="bp-email-copy-clipboard-info is-hidden" data-bp_txn_counter="<?php echo esc_attr($bp_txn_counter); ?>" >Copied!</span> |
| 106 |
</p> |
| 107 |
</div> |
| 108 |
<div class="table__col col__amount"> |
| 109 |
<p> <?php echo esc_html($bp_transaction->currency) . ' ' . esc_html( floatval( $bp_transaction->amount ) ); ?> </p> |
| 110 |
</div> |
| 111 |
|
| 112 |
<div class="table__col col__amount is-subscription"> |
| 113 |
<p> <?php echo esc_html($is_subscription); ?> </p> |
| 114 |
</div> |
| 115 |
<div class="table__col col__trans"> |
| 116 |
<?php $bp_transaction_id = sanitize_text_field($bp_transaction->transaction_id); ?> |
| 117 |
|
| 118 |
<?php if( !empty($bp_transaction_id) ) : ?> |
| 119 |
<p> |
| 120 |
<span id="bp_copy_clipboard_input_<?php echo esc_html($bp_txn_counter); ?>"><?php echo esc_html($bp_transaction_id); ?></span> |
| 121 |
<span id="bp_copy_clipboard_<?php echo esc_attr($bp_txn_counter); ?>" class="bp-icon bp-copy-square bp-copy-clipboard" title="<?php esc_html_e('Copy', 'better-payment'); ?>" data-bp_txn_counter="<?php echo esc_attr($bp_txn_counter); ?>" ></span> |
| 122 |
<span id="bp_copy_clipboard_info_<?php echo esc_attr($bp_txn_counter); ?>" class="bp-copy-clipboard-info is-hidden" data-bp_txn_counter="<?php echo esc_attr($bp_txn_counter); ?>" >Copied!</span> |
| 123 |
</p> |
| 124 |
<?php endif; ?> |
| 125 |
</div> |
| 126 |
<div class="table__col col__source"> |
| 127 |
<?php |
| 128 |
if( in_array( strtolower( $bp_transaction->source ), $allowed_sources ) ){ |
| 129 |
$td_source_image_url = strtolower( $bp_transaction->source ) == 'paypal' ? BETTER_PAYMENT_ASSETS . '/img/paypal.png' : BETTER_PAYMENT_ASSETS . "/img/{$bp_transaction->source}.svg"; |
| 130 |
$td_source_image_alt = strtolower( $bp_transaction->source ) == 'paypal' ? 'PayPal' : ucfirst( $bp_transaction->source ); |
| 131 |
} |
| 132 |
?> |
| 133 |
<p> <img src="<?php echo esc_url($td_source_image_url) ?>" title="<?php echo esc_attr( $td_source_image_alt ); ?>" alt="<?php echo esc_attr( $td_source_image_alt ); ?>"> </p> |
| 134 |
</div> |
| 135 |
<div class="table__col col__status"> |
| 136 |
<?php |
| 137 |
$bp_transaction_status_for_color = $bp_transaction->status ? sanitize_text_field($bp_transaction->status) : ''; |
| 138 |
$bp_helper_obj = new Helper(); |
| 139 |
$bp_transaction_status_color = $bp_helper_obj->get_color_by_transaction_status($bp_transaction_status_for_color, 'v2'); |
| 140 |
$td_status_btn_text_v2 = $bp_helper_obj->get_type_by_transaction_status($bp_transaction_status_for_color, 'v2'); |
| 141 |
|
| 142 |
$bp_transaction_status = $bp_transaction->status ? sanitize_text_field($bp_transaction->status) : esc_html__('N/A', 'better-payment'); |
| 143 |
?> |
| 144 |
<p class="" data-id="<?php echo esc_attr($bp_transaction->id) ?>"> <span style="color:#fff; padding:7px 15px; border-radius: 20px;background: <?php echo esc_attr($bp_transaction_status_color); ?>"><?php echo esc_html(ucfirst($td_status_btn_text_v2)); //$bp_transaction_status ?></span> </p> |
| 145 |
</div> |
| 146 |
<div class="table__col col__amount"> |
| 147 |
<?php $bp_payment_date = sanitize_text_field($bp_transaction->payment_date); ?> |
| 148 |
<?php $bp_payment_date = wp_date(get_option('date_format').' '.get_option('time_format'), strtotime($bp_payment_date)); ?> |
| 149 |
<p> <?php echo esc_html($bp_payment_date); ?> </p> |
| 150 |
</div> |
| 151 |
<div class="table__col col__action action-buttons"> |
| 152 |
<a href='<?php echo esc_url(admin_url("admin.php?page=better-payment-transactions&action=view&id={$bp_transaction->id}")); ?>' class="button button--sm view-button" data-id="<?php echo esc_attr($bp_transaction->id) ?>"><span title="<?php esc_attr_e('View', 'better-payment'); ?>" class="bp-icon bp-view font-bold"></span></a> |
| 153 |
<button class="button button--sm delete-button" data-id="<?php echo esc_attr( $bp_transaction->id ); ?>"><span title="<?php esc_attr_e('Delete', 'better-payment'); ?>" class="bp-icon bp-delete font-bold"></span></button> |
| 154 |
</div> |
| 155 |
</div> |
| 156 |
<?php endforeach; ?> |
| 157 |
|
| 158 |
<?php if (count($bp_admin_all_transactions) == 0) : ?> |
| 159 |
<div class="table__row"> |
| 160 |
<div class="table__col col__name"> |
| 161 |
<p class="text-center"> <?php echo esc_html__('No records found!', 'better-payment'); ?> </p> |
| 162 |
</div> |
| 163 |
</div> |
| 164 |
<?php endif; ?> |
| 165 |
</div> |
| 166 |
</div> |
| 167 |
|
| 168 |
<!-- Pagination Starts --> |
| 169 |
<div class="transaction-pagination pagination pt30"> |
| 170 |
<div class="bp-row"> |
| 171 |
<div class="bp-col-3"> |
| 172 |
<p class="showing-entities-html"> |
| 173 |
<select class="per-page" name="per_page" id=""> |
| 174 |
<option value="10" <?php echo 10 === $transaction_filter_per_page ? esc_attr('selected') : '' ?> ><?php esc_html_e('10', 'better-payment'); ?></option> |
| 175 |
<option value="20" <?php echo 20 === $transaction_filter_per_page ? esc_attr('selected') : '' ?> ><?php esc_html_e('20', 'better-payment'); ?></option> |
| 176 |
<option value="50" <?php echo 50 === $transaction_filter_per_page ? esc_attr('selected') : '' ?> ><?php esc_html_e('50', 'better-payment'); ?></option> |
| 177 |
<option value="100" <?php echo 100 === $transaction_filter_per_page ? esc_attr('selected') : '' ?> ><?php esc_html_e('100', 'better-payment'); ?></option> |
| 178 |
<option value="<?php echo esc_attr($bp_admin_all_transactions_count); ?>" <?php echo $bp_admin_all_transactions_count === $transaction_filter_per_page ? esc_attr('selected') : '' ?>>All</option> |
| 179 |
</select> |
| 180 |
<span><?php echo wp_kses( $paginations_showing_entities_html, wp_kses_allowed_html( 'post' ) ); ?></span> |
| 181 |
</p> |
| 182 |
</div> |
| 183 |
|
| 184 |
<div class="bp-col-9"> |
| 185 |
<?php echo wp_kses( $bp_admin_all_transactions_paginations, wp_kses_allowed_html( 'post' ) ); ?> |
| 186 |
</div> |
| 187 |
</div> |
| 188 |
</div> |
| 189 |
<!-- Pagination Ends --> |
| 190 |
</div> |