diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index 9931ff09..294bcc7f 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -1111,11 +1111,17 @@ class PD_Controller extends REST_Controller { $this->load->model('User_Management_Model'); $user_details = $this->User_Management_Model->getUserDetails($pd_details['fk_updatedby']); $role = $user_details['data'][0]['user_role']; - + + if($is_mwise_lender && (!empty($agency_id)) && ($agency_id != null) && ((int)$agency_id != 0) && ($pd_details['pd_status'] == "TRIGGERED") && ($role == 30)){ + $pd_details['vendor_status'] = null; + $pd_details['pd_agency_id'] = null; + $pd_details['pd_status'] = $pd_details['pd_status']; + } + if($is_mwise_lender && (!empty($agency_id)) && ($agency_id != null) && ((int)$agency_id != 0) && ($pd_details['pd_status'] != "TRIGGERED" || $pd_details['pd_status'] != "QC_COMPLETED")) { //newly implemented - if(($pd_details['pd_status'] == "CANCELLED") && ($role == 27 || $role == 26)){ + if(($pd_details['pd_status'] == "CANCELLED") && ($role == 27 || $role == 26 || $role == 30)){ $pd_details['vendor_status'] = null; $pd_details['pd_agency_id'] = null; $pd_details['pd_status'] = $pd_details['pd_status']; diff --git a/api/application/controllers/SMC_Credit_PD_Controller.php b/api/application/controllers/SMC_Credit_PD_Controller.php index 1989de0e..7f9ae1cc 100644 --- a/api/application/controllers/SMC_Credit_PD_Controller.php +++ b/api/application/controllers/SMC_Credit_PD_Controller.php @@ -1549,6 +1549,7 @@ public function filterSalesPDList_post() { // print_r($view_data['pd_section_data'][15]);die(); $view_data['smc_images'] = $this->SMC_Credit_PD_Model->selectCustomRecords(array('doc_id', 'fk_smc_credit_pd_id','img','img_name','isactive'),array('fk_smc_credit_pd_id' => $records['pd_id'],'isactive' => 1,'img_name!=' => 'satellite'),SMC_CREDIT_PD_DOCS); $view_data['satellite'] = $this->SMC_Credit_PD_Model->selectCustomRecords(array('doc_id', 'fk_smc_credit_pd_id','img','img_name','isactive'),array('fk_smc_credit_pd_id' => $records['pd_id'],'isactive' => 1,'img_name=' => 'satellite'),SMC_CREDIT_PD_DOCS); + // print_r($view_data['smc_images']);die(); //print_r(count($view_data['smc_images']));die(); //score card part @@ -1627,7 +1628,7 @@ public function filterSalesPDList_post() { $html_content = $this->load->view('smc_creditpd_reports/MWISE',$view_data,true); } - // echo $html_content;exit(); + echo $html_content;exit(); $pdf_name = $view_data['pd_master_details'][0]['main_applicant']; $pdf_doc = $this->pdfgenerator->generate($html_content, $filename='version', $stream=false, $paper = 'A4', $orientation = "portrait"); //End of PDF Gen using DOM PDF @@ -1813,7 +1814,7 @@ public function filterSalesPDList_post() { $this->response($data,REST_Controller::HTTP_OK); } - //2 roles = SMC Vendor PD officer and SMC Vendor PD manager + //3 roles = SMC Vendor PD officer and SMC Vendor PD manager,lender admin function getSMCVendorPDOfficersList_get(){ // $role_id = $this->get('role_id'); diff --git a/api/application/controllers/Sales_PD_Controller.php b/api/application/controllers/Sales_PD_Controller.php index 492a4315..45f94cd1 100644 --- a/api/application/controllers/Sales_PD_Controller.php +++ b/api/application/controllers/Sales_PD_Controller.php @@ -214,7 +214,8 @@ class Sales_PD_Controller extends REST_Controller { //$view_name = $sales_pd_data[0]['short_name'].'_'.$sales_pd_data[0]['abbr']; $view_name = $sales_pd_data[0]['short_name'];if( $sales_pd_data[0]['abbr'] == 'MEQ'){ $view_name = $sales_pd_data[0]['abbr']; } $html_content = $this->load->view('sale_pd_templates/'.$view_name,$view_data,true); - // echo $html_content;die(); + print_r($view_data);die(); + echo $html_content;die(); $pdf_doc = $this->pdfgenerator->generate($html_content, $filename='version', $stream=false, $paper = 'A4', $orientation = "portrait"); //End of PDF Gen using DOM PDF $output_file = $this->external_path ."/sales_pd/" . $sales_pd_id . "/temp.pdf"; diff --git a/api/application/controllers/Template_Management_Controller.php b/api/application/controllers/Template_Management_Controller.php index 3f00cf47..41b752c5 100644 --- a/api/application/controllers/Template_Management_Controller.php +++ b/api/application/controllers/Template_Management_Controller.php @@ -1028,6 +1028,8 @@ class Template_Management_Controller extends REST_Controller { // API 3 : to save and Update the Mapping Details and return the Pkid public function saveTemplateV2_post(){ + // draft,approve,completed + // strtoupper(str_replace(' ', '', $form_status)); $records = $this->post("records"); // print_r($records);die(); if( (!isset($records['entity_id'])) || (!isset($records['product_id'])) || (!isset($records['customer_segment_id'])) ) @@ -1084,16 +1086,27 @@ class Template_Management_Controller extends REST_Controller { $map_id = $records['map_id']; $form_id = $records['form_id']; $fields = array('id'); + $status = strtoupper(str_replace(' ', '',$records['form_status'])); $where_condition_array = array('map_id'=>$map_id,"form_id"=>$form_id,"isactive"=>1); $json_table = $this->Template_Management_Model->selectCustomRecords($fields,$where_condition_array,TEMPLATE_JSON_V2); - if(count($json_table)>0){ - $this->db->where('id',$json_table[0]['id']); - $this->db->set('isactive',0); - $this->db->update(TEMPLATE_JSON_V2); - } - $json = json_encode($records['json'],true); - $fields = array('form_id' => $form_id,'json' => $json,'map_id'=>$map_id); - $json_pk_id = $this->Template_Management_Model->saveTemplateMapping($fields,TEMPLATE_JSON_V2); + if(count($json_table)>0 && $status == "COMPLETED"){ + $this->db->where('id',$json_table[0]['id']); + $this->db->set('isactive',0); + $this->db->update(TEMPLATE_JSON_V2); + }else if(count($json_table)>0 && ($status == "DRAFT" || $status == "APPROVED" )){ + $json = json_encode($records['json'],true); + $this->db->where('id',$json_table[0]['id']); + $this->db->where('map_id',$map_id); + $this->db->where('form_id',$form_id); + $this->db->where('is_form_status',$status); + $this->db->set('json',$json); + $this->db->update(TEMPLATE_JSON_V2); + $json_pk_id = $json_table[0]['id']; + }else{ + $json = json_encode($records['json'],true); + $fields = array('form_id' => $form_id,'json' => $json,'map_id'=>$map_id,'is_form_status'=>$status); + $json_pk_id = $this->Template_Management_Model->saveTemplateMapping($fields,TEMPLATE_JSON_V2); + } if($json_pk_id) { $data['dataStatus'] = true; diff --git a/api/application/models/PD_Model.php b/api/application/models/PD_Model.php index bd384b4c..86fc5c84 100644 --- a/api/application/models/PD_Model.php +++ b/api/application/models/PD_Model.php @@ -2313,7 +2313,7 @@ class PD_Model extends SPARQ_Model { function getSMCVendorPDOfficersList($agency_id){ // if(empty($role)){ // $role = array(28,29); - $role = array(29); + $role = array(29,30); // } $this->db->select('USERPROFILE.userid,USERPROFILE.first_name,USERPROFILE.last_name,USERPROFILE.first_name as name,USERPROFILEROLES.user_role'); $this->db->from(USERPROFILE.' as USERPROFILE'); diff --git a/api/application/models/SMC_Credit_PD_Model.php b/api/application/models/SMC_Credit_PD_Model.php index 54cc4fc2..c8ed2aa8 100644 --- a/api/application/models/SMC_Credit_PD_Model.php +++ b/api/application/models/SMC_Credit_PD_Model.php @@ -135,7 +135,7 @@ class SMC_Credit_PD_Model extends SPARQ_Model { $result = $CMusers; } - }else if($role == 27){ + }else if($role == 27 || $role == 30){ $result = $RCMusers; } return $result; diff --git a/api/application/views/sale_pd_templates/MEQ.php b/api/application/views/sale_pd_templates/MEQ.php index 8c96f409..4cb36fc4 100644 --- a/api/application/views/sale_pd_templates/MEQ.php +++ b/api/application/views/sale_pd_templates/MEQ.php @@ -617,6 +617,10 @@ defined('BASEPATH') OR exit('No direct script access allowed');