diff --git a/api/application/config/constants.php b/api/application/config/constants.php index d6635b8f..e8e13311 100644 --- a/api/application/config/constants.php +++ b/api/application/config/constants.php @@ -85,16 +85,15 @@ 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', 'login'); // no errors -defined('ROUTE_LOGIN2') OR define('ROUTE_LOGIN2', 'login2'); // no errors -defined('ROUTE_LOGIN3') OR define('ROUTE_LOGIN3', 'login3'); // no errors +defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', '(listLessPDDetails/:any)'); // no errors -//AWS resources Constants +/*********************AWS resources Constants*************************************************/ defined('PROFILEPICTUREBUCKETNAME') OR define('PROFILEPICTUREBUCKETNAME','sineedgedevprofilepic'); +/*********************AWS resources Constants*************************************************/ +/*******************Define Constants for Table Names and Primarykeys**************************/ -//Define Constants for Table Names and Primarykeys defined('INDUSTRYCLASSIFICATION') OR define('INDUSTRYCLASSIFICATION','m_industry_classification'); defined('INDUSTRYCLASSIFICATIONID') OR define('INDUSTRYCLASSIFICATIONID','industry_classification_id'); @@ -147,7 +146,7 @@ defined('PDALLOCATIONTYPEID') OR define('PDALLOCATIONTYPEID','pd_allocation_type defined('PDLOCATIONAPPROACH') OR define('PDLOCATIONAPPROACH','m_pd_location_approach'); defined('PDLOCATIONAPPROACHID') OR define('PDLOCATIONAPPROACHID','pd_location_approach_id'); -defined('PDSTATUS') OR define('PDSTATUS','m_pd_status'); +defined('PDSTATUS') OR define('PDSTATUS','c_pd_status'); defined('PDSTATUSID') OR define('PDSTATUSID','pd_status_id'); defined('PDTYPE') OR define('PDTYPE','m_pd_type'); @@ -186,9 +185,6 @@ defined('USERPROFILEHIERARCHYID') OR define('USERPROFILEHIERARCHYID','user_lende defined('USERPROFILEROLES') OR define('USERPROFILEROLES','m_user_roles'); defined('USERPROFILEROLESID') OR define('USERPROFILEROLESID','user_role_id'); -defined('LENDER') OR define('LENDER','m_lender'); -defined('LENDERID') OR define('LENDERID','lender_id'); - defined('QUESTIONS') OR define('QUESTIONS','m_questions'); defined('QUESTIONSID') OR define('QUESTIONSID','question_id'); @@ -216,6 +212,15 @@ defined('TEMPLATEQUESTIONID') OR define('TEMPLATEQUESTIONID','template_question_ defined('TEMPLATEANSWERWEIGHTAGE') OR define('TEMPLATEANSWERWEIGHTAGE','m_template_answer_weightage'); defined('TEMPLATEANSWERWEIGHTAGEID') OR define('TEMPLATEANSWERWEIGHTAGEID','template_answer_weightage_id'); +defined('PDTRIGGER') OR define('PDTRIGGER','t_pd_triggered'); +defined('PDTRIGGERID') OR define('PDTRIGGERID','pd_id'); + +defined('PDAPPLICANTSDETAILS') OR define('PDAPPLICANTSDETAILS','t_pd_co_applicants_details'); +defined('PDAPPLICANTSDETAILSID') OR define('PDAPPLICANTSDETAILSID','pd_co_applicant_id'); + +defined('PDSTATUS') OR define('PDSTATUS','m_pd_status'); +defined('PDSTATUSID') OR define('PDSTATUSID','pd_status_id'); + diff --git a/api/application/config/customconfig_one.php b/api/application/config/customconfig_one.php index 9c3b3976..55ac134e 100644 --- a/api/application/config/customconfig_one.php +++ b/api/application/config/customconfig_one.php @@ -2,7 +2,7 @@ -/* public key for encrypt AWS JWT token +/* public key for encrypt AWS JWT SINE_EDGE_USER_POOL_ID_TOKEN */ $config['jwt_public_key'] = '-----BEGIN PUBLIC KEY----- MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqTsyy4r3nrjumED4To7w @@ -14,6 +14,8 @@ eq0HukzvikhFNglSw5GV0pK0syZxvu/ERMg3ja4r9an8fMayVS2YpybtRl6CCCVP RwIDAQAB -----END PUBLIC KEY-----'; +/* public key for encrypt AWS JWT LENDER_USER_POOL_ID_TOKEN +*/ $config['jwt_public_key_lender_dev'] = '-----BEGIN PUBLIC KEY----- MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqTsyy4r3nrjumED4To7w r1rfjMEzL+hcF8OwGm89aHoEzKLZqr12uQw3eK7tVV97QV8aYOi0zUinHlOVx1PM @@ -24,6 +26,8 @@ eq0HukzvikhFNglSw5GV0pK0syZxvu/ERMg3ja4r9an8fMayVS2YpybtRl6CCCVP RwIDAQAB -----END PUBLIC KEY-----'; +/* public key for encrypt AWS JWT VENDOR_USER_POOL_ID_TOKEN +*/ $config['jwt_public_key_vendor_dev'] = '-----BEGIN PUBLIC KEY----- MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqTsyy4r3nrjumED4To7w r1rfjMEzL+hcF8OwGm89aHoEzKLZqr12uQw3eK7tVV97QV8aYOi0zUinHlOVx1PM diff --git a/api/application/config/routes.php b/api/application/config/routes.php index ac19cf7a..684a1188 100644 --- a/api/application/config/routes.php +++ b/api/application/config/routes.php @@ -96,4 +96,8 @@ $route['listAllEntites'] = 'Entity_Management_Controller/listAllEntites'; $route['saveNewEntity'] = 'Entity_Management_Controller/saveNewEntity'; $route['saveExistEntity'] = 'Entity_Management_Controller/saveExistEntity'; +//PD RELATED +$route['triggerNewPD'] = 'PD_Controller/triggerNewPD'; +$route['updateExistPD'] = 'PD_Controller/updateExistPD'; +$route['(listLessPDDetails/:any)'] = 'PD_Controller/listLessPDDetails/'; diff --git a/api/application/controllers/Entity_Management_Controller.php b/api/application/controllers/Entity_Management_Controller.php index 727c47a8..c856a51c 100644 --- a/api/application/controllers/Entity_Management_Controller.php +++ b/api/application/controllers/Entity_Management_Controller.php @@ -36,7 +36,7 @@ class Entity_Management_Controller extends REST_Controller { { $data['dataStatus'] = false; $data['status'] = REST_Controller::HTTP_NO_CONTENT; - $this->response($data,REST_Controller::HTTP_NO_CONTENT); + $this->response($data,REST_Controller::HTTP_OK); } } diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php new file mode 100644 index 00000000..9424b1ea --- /dev/null +++ b/api/application/controllers/PD_Controller.php @@ -0,0 +1,138 @@ +load->model('PD_Model'); + + } + + + public function triggerNewPD_post() + { + $pd_details = $this->post('pd_details'); + $pd_applicant_details = $this->post('pd_applicant_details'); + $count = 0; + + $pd_id = $this->PD_Model->saveRecords(PDTRIGGER,$pd_details); + + if($pd_id != null || $pd_id != '') + { + foreach($pd_applicant_details as $pd_applicant_detail) + { + $pd_applicant_detail['fk_pd_id'] = $pd_id; + $co_applicant_id = $this->PD_Model->saveRecords(PDAPPLICANTSDETAILS,$pd_applicant_detail); + if($co_applicant_id != null || $co_applicant_id != '') + { + $count = $count + 1; + } + } + } + + if($pd_id != null || $pd_id != '' && $count != 0) + { + $data['dataStatus'] = true; + $data['status'] = REST_Controller::HTTP_OK; + $data['records'] = $template_id; + $this->response($data,REST_Controller::HTTP_OK); + } + else + { + $data['dataStatus'] = false; + $data['status'] = REST_Controller::HTTP_NO_CONTENT; + $this->response($data,REST_Controller::HTTP_OK); + } + + } + + + + + public function updateExistPD_post() + { + $pd_details = $this->post('pd_details'); + $pd_applicant_details = $this->post('pd_applicant_details'); + $count = 0; + + $where_condition_array = array('pd_id' => $pd_details['pd_id']); + $pd_id_modified = $this->PD_Model->updateRecords($pd_details,PDTRIGGER,$where_condition_array); + + if($pd_id_modified != null || $pd_id_modified != '') + { + foreach($pd_applicant_details as $pd_applicant_detail) + { + $where_condition_array = array('pd_co_applicant_id' => $pd_applicant_detail['pd_co_applicant_id']); + $co_applicant_id_modified = $this->PD_Model->updateRecords($pd_applicant_detail,PDAPPLICANTSDETAILS,$where_condition_array); + if($co_applicant_id_modified != null || $co_applicant_id_modified != '') + { + $count = $count + 1; + } + } + } + + if($pd_id_modified != null || $pd_id_modified != '' && $count != 0) + { + $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; + $this->response($data,REST_Controller::HTTP_OK); + } + + } + + + /* PD_Triggerd and PD_Co_Applocants Details only for Listing Page + @param page/offset + @param limit + @param sorting order(ASC/DESC) + */ + public function listLessPDDetails_get() + { + $page = 0;$limit = 50;$sort = 'DESC'; + if($this->get('page')) { $page = $this->get('page'); } + if($this->get('limit')){ $limit = $this->get('limit'); } + if($this->get('sort')) { $sort = $this->get('sort'); } + + $result_data = $this->PD_Model->listLessPDDetails($page,$limit,$sort); + + if($result_data['data_status'] == true) + { + $data['dataStatus'] = true; + $data['status'] = REST_Controller::HTTP_OK; + $data['records'] = $result_data['data']; + $this->response($data,REST_Controller::HTTP_OK); + } + else + { + $data['dataStatus'] = false; + $data['status'] = REST_Controller::HTTP_NO_CONTENT; + $this->response($data,REST_Controller::HTTP_OK); + + } + + } + + + + +} \ 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 1b22bf45..0be9799a 100644 --- a/api/application/controllers/Template_Management_Controller.php +++ b/api/application/controllers/Template_Management_Controller.php @@ -36,7 +36,7 @@ class Template_Management_Controller extends REST_Controller { { $data['dataStatus'] = false; $data['status'] = REST_Controller::HTTP_NO_CONTENT; - $this->response($data,REST_Controller::HTTP_NO_CONTENT); + $this->response($data,REST_Controller::HTTP_OK); } } @@ -58,7 +58,7 @@ class Template_Management_Controller extends REST_Controller { { $data['dataStatus'] = false; $data['status'] = REST_Controller::HTTP_NO_CONTENT; - $this->response($data,REST_Controller::HTTP_NO_CONTENT); + $this->response($data,REST_Controller::HTTP_OK); } } @@ -77,7 +77,7 @@ class Template_Management_Controller extends REST_Controller { { $data['dataStatus'] = false; $data['status'] = REST_Controller::HTTP_NO_CONTENT; - $this->response($data,REST_Controller::HTTP_NO_CONTENT); + $this->response($data,REST_Controller::HTTP_OK); } @@ -126,7 +126,7 @@ class Template_Management_Controller extends REST_Controller { { $data['dataStatus'] = false; $data['status'] = REST_Controller::HTTP_NO_CONTENT; - $this->response($data,REST_Controller::HTTP_NO_CONTENT); + $this->response($data,REST_Controller::HTTP_OK); } @@ -172,7 +172,7 @@ class Template_Management_Controller extends REST_Controller { { $data['dataStatus'] = false; $data['status'] = REST_Controller::HTTP_NO_CONTENT; - $this->response($data,REST_Controller::HTTP_NO_CONTENT); + $this->response($data,REST_Controller::HTTP_OK); } diff --git a/api/application/libraries/SPARQ_Model.php b/api/application/libraries/SPARQ_Model.php index e44a5197..d983a542 100644 --- a/api/application/libraries/SPARQ_Model.php +++ b/api/application/libraries/SPARQ_Model.php @@ -25,13 +25,11 @@ class SPARQ_Model extends CI_Model { } - public function selectRecords($table_name,$where_condition_array = array(),$print_query = '') - { - // echo $print_query; - // echo $table_name; - - $data = $this->db->get_where($table_name,$where_condition_array)->result_array();//only AND condition - //print_r($data); + public function selectRecords($table_name,$where_condition_array = array(),$print_query = '',$limit = 50,$offset = 0,$order = 'ASC',$order_by_colum_name = '') + { + $data = $this->db->order_by($order_by_colum_name,$order)->get_where($table_name,$where_condition_array,$limit,$offset)->result_array();//only AND condition + + if($print_query == 1) { print_r($this->db->last_query()); @@ -98,7 +96,7 @@ class SPARQ_Model extends CI_Model { } - public function getJoinRecords($columns,$table,$joins,$print_query = '') + public function getJoinRecords($columns,$table,$joins,$print_query = '') { diff --git a/api/application/models/PD_Model.php b/api/application/models/PD_Model.php new file mode 100644 index 00000000..10c61c54 --- /dev/null +++ b/api/application/models/PD_Model.php @@ -0,0 +1,66 @@ +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, PDTRIGGER.pd_date_of_initiation, PDTRIGGER.fk_product_id,PRODUCTS.name as product_name, PDTRIGGER.fk_subproduct_id,SUBPRODUCTS.name as subproduct_name, PDTRIGGER.fk_pd_type,PDTYPE.type_name as pd_type_name, PDTRIGGER.fk_pd_status,PDSTATUS.pd_status_name, PDTRIGGER.pd_specific_clarification, PDTRIGGER.createdon, PDTRIGGER.fk_createdby, PDTRIGGER.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, PDTRIGGER.pd_officier_final_judgement, PDTRIGGER.pd_agency_id,AGENCY.full_name as agency_name, PDTRIGGER.loan_amount'); + $this->db->FROM(PDTRIGGER.' as PDTRIGGER'); + $this->db->JOIN(ENTITY.' as ENTITY','PDTRIGGER.fk_lender_id = ENTITY.entity_id AND ENTITY.isactive = 1'); + $this->db->JOIN(PRODUCTS.' as PRODUCTS','PDTRIGGER.fk_product_id = PRODUCTS.product_id AND PRODUCTS.isactive = 1'); + $this->db->JOIN(SUBPRODUCTS.' as SUBPRODUCTS','PDTRIGGER.fk_subproduct_id = SUBPRODUCTS.subproduct_id AND SUBPRODUCTS.isactive = 1'); + $this->db->JOIN(PDTYPE.' as PDTYPE','PDTRIGGER.fk_pd_type = PDTYPE.pd_type_id AND PDTYPE.isactive = 1'); + $this->db->JOIN(PDSTATUS.' as PDSTATUS','PDTRIGGER.fk_pd_status = PDSTATUS.pd_status_id AND PDSTATUS.isactive = 1'); + $this->db->JOIN(USERPROFILE.' as USERPROFILE','PDTRIGGER.fk_createdby = USERPROFILE.userid AND USERPROFILE.isactive = 1'); + $this->db->JOIN(USERPROFILE.' as USERPROFILE1','PDTRIGGER.fk_updatedby = USERPROFILE1.userid AND USERPROFILE1.isactive = 1'); + $this->db->JOIN(PDALLOCATIONTYPE.' as PDALLOCATIONTYPE','PDTRIGGER.fk_pd_allocation_type = PDALLOCATIONTYPE.pd_allocation_type_id AND PDALLOCATIONTYPE.isactive = 1'); + $this->db->JOIN(USERPROFILE.' as USERPROFILE2','PDTRIGGER.fk_pd_allocation_type = USERPROFILE2.userid AND USERPROFILE2.isactive = 1'); + $this->db->JOIN(TEMPLATE.' as TEMPLATE','PDTRIGGER.fk_pd_template_id = TEMPLATE.template_id AND TEMPLATE.isactive = 1'); + $this->db->JOIN(CUSTOMERSEGMENT.' as CUSTOMERSEGMENT','PDTRIGGER.fk_customer_segment = CUSTOMERSEGMENT.customer_segment_id AND CUSTOMERSEGMENT.isactive = 1'); + $this->db->JOIN(ENTITY.' as AGENCY','PDTRIGGER.pd_agency_id = AGENCY.entity_id AND AGENCY.isactive = 1','LEFT'); + $this->db->ORDER_BY('PDTRIGGER.pd_id',$sort); + $this->db->LIMIT($page,$limit); + $result_array = $this->db->GET()->result_array(); + + if(count($result_array) != 0) + { + foreach($result_array as $key => $result) + { + $this->db->SELECT('PDAPPLICANTSDETAILS.pd_co_applicant_id, PDAPPLICANTSDETAILS.fk_pd_id, PDAPPLICANTSDETAILS.applicant_name, PDAPPLICANTSDETAILS.applicant_type, PDAPPLICANTSDETAILS.mobile_no, PDAPPLICANTSDETAILS.email, PDAPPLICANTSDETAILS.addressline1, PDAPPLICANTSDETAILS.addressline2, PDAPPLICANTSDETAILS.addressline3, PDAPPLICANTSDETAILS.fk_city, PDAPPLICANTSDETAILS.fk_state, PDAPPLICANTSDETAILS.pincode'); + $this->db->FROM(PDAPPLICANTSDETAILS.' as PDAPPLICANTSDETAILS'); + $this->db->JOIN(STATE.' as STATE','PDAPPLICANTSDETAILS.fk_state = STATE.state_id AND STATE.isactive = 1'); + $this->db->JOIN(CITY.' as CITY','PDAPPLICANTSDETAILS.fk_city = CITY.city_id AND CITY.isactive = 1'); + $this->db->WHERE('PDAPPLICANTSDETAILS.fk_pd_id = $result["pd_id"] AND PDAPPLICANTSDETAILS.isactive = 1'); + $result_child_array = $this->db->GET()->result_array(); + if(count($result_child_array) != 0) + { + array_push($result[$key],$result_child_array); + } + } + } + + + if(count($result_array) > 0 ) + { + $result_data['data_status'] = true; + $result_data['data'] = $result_array; + return $result_data; + + } + else + { + $result_data['data_status'] = false; + $result_data['data'] = null; + return $result_data; + } + + } +} \ No newline at end of file