SMC PHOTO SECTION APIS
This commit is contained in:
parent
03e328ae82
commit
a9b8d6e618
@ -656,6 +656,7 @@ defined('VIDEO_ROOM_INFO') OR define('VIDEO_ROOM_INFO','t_video_room_info');
|
||||
defined('SMC_EXCEL_FILELIST') OR define('SMC_EXCEL_FILELIST','t_smc_excel_filelist');
|
||||
defined('EXCEL_COLUMN_REF_NAME') OR define('EXCEL_COLUMN_REF_NAME','t_excel_column_ref_name');
|
||||
defined('SMC_CREDIT_PD_FORMS') OR define('SMC_CREDIT_PD_FORMS','m_smc_credit_pd_forms');
|
||||
defined('SMC_CREDITPD_IMGS') OR define('SMC_CREDITPD_IMGS','m_smc_creditpd_imgs');
|
||||
|
||||
|
||||
|
||||
|
||||
@ -306,4 +306,5 @@ $route['getSMCCreditPDSectionData'] = 'SMC_Credit_PD_Controller/getSMCCreditPDSe
|
||||
$route['getStakeHoldersInfo'] = 'SMC_Credit_PD_Controller/getStakeHoldersInfo';
|
||||
$route['loadSMCPDTemplate'] = 'SMC_Credit_PD_Controller/loadSMCPDTemplate';
|
||||
$route['loadDataFromExcel'] = 'SMC_Credit_PD_Controller/loadDataFromExcel';
|
||||
$route['getSMCPDImgSectionData'] = 'SMC_Credit_PD_Controller/getSMCPDImgSectionData';
|
||||
|
||||
|
||||
@ -467,7 +467,7 @@ class SMC_Credit_PD_Controller extends REST_Controller {
|
||||
$is_customer_app = isset($records['is_customer_app']) ? $records['is_customer_app'] : null;
|
||||
unset($records['is_customer_app']);
|
||||
|
||||
if($records['img_name'] == 'selfie_with_person_met')
|
||||
if(!$records['is_multiple'])
|
||||
{
|
||||
//$location = $records['location'];
|
||||
//$update_fields = array('geo_location' => $records['location']);
|
||||
@ -481,11 +481,12 @@ class SMC_Credit_PD_Controller extends REST_Controller {
|
||||
// $this->SMC_Credit_PD_Model->updateRecords($update_fields2,SALEPD_DOCS,array('img_name' => 'selfie_with_person_met','fk_smc_credit_pd' => $records['fk_smc_credit_pd']));
|
||||
// if($is_customer_app)
|
||||
// {
|
||||
// $this->SMC_Credit_PD_Model->updateRecords(array('isactive' => 0),SMC_CREDIT_PD_SECTION_DATA,array('section_id' => 9,'smc_credit_pd' => $records['fk_smc_credit_pd']));
|
||||
$this->SMC_Credit_PD_Model->updateRecords(array('isactive' => 0),SMC_CREDIT_PD_DOCS,array('fk_smc_credit_pd_id' => $records['fk_smc_credit_pd_id'],'img_name' => $records['img_name']));
|
||||
// print_r($this->db->last_query());
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
unset($records['is_multiple']);
|
||||
$id = $this->SMC_Credit_PD_Model->saveRecords($records,SMC_CREDIT_PD_DOCS);
|
||||
if($id)
|
||||
{
|
||||
@ -1326,6 +1327,104 @@ public function filterSalesPDList_post() {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function getSMCPDImgSectionData_post()
|
||||
{
|
||||
$rand_string = $this->post('rand_string');
|
||||
$pd_id = $this->post('pd_id');
|
||||
//echo $rand_string.'#'.$pd_id;die();
|
||||
|
||||
//$smc_pd_master_data = $this->PD_Model->getPDMasterDetails($pd_id,$random_string);
|
||||
|
||||
$sales_pd_img_data = $this->SMC_Credit_PD_Model->selectCustomRecords(array('doc_id', 'fk_smc_credit_pd_id','img','img_name','isactive'),array('fk_smc_credit_pd_id' => $pd_id,'isactive' => 1,'img_name!=' => 'satellite'),SMC_CREDIT_PD_DOCS);
|
||||
|
||||
//print_r($sales_pd_img_data);die();
|
||||
//sales tele pd img structure array
|
||||
$imgs = $this->SMC_Credit_PD_Model->selectCustomRecords(array('*'),array('isactive' => 1),SMC_CREDITPD_IMGS);
|
||||
//print_r($imgs);
|
||||
$img_data = array();
|
||||
if(count($sales_pd_img_data))
|
||||
{
|
||||
|
||||
foreach ($imgs as $key => $value)
|
||||
{
|
||||
|
||||
//echo "FISRT LOOP****$key";
|
||||
foreach ($sales_pd_img_data as $sales_pd_img_data_key => $sales_pd_img_data_value)
|
||||
{
|
||||
//echo "SEC LOOP****";
|
||||
if($value['key_name'] == $sales_pd_img_data_value['img_name'])
|
||||
{
|
||||
if($value['is_multiple'])
|
||||
{
|
||||
if(!array_key_exists($value['key_name'],$img_data))
|
||||
{
|
||||
$img_data[$value['key_name']] = array('img_key' => $value['key_name'],'img_name' => $value['img_name'],'img_data' => [array('img_url' => $sales_pd_img_data_value['img'] ? $sales_pd_img_data_value['img'] : '')],'is_multiple' => 1,'section_heading' => $value['img_name']);
|
||||
// $img_data[$value['key_name']] = array('img_key' => $value['key_name'],'img_name' => $value['img_name'],'img_data' => [array('img_url' => $sales_pd_img_data_value['img'] ? 'BLOB' : '')],'is_multiple' => 1,'section_heading' => $value['img_name']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$img_data[$key]['img_data'][] = array('img_url' => $sales_pd_img_data_value['img'] ? $sales_pd_img_data_value['img'] : '');
|
||||
// $img_data[$key]['img_data'][] = array('img_url' => $sales_pd_img_data_value['img'] ? 'BLOB' : '');
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
$img_data[$value['key_name']] = array('img_key' => $value['key_name'],'img_name' => $value['img_name'],'img_url' => $sales_pd_img_data_value['img'] ? $sales_pd_img_data_value['img'] : '','is_multiple' => 0,'section_heading' => $value['img_name']);//$sales_pd_img_data_value['img']
|
||||
// $img_data[$value['key_name']] = array('img_key' => $value['key_name'],'img_name' => $value['img_name'],'img_url' => $sales_pd_img_data_value['img'] ? 'BLOB' : '','is_multiple' => 0,'section_heading' => $value['img_name']);//$sales_pd_img_data_value['img']
|
||||
}
|
||||
|
||||
unset($sales_pd_img_data[$sales_pd_img_data_key]);
|
||||
//break;
|
||||
}
|
||||
}
|
||||
|
||||
//IF current img key is not exist in existing img arry
|
||||
|
||||
if(!array_key_exists($value['key_name'],$img_data))
|
||||
{
|
||||
|
||||
if(!$value['is_multiple'])
|
||||
{
|
||||
$img_data[$key] = array('img_key' => $key,'img_name' => $value['img_name'],'img_url' => '','is_multiple' => $value['is_multiple'],'section_heading' => $value['img_name']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$img_data[$key] = array('img_key' => $key,'img_name' => $value['img_name'],'img_data' => array(),'is_multiple' => $value['is_multiple'],'section_heading' => $value['img_name']);
|
||||
}
|
||||
}
|
||||
}
|
||||
$img_data = array_values($img_data);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
foreach ($imgs as $key => $value)
|
||||
{
|
||||
|
||||
if($value['is_multiple'])
|
||||
{
|
||||
$img_data[] = array('img_key' => $value['key_name'],'img_name' => $value['img_name'],'img_data' => array(),'is_multiple' => 1,'section_heading' => $value['img_name']);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$img_data[] = array('img_key' => $value['key_name'],'img_name' => $value['img_name'],'img_url' => '','is_multiple' => 0,'section_heading' => $value['img_name']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//print_r($img_data);
|
||||
$data['dataStatus'] = true;
|
||||
$data['status'] = REST_Controller::HTTP_OK;
|
||||
// $data['records'] = array('smc_credit_pd' => $sales_pd_master_data[0]['smc_credit_pd'],'img_data' => $img_data,'is_cus_link_disabled' => $sales_pd_master_data[0]['is_cus_link_disabled']);
|
||||
$data['records'] = array('smc_credit_pd' => $pd_id,'img_data' => $img_data);
|
||||
$this->response($data,REST_Controller::HTTP_OK);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user