| 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\Better_Payment_DB; |
| 9 |
use Better_Payment\Lite\Classes\Better_Payment_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 Better_Payment_DB(); |
| 19 |
$better_payment_helper_obj = new Better_Payment_Helper(); |
| 20 |
|
| 21 |
$better_payment_allowed_statuses = (new Better_Payment_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=""></a> |
| 33 |
</div> |
| 34 |
</div> |
| 35 |
|
| 36 |
<div class="bp-col-3"> |
| 37 |
<p class="has-text-right"> |
| 38 |
<button class="button better-payment-transaction-export button__active"> <?php _e('Export All', 'better-payment'); ?> </button> |
| 39 |
</p> |
| 40 |
</div> |
| 41 |
</div> |
| 42 |
</div> |
| 43 |
</header> |
| 44 |
|
| 45 |
<div class="bp-container"> |
| 46 |
<div class="bp-row"> |
| 47 |
<div class="bp-col-lg-4 bp-col-sm-6 bp-col"> |
| 48 |
<div class="statistic"> |
| 49 |
<div class="icon"> |
| 50 |
<i class="bp-icon bp-swap"></i> |
| 51 |
</div> |
| 52 |
<div class="statistic__body"> |
| 53 |
<h3 class="bp-stat-all-transactions-count"><?php _e($bp_admin_all_transactions_count, 'better-payment'); ?></h3> |
| 54 |
<p><?php _e('Total Transactions', 'better-payment'); ?></p> |
| 55 |
<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> |
| 56 |
</div> |
| 57 |
</div> |
| 58 |
</div> |
| 59 |
<div class="bp-col-lg-4 bp-col-sm-6 bp-col"> |
| 60 |
<div class="statistic"> |
| 61 |
<div class="icon"> |
| 62 |
<i class="bp-icon bp-list-check"></i> |
| 63 |
</div> |
| 64 |
<div class="statistic__body"> |
| 65 |
<h3 class="bp-stat-completed-transactions-count"><?php _e($bp_admin_completed_transactions_count, 'better-payment'); ?></h3> |
| 66 |
<p><?php _e('Completed Transactions', 'better-payment'); ?></p> |
| 67 |
<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> |
| 68 |
</div> |
| 69 |
</div> |
| 70 |
</div> |
| 71 |
<div class="bp-col-lg-4 bp-col-sm-6 bp-col"> |
| 72 |
<div class="statistic"> |
| 73 |
<div class="icon"> |
| 74 |
<i class="bp-icon bp-server"></i> |
| 75 |
</div> |
| 76 |
<div class="statistic__body"> |
| 77 |
<h3 class="bp-stat-incomplete-transactions-count"><?php _e($bp_admin_incomplete_transactions_count, 'better-payment'); ?></h3> |
| 78 |
<p ><?php _e('Incomplete Transactions', 'better-payment'); ?></p> |
| 79 |
<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> |
| 80 |
</div> |
| 81 |
</div> |
| 82 |
</div> |
| 83 |
</div> |
| 84 |
<div class="bp-row"> |
| 85 |
<div class="bp-col"> |
| 86 |
<div class="transaction-filter-wrapper transactions fix-style"> |
| 87 |
<div class="transaction__filter"> |
| 88 |
<form action="#" id="better-payment-admin-settings-form"> |
| 89 |
<div class="mb20"> |
| 90 |
<label class="is-hidden" for="#"><?php _e('Search', 'better-payment'); ?></label> |
| 91 |
<div class="form__group"> |
| 92 |
<input name="search_text" type="text" class="form__control serch-text" placeholder="<?php _e('Search', 'better-payment'); ?>" value="<?php echo isset($search_text) ? esc_attr($search_text) : '' ?>" title="<?php _e('Search by email, amount, transaction id, source', 'better-payment'); ?>" > |
| 93 |
</div> |
| 94 |
</div> |
| 95 |
<div class="mb20"> |
| 96 |
<label class="is-hidden" for="#"> <?php _e('From Date', 'better-payment'); ?> </label> |
| 97 |
<div class="form__group"> |
| 98 |
<input name="payment_date_from1" type="text" class="form__control payment_date_from bp-datepicker1 bp_time_period-custom-range" placeholder="<?php _e('Date Range', 'better-payment'); ?>"> |
| 99 |
</div> |
| 100 |
</div> |
| 101 |
|
| 102 |
<div class="mb20 is-hidden"> |
| 103 |
<label class="is-hidden" for="#"> <?php _e('To Date', 'better-payment'); ?> </label> |
| 104 |
<div class="form__group is-hidden"> |
| 105 |
<input name="payment_date_to1" type="text" class="form__control payment_date_to bp-datepicker1" placeholder="<?php _e('To Date', 'better-payment'); ?>"> |
| 106 |
</div> |
| 107 |
</div> |
| 108 |
|
| 109 |
<div class="mb20"> |
| 110 |
<label class="is-hidden" for="#"> <?php _e('Status', 'better-payment'); ?> </label> |
| 111 |
<div class="bp-select fix-style"> |
| 112 |
<select name="status1" class="status1 is-hidden"> |
| 113 |
<option value="all" <?php echo $transaction_pagination_status === 'all' ? 'selected' : ''; ?> > <?php _e('All', 'better-payment'); ?> </option> |
| 114 |
<?php foreach($better_payment_allowed_statuses as $better_payment_allowed_status): ?> |
| 115 |
<?php |
| 116 |
$better_payment_allowed_status = NULL === $better_payment_allowed_status ? 'null' : $better_payment_allowed_status; |
| 117 |
if( |
| 118 |
'completed' === $better_payment_allowed_status || |
| 119 |
'pending' === $better_payment_allowed_status |
| 120 |
){ |
| 121 |
continue; |
| 122 |
} |
| 123 |
?> |
| 124 |
<option value="<?php esc_attr_e($better_payment_allowed_status); ?>" <?php echo $transaction_pagination_status === $better_payment_allowed_status ? 'selected' : ''; ?> > <?php _e( ('null' === $better_payment_allowed_status) ? 'N/A' : strtoupper($better_payment_allowed_status), 'better-payment'); ?> </option> |
| 125 |
<?php endforeach; ?> |
| 126 |
</select> |
| 127 |
|
| 128 |
<select name="status1" class="status1 is-hidden"> |
| 129 |
<option value="" selected disabled> <?php _e('Status', 'better-payment'); ?> </option> |
| 130 |
<option value="all" <?php echo $transaction_pagination_status === 'all' ? 'selected' : ''; ?> > <?php _e('All', 'better-payment'); ?> </option> |
| 131 |
<option value="completed" <?php echo $transaction_pagination_status === 'completed' ? 'selected' : ''; ?> > <?php _e('Completed', 'better-payment'); ?> </option> |
| 132 |
<option value="incomplete" <?php echo $transaction_pagination_status === 'incomplete' ? 'selected' : ''; ?> > <?php _e('Incomplete', 'better-payment'); ?> </option> |
| 133 |
<option value="refunded" <?php echo $transaction_pagination_status === 'refunded' ? 'selected' : ''; ?> > <?php _e('Refunded', 'better-payment'); ?> </option> |
| 134 |
|
| 135 |
</select> |
| 136 |
<?php |
| 137 |
$data = array(); |
| 138 |
$data['inputFieldName'] = 'status'; |
| 139 |
$data['inputFieldLabel'] = 'Status'; |
| 140 |
$data['dropdownDefaultValue'] = 'all'; |
| 141 |
$data['dropdownItems'] = array( |
| 142 |
'all' => 'All', |
| 143 |
'completed' => 'Completed', |
| 144 |
'incomplete' => 'Incomplete', |
| 145 |
'refunded' => 'Refunded', |
| 146 |
); |
| 147 |
?> |
| 148 |
<?php $better_payment_helper_obj->bp_template_render(BETTER_PAYMENT_ADMIN_VIEWS_PATH . "/partials/custom-dropdown.php", $data); ?> |
| 149 |
|
| 150 |
</div> |
| 151 |
</div> |
| 152 |
|
| 153 |
<div class="mb20"> |
| 154 |
<label class="is-hidden" for="#"><?php _e('Sort By', 'better-payment'); ?></label> |
| 155 |
<div class="bp-select"> |
| 156 |
<select name="order_by1" class="order-by1 is-hidden"> |
| 157 |
<option value="" selected disabled> <?php _e('Sort By', 'better-payment'); ?> </option> |
| 158 |
<option value="payment_date" <?php ( $transaction_pagination_orderby === 'payment_date' || $transaction_pagination_orderby === 'id' ) ? 'selected' : ''; ?> > <?php _e('Payment Date', 'better-payment'); ?> </option> |
| 159 |
<option value="email" <?php $transaction_pagination_orderby === 'email' ? 'selected' : ''; ?> > <?php _e('Email Address', 'better-payment'); ?> </option> |
| 160 |
<option value="amount" <?php $transaction_pagination_orderby === 'amount' ? 'selected' : ''; ?> > <?php _e('Amount', 'better-payment'); ?> </option> |
| 161 |
<!-- <option value="status" <?php //$transaction_pagination_orderby === 'status' ? 'selected' : ''; ?> > <?php //_e('Status', 'better-payment'); ?> </option> --> |
| 162 |
</select> |
| 163 |
|
| 164 |
<?php |
| 165 |
$data = array(); |
| 166 |
$data['inputFieldName'] = 'order_by'; |
| 167 |
$data['inputFieldLabel'] = 'Order By'; |
| 168 |
$data['dropdownDefaultValue'] = ''; |
| 169 |
$data['dropdownItems'] = array( |
| 170 |
'payment_date' => 'Payment Date', |
| 171 |
'email' => 'Email', |
| 172 |
'amount' => 'Amount', |
| 173 |
); |
| 174 |
?> |
| 175 |
<?php $better_payment_helper_obj->bp_template_render(BETTER_PAYMENT_ADMIN_VIEWS_PATH . "/partials/custom-dropdown.php", $data); ?> |
| 176 |
</div> |
| 177 |
</div> |
| 178 |
<div class="mb20"> |
| 179 |
<label class="is-hidden" for="#"> <?php _e('Sort Order', 'better-payment'); ?> </label> |
| 180 |
<div class="bp-select"> |
| 181 |
<select name="order1" class="order1 is-hidden"> |
| 182 |
<option value="" selected disabled> <?php _e('Sort Order', 'better-payment'); ?> </option> |
| 183 |
<option value="DESC" <?php echo $transaction_pagination_order === 'DESC' ? 'selected' : ''; ?> > <?php _e('Descending', 'better-payment'); ?> </option> |
| 184 |
<option value="ASC" <?php echo $transaction_pagination_order === 'ASC' ? 'selected' : ''; ?> > <?php _e('Ascending', 'better-payment'); ?> </option> |
| 185 |
</select> |
| 186 |
|
| 187 |
<?php |
| 188 |
$data = array(); |
| 189 |
$data['inputFieldName'] = 'order'; |
| 190 |
$data['inputFieldLabel'] = 'Order'; |
| 191 |
$data['dropdownDefaultValue'] = ''; |
| 192 |
$data['dropdownItems'] = array( |
| 193 |
'DESC' => 'Descending', |
| 194 |
'ASC' => 'Ascending', |
| 195 |
); |
| 196 |
?> |
| 197 |
<?php $better_payment_helper_obj->bp_template_render(BETTER_PAYMENT_ADMIN_VIEWS_PATH . "/partials/custom-dropdown.php", $data); ?> |
| 198 |
</div> |
| 199 |
</div> |
| 200 |
<div class="mb20"> |
| 201 |
<label class="is-hidden" for="#"> <?php _e('Source', 'better-payment'); ?> </label> |
| 202 |
<div class="bp-select"> |
| 203 |
<select name="source1" class="source1 is-hidden"> |
| 204 |
<option value="" selected disabled> <?php _e('Source', 'better-payment'); ?> </option> |
| 205 |
<option value="paypal" <?php echo $transaction_pagination_source === 'paypal' ? 'selected' : ''; ?> > <?php _e('PayPal', 'better-payment'); ?> </option> |
| 206 |
<option value="stripe" <?php echo $transaction_pagination_source === 'stripe' ? 'selected' : ''; ?> > <?php _e('Stripe', 'better-payment'); ?> </option> |
| 207 |
</select> |
| 208 |
|
| 209 |
<?php |
| 210 |
$data = array(); |
| 211 |
$data['inputFieldName'] = 'source'; |
| 212 |
$data['inputFieldLabel'] = 'Source'; |
| 213 |
$data['dropdownDefaultValue'] = ''; |
| 214 |
$data['dropdownItems'] = array( |
| 215 |
'paypal' => 'PayPal', |
| 216 |
'stripe' => 'Stripe', |
| 217 |
); |
| 218 |
?> |
| 219 |
<?php $better_payment_helper_obj->bp_template_render(BETTER_PAYMENT_ADMIN_VIEWS_PATH . "/partials/custom-dropdown.php", $data); ?> |
| 220 |
</div> |
| 221 |
</div> |
| 222 |
<button class="button button__active better-payment-transaction-filter"> <?php _e('Filter', 'better-payment'); ?> </button> |
| 223 |
<button class="button better-payment-transaction-reset"> <?php _e('Reset', 'better-payment'); ?> </button> |
| 224 |
|
| 225 |
<div class="bp-modal"> |
| 226 |
<div class="modal bp-custom-time-period"> |
| 227 |
<div class="modal-background"></div> |
| 228 |
<div class="modal-card"> |
| 229 |
<header class="modal-card-head"> |
| 230 |
<p class="modal-card-title is-size-5"><?php esc_html_e('Custom Date Range', 'better-payment'); ?></p> |
| 231 |
<button class="delete" aria-label="close"></button> |
| 232 |
</header> |
| 233 |
<section class="modal-card-body"> |
| 234 |
<div class="columns"> |
| 235 |
<div class="column"> |
| 236 |
<div class="columns"> |
| 237 |
<div class="column"> |
| 238 |
<p class="is-size-6"><?php esc_html_e('Start Date', 'better-payment'); ?></p> |
| 239 |
</div> |
| 240 |
|
| 241 |
<div class="column is-three-quarters"> |
| 242 |
<input class="form__control email-recipient-field bp-datepicker bp-time-period-start-date-custom" type="text" name="payment_date_from" value=""> |
| 243 |
<small class="email-recipient-field-note"><?php esc_html_e('Select start date of desired time period to see the analytics.', 'better-payment'); ?></small> |
| 244 |
</div> |
| 245 |
</div> |
| 246 |
</div> |
| 247 |
|
| 248 |
<div class="column"> |
| 249 |
<div class="columns"> |
| 250 |
<div class="column"> |
| 251 |
<p class="is-size-6"><?php esc_html_e('End Date', 'better-payment'); ?></p> |
| 252 |
</div> |
| 253 |
|
| 254 |
<div class="column is-three-quarters"> |
| 255 |
<input class="form__control email-recipient-field bp-datepicker bp-time-period-end-date-custom" type="text" name="payment_date_to" value=""> |
| 256 |
<small class="email-recipient-field-note"><?php esc_html_e('Select end date of desired time period to see the analytics.', 'better-payment'); ?></small> |
| 257 |
</div> |
| 258 |
</div> |
| 259 |
</div> |
| 260 |
</div> |
| 261 |
|
| 262 |
</section> |
| 263 |
<footer class="modal-card-foot"> |
| 264 |
<button class="button cancel-button mr-1 fix-common mb-0"><?php esc_html_e('Confirm', 'better-payment'); ?></button> |
| 265 |
<button class="button cancel-button fix-common mb-0"><?php esc_html_e('Cancel', 'better-payment'); ?></button> |
| 266 |
</footer> |
| 267 |
</div> |
| 268 |
</div> |
| 269 |
</div> |
| 270 |
|
| 271 |
</form> |
| 272 |
</div> |
| 273 |
</div> |
| 274 |
|
| 275 |
<?php include_once BETTER_PAYMENT_ADMIN_VIEWS_PATH . "/template-transaction-list.php"; ?> |
| 276 |
|
| 277 |
</div> |
| 278 |
</div> |
| 279 |
</div> |
| 280 |
</div> |
| 281 |
</div> |