PluginProbe
Better Payment – Instant Payments, Donations, Fundraising with Subscriptions & More / 2.2.0
Better Payment – Instant Payments, Donations, Fundraising with Subscriptions & More v2.2.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 / Elementor / User_Dashboard.php

User_Dashboard.php in Better Payment – Instant Payments, Donations, Fundraising with Subscriptions & More 2.2.0, at includes/Admin/Elementor/User_Dashboard.php

2,162 lines 76.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Better_Payment\Lite\Admin\Elementor;
4
5 use Better_Payment\Lite\Admin\DB;
6 use Better_Payment\Lite\Classes\Handler;
7 use Better_Payment\Lite\Classes\Helper as ClassesHelper;
8 use Better_Payment\Lite\Traits\Helper;
9 use \Elementor\Controls_Manager as Controls_Manager;
10 use Elementor\Core\Kits\Documents\Tabs\Global_Typography;
11 use Elementor\Group_Control_Background;
12 use Elementor\Group_Control_Border;
13 use Elementor\Group_Control_Box_Shadow;
14 use Elementor\Group_Control_Typography;
15 use \Elementor\Repeater;
16 use Elementor\Utils;
17 use \Elementor\Widget_Base as Widget_Base;
18
19 /**
20 * Exit if accessed directly
21 */
22 if (!defined('ABSPATH')) {
23 exit;
24 }
25
26 /**
27 * The elementor widget class
28 *
29 * @since 0.0.1
30 */
31 class User_Dashboard extends Widget_Base {
32
33 use Helper;
34
35 private $better_payment_global_settings = [];
36
37 /**
38 * @var mixed|void
39 */
40 protected $pro_enabled;
41
42 /**
43 * Login_Register constructor.
44 * Initializing the Login_Register widget class.
45 * @inheritDoc
46 */
47 public function __construct( $data = [], $args = null ) {
48 parent::__construct( $data, $args );
49 $this->pro_enabled = apply_filters( 'better_payment/pro_enabled', false );
50
51 }
52
53 public function get_name() {
54 return 'better-payment-user-dashboard';
55 }
56
57 public function get_title() {
58 return esc_html__( 'User Dashboard', 'better-payment' );
59 }
60
61 public function get_icon() {
62 return 'bp-icon bp-user-dashboard';
63 }
64
65 public function get_categories() {
66 return ['better-payment'];
67 }
68
69 public function get_keywords() {
70 return [
71 'payment', 'better-payment' ,'paypal', 'stripe', 'sell', 'donate', 'transaction', 'online-transaction', 'paystack', 'user-dashboard', 'recurring-payments', 'subscriptions', 'better payment'
72 ];
73 }
74
75 public function get_custom_help_url()
76 {
77 return 'https://betterpayment.co/docs/user-dashboard-using-better-payment/';
78 }
79
80 public function get_style_depends() {
81 return apply_filters( 'better_payment/elementor/user_dashboard/editor/get_style_depends', [ 'better-payment-el', 'bp-icon-front', 'better-payment-style', 'better-payment-common-style', 'better-payment-admin-style', 'bp-dashboard-pagination-style' ] );
82 }
83
84 public function get_script_depends() {
85 return apply_filters( 'better_payment/elementor/user_dashboard/editor/get_script_depends', [ 'better-payment-common-script', 'better-payment', 'bp-dashboard-pagination' ] );
86 }
87
88 protected function register_controls() {
89 $this->better_payment_global_settings = DB::get_settings();
90
91 $better_payment_helper = new ClassesHelper();
92 $better_payment_general_currency = $this->better_payment_global_settings['better_payment_settings_general_general_currency'];
93
94 $better_payment_general_currency_woocommerce = $better_payment_general_currency;
95 if( class_exists('woocommerce') ) {
96 $better_payment_general_currency_woocommerce = get_woocommerce_currency() ? get_woocommerce_currency() : $better_payment_general_currency_woocommerce;
97 }
98
99 $this->start_controls_section(
100 'better_payment_user_dashboard_layout_settings',
101 [
102 'label' => esc_html__( 'Layout', 'better-payment' ),
103 ]
104 );
105
106 $user_dashboard_layouts = $this->better_payment_free_layouts();
107 $template_list = $this->get_template_list_for_dropdown();
108
109 $this->add_control(
110 'better_payment_user_dashboard_layout',
111 [
112 'label' => esc_html__( 'Layout', 'better-payment' ),
113 'type' => Controls_Manager::SELECT,
114 'default' => 'layout-1',
115 'options' => array_merge($user_dashboard_layouts, $template_list),
116 ]
117 );
118
119 $this->add_control(
120 'better_payment_user_dashboard_sidebar_show',
121 [
122 'label' => __( 'Sidebar', 'better-payment' ),
123 'type' => Controls_Manager::SWITCHER,
124 'label_on' => __( 'Show', 'better-payment' ),
125 'label_off' => __( 'Hide', 'better-payment' ),
126 'return_value' => 'yes',
127 'default' => 'yes',
128 ]
129 );
130
131 $this->add_control(
132 'better_payment_user_dashboard_avatar_show',
133 [
134 'label' => __( 'Avatar', 'better-payment' ),
135 'type' => Controls_Manager::SWITCHER,
136 'label_on' => __( 'Show', 'better-payment' ),
137 'label_off' => __( 'Hide', 'better-payment' ),
138 'return_value' => 'yes',
139 'default' => 'yes',
140 'condition' => [
141 'better_payment_user_dashboard_sidebar_show' => 'yes'
142 ],
143 ]
144 );
145
146 $this->add_control(
147 'better_payment_user_dashboard_username_show',
148 [
149 'label' => __( 'Username', 'better-payment' ),
150 'type' => Controls_Manager::SWITCHER,
151 'label_on' => __( 'Show', 'better-payment' ),
152 'label_off' => __( 'Hide', 'better-payment' ),
153 'return_value' => 'yes',
154 'default' => 'yes',
155 'condition' => [
156 'better_payment_user_dashboard_sidebar_show' => 'yes'
157 ],
158 ]
159 );
160
161 $this->add_control(
162 'better_payment_user_dashboard_dashboard_show',
163 [
164 'label' => __( 'Dashboard', 'better-payment' ),
165 'type' => Controls_Manager::SWITCHER,
166 'label_on' => __( 'Show', 'better-payment' ),
167 'label_off' => __( 'Hide', 'better-payment' ),
168 'return_value' => 'yes',
169 'default' => 'yes',
170 ]
171 );
172
173 $this->add_control(
174 'better_payment_user_dashboard_transactions_show',
175 [
176 'label' => __( 'Transactions', 'better-payment' ),
177 'type' => Controls_Manager::SWITCHER,
178 'label_on' => __( 'Show', 'better-payment' ),
179 'label_off' => __( 'Hide', 'better-payment' ),
180 'return_value' => 'yes',
181 'default' => 'yes',
182 ]
183 );
184
185 $this->add_control(
186 'better_payment_user_dashboard_subscriptions_show',
187 [
188 'label' => __( 'Subscriptions', 'better-payment' ),
189 'type' => Controls_Manager::SWITCHER,
190 'label_on' => __( 'Show', 'better-payment' ),
191 'label_off' => __( 'Hide', 'better-payment' ),
192 'return_value' => 'yes',
193 'default' => 'yes',
194 ]
195 );
196
197 $this->add_control(
198 'better_payment_user_dashboard_header_show',
199 [
200 'label' => __( 'Header', 'better-payment' ),
201 'type' => Controls_Manager::SWITCHER,
202 'label_on' => __( 'Show', 'better-payment' ),
203 'label_off' => __( 'Hide', 'better-payment' ),
204 'return_value' => 'yes',
205 'default' => 'yes',
206 ]
207 );
208
209 $this->get_dashboard_layout_settings( $this );
210
211 $this->get_transaction_layout_settings( $this );
212
213 do_action('better_payment/elementor/user_dashboard/layout_settings_header_after', $this);
214
215 $this->end_controls_section();
216
217 $this->start_controls_section(
218 'better_payment_user_dashboard_content_settings',
219 [
220 'label' => esc_html__( 'Content', 'better-payment' ),
221 ]
222 );
223
224 $this->add_control(
225 'better_payment_user_dashboard_content_label',
226 [
227 'label' => esc_html__( 'Label', 'better-payment' ),
228 'type' => Controls_Manager::HEADING,
229 ]
230 );
231
232 $this->add_control(
233 'better_payment_user_dashboard_dashboard_label',
234 [
235 'label' => esc_html__( 'Dashboard', 'better-payment' ),
236 'type' => Controls_Manager::TEXT,
237 'label_block' => false,
238 'default' => esc_html__( 'Dashboard', 'better-payment' ),
239 'ai' => [
240 'active' => false,
241 ],
242 ]
243 );
244
245 $this->add_control( 'better_payment_user_dashboard_transaction_label', [
246 'label' => esc_html__( 'Transactions', 'better-payment' ),
247 'type' => Controls_Manager::TEXT,
248 'label_block' => false,
249 'default' => esc_html__( 'Transactions', 'better-payment' ),
250 'ai' => [
251 'active' => false,
252 ],
253 ] );
254
255 $this->add_control( 'better_payment_user_dashboard_subscription_label', [
256 'label' => esc_html__( 'Subscriptions', 'better-payment' ),
257 'type' => Controls_Manager::TEXT,
258 'label_block' => false,
259 'default' => esc_html__( 'Subscriptions', 'better-payment' ),
260 'ai' => [
261 'active' => false,
262 ],
263 ] );
264
265 $this->add_control( 'better_payment_user_dashboard_refresh_stats_label', [
266 'label' => esc_html__( 'Refresh Stats', 'better-payment' ),
267 'type' => Controls_Manager::TEXT,
268 'label_block' => false,
269 'default' => esc_html__( 'Refresh Stats', 'better-payment' ),
270 'ai' => [
271 'active' => false,
272 ],
273 ] );
274
275 $this->add_control( 'better_payment_user_dashboard_no_items_label', [
276 'label' => esc_html__( 'No Items', 'better-payment' ),
277 'type' => Controls_Manager::TEXT,
278 'label_block' => false,
279 'default' => esc_html__( 'No records found!', 'better-payment' ),
280 'ai' => [
281 'active' => false,
282 ],
283 ] );
284
285 $this->get_dashboard_content_settings( $this );
286
287 $this->get_transaction_content_settings( $this );
288
289 do_action('better_payment/elementor/user_dashboard/content_settings_no_items_after', $this);
290
291 $this->end_controls_section();
292
293 $this->user_dashboard_style();
294 }
295
296 public function user_dashboard_style() {
297 $this->container_style();
298 $this->sidebar_style();
299 $this->header_style();
300 $this->table_style();
301 }
302
303 public function container_style() {
304 $this->start_controls_section(
305 'better_payment_user_dashboard_container_style',
306 [
307 'label' => esc_html__( 'Container', 'better-payment' ),
308 'tab' => Controls_Manager::TAB_STYLE,
309 ]
310 );
311
312 $this->add_responsive_control(
313 'better_payment_user_dashboard_container_margin',
314 [
315 'label' => esc_html__( 'Margin', 'better-payment' ),
316 'type' => Controls_Manager::DIMENSIONS,
317 'size_units' => [ 'px', 'em' ],
318 'selectors' => [
319 '{{WRAPPER}} .better-payment-user-dashboard-container' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
320 ],
321 ]
322 );
323
324 $this->add_responsive_control(
325 'better_payment_user_dashboard_container_padding',
326 [
327 'label' => esc_html__( 'Padding', 'better-payment' ),
328 'type' => Controls_Manager::DIMENSIONS,
329 'size_units' => [ 'px', 'em' ],
330 'default' => [ 'size' => 15 ],
331 'selectors' => [
332 '{{WRAPPER}} .better-payment-user-dashboard-container' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
333 ],
334 ]
335 );
336
337 $this->add_control(
338 'better_payment_user_dashboard_container_border_radius',
339 [
340 'label' => esc_html__( 'Border Radius', 'better-payment' ),
341 'type' => Controls_Manager::SLIDER,
342 'range' => [
343 'px' => [
344 'max' => 100,
345 ],
346 ],
347 // 'default' => [
348 // 'size' => 10,
349 // ],
350 'selectors' => [
351 '{{WRAPPER}} .better-payment-user-dashboard-container' => 'border-radius: {{SIZE}}px;',
352 ],
353 ]
354 );
355
356 $this->start_controls_tabs( 'better_payment_user_dashboard_container_controls_tabs' );
357
358 $this->start_controls_tab( 'better_payment_user_dashboard_container_control_normal', [
359 'label' => esc_html__( 'Normal', 'better-payment' ),
360 ] );
361
362 $this->add_control(
363 'better_payment_user_dashboard_container_normal_background_color',
364 [
365 'label' => esc_html__( 'Background Color', 'better-payment' ),
366 'type' => Controls_Manager::COLOR,
367 'selectors' => [
368 '{{WRAPPER}} .better-payment-user-dashboard-container' => 'background: {{VALUE}};',
369 ],
370 ]
371 );
372
373 $this->add_group_control(
374 Group_Control_Border::get_type(),
375 [
376 'name' => 'better_payment_user_dashboard_container_normal_border',
377 'selector' => '{{WRAPPER}} .better-payment-user-dashboard-container',
378 ]
379 );
380
381 $this->add_group_control(
382 Group_Control_Box_Shadow::get_type(),
383 [
384 'name' => 'better_payment_user_dashboard_container_normal_box_shadow',
385 'selector' => '{{WRAPPER}} .better-payment-user-dashboard-container',
386 ]
387 );
388
389 $this->end_controls_tab();
390
391 $this->start_controls_tab( 'better_payment_user_dashboard_container_control_hover', [
392 'label' => esc_html__( 'Hover', 'better-payment' ),
393 ] );
394
395 $this->add_control(
396 'better_payment_user_dashboard_container_hover_background_color',
397 [
398 'label' => esc_html__( 'Background Color', 'better-payment' ),
399 'type' => Controls_Manager::COLOR,
400 'selectors' => [
401 '{{WRAPPER}} .better-payment-user-dashboard-container:hover' => 'background: {{VALUE}};',
402 ],
403 ]
404 );
405
406 $this->add_group_control(
407 Group_Control_Border::get_type(),
408 [
409 'name' => 'better_payment_user_dashboard_container_hover_border',
410 'selector' => '{{WRAPPER}} .better-payment-user-dashboard-container:hover',
411 ]
412 );
413
414 $this->add_group_control(
415 Group_Control_Box_Shadow::get_type(),
416 [
417 'name' => 'better_payment_user_dashboard_container_hover_box_shadow',
418 'selector' => '{{WRAPPER}} .better-payment-user-dashboard-container:hover',
419 ]
420 );
421
422 $this->end_controls_tab();
423
424 $this->end_controls_tabs();
425
426 $this->end_controls_section();
427 }
428
429 public function sidebar_style() {
430 $this->start_controls_section(
431 'better_payment_user_dashboard_sidebar_style',
432 [
433 'label' => esc_html__( 'Sidebar', 'better-payment' ),
434 'tab' => Controls_Manager::TAB_STYLE,
435 'condition' => [
436 'better_payment_user_dashboard_sidebar_show' => 'yes',
437 ],
438 ]
439 );
440
441 $this->add_control(
442 'better_payment_user_dashboard_sidebar_container_label',
443 [
444 'label' => esc_html__( 'Sidebar Container', 'better-payment' ),
445 'type' => Controls_Manager::HEADING,
446 'separator' => 'before',
447 ]
448 );
449
450 $this->add_responsive_control(
451 'better_payment_user_dashboard_sidebar_margin',
452 [
453 'label' => esc_html__( 'Margin', 'better-payment' ),
454 'type' => Controls_Manager::DIMENSIONS,
455 'size_units' => [ 'px', 'em' ],
456 'selectors' => [
457 '{{WRAPPER}} .better-payment-user-dashboard-sidebar' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
458 ],
459 ]
460 );
461
462 $this->add_responsive_control(
463 'better_payment_user_dashboard_sidebar_padding',
464 [
465 'label' => esc_html__( 'Padding', 'better-payment' ),
466 'type' => Controls_Manager::DIMENSIONS,
467 'size_units' => [ 'px', 'em' ],
468 'default' => [ 'size' => 15 ],
469 'selectors' => [
470 '{{WRAPPER}} .better-payment-user-dashboard-sidebar' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
471 ],
472 ]
473 );
474
475 $this->add_control(
476 'better_payment_user_dashboard_sidebar_background_color',
477 [
478 'label' => esc_html__( 'Background Color', 'better-payment' ),
479 'type' => Controls_Manager::COLOR,
480 'selectors' => [
481 '{{WRAPPER}} .better-payment-user-dashboard-sidebar' => 'background: {{VALUE}};',
482 ],
483 ]
484 );
485
486 $this->add_control(
487 'better_payment_user_dashboard_sidebar_border_radius',
488 [
489 'label' => esc_html__( 'Border Radius', 'better-payment' ),
490 'type' => Controls_Manager::SLIDER,
491 'range' => [
492 'px' => [
493 'max' => 100,
494 ],
495 ],
496 'selectors' => [
497 '{{WRAPPER}} .better-payment-user-dashboard-sidebar' => 'border-radius: {{SIZE}}px;',
498 ],
499 ]
500 );
501
502 $this->add_group_control(
503 Group_Control_Border::get_type(),
504 [
505 'name' => 'better_payment_user_dashboard_sidebar_border',
506 'selector' => '{{WRAPPER}} .better-payment-user-dashboard-sidebar',
507 ]
508 );
509
510 $this->add_group_control(
511 Group_Control_Box_Shadow::get_type(),
512 [
513 'name' => 'better_payment_user_dashboard_sidebar_box_shadow',
514 'selector' => '{{WRAPPER}} .better-payment-user-dashboard-sidebar',
515 ]
516 );
517
518 $this->add_control(
519 'better_payment_user_dashboard_sidebar_avatar_label',
520 [
521 'label' => esc_html__( 'Avatar', 'better-payment' ),
522 'type' => Controls_Manager::HEADING,
523 'separator' => 'before',
524 ]
525 );
526
527 $this->add_responsive_control(
528 'better_payment_user_dashboard_sidebar_avatar_size',
529 [
530 'label' => __( 'Size', 'better-payment' ),
531 'type' => Controls_Manager::SLIDER,
532 'range' => [
533 'px' => [
534 'min' => 15,
535 'max' => 200,
536 'step' => 1,
537 ],
538 ],
539 'size_units' => [ 'px' ],
540 'selectors' => [
541 '{{WRAPPER}} .bp--author img' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};',
542 ],
543 ]
544 );
545
546 $this->add_group_control(
547 Group_Control_Typography::get_type(),
548 [
549 'name' => 'better_payment_user_dashboard_sidebar_avatar_typography',
550 'selector' => '{{WRAPPER}} .bp--author h5',
551 ]
552 );
553
554 $this->start_controls_tabs( 'better_payment_user_dashboard_sidebar_avatar_controls_tabs' );
555
556 $this->start_controls_tab( 'better_payment_user_dashboard_sidebar_avatar_control_normal', [
557 'label' => esc_html__( 'Normal', 'better-payment' ),
558 ] );
559
560 $this->add_control(
561 'better_payment_user_dashboard_sidebar_avatar_normal_text_color',
562 [
563 'label' => esc_html__( 'Text Color', 'better-payment' ),
564 'type' => Controls_Manager::COLOR,
565 'selectors' => [
566 '{{WRAPPER}} .bp--author h5' => 'color: {{VALUE}};',
567 ],
568 ]
569 );
570
571 $this->end_controls_tab();
572
573 $this->start_controls_tab( 'better_payment_user_dashboard_sidebar_avatar_control_hover', [
574 'label' => esc_html__( 'Hover', 'better-payment' ),
575 ] );
576
577 $this->add_control(
578 'better_payment_user_dashboard_sidebar_avatar_hover_text_color',
579 [
580 'label' => esc_html__( 'Text Color', 'better-payment' ),
581 'type' => Controls_Manager::COLOR,
582 'selectors' => [
583 '{{WRAPPER}} .bp--author h5:hover' => 'color: {{VALUE}};',
584 ],
585 ]
586 );
587
588 $this->end_controls_tab();
589
590 $this->end_controls_tabs();
591
592 $this->add_control(
593 'better_payment_user_dashboard_sidebar_menu_label',
594 [
595 'label' => esc_html__( 'Menu', 'better-payment' ),
596 'type' => Controls_Manager::HEADING,
597 'separator' => 'before',
598 ]
599 );
600
601 $this->add_group_control(
602 Group_Control_Typography::get_type(),
603 [
604 'name' => 'better_payment_user_dashboard_sidebar_menu_typography',
605 'selector' => '{{WRAPPER}} .bp--sidebar-nav.active .bp--nav-text',
606 ]
607 );
608
609 $this->start_controls_tabs( 'better_payment_user_dashboard_sidebar_menu_controls_tabs' );
610
611 $this->start_controls_tab( 'better_payment_user_dashboard_sidebar_menu_control_normal', [
612 'label' => esc_html__( 'Normal', 'better-payment' ),
613 ] );
614
615 $this->add_control(
616 'better_payment_user_dashboard_sidebar_menu_normal_text_color',
617 [
618 'label' => esc_html__( 'Text Color', 'better-payment' ),
619 'type' => Controls_Manager::COLOR,
620 'selectors' => [
621 '{{WRAPPER}} .bp--sidebar-nav.active .bp--nav-text' => 'color: {{VALUE}};',
622 ],
623 ]
624 );
625
626 $this->end_controls_tab();
627
628 $this->start_controls_tab( 'better_payment_user_dashboard_sidebar_menu_control_hover', [
629 'label' => esc_html__( 'Hover', 'better-payment' ),
630 ] );
631
632 $this->add_control(
633 'better_payment_user_dashboard_sidebar_menu_hover_text_color',
634 [
635 'label' => esc_html__( 'Text Color', 'better-payment' ),
636 'type' => Controls_Manager::COLOR,
637 'selectors' => [
638 '{{WRAPPER}} .bp--sidebar-nav.active .bp--nav-text:hover' => 'color: {{VALUE}};',
639 ],
640 ]
641 );
642
643 $this->end_controls_tab();
644
645 $this->end_controls_tabs();
646
647 $this->add_control(
648 'better_payment_user_dashboard_sidebar_icon_label',
649 [
650 'label' => esc_html__( 'Icon', 'better-payment' ),
651 'type' => Controls_Manager::HEADING,
652 'separator' => 'before',
653 ]
654 );
655
656 $this->add_responsive_control(
657 'better_payment_user_dashboard_sidebar_icon_size',
658 [
659 'label' => __( 'Size', 'better-payment' ),
660 'type' => Controls_Manager::SLIDER,
661 'range' => [
662 'px' => [
663 'min' => 15,
664 'max' => 200,
665 'step' => 1,
666 ],
667 ],
668 'size_units' => [ 'px' ],
669 'selectors' => [
670 '{{WRAPPER}} span.bp--nav-icon svg' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};',
671 ],
672 ]
673 );
674
675 $this->add_control(
676 'better_payment_user_dashboard_sidebar_icon_color',
677 [
678 'label' => esc_html__( 'Color', 'better-payment' ),
679 'type' => Controls_Manager::COLOR,
680 'selectors' => [
681 '{{WRAPPER}} .bp--sidebar-nav.active span.bp--nav-icon svg path' => 'stroke: {{VALUE}};',
682 ],
683 ]
684 );
685
686 $this->end_controls_section();
687 }
688
689 public function header_style() {
690 $this->start_controls_section(
691 'better_payment_user_dashboard_header_style',
692 [
693 'label' => esc_html__( 'Header', 'better-payment' ),
694 'tab' => Controls_Manager::TAB_STYLE,
695 ]
696 );
697
698 $this->add_responsive_control(
699 'better_payment_user_dashboard_header_margin',
700 [
701 'label' => esc_html__( 'Margin', 'better-payment' ),
702 'type' => Controls_Manager::DIMENSIONS,
703 'size_units' => [ 'px', 'em' ],
704 'selectors' => [
705 '{{WRAPPER}} .better-payment-user-dashboard-header' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
706 ],
707 ]
708 );
709
710 $this->add_responsive_control(
711 'better_payment_user_dashboard_header_padding',
712 [
713 'label' => esc_html__( 'Padding', 'better-payment' ),
714 'type' => Controls_Manager::DIMENSIONS,
715 'size_units' => [ 'px', 'em' ],
716 'default' => [ 'size' => 15 ],
717 'selectors' => [
718 '{{WRAPPER}} .better-payment-user-dashboard-header' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
719 ],
720 ]
721 );
722
723 $this->add_control(
724 'better_payment_user_dashboard_header_border_radius',
725 [
726 'label' => esc_html__( 'Border Radius', 'better-payment' ),
727 'type' => Controls_Manager::SLIDER,
728 'range' => [
729 'px' => [
730 'max' => 100,
731 ],
732 ],
733 'selectors' => [
734 '{{WRAPPER}} .better-payment-user-dashboard-header' => 'border-radius: {{SIZE}}px;',
735 ],
736 ]
737 );
738
739 $this->add_group_control(
740 Group_Control_Typography::get_type(),
741 [
742 'name' => 'better_payment_user_dashboard_sidebar_header_typography',
743 'selector' => '{{WRAPPER}} .better-payment-user-dashboard-header h2',
744 ]
745 );
746
747 $this->start_controls_tabs( 'better_payment_user_dashboard_header_controls_tabs' );
748
749 $this->start_controls_tab( 'better_payment_user_dashboard_header_control_normal', [
750 'label' => esc_html__( 'Normal', 'better-payment' ),
751 ] );
752
753 $this->add_control(
754 'better_payment_user_dashboard_header_normal_text_color',
755 [
756 'label' => esc_html__( 'Color', 'better-payment' ),
757 'type' => Controls_Manager::COLOR,
758 'selectors' => [
759 '{{WRAPPER}} .better-payment-user-dashboard-header h2' => 'color: {{VALUE}};',
760 ],
761 ]
762 );
763
764 $this->add_control(
765 'better_payment_user_dashboard_header_normal_background_color',
766 [
767 'label' => esc_html__( 'Background Color', 'better-payment' ),
768 'type' => Controls_Manager::COLOR,
769 'selectors' => [
770 '{{WRAPPER}} .better-payment-user-dashboard-header' => 'background: {{VALUE}};',
771 ],
772 ]
773 );
774
775 $this->add_group_control(
776 Group_Control_Border::get_type(),
777 [
778 'name' => 'better_payment_user_dashboard_header_normal_border',
779 'selector' => '{{WRAPPER}} .better-payment-user-dashboard-header',
780 ]
781 );
782
783 $this->add_group_control(
784 Group_Control_Box_Shadow::get_type(),
785 [
786 'name' => 'better_payment_user_dashboard_header_normal_box_shadow',
787 'selector' => '{{WRAPPER}} .better-payment-user-dashboard-header',
788 ]
789 );
790
791 $this->end_controls_tab();
792
793 $this->start_controls_tab( 'better_payment_user_dashboard_header_control_hover', [
794 'label' => esc_html__( 'Hover', 'better-payment' ),
795 ] );
796
797 $this->add_control(
798 'better_payment_user_dashboard_header_hover_text_color',
799 [
800 'label' => esc_html__( 'Color', 'better-payment' ),
801 'type' => Controls_Manager::COLOR,
802 'selectors' => [
803 '{{WRAPPER}} .better-payment-user-dashboard-header h2:hover' => 'color: {{VALUE}};',
804 ],
805 ]
806 );
807
808 $this->add_control(
809 'better_payment_user_dashboard_header_hover_background_color',
810 [
811 'label' => esc_html__( 'Background Color', 'better-payment' ),
812 'type' => Controls_Manager::COLOR,
813 'selectors' => [
814 '{{WRAPPER}} .better-payment-user-dashboard-header:hover' => 'background: {{VALUE}};',
815 ],
816 ]
817 );
818
819 $this->add_group_control(
820 Group_Control_Border::get_type(),
821 [
822 'name' => 'better_payment_user_dashboard_header_hover_border',
823 'selector' => '{{WRAPPER}} .better-payment-user-dashboard-header:hover',
824 ]
825 );
826
827 $this->add_group_control(
828 Group_Control_Box_Shadow::get_type(),
829 [
830 'name' => 'better_payment_user_dashboard_header_hover_box_shadow',
831 'selector' => '{{WRAPPER}} .better-payment-user-dashboard-header:hover',
832 ]
833 );
834
835 $this->end_controls_tab();
836
837 $this->end_controls_tabs();
838
839 $this->end_controls_section();
840 }
841
842 public function table_style() {
843 // Table
844 $this->start_controls_section(
845 'better_payment_user_dashboard_table_style',
846 [
847 'label' => esc_html__( 'Table', 'better-payment' ),
848 'tab' => Controls_Manager::TAB_STYLE,
849 ]
850 );
851
852 // Table Container
853 $this->add_control(
854 'better_payment_user_dashboard_table_container_label',
855 [
856 'label' => esc_html__( 'Table Container', 'better-payment' ),
857 'type' => Controls_Manager::HEADING,
858 ]
859 );
860
861 $this->add_responsive_control(
862 'better_payment_user_dashboard_table_margin',
863 [
864 'label' => esc_html__( 'Margin', 'better-payment' ),
865 'type' => Controls_Manager::DIMENSIONS,
866 'size_units' => [ 'px', 'em' ],
867 'selectors' => [
868 '{{WRAPPER}} .better-payment-user-dashboard-table' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
869 ],
870 ]
871 );
872
873 $this->add_responsive_control(
874 'better_payment_user_dashboard_table_padding',
875 [
876 'label' => esc_html__( 'Padding', 'better-payment' ),
877 'type' => Controls_Manager::DIMENSIONS,
878 'size_units' => [ 'px', 'em' ],
879 'default' => [ 'size' => 15 ],
880 'selectors' => [
881 '{{WRAPPER}} .better-payment-user-dashboard-table' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
882 ],
883 ]
884 );
885
886 $this->add_control(
887 'better_payment_user_dashboard_table_border_radius',
888 [
889 'label' => esc_html__( 'Border Radius', 'better-payment' ),
890 'type' => Controls_Manager::SLIDER,
891 'range' => [
892 'px' => [
893 'max' => 100,
894 ],
895 ],
896 'selectors' => [
897 '{{WRAPPER}} .better-payment-user-dashboard-table' => 'border-radius: {{SIZE}}px;',
898 ],
899 ]
900 );
901
902 $this->start_controls_tabs( 'better_payment_user_dashboard_table_controls_tabs' );
903
904 $this->start_controls_tab( 'better_payment_user_dashboard_table_control_normal', [
905 'label' => esc_html__( 'Normal', 'better-payment' ),
906 ] );
907
908 $this->add_control(
909 'better_payment_user_dashboard_table_normal_background_color',
910 [
911 'label' => esc_html__( 'Background Color', 'better-payment' ),
912 'type' => Controls_Manager::COLOR,
913 'selectors' => [
914 '{{WRAPPER}} .better-payment-user-dashboard-table' => 'background: {{VALUE}};',
915 ],
916 ]
917 );
918
919 $this->add_group_control(
920 Group_Control_Border::get_type(),
921 [
922 'name' => 'better_payment_user_dashboard_table_normal_border',
923 'selector' => '{{WRAPPER}} .better-payment-user-dashboard-table',
924 ]
925 );
926
927 $this->add_group_control(
928 Group_Control_Box_Shadow::get_type(),
929 [
930 'name' => 'better_payment_user_dashboard_table_normal_box_shadow',
931 'selector' => '{{WRAPPER}} .better-payment-user-dashboard-table',
932 ]
933 );
934
935 $this->end_controls_tab();
936
937 $this->start_controls_tab( 'better_payment_user_dashboard_table_control_hover', [
938 'label' => esc_html__( 'Hover', 'better-payment' ),
939 ] );
940
941 $this->add_control(
942 'better_payment_user_dashboard_table_hover_background_color',
943 [
944 'label' => esc_html__( 'Background Color', 'better-payment' ),
945 'type' => Controls_Manager::COLOR,
946 'selectors' => [
947 '{{WRAPPER}} .better-payment-user-dashboard-table:hover' => 'background: {{VALUE}};',
948 ],
949 ]
950 );
951
952 $this->add_group_control(
953 Group_Control_Border::get_type(),
954 [
955 'name' => 'better_payment_user_dashboard_table_hover_border',
956 'selector' => '{{WRAPPER}} .better-payment-user-dashboard-table:hover',
957 ]
958 );
959
960 $this->add_group_control(
961 Group_Control_Box_Shadow::get_type(),
962 [
963 'name' => 'better_payment_user_dashboard_table_hover_box_shadow',
964 'selector' => '{{WRAPPER}} .better-payment-user-dashboard-table:hover',
965 ]
966 );
967
968 $this->end_controls_tab();
969
970 $this->end_controls_tabs();
971
972 // Table Header
973 $this->add_control(
974 'better_payment_user_dashboard_table_header_label',
975 [
976 'label' => esc_html__( 'Table Header', 'better-payment' ),
977 'type' => Controls_Manager::HEADING,
978 'separator' => 'before',
979 ]
980 );
981
982 $this->add_responsive_control(
983 'better_payment_user_dashboard_table_header_margin',
984 [
985 'label' => esc_html__( 'Margin', 'better-payment' ),
986 'type' => Controls_Manager::DIMENSIONS,
987 'size_units' => [ 'px', 'em' ],
988 'selectors' => [
989 '{{WRAPPER}} .better-payment-user-dashboard-table .better-payment-user-dashboard-table-header' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
990 ],
991 ]
992 );
993
994 $this->add_responsive_control(
995 'better_payment_user_dashboard_table_header_padding',
996 [
997 'label' => esc_html__( 'Padding', 'better-payment' ),
998 'type' => Controls_Manager::DIMENSIONS,
999 'size_units' => [ 'px', 'em' ],
1000 'default' => [ 'size' => 15 ],
1001 'selectors' => [
1002 '{{WRAPPER}} .better-payment-user-dashboard-table .better-payment-user-dashboard-table-header' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1003 ],
1004 ]
1005 );
1006
1007 $this->add_control(
1008 'better_payment_user_dashboard_table_header_border_radius',
1009 [
1010 'label' => esc_html__( 'Border Radius', 'better-payment' ),
1011 'type' => Controls_Manager::SLIDER,
1012 'range' => [
1013 'px' => [
1014 'max' => 100,
1015 ],
1016 ],
1017 'selectors' => [
1018 '{{WRAPPER}} .better-payment-user-dashboard-table .better-payment-user-dashboard-table-header' => 'border-radius: {{SIZE}}px;',
1019 ],
1020 ]
1021 );
1022
1023 $this->add_group_control(
1024 Group_Control_Typography::get_type(),
1025 [
1026 'name' => 'better_payment_user_dashboard_table_header_typography',
1027 'selector' => '{{WRAPPER}} .bp--table-header .th, {{WRAPPER}} .bp--table-header .th h5',
1028 ]
1029 );
1030
1031 $this->start_controls_tabs( 'better_payment_user_dashboard_table_header_controls_tabs' );
1032
1033 $this->start_controls_tab( 'better_payment_user_dashboard_table_header_control_normal', [
1034 'label' => esc_html__( 'Normal', 'better-payment' ),
1035 ] );
1036
1037 $this->add_control(
1038 'better_payment_user_dashboard_table_header_normal_text_color',
1039 [
1040 'label' => esc_html__( 'Color', 'better-payment' ),
1041 'type' => Controls_Manager::COLOR,
1042 'selectors' => [
1043 '{{WRAPPER}} .bp--table-header .th' => 'color: {{VALUE}};',
1044 '{{WRAPPER}} .bp--table-header .th h5' => 'color: {{VALUE}};',
1045 ],
1046 ]
1047 );
1048
1049 $this->add_control(
1050 'better_payment_user_dashboard_table_header_normal_background_color',
1051 [
1052 'label' => esc_html__( 'Background Color', 'better-payment' ),
1053 'type' => Controls_Manager::COLOR,
1054 'selectors' => [
1055 '{{WRAPPER}} .better-payment-user-dashboard-table .better-payment-user-dashboard-table-header' => 'background: {{VALUE}};',
1056 ],
1057 ]
1058 );
1059
1060 $this->add_group_control(
1061 Group_Control_Border::get_type(),
1062 [
1063 'name' => 'better_payment_user_dashboard_table_header_normal_border',
1064 'selector' => '{{WRAPPER}} .better-payment-user-dashboard-table .better-payment-user-dashboard-table-header',
1065 ]
1066 );
1067
1068 $this->add_group_control(
1069 Group_Control_Box_Shadow::get_type(),
1070 [
1071 'name' => 'better_payment_user_dashboard_table_header_normal_box_shadow',
1072 'selector' => '{{WRAPPER}} .better-payment-user-dashboard-table .better-payment-user-dashboard-table-header',
1073 ]
1074 );
1075
1076 $this->end_controls_tab();
1077
1078 $this->start_controls_tab( 'better_payment_user_dashboard_table_header_control_hover', [
1079 'label' => esc_html__( 'Hover', 'better-payment' ),
1080 ] );
1081
1082 $this->add_control(
1083 'better_payment_user_dashboard_table_header_hover_text_color',
1084 [
1085 'label' => esc_html__( 'Color', 'better-payment' ),
1086 'type' => Controls_Manager::COLOR,
1087 'selectors' => [
1088 '{{WRAPPER}} .bp--table-header .th:hover' => 'color: {{VALUE}};',
1089 '{{WRAPPER}} .bp--table-header .th h5:hover' => 'color: {{VALUE}};',
1090 ],
1091 ]
1092 );
1093
1094 $this->add_control(
1095 'better_payment_user_dashboard_table_header_hover_background_color',
1096 [
1097 'label' => esc_html__( 'Background Color', 'better-payment' ),
1098 'type' => Controls_Manager::COLOR,
1099 'selectors' => [
1100 '{{WRAPPER}} .better-payment-user-dashboard-table .better-payment-user-dashboard-table-header:hover' => 'background: {{VALUE}};',
1101 ],
1102 ]
1103 );
1104
1105 $this->add_group_control(
1106 Group_Control_Border::get_type(),
1107 [
1108 'name' => 'better_payment_user_dashboard_table_header_hover_border',
1109 'selector' => '{{WRAPPER}} .better-payment-user-dashboard-table .better-payment-user-dashboard-table-header:hover',
1110 ]
1111 );
1112
1113 $this->add_group_control(
1114 Group_Control_Box_Shadow::get_type(),
1115 [
1116 'name' => 'better_payment_user_dashboard_table_header_hover_box_shadow',
1117 'selector' => '{{WRAPPER}} .better-payment-user-dashboard-table .better-payment-user-dashboard-table-header:hover',
1118 ]
1119 );
1120
1121 $this->end_controls_tab();
1122
1123 $this->end_controls_tabs();
1124
1125 // Table Body
1126 $this->add_control(
1127 'better_payment_user_dashboard_table_body_label',
1128 [
1129 'label' => esc_html__( 'Table Body', 'better-payment' ),
1130 'type' => Controls_Manager::HEADING,
1131 'separator' => 'before',
1132 ]
1133 );
1134
1135 $this->add_responsive_control(
1136 'better_payment_user_dashboard_table_body_margin',
1137 [
1138 'label' => esc_html__( 'Margin', 'better-payment' ),
1139 'type' => Controls_Manager::DIMENSIONS,
1140 'size_units' => [ 'px', 'em' ],
1141 'selectors' => [
1142 '{{WRAPPER}} .better-payment-user-dashboard-table .better-payment-user-dashboard-table-body' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1143 ],
1144 ]
1145 );
1146
1147 $this->add_responsive_control(
1148 'better_payment_user_dashboard_table_body_padding',
1149 [
1150 'label' => esc_html__( 'Padding', 'better-payment' ),
1151 'type' => Controls_Manager::DIMENSIONS,
1152 'size_units' => [ 'px', 'em' ],
1153 'default' => [ 'size' => 15 ],
1154 'selectors' => [
1155 '{{WRAPPER}} .better-payment-user-dashboard-table .better-payment-user-dashboard-table-body' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1156 ],
1157 ]
1158 );
1159
1160 $this->add_control(
1161 'better_payment_user_dashboard_table_body_border_radius',
1162 [
1163 'label' => esc_html__( 'Border Radius', 'better-payment' ),
1164 'type' => Controls_Manager::SLIDER,
1165 'range' => [
1166 'px' => [
1167 'max' => 100,
1168 ],
1169 ],
1170 'selectors' => [
1171 '{{WRAPPER}} .better-payment-user-dashboard-table .better-payment-user-dashboard-table-body' => 'border-radius: {{SIZE}}px;',
1172 ],
1173 ]
1174 );
1175
1176 $this->add_group_control(
1177 Group_Control_Typography::get_type(),
1178 [
1179 'name' => 'better_payment_user_dashboard_table_body_typography',
1180 'selector' => '{{WRAPPER}} .bp--table-body .td h5, {{WRAPPER}} .bp--table-body .td h5 span, {{WRAPPER}} .bp--table-body .td p, {{WRAPPER}} button.active, {{WRAPPER}} button.cancel, {{WRAPPER}} .bp--table-body .td span, {{WRAPPER}} button.inactive',
1181 ]
1182 );
1183
1184 $this->start_controls_tabs( 'better_payment_user_dashboard_table_body_controls_tabs' );
1185
1186 $this->start_controls_tab( 'better_payment_user_dashboard_table_body_control_normal', [
1187 'label' => esc_html__( 'Normal', 'better-payment' ),
1188 ] );
1189
1190 $this->add_control(
1191 'better_payment_user_dashboard_table_body_normal_text_color',
1192 [
1193 'label' => esc_html__( 'Color', 'better-payment' ),
1194 'type' => Controls_Manager::COLOR,
1195 'selectors' => [
1196 '{{WRAPPER}} .bp--table-body .td h5' => 'color: {{VALUE}};',
1197 '{{WRAPPER}} .bp--table-body .td h5 span' => 'color: {{VALUE}};',
1198 '{{WRAPPER}} .bp--table-body .td p' => 'color: {{VALUE}};',
1199 '{{WRAPPER}} .bp--table-body .td span' => 'color: {{VALUE}};',
1200 ],
1201 ]
1202 );
1203
1204 $this->add_control(
1205 'better_payment_user_dashboard_table_body_normal_background_color',
1206 [
1207 'label' => esc_html__( 'Background Color', 'better-payment' ),
1208 'type' => Controls_Manager::COLOR,
1209 'selectors' => [
1210 '{{WRAPPER}} .better-payment-user-dashboard-table .better-payment-user-dashboard-table-body' => 'background: {{VALUE}};',
1211 ],
1212 ]
1213 );
1214
1215 $this->add_group_control(
1216 Group_Control_Border::get_type(),
1217 [
1218 'name' => 'better_payment_user_dashboard_table_body_normal_border',
1219 'selector' => '{{WRAPPER}} .better-payment-user-dashboard-table .better-payment-user-dashboard-table-body',
1220 ]
1221 );
1222
1223 $this->add_group_control(
1224 Group_Control_Box_Shadow::get_type(),
1225 [
1226 'name' => 'better_payment_user_dashboard_table_body_normal_box_shadow',
1227 'selector' => '{{WRAPPER}} .better-payment-user-dashboard-table .better-payment-user-dashboard-table-body',
1228 ]
1229 );
1230
1231 $this->end_controls_tab();
1232
1233 $this->start_controls_tab( 'better_payment_user_dashboard_table_body_control_hover', [
1234 'label' => esc_html__( 'Hover', 'better-payment' ),
1235 ] );
1236
1237 $this->add_control(
1238 'better_payment_user_dashboard_table_body_hover_text_color',
1239 [
1240 'label' => esc_html__( 'Color', 'better-payment' ),
1241 'type' => Controls_Manager::COLOR,
1242 'selectors' => [
1243 '{{WRAPPER}} .bp--table-body .td h5:hover' => 'color: {{VALUE}};',
1244 '{{WRAPPER}} .bp--table-body .td h5 span:hover' => 'color: {{VALUE}};',
1245 ],
1246 ]
1247 );
1248
1249 $this->add_control(
1250 'better_payment_user_dashboard_table_body_hover_background_color',
1251 [
1252 'label' => esc_html__( 'Background Color', 'better-payment' ),
1253 'type' => Controls_Manager::COLOR,
1254 'selectors' => [
1255 '{{WRAPPER}} .better-payment-user-dashboard-table .better-payment-user-dashboard-table-body:hover' => 'background: {{VALUE}};',
1256 ],
1257 ]
1258 );
1259
1260 $this->add_group_control(
1261 Group_Control_Border::get_type(),
1262 [
1263 'name' => 'better_payment_user_dashboard_table_body_hover_border',
1264 'selector' => '{{WRAPPER}} .better-payment-user-dashboard-table .better-payment-user-dashboard-table-body:hover',
1265 ]
1266 );
1267
1268 $this->add_group_control(
1269 Group_Control_Box_Shadow::get_type(),
1270 [
1271 'name' => 'better_payment_user_dashboard_table_body_hover_box_shadow',
1272 'selector' => '{{WRAPPER}} .better-payment-user-dashboard-table .better-payment-user-dashboard-table-body:hover',
1273 ]
1274 );
1275
1276 $this->end_controls_tab();
1277
1278 $this->end_controls_tabs();
1279
1280 $this->add_control(
1281 'better_payment_user_dashboard_table_body_buttons_label',
1282 [
1283 'label' => esc_html__( 'Table Body » Buttons', 'better-payment' ),
1284 'type' => Controls_Manager::HEADING,
1285 'separator' => 'before',
1286 ]
1287 );
1288
1289 $this->add_control(
1290 'better_payment_user_dashboard_table_body_buttons_active_label',
1291 [
1292 'label' => esc_html__( 'Active Button', 'better-payment' ),
1293 'type' => Controls_Manager::HEADING,
1294 ]
1295 );
1296
1297 $this->start_controls_tabs( 'better_payment_user_dashboard_table_body_buttons_active_controls_tabs' );
1298
1299 $this->start_controls_tab( 'better_payment_user_dashboard_table_body_buttons_active_control_normal', [
1300 'label' => esc_html__( 'Normal', 'better-payment' ),
1301 ] );
1302
1303 $this->add_control(
1304 'better_payment_user_dashboard_table_body_buttons_active_normal_text_color',
1305 [
1306 'label' => esc_html__( 'Color', 'better-payment' ),
1307 'type' => Controls_Manager::COLOR,
1308 'selectors' => [
1309 '{{WRAPPER}} button.active' => 'color: {{VALUE}};',
1310 ],
1311 ]
1312 );
1313
1314 $this->add_control(
1315 'better_payment_user_dashboard_table_body_buttons_active_normal_background_color',
1316 [
1317 'label' => esc_html__( 'Background Color', 'better-payment' ),
1318 'type' => Controls_Manager::COLOR,
1319 'selectors' => [
1320 '{{WRAPPER}} button.active' => 'background: {{VALUE}};',
1321 ],
1322 ]
1323 );
1324
1325 $this->end_controls_tab();
1326
1327 $this->start_controls_tab( 'better_payment_user_dashboard_table_body_buttons_active_control_hover', [
1328 'label' => esc_html__( 'Hover', 'better-payment' ),
1329 ] );
1330
1331 $this->add_control(
1332 'better_payment_user_dashboard_table_body_buttons_active_hover_text_color',
1333 [
1334 'label' => esc_html__( 'Color', 'better-payment' ),
1335 'type' => Controls_Manager::COLOR,
1336 'selectors' => [
1337 '{{WRAPPER}} button.active:hover' => 'color: {{VALUE}};',
1338 ],
1339 ]
1340 );
1341
1342 $this->add_control(
1343 'better_payment_user_dashboard_table_body_buttons_active_hover_background_color',
1344 [
1345 'label' => esc_html__( 'Background Color', 'better-payment' ),
1346 'type' => Controls_Manager::COLOR,
1347 'selectors' => [
1348 '{{WRAPPER}} button.active:hover' => 'background: {{VALUE}};',
1349 ],
1350 ]
1351 );
1352
1353 $this->end_controls_tab();
1354
1355 $this->end_controls_tabs();
1356
1357 $this->add_control(
1358 'better_payment_user_dashboard_table_body_buttons_inactive_label',
1359 [
1360 'label' => esc_html__( 'Inactive Button', 'better-payment' ),
1361 'type' => Controls_Manager::HEADING,
1362 ]
1363 );
1364
1365 $this->start_controls_tabs( 'better_payment_user_dashboard_table_body_buttons_inactive_controls_tabs' );
1366
1367 $this->start_controls_tab( 'better_payment_user_dashboard_table_body_buttons_inactive_control_normal', [
1368 'label' => esc_html__( 'Normal', 'better-payment' ),
1369 ] );
1370
1371 $this->add_control(
1372 'better_payment_user_dashboard_table_body_buttons_inactive_normal_text_color',
1373 [
1374 'label' => esc_html__( 'Color', 'better-payment' ),
1375 'type' => Controls_Manager::COLOR,
1376 'selectors' => [
1377 '{{WRAPPER}} button.inactive' => 'color: {{VALUE}};',
1378 ],
1379 ]
1380 );
1381
1382 $this->add_control(
1383 'better_payment_user_dashboard_table_body_buttons_inactive_normal_background_color',
1384 [
1385 'label' => esc_html__( 'Background Color', 'better-payment' ),
1386 'type' => Controls_Manager::COLOR,
1387 'selectors' => [
1388 '{{WRAPPER}} button.inactive' => 'background: {{VALUE}};',
1389 ],
1390 ]
1391 );
1392
1393 $this->end_controls_tab();
1394
1395 $this->start_controls_tab( 'better_payment_user_dashboard_table_body_buttons_inactive_control_hover', [
1396 'label' => esc_html__( 'Hover', 'better-payment' ),
1397 ] );
1398
1399 $this->add_control(
1400 'better_payment_user_dashboard_table_body_buttons_inactive_hover_text_color',
1401 [
1402 'label' => esc_html__( 'Color', 'better-payment' ),
1403 'type' => Controls_Manager::COLOR,
1404 'selectors' => [
1405 '{{WRAPPER}} button.inactive:hover' => 'color: {{VALUE}};',
1406 ],
1407 ]
1408 );
1409
1410 $this->add_control(
1411 'better_payment_user_dashboard_table_body_buttons_inactive_hover_background_color',
1412 [
1413 'label' => esc_html__( 'Background Color', 'better-payment' ),
1414 'type' => Controls_Manager::COLOR,
1415 'selectors' => [
1416 '{{WRAPPER}} button.inactive:hover' => 'background: {{VALUE}};',
1417 ],
1418 ]
1419 );
1420
1421 $this->end_controls_tab();
1422
1423 $this->end_controls_tabs();
1424
1425 $this->add_control(
1426 'better_payment_user_dashboard_table_body_buttons_cancel_label',
1427 [
1428 'label' => esc_html__( 'Cancel Button', 'better-payment' ),
1429 'type' => Controls_Manager::HEADING,
1430 ]
1431 );
1432
1433 $this->start_controls_tabs( 'better_payment_user_dashboard_table_body_buttons_cancel_controls_tabs' );
1434
1435 $this->start_controls_tab( 'better_payment_user_dashboard_table_body_buttons_cancel_control_normal', [
1436 'label' => esc_html__( 'Normal', 'better-payment' ),
1437 ] );
1438
1439 $this->add_control(
1440 'better_payment_user_dashboard_table_body_buttons_cancel_normal_text_color',
1441 [
1442 'label' => esc_html__( 'Color', 'better-payment' ),
1443 'type' => Controls_Manager::COLOR,
1444 'selectors' => [
1445 '{{WRAPPER}} button.cancel' => 'color: {{VALUE}};',
1446 ],
1447 ]
1448 );
1449
1450 $this->add_control(
1451 'better_payment_user_dashboard_table_body_buttons_cancel_normal_background_color',
1452 [
1453 'label' => esc_html__( 'Background Color', 'better-payment' ),
1454 'type' => Controls_Manager::COLOR,
1455 'selectors' => [
1456 '{{WRAPPER}} button.cancel' => 'background: {{VALUE}};',
1457 ],
1458 ]
1459 );
1460
1461 $this->end_controls_tab();
1462
1463 $this->start_controls_tab( 'better_payment_user_dashboard_table_body_buttons_cancel_control_hover', [
1464 'label' => esc_html__( 'Hover', 'better-payment' ),
1465 ] );
1466
1467 $this->add_control(
1468 'better_payment_user_dashboard_table_body_buttons_cancel_hover_text_color',
1469 [
1470 'label' => esc_html__( 'Color', 'better-payment' ),
1471 'type' => Controls_Manager::COLOR,
1472 'selectors' => [
1473 '{{WRAPPER}} button.cancel:hover' => 'color: {{VALUE}};',
1474 ],
1475 ]
1476 );
1477
1478 $this->add_control(
1479 'better_payment_user_dashboard_table_body_buttons_cancel_hover_background_color',
1480 [
1481 'label' => esc_html__( 'Background Color', 'better-payment' ),
1482 'type' => Controls_Manager::COLOR,
1483 'selectors' => [
1484 '{{WRAPPER}} button.cancel:hover' => 'background: {{VALUE}};',
1485 ],
1486 ]
1487 );
1488
1489 $this->end_controls_tab();
1490
1491 $this->end_controls_tabs();
1492
1493 $this->end_controls_section();
1494 }
1495
1496 /**
1497 * Render the widget output on the frontend.
1498 *
1499 * @since 1.0.0
1500 */
1501 protected function render() {
1502
1503 $settings = $this->get_settings_for_display();
1504 $bp_settings = $this->get_bp_settings( $settings );
1505
1506 $payment_field = "number" ;
1507
1508 $response = Handler::manage_response( $settings, $this->get_id() );
1509 if ( $response ) {
1510 return false;
1511 }
1512
1513 do_action('better_payment/elementor/editor/manage_response_webhook', $this, $settings );
1514
1515 wp_enqueue_script( 'better-payment' );
1516 wp_localize_script( 'better-payment', 'betterPaymentUserDash', [
1517 'nonce' => wp_create_nonce( 'wp_rest' ),
1518 'restUrl' => get_rest_url( null, 'better-payment/v1/user-transactions' ),
1519 ] );
1520 wp_enqueue_script( 'bp-dashboard-pagination' );
1521
1522 if( $this->pro_enabled ){
1523 wp_enqueue_script( 'better-payment-common-script' );
1524 wp_enqueue_style( 'better-payment-common-style' );
1525 }
1526
1527 $action = esc_url( admin_url( 'admin-post.php' ) );
1528 $setting_meta = wp_json_encode( [
1529 'page_id' => get_the_ID(),
1530 'widget_id' => esc_attr( $this->get_id() ),
1531 ] );
1532
1533 $better_payment_placeholder_class = '';
1534 if ( !empty($settings[ 'better_payment_placeholder_switch' ]) && $settings[ 'better_payment_placeholder_switch' ] != 'yes' ) {
1535 $better_payment_placeholder_class = 'better-payment-hide-placeholder';
1536 }
1537
1538 $data = array(
1539 'payment_field' => $payment_field,
1540 'action' => $action,
1541 'setting_meta' => $setting_meta,
1542 'better_payment_placeholder_class' => $better_payment_placeholder_class,
1543 );
1544
1545 $widgetObj = $this;
1546 $extraDatas = $data;
1547
1548 $better_payment_form_layout = sanitize_text_field($settings[ 'better_payment_user_dashboard_layout' ]);
1549
1550 $template_file = BETTER_PAYMENT_ADMIN_VIEWS_PATH . '/elementor/user-dashboard/' . $better_payment_form_layout . '.php';
1551 $is_pro_layout = false !== strpos( $better_payment_form_layout, '-pro' );
1552
1553 if ( $this->pro_enabled && $is_pro_layout ){
1554 $template_file = BETTER_PAYMENT_PRO_ADMIN_VIEWS_PATH . '/elementor/layouts/' . $better_payment_form_layout . '.php';
1555 }
1556
1557 if ( ( ! $this->pro_enabled ) && $is_pro_layout ){
1558 $template_file = BETTER_PAYMENT_ADMIN_VIEWS_PATH . '/partials/layout-pro-banners.php';
1559 }
1560
1561 if( $better_payment_form_layout !== 'layout-1' ){
1562 $template_file = $this->get_template( $better_payment_form_layout );
1563 }
1564
1565 $better_payment_form_content = '';
1566
1567 if ( file_exists($template_file) ) {
1568 ob_start();
1569 include $template_file;
1570 $better_payment_form_content = ob_get_contents();
1571 ob_end_clean();
1572 }
1573
1574 $better_payment_form_content = apply_filters( 'better_payment/elementor/editor/get_layout_content', $better_payment_form_content, $settings, $this, $data );
1575
1576 echo $better_payment_form_content;
1577 }
1578
1579 public function better_payment_free_layouts(){
1580 $layouts = apply_filters('better_payment/elementor/widget/user-dashboard/layouts', [
1581 'layout-1' => 'Layout 1',
1582 // 'layout-2' => 'Layout 2',
1583 // 'layout-3' => 'Layout 3'
1584 ]);
1585
1586 if ( ! $this->pro_enabled ) {
1587 $pro_banners = [
1588 // 'layout-4-pro' => 'Layout 4 (Pro)',
1589 // 'layout-5-pro' => 'Layout 5 (Pro)',
1590 // 'layout-6-pro' => 'Layout 6 (Pro)',
1591 ];
1592
1593 $layouts = array_merge( $layouts, $pro_banners );
1594 }
1595
1596 return $layouts;
1597 }
1598
1599 public function get_bp_settings( $settings = [] ) {
1600 $bp_settings = [];
1601
1602 $bp_settings['sidebar_show'] = ! empty( $settings['better_payment_user_dashboard_sidebar_show']) && 'yes' === $settings['better_payment_user_dashboard_sidebar_show'];
1603 $bp_settings['avatar_show'] = $bp_settings['sidebar_show'] && ( ! empty( $settings['better_payment_user_dashboard_avatar_show']) && 'yes' === $settings['better_payment_user_dashboard_avatar_show'] );
1604 $bp_settings['username_show'] = $bp_settings['sidebar_show'] && ( ! empty( $settings['better_payment_user_dashboard_username_show']) && 'yes' === $settings['better_payment_user_dashboard_username_show'] );
1605 $bp_settings['dashboard_show'] = ! empty( $settings['better_payment_user_dashboard_dashboard_show']) && 'yes' === $settings['better_payment_user_dashboard_dashboard_show'];
1606 $bp_settings['transactions_show'] = ! empty( $settings['better_payment_user_dashboard_transactions_show']) && 'yes' === $settings['better_payment_user_dashboard_transactions_show'];
1607 $bp_settings['subscriptions_show'] = ! empty( $settings['better_payment_user_dashboard_subscriptions_show']) && 'yes' === $settings['better_payment_user_dashboard_subscriptions_show'];
1608 $bp_settings['header_show'] = ! empty( $settings['better_payment_user_dashboard_header_show']) && 'yes' === $settings['better_payment_user_dashboard_header_show'];
1609
1610 $bp_settings['dashboard_label'] = ! empty( $settings['better_payment_user_dashboard_dashboard_label']) ? $settings['better_payment_user_dashboard_dashboard_label'] : 'Dashboard';
1611 $bp_settings['transaction_label'] = ! empty( $settings['better_payment_user_dashboard_transaction_label']) ? $settings['better_payment_user_dashboard_transaction_label'] : 'Transactions';
1612 $bp_settings['subscription_label'] = ! empty( $settings['better_payment_user_dashboard_subscription_label']) ? $settings['better_payment_user_dashboard_subscription_label'] : 'Subscriptions';
1613 $bp_settings['refresh_stats_label'] = ! empty( $settings['better_payment_user_dashboard_refresh_stats_label']) ? $settings['better_payment_user_dashboard_refresh_stats_label'] : 'Refresh Stats';
1614 $bp_settings['no_items_label'] = ! empty( $settings['better_payment_user_dashboard_no_items_label']) ? $settings['better_payment_user_dashboard_no_items_label'] : 'No subscriptions found!';
1615
1616 // Dashboard
1617 $bp_settings['dashboard_transaction_summary_show'] = ! empty( $settings['better_payment_user_dashboard_dashboard_transaction_summary_show']) && 'yes' === $settings['better_payment_user_dashboard_dashboard_transaction_summary_show'];
1618 $bp_settings['dashboard_analytics_report_show'] = ! empty( $settings['better_payment_user_dashboard_dashboard_analytics_report_show']) && 'yes' === $settings['better_payment_user_dashboard_dashboard_analytics_report_show'];
1619 $bp_settings['dashboard_recent_transactions_show'] = ! empty( $settings['better_payment_user_dashboard_dashboard_recent_transactions_show']) && 'yes' === $settings['better_payment_user_dashboard_dashboard_recent_transactions_show'];
1620 $bp_settings['dashboard_recurring_subscription_show'] = ! empty( $settings['better_payment_user_dashboard_dashboard_recurring_subscription_show']) && 'yes' === $settings['better_payment_user_dashboard_dashboard_recurring_subscription_show'];
1621 $bp_settings['dashboard_split_subscription_show'] = ! empty( $settings['better_payment_user_dashboard_dashboard_split_subscription_show']) && 'yes' === $settings['better_payment_user_dashboard_dashboard_split_subscription_show'];
1622
1623 $bp_settings['dashboard_total_amount_label'] = ! empty( $settings['better_payment_user_dashboard_dashboard_total_amount_label']) ? $settings['better_payment_user_dashboard_dashboard_total_amount_label'] : 'Total Amount';
1624 $bp_settings['dashboard_completed_amount_label'] = ! empty( $settings['better_payment_user_dashboard_dashboard_completed_amount_label']) ? $settings['better_payment_user_dashboard_dashboard_completed_amount_label'] : 'Completed Amount';
1625 $bp_settings['dashboard_incomplete_amount_label'] = ! empty( $settings['better_payment_user_dashboard_dashboard_incomplete_amount_label']) ? $settings['better_payment_user_dashboard_dashboard_incomplete_amount_label'] : 'Incomplete Amount';
1626 $bp_settings['dashboard_refunded_amount_label'] = ! empty( $settings['better_payment_user_dashboard_dashboard_refunded_amount_label']) ? $settings['better_payment_user_dashboard_dashboard_refunded_amount_label'] : 'Refunded Amount';
1627 $bp_settings['dashboard_view_all_label'] = ! empty( $settings['better_payment_user_dashboard_dashboard_view_all_label']) ? $settings['better_payment_user_dashboard_dashboard_view_all_label'] : 'View All';
1628 $bp_settings['dashboard_analytics_reports_label'] = ! empty( $settings['better_payment_user_dashboard_dashboard_analytics_reports_label']) ? $settings['better_payment_user_dashboard_dashboard_analytics_reports_label'] : 'Analytics Reports';
1629 $bp_settings['dashboard_recent_transactions_label'] = ! empty( $settings['better_payment_user_dashboard_dashboard_recent_transactions_label']) ? $settings['better_payment_user_dashboard_dashboard_recent_transactions_label'] : 'Recent Transactions';
1630 $bp_settings['dashboard_recurring_subscriptions_label'] = ! empty( $settings['better_payment_user_dashboard_dashboard_recurring_subscriptions_label']) ? $settings['better_payment_user_dashboard_dashboard_recurring_subscriptions_label'] : 'Recurring Subscriptions';
1631 $bp_settings['dashboard_split_subscriptions_label'] = ! empty( $settings['better_payment_user_dashboard_dashboard_split_subscriptions_label']) ? $settings['better_payment_user_dashboard_dashboard_split_subscriptions_label'] : 'Split Subscriptions';
1632
1633 // Transaction
1634 $bp_settings['transaction_table_name_show'] = ! empty( $settings['better_payment_user_dashboard_transactions_list_name_show']) && 'yes' === $settings['better_payment_user_dashboard_transactions_list_name_show'];
1635 $bp_settings['transaction_table_email_address_show'] = ! empty( $settings['better_payment_user_dashboard_transactions_list_email_address_show']) && 'yes' === $settings['better_payment_user_dashboard_transactions_list_email_address_show'];
1636 $bp_settings['transaction_table_amount_show'] = ! empty( $settings['better_payment_user_dashboard_transactions_list_amount_show']) && 'yes' === $settings['better_payment_user_dashboard_transactions_list_amount_show'];
1637 $bp_settings['transaction_table_payment_type_show'] = ! empty( $settings['better_payment_user_dashboard_transactions_list_payment_type_show']) && 'yes' === $settings['better_payment_user_dashboard_transactions_list_payment_type_show'];
1638 $bp_settings['transaction_table_transaction_id_show'] = ! empty( $settings['better_payment_user_dashboard_transactions_list_transaction_id_show']) && 'yes' === $settings['better_payment_user_dashboard_transactions_list_transaction_id_show'];
1639 $bp_settings['transaction_table_source_show'] = ! empty( $settings['better_payment_user_dashboard_transactions_list_source_show']) && 'yes' === $settings['better_payment_user_dashboard_transactions_list_source_show'];
1640 $bp_settings['transaction_table_status_show'] = ! empty( $settings['better_payment_user_dashboard_transactions_list_status_show']) && 'yes' === $settings['better_payment_user_dashboard_transactions_list_status_show'];
1641 $bp_settings['transaction_table_date_show'] = ! empty( $settings['better_payment_user_dashboard_transactions_list_date_show']) && 'yes' === $settings['better_payment_user_dashboard_transactions_list_date_show'];
1642 $bp_settings['transaction_table_action_show'] = ! empty( $settings['better_payment_user_dashboard_transactions_list_action_show']) && 'yes' === $settings['better_payment_user_dashboard_transactions_list_action_show'];
1643
1644 $bp_settings['transaction_table_name_label'] = ! empty( $settings['better_payment_user_dashboard_transactions_list_name_label']) ? $settings['better_payment_user_dashboard_transactions_list_name_label'] : 'Name';
1645 $bp_settings['transaction_table_email_address_label'] = ! empty( $settings['better_payment_user_dashboard_transactions_list_email_address_label']) ? $settings['better_payment_user_dashboard_transactions_list_email_address_label'] : 'Email Address';
1646 $bp_settings['transaction_table_amount_label'] = ! empty( $settings['better_payment_user_dashboard_transactions_list_amount_label']) ? $settings['better_payment_user_dashboard_transactions_list_amount_label'] : 'Amount';
1647 $bp_settings['transaction_table_payment_type_label'] = ! empty( $settings['better_payment_user_dashboard_transactions_list_payment_type_label']) ? $settings['better_payment_user_dashboard_transactions_list_payment_type_label'] : 'Payment Type';
1648 $bp_settings['transaction_table_transaction_id_label'] = ! empty( $settings['better_payment_user_dashboard_transactions_list_transaction_id_label']) ? $settings['better_payment_user_dashboard_transactions_list_transaction_id_label'] : 'Transaction ID';
1649 $bp_settings['transaction_table_source_label'] = ! empty( $settings['better_payment_user_dashboard_transactions_list_source_label']) ? $settings['better_payment_user_dashboard_transactions_list_source_label'] : 'Source';
1650 $bp_settings['transaction_table_status_label'] = ! empty( $settings['better_payment_user_dashboard_transactions_list_status_label']) ? $settings['better_payment_user_dashboard_transactions_list_status_label'] : 'Status';
1651 $bp_settings['transaction_table_date_label'] = ! empty( $settings['better_payment_user_dashboard_transactions_list_date_label']) ? $settings['better_payment_user_dashboard_transactions_list_date_label'] : 'Date';
1652 $bp_settings['transaction_table_action_label'] = ! empty( $settings['better_payment_user_dashboard_transactions_list_action_label']) ? $settings['better_payment_user_dashboard_transactions_list_action_label'] : 'Action';
1653 // $bp_settings['transaction_table_status_active_label'] = ! empty( $settings['better_payment_user_dashboard_transactions_list_status_active_label']) ? $settings['better_payment_user_dashboard_transactions_list_status_active_label'] : 'Active';
1654 // $bp_settings['transaction_table_status_inactive_label'] = ! empty( $settings['better_payment_user_dashboard_transactions_list_status_inactive_label']) ? $settings['better_payment_user_dashboard_transactions_list_status_inactive_label'] : 'Inactive';
1655 // $bp_settings['transaction_table_action_cancel_label'] = ! empty( $settings['better_payment_user_dashboard_transactions_list_action_cancel_label']) ? $settings['better_payment_user_dashboard_transactions_list_action_cancel_label'] : 'Cancel';
1656
1657 $bp_settings = apply_filters( 'better_payment/elementor/user_dashboard/bp_settings', $bp_settings, $settings );
1658
1659 return $bp_settings;
1660 }
1661
1662 public function get_dashboard_layout_settings( $widgetObj ) {
1663 $widgetObj->add_control(
1664 'better_payment_user_dashboard_layout_dashboard_label',
1665 [
1666 'label' => esc_html__( 'Dashboard', 'better-payment' ),
1667 'type' => Controls_Manager::HEADING,
1668 'separator' => 'before',
1669 ]
1670 );
1671
1672 $widgetObj->add_control(
1673 'better_payment_user_dashboard_dashboard_transaction_summary_show',
1674 [
1675 'label' => __( 'Transaction Summary', 'better-payment' ),
1676 'type' => Controls_Manager::SWITCHER,
1677 'label_on' => __( 'Show', 'better-payment' ),
1678 'label_off' => __( 'Hide', 'better-payment' ),
1679 'return_value' => 'yes',
1680 'default' => 'yes',
1681 ]
1682 );
1683
1684 $widgetObj->add_control(
1685 'better_payment_user_dashboard_dashboard_analytics_report_show',
1686 [
1687 'label' => __( 'Analytics Report', 'better-payment' ),
1688 'type' => Controls_Manager::SWITCHER,
1689 'label_on' => __( 'Show', 'better-payment' ),
1690 'label_off' => __( 'Hide', 'better-payment' ),
1691 'return_value' => 'yes',
1692 'default' => 'yes',
1693 ]
1694 );
1695
1696 $widgetObj->add_control(
1697 'better_payment_user_dashboard_dashboard_recent_transactions_show',
1698 [
1699 'label' => __( 'Recent Transactions', 'better-payment' ),
1700 'type' => Controls_Manager::SWITCHER,
1701 'label_on' => __( 'Show', 'better-payment' ),
1702 'label_off' => __( 'Hide', 'better-payment' ),
1703 'return_value' => 'yes',
1704 'default' => 'yes',
1705 ]
1706 );
1707
1708 $widgetObj->add_control(
1709 'better_payment_user_dashboard_dashboard_recurring_subscription_show',
1710 [
1711 'label' => __( 'Recurring Subscription', 'better-payment' ),
1712 'type' => Controls_Manager::SWITCHER,
1713 'label_on' => __( 'Show', 'better-payment' ),
1714 'label_off' => __( 'Hide', 'better-payment' ),
1715 'return_value' => 'yes',
1716 'default' => 'yes',
1717 ]
1718 );
1719
1720 $widgetObj->add_control(
1721 'better_payment_user_dashboard_dashboard_split_subscription_show',
1722 [
1723 'label' => __( 'Split Subscription', 'better-payment' ),
1724 'type' => Controls_Manager::SWITCHER,
1725 'label_on' => __( 'Show', 'better-payment' ),
1726 'label_off' => __( 'Hide', 'better-payment' ),
1727 'return_value' => 'yes',
1728 'default' => 'yes',
1729 ]
1730 );
1731 }
1732
1733 public function get_dashboard_content_settings( $widgetObj ) {
1734 $widgetObj->add_control(
1735 'better_payment_user_dashboard_content_dashboard_label',
1736 [
1737 'label' => esc_html__( 'Dashboard', 'better-payment' ),
1738 'type' => Controls_Manager::HEADING,
1739 'separator' => 'before',
1740 ]
1741 );
1742
1743 $widgetObj->add_control(
1744 'better_payment_user_dashboard_dashboard_total_amount_label',
1745 [
1746 'label' => esc_html__( 'Total Amount', 'better-payment' ),
1747 'type' => Controls_Manager::TEXT,
1748 'label_block' => false,
1749 'default' => esc_html__( 'Total Amount', 'better-payment' ),
1750 'ai' => [
1751 'active' => false,
1752 ],
1753 ]
1754 );
1755
1756 $widgetObj->add_control(
1757 'better_payment_user_dashboard_dashboard_completed_amount_label',
1758 [
1759 'label' => esc_html__( 'Completed Amount', 'better-payment' ),
1760 'type' => Controls_Manager::TEXT,
1761 'label_block' => false,
1762 'default' => esc_html__( 'Completed Amount', 'better-payment' ),
1763 'ai' => [
1764 'active' => false,
1765 ],
1766 ]
1767 );
1768
1769 $widgetObj->add_control(
1770 'better_payment_user_dashboard_dashboard_incomplete_amount_label',
1771 [
1772 'label' => esc_html__( 'Incomplete Amount', 'better-payment' ),
1773 'type' => Controls_Manager::TEXT,
1774 'label_block' => false,
1775 'default' => esc_html__( 'Incomplete Amount', 'better-payment' ),
1776 'ai' => [
1777 'active' => false,
1778 ],
1779 ]
1780 );
1781
1782 $widgetObj->add_control(
1783 'better_payment_user_dashboard_dashboard_refunded_amount_label',
1784 [
1785 'label' => esc_html__( 'Refunded Amount', 'better-payment' ),
1786 'type' => Controls_Manager::TEXT,
1787 'label_block' => false,
1788 'default' => esc_html__( 'Refunded Amount', 'better-payment' ),
1789 'ai' => [
1790 'active' => false,
1791 ],
1792 ]
1793 );
1794
1795 $widgetObj->add_control(
1796 'better_payment_user_dashboard_dashboard_view_all_label',
1797 [
1798 'label' => esc_html__( 'View All', 'better-payment' ),
1799 'type' => Controls_Manager::TEXT,
1800 'label_block' => false,
1801 'default' => esc_html__( 'View All', 'better-payment' ),
1802 'ai' => [
1803 'active' => false,
1804 ],
1805 ]
1806 );
1807
1808 $widgetObj->add_control(
1809 'better_payment_user_dashboard_dashboard_analytics_reports_label',
1810 [
1811 'label' => esc_html__( 'Analytics Reports', 'better-payment' ),
1812 'type' => Controls_Manager::TEXT,
1813 'label_block' => false,
1814 'default' => esc_html__( 'Analytics Reports', 'better-payment' ),
1815 'ai' => [
1816 'active' => false,
1817 ],
1818 ]
1819 );
1820
1821 $widgetObj->add_control(
1822 'better_payment_user_dashboard_dashboard_recent_transactions_label',
1823 [
1824 'label' => esc_html__( 'Recent Transactions', 'better-payment' ),
1825 'type' => Controls_Manager::TEXT,
1826 'label_block' => false,
1827 'default' => esc_html__( 'Recent Transactions', 'better-payment' ),
1828 'ai' => [
1829 'active' => false,
1830 ],
1831 ]
1832 );
1833
1834 $widgetObj->add_control(
1835 'better_payment_user_dashboard_dashboard_recurring_subscriptions_label',
1836 [
1837 'label' => esc_html__( 'Recurring Subscriptions', 'better-payment' ),
1838 'type' => Controls_Manager::TEXT,
1839 'label_block' => false,
1840 'default' => esc_html__( 'Recurring Subscriptions', 'better-payment' ),
1841 'ai' => [
1842 'active' => false,
1843 ],
1844 ]
1845 );
1846
1847 $widgetObj->add_control(
1848 'better_payment_user_dashboard_dashboard_split_subscriptions_label',
1849 [
1850 'label' => esc_html__( 'Split Subscriptions', 'better-payment' ),
1851 'type' => Controls_Manager::TEXT,
1852 'label_block' => false,
1853 'default' => esc_html__( 'Split Subscriptions', 'better-payment' ),
1854 'ai' => [
1855 'active' => false,
1856 ],
1857 ]
1858 );
1859 }
1860
1861 public function get_transaction_layout_settings( $widgetObj ) {
1862 $widgetObj->add_control(
1863 'better_payment_user_dashboard_layout_transactions_list_label',
1864 [
1865 'label' => esc_html__( 'Transactions List', 'better-payment' ),
1866 'type' => Controls_Manager::HEADING,
1867 'separator' => 'before',
1868 ]
1869 );
1870
1871 $widgetObj->add_control(
1872 'better_payment_user_dashboard_transactions_list_name_show',
1873 [
1874 'label' => __( 'Name', 'better-payment' ),
1875 'type' => Controls_Manager::SWITCHER,
1876 'label_on' => __( 'Show', 'better-payment' ),
1877 'label_off' => __( 'Hide', 'better-payment' ),
1878 'return_value' => 'yes',
1879 'default' => 'yes',
1880 ]
1881 );
1882
1883 $widgetObj->add_control(
1884 'better_payment_user_dashboard_transactions_list_email_address_show',
1885 [
1886 'label' => __( 'Email Address', 'better-payment' ),
1887 'type' => Controls_Manager::SWITCHER,
1888 'label_on' => __( 'Show', 'better-payment' ),
1889 'label_off' => __( 'Hide', 'better-payment' ),
1890 'return_value' => 'yes',
1891 'default' => 'yes',
1892 ]
1893 );
1894
1895 $widgetObj->add_control(
1896 'better_payment_user_dashboard_transactions_list_amount_show',
1897 [
1898 'label' => __( 'Amount', 'better-payment' ),
1899 'type' => Controls_Manager::SWITCHER,
1900 'label_on' => __( 'Show', 'better-payment' ),
1901 'label_off' => __( 'Hide', 'better-payment' ),
1902 'return_value' => 'yes',
1903 'default' => 'yes',
1904 ]
1905 );
1906
1907 $widgetObj->add_control(
1908 'better_payment_user_dashboard_transactions_list_payment_type_show',
1909 [
1910 'label' => __( 'Payment Type', 'better-payment' ),
1911 'type' => Controls_Manager::SWITCHER,
1912 'label_on' => __( 'Show', 'better-payment' ),
1913 'label_off' => __( 'Hide', 'better-payment' ),
1914 'return_value' => 'yes',
1915 'default' => 'yes',
1916 ]
1917 );
1918
1919 $widgetObj->add_control(
1920 'better_payment_user_dashboard_transactions_list_transaction_id_show',
1921 [
1922 'label' => __( 'Transaction ID', 'better-payment' ),
1923 'type' => Controls_Manager::SWITCHER,
1924 'label_on' => __( 'Show', 'better-payment' ),
1925 'label_off' => __( 'Hide', 'better-payment' ),
1926 'return_value' => 'yes',
1927 'default' => 'yes',
1928 ]
1929 );
1930
1931 $widgetObj->add_control(
1932 'better_payment_user_dashboard_transactions_list_source_show',
1933 [
1934 'label' => __( 'Source', 'better-payment' ),
1935 'type' => Controls_Manager::SWITCHER,
1936 'label_on' => __( 'Show', 'better-payment' ),
1937 'label_off' => __( 'Hide', 'better-payment' ),
1938 'return_value' => 'yes',
1939 'default' => 'yes',
1940 ]
1941 );
1942
1943 $widgetObj->add_control(
1944 'better_payment_user_dashboard_transactions_list_status_show',
1945 [
1946 'label' => __( 'Status', 'better-payment' ),
1947 'type' => Controls_Manager::SWITCHER,
1948 'label_on' => __( 'Show', 'better-payment' ),
1949 'label_off' => __( 'Hide', 'better-payment' ),
1950 'return_value' => 'yes',
1951 'default' => 'yes',
1952 ]
1953 );
1954
1955 $widgetObj->add_control(
1956 'better_payment_user_dashboard_transactions_list_date_show',
1957 [
1958 'label' => __( 'Date', 'better-payment' ),
1959 'type' => Controls_Manager::SWITCHER,
1960 'label_on' => __( 'Show', 'better-payment' ),
1961 'label_off' => __( 'Hide', 'better-payment' ),
1962 'return_value' => 'yes',
1963 'default' => 'yes',
1964 ]
1965 );
1966
1967 // $widgetObj->add_control(
1968 // 'better_payment_user_dashboard_transactions_list_action_show',
1969 // [
1970 // 'label' => __( 'Action', 'better-payment' ),
1971 // 'type' => Controls_Manager::SWITCHER,
1972 // 'label_on' => __( 'Show', 'better-payment' ),
1973 // 'label_off' => __( 'Hide', 'better-payment' ),
1974 // 'return_value' => 'yes',
1975 // 'default' => 'yes',
1976 // ]
1977 // );
1978 }
1979
1980 public function get_transaction_content_settings( $widgetObj ) {
1981 $widgetObj->add_control(
1982 'better_payment_user_dashboard_content_transactions_list_label',
1983 [
1984 'label' => esc_html__( 'Transactions List', 'better-payment' ),
1985 'type' => Controls_Manager::HEADING,
1986 'separator' => 'before',
1987 ]
1988 );
1989
1990 $widgetObj->add_control(
1991 'better_payment_user_dashboard_transactions_list_name_label',
1992 [
1993 'label' => esc_html__( 'Name', 'better-payment' ),
1994 'type' => Controls_Manager::TEXT,
1995 'label_block' => false,
1996 'default' => esc_html__( 'Name', 'better-payment' ),
1997 'ai' => [
1998 'active' => false,
1999 ],
2000 ]
2001 );
2002
2003 $widgetObj->add_control(
2004 'better_payment_user_dashboard_transactions_list_email_address_label',
2005 [
2006 'label' => esc_html__( 'Email Address', 'better-payment' ),
2007 'type' => Controls_Manager::TEXT,
2008 'label_block' => false,
2009 'default' => esc_html__( 'Email Address', 'better-payment' ),
2010 'ai' => [
2011 'active' => false,
2012 ],
2013 ]
2014 );
2015
2016 $widgetObj->add_control(
2017 'better_payment_user_dashboard_transactions_list_amount_label',
2018 [
2019 'label' => esc_html__( 'Amount', 'better-payment' ),
2020 'type' => Controls_Manager::TEXT,
2021 'label_block' => false,
2022 'default' => esc_html__( 'Amount', 'better-payment' ),
2023 'ai' => [
2024 'active' => false,
2025 ],
2026 ]
2027 );
2028
2029 $widgetObj->add_control(
2030 'better_payment_user_dashboard_transactions_list_payment_type_label',
2031 [
2032 'label' => esc_html__( 'Payment Type', 'better-payment' ),
2033 'type' => Controls_Manager::TEXT,
2034 'label_block' => false,
2035 'default' => esc_html__( 'Payment Type', 'better-payment' ),
2036 'ai' => [
2037 'active' => false,
2038 ],
2039 ]
2040 );
2041
2042 $widgetObj->add_control(
2043 'better_payment_user_dashboard_transactions_list_transaction_id_label',
2044 [
2045 'label' => esc_html__( 'Transaction ID', 'better-payment' ),
2046 'type' => Controls_Manager::TEXT,
2047 'label_block' => false,
2048 'default' => esc_html__( 'Transaction ID', 'better-payment' ),
2049 'ai' => [
2050 'active' => false,
2051 ],
2052 ]
2053 );
2054
2055 $widgetObj->add_control(
2056 'better_payment_user_dashboard_transactions_list_source_label',
2057 [
2058 'label' => esc_html__( 'Source', 'better-payment' ),
2059 'type' => Controls_Manager::TEXT,
2060 'label_block' => false,
2061 'default' => esc_html__( 'Source', 'better-payment' ),
2062 'ai' => [
2063 'active' => false,
2064 ],
2065 ]
2066 );
2067
2068 $widgetObj->add_control(
2069 'better_payment_user_dashboard_transactions_list_status_label',
2070 [
2071 'label' => esc_html__( 'Status', 'better-payment' ),
2072 'type' => Controls_Manager::TEXT,
2073 'label_block' => false,
2074 'default' => esc_html__( 'Status', 'better-payment' ),
2075 'ai' => [
2076 'active' => false,
2077 ],
2078 ]
2079 );
2080
2081 $widgetObj->add_control(
2082 'better_payment_user_dashboard_transactions_list_date_label',
2083 [
2084 'label' => esc_html__( 'Date', 'better-payment' ),
2085 'type' => Controls_Manager::TEXT,
2086 'label_block' => false,
2087 'default' => esc_html__( 'Date', 'better-payment' ),
2088 'ai' => [
2089 'active' => false,
2090 ],
2091 ]
2092 );
2093
2094 // $widgetObj->add_control(
2095 // 'better_payment_user_dashboard_transactions_list_action_label',
2096 // [
2097 // 'label' => esc_html__( 'Action', 'better-payment' ),
2098 // 'type' => Controls_Manager::TEXT,
2099 // 'label_block' => false,
2100 // 'default' => esc_html__( 'Action', 'better-payment' ),
2101 // 'ai' => [
2102 // 'active' => false,
2103 // ],
2104 // ]
2105 // );
2106
2107 // $widgetObj->add_control(
2108 // 'better_payment_user_dashboard_transactions_list_status_active_label',
2109 // [
2110 // 'label' => esc_html__( 'Status » Active', 'better-payment' ),
2111 // 'type' => Controls_Manager::TEXT,
2112 // 'label_block' => false,
2113 // 'default' => esc_html__( 'Active', 'better-payment' ),
2114 // 'ai' => [
2115 // 'active' => false,
2116 // ],
2117 // ]
2118 // );
2119
2120 // $widgetObj->add_control(
2121 // 'better_payment_user_dashboard_transactions_list_status_inactive_label',
2122 // [
2123 // 'label' => esc_html__( 'Status » Inactive', 'better-payment' ),
2124 // 'type' => Controls_Manager::TEXT,
2125 // 'label_block' => false,
2126 // 'default' => esc_html__( 'Inactive', 'better-payment' ),
2127 // 'ai' => [
2128 // 'active' => false,
2129 // ],
2130 // ]
2131 // );
2132
2133 // $widgetObj->add_control(
2134 // 'better_payment_user_dashboard_transactions_list_action_cancel_label',
2135 // [
2136 // 'label' => esc_html__( 'Action » Cancel', 'better-payment' ),
2137 // 'type' => Controls_Manager::TEXT,
2138 // 'label_block' => false,
2139 // 'default' => esc_html__( 'Cancel', 'better-payment' ),
2140 // 'ai' => [
2141 // 'active' => false,
2142 // ],
2143 // ]
2144 // );
2145 }
2146
2147 public function get_user_transactions( $email = '', $page = 1, $per_page = 10 ){
2148 $current_user = wp_get_current_user();
2149
2150 if( empty($email) ) {
2151 $email = $current_user->user_email;
2152 }
2153
2154 return DB::get_user_transactions_paginated( $email, [
2155 'page' => $page,
2156 'per_page' => $per_page,
2157 'type' => 'transactions',
2158 ] );
2159 }
2160
2161 }
2162