Subversion Repositories SmartDukaan

Rev

Rev 19748 | Rev 19775 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 19748 Rev 19768
Line 233... Line 233...
233
		$opt = array('conditions' => array('status'=> 'pending_verification'));
233
		$opt = array('conditions' => array('status'=> 'pending_verification'));
234
		$pending = $this->Retailer->find('all',$opt);
234
		$pending = $this->Retailer->find('all',$opt);
235
		$this->set(compact('pending'));
235
		$this->set(compact('pending'));
236
	}
236
	}
237
	
237
	
-
 
238
	public function admin_verifiedretailer(){
-
 
239
		$opt['conditions']= array('status' => 'retailer_verified');
-
 
240
		$verified = $this->Retailer->find('all',$opt);
-
 
241
		$this->set(compact('verified'));
-
 
242
	}
-
 
243
	
238
	public function admin_retailerverify($id,$tin){
244
	public function admin_retailerverify($id,$tin){
-
 
245
		if($this->request->is('post')){
-
 
246
			$data = $this->request->data;
-
 
247
			$retId = $data['Retailer']['retId'];
-
 
248
			$retcontact = $data['Retailer']['contact'];
-
 
249
			$cur_date = date('Y-m-d h:i:s', time());
-
 
250
			if($data['type'] == "Verify"){
-
 
251
				$retquery ="update retailers set status = 'retailer_verified' , isvalidated = 1  where id = ".$retId."";
-
 
252
				$this->Retailer->query($retquery);
-
 
253
			}elseif($data['type'] == "Cancel"){
-
 
254
				$retquery ="update retailers set status = 'not_verified' , comments = '".$data['Retailer']['text']."' where id = ".$retId."";
-
 
255
				$this->Retailer->query($retquery);
-
 
256
				
-
 
257
				$callhistoryquery = "insert into callhistory 
-
 
258
						(retailer_id,agent_id,mobile_number,call_type,sms_verified,call_time,duration_sec,
-
 
259
						last_fetch_time,call_disposition,disposition_description,disposition_comments,created) 
-
 
260
						values 
-
 
261
						(".$retId.",'2','".$retcontact."','verification',0,'".$cur_date."',0,'".$cur_date."',
-
 
262
						'other','verification cancelled','verification cancelled','".$cur_date."')";
-
 
263
				$this->Retailer->query($callhistoryquery);
-
 
264
			}elseif($data['type'] == "Pending"){
-
 
265
				$retquery ="update retailers set comments = '".$data['Retailer']['text']."' where id = ".$retId."";
-
 
266
				$this->Retailer->query($retquery);
-
 
267
				$callhistoryquery = "insert into callhistory
-
 
268
						(retailer_id,agent_id,mobile_number,call_type,sms_verified,call_time,duration_sec,
-
 
269
						last_fetch_time,call_disposition,disposition_description,disposition_comments,created)
-
 
270
						values
-
 
271
						(".$retId.",'2','".$retcontact."','verification',0,'".$cur_date."',0,'".$cur_date."',
-
 
272
						'other','verification still in process','verification still in  process','".$cur_date."')";
-
 
273
				$this->Retailer->query($callhistoryquery);
-
 
274
			}
-
 
275
			$this->redirect("pendingretailer");
-
 
276
		}
239
		$options['conditions'] = array('id'=> $id);
277
		$options['conditions'] = array('id'=> $id);
240
		$pending = $this->Retailer->find('first',$options);
278
		$pending = $this->Retailer->find('first',$options);
241
		$result = $pending['Retailer'];
279
		$result = $pending['Retailer'];
242
		$tinresult = "";
280
		$tinresult = "";
243
		if($tin != null){
281
		if($tin != null){
Line 248... Line 286...
248
				$this->set(compact('tinresult'));
286
				$this->set(compact('tinresult'));
249
			}
287
			}
250
		}
288
		}
251
		$this->set(compact('result'));
289
		$this->set(compact('result'));
252
	}
290
	}
-
 
291
	
-
 
292
	
253
	public function admin_verifycancel($id,$type){
293
	public function sendsms(){
254
		if($type == "verify"){
294
		$this->autoRender = false;
255
			$retquery ="update retailers set status = 'retailer_verified' and isvalidated = 1  where id = ".$id."";
295
		$this->request->onlyAllow('ajax');
256
			$this->Retailer->query($retquery);
296
		$contact = $this->request->query('contact');
257
		}else if($type == "cancel"){
297
		$retid = $this->request->query('retid');
258
			$retquery ="update retailers set status = 'not_verified' where id = ".$id."";
298
		$url = Configure::read('pythonapihost')."sendTransSms/code/".$retid."/2";
-
 
299
// 		$url = "http://45.79.106.95:8057/sendTransSms/code/6836700/2";
-
 
300
		if($contact != null || !empty($contact)){
259
			$this->Retailer->query($retquery);
301
			$url = $url."?mobile_number=".$contact;
260
		}
302
		}
-
 
303
		$response = $this->make_request($url,'{}');
-
 
304
		
261
		$this->redirect("pendingretailer");
305
		return json_encode($response);
262
	}
306
	}
263
}
307
}