dynamical form Template : ps

This commit is contained in:
sanjeev 2021-12-21 21:25:06 +05:30
parent 52f8affa08
commit a23534ad7e
5 changed files with 139 additions and 56 deletions

View File

@ -674,5 +674,7 @@ defined('RCM_STATE_MAPPING') OR define('RCM_STATE_MAPPING','t_rcm_state_mapping'
defined('AGENCYLIST') OR define('AGENCYLIST','t_smc_agency_list');
defined('TEMPLATE_JSON_V2') OR define('TEMPLATE_JSON_V2',"m_template_json_v2");
defined('TEMPLATE_MAP_V2') OR define('TEMPLATE_MAP_V2',"m_template_mapping_v2");

View File

@ -330,4 +330,8 @@ $route['downloadDataDump'] = 'Request_DataDump_Controller/downloadDataDump2';
$route['getSMCVendorList'] = 'SMC_Credit_PD_Controller/getCityWiseAgency';
$route['getSMCVendorPDOfficersList'] = 'SMC_Credit_PD_Controller/getSMCVendorPDOfficersList';
$route['getShortenURL'] = 'PD_Controller/getShortenURL';
//Template V2 (Dynamical)
$route['getTemplateFormsV2'] = 'Template_Management_Controller/getTemplateFormsV2';
$route['saveAndUpdateTemplateFormsV2'] = 'Template_Management_Controller/saveTemplateFormsV2';
// $route['updateTemplateFormsV2'] = 'Template_Management_Controller/updateTemplateFormsV2';

View File

@ -11351,60 +11351,6 @@ public function getCompaniesListsFromGeneralFormRawJSON_post()
return $pd_details;
}
function getShortenURL_get(){
$url = $this->get('url');
$this->load->helper('video_grabber_helper');
$concat_url = "127.0.0.1:5000/sh_url?url=".$url;
// 1
$client = new \GuzzleHttp\Client();
$res = $client->get($concat_url,['headers'=>['Content-Type' => 'application/json']]);
if($res && $res->getStatusCode() == 200)
{
$result_data = json_decode($res->getBody()->getContents());
}else{
$result_data = array();
}
// print_r($result_data);die();
// 2
// $ch = curl_init();
// $timeout = 5;
// $headers = array('Content-type: application/json');
// curl_setopt( $ch,CURLOPT_URL, $concat_url );
// curl_setopt( $ch,CURLOPT_HTTPHEADER, $headers );
// curl_setopt( $ch,CURLOPT_RETURNTRANSFER, true );
// curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
// $result = curl_exec($ch );
// curl_close( $ch );
// print_r($result);
// $client = new GuzzleHttp\Client();
// $res = $client->request('GET',$concat_url);
// echo $res->getStatusCode();
// // "200"
// echo $res->getHeader('content-type')[0];
// // 'application/json; charset=utf8'
// echo $res->getBody();
// {"type":"User"...'
// Send an asynchronous request.
// $request = new \GuzzleHttp\Psr7\Request('GET',$concat_url);
// $promise = $client->sendAsync($request)->then(function ($response) {
// echo 'I completed! ' . $response->getBody();
// });
// $promise->wait();
if(!empty($result_data) && $result_data->datastatus == 200)
{
$data['dataStatus'] = true;
$data['status'] = REST_Controller::HTTP_OK;
$data['shorten_url'] = $result_data->data;
}
else
{
$data['dataStatus'] = false;
$data['status'] = REST_Controller::HTTP_NOT_FOUND;
$data['msg'] = 'Something Wrong. Try Later!';
}
$this->response($data,REST_Controller::HTTP_OK);
}
function getAdditionalRequirements_get(){
$pdid = $this->get('pdid');

File diff suppressed because one or more lines are too long

View File

@ -279,4 +279,53 @@ class Template_Management_Model extends SPARQ_Model {
}
public function getTemplateFormsV2($records){
$this->db->SELECT('TEMPLATE_MAP_V2.id, TEMPLATE_MAP_V2.entity_id, TEMPLATE_MAP_V2.product_id, TEMPLATE_MAP_V2.customer_segment_id, TEMPLATE_MAP_V2.isactive,TEMPLATE_JSON_V2.form_id,TEMPLATE_JSON_V2.json');
$this->db->FROM(TEMPLATE_MAP_V2.' as TEMPLATE_MAP_V2');
$this->db->JOIN(TEMPLATE_JSON_V2.' as TEMPLATE_JSON_V2','TEMPLATE_MAP_V2.id = TEMPLATE_JSON_V2.map_id','LEFT');
if(isset($records['entity_id']))
{
$this->db->WHERE('TEMPLATE_MAP_V2.entity_id',$records['entity_id']);
}
if(isset($records['product_id']))
{
$this->db->WHERE('TEMPLATE_MAP_V2.product_id',$records['product_id']);
}
if(isset($records['customer_segment_id']))
{
$this->db->WHERE('TEMPLATE_MAP_V2.customer_segment_id',$records['customer_segment_id']);
}
$result = $this->db->GET()->result_array();
return $result;
}
public function saveTemplateMapping($records,$table){
$this->db->insert($table, $records);
$insert_id = $this->db->insert_id();
return $insert_id;
}
public function updateTemplateFormsV2($records){
// $this->db->SELECT('TEMPLATE_JSON_V2.id, TEMPLATE_JSON_V2.entity_id, TEMPLATE_JSON_V2.product_id, TEMPLATE_JSON_V2.customer_segment_id, TEMPLATE_JSON_V2.isactive,TEMPLATE_MAP_V2.json, TEMPLATE_MAP_V2.form_id');
// $this->db->FROM(TEMPLATE_JSON_V2.' as TEMPLATE_JSON_V2');
// $this->db->JOIN(TEMPLATE_MAP_V2.' as TEMPLATE_MAP_V2','TEMPLATE_MAP_V2.map_id = TEMPLATE_JSON_V2.id','LEFT');
// if(isset($records['entity_id']))
// {
// $this->db->WHERE('TEMPLATE_JSON_V2.entity_id',$records['entity_id']);
// }
// if(isset($records['product_id']))
// {
// $this->db->WHERE('TEMPLATE_JSON_V2.product_id',$records['product_id']);
// }
// if(isset($records['customer_segment_id']))
// {
// $this->db->WHERE('TEMPLATE_JSON_V2.customer_segment_id',$records['customer_segment_id']);
// }
// $result = $this->db->GET()->result_array();
// return $result;
}
}