MERGE_CODE_MERGE : RV

This commit is contained in:
VENKATESHWARAN 2025-03-20 08:55:54 +05:30
commit b313309e00
3 changed files with 311 additions and 1030 deletions

View File

@ -557,9 +557,7 @@ class LeadsController extends BaseController
$data['insurer'] = $this->insurerBranchModel->getInsurerBranchesWithInsurerNames();
$data['userList'] = $this->userModel->getUserListForRFQ();
$data['lead_data'] = $lead_data;
// dd($data);
$mail_content = "
<p>Dear Sir,</p>
<p>Greetings From Nhance India!</p>
@ -577,46 +575,23 @@ class LeadsController extends BaseController
// dd($data);
if ($lead_data['lead_form_type'] == 1){
if ($data['lead_data']['lead_form_type'] == 1){
return $this->loadLayout('view_rfq.php', $data);
}else{
$this->loadLayout('view_rfq.php', $data);
}else if ($data['lead_data']['lead_form_type'] == 2){
return $this->loadLayout('view_rfq_non_eb', $data);
$data['policies'] = json_decode($data['question_json'], true)['policies'];
$data["child_table_data"] = json_decode($data['question_json'], true)['child_table_data'];
// $data['lead_register_data'] = json_decode($data['lead_data']['custom_fields']);
// dd($data['lead_register_data']);
$data['client_type'] = $this->clientType;
$this->loadLayout('view_rfq_non_eb', $data);
}
}
public function viewNonEBRFQ($id){
$data['insurer'] = $this->insurerBranchModel->getInsurerBranchesWithInsurerNames();
$lead_data = $this->leadsModel
->select('
leads.*,
policy_type.question_json,
policy_type.policy_type,
policy_type.long_name,
user_profiles.email as created_person_email
')
->join('policy_type', 'leads.policy_type_id = policy_type.id')
->join('user_profiles', 'leads.created_by = user_profiles.id', 'left')
->where('leads.id', $id)
->where('leads.is_active', 1)
->first();
$data['lead_data'] = $lead_data;
$data['client_type'] = $this->clientType;
$data['rfq_data'] = $this->RFQModel
->where('lead_id', $id)
// ->where('type', $type)
->where('is_active', 1)
->orderBy('id', 'desc')
->first();
// dd($data);
$this->loadLayout('view_rfq_non_eb', $data);
}
public function createRFQ()
{

View File

@ -32,6 +32,11 @@
<!-- Product selection Tab -->
<div class="tab-pane fade show active" id="product-selection">
<form id="productSelectionForm" class="parsley-examples" enctype="multipart/form-data">
<div class="row">
<div class="form-group col-md-3">
<button type="button" class="btn btn-primary" id="getDataFromLead" onclick="assignLeadData()">Get Data From Lead</button>
</div>
</div>
<div class="row">
<div class="form-group col-md-3">
<label>Select Buisness Type<span class="text-danger">*</span></label>
@ -59,7 +64,7 @@
<div class="row">
<div class="form-group col-md-3">
<label for="client_type">Client Type<span class="text-danger">*</span></label>
<select class="form-control" id="client_type" name="client_type" >
<select class="form-control" id="client_type" name="client_type">
<option value="">Select Client type</option>
<?php
if (isset($client_type) && count($client_type)) {
@ -72,7 +77,7 @@
</div>
<div class="form-group col-md-3">
<label for="buisnessNature">Nature of Buisness</label>
<input type="text" class="form-control" id="buisnessNature"/>
<input type="text" class="form-control" id="buisnessNature" />
</div>
</div>
@ -118,8 +123,11 @@
<label for="pan_number">PAN Number</label>
<input type="text" id="pan_number" name="pan_number" class="form-control" />
</div>
<div class="form-group col-md-3">
<input type="checkbox" id="dataFromLead" name="dataFromLead" class="form-check-input" />
<div class="form-group col-md-3" style="
padding-left: 40px;
padding-top: 34px;
">
<input onclick="checkandassignLeadData()" type="checkbox" id="dataFromLead" name="dataFromLead" class="form-check-input" />
<label for="dataFromLead">Get Data From Leads</label>
</div>
</div>
@ -154,7 +162,7 @@
</div>
<div class="form-group col-md-3">
<label for="policy_term">Policy Term<span class="text-danger">*</span></label>
<select id="policy_term" name="policy_term" class="form-control" >
<select id="policy_term" name="policy_term" class="form-control">
<option value="">Select</option>
<option value="1_month">1 Months</option>
<option value="2_month">2 Months</option>
@ -174,7 +182,7 @@
</div>
<div id="locationNoDIV" class="form-group col-md-3">
<label for="location_no">No of location<span class="text-danger">*</span></label>
<select id="location_no" name="location_no" class="form-control" >
<select id="location_no" name="location_no" class="form-control">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
@ -259,11 +267,11 @@
</div>
</div>
<script>
var storedData = JSON.parse(localStorage.getItem('policyData'));
var storedPolicyData = JSON.parse(localStorage.getItem('policyData'));
$(document).ready(function() {
// console.log("Stored date Found : ",storedData.length);
if (!$.isEmptyObject(storedData)) {
prepareDataForEdit(storedData);
// console.log("Stored date Found : ",storedPolicyData.length);
if (!$.isEmptyObject(storedPolicyData)) {
prepareDataForEdit(storedPolicyData);
} else {
console.log("inside else trying to open product sleection tab");
// const productSelectionTab = new bootstrap.Tab(document.getElementById);
@ -341,7 +349,7 @@
var policyRiskSplitUpData = {};
$(document).ready(function() {
if ($.isEmptyObject(storedData)) {
if ($.isEmptyObject(storedPolicyData)) {
$('#multilocation_type_div').hide();
}
// When a business-type checkbox changes, handle exclusive selection
@ -541,6 +549,7 @@
if (e.target.id === 'policy-details-tab') {
if (Object.keys(productSelectionData).length > 0) {
$("#policy-details").show();
// validatePolicyBasedOnProductSelection();
} else {
$("#policy-details").hide();
@ -1056,9 +1065,9 @@
console.log("Policy data saved to local storage. : ", policyData);
}
function loadPolicyDataBack(storedData) {
if (storedData) {
var parsedData = storedData;
function loadPolicyDataBack(storedPolicyData) {
if (storedPolicyData) {
var parsedData = storedPolicyData;
// Assign back to original variables
productSelectionData = parsedData.productSelection;
@ -1081,6 +1090,7 @@
function prepareDataForEdit(data) {
// alert("something wrong");
loadPolicyDataBack(data);
// Populate Product Selection
$('#singleProduct').prop('checked', data.productSelection.singleProduct === 'on');
@ -1157,4 +1167,49 @@
//showRequiredFieldsBasedOnLocation();
}
function checkandassignLeadData() {
var checkedStatus = $("#dataFromLead").is(":checked") ? true : false;
if (checkedStatus) {
assignLeadData();
}
}
function assignLeadData() {
const lead_data = <?= json_encode(json_decode($lead_data['custom_fields'])) ?>;
var client_type = <?= isset($lead_data['client_type']) ? $lead_data
['client_type'] : "" ?>;
var mobile = <?= isset($lead_data['client_type']) ? $lead_data
['client_type'] : "" ?>;
var email = <?= isset($lead_data['client_type']) ? $lead_data
['client_type'] : "" ?>;
var panNo = <?= isset($lead_data['client_type']) ? $lead_data
['client_type'] : "" ?>;
console.log("client_type : ".client_type);
if (lead_data) {
// lead_data = JSON.parse(lead_data);
console.log("Lead Data : ", typeof(lead_data));
if (lead_data.risk_location == "Single") {
console.log("single ");
$("#singleProduct").prop("checked", true).trigger("change");
} else {
$("#multipleProduct").prop("checked", true).trigger("change");
if (lead_data.risk_location == "multi_with_floter") {
$("#multilocation_type").val("multiFloater").trigger("change");
} else {
$("#multilocation_type").val("multiLocation").trigger("change");
}
}
$("#client_type").val(client_type).trigger("change");
$("#address1").val(lead_data.address);
}
}
</script>

File diff suppressed because it is too large Load Diff