diff --git a/api/application/config/constants.php b/api/application/config/constants.php index c37d62ee..636702e6 100644 --- a/api/application/config/constants.php +++ b/api/application/config/constants.php @@ -517,6 +517,12 @@ defined('PERSONALASSETGRIDID') OR define('PERSONALASSETGRIDID','personal_asset_g defined('PERSONALASSETGRIDVARIANCE') OR define('PERSONALASSETGRIDVARIANCE','m_personal_asset_grid_variance'); defined('PERSONALASSETGRIDVARIANCEID') OR define('PERSONALASSETGRIDVARIANCEID','m_personal_asset_grid_variance'); +defined('PDADDRESS') OR define('PDADDRESS','t_pd_address'); +defined('PDADDRESSID') OR define('PDADDRESSID','pd_address_id'); + +defined('PDCOMPANY') OR define('PDCOMPANY','t_pd_company'); +defined('PDCOMPANYID') OR define('PDCOMPANYID','pd_company_id'); + diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index 590b7016..a9e7254b 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -296,10 +296,22 @@ class PD_Controller extends REST_Controller { $pd_details = json_decode($this->post('pd_details'),true); $pd_addtional_requirements = array(); + $addresses = array(); + $company = array(); if($this->post('addtional_requirements')) { $pd_addtional_requirements = json_decode($this->post('addtional_requirements'),true); } + + if($this->post('addresses')) + { + $addresses = json_decode($this->post('addresses'),true); + } + + if($this->post('company')) + { + $company = json_decode($this->post('company'),true); + } $pd_applicant_details = json_decode($this->post('pd_applicant_details'),true); $pd_document_titles = ""; $pd_document_from_mobile = ""; @@ -528,6 +540,24 @@ class PD_Controller extends REST_Controller { $this->PD_Model->saveRecords($pd_addtional_requirement,PDADDTIONALREQUIREMENTS); } } + + if(count($addresses)) + { + foreach($addresses as $address_key => $address) + { + $address['fk_pd_id'] = $pd_id; + $this->PD_Model->saveRecords($address,PDADDRESS); + } + } + + if(count($company)) + { + foreach($company as $company_key => $new_company) + { + $new_company['fk_pd_id'] = $pd_id; + $this->PD_Model->saveRecords($new_company,PDCOMPANY); + } + } } /****************END OF ADDTIONAL REQUIREMENTS SECTION*******************************************/ @@ -762,6 +792,42 @@ class PD_Controller extends REST_Controller { } + + public function updatePDAddress_post() + { + $records = $this->post('records'); + $count = 0; + foreach($records as $key => $value) + { + if($value['pd_address_id'] != "" || $value['pd_address_id'] != null) + { + $where_condition_array = array('pd_address_id' => $value['pd_address_id']); + $id = $this->db->updateRecords($value,PDADDRESS,$where_condition_array); + if($id != "" || $id != null){ $count++; } + } + else + { + $id = $this->db->saveRecords($value,PDADDRESS); + if($id != "" || $id != null){ $count++; } + } + } + + if($count != count($records)) + { + $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'] = 'Something went wrong! Try later'; + $this->response($data,REST_Controller::HTTP_OK); + } + } + /** * Pd Discussion OTP Checking function * sriram @@ -1503,6 +1569,12 @@ class PD_Controller extends REST_Controller { //Get All PD Template and It's Question with Answers $result_data['pd_question_answer'] = $this->PD_Model->getPDQuestionAnswers($pdid); + //Get All PD Address + $result_data['pd_address'] = $this->PD_Model->getPDAddress($pdid); + + //Get All PD COmpanies + $result_data['pd_company'] = $this->PD_Model->getPDCompany($pdid); + //Get Addtional Requirements details $result_data['pd_additional_requirements'] = $this->PD_Model->getPDAdditionalRequirements($pdid); diff --git a/api/application/libraries/AWS_S3.php b/api/application/libraries/AWS_S3.php index 9beab15b..188e9f19 100644 --- a/api/application/libraries/AWS_S3.php +++ b/api/application/libraries/AWS_S3.php @@ -21,8 +21,8 @@ class AWS_S3 //echo "listAllBuckets"; $this->S3 = S3Client::factory($this->s3_properties); - // echo "Called"; - // $this->createNewBucket(); + // echo "Called"; + // $this->setCors(); } diff --git a/api/application/models/PD_Model.php b/api/application/models/PD_Model.php index 64f38f07..e821b17f 100644 --- a/api/application/models/PD_Model.php +++ b/api/application/models/PD_Model.php @@ -285,6 +285,47 @@ class PD_Model extends SPARQ_Model { } + + public function getPDAddress($pdid) + { + $this->db->SELECT('PDADDRESS.pd_address_id, PDADDRESS.addressline, PDADDRESS.fk_city, PDADDRESS.fk_state,PDADDRESS.pincode,PDADDRESS.isactive,PDADDRESS.createdon,PDADDRESS.updatedon,PDADDRESS.is_visited'); + $this->db->FROM(PDADDRESS.' as PDADDRESS'); + $this->db->JOIN(STATE.' as STATE','PDADDRESS.fk_state = STATE.state_id','LEFT'); + $this->db->JOIN(CITY.' as CITY','PDADDRESS.fk_city = CITY.city_id','LEFT'); + $this->db->WHERE('PDADDRESS.fk_pd_id ',$pdid); + $this->db->ORDER_BY('PDADDRESS.pd_address_id'); + $result_child_array = $this->db->GET()->result_array(); + + if(count($result_child_array) != 0) + { + return $result_child_array; + } + else + { + return array(); + } + } + + + public function getPDCompany($pdid) + { + + $this->db->SELECT('PDCOMPANY.pd_company_id, PDCOMPANY.company_name, PDCOMPANY.isactive,PDCOMPANY.createdon,PDCOMPANY.updatedon'); + $this->db->FROM(PDCOMPANY.' as PDCOMPANY'); + $this->db->WHERE('PDCOMPANY.fk_pd_id ',$pdid); + $this->db->ORDER_BY('PDCOMPANY.pd_company_id'); + $result_child_array = $this->db->GET()->result_array(); + + if(count($result_child_array) != 0) + { + return $result_child_array; + } + else + { + return array(); + } + } + /* * GET PD Log Details by pdid */