| @@ -1,6 +1,5 @@ | ||
| 1 | 1 | <?php |
| 2 | - | |
| 3 | 2 | namespace SureCartBlocks\Controllers; |
| 4 | 3 | |
| 5 | 4 | use SureCart\Models\Component; |
| 6 | 5 | use SureCart\Models\User; |
| @@ -5,9 +4,9 @@ | ||
| 5 | 4 | use SureCart\Models\Component; |
| 6 | 5 | use SureCart\Models\User; |
| 7 | 6 | |
| 8 | 7 | /** |
| 9 | - * The invoice controller. | |
| 8 | + * The subscription controller. | |
| 10 | 9 | */ |
| 11 | 10 | class InvoiceController extends BaseController { |
| 12 | 11 | /** |
| 13 | 12 | * Preview. |
| @@ -12,37 +11,9 @@ | ||
| 12 | 11 | /** |
| 13 | 12 | * Preview. |
| 14 | 13 | */ |
| 15 | 14 | public function preview( $attributes = [] ) { |
| 16 | - if ( ! is_user_logged_in() ) { | |
| 17 | - return; | |
| 18 | - } | |
| 19 | - | |
| 20 | - return wp_kses_post( | |
| 21 | - Component::tag( 'sc-invoices-list' ) | |
| 22 | - ->id( 'customer-invoices-preview' ) | |
| 23 | - ->with( | |
| 24 | - [ | |
| 25 | - 'allLink' => add_query_arg( | |
| 26 | - [ | |
| 27 | - 'tab' => $this->getTab(), | |
| 28 | - 'model' => 'invoice', | |
| 29 | - 'action' => 'index', | |
| 30 | - ] | |
| 31 | - ), | |
| 32 | - 'isCustomer' => User::current()->isCustomer(), | |
| 33 | - 'query' => apply_filters( | |
| 34 | - 'surecart/dashboard/invoice_list/query', | |
| 35 | - [ | |
| 36 | - 'customer_ids' => array_values( User::current()->customerIds() ), | |
| 37 | - 'status' => [ 'paid', 'open' ], | |
| 38 | - 'page' => 1, | |
| 39 | - 'per_page' => 5, | |
| 40 | - ] | |
| 41 | - ), | |
| 42 | - ] | |
| 43 | - )->render( $attributes['title'] ? "<span slot='heading'>" . $attributes['title'] . '</span>' : '' ) | |
| 44 | - ); | |
| 15 | + return; | |
| 45 | 16 | } |
| 46 | 17 | |
| 47 | 18 | /** |
| 48 | 19 | * Index. |
| @@ -47,47 +18,7 @@ | ||
| 47 | 18 | /** |
| 48 | 19 | * Index. |
| 49 | 20 | */ |
| 50 | 21 | public function index() { |
| 51 | - if ( ! is_user_logged_in() ) { | |
| 52 | - return; | |
| 53 | - } | |
| 54 | - ob_start(); | |
| 55 | - ?> | |
| 56 | - | |
| 57 | - <sc-spacing style="--spacing: var(--sc-spacing-large)"> | |
| 58 | - <sc-breadcrumbs> | |
| 59 | - <sc-breadcrumb href="<?php echo esc_url( add_query_arg( [ 'tab' => $this->getTab() ], remove_query_arg( array_keys( $_GET ) ) ) ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended ?>"> | |
| 60 | - <?php esc_html_e( 'Dashboard', 'surecart' ); ?> | |
| 61 | - </sc-breadcrumb> | |
| 62 | - <sc-breadcrumb> | |
| 63 | - <?php esc_html_e( 'Invoices', 'surecart' ); ?> | |
| 64 | - </sc-breadcrumb> | |
| 65 | - </sc-breadcrumbs> | |
| 66 | - | |
| 67 | - <?php | |
| 68 | - echo wp_kses_post( | |
| 69 | - Component::tag( 'sc-invoices-list' ) | |
| 70 | - ->id( 'customer-invoices-index' ) | |
| 71 | - ->with( | |
| 72 | - [ | |
| 73 | - 'heading' => __( 'Invoices', 'surecart' ), | |
| 74 | - 'isCustomer' => User::current()->isCustomer(), | |
| 75 | - 'query' => apply_filters( | |
| 76 | - 'surecart/dashboard/invoice_list/query', | |
| 77 | - [ | |
| 78 | - 'customer_ids' => array_values( User::current()->customerIds() ), | |
| 79 | - 'status' => [ 'paid', 'open' ], | |
| 80 | - 'page' => 1, | |
| 81 | - 'per_page' => 10, | |
| 82 | - ] | |
| 83 | - ), | |
| 84 | - ] | |
| 85 | - )->render() | |
| 86 | - ); | |
| 87 | - ?> | |
| 88 | - </sc-spacing> | |
| 89 | - | |
| 90 | - <?php | |
| 91 | - return ob_get_clean(); | |
| 22 | + return; | |
| 92 | 23 | } |
| 93 | 24 | } |