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-dashboard-tab.php

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

240 lines 16.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 use Better_Payment\Lite\Admin\DB;
4
5 $current_user = wp_get_current_user();
6
7 if ( empty($email) ) {
8 $email = $current_user->user_email;
9 }
10
11 $transactions_analytics = DB::get_user_analytics_by_email( $email );
12
13 $total_transactions_count = isset($transactions_analytics['total_transactions_count']) ? $transactions_analytics['total_transactions_count'] : 0;
14 $completed_transactions_count = isset($transactions_analytics['completed_transactions_count']) ? $transactions_analytics['completed_transactions_count'] : 0;
15 $incomplete_transactions_count = isset($transactions_analytics['incomplete_transactions_count']) ? $transactions_analytics['incomplete_transactions_count'] : 0;
16 $refunded_transactions_count = isset($transactions_analytics['refunded_transactions_count']) ? $transactions_analytics['refunded_transactions_count'] : 0;
17
18 $total_transactions_amount = isset($transactions_analytics['total_transactions_amount']) ? number_format($transactions_analytics['total_transactions_amount'], 2) : 0;
19 $completed_transactions_amount = isset($transactions_analytics['completed_transactions_amount']) ? number_format($transactions_analytics['completed_transactions_amount'], 2) : 0;
20 $incomplete_transactions_amount = isset($transactions_analytics['incomplete_transactions_amount']) ? number_format($transactions_analytics['incomplete_transactions_amount'], 2) : 0;
21 $refunded_transactions_amount = isset($transactions_analytics['refunded_transactions_amount']) ? number_format($transactions_analytics['refunded_transactions_amount'], 2) : 0;
22
23 $transaction_amount_currency = isset($transaction_amount_currency) ? $transaction_amount_currency : '$';
24 ?>
25
26 <!-- Need to replace with action -->
27 <?php if ($bp_settings['header_show']) : ?>
28 <div class="better-payment-user-dashboard-header bp--db-header bp-dashboard-header flex items-center justify-center">
29 <?php if ($bp_settings['sidebar_show']) : ?>
30 <div class="bp-dashboard-hamburger padding-0 bp-visible-xs">
31 <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>
32 </div>
33 <?php endif; ?>
34 <h2><?php esc_html_e($bp_settings['dashboard_label'], 'better-payment'); ?></h2>
35 <button class="primary-btn bp-hidden-xs"><a href="<?php echo the_permalink(); ?>"><?php esc_html_e( $bp_settings['refresh_stats_label'], 'better-payment' ); ?></a></button>
36 </div>
37 <?php endif; ?>
38
39 <div class="bp-dashboard_wrapper">
40 <div class="bp-amount_wrapper">
41 <?php if ($bp_settings['dashboard_transaction_summary_show']) : ?>
42 <div class="bp-row">
43 <div class="bp-col_4 bp-col">
44 <div class="bp-amount">
45 <h4 class="mb-0 pb-0"><?php esc_html_e($bp_settings['dashboard_total_amount_label'], 'better-payment'); ?></h4>
46 <div class="bp-amount_price mb-0 pb-0">
47 <span><?php printf('%s%s', esc_html( $transaction_amount_currency ), esc_html( $total_transactions_amount ) ); ?></span>
48 </div>
49 <div class="bp-transaction">
50 <span class="bp-transaction_title">No of Transaction:</span>
51 <span class="bp-transaction_number"> <?php printf('%s', esc_html( $total_transactions_count ) ); ?></span>
52 </div>
53 </div>
54 </div>
55 <div class="bp-col_4 bp-col">
56 <div class="bp-amount">
57 <h4 class="mb-0 pb-0"><?php esc_html_e($bp_settings['dashboard_completed_amount_label'], 'better-payment'); ?></h4>
58 <div class="bp-amount_price mb-0 pb-0">
59 <span><?php printf('%s%s', esc_html( $transaction_amount_currency ), esc_html( $completed_transactions_amount ) ); ?></span>
60 </div>
61 <div class="bp-transaction">
62 <span class="bp-transaction_title">No of Transaction:</span>
63 <span class="bp-transaction_number"> <?php printf('%s', esc_html( $completed_transactions_count ) ); ?></span>
64 </div>
65 </div>
66 </div>
67 <div class="bp-col_4 bp-col">
68 <div class="bp-amount">
69 <h4 class="mb-0 pb-0"><?php esc_html_e($bp_settings['dashboard_incomplete_amount_label'], 'better-payment'); ?></h4>
70 <div class="bp-amount_price mb-0 pb-0">
71 <span><?php printf('%s%s', esc_html( $transaction_amount_currency ), esc_html( $incomplete_transactions_amount ) ); ?></span>
72 </div>
73 <div class="bp-transaction">
74 <span class="bp-transaction_title">No of Transaction:</span>
75 <span class="bp-transaction_number"> <?php printf('%s', esc_html( $incomplete_transactions_count ) ); ?></span>
76 </div>
77 </div>
78 </div>
79 <div class="bp-col_4 bp-col">
80 <div class="bp-amount">
81 <h4 class="mb-0 pb-0"><?php esc_html_e($bp_settings['dashboard_refunded_amount_label'], 'better-payment'); ?></h4>
82 <div class="bp-amount_price mb-0 pb-0">
83 <span><?php printf('%s%s', esc_html( $transaction_amount_currency ), esc_html( $refunded_transactions_amount ) ); ?></span>
84 </div>
85 <div class="bp-transaction">
86 <span class="bp-transaction_title">No of Transaction:</span>
87 <span class="bp-transaction_number"> <?php printf('%s', esc_html( $refunded_transactions_count ) ); ?></span>
88 </div>
89 </div>
90 </div>
91
92 </div>
93 <?php endif; ?>
94 </div>
95
96 <div class="bp-analytics_chart-wrapper">
97 <div class="bp-row">
98 <?php if ($bp_settings['dashboard_analytics_report_show']) : ?>
99 <?php if ( ( ! $this->pro_enabled ) && current_user_can('manage_options') ) : ?>
100 <div class="bp-col_10 bp-col">
101 <a class="bp-analytics_reports" target="_blank" href="//wpdeveloper.com/in/upgrade-better-payment-pro" >
102 <img width="100%" src="<?php echo esc_url(BETTER_PAYMENT_ASSETS . '/img/' . 'user-dashboard-analytics-reports-pro-banner.png'); ?>" alt="user-dashboard-analytics-reports-pro-banner">
103 </a>
104 </div>
105 <?php endif; ?>
106
107 <?php do_action('better_payment/widget/user-dashboard/dashboard_tab_analytics_reports', $settings, $bp_settings); ?>
108 <?php endif; ?>
109
110 <?php if ($bp_settings['dashboard_recent_transactions_show']) : ?>
111 <div class="bp-col_4 bp-col">
112 <div class="bp-recent_box">
113 <div class="bp-recent_header flex justify-between items-center">
114 <div class="flex gap-2 items-center">
115 <span>
116 <svg width="20" height="21" viewBox="0 0 20 21" fill="none"
117 xmlns="http://www.w3.org/2000/svg">
118 <path
119 d="M13.9586 2.16663H6.03361C5.06788 2.16663 4.58502 2.16663 4.19558 2.30213C3.45711 2.55909 2.87733 3.15595 2.62772 3.91618C2.49609 4.31708 2.49609 4.81417 2.49609 5.80834V17.4785C2.49609 18.1937 3.31692 18.5731 3.83617 18.098C4.14124 17.8188 4.60095 17.8188 4.90601 18.098L5.30859 18.4664C5.84325 18.9556 6.64894 18.9556 7.18359 18.4664C7.71825 17.9771 8.52394 17.9771 9.05859 18.4664C9.59325 18.9556 10.3989 18.9556 10.9336 18.4664C11.4682 17.9771 12.2739 17.9771 12.8086 18.4664C13.3432 18.9556 14.1489 18.9556 14.6836 18.4664L15.0862 18.098C15.3912 17.8188 15.8509 17.8188 16.156 18.098C16.6753 18.5731 17.4961 18.1937 17.4961 17.4785V5.80834C17.4961 4.81417 17.4961 4.31708 17.3645 3.91618C17.1149 3.15595 16.5351 2.55909 15.7966 2.30213C15.4072 2.16663 14.9243 2.16663 13.9586 2.16663Z"
120 stroke="#475467" stroke-width="1.25" />
121 <path d="M8.74609 9.66663L14.1628 9.66663" stroke="#475467"
122 stroke-width="1.25" stroke-linecap="round" />
123 <path d="M5.8291 9.66663H6.24577" stroke="#475467" stroke-width="1.25"
124 stroke-linecap="round" />
125 <path d="M5.8291 6.75H6.24577" stroke="#475467" stroke-width="1.25"
126 stroke-linecap="round" />
127 <path d="M5.8291 12.5834H6.24577" stroke="#475467" stroke-width="1.25"
128 stroke-linecap="round" />
129 <path d="M8.74609 6.75H14.1628" stroke="#475467" stroke-width="1.25"
130 stroke-linecap="round" />
131 <path d="M8.74609 12.5834H14.1628" stroke="#475467" stroke-width="1.25"
132 stroke-linecap="round" />
133 </svg>
134
135 </span>
136 <h3 class="bp-recent_header-title"><?php esc_html_e($bp_settings['dashboard_recent_transactions_label'], 'better-payment'); ?></h3>
137 </div>
138
139 <a href="#" class="bp-view_all-btn is-hidden"><?php esc_html_e($bp_settings['dashboard_view_all_label'], 'better-payment'); ?></a>
140 </div>
141
142 <div class="bp-recent_body">
143 <div class="bp-th flex items-center">
144 <div class="w-195">
145 <h5>Transaction</h5>
146 </div>
147
148 <div class="w-80">
149 <h5>Amount</h5>
150 </div>
151 </div>
152 <div class="bp-product_scroll">
153 <?php
154 $bp_txn_counter = 0;
155 $allowed_sources = ['paypal', 'stripe', 'paystack'];
156 $td_source_image_url = BETTER_PAYMENT_ASSETS . '/img/stripe.svg';
157 $td_source_image_alt = 'Stripe';
158 ?>
159 <?php $recent_transactions = DB::get_user_transactions_paginated( $email, [ 'page' => 1, 'per_page' => 5 ] )['transactions']; ?>
160 <?php if ( is_array( $recent_transactions ) && count( $recent_transactions ) ) : ?>
161 <?php foreach( $recent_transactions as $user_transaction ) : ?>
162 <div class="bp-td flex items-center">
163 <div class="td-product flex items-start w-195 flex-col">
164 <div class="td-product_logo">
165 <?php
166 if( in_array( strtolower( $user_transaction->source ), $allowed_sources ) ){
167 $image_url = strtolower( $user_transaction->source ) == 'paypal' ? BETTER_PAYMENT_ASSETS . '/img/paypal.png' : BETTER_PAYMENT_ASSETS . "/img/{$user_transaction->source}.svg";
168 $image_alt = strtolower( $user_transaction->source ) == 'paypal' ? 'PayPal' : ucfirst( $user_transaction->source );
169 }
170 ?>
171 <img src="<?php echo esc_url($image_url) ?>" title="<?php echo esc_attr( $image_alt ); ?>" alt="<?php echo esc_attr( $image_alt ); ?>">
172 </div>
173
174 <div class="td-product_info">
175 <h4 class="td-product_name">
176 <!-- #TODO same id on transaction tab too. fix duplicate id issue -->
177 <!-- <?php //$user_transaction_id = sanitize_text_field($user_transaction->transaction_id); ?>
178
179 <?php //if( !empty($user_transaction_id) ) : ?>
180 <span id="bp_copy_clipboard_input_<?php //echo esc_html($bp_txn_counter); ?>"><?php //echo esc_html($user_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>
181 <?php //endif; ?> -->
182
183 <?php $payment_date = sanitize_text_field( $user_transaction->payment_date ); ?>
184 <?php $payment_date = wp_date(get_option('date_format'), strtotime( $payment_date ) ); ?>
185 <?php echo esc_html( $payment_date ); ?>
186 <?php //echo esc_html( $user_transaction->status ); ?>
187 </h4>
188 <!-- <p class="td-details">
189 <?php //$payment_date = sanitize_text_field( $user_transaction->payment_date ); ?>
190 <?php //$payment_date = wp_date(get_option('date_format'), strtotime( $payment_date ) ); ?>
191 <?php //echo esc_html( $payment_date ); ?>
192 </p> -->
193 </div>
194 </div>
195
196 <div class="td-product_price w-80">
197 <span><?php echo esc_html($user_transaction->currency) . ' ' . esc_html( floatval( $user_transaction->amount ) ); ?></span>
198 </div>
199 </div>
200 <?php endforeach; ?>
201 <?php endif; ?>
202 </div>
203 </div>
204 </div>
205 </div>
206 <?php endif; ?>
207
208 </div>
209
210 </div>
211
212 <div class="bp-subscription_wrapper">
213 <div class="bp-row">
214 <?php if ($bp_settings['dashboard_recurring_subscription_show']) : ?>
215 <?php if ( ( ! $this->pro_enabled ) && current_user_can('manage_options') ) : ?>
216 <div class="bp-col_7 bp-col ">
217 <a class="width-100" target="_blank" href="//wpdeveloper.com/in/upgrade-better-payment-pro">
218 <img width="100%" src="<?php echo esc_url(BETTER_PAYMENT_ASSETS . '/img/' . 'user-dashboard-recurring-subscription-pro-banner.png'); ?>" alt="user-dashboard-recurring-subscriptions-pro-banner">
219 </a>
220 </div>
221 <?php endif; ?>
222
223 <?php do_action('better_payment/widget/user-dashboard/dashboard_tab_recurring_subscriptions', $settings, $bp_settings); ?>
224 <?php endif; ?>
225
226 <?php if ($bp_settings['dashboard_split_subscription_show']) : ?>
227 <?php if ( ( ! $this->pro_enabled ) && current_user_can('manage_options') ) : ?>
228 <div class=" bp-col_7 bp-col">
229 <a class="width-100" target="_blank" href="//wpdeveloper.com/in/upgrade-better-payment-pro">
230 <img width="100%" src="<?php echo esc_url(BETTER_PAYMENT_ASSETS . '/img/' . 'user-dashboard-split-subscription-pro-banner.png'); ?>" alt="user-dashboard-split-subscriptions-pro-banner">
231 </a>
232 </div>
233 <?php endif; ?>
234
235 <?php do_action('better_payment/widget/user-dashboard/dashboard_tab_split_subscriptions', $settings, $bp_settings); ?>
236 <?php endif; ?>
237 </div>
238 </div>
239
240 </div>