<?php

use_class('jng_sp_customers_special');
$class_jcs = new jng_sp_customers_special();
//AJAX ACTION
if (isset($_GET['type'])) {
    $type = tep_db_prepare_input($_GET['type']);
    $list = $class_jcs->retrieveList($type);
    $result = '';
    $result .= '<h2>';
    $result .= $class_jcs->getTypeSymbol($type) . ' ';
    $result .= $class_jcs->getTypeName($type) . ' Customers';
    $result .= '</h2>';
    $result .= '<div style="margin:10px 0 20px 0;">';
    if ($type != 'N') {
        $result .= '<a href="?open=sp-customers-special-list-add&amp;type=' . $type . '&amp;hidemenu=true" class="view_webpage"></a>';
        $result .= '<input type="button" class="button" name="addnew" value="Add Customer" onclick="$(this).siblings(\'a\').click();" />';
    } else {
        $result .= '<span class="notice">When removed from Blacklist/VIP list, customer will be moved here so all historical information is not lost</span>';
    }
    $result .= '</div>';
    if (count($list) == 0) {
        $result .= '<h3 class="red">No customer is found</h3>';
    } else {
        $table = array();
        $t = array();
        $t['r'] = 'Partner';
        $t['d'] = 'J&G ID';
        $t['c'] = 'Name';
        $t['a'] = 'Action';
        $table[] = $t;