Merge branch 'dev' of bitbucket.org:jubilian/nhance into dev
This commit is contained in:
commit
5de9d6ffcd
@ -4713,7 +4713,8 @@ class ClientController extends AdminController
|
|||||||
// dd($data);
|
// dd($data);
|
||||||
|
|
||||||
|
|
||||||
// $LeadsController = new LeadsController();
|
$LeadsController = new LeadsController();
|
||||||
|
$RFQModel = new RFQModel();
|
||||||
// $path = $LeadsController->constructNonEbExcelToSaveTemp(106, 2, "Proposal 2-ICICIPRU-ICICI001");
|
// $path = $LeadsController->constructNonEbExcelToSaveTemp(106, 2, "Proposal 2-ICICIPRU-ICICI001");
|
||||||
// $filepath = $path['filePath'];
|
// $filepath = $path['filePath'];
|
||||||
|
|
||||||
@ -4735,6 +4736,15 @@ class ClientController extends AdminController
|
|||||||
// } else {
|
// } else {
|
||||||
// echo "File does not exist.";
|
// echo "File does not exist.";
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
// $data = $this->leadsModel->where('leads.id', 115)->where('leads.is_active', 1)->first();
|
||||||
|
// $RFQdata = $RFQModel->getRFQTableDataWithLeadIDAndType(115, 2);
|
||||||
|
// Kint::dump($RFQdata['json']);
|
||||||
|
// $returnData = $LeadsController->getPlacementJson($data);
|
||||||
|
// $this->clientPolicyModel->where('id', 6050)->set('placement_json', $returnData)->update();
|
||||||
|
// dd($returnData);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@ -584,8 +584,17 @@ class LeadsController extends BaseController
|
|||||||
|
|
||||||
$data['occupancy'] = $this->occupancyModel->findAll();
|
$data['occupancy'] = $this->occupancyModel->findAll();
|
||||||
// dd($data['occupancy']);
|
// dd($data['occupancy']);
|
||||||
|
|
||||||
|
if($lead_data['lead_type'] == 2){
|
||||||
|
$client_policy_data = $this->clientPolicyModel->where('is_active', 1)->where('id', $lead_data['source_policy_id'])->first();
|
||||||
|
$data['rfq_data']['json'] = $client_policy_data['placement_json'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!empty($data['question_json'])){
|
||||||
$data['policies'] = json_decode($data['question_json'], true)['policies'];
|
$data['policies'] = json_decode($data['question_json'], true)['policies'];
|
||||||
$data["child_table_data"] = json_decode($data['question_json'], true)['child_table_data'];
|
$data["child_table_data"] = json_decode($data['question_json'], true)['child_table_data'];
|
||||||
|
}
|
||||||
|
|
||||||
// $data['lead_register_data'] = json_decode($data['lead_data']['custom_fields']);
|
// $data['lead_register_data'] = json_decode($data['lead_data']['custom_fields']);
|
||||||
// dd($data['lead_register_data']);
|
// dd($data['lead_register_data']);
|
||||||
$data['client_type'] = $this->clientType;
|
$data['client_type'] = $this->clientType;
|
||||||
@ -2272,8 +2281,6 @@ class LeadsController extends BaseController
|
|||||||
'policy_status' => 1,
|
'policy_status' => 1,
|
||||||
];
|
];
|
||||||
|
|
||||||
$terms = $this->preparePolicyTermsFromRFQ($data);
|
|
||||||
|
|
||||||
$policy_type_id = $data['policy_type_id'];
|
$policy_type_id = $data['policy_type_id'];
|
||||||
if (in_array($policy_type_id, [1, 2, 6, 7])) {
|
if (in_array($policy_type_id, [1, 2, 6, 7])) {
|
||||||
$client_policy_data['is_addon'] = 1; // Base Policy
|
$client_policy_data['is_addon'] = 1; // Base Policy
|
||||||
@ -2287,8 +2294,16 @@ class LeadsController extends BaseController
|
|||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($data['lead_form_type'] == 1){
|
||||||
$client_policy_data['policy_terms'] = $this->preparePolicyTermsFromRFQ($data);
|
$client_policy_data['policy_terms'] = $this->preparePolicyTermsFromRFQ($data);
|
||||||
|
}else{
|
||||||
|
|
||||||
|
$placementJson = $this->getPlacementJson($data);
|
||||||
|
if ($placementJson) {
|
||||||
|
$client_policy_data['placement_json'] = $placementJson;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
// print_r($client_policy_data); die;
|
// print_r($client_policy_data); die;
|
||||||
|
|
||||||
return $client_policy_data;
|
return $client_policy_data;
|
||||||
@ -2298,7 +2313,7 @@ class LeadsController extends BaseController
|
|||||||
{
|
{
|
||||||
$proposel_data = json_decode($data['proposel_data'], true);
|
$proposel_data = json_decode($data['proposel_data'], true);
|
||||||
|
|
||||||
$QCRData = $this->RFQModel->where('is_active', 1)->where('type', 2)->where('lead_id', $data['id'])->first();
|
$QCRData = $this->RFQModel->where('is_active', 1)->where('lead_id', $data['id'])->first();
|
||||||
|
|
||||||
$JSON = json_decode($QCRData['json'], true);
|
$JSON = json_decode($QCRData['json'], true);
|
||||||
|
|
||||||
@ -2405,6 +2420,40 @@ class LeadsController extends BaseController
|
|||||||
return $this->respond(['status' => false, 'message' => 'Failed to create policy', 'data' => $data], 200);
|
return $this->respond(['status' => false, 'message' => 'Failed to create policy', 'data' => $data], 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getPlacementJson(array $data): ?string
|
||||||
|
{
|
||||||
|
$proposel_data = json_decode($data['proposel_data'], true);
|
||||||
|
|
||||||
|
$QCRData = $this->RFQModel
|
||||||
|
->where('is_active', 1)
|
||||||
|
->where('lead_id', $data['id'])
|
||||||
|
->first();
|
||||||
|
|
||||||
|
if (!$QCRData || empty($QCRData['json'])) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$jsonArray = json_decode($QCRData['json'], true);
|
||||||
|
$proposalData = array_pop($jsonArray); // Get last item and remove it from the array
|
||||||
|
|
||||||
|
if (empty($jsonArray)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$placement_json_data = array_map(function ($jsonData) use ($proposel_data) {
|
||||||
|
return $this->transformNonEbProposelData(
|
||||||
|
$jsonData,
|
||||||
|
$proposel_data['proposel_name'] ?? '',
|
||||||
|
$proposel_data['insurer_name'] ?? '', null, 1
|
||||||
|
);
|
||||||
|
}, $jsonArray);
|
||||||
|
|
||||||
|
$placement_json_data[] = $proposalData;
|
||||||
|
|
||||||
|
return json_encode($placement_json_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
@ -3268,7 +3317,7 @@ class LeadsController extends BaseController
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function transformNonEbProposelData(&$data, $proposal, $insurer, $tableCount)
|
public function transformNonEbProposelData(&$data, $proposal, $insurer, $tableCount=null, $actionColumn = null)
|
||||||
{
|
{
|
||||||
// Kint::dump($data, $proposal, $insurer, $tableCount);
|
// Kint::dump($data, $proposal, $insurer, $tableCount);
|
||||||
|
|
||||||
@ -3305,6 +3354,13 @@ class LeadsController extends BaseController
|
|||||||
// Update the original data's headers
|
// Update the original data's headers
|
||||||
$data['table_data']['headers'] = $headerData;
|
$data['table_data']['headers'] = $headerData;
|
||||||
|
|
||||||
|
if(!empty($actionColumn)){
|
||||||
|
$data['table_data']['headers'][] = [
|
||||||
|
'parentHeader' => "Action",
|
||||||
|
'subHeaders' => ['-']
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($data['table_data']['data'] as &$entry) {
|
foreach ($data['table_data']['data'] as &$entry) {
|
||||||
|
|
||||||
$sno = $entry['SNO'];
|
$sno = $entry['SNO'];
|
||||||
@ -3329,6 +3385,12 @@ class LeadsController extends BaseController
|
|||||||
if ($item['parentth'] === $proposal && $item['subth'] === $insurer) {
|
if ($item['parentth'] === $proposal && $item['subth'] === $insurer) {
|
||||||
$filteredData[] = $item;
|
$filteredData[] = $item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!empty($actionColumn)){
|
||||||
|
if($item['parentth'] === "Action"){
|
||||||
|
$filteredData[] = $item;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the entry with filtered data
|
// Update the entry with filtered data
|
||||||
|
|||||||
@ -54,6 +54,7 @@ class ClientPolicyModel extends Model
|
|||||||
"is_member_modify_allowed",
|
"is_member_modify_allowed",
|
||||||
"cd_ac_pk",
|
"cd_ac_pk",
|
||||||
"is_lgbtq",
|
"is_lgbtq",
|
||||||
|
"placement_json",
|
||||||
];
|
];
|
||||||
|
|
||||||
// Callbacks
|
// Callbacks
|
||||||
|
|||||||
@ -294,6 +294,25 @@ if (isset($selected_lead_type)) {
|
|||||||
$('#salse_person_id').trigger('change');
|
$('#salse_person_id').trigger('change');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function validateInput(input, table, field){
|
||||||
|
|
||||||
|
let value = $(input).val();
|
||||||
|
let label = $(input).closest('.form-group').find('label').text().replace('*', '').trim();
|
||||||
|
|
||||||
|
let message = "Value is duplicate!";
|
||||||
|
if(label){
|
||||||
|
message = label + " already exists!";
|
||||||
|
}
|
||||||
|
|
||||||
|
checkDuplicateTableFieldValue(table, field, value, function(isDuplicate) {
|
||||||
|
if (isDuplicate) {
|
||||||
|
toastr.warning(message, 'WARNING');
|
||||||
|
$(input).val('')
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user