| Line 15... |
Line 15... |
| 15 |
*/
|
15 |
*/
|
| 16 |
public $components = array('Paginator');
|
16 |
public $components = array('Paginator');
|
| 17 |
|
17 |
|
| 18 |
public function beforeFilter() {
|
18 |
public function beforeFilter() {
|
| 19 |
parent::beforeFilter();
|
19 |
parent::beforeFilter();
|
| 20 |
$this->Auth->allow('add','mine','pendingcashbacks','all');
|
20 |
// $this->Auth->allow('add','mine','pendingcashbacks','all');
|
| 21 |
$this->apihost = Configure::read('pythonapihost');
|
21 |
$this->apihost = Configure::read('pythonapihost');
|
| 22 |
}
|
22 |
}
|
| 23 |
|
23 |
|
| 24 |
|
24 |
|
| 25 |
public function getOrderFilters($type='user') {
|
25 |
public function getOrderFilters($type='user') {
|
| Line 40... |
Line 40... |
| 40 |
public function mine() {
|
40 |
public function mine() {
|
| 41 |
$type = $this->request->query('type');
|
41 |
$type = $this->request->query('type');
|
| 42 |
$page = $this->request->query('page');
|
42 |
$page = $this->request->query('page');
|
| 43 |
$page = isset($page)?$page:1;
|
43 |
$page = isset($page)?$page:1;
|
| 44 |
$userId = $this->request->query('user_id');
|
44 |
$userId = $this->request->query('user_id');
|
| 45 |
if(isset($userId) && !empty($userId)){
|
- |
|
| 46 |
$this->loadModel('User');
|
- |
|
| 47 |
$dbuser = $this->User->findById($userId);
|
- |
|
| 48 |
$this->Auth->login($dbuser['User']);
|
- |
|
| 49 |
}
|
- |
|
| 50 |
$this->layout = "innerpages";
|
45 |
$this->layout = "innerpages";
|
| 51 |
$url = $this->apihost."storeorder/user/".$this->Auth->User('id')."?page=$page&window=10";
|
46 |
$url = $this->apihost."storeorder/user/".$this->Auth->User('id')."?page=$page&window=10";
|
| 52 |
if(isset($type) && !empty($type)) {
|
47 |
if(isset($type) && !empty($type)) {
|
| 53 |
$url .= '&type='.$type;
|
48 |
$url .= '&type='.$type;
|
| 54 |
}
|
49 |
}
|
| Line 81... |
Line 76... |
| 81 |
$this->set(compact('ignoredFields','page','totalPages','userId','activestores','storemapping','amazonorderurl'));
|
76 |
$this->set(compact('ignoredFields','page','totalPages','userId','activestores','storemapping','amazonorderurl'));
|
| 82 |
}
|
77 |
}
|
| 83 |
|
78 |
|
| 84 |
public function pendingcashbacks() {
|
79 |
public function pendingcashbacks() {
|
| 85 |
$userId = $this->request->query('user_id');
|
80 |
$userId = $this->request->query('user_id');
|
| 86 |
if(isset($userId) && !empty($userId)){
|
- |
|
| 87 |
$this->loadModel('User');
|
- |
|
| 88 |
$dbuser = $this->User->findById($userId);
|
- |
|
| 89 |
$this->Auth->login($dbuser['User']);
|
- |
|
| 90 |
}
|
- |
|
| 91 |
$this->layout = "innerpages";
|
81 |
$this->layout = "innerpages";
|
| 92 |
$url = $this->apihost."storeorder/user/".$userId."?page=1&window=50&searchMap=%7B\"subOrders.cashBackStatus\"%3A%20%7B\"%24in\"%3A%20%5B\"Approved\"%2C%20\"Pending\"%5D%7D%7D";
|
82 |
$url = $this->apihost."storeorder/user/".$userId."?page=1&window=50&searchMap=%7B\"subOrders.cashBackStatus\"%3A%20%7B\"%24in\"%3A%20%5B\"Approved\"%2C%20\"Pending\"%5D%7D%7D";
|
| 93 |
$response = $this->make_request($url,null);
|
83 |
$response = $this->make_request($url,null);
|
| 94 |
// debug($response);
|
84 |
// debug($response);
|
| 95 |
$creditedOrders = $pendingOrders = $approvedOrders = array();
|
85 |
$creditedOrders = $pendingOrders = $approvedOrders = array();
|