Initial Commit
This commit is contained in:
58
inc/list-tables/customer-panel/class-invoice-list-table.php
Normal file
58
inc/list-tables/customer-panel/class-invoice-list-table.php
Normal file
@ -0,0 +1,58 @@
|
||||
<?php
|
||||
/**
|
||||
* Customers Payment List Table class.
|
||||
*
|
||||
* @package WP_Ultimo
|
||||
* @subpackage List_Table
|
||||
* @since 2.0.0
|
||||
*/
|
||||
|
||||
namespace WP_Ultimo\List_Tables\Customer_Panel;
|
||||
|
||||
// Exit if accessed directly
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
use WP_Ultimo\List_Tables\Payment_List_Table as Parent_Payment_List_Table;
|
||||
|
||||
/**
|
||||
* Payment List Table class.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
class Invoice_List_Table extends Parent_Payment_List_Table {
|
||||
|
||||
/**
|
||||
* Returns the list of columns for this particular List Table.
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @return array
|
||||
*/
|
||||
public function get_columns() {
|
||||
|
||||
$columns = array(
|
||||
'hash' => __('Code', 'wp-ultimo'),
|
||||
'status' => __('Status', 'wp-ultimo'),
|
||||
'total' => __('Total', 'wp-ultimo'),
|
||||
'date_created' => __('Created at', 'wp-ultimo'),
|
||||
);
|
||||
|
||||
return $columns;
|
||||
|
||||
} // end get_columns;
|
||||
|
||||
/**
|
||||
* Clears the bulk actions.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*
|
||||
* @param string $which Top or bottom.
|
||||
* @return array
|
||||
*/
|
||||
public function bulk_actions($which = '') {
|
||||
|
||||
return array();
|
||||
|
||||
} // end bulk_actions;
|
||||
|
||||
} // end class Invoice_List_Table;
|
||||
|
98
inc/list-tables/customer-panel/class-product-list-table.php
Normal file
98
inc/list-tables/customer-panel/class-product-list-table.php
Normal file
@ -0,0 +1,98 @@
|
||||
<?php
|
||||
/**
|
||||
* Customers Site List Table class.
|
||||
*
|
||||
* @package WP_Ultimo
|
||||
* @subpackage List_Table
|
||||
* @since 2.0.0
|
||||
*/
|
||||
|
||||
namespace WP_Ultimo\List_Tables\Customer_Panel;
|
||||
|
||||
// Exit if accessed directly
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
use WP_Ultimo\List_Tables\Product_List_Table as Parent_Product_List_Table;
|
||||
|
||||
/**
|
||||
* Product List Table class.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
class Product_List_Table extends Parent_Product_List_Table {
|
||||
|
||||
/**
|
||||
* Initializes the table.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public function __construct() {
|
||||
|
||||
parent::__construct();
|
||||
|
||||
$this->modes = array(
|
||||
'grid' => __('Grid View'),
|
||||
);
|
||||
|
||||
$this->current_mode = 'grid';
|
||||
|
||||
} // end __construct;
|
||||
|
||||
/**
|
||||
* Returns the list of columns for this particular List Table.
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @return array
|
||||
*/
|
||||
public function get_columns() {
|
||||
|
||||
return array();
|
||||
|
||||
} // end get_columns;
|
||||
|
||||
/**
|
||||
* Resets the filters.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public function get_filters(): array {
|
||||
|
||||
return array(
|
||||
'filters' => array(),
|
||||
'date_filters' => array(),
|
||||
);
|
||||
|
||||
} // end get_filters;
|
||||
|
||||
/**
|
||||
* Resets bulk actions.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*
|
||||
* @param string $which Top or bottom.
|
||||
* @return array
|
||||
*/
|
||||
public function bulk_actions($which = '') {
|
||||
|
||||
return array();
|
||||
|
||||
} // end bulk_actions;
|
||||
|
||||
/**
|
||||
* Renders the customer card for grid mode.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*
|
||||
* @param WP_Ultimo\Models\Customer $item The customer being shown.
|
||||
* @return void
|
||||
*/
|
||||
public function single_row_grid($item) {
|
||||
|
||||
wu_get_template('base/products/grid-item', array(
|
||||
'item' => $item,
|
||||
'list_table' => $this,
|
||||
));
|
||||
|
||||
} // end single_row_grid;
|
||||
|
||||
} // end class Product_List_Table;
|
119
inc/list-tables/customer-panel/class-site-list-table.php
Normal file
119
inc/list-tables/customer-panel/class-site-list-table.php
Normal file
@ -0,0 +1,119 @@
|
||||
<?php
|
||||
/**
|
||||
* Customers Site List Table class.
|
||||
*
|
||||
* @package WP_Ultimo
|
||||
* @subpackage List_Table
|
||||
* @since 2.0.0
|
||||
*/
|
||||
|
||||
namespace WP_Ultimo\List_Tables\Customer_Panel;
|
||||
|
||||
// Exit if accessed directly
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
use WP_Ultimo\List_Tables\Site_List_Table as Parent_Site_List_Table;
|
||||
|
||||
/**
|
||||
* Site List Table class.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
class Site_List_Table extends Parent_Site_List_Table {
|
||||
|
||||
/**
|
||||
* Initializes the table.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public function __construct() {
|
||||
|
||||
parent::__construct();
|
||||
|
||||
$this->modes = array(
|
||||
'grid' => __('Grid View'),
|
||||
);
|
||||
|
||||
$this->current_mode = 'grid';
|
||||
|
||||
} // end __construct;
|
||||
|
||||
/**
|
||||
* Returns the list of columns for this particular List Table.
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @return array
|
||||
*/
|
||||
public function get_columns() {
|
||||
|
||||
return array();
|
||||
|
||||
} // end get_columns;
|
||||
|
||||
/**
|
||||
* Clears filters.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public function get_filters(): array {
|
||||
|
||||
return array(
|
||||
'filters' => array(),
|
||||
'date_filters' => array(),
|
||||
);
|
||||
|
||||
} // end get_filters;
|
||||
|
||||
/**
|
||||
* Clears views.
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @return array
|
||||
*/
|
||||
public function get_views() {
|
||||
|
||||
return array(
|
||||
'all' => array(
|
||||
'field' => 'type',
|
||||
'url' => add_query_arg('type', 'all'),
|
||||
'label' => __('Your Sites', 'wp-ultimo'),
|
||||
'count' => 0,
|
||||
),
|
||||
);
|
||||
|
||||
} // end get_views;
|
||||
|
||||
/**
|
||||
* Get the extra fields based on the request.
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @return array
|
||||
*/
|
||||
public function get_extra_fields() {
|
||||
|
||||
$customer = wu_get_current_customer();
|
||||
|
||||
if (!$customer) {
|
||||
|
||||
return array(
|
||||
'blog_id__in' => array('null_id'), // pass absurd value to make sure the query returns nothing.
|
||||
);
|
||||
|
||||
} // end if;
|
||||
|
||||
$fields = parent::get_extra_fields();
|
||||
|
||||
$fields = array(
|
||||
'meta_query' => array(
|
||||
'customer_id' => array(
|
||||
'key' => 'wu_customer_id',
|
||||
'value' => $customer->get_id(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
return $fields;
|
||||
|
||||
} // end get_extra_fields;
|
||||
|
||||
} // end class Site_List_Table;
|
Reference in New Issue
Block a user