diff --git a/api/application/config/constants.php b/api/application/config/constants.php index 0ee6a128..a790e196 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', 'getPDFormDetails'); // no errors /*********************AWS resources Constants*************************************************/ defined('PROFILE_PICTURE_BUCKET_NAME') OR define('PROFILE_PICTURE_BUCKET_NAME','sineedgedevprofilepic'); @@ -427,6 +427,15 @@ defined('BOUNCEMASTERID') OR define('BOUNCEMASTERID','bounce_id'); defined('EXISTINGLOANTYPES') OR define('EXISTINGLOANTYPES','m_existing_loan_types'); defined('EXISTINGLOANTYPESID') OR define('EXISTINGLOANTYPESID','existing_loan_type_id'); +/*NOT IN TEST ENV*/ +defined('REPORTTEMPLATES') OR define('REPORTTEMPLATES','m_report_templates'); +defined('REPORTTEMPLATESID') OR define('REPORTTEMPLATESID','report_template_id'); + +defined('PDADDTIONALREQUIREMENTS') OR define('PDADDTIONALREQUIREMENTS','t_pd_addtional_requirements'); +defined('PDADDTIONALREQUIREMENTSID') OR define('PDADDTIONALREQUIREMENTSID','add_req_id'); + + + diff --git a/api/application/config/routes.php b/api/application/config/routes.php index 0b15f30b..ab03e9e1 100644 --- a/api/application/config/routes.php +++ b/api/application/config/routes.php @@ -112,6 +112,8 @@ $route['getCategoryGroupCombinations'] = 'Template_Management_Controller/getCate $route['saveScoreCardQuestions'] = 'Template_Management_Controller/saveScoreCardQuestions'; $route['getFormAndQuestionKeys'] = 'Template_Management_Controller/getFormAndQuestionKeys'; $route['getScorecardDetails'] = 'Template_Management_Controller/getScorecardDetails'; +$route['savePDReportTemplate'] = 'Template_Management_Controller/savePDReportTemplate'; +$route['getPDReportTemplate'] = 'Template_Management_Controller/getPDReportTemplate'; //QUESTION MANAGEMENT $route['(listAllQuestions/:any)'] = 'Question_Management_Controller/listAllQuestions/'; diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index c0282280..f560c7e8 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -230,7 +230,7 @@ class PD_Controller extends REST_Controller { $pd_details = json_decode($this->post('pd_details'),true); - + $pd_addtional_requirements = json_decode($this->post('addtional_requirements'),true); $pd_applicant_details = json_decode($this->post('pd_applicant_details'),true); $pd_document_titles = ""; $pd_document_from_mobile = ""; @@ -417,10 +417,20 @@ class PD_Controller extends REST_Controller { } } + } + /***********************END OF PD DOCUMENTS(base64 type) UPLOAD SECTION FROM MOBILE***********/ + + + /****************ADDTIONAL REQUIREMENTS SECTION*******************************************/ + if(($pd_id != null || $pd_id != '') + { + foreach($pd_addtional_requirements as $pd_addtional_requirement_key => $pd_addtional_requirement) + { + $this->PD_Model->saveRecords($pd_addtional_requirement,PDADDTIONALREQUIREMENTS); + } } - - /***********************END OF PD DOCUMENTS(base64 type) UPLOAD SECTION FROM MOBILE***********/ + /****************END OF ADDTIONAL REQUIREMENTS SECTION*******************************************/ if($pd_id != null || $pd_id != '' && $count != 0) @@ -451,9 +461,30 @@ class PD_Controller extends REST_Controller { public function updatePDMaster_post() { $pd_details = $this->post('records'); - // print_r($pd_details);die; - //print_r($pd_details); - + $pd_addtional_requirements = array(); + if(array_key_exists('addtional_requirements',$pd_details)) + { + $pd_addtional_requirements = $pd_details['addtional_requirements']; + unset($pd_details['addtional_requirements']); + } + + if(count($pd_addtional_requirements)) + { + foreach($pd_addtional_requirements as $requirement_key => $pd_addtional_requirement) + { + if($pd_addtional_requirement['add_req_id'] != null || $pd_addtional_requirement['add_req_id'] != "") + { + $where_condition_array = array('add_req_id' => $pd_addtional_requirement['add_req_id']); + $this->PD_Model->updateRecords($pd_addtional_requirement,PDADDTIONALREQUIREMENTS,$where_condition_array); + } + else + { + $pd_addtional_requirement['fk_pd_id'] = $pd_details['pd_id']; + $this->PD_Model->saveRecords($pd_addtional_requirement,PDADDTIONALREQUIREMENTS); + } + } + } + // OTP Generate Condition if($pd_details['pd_status'] == INITIATED) { @@ -1211,6 +1242,9 @@ 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 Addtional Requirements details + $result_data['pd_question_answer'] = $this->PD_Model->getPDAddtionalRequirements($pdid); + //Get All PD Logs $result_data['pd_logs'] = $this->PD_Model->getPDLogs($pdid); //print_r($result_data['pd_logs']);die(); @@ -1574,7 +1608,7 @@ class PD_Controller extends REST_Controller { $pd_details = $this->PD_Model->getPDMasterDetails($pd_id); $result_array = $this->PD_Model->getPDFormDetails($pd_id,$pd_form_id); - + print_r($result_array);die(); //call helper function for get structured key,value pairs $final_array = GETPDFORMDETAILS::getPDFormDetailsStructured($result_array,$pd_id,$pd_form_id); // *****************************Get Docs from bucket @@ -2480,4 +2514,22 @@ class PD_Controller extends REST_Controller { } } + + public function generatePDReport_post() + { + $records = $this->post('records'); + $pdid = $records['pd_id']; + + //Get PD Report Functions + $fields = array('report_template_id', 'fk_template_id','content'); + $where_condition_array = array('fk_template_id'=>$records['fk_template_id'],'isactive'=>1); + $result_array = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,REPORTTEMPLATES); + + if(count($result_array)) + { + + + } + + } } \ No newline at end of file diff --git a/api/application/controllers/Template_Management_Controller.php b/api/application/controllers/Template_Management_Controller.php index f22af7b0..0f6345a6 100644 --- a/api/application/controllers/Template_Management_Controller.php +++ b/api/application/controllers/Template_Management_Controller.php @@ -741,5 +741,62 @@ class Template_Management_Controller extends REST_Controller { } + public function savePDReportTemplate_post() + { + $records = $this->post('records'); + $pk_id = 0; + if($records['report_template_id'] != "" || $records['report_template_id'] != null) + { + $where_condition_array = array('report_template_id' => $records['report_template_id']); + $pk_id = $this->Template_Management_Model->updateRecords($records,REPORTTEMPLATES,$where_condition_array); + } + else + { + + $pk_id = $this->Template_Management_Model->saveRecords($records,REPORTTEMPLATES); + } + + if($pk_id != 0) + { + $data['dataStatus'] = true; + $data['status'] = REST_Controller::HTTP_OK; + $data['records'] = $pk_id; + $this->response($data,REST_Controller::HTTP_OK); + } + else + { + $data['dataStatus'] = false; + $data['status'] = REST_Controller::HTTP_NOT_MODIFIED; + $data['msg'] = 'Not enough Data to Calculate Assessed Income'; + $this->response($data,REST_Controller::HTTP_OK); + } + + } + + public function getPDReportTemplate_post() + { + $records = $this->post('records'); + + $fields = array('report_template_id', 'fk_template_id','content'); + $where_condition_array = array('fk_template_id'=>$records['fk_template_id'],'isactive'=>1); + $result_array = $this->Template_Management_Model->selectCustomRecords($fields,$where_condition_array,REPORTTEMPLATES); + if(count($result_array)) + { + $data['dataStatus'] = true; + $data['status'] = REST_Controller::HTTP_OK; + $data['records'] = $result_array; + $this->response($data,REST_Controller::HTTP_OK); + } + else + { + $data['dataStatus'] = false; + $data['status'] = REST_Controller::HTTP_NO_CONTENT; + $data['msg'] = 'No Data Available'; + $this->response($data,REST_Controller::HTTP_OK); + + } + } + + } \ No newline at end of file diff --git a/api/application/models/PD_Model.php b/api/application/models/PD_Model.php index 3cc76b08..2b2797c8 100644 --- a/api/application/models/PD_Model.php +++ b/api/application/models/PD_Model.php @@ -537,7 +537,10 @@ class PD_Model extends SPARQ_Model { return $result_array; } - + public funciton getPDAddtionalRequirements($pdid) + { + + } public function getTemplateForPD($pdid,$client) {