diff --git a/application/controllers/Webservices.php b/application/controllers/Webservices.php index f36511d..e72bd54 100644 --- a/application/controllers/Webservices.php +++ b/application/controllers/Webservices.php @@ -1184,12 +1184,12 @@ $currentpage = $currentpage==0 ? $currentpage : $currentpage-1; $start = $currentpage * $per_page; } - - if(isset($postdata['is_emergency']) && $postdata['is_emergency'] == 1){ + if(isset($postData['is_emergency']) && $postData['is_emergency'] == 1){ + $mechanicsListcount = $this->Webservice_model->getNearMechanics($postData,0,0,1); + $mechanicsList = $this->Webservice_model->getNearMechanics($postData,$start,$per_page,1); + } else { $mechanicsListcount = $this->Webservice_model->getNearMechanics($postData,0,0); $mechanicsList = $this->Webservice_model->getNearMechanics($postData,$start,$per_page); - } else { - } $total = 0; diff --git a/application/models/Webservice_model.php b/application/models/Webservice_model.php index 118b914..3b9b155 100644 --- a/application/models/Webservice_model.php +++ b/application/models/Webservice_model.php @@ -385,7 +385,7 @@ class Webservice_model extends CI_Model { return $respArr; } - public function getNearMechanics($postData = '',$start,$per_page){ + public function getNearMechanics($postData = '',$start='',$per_page='',$type=0){ $respArr = array('status'=>'error','message'=>'Something Went Wrong.'); if(empty($postData)){ return $respArr; @@ -413,6 +413,20 @@ class Webservice_model extends CI_Model { if(empty($mechData) || empty($mechData = $mechData->result_array())){ return 0; } + + if($type == 0){ + $respArr = $this->getNearMechanicsDetails($mechData,$issue_cat_id); + if($respArr['status'] == 'success'){ + return $respArr; + } + } + $respArr['status'] = 'success'; + $respArr['message'] = 'success'; + $respArr['data'] = $mechData; + return $respArr; + } + + public function getNearMechanicsDetails($mechData,$issue_cat_id){ $estimate = 0; $mechDataArr = array(); foreach($mechData AS $index => $data){