| 1 |
<?php |
| 2 |
/* |
| 3 |
* Transactions list page |
| 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\Admin\DB; |
| 9 |
use Better_Payment\Lite\Classes\Helper; |
| 10 |
|
| 11 |
?> |
| 12 |
|
| 13 |
<?php |
| 14 |
$bp_admin_settings_total_transactions_count = isset($bp_admin_all_transactions_analytics['total_transactions']) ? $bp_admin_all_transactions_analytics['total_transactions'] : 0; |
| 15 |
$bp_admin_settings_completed_transactions_count = isset($bp_admin_all_transactions_analytics['completed_transactions']) ? $bp_admin_all_transactions_analytics['completed_transactions'] : 0; |
| 16 |
$bp_admin_settings_incomplete_transactions_count = isset($bp_admin_all_transactions_analytics['incomplete_transactions']) ? $bp_admin_all_transactions_analytics['incomplete_transactions'] : 0; |
| 17 |
|
| 18 |
$better_payment_db_obj = new DB(); |
| 19 |
$better_payment_helper_obj = new Helper(); |
| 20 |
|
| 21 |
$better_payment_allowed_statuses = (new DB())->allowed_statuses('all','v2'); |
| 22 |
$search_text = $args['search_text'] ? $args['search_text'] : ''; |
| 23 |
?> |
| 24 |
|
| 25 |
<div class="better-payment"> |
| 26 |
<div class="template__wrapper background__grey better-payment-admin-transactions-page"> |
| 27 |
<header class="pb30"> |
| 28 |
<div class="bp-container"> |
| 29 |
<div class="bp-row"> |
| 30 |
<div class="bp-col-9"> |
| 31 |
<div class="logo"> |
| 32 |
<a href="javascript:void(0)"><img src="<?php echo esc_url(BETTER_PAYMENT_ASSETS . '/img/logo.svg'); ?>" alt="Better Payment logo"></a> |
| 33 |
</div> |
| 34 |
</div> |
| 35 |
|
| 36 |
<div class="bp-col-3"> |
| 37 |
<p class="bp-transactions-import-export-wrapper"> |
| 38 |
<button class="button better-payment-transaction-import button__active"> <?php esc_html_e('Import Data', 'better-payment'); ?> </button> |
| 39 |
<button class="button better-payment-transaction-export button__active"> <?php esc_html_e('Export All', 'better-payment'); ?> </button> |
| 40 |
</p> |
| 41 |
</div> |
| 42 |
</div> |
| 43 |
</div> |
| 44 |
</header> |
| 45 |
|
| 46 |
<div class="bp-container better-payment-transaction-import-wrap mb-6 is-hidden"> |
| 47 |
<div class="bp-row"> |
| 48 |
<div class="bp-col"> |
| 49 |
<form action="<?php echo esc_url( admin_url('admin-post.php') ); ?>" method="POST" id="better-payment-transaction-import-form" enctype="multipart/form-data"> |
| 50 |
<?php wp_nonce_field('better_payment_transaction_import_nonce', 'nonce'); ?> |
| 51 |
<input type="hidden" name="action" value="better-payment-transactions-import" /> |
| 52 |
|
| 53 |
<div class="notification is-link is-light"> |
| 54 |
<div class="is-flex is-justify-content-center"> |
| 55 |
<div class="file has-name is-fullwidth is-medium"> |
| 56 |
<label class="file-label"> |
| 57 |
<input class="file-input better-payment-transaction-import-input" type="file" name="better-payment-transaction-import-input"> |
| 58 |
<span class="file-cta"> |
| 59 |
<span class="file-icon"> |
| 60 |
<i class="fa fa-upload"></i> |
| 61 |
</span> |
| 62 |
<span class="file-label"> |
| 63 |
<?php esc_html_e('Choose csv file…', 'better-payment'); ?> |
| 64 |
</span> |
| 65 |
</span> |
| 66 |
<span class="file-name"> |
| 67 |
<?php esc_html_e('No file chosen', 'better-payment'); ?> |
| 68 |
</span> |
| 69 |
</label> |
| 70 |
</div> |
| 71 |
|
| 72 |
<div> |
| 73 |
<input type="submit" class="button button__active better-payment-transaction-import-button" value="<?php esc_html_e('Let\'s Go!', 'better-payment'); ?>"> |
| 74 |
</div> |
| 75 |
</div> |
| 76 |
|
| 77 |
<div class="is-flex is-justify-content-center pt-4"> |
| 78 |
<p class="is-size-6"><?php esc_html_e('Upload any csv file that is exported from another site via Better Payment.', 'better-payment'); ?></p> |
| 79 |
</div> |
| 80 |
</div> |
| 81 |
</form> |
| 82 |
</div> |
| 83 |
</div> |
| 84 |
</div> |
| 85 |
|
| 86 |
<?php if ($notice = get_transient('better_payment_import_transactions_success')) : ?> |
| 87 |
<div class="bp-container better-payment-transaction-import-wrap mb-6"> |
| 88 |
<div class="bp-row"> |
| 89 |
<div class="bp-col"> |
| 90 |
<div class="notification is-link is-light"> |
| 91 |
<div class="is-flex is-justify-content-center"> |
| 92 |
<p class="is-size-6"><?php esc_html_e( $notice, 'better-payment' ); ?></p> |
| 93 |
</div> |
| 94 |
</div> |
| 95 |
</div> |
| 96 |
</div> |
| 97 |
</div> |
| 98 |
<?php delete_transient('better_payment_import_transactions_success'); ?> |
| 99 |
<?php elseif ($notice = get_transient('better_payment_import_transactions_error')) : ?> |
| 100 |
<div class="bp-container better-payment-transaction-import-wrap mb-6"> |
| 101 |
<div class="bp-row"> |
| 102 |
<div class="bp-col"> |
| 103 |
<div class="notification is-danger is-light"> |
| 104 |
<div class="is-flex is-justify-content-center"> |
| 105 |
<p class="is-size-6"><?php esc_html_e( $notice, 'better-payment' ); ?></p> |
| 106 |
</div> |
| 107 |
</div> |
| 108 |
</div> |
| 109 |
</div> |
| 110 |
</div> |
| 111 |
<?php delete_transient('better_payment_import_transactions_error'); ?> |
| 112 |
<?php endif; ?> |
| 113 |
|
| 114 |
<div class="bp-container"> |
| 115 |
<div class="bp-row"> |
| 116 |
<div class="bp-col-lg-4 bp-col-sm-6 bp-col"> |
| 117 |
<div class="statistic"> |
| 118 |
<div class="icon"> |
| 119 |
<i class="bp-icon bp-swap"></i> |
| 120 |
</div> |
| 121 |
<div class="statistic__body"> |
| 122 |
<h3 class="bp-stat-all-transactions-count"><?php esc_html_e($bp_admin_all_transactions_count, 'better-payment'); ?></h3> |
| 123 |
<p><?php esc_html_e('Total Transactions', 'better-payment'); ?></p> |
| 124 |
<p class="is-hidden" title="<?php esc_attr_e(sprintf('Transaction statuses: %s', $better_payment_helper_obj->arrayToString($better_payment_db_obj->allowed_statuses('all', 'v2'), ', ', ', NULL')), 'better-payment'); ?>"></p> |
| 125 |
</div> |
| 126 |
</div> |
| 127 |
</div> |
| 128 |
<div class="bp-col-lg-4 bp-col-sm-6 bp-col"> |
| 129 |
<div class="statistic"> |
| 130 |
<div class="icon"> |
| 131 |
<i class="bp-icon bp-list-check"></i> |
| 132 |
</div> |
| 133 |
<div class="statistic__body"> |
| 134 |
<h3 class="bp-stat-completed-transactions-count"><?php esc_html_e($bp_admin_completed_transactions_count, 'better-payment'); ?></h3> |
| 135 |
<p><?php esc_html_e('Completed Transactions', 'better-payment'); ?></p> |
| 136 |
<p class="is-hidden" title="<?php esc_attr_e(sprintf('Transaction statuses: %s', $better_payment_helper_obj->arrayToString($better_payment_db_obj->allowed_statuses('completed', 'v2'))), 'better-payment'); ?>"></p> |
| 137 |
</div> |
| 138 |
</div> |
| 139 |
</div> |
| 140 |
<div class="bp-col-lg-4 bp-col-sm-6 bp-col"> |
| 141 |
<div class="statistic"> |
| 142 |
<div class="icon"> |
| 143 |
<i class="bp-icon bp-server"></i> |
| 144 |
</div> |
| 145 |
<div class="statistic__body"> |
| 146 |
<h3 class="bp-stat-incomplete-transactions-count"><?php esc_html_e($bp_admin_incomplete_transactions_count, 'better-payment'); ?></h3> |
| 147 |
<p><?php esc_html_e('Incomplete Transactions', 'better-payment'); ?></p> |
| 148 |
<p class="is-hidden" title="<?php esc_attr_e(sprintf('Transaction statuses: %s', $better_payment_helper_obj->arrayToString($better_payment_db_obj->allowed_statuses('incomplete', 'v2'), ', ', ', NULL')), 'better-payment'); ?>"></p> |
| 149 |
</div> |
| 150 |
</div> |
| 151 |
</div> |
| 152 |
</div> |
| 153 |
<div class="bp-row"> |
| 154 |
<div class="bp-col"> |
| 155 |
<div class="transaction-filter-wrapper transactions fix-style"> |
| 156 |
<div class="transaction__filter"> |
| 157 |
<form action="#" id="better-payment-admin-settings-form"> |
| 158 |
<div class="mb20"> |
| 159 |
<label class="is-hidden"><?php esc_html_e('Search', 'better-payment'); ?></label> |
| 160 |
<div class="form__group"> |
| 161 |
<input name="search_text" type="text" class="form__control serch-text" placeholder="<?php esc_html_e('Search', 'better-payment'); ?>" value="<?php echo isset($search_text) ? esc_attr($search_text) : '' ?>" title="<?php esc_html_e('Search by email, amount, transaction id, source', 'better-payment'); ?>"> |
| 162 |
</div> |
| 163 |
</div> |
| 164 |
<div class="mb20"> |
| 165 |
<label class="is-hidden"> <?php esc_html_e('From Date', 'better-payment'); ?> </label> |
| 166 |
<div class="form__group"> |
| 167 |
<input name="payment_date_from1" type="text" class="form__control payment_date_from bp-datepicker1 bp_time_period-custom-range" placeholder="<?php esc_html_e('Date Range', 'better-payment'); ?>"> |
| 168 |
</div> |
| 169 |
</div> |
| 170 |
|
| 171 |
<div class="mb20 is-hidden"> |
| 172 |
<label class="is-hidden"> <?php esc_html_e('To Date', 'better-payment'); ?> </label> |
| 173 |
<div class="form__group is-hidden"> |
| 174 |
<input name="payment_date_to1" type="text" class="form__control payment_date_to bp-datepicker1" placeholder="<?php esc_html_e('To Date', 'better-payment'); ?>"> |
| 175 |
</div> |
| 176 |
</div> |
| 177 |
|
| 178 |
<div class="mb20"> |
| 179 |
<label class="is-hidden"> <?php esc_html_e('Status', 'better-payment'); ?> </label> |
| 180 |
<div class="bp-select fix-style"> |
| 181 |
<select name="status1" class="status1 is-hidden"> |
| 182 |
<option value="all" <?php echo $transaction_pagination_status === 'all' ? 'selected' : ''; ?>> <?php esc_html_e('All', 'better-payment'); ?> </option> |
| 183 |
<?php foreach ($better_payment_allowed_statuses as $better_payment_allowed_status) : ?> |
| 184 |
<?php |
| 185 |
$better_payment_allowed_status = NULL === $better_payment_allowed_status ? 'null' : $better_payment_allowed_status; |
| 186 |
if ( |
| 187 |
'completed' === $better_payment_allowed_status || |
| 188 |
'pending' === $better_payment_allowed_status |
| 189 |
) { |
| 190 |
continue; |
| 191 |
} |
| 192 |
?> |
| 193 |
<option value="<?php echo esc_attr($better_payment_allowed_status); ?>" <?php echo $transaction_pagination_status === $better_payment_allowed_status ? 'selected' : ''; ?>> <?php esc_html_e(('null' === $better_payment_allowed_status) ? 'N/A' : strtoupper($better_payment_allowed_status), 'better-payment'); ?> </option> |
| 194 |
<?php endforeach; ?> |
| 195 |
</select> |
| 196 |
|
| 197 |
<select name="status1" class="status1 is-hidden"> |
| 198 |
<option value="" selected disabled> <?php esc_html_e('Status', 'better-payment'); ?> </option> |
| 199 |
<option value="all" <?php echo $transaction_pagination_status === 'all' ? 'selected' : ''; ?>> <?php esc_html_e('All', 'better-payment'); ?> </option> |
| 200 |
<option value="completed" <?php echo $transaction_pagination_status === 'completed' ? 'selected' : ''; ?>> <?php esc_html_e('Completed', 'better-payment'); ?> </option> |
| 201 |
<option value="incomplete" <?php echo $transaction_pagination_status === 'incomplete' ? 'selected' : ''; ?>> <?php esc_html_e('Incomplete', 'better-payment'); ?> </option> |
| 202 |
<option value="refunded" <?php echo $transaction_pagination_status === 'refunded' ? 'selected' : ''; ?>> <?php esc_html_e('Refunded', 'better-payment'); ?> </option> |
| 203 |
|
| 204 |
</select> |
| 205 |
<?php |
| 206 |
$data = array(); |
| 207 |
$data['inputFieldName'] = 'status'; |
| 208 |
$data['inputFieldLabel'] = 'Status'; |
| 209 |
$data['dropdownDefaultValue'] = 'all'; |
| 210 |
$data['dropdownItems'] = array( |
| 211 |
'all' => 'All', |
| 212 |
'completed' => 'Completed', |
| 213 |
'incomplete' => 'Incomplete', |
| 214 |
'refunded' => 'Refunded', |
| 215 |
); |
| 216 |
?> |
| 217 |
<?php $better_payment_helper_obj->bp_template_render(BETTER_PAYMENT_ADMIN_VIEWS_PATH . "/partials/custom-dropdown.php", $data); ?> |
| 218 |
|
| 219 |
</div> |
| 220 |
</div> |
| 221 |
|
| 222 |
<div class="mb20"> |
| 223 |
<label class="is-hidden"><?php esc_html_e('Sort By', 'better-payment'); ?></label> |
| 224 |
<div class="bp-select"> |
| 225 |
<select name="order_by1" class="order-by1 is-hidden"> |
| 226 |
<option value="" selected disabled> <?php esc_html_e('Sort By', 'better-payment'); ?> </option> |
| 227 |
<option value="payment_date" <?php ($transaction_pagination_orderby === 'payment_date' || $transaction_pagination_orderby === 'id') ? 'selected' : ''; ?>> <?php esc_html_e('Payment Date', 'better-payment'); ?> </option> |
| 228 |
<option value="email" <?php $transaction_pagination_orderby === 'email' ? 'selected' : ''; ?>> <?php esc_html_e('Email Address', 'better-payment'); ?> </option> |
| 229 |
<option value="amount" <?php $transaction_pagination_orderby === 'amount' ? 'selected' : ''; ?>> <?php esc_html_e('Amount', 'better-payment'); ?> </option> |
| 230 |
<!-- <option value="status" <?php //$transaction_pagination_orderby === 'status' ? 'selected' : ''; |
| 231 |
?> > <?php //esc_html_e('Status', 'better-payment'); |
| 232 |
?> </option> --> |
| 233 |
</select> |
| 234 |
|
| 235 |
<?php |
| 236 |
$data = array(); |
| 237 |
$data['inputFieldName'] = 'order_by'; |
| 238 |
$data['inputFieldLabel'] = 'Order By'; |
| 239 |
$data['dropdownDefaultValue'] = ''; |
| 240 |
$data['dropdownItems'] = array( |
| 241 |
'payment_date' => 'Payment Date', |
| 242 |
'email' => 'Email', |
| 243 |
'amount' => 'Amount', |
| 244 |
); |
| 245 |
?> |
| 246 |
<?php $better_payment_helper_obj->bp_template_render(BETTER_PAYMENT_ADMIN_VIEWS_PATH . "/partials/custom-dropdown.php", $data); ?> |
| 247 |
</div> |
| 248 |
</div> |
| 249 |
<div class="mb20"> |
| 250 |
<label class="is-hidden"> <?php esc_html_e('Sort Order', 'better-payment'); ?> </label> |
| 251 |
<div class="bp-select"> |
| 252 |
<select name="order1" class="order1 is-hidden"> |
| 253 |
<option value="" selected disabled> <?php esc_html_e('Sort Order', 'better-payment'); ?> </option> |
| 254 |
<option value="DESC" <?php echo $transaction_pagination_order === 'DESC' ? 'selected' : ''; ?>> <?php esc_html_e('Descending', 'better-payment'); ?> </option> |
| 255 |
<option value="ASC" <?php echo $transaction_pagination_order === 'ASC' ? 'selected' : ''; ?>> <?php esc_html_e('Ascending', 'better-payment'); ?> </option> |
| 256 |
</select> |
| 257 |
|
| 258 |
<?php |
| 259 |
$data = array(); |
| 260 |
$data['inputFieldName'] = 'order'; |
| 261 |
$data['inputFieldLabel'] = 'Order'; |
| 262 |
$data['dropdownDefaultValue'] = ''; |
| 263 |
$data['dropdownItems'] = array( |
| 264 |
'DESC' => 'Descending', |
| 265 |
'ASC' => 'Ascending', |
| 266 |
); |
| 267 |
?> |
| 268 |
<?php $better_payment_helper_obj->bp_template_render(BETTER_PAYMENT_ADMIN_VIEWS_PATH . "/partials/custom-dropdown.php", $data); ?> |
| 269 |
</div> |
| 270 |
</div> |
| 271 |
<div class="mb20"> |
| 272 |
<label class="is-hidden"> <?php esc_html_e('Source', 'better-payment'); ?> </label> |
| 273 |
<div class="bp-select"> |
| 274 |
<select name="source1" class="source1 is-hidden"> |
| 275 |
<option value="" selected disabled> <?php esc_html_e('Source', 'better-payment'); ?> </option> |
| 276 |
<option value="paypal" <?php echo $transaction_pagination_source === 'paypal' ? 'selected' : ''; ?>> <?php esc_html_e('PayPal', 'better-payment'); ?> </option> |
| 277 |
<option value="stripe" <?php echo $transaction_pagination_source === 'stripe' ? 'selected' : ''; ?>> <?php esc_html_e('Stripe', 'better-payment'); ?> </option> |
| 278 |
<option value="paystack" <?php echo $transaction_pagination_source === 'paystack' ? 'selected' : ''; ?>> <?php esc_html_e('Paystack', 'better-payment'); ?> </option> |
| 279 |
</select> |
| 280 |
|
| 281 |
<?php |
| 282 |
$data = array(); |
| 283 |
$data['inputFieldName'] = 'source'; |
| 284 |
$data['inputFieldLabel'] = 'Source'; |
| 285 |
$data['dropdownDefaultValue'] = ''; |
| 286 |
$data['dropdownItems'] = array( |
| 287 |
'paypal' => 'PayPal', |
| 288 |
'stripe' => 'Stripe', |
| 289 |
'paystack' => 'Paystack', |
| 290 |
); |
| 291 |
?> |
| 292 |
<?php $better_payment_helper_obj->bp_template_render(BETTER_PAYMENT_ADMIN_VIEWS_PATH . "/partials/custom-dropdown.php", $data); ?> |
| 293 |
</div> |
| 294 |
</div> |
| 295 |
<button class="button button__active better-payment-transaction-filter"> <?php esc_html_e('Filter', 'better-payment'); ?> </button> |
| 296 |
<button class="button better-payment-transaction-reset"> <?php esc_html_e('Reset', 'better-payment'); ?> </button> |
| 297 |
|
| 298 |
<div class="bp-modal"> |
| 299 |
<div class="modal bp-custom-time-period"> |
| 300 |
<div class="modal-background"></div> |
| 301 |
<div class="modal-card"> |
| 302 |
<header class="modal-card-head"> |
| 303 |
<p class="modal-card-title is-size-5"><?php esc_html_e('Custom Date Range', 'better-payment'); ?></p> |
| 304 |
<button class="delete" aria-label="close"></button> |
| 305 |
</header> |
| 306 |
<section class="modal-card-body"> |
| 307 |
<div class="columns"> |
| 308 |
<div class="column"> |
| 309 |
<div class="columns"> |
| 310 |
<div class="column"> |
| 311 |
<p class="is-size-6"><?php esc_html_e('Start Date', 'better-payment'); ?></p> |
| 312 |
</div> |
| 313 |
|
| 314 |
<div class="column is-three-quarters"> |
| 315 |
<input class="form__control email-recipient-field bp-datepicker bp-time-period-start-date-custom" type="text" name="payment_date_from" value=""> |
| 316 |
<small class="email-recipient-field-note"><?php esc_html_e('Select start date of desired time period to see the analytics.', 'better-payment'); ?></small> |
| 317 |
</div> |
| 318 |
</div> |
| 319 |
</div> |
| 320 |
|
| 321 |
<div class="column"> |
| 322 |
<div class="columns"> |
| 323 |
<div class="column"> |
| 324 |
<p class="is-size-6"><?php esc_html_e('End Date', 'better-payment'); ?></p> |
| 325 |
</div> |
| 326 |
|
| 327 |
<div class="column is-three-quarters"> |
| 328 |
<input class="form__control email-recipient-field bp-datepicker bp-time-period-end-date-custom" type="text" name="payment_date_to" value=""> |
| 329 |
<small class="email-recipient-field-note"><?php esc_html_e('Select end date of desired time period to see the analytics.', 'better-payment'); ?></small> |
| 330 |
</div> |
| 331 |
</div> |
| 332 |
</div> |
| 333 |
</div> |
| 334 |
|
| 335 |
</section> |
| 336 |
<footer class="modal-card-foot"> |
| 337 |
<button class="button cancel-button mr-1 fix-common mb-0"><?php esc_html_e('Confirm', 'better-payment'); ?></button> |
| 338 |
<button class="button cancel-button fix-common mb-0"><?php esc_html_e('Cancel', 'better-payment'); ?></button> |
| 339 |
</footer> |
| 340 |
</div> |
| 341 |
</div> |
| 342 |
</div> |
| 343 |
|
| 344 |
</form> |
| 345 |
</div> |
| 346 |
</div> |
| 347 |
|
| 348 |
<?php include_once BETTER_PAYMENT_ADMIN_VIEWS_PATH . "/template-transaction-list.php"; ?> |
| 349 |
|
| 350 |
</div> |
| 351 |
</div> |
| 352 |
</div> |
| 353 |
</div> |
| 354 |
</div> |