TEMPALE CHANGED
This commit is contained in:
parent
db6aa08461
commit
89d6a4880d
@ -86,7 +86,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', 'getListOfUsers'); // no errors
|
||||
defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', '(listAllTemplates/:any)'); // no errors
|
||||
|
||||
/*********************AWS resources Constants*************************************************/
|
||||
defined('PROFILE_PICTURE_BUCKET_NAME') OR define('PROFILE_PICTURE_BUCKET_NAME','sineedgedevprofilepic');
|
||||
|
||||
@ -89,7 +89,7 @@ $route['getUsersDetails'] = 'User_Management_Controller/getUsersDetails';
|
||||
$route['getSingedProfilePicURL'] = 'User_Management_Controller/getSingedProfilePicURL';
|
||||
|
||||
// TEMPLATE MANAGEMENT
|
||||
$route['listAllTemplates'] = 'Template_Management_Controller/listAllTemplates';
|
||||
$route['(listAllTemplates/:any)'] = 'Template_Management_Controller/listAllTemplates/';
|
||||
$route['saveNewTemplateName'] = 'Template_Management_Controller/saveNewTemplateName';
|
||||
$route['saveTemplateLenderDetails'] = 'Template_Management_Controller/saveTemplateLenderDetails';
|
||||
$route['saveTemplateCategoryDetails'] = 'Template_Management_Controller/saveTemplateCategoryDetails';
|
||||
|
||||
@ -32,7 +32,12 @@ class PD_Controller extends REST_Controller {
|
||||
if(count($result_data))
|
||||
{
|
||||
|
||||
|
||||
foreach($result_data as $key => $value)
|
||||
{
|
||||
$fields = array('*');
|
||||
$where_condition_array = array('isactive' => 1,'fk_entity_id' => $value['entity_id']);
|
||||
$result_data[$key]['billing_address'] = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,ENTITYBILLING);
|
||||
}
|
||||
$data['dataStatus'] = true;
|
||||
$data['status'] = REST_Controller::HTTP_OK;
|
||||
$data['records'] = $result_data;
|
||||
@ -209,74 +214,71 @@ class PD_Controller extends REST_Controller {
|
||||
|
||||
/***********************PD ALLOCATION TYPE PROCESS **********/
|
||||
|
||||
$pd_details['pd_status'] = TRIGGERED;
|
||||
$pd_details['fk_pd_allocated_to'] = null;
|
||||
$where_condition_array = array('fk_city_id' => $pd_details['fk_city'],'fk_lender_id' => $pd_details['fk_lender_id']);
|
||||
$temp_city_id = $this->PD_Model->selectRecords(PDTEAMMAP,$where_condition_array,$limit=0,$offset=0);
|
||||
//print_r($temp_city_id);
|
||||
if(count($temp_city_id))
|
||||
{
|
||||
if(isset($temp_city_id[0]['team_type']))
|
||||
{
|
||||
if($temp_city_id[0]['team_type'] == 0) // Allocate to Vendor
|
||||
{
|
||||
$pd_details['pd_agency_id'] = $temp_city_id[0]['fk_team_id'];
|
||||
$pd_details['pd_status'] = ALLOCATED_TO_PARTNER;
|
||||
$pd_details['fk_pd_allocated_to'] = null;
|
||||
}
|
||||
else //Allocate to SineEdge Team with allocation logics
|
||||
{
|
||||
//echo "SineEdge TEAm";
|
||||
$local_pd_allocation_type = $pd_details['fk_pd_allocation_type'];
|
||||
if($local_pd_allocation_type == 1)// AUTO - Load Balance Allocation
|
||||
{
|
||||
// $pd_details['pd_status'] = TRIGGERED;
|
||||
// $pd_details['fk_pd_allocated_to'] = null;
|
||||
// $where_condition_array = array('fk_city_id' => $pd_details['fk_city'],'fk_lender_id' => $pd_details['fk_lender_id']);
|
||||
// $temp_city_id = $this->PD_Model->selectRecords(PDTEAMMAP,$where_condition_array,$limit=0,$offset=0);
|
||||
// //print_r($temp_city_id);
|
||||
// if(count($temp_city_id))
|
||||
// {
|
||||
// if(isset($temp_city_id[0]['team_type']))
|
||||
// {
|
||||
// if($temp_city_id[0]['team_type'] == 0) // Allocate to Vendor
|
||||
// {
|
||||
// $pd_details['pd_agency_id'] = $temp_city_id[0]['fk_team_id'];
|
||||
// $pd_details['pd_status'] = ALLOCATED_TO_PARTNER;
|
||||
// $pd_details['fk_pd_allocated_to'] = null;
|
||||
// }
|
||||
// else //Allocate to SineEdge Team with allocation logics
|
||||
// {
|
||||
// //echo "SineEdge TEAm";
|
||||
// $local_pd_allocation_type = $pd_details['fk_pd_allocation_type'];
|
||||
// if($local_pd_allocation_type == 1)// AUTO - Load Balance Allocation
|
||||
// {
|
||||
|
||||
//echo "AUTO LOAD";
|
||||
//select list of pd officers based on pd type, product, customer segment, and team from table (t_pd_officiers_details) and choose minimun allocated one and assign pd Officer and change status form TRIGGERED to ALLOCATED
|
||||
$fields = array('fk_user_id','allocated');
|
||||
// //echo "AUTO LOAD";
|
||||
// //select list of pd officers based on pd type, product, customer segment, and team from table (t_pd_officiers_details) and choose minimun allocated one and assign pd Officer and change status form TRIGGERED to ALLOCATED
|
||||
// $fields = array('fk_user_id','allocated');
|
||||
|
||||
$where_condition_array = array('fk_pd_type_id' => $pd_details['fk_pd_type'],'fk_team_id' => $temp_city_id[0]['fk_team_id'],'fk_customer_segment' => $pd_details['fk_customer_segment'],'fk_product_id' => $pd_details['fk_product_id'],'isactive' => 1);
|
||||
// $where_condition_array = array('fk_pd_type_id' => $pd_details['fk_pd_type'],'fk_team_id' => $temp_city_id[0]['fk_team_id'],'fk_customer_segment' => $pd_details['fk_customer_segment'],'fk_product_id' => $pd_details['fk_product_id'],'isactive' => 1);
|
||||
|
||||
$list_of_pd_officers = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,PDOFFICIERSDETAILS);
|
||||
//echo "PD OFF";
|
||||
//print_r($list_of_pd_officers);
|
||||
$allocated_values = array_column($list_of_pd_officers,'allocated');
|
||||
// $list_of_pd_officers = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,PDOFFICIERSDETAILS);
|
||||
// //echo "PD OFF";
|
||||
// //print_r($list_of_pd_officers);
|
||||
// $allocated_values = array_column($list_of_pd_officers,'allocated');
|
||||
|
||||
$min_allocated = min($allocated_values);
|
||||
$key = array_search($min_allocated,$allocated_values);
|
||||
$final_pd_officer_to_allocate = $list_of_pd_officers[$key]['fk_user_id'];
|
||||
// $min_allocated = min($allocated_values);
|
||||
// $key = array_search($min_allocated,$allocated_values);
|
||||
// $final_pd_officer_to_allocate = $list_of_pd_officers[$key]['fk_user_id'];
|
||||
|
||||
//For Random Allocaiton not in use
|
||||
// $key = mt_rand(0, count($list_of_pd_officers) - 1);
|
||||
// $final_pd_officer_to_allocate = isset($list_of_pd_officers[$key])? $list_of_pd_officers[$key]: null;
|
||||
// //For Random Allocaiton not in use
|
||||
// // $key = mt_rand(0, count($list_of_pd_officers) - 1);
|
||||
// // $final_pd_officer_to_allocate = isset($list_of_pd_officers[$key])? $list_of_pd_officers[$key]: null;
|
||||
|
||||
$pd_details['fk_pd_allocated_to'] = $final_pd_officer_to_allocate;
|
||||
$pd_details['pd_status'] = ALLOCATED;
|
||||
//echo "final".$final_pd_officer_to_allocate;
|
||||
// $pd_details['fk_pd_allocated_to'] = $final_pd_officer_to_allocate;
|
||||
// $pd_details['pd_status'] = ALLOCATED;
|
||||
// //echo "final".$final_pd_officer_to_allocate;
|
||||
|
||||
}
|
||||
else if($local_pd_allocation_type == 2) // AUTO - NEAREST Allocation
|
||||
{
|
||||
// }
|
||||
// else if($local_pd_allocation_type == 2) // AUTO - NEAREST Allocation
|
||||
// {
|
||||
|
||||
}
|
||||
else // Manual Allocation
|
||||
{
|
||||
// Do nothing, cause fk_pd_allocated_to value comes from front end.
|
||||
}
|
||||
|
||||
}
|
||||
}//End Of isset
|
||||
}
|
||||
|
||||
|
||||
// }
|
||||
// else // Manual Allocation
|
||||
// {
|
||||
// // Do nothing, cause fk_pd_allocated_to value comes from front end.
|
||||
// }
|
||||
|
||||
// }
|
||||
// }//End Of isset
|
||||
// }
|
||||
|
||||
/***********************END OF PD ALLOCATION TYPE AND PROCESS***********/
|
||||
|
||||
$pd_details['pd_date_of_initiation'] = date("Y-m-d H:i:s");
|
||||
if($pd_details['pd_status'] == "" || $pd_details['pd_status'] == null)
|
||||
{
|
||||
$pd_details['pd_status'] = TRIGGERED;
|
||||
$pd_details['pd_status'] = DRAFT;
|
||||
}
|
||||
$pd_id = $this->PD_Model->saveRecords($pd_details,PDTRIGGER);
|
||||
|
||||
|
||||
@ -23,13 +23,13 @@ class Template_Management_Controller extends REST_Controller {
|
||||
|
||||
public function listAllTemplates_get()
|
||||
{
|
||||
|
||||
$result = $this->User_Management_Model->$listAllTemplates();
|
||||
if($result['data_status'])
|
||||
$page = "";$limit = ""; $sort = "asc";
|
||||
$result = $this->Template_Management_Model->listAllTemplates($page,$limit,$sort);
|
||||
if(count($result))
|
||||
{
|
||||
$data['dataStatus'] = true;
|
||||
$data['status'] = REST_Controller::HTTP_OK;
|
||||
$data['records'] = $result['data'];
|
||||
$data['records'] = $result;
|
||||
$this->response($data,REST_Controller::HTTP_OK);
|
||||
}
|
||||
else
|
||||
@ -42,11 +42,11 @@ class Template_Management_Controller extends REST_Controller {
|
||||
|
||||
public function saveNewTemplateName_post()
|
||||
{
|
||||
$template_name = $this->post('template_name');
|
||||
$records = $this->post('records');
|
||||
|
||||
if(array_key_exists('template_id',$template_name))
|
||||
if($records['template_id'] == null || $records['template_id'] == "")
|
||||
{
|
||||
$template_id = $this->Template_Management_Model->saveRecords($template_name,TEMPLATE);
|
||||
$template_id = $this->Template_Management_Model->saveRecords($records,TEMPLATE);
|
||||
if($template_id != "" || $template_id != null)
|
||||
{
|
||||
$data['dataStatus'] = true;
|
||||
@ -64,8 +64,8 @@ class Template_Management_Controller extends REST_Controller {
|
||||
}
|
||||
else
|
||||
{
|
||||
$where_condition_array = array('template_id'=>$template_name['template_id']);
|
||||
$modified = $this->db->updateRecords($template_name,TEMPLATE,$where_condition_array);
|
||||
$where_condition_array = array('template_id'=>$records['template_id']);
|
||||
$modified = $this->db->updateRecords($records,TEMPLATE,$where_condition_array);
|
||||
if($template_id != "" || $template_id != null)
|
||||
{
|
||||
$data['dataStatus'] = true;
|
||||
@ -76,7 +76,7 @@ class Template_Management_Controller extends REST_Controller {
|
||||
else
|
||||
{
|
||||
$data['dataStatus'] = false;
|
||||
$data['status'] = REST_Controller::HTTP_NO_CONTENT;
|
||||
$data['status'] = REST_Controller::HTTP_NOT_MODIFIED;
|
||||
$this->response($data,REST_Controller::HTTP_OK);
|
||||
|
||||
}
|
||||
@ -88,27 +88,21 @@ class Template_Management_Controller extends REST_Controller {
|
||||
|
||||
public function saveTemplateLenderDetails_post()
|
||||
{
|
||||
$template_id = '';
|
||||
|
||||
$count = 0;
|
||||
|
||||
if($this->post('template_id'))
|
||||
{
|
||||
$template_id = $this->post('template_id');
|
||||
}
|
||||
|
||||
$template_lender_details = $this->post('template_lender_details');
|
||||
$template_lender_details = $this->post('records');
|
||||
|
||||
foreach($template_lender_details as $template_lender_detail)
|
||||
{
|
||||
if(array_key_exists('lender_template_id',$template_lender_detail))
|
||||
if($template_lender_detail['template_lender_map_id'] != null || $template_lender_detail['template_lender_map_id'] != "")
|
||||
{
|
||||
$where_condition_array = array('lender_template_id'=>$template_lender_detail['lender_template_id']);
|
||||
$modified = $this->Template_Management_Model->updateRecords(template_lender_detail,LENDERTEMPLATE,$where_condition_array);
|
||||
$where_condition_array = array('fk_template_id'=>$template_lender_detail['fk_template_id']);
|
||||
$modified = $this->Template_Management_Model->updateRecords($template_lender_detail,LENDERTEMPLATE,$where_condition_array);
|
||||
if($modified != "" || $modified != null){ $count++; }
|
||||
}
|
||||
else
|
||||
{
|
||||
$template_lender_detail['fk_template_id'] = $template_id;
|
||||
|
||||
$id = $this->Template_Management_Model->saveRecords($template_lender_detail,LENDERTEMPLATE);
|
||||
if($id != "" || $id != null){ $count++; }
|
||||
}
|
||||
@ -135,19 +129,13 @@ class Template_Management_Controller extends REST_Controller {
|
||||
|
||||
public function saveTemplateCategoryDetails_post()
|
||||
{
|
||||
$template_id = '';
|
||||
$count = 0;
|
||||
|
||||
if($this->post('template_id'))
|
||||
{
|
||||
$template_id = $this->post('template_id');
|
||||
}
|
||||
|
||||
$template_category_details = $this->post('template_category_details');
|
||||
|
||||
$count = 0;
|
||||
$template_category_details = $this->post('records');
|
||||
|
||||
foreach($template_category_details as $template_category_detail)
|
||||
{
|
||||
if(array_key_exists('template_catagory_weightage_id',$template_category_detail))
|
||||
if($template_category_detail['template_catagory_weightage_id'] != null || $template_category_detail['template_catagory_weightage_id'] != "")
|
||||
{
|
||||
$where_condition_array = array('template_catagory_weightage_id'=>$template_category_detail['template_catagory_weightage_id']);
|
||||
$modified = $this->Template_Management_Model->updateRecords($template_category_detail,TEMPLATECATAGORYWEIGHTAGE,$where_condition_array);
|
||||
@ -155,7 +143,7 @@ class Template_Management_Controller extends REST_Controller {
|
||||
}
|
||||
else
|
||||
{
|
||||
$template_category_detail['fk_template_id'] = $template_id;
|
||||
|
||||
$id = $this->Template_Management_Model->saveRecords($template_lender_detail,TEMPLATECATAGORYWEIGHTAGE);
|
||||
if($id != "" || $id != null){ $count++; }
|
||||
}
|
||||
@ -180,5 +168,99 @@ class Template_Management_Controller extends REST_Controller {
|
||||
}
|
||||
|
||||
|
||||
public function saveTemplateQuestionAnswers_post()
|
||||
{
|
||||
$count = 0;
|
||||
$template_question_answers_details = $this->post('records');
|
||||
|
||||
foreach($template_question_answers_details as $key => $template_question_answers_detail)
|
||||
{
|
||||
$answers_array = array();
|
||||
if($template_question_answers_detail['template_question_id'] != null || $template_question_answers_detail['template_question_id'] != "")
|
||||
{
|
||||
if(isset($template_question_answers_detail['answers_details']))
|
||||
{
|
||||
$answers_array = $template_question_answers_detail['answers_details'];
|
||||
unset($template_question_answers_detail['answers_details']);
|
||||
}
|
||||
|
||||
$where_condition_array = array('template_question_id' => $template_question_answers_detail['template_question_id']);
|
||||
$question_modified = $this->Template_Management_Model->updateRecords($template_question_answers_detail,TEMPLATEQUESTION,$where_condition_array);
|
||||
|
||||
if(count($answers_array))
|
||||
{
|
||||
foreach($answers_array as $key => $answer)
|
||||
{
|
||||
if($answer['template_answer_weightage_id'] != "" || $answer['template_answer_weightage_id'] != null)
|
||||
{
|
||||
$where_condition_array = array('template_answer_weightage_id' => $answer['template_answer_weightage_id']);
|
||||
$answer_modified = $this->Template_Management_Model->updateRecords($answer,TEMPLATEANSWERWEIGHTAGE,$where_condition_array);
|
||||
|
||||
if($answer_modified != "" || $answer_modified != null) {$count++;}
|
||||
}
|
||||
else
|
||||
{
|
||||
$answer_inserted = $this->Template_Management_Model->saveRecords($answer,TEMPLATEANSWERWEIGHTAGE);
|
||||
|
||||
if($answer_inserted != "" || $answer_inserted != null) {$count++;}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(($question_modified != "" || $question_modified != null) && count($answers_array) == $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;
|
||||
$this->response($data,REST_Controller::HTTP_OK);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if(isset($template_question_answers_detail['answers_details']))
|
||||
{
|
||||
$answers_array = $template_question_answers_detail['answers_details'];
|
||||
unset($template_question_answers_detail['answers_details']);
|
||||
}
|
||||
|
||||
$question_id = $this->Template_Management_Model->saveRecords($template_question_answers_detail,TEMPLATEQUESTION);
|
||||
|
||||
if(count($answers_array))
|
||||
{
|
||||
foreach($answers_array as $key => $answer)
|
||||
{
|
||||
$answer_inserted = $this->Template_Management_Model->saveRecords($answer,TEMPLATEANSWERWEIGHTAGE);
|
||||
if($answer_inserted != "" || $answer_inserted != null) {$count++;}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(($question_id != "" || $question_id != null) && count($answers_array) == $count)
|
||||
{
|
||||
$data['dataStatus'] = true;
|
||||
$data['status'] = REST_Controller::HTTP_OK;
|
||||
$data['records'] = $question_id;
|
||||
$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);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -10,26 +10,37 @@ class Template_Management_Model extends SPARQ_Model {
|
||||
}
|
||||
|
||||
|
||||
public function listAllTemplates()
|
||||
public function listAllTemplates($page,$limit,$sort)
|
||||
{
|
||||
$result_data = array();
|
||||
|
||||
$templates = $this->selectRecords(TEMPLATE,array(),$limit,$page,$sort);
|
||||
|
||||
$result = $this->db->get()->result_array();
|
||||
|
||||
if(count($result) > 0 )
|
||||
{
|
||||
$result_data['data_status'] = true;
|
||||
$result_data['data'] = $result;
|
||||
return $result_data;
|
||||
if(count($templates))
|
||||
{
|
||||
|
||||
foreach($templates as $key => $template)
|
||||
{
|
||||
$this->db->SELECT('LENDERTEMPLATE.template_lender_map_id, LENDERTEMPLATE.fk_template_id, LENDERTEMPLATE.fk_lender_id,ENTITY.full_name,ENTITY.short_name, LENDERTEMPLATE.fk_product_id,PRODUCTS.name as product_name,PRODUCTS.abbr as product_abbr, LENDERTEMPLATE.fk_customer_segment,CUSTOMERSEGMENT.name as customer_segment_name, CUSTOMERSEGMENT.abbr as customer_segment_abbr,DATE_FORMAT(LENDERTEMPLATE.createdon, "%d/%m/%Y") as createdon,LENDERTEMPLATE.fk_createdby, DATE_FORMAT(LENDERTEMPLATE.updatedon,"%d/%m/%Y") as updatedon, LENDERTEMPLATE.isactive,LENDERTEMPLATE.fk_updatedby,concat(USERPROFILE.first_name," ",USERPROFILE.last_name) as createdby,concat(USERPROFILE1.first_name," ",USERPROFILE1.last_name) as updatedby');
|
||||
$this->db->FROM(LENDERTEMPLATE.' as LENDERTEMPLATE');
|
||||
$this->db->JOIN(ENTITY.' as ENTITY','LENDERTEMPLATE.fk_lender_id = ENTITY.entity_id');
|
||||
$this->db->JOIN(PRODUCTS.' as PRODUCTS','LENDERTEMPLATE.fk_product_id = PRODUCTS.product_id');
|
||||
$this->db->JOIN(CUSTOMERSEGMENT.' as CUSTOMERSEGMENT','LENDERTEMPLATE.fk_customer_segment = CUSTOMERSEGMENT.customer_segment_id');
|
||||
$this->db->JOIN(USERPROFILE.' as USERPROFILE','LENDERTEMPLATE.fk_createdby = USERPROFILE.userid');
|
||||
$this->db->JOIN(USERPROFILE.' as USERPROFILE1','LENDERTEMPLATE.fk_updatedby = USERPROFILE1.userid','LEFT');
|
||||
$this->db->WHERE('LENDERTEMPLATE.fk_template_id',$template['template_id']);
|
||||
$child_data = $this->db->GET()->result_array();
|
||||
$templates[$key]['lender_details'] = $child_data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$result_data['data_status'] = false;
|
||||
$result_data['data'] = null;
|
||||
return $result_data;
|
||||
}
|
||||
return $templates;
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user