function get_customer_orders()
 {
     require_once 'wc_crm_order_list.php';
     $wc_crm_order_list = new WC_Crm_Order_List();
     $wc_crm_order_list->prepare_items();
     $wc_crm_order_list->display();
 }
Example #2
0
/**
 * Renders CRM page.
 */
function wc_customer_relationship_manager_render_list_page()
{
    echo '<div class="wrap" id="wc-crm-page">';
    wc_crm_page_title($_REQUEST);
    wc_crm_page_messages($_REQUEST);
    if (isset($_GET['message']) && $_GET['message'] == 1) {
        echo '<div id="message" class="updated fade"><p>Customer added.</p></div>';
    }
    if (isset($_GET['message']) && $_GET['message'] == 2 && isset($_GET['added_rows']) && !empty($_GET['added_rows'])) {
        echo '<div id="message" class="updated fade"><p>' . $_GET['added_rows'] . ' customers have been imported successfully.</p></div>';
    }
    $group = '';
    if (isset($_REQUEST['group']) && !empty($_REQUEST['group']) && $_REQUEST['group'] > 0) {
        $group = '&group=' . $_REQUEST['group'];
    }
    $statuses = wc_crm_get_statuses();
    $page_action = '';
    if (isset($_GET['order_list'])) {
        $page_action = 'order_list';
    } elseif (isset($_GET['product_list'])) {
        $page_action = 'product_list';
    } else {
        if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'email' && !isset($_REQUEST['send'])) {
            $page_action = 'email';
        } else {
            if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'phone_call' && !isset($_POST['save_phone_call'])) {
                $page_action = 'phone_call';
            }
        }
    }
    ?>
	<form method="<?php 
    echo empty($page_action) ? 'get' : 'post';
    ?>
" id="wc_crm_customers_form" action="admin.php?page=wc-customer-relationship-manager<?php 
    echo $group;
    ?>
">
		<input type="hidden" name="page" value="wc-customer-relationship-manager">
		<?php 
    switch ($page_action) {
        case 'order_list':
            require_once 'classes/wc_crm_order_list.php';
            $wc_crm_order_list = new WC_Crm_Order_List();
            $wc_crm_order_list->prepare_items();
            $wc_crm_order_list->display();
            break;
        case 'product_list':
            require_once 'classes/wc_crm_product_list.php';
            $wc_crm_product_list = new WC_Crm_Product_List();
            $wc_crm_product_list->prepare_items();
            $wc_crm_product_list->display();
            break;
        case 'email':
            WC_Crm_Email_Handling::display_form();
            break;
        case 'phone_call':
            WC_Crm_Phone_Call::display_form();
            break;
        default:
            $customers_table = WC_CRM()->customers_table();
            $customers_table->views();
            ?>
				<p class="search-box">
				<?php 
            $ss = '';
            if (!empty($_GET['s'])) {
                $ss = $_GET['s'];
            }
            ?>
					<label for="post-search-input" class="screen-reader-text"><?php 
            _e('Search', 'wc_customer_relationship_manager');
            ?>
</label>
					<input type="search" value="<?php 
            echo $ss;
            ?>
" name="s" id="post-search-input">
					<input type="submit" value="<?php 
            _e('Search Customers', 'wc_customer_relationship_manager');
            ?>
" class="button" id="search-submit" name="">
				</p>
				<?php 
            $customers_table->prepare_items();
            $customers_table->display();
            break;
    }
    ?>
	</form>
	<div id="customer_notes_popup" class="overlay_media_popup">
	    <div class="media-modal wp-core-ui">
	    	<a href="#" class="media-modal-close"><span class="media-modal-icon"><span class="screen-reader-text">Close</span></span></a>
	    	<div class="media-modal-content">
	    		<div class="media-frame mode-select wp-core-ui hide-menu">
	    			<div class="media-frame-title"><h1>Customer Notes</h1></div>
	    			<div class="media-frame-content">
	    				<iframe src="" frameborder="0"></iframe>
	    			</div>
	    		</div>
	    	</div>
	    </div>
	    <div class="media-modal-backdrop"></div>
	</div>
	</div>
<?php 
}