From d25b5a80e9c6cdbb6d1a22a688aaa34041e167dd Mon Sep 17 00:00:00 2001 From: velz Date: Wed, 24 Oct 2018 12:53:41 +0530 Subject: [PATCH] ENTITY PD --- api/application/config/constants.php | 6 ++-- api/application/config/routes.php | 1 + .../Entity_Management_Controller.php | 36 +++++++++++++++++++ .../models/Entity_Management_Model.php | 12 +++++++ api/application/models/PD_Model.php | 2 +- 5 files changed, 53 insertions(+), 4 deletions(-) diff --git a/api/application/config/constants.php b/api/application/config/constants.php index 6e44dd99..b52f5cae 100644 --- a/api/application/config/constants.php +++ b/api/application/config/constants.php @@ -87,7 +87,7 @@ defined('EXIT__AUTO_MAX') OR define('EXIT__AUTO_MAX', 125); // highest auto // 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', '(listAllTemplates/:any)'); // no errors -defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', 'getFullPDDetails'); // no errors +defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', 'getCityHierarchy'); // no errors /*********************AWS resources Constants*************************************************/ defined('PROFILE_PICTURE_BUCKET_NAME') OR define('PROFILE_PICTURE_BUCKET_NAME','sineedgedevprofilepic'); @@ -282,8 +282,8 @@ defined('PDTEAMPRODUCTID') OR define('PDTEAMPRODUCTID','pdteam_product_id'); defined('PDTEAMCUSTOMERSEGMENT') OR define('PDTEAMCUSTOMERSEGMENT','m_pdteam_customer_segment'); defined('PDTEAMCUSTOMERSEGMENTID') OR define('PDTEAMCUSTOMERSEGMENTID','pdteam_customer_segment_id'); -defined('ENTITYREGION') OR define('ENTITYREGION','m_entity_region'); -defined('ENTITYREGIONID') OR define('ENTITYREGIONID','entity_region_id'); +defined('ENTITYREGION') OR define('ENTITYREGION','m_entity_region_mapping'); +defined('ENTITYREGIONID') OR define('ENTITYREGIONID','entity_region_map_id'); defined('ENTITYSTATE') OR define('ENTITYSTATE','m_entity_state'); defined('ENTITYSTATEID') OR define('ENTITYSTATEID','entity_state_id'); diff --git a/api/application/config/routes.php b/api/application/config/routes.php index c2c7cdc5..a006ba8c 100644 --- a/api/application/config/routes.php +++ b/api/application/config/routes.php @@ -123,6 +123,7 @@ $route['getEntityBillingInfo'] = 'Entity_Management_Controller/getEntityBillingI $route['getLocationHierarchy'] = 'Entity_Management_Controller/getLocationHierarchy'; $route['getEntityMasterInfo'] = 'Entity_Management_Controller/getEntityMasterInfo'; $route['saveEntityBillingInfo'] = 'Entity_Management_Controller/saveEntityBillingInfo'; +$route['getCityHierarchy'] = 'Entity_Management_Controller/getCityHierarchy'; //PD RELATED $route['triggerNewPD'] = 'PD_Controller/triggerNewPD'; diff --git a/api/application/controllers/Entity_Management_Controller.php b/api/application/controllers/Entity_Management_Controller.php index a9f2ed2c..1a3818d3 100644 --- a/api/application/controllers/Entity_Management_Controller.php +++ b/api/application/controllers/Entity_Management_Controller.php @@ -338,6 +338,42 @@ class Entity_Management_Controller extends REST_Controller { } } } + + + + + /* + * Get Location Hierarchy as city and state - wrapped as one array for Lender Regions Mapping + */ + public function getCityHierarchy_get() + { + + $cities = $this->Entity_Management_Model->getCityHierarchy(); + + if(count($cities)) + { + $data['dataStatus'] = true; + $data['status'] = REST_Controller::HTTP_OK; + $data['records'] = $cities; + $this->response($data,REST_Controller::HTTP_OK); + } + else + { + $data['dataStatus'] = false; + $data['status'] = REST_Controller::HTTP_NOT_MODIFIED; + $data['msg'] = 'Records Not Found'; + $this->response($data,REST_Controller::HTTP_OK); + } + } + + + /* + * Save Entity Regions Mapping + */ + public function getCityHierarchy_get() + { + + } diff --git a/api/application/models/Entity_Management_Model.php b/api/application/models/Entity_Management_Model.php index ab638f46..354e4e27 100644 --- a/api/application/models/Entity_Management_Model.php +++ b/api/application/models/Entity_Management_Model.php @@ -90,6 +90,18 @@ class Entity_Management_Model extends SPARQ_Model { return $result; } + public function getCityHierarchy() + { + $this->db->SELECT('CITY.city_id,CITY.fk_state_id,CITY.name as city_name,STATE.name as state_name,CITY.isactive'); + $this->db->FROM(CITY.' as CITY'); + $this->db->JOIN(STATE.' as STATE','CITY.fk_state_id = STATE.state_id'); + $this->db->WHERE('CITY.isactive',1); + $data = $this->db->get()->result_array(); + return $data; + + } + + } \ No newline at end of file diff --git a/api/application/models/PD_Model.php b/api/application/models/PD_Model.php index 94e2827b..2ec91599 100644 --- a/api/application/models/PD_Model.php +++ b/api/application/models/PD_Model.php @@ -325,7 +325,7 @@ class PD_Model extends SPARQ_Model { } } - $result_data['child'] = array('Hi'=>'Welcome'); + //$result_data['child'] = array('Hi'=>'Welcome'); $result_data['master'] = $actual_logs; // Child History Start