diff --git a/api/application/config/constants.php b/api/application/config/constants.php index 6a7bd3db..76d2ef2b 100644 --- a/api/application/config/constants.php +++ b/api/application/config/constants.php @@ -85,9 +85,9 @@ defined('EXIT__AUTO_MIN') OR define('EXIT__AUTO_MIN', 9); // lowest automat defined('EXIT__AUTO_MAX') OR define('EXIT__AUTO_MAX', 125); // highest automatically-assigned error code // define login route name for token verification -//defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', '(listLessPDDetails/:any)'); // no errors +defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', '(listLessPDDetails/:any)'); // no errors //defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', '(listAllTemplates/:any)'); // no errors -defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', 'getTemplateQuestionAnswers'); // no errors +//defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', 'getListPDOfficers'); // no errors /*********************AWS resources Constants*************************************************/ defined('PROFILE_PICTURE_BUCKET_NAME') OR define('PROFILE_PICTURE_BUCKET_NAME','sineedgedevprofilepic'); @@ -117,6 +117,9 @@ defined('DRAFT') OR define('DRAFT','17'); /*******************End Of Constants PD status**************************/ +/*******************Define Constants for Table Names and Primarykeys**************************/ +defined('PDTEAM_CTY_PRODUCT_CS_COMBINATIONS') OR define('PDTEAM_CTY_PRODUCT_CS_COMBINATIONS','PDTEAM_CTY_PRODUCT_CS_COMBINATIONS'); + /*******************Define Constants for Table Names and Primarykeys**************************/ defined('INDUSTRYCLASSIFICATION') OR define('INDUSTRYCLASSIFICATION','m_industry_classification'); diff --git a/api/application/config/customconfig_one.php b/api/application/config/customconfig_one.php index 55ac134e..79b4f0fd 100644 --- a/api/application/config/customconfig_one.php +++ b/api/application/config/customconfig_one.php @@ -17,13 +17,13 @@ RwIDAQAB /* public key for encrypt AWS JWT LENDER_USER_POOL_ID_TOKEN */ $config['jwt_public_key_lender_dev'] = '-----BEGIN PUBLIC KEY----- -MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqTsyy4r3nrjumED4To7w -r1rfjMEzL+hcF8OwGm89aHoEzKLZqr12uQw3eK7tVV97QV8aYOi0zUinHlOVx1PM -Dgik5jW8aCBvGM5S6PAZXn3fj59HYtKL0HIQ1cxaoIUVXjRHD/QkcCEZuG5dIxij -8NOCnE+Ip2nVm9WXbKSb/KXuF+p69Osm8VpVz7hpa/Hcf50iOe3R82dpCytUKBX4 -eq0HukzvikhFNglSw5GV0pK0syZxvu/ERMg3ja4r9an8fMayVS2YpybtRl6CCCVP -7LKZG/M5n9UutA8GWMFeDw0qcI3kLdo6ijbdpGDUqjs+OY6MBH+uKLrzsqVNTamC -RwIDAQAB +MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAkvWF8GBAVs77bKzpOtnu +mBGQ9kC11Pqw64avOsTE8T0mEbPWCSedqP8ShZtoFRUnZbfCVYcYPkvl+Gx5nxrY +OvrlKxtVVbrcifuKJJ/qjSSUZucQVX1aeWjYofteevcPjJxa5JEQWCjRSeblbbit +KFtoiCHH5lOFOJ9Up25AbSzOfvKT8Q3IuJau+iDyaK7PAJk4zPMtIKwk4Xw0LXVa +VmOght1/MKQnkF1YhV58HUoUirrU00ZNf+aNGQ/RW0Egjdhd+pm0R6fXXDa287fE +Yq6J1S/I5ZhFdb5kxPcuoj3K8ZQ1iIAw4euy0fn0bver8KOQCWCBxlnMUVDzyy0x +DwIDAQAB -----END PUBLIC KEY-----'; /* public key for encrypt AWS JWT VENDOR_USER_POOL_ID_TOKEN diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index fc845ac8..738a92c1 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -590,11 +590,10 @@ class PD_Controller extends REST_Controller { $records = $this->post('records'); if($records['schedule_time'] != "" || $records['schedule_time'] != null) { - $id = $this->PD_Model->saveRecords($records,PDSCHEDULE); - if($id != '' || $id != null) - { + //$id = $this->PD_Model->saveRecords($records,PDSCHEDULE); + $where_condition_array = array('pd_id' => $records['fk_pd_id']); - $temp_array = array('pd_status' => SCHEDULED,'fk_updatedby'=>$records['fk_scheduled_by'],'updatedon'=>$records['createdon']); + $temp_array = array('pd_status' => SCHEDULED,'fk_updatedby'=>$records['fk_scheduled_by'],'updatedon'=>$records['createdon'],'scheduled_on'=>$records['schedule_time']); $pd_id_modified = $this->PD_Model->updateRecords($temp_array,PDTRIGGER,$where_condition_array); if($pd_id_modified != "" || $pd_id_modified != null) @@ -612,7 +611,7 @@ class PD_Controller extends REST_Controller { $data['msg'] = 'Not Updated! Try Later'; $this->response($data,REST_Controller::HTTP_OK); } - } + } @@ -631,12 +630,13 @@ class PD_Controller extends REST_Controller { $where_condition_array = array('pd_id'=>$pdid); $res_array = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,PDTRIGGER); - //2.Get Team Map Details based on step 1 + //2.Get Team ID based on Lender ID if(count($res_array)) { - $where_condition_array = array('fk_city_id' => $res_array[0]['fk_city'],'fk_lender_id' => $res_array[0]['fk_lender_id']); - $temp_city_id = $this->PD_Model->selectRecords(PDTEAMMAP,$where_condition_array,$limit=0,$offset=0); - + //$where_condition_array = array('lender_id' => $res_array[0]['fk_lender_id'],'city_id' =>$res_array[0]['fk_city'] ,'cs_id' =>$res_array[0]['fk_customer_segment'] ,'product_id' =>$res_array[0]['fk_product_id']); + $where_condition_array = array('lender_id' => 2,'city_id' => 17 ,'cs_id' => 1 ,'product_id' => 1); + $temp_city_id = $this->PD_Model->selectRecords(PDTEAM_CTY_PRODUCT_CS_COMBINATIONS,$where_condition_array,$limit=0,$offset=0); + //print_r($temp_city_id);die(); if(count($temp_city_id)) { if(isset($temp_city_id[0]['team_type'])) @@ -651,9 +651,9 @@ class PD_Controller extends REST_Controller { { //select list of pd officers based on pd type, product, customer segment, and team from table (t_pd_officiers_details) and choose minimun allocated one and assign pd Officer and change status form TRIGGERED to ALLOCATED - $fields = array('fk_user_id','allocated','scheduled','inprogress'); + $fields = array('fk_user_id','fk_pd_type_id','allocated','scheduled','inprogress'); - $where_condition_array = array('fk_pd_type_id' => $res_array[0]['fk_pd_type'],'fk_team_id' => $temp_city_id[0]['fk_team_id'],'fk_customer_segment' => $res_array[0]['fk_customer_segment'],'fk_product_id' => $res_array[0]['fk_product_id'],'isactive' => 1); + $where_condition_array = array('fk_team_id' => $temp_city_id[0]['pdteam_id'],'isactive' => 1); $list_of_pd_officers = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,PDOFFICIERSDETAILS); @@ -665,9 +665,10 @@ class PD_Controller extends REST_Controller { $this->db->FROM(USERPROFILE.' as USERPROFILE'); $this->db->WHERE('USERPROFILE.userid',$pdofficer['fk_user_id']); $names = $this->db->GET()->result_array(); + if(count($names)){ $list_of_pd_officers[$key]['first_name'] = $names[0]['first_name']; $list_of_pd_officers[$key]['last_name'] = $names[0]['last_name']; - + } } $data['dataStatus'] = true; @@ -717,12 +718,16 @@ class PD_Controller extends REST_Controller { */ public function listLessPDDetails_get() { - $page = 0;$limit = 50;$sort = 'DESC'; + $page = 0;$limit = 50;$sort = 'DESC';$pdofficerid = "";$datetype = "";$fdate ="";$tdate =""; if($this->get('page')) { $page = $this->get('page'); } if($this->get('limit')){ $limit = $this->get('limit'); } if($this->get('sort')) { $sort = $this->get('sort'); } + if($this->get('pdofficerid')) { $pdofficerid = $this->get('pdofficerid'); } + if($this->get('datetype')) { $datetype = $this->get('datetype'); } + if($this->get('fdate')) { $fdate = $this->get('fdate'); } + if($this->get('tdate')) { $tdate = $this->get('tdate'); } - $result_data = $this->PD_Model->listLessPDDetails($page,$limit,$sort); + $result_data = $this->PD_Model->listLessPDDetails($page,$limit,$sort,$pdofficerid,$datetype,$fdate,$tdate); if($result_data['data_status'] == true) { diff --git a/api/application/helpers/pdalerts_helper.php b/api/application/helpers/pdalerts_helper.php index e0d64a57..1cecea72 100644 --- a/api/application/helpers/pdalerts_helper.php +++ b/api/application/helpers/pdalerts_helper.php @@ -107,7 +107,7 @@ class PDALERTS } } - $msg = "PD for Lender Applicant ID -:". $core_details[0]['lender_applicant_id'] ." has been ". $core_details[0]['pd_status_name']; // status base configurable + $msg = "PD for Lender Applicant ID -:". $core_details[0]['lender_applicant_id'] ." has been ". $core_details[0]['pd_status_name']; // status base configurable //print_r($mobile_nos_to_send_notification); foreach($mobile_nos_to_send_notification as $no) { diff --git a/api/application/models/PD_Model.php b/api/application/models/PD_Model.php index 0b6d1659..8d861ede 100644 --- a/api/application/models/PD_Model.php +++ b/api/application/models/PD_Model.php @@ -11,7 +11,7 @@ class PD_Model extends SPARQ_Model { } - public function listLessPDDetails($page,$limit,$sort)// $page represents mysql offset + public function listLessPDDetails($page,$limit,$sort,$pdofficerid,$datetype,$fdate,$tdate)// $page represents mysql offset { $this->db->SELECT('PDTRIGGER.pd_id, PDTRIGGER.fk_lender_id,ENTITY.full_name as lender_full_name,ENTITY.short_name as lender_short_name, PDTRIGGER.lender_applicant_id, DATE_FORMAT(PDTRIGGER.pd_date_of_initiation, "%d/%m/%Y") as pd_date_of_initiation, PDTRIGGER.fk_product_id,PRODUCTS.name as product_name,PRODUCTS.abbr as product_abbr, PDTRIGGER.fk_subproduct_id,SUBPRODUCTS.name as subproduct_name,SUBPRODUCTS.abbr as subproduct_abbr, PDTRIGGER.fk_pd_type,PDTYPE.type_name as pd_type_name, PDTRIGGER.pd_status,PDSTATUS.pd_status_name, PDTRIGGER.pd_specific_clarification, DATE_FORMAT(PDTRIGGER.createdon,"%d/%m/%Y %H:%i:%s") as createdon, PDTRIGGER.fk_createdby, DATE_FORMAT(PDTRIGGER.updatedon,"%d/%m/%Y %H:%i:%s") as updatedon, PDTRIGGER.fk_updatedby,concat(USERPROFILE.first_name," ",USERPROFILE.last_name) as createdby,concat(USERPROFILE1.first_name," ",USERPROFILE1.last_name) as updatedby, PDTRIGGER.fk_pd_allocation_type,,PDALLOCATIONTYPE.pd_allocation_type_name, PDTRIGGER.fk_pd_allocated_to,concat(USERPROFILE2.first_name," ",USERPROFILE2.last_name) as pd_allocated_to,PDTRIGGER.fk_pd_template_id,TEMPLATE.template_name, PDTRIGGER.fk_customer_segment,CUSTOMERSEGMENT.name as customer_segment_name,CUSTOMERSEGMENT.abbr as customer_segment_abbr, PDTRIGGER.pd_officier_final_judgement, PDTRIGGER.pd_agency_id,AGENCY.full_name as agency_name, PDTRIGGER.loan_amount,PDTRIGGER.addressline1,PDTRIGGER.addressline2,PDTRIGGER.addressline3,PDTRIGGER.fk_city,CITY.name as city_name,PDTRIGGER.fk_state,STATE.name as state_name,PDTRIGGER.pincode'); $this->db->FROM(PDTRIGGER.' as PDTRIGGER'); @@ -29,9 +29,42 @@ class PD_Model extends SPARQ_Model { $this->db->JOIN(ENTITY.' as AGENCY','PDTRIGGER.pd_agency_id = AGENCY.entity_id','LEFT'); $this->db->JOIN(STATE.' as STATE','PDTRIGGER.fk_state = STATE.state_id ','LEFT'); $this->db->JOIN(CITY.' as CITY','PDTRIGGER.fk_city = CITY.city_id','LEFT'); + + if($pdofficerid != "" || $pdofficerid != null) + { + $this->db->WHERE('PDTRIGGER.fk_pd_allocated_to',$pdofficerid); + } + + if($datetype != "" || $datetype != null) + { + if($datetype == 1) + { + if($fdate != "" || $fdate != null) + { + $this->db->WHERE('PDTRIGGER.pd_date_of_initiation >=',$fdate); + } + if($tdate != "" || $tdate != null) + { + $this->db->WHERE('PDTRIGGER.pd_date_of_initiation <=',$tdate); + } + } + else if($datetype == 2) + { + if($fdate != "" || $fdate != null) + { + $this->db->WHERE('PDTRIGGER.scheduled_on >=',$fdate); + } + if($tdate != "" || $tdate != null) + { + $this->db->WHERE('PDTRIGGER.scheduled_on <=',$tdate); + } + } + + } $this->db->ORDER_BY('PDTRIGGER.pd_id',$sort); $this->db->LIMIT($limit,$page); $result_array = $this->db->GET()->result_array(); + print_r($this->db->last_query()); if(count($result_array) != 0) { foreach($result_array as $key => $result) diff --git a/api/application/models/Template_Management_Model.php b/api/application/models/Template_Management_Model.php index b7f2bd9d..29830105 100644 --- a/api/application/models/Template_Management_Model.php +++ b/api/application/models/Template_Management_Model.php @@ -140,7 +140,7 @@ class Template_Management_Model extends SPARQ_Model { } -return $categories; + return $categories; } } \ No newline at end of file