From 4bfbdfb10d754da6ee0e0bdc9514cbe256db2164 Mon Sep 17 00:00:00 2001 From: velz Date: Wed, 24 Oct 2018 14:50:46 +0530 Subject: [PATCH] ENTITY FULL --- api/application/config/constants.php | 2 +- api/application/config/routes.php | 3 + .../Entity_Management_Controller.php | 101 +++++++++++++++++- 3 files changed, 104 insertions(+), 2 deletions(-) diff --git a/api/application/config/constants.php b/api/application/config/constants.php index a33ca1c0..5a7fa6d8 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', 'saveEntityRegionMapping'); // no errors +defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', 'getVendorCityMap'); // no errors /*********************AWS resources Constants*************************************************/ defined('PROFILE_PICTURE_BUCKET_NAME') OR define('PROFILE_PICTURE_BUCKET_NAME','sineedgedevprofilepic'); diff --git a/api/application/config/routes.php b/api/application/config/routes.php index a0538a77..97b92293 100644 --- a/api/application/config/routes.php +++ b/api/application/config/routes.php @@ -125,6 +125,9 @@ $route['getEntityMasterInfo'] = 'Entity_Management_Controller/getEntityMasterInf $route['saveEntityBillingInfo'] = 'Entity_Management_Controller/saveEntityBillingInfo'; $route['getCityHierarchy'] = 'Entity_Management_Controller/getCityHierarchy'; $route['saveEntityRegionMapping'] = 'Entity_Management_Controller/saveEntityRegionMapping'; +$route['getEntityRegionCityMap'] = 'Entity_Management_Controller/getEntityRegionCityMap'; +$route['saveVendorCityMapping'] = 'Entity_Management_Controller/saveVendorCityMapping'; +$route['getVendorCityMap'] = 'Entity_Management_Controller/getVendorCityMap'; //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 b087df57..4a830477 100644 --- a/api/application/controllers/Entity_Management_Controller.php +++ b/api/application/controllers/Entity_Management_Controller.php @@ -369,7 +369,6 @@ class Entity_Management_Controller extends REST_Controller { /* * Save Entity Regions Mapping - , //fk_region_id, fk_city_id, fk_entity_id, createdon, fk_createdby, updatedon, fk_updatedby */ public function saveEntityRegionMapping_post() { @@ -413,5 +412,105 @@ class Entity_Management_Controller extends REST_Controller { } + /*Get Exist Mapped Region and City For Entity Edit Page*/ + public function getEntityRegionCityMap_get() + { + $entity_id = $this->get('entityid'); + $fields = array('fk_region_id','fk_city_id','fk_entity_id','entity_region_map_id'); + $where_condition_array = array('fk_entity_id' => $entity_id); + $records = $this->Entity_Management_Model->selectCustomRecords($fields,$where_condition_array,ENTITYREGION); + if($records != null || $records != "") + { + + $data['dataStatus'] = true; + $data['status'] = REST_Controller::HTTP_OK; + $data['records'] = $records; + $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 Vendor City Mapping + */ + public function saveVendorCityMapping_post() + { + $count = 0; + $records = $this->post('records'); + + foreach($records as $key => $record) + { + + if($record['vendor_city_map_id'] != null || $record['vendor_city_map_id'] != "") + { + + $where_condition_array = array('vendor_city_map_id' => $record['vendor_city_map_id']); + $vendor_city_map_id = $this->Entity_Management_Model->updateRecords($record,VENDORCITYMAP,$where_condition_array); + if($vendor_city_map_id != "" || $vendor_city_map_id != null){ $count++; } + } + else + { + + $vendor_city_map_id = $this->Entity_Management_Model->saveRecords($record,VENDORCITYMAP); + if($vendor_city_map_id != "" || $vendor_city_map_id != null){ $count++; } + } + } + + if(count($records) == $count) + { + $data['dataStatus'] = true; + $data['status'] = REST_Controller::HTTP_OK; + $data['records'] = true; + $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); + } + + + } + + + /*Get Exist Mapped Vendor and City For Entity Edit Page*/ + public function getVendorCityMap_get() + { + $entity_id = $this->get('entityid'); + $fields = array('vendor_city_map_id', 'fk_vendor_id', 'fk_city_id', 'isactive'); + $where_condition_array = array('fk_vendor_id' => $entity_id); + $records = $this->Entity_Management_Model->selectCustomRecords($fields,$where_condition_array,VENDORCITYMAP); + if($records != null || $records != "") + { + + $data['dataStatus'] = true; + $data['status'] = REST_Controller::HTTP_OK; + $data['records'] = $records; + $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); + } + + } + + } \ No newline at end of file