PluginProbe
Better Payment – Instant Payments, Donations, Fundraising with Subscriptions & More / 2.3.0
Better Payment – Instant Payments, Donations, Fundraising with Subscriptions & More v2.3.0
2.3.4 2.3.3 2.3.2 2.3.1 2.3.0 2.2.2 2.2.1 2.2.0 2.1.2 2.1.1 trunk 0.0.1 0.0.2 0.0.3 0.0.4 0.0.5 0.0.6 0.0.7 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 All 66 releases
better-payment / includes / Admin / views / elementor / user-dashboard / template-transactions-tab.php

template-transactions-tab.php in Better Payment – Instant Payments, Donations, Fundraising with Subscriptions & More 2.3.0, at includes/Admin/views/elementor/user-dashboard/template-transactions-tab.php

226 lines 14.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 use Better_Payment\Lite\Classes\Helper;
3
4 $bp_txn_result = $this->get_user_transactions( '', 1, 20 );
5 $transactions = $bp_txn_result['transactions'];
6 $bp_total_pages = $bp_txn_result['pages'];
7 $bp_current_page = 1;
8
9 ?>
10
11 <!-- Need to replace with action -->
12 <?php if ( $bp_settings['header_show'] ) : ?>
13 <div class="better-payment-user-dashboard-header bp--db-header bp-dashboard-header flex items-center justify-center">
14 <?php if ($bp_settings['sidebar_show']) : ?>
15 <div class="bp-dashboard-hamburger padding-0 bp-visible-xs">
16 <svg fill="none" viewBox="0 0 24 24" width="25" xmlns="http://www.w3.org/2000/svg"><path clip-rule="evenodd" d="m3 8c0-.55228.44772-1 1-1h16c.5523 0 1 .44772 1 1s-.4477 1-1 1h-16c-.55228 0-1-.44772-1-1zm0 4c0-.5523.44772-1 1-1h16c.5523 0 1 .4477 1 1s-.4477 1-1 1h-16c-.55228 0-1-.4477-1-1zm0 4c0-.5523.44772-1 1-1h8c.5523 0 1 .4477 1 1s-.4477 1-1 1h-8c-.55228 0-1-.4477-1-1z" fill="rgb(0,0,0)" fill-rule="evenodd"/></svg>
17 </div>
18 <?php endif; ?>
19 <h2><?php esc_html_e($bp_settings['transaction_label'], 'better-payment'); ?></h2>
20 <button class="primary-btn d-none"><a href="<?php echo esc_url( get_permalink() ); ?>">Refresh Stats</a></button>
21 </div>
22 <?php endif; ?>
23
24 <div class="bp--body-content">
25 <div class="bp--table-main-wrapper">
26 <?php
27 $bp_txn_col_settings = wp_json_encode( [
28 'name' => (bool) $bp_settings['transaction_table_name_show'],
29 'email' => (bool) $bp_settings['transaction_table_email_address_show'],
30 'amount' => (bool) $bp_settings['transaction_table_amount_show'],
31 'payment_type' => (bool) $bp_settings['transaction_table_payment_type_show'],
32 'transaction_id' => (bool) $bp_settings['transaction_table_transaction_id_show'],
33 'source' => (bool) $bp_settings['transaction_table_source_show'],
34 'status' => (bool) $bp_settings['transaction_table_status_show'],
35 'date' => (bool) $bp_settings['transaction_table_date_show'],
36 'action' => (bool) $bp_settings['transaction_table_action_show'],
37 'no_items_label' => $bp_settings['no_items_label'],
38 'admin_url' => admin_url( 'admin.php' ),
39 'assets_url' => BETTER_PAYMENT_ASSETS,
40 ] );
41 ?>
42 <div class="bp--table-wrapper transaction better-payment-user-dashboard-table"
43 data-bp-tab="transactions"
44 data-bp-total-pages="<?php echo esc_attr( $bp_total_pages ); ?>"
45 data-bp-per-page="20"
46 data-bp-settings="<?php echo esc_attr( $bp_txn_col_settings ); ?>">
47 <div class="better-payment-user-dashboard-table-header bp--table-header bp-min_width-1300 flex justify-between gap-1">
48 <?php if ( $bp_settings['transaction_table_name_show'] ) : ?>
49 <div class="th user-name details">
50 <h5><?php esc_html_e($bp_settings['transaction_table_name_label'], 'better-payment') ?></h5>
51 </div>
52 <?php endif; ?>
53
54 <?php if ( $bp_settings['transaction_table_email_address_show'] ) : ?>
55 <div class="th details email">
56 <h5><?php esc_html_e($bp_settings['transaction_table_email_address_label'], 'better-payment') ?></h5>
57 </div>
58 <?php endif; ?>
59
60 <?php if ( $bp_settings['transaction_table_amount_show'] ) : ?>
61 <div class="th details amount">
62 <h5><?php esc_html_e($bp_settings['transaction_table_amount_label'], 'better-payment') ?></h5>
63 </div>
64 <?php endif; ?>
65
66 <?php if ( $bp_settings['transaction_table_payment_type_show'] ) : ?>
67 <div class="th details">
68 <h5><?php esc_html_e($bp_settings['transaction_table_payment_type_label'], 'better-payment') ?></h5>
69 </div>
70 <?php endif; ?>
71
72 <?php if ( $bp_settings['transaction_table_transaction_id_show'] ) : ?>
73 <div class="th details transaction">
74 <h5><?php esc_html_e($bp_settings['transaction_table_transaction_id_label'], 'better-payment') ?></h5>
75 </div>
76 <?php endif; ?>
77
78 <?php if ( $bp_settings['transaction_table_source_show'] ) : ?>
79 <div class="th details flex justify-center">
80 <h5><?php esc_html_e($bp_settings['transaction_table_source_label'], 'better-payment') ?></h5>
81 </div>
82 <?php endif; ?>
83
84 <?php if ( $bp_settings['transaction_table_status_show'] ) : ?>
85 <div class="th details flex justify-center">
86 <h5><?php esc_html_e($bp_settings['transaction_table_status_label'], 'better-payment') ?></h5>
87 </div>
88 <?php endif; ?>
89
90 <?php if ( $bp_settings['transaction_table_date_show'] ) : ?>
91 <div class="th details flex justify-center">
92 <h5><?php esc_html_e($bp_settings['transaction_table_date_label'], 'better-payment') ?></h5>
93 </div>
94 <?php endif; ?>
95
96 <?php if ( $bp_settings['transaction_table_action_show'] ) : ?>
97 <div class="th details flex justify-center d-none">
98 <h5><?php esc_html_e($bp_settings['transaction_table_action_label'], 'better-payment') ?></h5>
99 </div>
100 <?php endif; ?>
101 </div>
102
103 <div class="bp--table-tbody">
104 <?php if ( is_array( $transactions ) && count($transactions)) : ?>
105 <?php
106 $bp_txn_counter = 0;
107 $allowed_sources = ['paypal', 'stripe', 'paystack'];
108 $td_source_image_url = BETTER_PAYMENT_ASSETS . '/img/stripe.svg';
109 $td_source_image_alt = 'Stripe';
110
111 foreach ($transactions as $bp_transaction) :
112 $bp_txn_counter++;
113 $bp_customer_info = maybe_unserialize($bp_transaction->customer_info); //obj
114 $bp_form_fields_info = maybe_unserialize($bp_transaction->form_fields_info); //array
115
116 $is_imported = ! empty( $bp_form_fields_info['is_imported'] ) && 1 === intval($bp_form_fields_info['is_imported']) ? 1 : 0;
117 $bp_transaction_customer_name = isset($bp_form_fields_info['primary_first_name']) ? sanitize_text_field($bp_form_fields_info['primary_first_name']) : '';
118 $bp_transaction_customer_name .= ' ';
119 $bp_transaction_customer_name .= isset($bp_form_fields_info['primary_last_name']) ? sanitize_text_field($bp_form_fields_info['primary_last_name']) : '';
120
121 //legacy
122 if( empty($bp_transaction_customer_name) || $bp_transaction_customer_name == ' ' ){
123 $bp_transaction_customer_name = isset($bp_form_fields_info['first_name']) ? sanitize_text_field($bp_form_fields_info['first_name']) : '';
124 $bp_transaction_customer_name .= ' ';
125 $bp_transaction_customer_name .= isset($bp_form_fields_info['last_name']) ? sanitize_text_field($bp_form_fields_info['last_name']) : '';
126 }
127
128 $bp_transaction_customer_email = isset($bp_form_fields_info['primary_email']) ? sanitize_text_field($bp_form_fields_info['primary_email']) : '';
129 //legacy
130 if( empty($bp_transaction_customer_email) ){
131 $bp_transaction_customer_email = isset($bp_form_fields_info['email']) ? sanitize_text_field($bp_form_fields_info['email']) : '';
132 }
133
134 $is_subscription = ! empty( $bp_form_fields_info['subscription_id'] ) ? 'Subscription' : 'One Time';
135 ?>
136 <div class="better-payment-user-dashboard-table-body bp--table-body bp-min_width-1300 flex items-center justify-between gap-1">
137 <?php
138 if ( $bp_settings['transaction_table_name_show'] ) : ?>
139 <div class="td details user-name flex items-center gap-3">
140 <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>
141 </div>
142 <?php endif; ?>
143
144 <?php if ( $bp_settings['transaction_table_email_address_show'] ) : ?>
145 <div class="td details email flex items-center gap-3">
146 <p> <span id="bp_email_copy_clipboard_input_<?php echo esc_html($bp_txn_counter); ?>"><?php echo esc_html($bp_transaction_customer_email); ?></span> <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> </p>
147 </div>
148 <?php endif; ?>
149
150 <?php if ( $bp_settings['transaction_table_amount_show'] ) : ?>
151 <div class="td details amount flex items-center gap-3">
152 <p> <?php echo esc_html($bp_transaction->currency) . ' ' . esc_html( floatval( $bp_transaction->amount ) ); ?> </p>
153 </div>
154 <?php endif; ?>
155
156 <?php if ( $bp_settings['transaction_table_payment_type_show'] ) : ?>
157 <div class="td details flex items-center gap-3">
158 <p> <?php echo esc_html($is_subscription); ?> </p>
159 </div>
160 <?php endif; ?>
161
162 <?php if ( $bp_settings['transaction_table_transaction_id_show'] ) : ?>
163 <div class="td details transaction flex items-center gap-3">
164 <?php $bp_transaction_id = sanitize_text_field($bp_transaction->transaction_id); ?>
165
166 <?php if( !empty($bp_transaction_id) ) : ?>
167 <p> <span id="bp_copy_clipboard_input_<?php echo esc_html($bp_txn_counter); ?>"><?php echo esc_html($bp_transaction_id); ?></span> <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> </p>
168 <?php endif; ?>
169 </div>
170 <?php endif; ?>
171
172 <?php if ( $bp_settings['transaction_table_source_show'] ) : ?>
173 <div class="td details flex justify-center gap-3">
174 <?php
175 if( in_array( strtolower( $bp_transaction->source ), $allowed_sources ) ){
176 $td_source_image_url = strtolower( $bp_transaction->source ) == 'paypal' ? BETTER_PAYMENT_ASSETS . '/img/paypal.png' : BETTER_PAYMENT_ASSETS . "/img/{$bp_transaction->source}.svg";
177 $td_source_image_alt = strtolower( $bp_transaction->source ) == 'paypal' ? 'PayPal' : ucfirst( $bp_transaction->source );
178 }
179 ?>
180 <img class="source--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 ); ?>" />
181 </div>
182 <?php endif; ?>
183
184 <?php if ( $bp_settings['transaction_table_status_show'] ) : ?>
185 <div class="td details flex justify-center gap-3">
186 <?php
187 $bp_transaction_status_for_color = $bp_transaction->status ? sanitize_text_field($bp_transaction->status) : '';
188 $bp_helper_obj = new Helper();
189 $bp_transaction_status_color = $bp_helper_obj->get_color_by_transaction_status($bp_transaction_status_for_color, 'v2');
190 $td_status_btn_text_v2 = $bp_helper_obj->get_type_by_transaction_status($bp_transaction_status_for_color, 'v2');
191
192 $bp_transaction_status = $bp_transaction->status ? sanitize_text_field($bp_transaction->status) : esc_html__('N/A', 'better-payment');
193 ?>
194 <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)); ?></span> </p>
195 </div>
196 <?php endif; ?>
197
198 <?php if ( $bp_settings['transaction_table_date_show'] ) : ?>
199 <div class="td details flex justify-center gap-3">
200 <?php $bp_payment_date = sanitize_text_field($bp_transaction->payment_date); ?>
201 <?php $bp_payment_date = wp_date(get_option('date_format').' '.get_option('time_format'), strtotime($bp_payment_date)); ?>
202 <p> <?php echo esc_html($bp_payment_date); ?> </p>
203 </div>
204 <?php endif; ?>
205
206 <?php if ( $bp_settings['transaction_table_action_show'] ) : ?>
207 <div class="td details flex justify-center d-none">
208 <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>
209 </div>
210 <?php endif; ?>
211
212 </div>
213 <?php $bp_txn_counter++; ?>
214 <?php endforeach; ?>
215 <?php else : ?>
216 <div class="flex justify-center m-5">
217 <p class="bp-no_subscription-text"><?php esc_html_e($bp_settings['no_items_label'], 'better-payment'); ?></p>
218 </div>
219 <?php endif; ?>
220 </div><!-- .bp--table-tbody -->
221
222 <div class="bp--pagination transaction-pagination pagination"></div>
223
224 </div>
225 </div>
226 </div>