CHANGE_RFQ_CR : RV
This commit is contained in:
parent
4a0d9657d9
commit
df5dce214e
@ -357,6 +357,7 @@ $routes->group("/util", ["filter" => "authMVC"], function ($routes) {
|
|||||||
$routes->get('getLeadNonEB/(:any)', 'LeadsController::getLeadNonEB/$1');
|
$routes->get('getLeadNonEB/(:any)', 'LeadsController::getLeadNonEB/$1');
|
||||||
$routes->get('getPolicyTypeFields', 'LeadsController::getPolicyTypeFields');
|
$routes->get('getPolicyTypeFields', 'LeadsController::getPolicyTypeFields');
|
||||||
$routes->get('removeMultiFile', 'LeadsController::removeMultiFile');
|
$routes->get('removeMultiFile', 'LeadsController::removeMultiFile');
|
||||||
|
$routes->get('removeInstallments', 'LeadsController::removeInstallments');
|
||||||
});
|
});
|
||||||
|
|
||||||
$routes->group("policy_tranction", ["filter" => "authMVC"], function ($routes) {
|
$routes->group("policy_tranction", ["filter" => "authMVC"], function ($routes) {
|
||||||
|
|||||||
@ -30,6 +30,7 @@ use App\Models\RFQModel;
|
|||||||
use App\Models\InsurerModel;
|
use App\Models\InsurerModel;
|
||||||
use App\Models\OccupancyMasterModel;
|
use App\Models\OccupancyMasterModel;
|
||||||
use App\Models\LeadFilesModel;
|
use App\Models\LeadFilesModel;
|
||||||
|
use App\Models\LeadInstallmentPaymentDetails;
|
||||||
|
|
||||||
use App\Helpers\MailHelper;
|
use App\Helpers\MailHelper;
|
||||||
use App\Helpers\ExcelMergeHelper;
|
use App\Helpers\ExcelMergeHelper;
|
||||||
@ -65,6 +66,7 @@ class LeadsController extends BaseController
|
|||||||
protected $insurerModel;
|
protected $insurerModel;
|
||||||
protected $occupancyModel;
|
protected $occupancyModel;
|
||||||
protected $leadFilesModel;
|
protected $leadFilesModel;
|
||||||
|
protected $leadInstallmentPaymentDetails;
|
||||||
|
|
||||||
//variables for storing array
|
//variables for storing array
|
||||||
protected $issuer;
|
protected $issuer;
|
||||||
@ -96,20 +98,26 @@ class LeadsController extends BaseController
|
|||||||
$this->insurerModel = new InsurerModel();
|
$this->insurerModel = new InsurerModel();
|
||||||
$this->occupancyModel = new OccupancyMasterModel();
|
$this->occupancyModel = new OccupancyMasterModel();
|
||||||
$this->leadFilesModel = new LeadFilesModel();
|
$this->leadFilesModel = new LeadFilesModel();
|
||||||
|
$this->leadInstallmentPaymentDetails = new LeadInstallmentPaymentDetails();
|
||||||
|
|
||||||
$this->issuer = [1 => 'JIBS', 2 => 'Nhance'];
|
$this->issuer = [1 => 'JIBS', 2 => 'Nhance'];
|
||||||
$this->clientType = [1 => 'Group', 2 => 'Individual'];
|
$this->clientType = [1 => 'Group', 2 => 'Individual'];
|
||||||
$this->leadType = [1 => 'Fresh', 2 => 'Renewal', 3 => 'Roll Over'];
|
$this->leadType = [1 => 'Fresh', 2 => 'Renewal', 3 => 'Roll Over'];
|
||||||
$this->buisnessType = [1 => 'Industrial', 2 => 'Non Industrial'];
|
$this->buisnessType = [1 => 'Industrial', 2 => 'Non Industrial'];
|
||||||
|
|
||||||
$this->leadsStatus = [
|
$this->leadsStatus = [
|
||||||
'queued' => 'In-Queued',
|
'queued' => 'In-Queued',
|
||||||
'qcr_sent' => 'QCR sent',
|
'rfq_created' => 'RFQ Created',
|
||||||
|
'rfq_sent' => 'RFQ Sent',
|
||||||
|
'qcr_created' => 'QCR Created',
|
||||||
|
'qcr_sent' => 'QCR Sent',
|
||||||
'lost' => 'Lost',
|
'lost' => 'Lost',
|
||||||
'co_insurer_pending' => 'Co-Insurer Pending',
|
'co_insurer_pending' => 'Co-Insurer Pending',
|
||||||
'won' => 'Won',
|
'won' => 'Won',
|
||||||
'completed_with_corrections' => 'Completed with Corrections',
|
'completed_with_corrections' => 'Completed with Corrections',
|
||||||
'completed_without_corrections' => 'Completed w/o Corrections',
|
'completed_without_corrections' => 'Completed without Corrections',
|
||||||
];
|
];
|
||||||
|
|
||||||
$this->claim_type_for_gpa = [
|
$this->claim_type_for_gpa = [
|
||||||
'accident_death' => 'Accident Death',
|
'accident_death' => 'Accident Death',
|
||||||
'permanent_total_disablement' => 'Permanent Total Disablement',
|
'permanent_total_disablement' => 'Permanent Total Disablement',
|
||||||
@ -592,6 +600,7 @@ class LeadsController extends BaseController
|
|||||||
$this->leadFilesModel->where('id', $value['id'])->set($lead_file_data)->update();
|
$this->leadFilesModel->where('id', $value['id'])->set($lead_file_data)->update();
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
if (!empty($value['file_name'])) {
|
||||||
$lead_file_data = [
|
$lead_file_data = [
|
||||||
'lead_id' => $lead_id,
|
'lead_id' => $lead_id,
|
||||||
'docs_name' => $value['docs_name'],
|
'docs_name' => $value['docs_name'],
|
||||||
@ -599,6 +608,7 @@ class LeadsController extends BaseController
|
|||||||
];
|
];
|
||||||
$this->leadFilesModel->insert($lead_file_data);
|
$this->leadFilesModel->insert($lead_file_data);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($key == 0 && !empty($value['file_name'])) {
|
if ($key == 0 && !empty($value['file_name'])) {
|
||||||
$this->leadsModel->where('id', $lead_id)->set('file_name', $value['file_name'])->update();
|
$this->leadsModel->where('id', $lead_id)->set('file_name', $value['file_name'])->update();
|
||||||
@ -619,6 +629,8 @@ class LeadsController extends BaseController
|
|||||||
return $this->respond(['status' => false, 'message' => 'File could not be removed.'], 200);
|
return $this->respond(['status' => false, 'message' => 'File could not be removed.'], 200);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//--------RFQ-----------------------------------------------------------------------------------------------
|
//--------RFQ-----------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
@ -676,7 +688,7 @@ class LeadsController extends BaseController
|
|||||||
$data['exclusiveUserList'] = $this->userModel->getexclusiveUserListForRFQ();
|
$data['exclusiveUserList'] = $this->userModel->getexclusiveUserListForRFQ();
|
||||||
$data['lead_data'] = $lead_data;
|
$data['lead_data'] = $lead_data;
|
||||||
|
|
||||||
$mail_content = "
|
$mail_content = '
|
||||||
<p>Dear Sir,</p>
|
<p>Dear Sir,</p>
|
||||||
<p>Greetings From Nhance India!</p>
|
<p>Greetings From Nhance India!</p>
|
||||||
<p>Please find attached the {{RFQ_OR_QCR}} for <strong>{{POLICY_TYPE}}</strong> policy pertaining to <strong>{{CLIENT_NAME}}</strong>.</p>
|
<p>Please find attached the {{RFQ_OR_QCR}} for <strong>{{POLICY_TYPE}}</strong> policy pertaining to <strong>{{CLIENT_NAME}}</strong>.</p>
|
||||||
@ -687,13 +699,11 @@ class LeadsController extends BaseController
|
|||||||
|
|
||||||
<div style=\"margin: 0; padding: 0; line-height: 1.2;\">
|
<div style=\"margin: 0; padding: 0; line-height: 1.2;\">
|
||||||
<div>{{LOGGED_USER_NAME}}</div>
|
<div>{{LOGGED_USER_NAME}}</div>
|
||||||
<div>Email: {{LOGGED_USER_EMAIL}}</div>
|
|
||||||
<div>Mobile: {{LOGGED_USER_MOBILE}}</div>
|
<div>Mobile: {{LOGGED_USER_MOBILE}}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<img src="{{LOGO_PATH}}" alt="Nhance Logo" width="100" style="margin-top:10px;">
|
||||||
|
';
|
||||||
";
|
|
||||||
|
|
||||||
if ($data['lead_data']['policy_end_date'] != null) {
|
if ($data['lead_data']['policy_end_date'] != null) {
|
||||||
$subject = "{{CLIENT_NAME}} _ {{POLICY_TYPE}} _ {{RFQ_OR_QCR}} _ {{POLICY_YEAR}} {{POLICY_END_DATE}}";
|
$subject = "{{CLIENT_NAME}} _ {{POLICY_TYPE}} _ {{RFQ_OR_QCR}} _ {{POLICY_YEAR}} {{POLICY_END_DATE}}";
|
||||||
@ -705,6 +715,8 @@ class LeadsController extends BaseController
|
|||||||
$data['subject'] = $this->transformMailContent($lead_data, $subject, $data['page_name']);
|
$data['subject'] = $this->transformMailContent($lead_data, $subject, $data['page_name']);
|
||||||
|
|
||||||
$data['multi_file_data'] = $this->leadFilesModel->where('lead_id', $id)->where('is_active', 1)->findAll() ?? null;
|
$data['multi_file_data'] = $this->leadFilesModel->where('lead_id', $id)->where('is_active', 1)->findAll() ?? null;
|
||||||
|
$installment_data['installments'] = $this->leadInstallmentPaymentDetails->where('lead_id', $id)->where('is_active', 1)->findAll() ?? null;
|
||||||
|
$data['lead_data']['installment_data'] = view('rfq/installment_fields', $installment_data) ?? null;
|
||||||
$data['attachment_html'] = view('rfq/attachment_files', $data) ?? "";
|
$data['attachment_html'] = view('rfq/attachment_files', $data) ?? "";
|
||||||
$data['user_team'] = $this->userModel->select("ut.team_id")->join("user_teams ut", "ut.user_id = user_profiles.id and ut.is_active = 1")->where("user_profiles.is_active", 1)->first()['team_id'];
|
$data['user_team'] = $this->userModel->select("ut.team_id")->join("user_teams ut", "ut.user_id = user_profiles.id and ut.is_active = 1")->where("user_profiles.is_active", 1)->first()['team_id'];
|
||||||
// dd($data);
|
// dd($data);
|
||||||
@ -776,10 +788,13 @@ class LeadsController extends BaseController
|
|||||||
return $this->respond(['status' => false, 'message' => 'Lead ID is required'], 400);
|
return $this->respond(['status' => false, 'message' => 'Lead ID is required'], 400);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$rfq_created = $this->RFQModel->where('lead_id', $lead_id)->where('is_active', 1)->countAllResults();
|
||||||
|
$qcr_created = false;
|
||||||
$inputJson = json_decode($data['json'], true);
|
$inputJson = json_decode($data['json'], true);
|
||||||
if (isset($inputJson['premium_data']) && !empty($inputJson['premium_data'])) {
|
if (isset($inputJson['premium_data']) && !empty($inputJson['premium_data'])) {
|
||||||
$sortedJson = $this->reorderProposalsByInsurerTotal($inputJson);
|
$sortedJson = $this->reorderProposalsByInsurerTotal($inputJson);
|
||||||
$data['json'] = json_encode($sortedJson);
|
$data['json'] = json_encode($sortedJson);
|
||||||
|
$qcr_created = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -821,6 +836,19 @@ class LeadsController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($insertId) {
|
if ($insertId) {
|
||||||
|
|
||||||
|
if(empty($rfq_created)){
|
||||||
|
$this->leadsModel->update($lead_id, ['status' => "rfq_created"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if($qcr_created == true){
|
||||||
|
$this->leadsModel
|
||||||
|
->where('id', $lead_id)
|
||||||
|
->whereNotIn('status', ['qcr_sent', 'lost', 'co_insurer_pending', 'won', 'completed_with_corrections', 'completed_without_corrections'])
|
||||||
|
->set(['status' => "qcr_created"])
|
||||||
|
->update();
|
||||||
|
}
|
||||||
|
|
||||||
$message = ($data['submit_type'] ?? '') == 'QCR' ? 'QCR saved successfully' : 'RFQ saved successfully';
|
$message = ($data['submit_type'] ?? '') == 'QCR' ? 'QCR saved successfully' : 'RFQ saved successfully';
|
||||||
return $this->respond([
|
return $this->respond([
|
||||||
'status' => true,
|
'status' => true,
|
||||||
@ -1063,6 +1091,17 @@ class LeadsController extends BaseController
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function removeInstallments()
|
||||||
|
{
|
||||||
|
$id = $this->request->getGet('id');
|
||||||
|
// print_r($id); die;
|
||||||
|
if (!empty($id)) {
|
||||||
|
$this->leadInstallmentPaymentDetails->whereIn('id', $id)->set(['is_active' => 0])->update();
|
||||||
|
return $this->respond(['status' => true, 'message' => 'Removed successfully'], 200);
|
||||||
|
} else {
|
||||||
|
return $this->respond(['status' => false, 'message' => 'Could not be removed.'], 200);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//-----RFQ and QCR EXPORT------------------------------------------------------------------------------------------------
|
//-----RFQ and QCR EXPORT------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
@ -1139,36 +1178,32 @@ class LeadsController extends BaseController
|
|||||||
|
|
||||||
if ($rfq_data['policy_type_id'] == 2) {
|
if ($rfq_data['policy_type_id'] == 2) {
|
||||||
$lead_data = [
|
$lead_data = [
|
||||||
'policy_end_date' => $rfq_data['policy_end_date'],
|
|
||||||
'Insured' => $rfq_data['client_name'],
|
'Insured' => $rfq_data['client_name'],
|
||||||
'Policy Status' => $rfq_data['status'],
|
'Policy Type' => $this->leadType[$rfq_data['lead_type']] ?? "",
|
||||||
|
|
||||||
'No of Employees' => $rfq_data['incept_emp_count'],
|
'No of Employees' => $rfq_data['incept_emp_count'],
|
||||||
'No of Dependents' => $rfq_data['incept_dept_count'],
|
'No of Dependents' => $rfq_data['incept_dept_count'],
|
||||||
'Total Lives' => $rfq_data['incept_no_of_lives'],
|
'Total Lives' => $rfq_data['incept_no_of_lives'],
|
||||||
|
|
||||||
'Period of Insurance ' => date('d/m/Y', strtotime($rfq_data['policy_start_date'])) . ' to ' . date('d/m/Y', strtotime($rfq_data['policy_end_date'])),
|
'Period of Insurance ' => !empty($rfq_data['policy_start_date']) && !empty($rfq_data['policy_end_date']) ? date('d/m/Y', strtotime($rfq_data['policy_start_date'])) . ' to ' . date('d/m/Y', strtotime($rfq_data['policy_end_date'])) : "To be decided",
|
||||||
'Policy Run Days' => $rfq_data['policy_run_days'],
|
'Policy Run Days' => $rfq_data['policy_run_days'],
|
||||||
];
|
];
|
||||||
} else if ($rfq_data['policy_type_id'] == 1) {
|
} else if ($rfq_data['policy_type_id'] == 1) {
|
||||||
$lead_data = [
|
$lead_data = [
|
||||||
'policy_end_date' => $rfq_data['policy_end_date'],
|
|
||||||
'Insured' => $rfq_data['client_name'],
|
'Insured' => $rfq_data['client_name'],
|
||||||
'No of Employees at Inception' => $rfq_data['incept_emp_count'],
|
'No of Employees at Inception' => $rfq_data['incept_emp_count'],
|
||||||
'Total Sum Insured at Inception ' => $rfq_data['total_si_at_incept'],
|
'Total Sum Insured at Inception ' => $rfq_data['total_si_at_incept'],
|
||||||
'Policy Period' => date('d/m/Y', strtotime($rfq_data['policy_start_date'])) . ' to ' . date('d/m/Y', strtotime($rfq_data['policy_end_date'])),
|
'Policy Period' => !empty($rfq_data['policy_start_date']) && !empty($rfq_data['policy_end_date']) ? date('d/m/Y', strtotime($rfq_data['policy_start_date'])) . ' to ' . date('d/m/Y', strtotime($rfq_data['policy_end_date'])) : "To be decided",
|
||||||
'Policy Status' => $rfq_data['status'],
|
'Policy Type' => $this->leadType[$rfq_data['lead_type']] ?? "",
|
||||||
'Existing Insurer' => $rfq_data['insurer_name'],
|
|
||||||
'TPA ' => $rfq_data['tpa_name'],
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if ($rfq_data['policy_type_id'] == 2) {
|
if ($rfq_data['policy_type_id'] == 2) {
|
||||||
$lead_data = [
|
$lead_data = [
|
||||||
'policy_end_date' => $rfq_data['policy_end_date'],
|
|
||||||
|
|
||||||
'Insured' => $rfq_data['client_name'],
|
'Insured' => $rfq_data['client_name'],
|
||||||
'Policy Status' => $rfq_data['status'],
|
'Policy Type' => $this->leadType[$rfq_data['lead_type']] ?? "",
|
||||||
|
|
||||||
'No of Employees at Inception' => $rfq_data['incept_emp_count'],
|
'No of Employees at Inception' => $rfq_data['incept_emp_count'],
|
||||||
'No of Dependents at Inception' => $rfq_data['incept_dept_count'],
|
'No of Dependents at Inception' => $rfq_data['incept_dept_count'],
|
||||||
@ -1182,7 +1217,7 @@ class LeadsController extends BaseController
|
|||||||
'No of Dependents at Renewal' => $rfq_data['renewal_dept_count'],
|
'No of Dependents at Renewal' => $rfq_data['renewal_dept_count'],
|
||||||
'Total Lives at Renewal ' => $rfq_data['renewal_no_of_lives'],
|
'Total Lives at Renewal ' => $rfq_data['renewal_no_of_lives'],
|
||||||
|
|
||||||
'Period of Insurance ' => date('d/m/Y', strtotime($rfq_data['policy_start_date'])) . ' to ' . date('d/m/Y', strtotime($rfq_data['policy_end_date'])),
|
'Period of Insurance ' => !empty($rfq_data['policy_start_date']) && !empty($rfq_data['policy_end_date']) ? date('d/m/Y', strtotime($rfq_data['policy_start_date'])) . ' to ' . date('d/m/Y', strtotime($rfq_data['policy_end_date'])) : "To be decided",
|
||||||
'Policy Run Days' => $rfq_data['policy_run_days'],
|
'Policy Run Days' => $rfq_data['policy_run_days'],
|
||||||
'Inception Premium' => $rfq_data['premium_at_inception'],
|
'Inception Premium' => $rfq_data['premium_at_inception'],
|
||||||
'Premium as on (Date - DD MM YYYY should be entered based on the claims dump report)' => $rfq_data['premium_date'],
|
'Premium as on (Date - DD MM YYYY should be entered based on the claims dump report)' => $rfq_data['premium_date'],
|
||||||
@ -1194,12 +1229,11 @@ class LeadsController extends BaseController
|
|||||||
];
|
];
|
||||||
} else if ($rfq_data['policy_type_id'] == 1) {
|
} else if ($rfq_data['policy_type_id'] == 1) {
|
||||||
$lead_data = [
|
$lead_data = [
|
||||||
'policy_end_date' => $rfq_data['policy_end_date'],
|
|
||||||
'Insured' => $rfq_data['client_name'],
|
'Insured' => $rfq_data['client_name'],
|
||||||
'No of Employees at Renewal' => $rfq_data['renewal_emp_count'],
|
'No of Employees at Renewal' => $rfq_data['renewal_emp_count'],
|
||||||
'Total Sum Insured at Renewal ' => $rfq_data['total_si_at_renewal'],
|
'Total Sum Insured at Renewal ' => $rfq_data['total_si_at_renewal'],
|
||||||
'Policy Period' => date('d/m/Y', strtotime($rfq_data['policy_start_date'])) . ' to ' . date('d/m/Y', strtotime($rfq_data['policy_end_date'])),
|
'Policy Period' => !empty($rfq_data['policy_start_date']) && !empty($rfq_data['policy_end_date']) ? date('d/m/Y', strtotime($rfq_data['policy_start_date'])) . ' to ' . date('d/m/Y', strtotime($rfq_data['policy_end_date'])) : "To be decided",
|
||||||
'Policy Status' => $rfq_data['status'],
|
'Policy Type' => $this->leadType[$rfq_data['lead_type']] ?? "",
|
||||||
'Existing Insurer' => $rfq_data['insurer_name'],
|
'Existing Insurer' => $rfq_data['insurer_name'],
|
||||||
'TPA ' => $rfq_data['tpa_name'],
|
'TPA ' => $rfq_data['tpa_name'],
|
||||||
];
|
];
|
||||||
@ -1209,13 +1243,16 @@ class LeadsController extends BaseController
|
|||||||
$data = json_decode($rfq_data['json'], true);
|
$data = json_decode($rfq_data['json'], true);
|
||||||
// dd($data);
|
// dd($data);
|
||||||
|
|
||||||
|
$sheetName = 'Worksheet';
|
||||||
if ($type == 2) {
|
if ($type == 2) {
|
||||||
|
$sheetName = 'QCR';
|
||||||
$data = $this->convertJsonForQCR($data, $type);
|
$data = $this->convertJsonForQCR($data, $type);
|
||||||
if ($propsal_and_insurer !== null) {
|
if ($propsal_and_insurer !== null) {
|
||||||
list($proposal_key, $insurer_key) = explode('-', $propsal_and_insurer, 2);
|
list($proposal_key, $insurer_key) = explode('-', $propsal_and_insurer, 2);
|
||||||
$data = $this->transformProposelData($data, $proposal_key, $insurer_key);
|
$data = $this->transformProposelData($data, $proposal_key, $insurer_key);
|
||||||
}
|
}
|
||||||
} else if ($type == 1) {
|
} else if ($type == 1) {
|
||||||
|
$sheetName = 'RFQ';
|
||||||
$data = $this->convertJsonForQCR($data, $type);
|
$data = $this->convertJsonForQCR($data, $type);
|
||||||
// dd($data);
|
// dd($data);
|
||||||
}
|
}
|
||||||
@ -1223,6 +1260,7 @@ class LeadsController extends BaseController
|
|||||||
|
|
||||||
$spreadsheet = new Spreadsheet();
|
$spreadsheet = new Spreadsheet();
|
||||||
$sheet = $spreadsheet->getActiveSheet();
|
$sheet = $spreadsheet->getActiveSheet();
|
||||||
|
$sheet->setTitle($sheetName);
|
||||||
|
|
||||||
|
|
||||||
// Start with lead_data at the top
|
// Start with lead_data at the top
|
||||||
@ -1242,22 +1280,6 @@ class LeadsController extends BaseController
|
|||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// Set column width to fit the image properly
|
|
||||||
$sheet->getColumnDimension('C')->setWidth(20); // Adjust as needed
|
|
||||||
$sheet->getRowDimension($rowNumber)->setRowHeight(40); // Adjust as needed
|
|
||||||
|
|
||||||
$drawing = new Drawing();
|
|
||||||
$path = ROOTPATH . "public/assets/images/Nhance-Logo-Final.png"; // Use FCPATH for server path
|
|
||||||
$drawing->setPath($path);
|
|
||||||
$drawing->setCoordinates("C{$rowNumber}"); // Set position in column B
|
|
||||||
$drawing->setHeight(35); // Adjust image height
|
|
||||||
|
|
||||||
// Center align the image in the cell
|
|
||||||
$drawing->setOffsetX(30); // Adjust horizontal offset
|
|
||||||
$drawing->setOffsetY(5); // Adjust vertical offset
|
|
||||||
|
|
||||||
$drawing->setWorksheet($sheet);
|
|
||||||
|
|
||||||
// Apply center alignment to the cell
|
// Apply center alignment to the cell
|
||||||
$sheet->getStyle("C{$rowNumber}")->getAlignment()->setHorizontal(\PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER);
|
$sheet->getStyle("C{$rowNumber}")->getAlignment()->setHorizontal(\PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER);
|
||||||
$sheet->getStyle("C{$rowNumber}")->getAlignment()->setVertical(\PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER);
|
$sheet->getStyle("C{$rowNumber}")->getAlignment()->setVertical(\PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER);
|
||||||
@ -1304,11 +1326,10 @@ class LeadsController extends BaseController
|
|||||||
$rowNumber++;
|
$rowNumber++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set column width based on max content length (adjusted for padding)
|
// // Set column width based on max content length (adjusted for padding)
|
||||||
$sheet->getColumnDimension('A')->setWidth($maxWidthA * 1.2);
|
$sheet->getColumnDimension('A')->setWidth($maxWidthA * 1.2);
|
||||||
$sheet->getColumnDimension('B')->setWidth($maxWidthA * 5);
|
$sheet->getColumnDimension('B')->setWidth($maxWidthA * 5);
|
||||||
$sheet->getColumnDimension('C')->setWidth($maxWidthB * 1.2);
|
$sheet->getColumnDimension('C')->setWidth($maxWidthB * 1.6);
|
||||||
// $sheet->getColumnDimension('D')->setWidth($maxWidthB * 1.2);
|
|
||||||
|
|
||||||
// $rowNumber += 2;
|
// $rowNumber += 2;
|
||||||
|
|
||||||
@ -1350,9 +1371,13 @@ class LeadsController extends BaseController
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
$sheet->mergeCells($mergeRange);
|
$sheet->mergeCells($mergeRange);
|
||||||
|
$rowNumber_for_remove_quote_asked = $rowNumber;
|
||||||
$rowNumber = $rowNumber + 1;
|
$rowNumber = $rowNumber + 1;
|
||||||
|
if($type == 2){
|
||||||
$subHeaderRow = $rowNumber + 1;
|
$subHeaderRow = $rowNumber + 1;
|
||||||
|
}else{
|
||||||
|
$subHeaderRow = $rowNumber_for_remove_quote_asked;
|
||||||
|
}
|
||||||
$columnLetter = 'A';
|
$columnLetter = 'A';
|
||||||
|
|
||||||
foreach ($headers as $header) {
|
foreach ($headers as $header) {
|
||||||
@ -1393,9 +1418,12 @@ class LeadsController extends BaseController
|
|||||||
|
|
||||||
// Add subheaders
|
// Add subheaders
|
||||||
foreach ($header['subHeaders'] as $subHeader) {
|
foreach ($header['subHeaders'] as $subHeader) {
|
||||||
$sheet->setCellValue("{$columnLetter}{$subHeaderRow}", $subHeader);
|
|
||||||
|
|
||||||
if ($columnLetter != "A" && $columnLetter != "B" && $columnLetter != "C" && $columnLetter != "D") {
|
if($type == 2){
|
||||||
|
$sheet->setCellValue("{$columnLetter}{$subHeaderRow}", $subHeader);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($columnLetter != "A" && $columnLetter != "B" && $columnLetter != "C") {
|
||||||
$sheet->getColumnDimension($columnLetter)->setWidth(35);
|
$sheet->getColumnDimension($columnLetter)->setWidth(35);
|
||||||
} else {
|
} else {
|
||||||
$sheet->getColumnDimension('A')->setWidth(10);
|
$sheet->getColumnDimension('A')->setWidth(10);
|
||||||
@ -1514,6 +1542,51 @@ class LeadsController extends BaseController
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//set imgage and align the row and column
|
||||||
|
// Kint::dump($columnLetter);
|
||||||
|
if($type == 2){
|
||||||
|
$columnLetter_img = $this->getPreviousColumn($columnLetter, 2);
|
||||||
|
}else{
|
||||||
|
$columnLetter_img = $this->getPreviousColumn($columnLetter);
|
||||||
|
}
|
||||||
|
// dd($columnLetter_img);
|
||||||
|
|
||||||
|
$company_name = $this->getPreviousColumn($columnLetter_img);
|
||||||
|
$mergeRange1 = "A1:{$company_name}1";
|
||||||
|
$sheet->mergeCells($mergeRange1);
|
||||||
|
|
||||||
|
$rowCount = count($lead_data);
|
||||||
|
for ($i = 2; $i <= $rowCount + 1; $i++) {
|
||||||
|
$mergeRange1 = "C{$i}:{$columnLetter_img}{$i}";
|
||||||
|
$sheet->mergeCells($mergeRange1);
|
||||||
|
$sheet->getStyle($mergeRange1)->applyFromArray([
|
||||||
|
'borders' => [
|
||||||
|
'allBorders' => [
|
||||||
|
'borderStyle' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN,
|
||||||
|
'color' => ['argb' => 'FF000000'], // Black color
|
||||||
|
],
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$sheet->getColumnDimension($columnLetter_img)->setWidth(40);
|
||||||
|
$sheet->getRowDimension(1)->setRowHeight(40); // Adjust as needed
|
||||||
|
|
||||||
|
$drawing = new Drawing();
|
||||||
|
$path = ROOTPATH . "public/assets/images/Nhance-Logo-Final.png"; // Use FCPATH for server path
|
||||||
|
$drawing->setPath($path);
|
||||||
|
$drawing->setCoordinates("{$columnLetter_img}1"); // Set position in column B
|
||||||
|
$drawing->setHeight(35); // Adjust image height
|
||||||
|
|
||||||
|
// Center align the image in the cell
|
||||||
|
$drawing->setOffsetX(110); // Adjust horizontal offset
|
||||||
|
$drawing->setOffsetY(10); // Adjust vertical offset
|
||||||
|
$drawing->setWorksheet($sheet);
|
||||||
|
|
||||||
|
//end
|
||||||
|
|
||||||
|
|
||||||
// Auto-size columns
|
// Auto-size columns
|
||||||
// foreach ($sheet->getColumnIterator() as $column) {
|
// foreach ($sheet->getColumnIterator() as $column) {
|
||||||
// $sheet->getColumnDimension($column->getColumnIndex())->setAutoSize(true);
|
// $sheet->getColumnDimension($column->getColumnIndex())->setAutoSize(true);
|
||||||
@ -1551,7 +1624,7 @@ class LeadsController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
$lastRow = count($lead_data) + 1;
|
$lastRow = count($lead_data) + 1;
|
||||||
$leadRange = "A1:C{$lastRow}";
|
$leadRange = "A1:{$columnLetter_img}{$lastRow}";
|
||||||
|
|
||||||
$sheet->getStyle($leadRange)->applyFromArray([
|
$sheet->getStyle($leadRange)->applyFromArray([
|
||||||
'borders' => [
|
'borders' => [
|
||||||
@ -1571,12 +1644,12 @@ class LeadsController extends BaseController
|
|||||||
$policy_year = "$current_year-$next_year";
|
$policy_year = "$current_year-$next_year";
|
||||||
|
|
||||||
if (!empty($rfq_data['policy_end_date'])) {
|
if (!empty($rfq_data['policy_end_date'])) {
|
||||||
$policy_expiry = strtotime($lead_data['policy_end_date']);
|
|
||||||
|
|
||||||
|
$policy_expiry = strtotime($rfq_data['policy_end_date']);
|
||||||
$formatted_policy = date("d-m-Y", $policy_expiry);
|
$formatted_policy = date("d-m-Y", $policy_expiry);
|
||||||
|
|
||||||
$filename = "{$rfq_data['client_name']}_{$rfq_data['policy_type']}_{$string}_" . $policy_year . '(Due On ' . $formatted_policy . ')' . '.xlsx';
|
$filename = "{$rfq_data['client_name']}_{$rfq_data['policy_type']}_{$string}_" . $policy_year . '(Due On ' . $formatted_policy . ')' . '.xlsx';
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
$filename = "{$rfq_data['client_name']}_{$rfq_data['policy_type']}_{$string}_" . $policy_year . '_' . '.xlsx';
|
$filename = "{$rfq_data['client_name']}_{$rfq_data['policy_type']}_{$string}_" . $policy_year . '_' . '.xlsx';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2081,11 +2154,12 @@ class LeadsController extends BaseController
|
|||||||
$bcc_mails = [];
|
$bcc_mails = [];
|
||||||
|
|
||||||
//get CC Mails
|
//get CC Mails
|
||||||
if ($recipient_type == 'internal' || $recipient_type == 'placement' || $recipient_type == 'insurer' || $recipient_type == 'client') {
|
if ($recipient_type == 'internal' || $recipient_type == 'insurer' || $recipient_type == 'client') {
|
||||||
|
|
||||||
$cc_data = isset($params['cc']) ? $params['cc'] : "";
|
$cc_data = isset($params['cc']) ? $params['cc'] : "";
|
||||||
$param_cc_mail = json_decode($cc_data, true);
|
$param_cc_mail = json_decode($cc_data, true);
|
||||||
|
|
||||||
|
|
||||||
if (isset($param_cc_mail) && is_array($param_cc_mail) && count($param_cc_mail) > 0) {
|
if (isset($param_cc_mail) && is_array($param_cc_mail) && count($param_cc_mail) > 0) {
|
||||||
// Fetch user data where ID is in the param_cc_mail array
|
// Fetch user data where ID is in the param_cc_mail array
|
||||||
$userData = $this->userModel
|
$userData = $this->userModel
|
||||||
@ -2109,6 +2183,8 @@ class LeadsController extends BaseController
|
|||||||
// Handle case where param_cc_mail is not valid
|
// Handle case where param_cc_mail is not valid
|
||||||
// return $this->respond(['status' => 'failed','code' => 400,'data' => '','message' => 'CC mail not found!'], 200);
|
// return $this->respond(['status' => 'failed','code' => 400,'data' => '','message' => 'CC mail not found!'], 200);
|
||||||
}
|
}
|
||||||
|
}else if($recipient_type == 'placement'){
|
||||||
|
$cc_mails = isset($params['cc']) ? json_decode($params['cc'], true) : "";
|
||||||
}
|
}
|
||||||
|
|
||||||
//get BCC Mails
|
//get BCC Mails
|
||||||
@ -2176,6 +2252,7 @@ class LeadsController extends BaseController
|
|||||||
$result = $file_info['filePath'];
|
$result = $file_info['filePath'];
|
||||||
// return $this->respond(['status' => 'fail', 'code' => 200, 'messgae' => 'File Not Found'], 200);
|
// return $this->respond(['status' => 'fail', 'code' => 200, 'messgae' => 'File Not Found'], 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
// print_rr($result); die;
|
// print_rr($result); die;
|
||||||
// print_rr($file_info);
|
// print_rr($file_info);
|
||||||
// $file_path = WRITEPATH."uploads/excel/sample/correction.xls";
|
// $file_path = WRITEPATH."uploads/excel/sample/correction.xls";
|
||||||
@ -2194,15 +2271,11 @@ class LeadsController extends BaseController
|
|||||||
//get recipient address
|
//get recipient address
|
||||||
if ($recipient_type == 'insurer' || $recipient_type == 'placement') {
|
if ($recipient_type == 'insurer' || $recipient_type == 'placement') {
|
||||||
|
|
||||||
// print_r($recipient_mail); die;
|
|
||||||
|
|
||||||
$recipient_data = $this->levelContactModel
|
$recipient_data = $this->levelContactModel
|
||||||
->where(['contact_type' => 'insurer', 'is_active' => 1])
|
->where(['contact_type' => 'insurer', 'is_active' => 1])
|
||||||
->whereIn('id', $recipient_mail)
|
->whereIn('id', $recipient_mail)
|
||||||
->findAll();
|
->findAll();
|
||||||
|
|
||||||
// print_r($recipient_data); die;
|
|
||||||
|
|
||||||
} else if ($recipient_type == 'client') {
|
} else if ($recipient_type == 'client') {
|
||||||
|
|
||||||
$mailIDS = explode(',', $params['contact_mail']);
|
$mailIDS = explode(',', $params['contact_mail']);
|
||||||
@ -2266,14 +2339,50 @@ class LeadsController extends BaseController
|
|||||||
'status' => 'won',
|
'status' => 'won',
|
||||||
'placement_date' => change_date_format($params['placement_date'], 'd/m/Y', 'Y-m-d'),
|
'placement_date' => change_date_format($params['placement_date'], 'd/m/Y', 'Y-m-d'),
|
||||||
'payment_date' => change_date_format($params['payment_date'], 'd/m/Y', 'Y-m-d'),
|
'payment_date' => change_date_format($params['payment_date'], 'd/m/Y', 'Y-m-d'),
|
||||||
'utr_no' => $params['utr_no'],
|
'utr_no' => $params['utr_no'] ?? null,
|
||||||
'is_cd' => $params['is_cd'],
|
'is_cd' => $params['is_cd'] ?? null ,
|
||||||
'premium_amount' => $params['premium_amount'],
|
'premium_amount' => $params['premium_amount'] ?? null,
|
||||||
'total_amount' => $params['total_amount'],
|
'total_amount' => $params['total_amount'] ?? null,
|
||||||
'cd_amount' => $params['cd_amount'],
|
'cd_amount' => $params['cd_amount'] ?? null,
|
||||||
|
'no_of_installment' => $params['no_of_installment'] ?? null,
|
||||||
|
'is_installment' => $params['is_installment'] ?? null,
|
||||||
];
|
];
|
||||||
|
|
||||||
$this->leadsModel->where('id', $lead_id)->set($data)->update();
|
$this->leadsModel->where('id', $lead_id)->set($data)->update();
|
||||||
|
|
||||||
|
if(isset($params['installments']) && !empty($params['installments'])){
|
||||||
|
|
||||||
|
$installment_data = json_decode($params['installments'], true);
|
||||||
|
if(!empty($installment_data)){
|
||||||
|
foreach ($installment_data as $key => $value) {
|
||||||
|
$value['payment_date'] = date('Y/m/d', strtotime($value['payment_date'])) ?? null;
|
||||||
|
if(isset($value['id']) && !empty($value['id'])){
|
||||||
|
$this->leadInstallmentPaymentDetails->where('id', $value['id'])->set($value)->update();
|
||||||
|
}else{
|
||||||
|
$this->leadInstallmentPaymentDetails->insert($value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($recipient_type == 'client') {
|
||||||
|
|
||||||
|
$this->leadsModel
|
||||||
|
->where('id', $lead_id)
|
||||||
|
->whereNotIn('status', ['lost', 'co_insurer_pending', 'won', 'completed_with_corrections', 'completed_without_corrections'])
|
||||||
|
->set(['status' => "qcr_sent"])
|
||||||
|
->update();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($recipient_type == 'insurer') {
|
||||||
|
|
||||||
|
$this->leadsModel
|
||||||
|
->where('id', $lead_id)
|
||||||
|
->whereNotIn('status', ['qcr_created', 'qcr_sent', 'lost', 'co_insurer_pending', 'won', 'completed_with_corrections', 'completed_without_corrections'])
|
||||||
|
->set(['status' => "rfq_sent"])
|
||||||
|
->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
//delete attachment file
|
//delete attachment file
|
||||||
@ -2913,6 +3022,10 @@ class LeadsController extends BaseController
|
|||||||
$current_year = date('Y');
|
$current_year = date('Y');
|
||||||
$next_year = $current_year + 1;
|
$next_year = $current_year + 1;
|
||||||
$policy_year = "$current_year-$next_year";
|
$policy_year = "$current_year-$next_year";
|
||||||
|
$page_name = $page_name == "QCR" ? "Quote Comparison Report" : $page_name;
|
||||||
|
$log_path = base_url() . '/public/assets/images/Nhance-Logo-Final.png';
|
||||||
|
// $log_path ='https://venbait.in/nhance/dev/public/assets/images/Nhance-Logo-Final.png';
|
||||||
|
// dd($log_path);
|
||||||
|
|
||||||
$policy_expiry = strtotime($lead_data['policy_end_date']);
|
$policy_expiry = strtotime($lead_data['policy_end_date']);
|
||||||
|
|
||||||
@ -2935,6 +3048,7 @@ class LeadsController extends BaseController
|
|||||||
$message = str_replace("{{LOGGED_USER_NAME}}", ucfirst($logged_user_data['first_name']) . " " . ucfirst($logged_user_data['last_name']), $message);
|
$message = str_replace("{{LOGGED_USER_NAME}}", ucfirst($logged_user_data['first_name']) . " " . ucfirst($logged_user_data['last_name']), $message);
|
||||||
$message = str_replace("{{LOGGED_USER_EMAIL}}", $logged_user_data['email'], $message);
|
$message = str_replace("{{LOGGED_USER_EMAIL}}", $logged_user_data['email'], $message);
|
||||||
$message = str_replace("{{LOGGED_USER_MOBILE}}", $logged_user_data['mobile'], $message);
|
$message = str_replace("{{LOGGED_USER_MOBILE}}", $logged_user_data['mobile'], $message);
|
||||||
|
$message = str_replace("{{LOGO_PATH}}", $log_path, $message);
|
||||||
|
|
||||||
return $message;
|
return $message;
|
||||||
} else {
|
} else {
|
||||||
@ -3898,13 +4012,18 @@ class LeadsController extends BaseController
|
|||||||
$lead_file = $this->leadFilesModel->where('lead_id', $lead_id)->where('id', $id)->where('is_active', 1)->first();
|
$lead_file = $this->leadFilesModel->where('lead_id', $lead_id)->where('id', $id)->where('is_active', 1)->first();
|
||||||
|
|
||||||
if ($lead_file) {
|
if ($lead_file) {
|
||||||
|
|
||||||
|
$fullPath = $lead_file_path . $lead_file['file_name'];
|
||||||
|
|
||||||
|
if (file_exists($fullPath) && !empty($fileName)) {
|
||||||
$attachments[] = [
|
$attachments[] = [
|
||||||
'fileName' => $lead_file['file_name'],
|
'fileName' => $lead_file['file_name'],
|
||||||
'filePath' => $lead_file_path . $lead_file['file_name']
|
'filePath' => $fullPath
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $attachments;
|
return $attachments;
|
||||||
}
|
}
|
||||||
|
|||||||
54
app/Models/LeadInstallmentPaymentDetails.php
Normal file
54
app/Models/LeadInstallmentPaymentDetails.php
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use CodeIgniter\Model;
|
||||||
|
|
||||||
|
class LeadInstallmentPaymentDetails extends Model
|
||||||
|
{
|
||||||
|
protected $table = 'lead_installment_payment_details';
|
||||||
|
protected $primaryKey = 'id';
|
||||||
|
protected $allowedFields = [
|
||||||
|
'lead_id',
|
||||||
|
'installment_amount',
|
||||||
|
'payment_date',
|
||||||
|
'utr_no',
|
||||||
|
'created_by',
|
||||||
|
'updated_by',
|
||||||
|
'is_active'
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
// Callbacks
|
||||||
|
protected $allowCallbacks = true;
|
||||||
|
protected $beforeInsert = ["checkAndADDCreatedByValue"];
|
||||||
|
protected $afterInsert = [];
|
||||||
|
protected $beforeUpdate = ["checkAndUpdateUpdatedByValue"];
|
||||||
|
protected $afterUpdate = [];
|
||||||
|
protected $beforeFind = [];
|
||||||
|
protected $afterFind = [];
|
||||||
|
protected $beforeDelete = [];
|
||||||
|
protected $afterDelete = [];
|
||||||
|
|
||||||
|
protected function checkAndADDCreatedByValue(array $data)
|
||||||
|
{
|
||||||
|
// Check if 'updated_by' value is null or empty
|
||||||
|
if (empty($data['data']['created_by'])) {
|
||||||
|
// Set 'updated_by' value to the current session user ID
|
||||||
|
$data['data']['created_by'] = get_session_userid();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function checkAndUpdateUpdatedByValue(array $data)
|
||||||
|
{
|
||||||
|
// Check if 'updated_by' value is null or empty
|
||||||
|
if (empty($data['data']['updated_by'])) {
|
||||||
|
// Set 'updated_by' value to the current session user ID
|
||||||
|
$data['data']['updated_by'] = get_session_userid();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -92,7 +92,10 @@ class LeadsModel extends Model
|
|||||||
'source_policy_end_date',
|
'source_policy_end_date',
|
||||||
|
|
||||||
'payment_date',
|
'payment_date',
|
||||||
'is_cd'
|
'is_cd',
|
||||||
|
|
||||||
|
'is_installment',
|
||||||
|
'no_of_installment',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
<style>
|
<style>
|
||||||
|
|
||||||
body {
|
body {
|
||||||
margin-top: 20px;
|
margin-top: 20px;
|
||||||
background: #FAFAFA;
|
background: #FAFAFA;
|
||||||
}
|
}
|
||||||
|
|
||||||
.order-card {
|
.order-card {
|
||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
@ -133,7 +133,9 @@ $isActive = get_role_id() == STAFF_ROLE_ID && in_array(ENROLLMENT_TEAM_ID,user_t
|
|||||||
<div class="card bg-c-Pelorous order-card" onclick="hide_and_show_tile(1,1)">
|
<div class="card bg-c-Pelorous order-card" onclick="hide_and_show_tile(1,1)">
|
||||||
<div class="card-block">
|
<div class="card-block">
|
||||||
<h6 class="m-b-20 font-15">Leads</h6>
|
<h6 class="m-b-20 font-15">Leads</h6>
|
||||||
<h2 class="text-right"><i class="mdi mdi-playlist-check f-left"></i><span><?= isset($lead_data)? $lead_data['total'] : 0 ?></span></h2>
|
<h2 class="text-right"><i
|
||||||
|
class="mdi mdi-playlist-check f-left"></i><span><?= isset($lead_data) ? $lead_data['total'] : 0 ?></span>
|
||||||
|
</h2>
|
||||||
<p class="m-b-1"> <span class="f-right"></span></p>
|
<p class="m-b-1"> <span class="f-right"></span></p>
|
||||||
<p class="m-b-1"> <span class="f-right"></span></p>
|
<p class="m-b-1"> <span class="f-right"></span></p>
|
||||||
</div>
|
</div>
|
||||||
@ -143,7 +145,9 @@ $isActive = get_role_id() == STAFF_ROLE_ID && in_array(ENROLLMENT_TEAM_ID,user_t
|
|||||||
<div class="card bg-c-Pelorous order-card" onclick="hide_and_show_tile(1,2)">
|
<div class="card bg-c-Pelorous order-card" onclick="hide_and_show_tile(1,2)">
|
||||||
<div class="card-block">
|
<div class="card-block">
|
||||||
<h6 class="m-b-20 font-15">BDS Renewals</h6>
|
<h6 class="m-b-20 font-15">BDS Renewals</h6>
|
||||||
<h2 class="text-right"><i class="mdi mdi-playlist-check f-left"></i><span><?= isset($bds_renewal) ? $bds_renewal['total'] : 0?></span></h2>
|
<h2 class="text-right"><i
|
||||||
|
class="mdi mdi-playlist-check f-left"></i><span><?= isset($bds_renewal) ? $bds_renewal['total'] : 0 ?></span>
|
||||||
|
</h2>
|
||||||
<p class="m-b-1"> <span class="f-right"></span></p>
|
<p class="m-b-1"> <span class="f-right"></span></p>
|
||||||
<p class="m-b-1"> <span class="f-right"></span></p>
|
<p class="m-b-1"> <span class="f-right"></span></p>
|
||||||
</div>
|
</div>
|
||||||
@ -167,7 +171,9 @@ $isActive = get_role_id() == STAFF_ROLE_ID && in_array(ENROLLMENT_TEAM_ID,user_t
|
|||||||
$index = 0;
|
$index = 0;
|
||||||
foreach ($lead_data as $key => $value) : ?>
|
foreach ($lead_data as $key => $value) : ?>
|
||||||
<?php
|
<?php
|
||||||
if ($key == "total"|| $key == "won" || substr($key, -4) === "_ids") { continue; } // Skip the total key
|
if ($key == "total" || $key == "won" || substr($key, -4) === "_ids") {
|
||||||
|
continue;
|
||||||
|
} // Skip the total key
|
||||||
?>
|
?>
|
||||||
<?php
|
<?php
|
||||||
// Initialize color set and shade indexes
|
// Initialize color set and shade indexes
|
||||||
@ -183,7 +189,8 @@ $isActive = get_role_id() == STAFF_ROLE_ID && in_array(ENROLLMENT_TEAM_ID,user_t
|
|||||||
$showTooltip = strlen($formattedStatus) > 20;
|
$showTooltip = strlen($formattedStatus) > 20;
|
||||||
?>
|
?>
|
||||||
<div class="col-md-2 col-xl-1 leadStatusTitle_1" style="display: none;">
|
<div class="col-md-2 col-xl-1 leadStatusTitle_1" style="display: none;">
|
||||||
<div class="card order-card" style="background: <?= $bgColor ?>;" onclick="linkRedirectForLeads('<?= esc(strtolower(str_replace(' ', '_', $key)), 'js') ?>','<?= $lead_data[$key . '_ids'] ?? '' ?>')">
|
<div class="card order-card" style="background: <?= $bgColor ?>;"
|
||||||
|
onclick="linkRedirectForLeads('<?= esc(strtolower(str_replace(' ', '_', $key)), 'js') ?>','<?= $lead_data[$key . '_ids'] ?? '' ?>')">
|
||||||
<h2 class="text-center"><span><?= $value ?></span></h2>
|
<h2 class="text-center"><span><?= $value ?></span></h2>
|
||||||
<h6 class="m-b-20 font-15 text-center"
|
<h6 class="m-b-20 font-15 text-center"
|
||||||
<?= $showTooltip ? 'data-toggle="tooltip" title="' . htmlspecialchars($formattedStatus, ENT_QUOTES, 'UTF-8') . '"' : '' ?>>
|
<?= $showTooltip ? 'data-toggle="tooltip" title="' . htmlspecialchars($formattedStatus, ENT_QUOTES, 'UTF-8') . '"' : '' ?>>
|
||||||
@ -203,7 +210,9 @@ $isActive = get_role_id() == STAFF_ROLE_ID && in_array(ENROLLMENT_TEAM_ID,user_t
|
|||||||
|
|
||||||
foreach ($bds_renewal as $key => $value) : ?>
|
foreach ($bds_renewal as $key => $value) : ?>
|
||||||
<?php
|
<?php
|
||||||
if ($key == "total" || substr($key, -4) === "_ids"){ continue; } // Skip the total key
|
if ($key == "total" || substr($key, -4) === "_ids") {
|
||||||
|
continue;
|
||||||
|
} // Skip the total key
|
||||||
?>
|
?>
|
||||||
<?php
|
<?php
|
||||||
// Initialize color set and shade indexes
|
// Initialize color set and shade indexes
|
||||||
@ -219,7 +228,15 @@ $isActive = get_role_id() == STAFF_ROLE_ID && in_array(ENROLLMENT_TEAM_ID,user_t
|
|||||||
$showTooltip = strlen($formattedStatus) > 20;
|
$showTooltip = strlen($formattedStatus) > 20;
|
||||||
?>
|
?>
|
||||||
<div class="col-md-2 col-xl-1 leadStatusTitle_2" style="display: none;">
|
<div class="col-md-2 col-xl-1 leadStatusTitle_2" style="display: none;">
|
||||||
<div class="card order-card" style="background: <?= $bgColor ?>;" onclick="linkRedirectForPolicy('<?= isset($bds_renewal[$key . '_ids']) ? str_replace(' ', '_', $bds_renewal[$key . '_ids']) : '' ?>')">
|
<?php
|
||||||
|
$policyIds = isset($bds_renewal[$key . '_ids'])
|
||||||
|
? (is_array($bds_renewal[$key . '_ids'])
|
||||||
|
? implode('_', $bds_renewal[$key . '_ids'])
|
||||||
|
: str_replace(' ', '_', $bds_renewal[$key . '_ids']))
|
||||||
|
: '';
|
||||||
|
?>
|
||||||
|
<div class="card order-card" style="background: <?= $bgColor ?>;"
|
||||||
|
onclick="linkRedirectForPolicy('<?= $policyIds ?>')">
|
||||||
<h2 class="text-center"><span><?= $value ?></span></h2>
|
<h2 class="text-center"><span><?= $value ?></span></h2>
|
||||||
<h6 class="m-b-20 font-15 text-center"
|
<h6 class="m-b-20 font-15 text-center"
|
||||||
<?= $showTooltip ? 'data-toggle="tooltip" title="' . htmlspecialchars($formattedStatus, ENT_QUOTES, 'UTF-8') . '"' : '' ?>>
|
<?= $showTooltip ? 'data-toggle="tooltip" title="' . htmlspecialchars($formattedStatus, ENT_QUOTES, 'UTF-8') . '"' : '' ?>>
|
||||||
@ -232,11 +249,11 @@ $isActive = get_role_id() == STAFF_ROLE_ID && in_array(ENROLLMENT_TEAM_ID,user_t
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$('[data-toggle="tooltip"]').tooltip();
|
$('[data-toggle="tooltip"]').tooltip();
|
||||||
$(".status_tile").hide();
|
$(".status_tile").hide();
|
||||||
});
|
});
|
||||||
|
|
||||||
function hide_and_show_tile(type, leadType = null) {
|
function hide_and_show_tile(type, leadType = null) {
|
||||||
|
|
||||||
if (type == 1) {
|
if (type == 1) {
|
||||||
@ -308,5 +325,4 @@ $isActive = get_role_id() == STAFF_ROLE_ID && in_array(ENROLLMENT_TEAM_ID,user_t
|
|||||||
document.body.appendChild(form);
|
document.body.appendChild(form);
|
||||||
form.submit();
|
form.submit();
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
35
app/Views/rfq/installment_fields.php
Normal file
35
app/Views/rfq/installment_fields.php
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
// Example: Loop through $installments array if available
|
||||||
|
if (!empty($installments)) {
|
||||||
|
foreach ($installments as $index => $installment) {
|
||||||
|
?>
|
||||||
|
<div class="form-row align-items-end">
|
||||||
|
|
||||||
|
<input type="hidden" name="installment_primary_key[]" value="<?= isset($installment['id']) ? $installment['id'] : '' ?>">
|
||||||
|
|
||||||
|
<div class="form-group col-md-3">
|
||||||
|
<label for="installment_amount">Installment Amount</label>
|
||||||
|
<input type="text" class="form-control" name="installment_amount[]" placeholder="Enter Amount"
|
||||||
|
value="<?= isset($installment['installment_amount']) ? $installment['installment_amount'] : '' ?>">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-md-3">
|
||||||
|
<label for="payment_date">Payment Date</label>
|
||||||
|
<input type="text" class="form-control payment_date" name="payment_date[]" placeholder="DD/MM/YYYY"
|
||||||
|
value="<?= isset($installment['payment_date']) && $installment['payment_date'] != '0000-00-00' ? date('d/m/Y', strtotime($installment['payment_date'])) : '' ?>">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-md-3">
|
||||||
|
<label for="utr_no">UTR No.</label>
|
||||||
|
<input type="text" class="form-control" name="utr_no[]" placeholder="Enter UTR No."
|
||||||
|
value="<?= isset($installment['utr_no']) ? $installment['utr_no'] : '' ?>">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-md-2">
|
||||||
|
<button type="button" class="btn btn-danger remove-installment">X</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -491,25 +491,14 @@
|
|||||||
|
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
|
|
||||||
<div class="form-group col-md-3">
|
|
||||||
<label for="payment_date">Payment Date</label>
|
|
||||||
<input type="text" class="form-control" id="payment_date" name="payment_date" placeholder="DD/MM/YYY" value="<?= isset($lead_data['payment_date']) ? date('d/m/Y', strtotime($lead_data['payment_date'])) : "" ?>">
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group col-md-3">
|
|
||||||
<label for="utr_no">UTR No.</label>
|
|
||||||
<input type="text" class="form-control" id="utr_no" name="utr_no" placeholder="Enter UTR No." value="<?= isset($lead_data['utr_no']) ? $lead_data['utr_no'] : "" ?>">
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group col-md-3">
|
<div class="form-group col-md-3">
|
||||||
<label for="placement_date">Placement Date</label>
|
<label for="placement_date">Placement Date</label>
|
||||||
<input type="text" class="form-control" id="placement_date" name="placement_date" placeholder="DD/MM/YYY" value="<?= isset($lead_data['placement_date']) ? date('d/m/Y', strtotime($lead_data['placement_date'])) : "" ?>">
|
<input type="text" class="form-control" id="placement_date" name="placement_date" placeholder="DD/MM/YYY" value="<?= isset($lead_data['placement_date']) ? date('d/m/Y', strtotime($lead_data['placement_date'])) : "" ?>">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-md-3">
|
<div class="form-group col-md-3">
|
||||||
<label style = "padding-left: 15px;padding-top: 33px;" for="is_cd_switch">CD </label>
|
<label for="is_cd_switch">CD Entry</label>
|
||||||
<input id="is_cd_switch" type="checkbox" name = "is_cd" value = "1" data-toggle="toggle" data-on="With CD" data-off="Without CD" data-onstyle="info" data-offstyle="dark" data-style="border" data-width="150" <?= isset($lead_data['is_cd']) && $lead_data['is_cd'] != 1 ? '' : 'checked' ?>
|
<input id="is_cd_switch" type="checkbox" name = "is_cd" value = "1" data-toggle="toggle" data-on="With CD" data-off="Without CD" data-onstyle="info" data-offstyle="dark" data-style="border" data-width="218" <?= isset($lead_data['is_cd']) && $lead_data['is_cd'] != 1 ? '' : 'checked' ?>>
|
||||||
>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-md-3">
|
<div class="form-group col-md-3">
|
||||||
@ -531,8 +520,42 @@
|
|||||||
|
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
|
<div class="form-group col-md-3">
|
||||||
|
<label for="is_installment_switch">Installemnt </label>
|
||||||
|
<input id="is_installment_switch" type="checkbox" name = "is_installment" value = "1" data-toggle="toggle" data-on="With Installments" data-off="Without Installments" data-onstyle="info" data-offstyle="dark" data-style="border" data-width="218" <?= isset($lead_data['is_installment']) && $lead_data['is_installment'] == 1 ? 'checked' : '' ?>>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php if (isset($lead_data['is_installment']) && $lead_data['is_installment'] == 1) { ?>
|
||||||
|
|
||||||
|
<div class="form-group col-md-3">
|
||||||
|
<label for="no_of_installment">No of installments</label>
|
||||||
|
<input type="text" class="form-control" id="no_of_installment" name="no_of_installment" placeholder="" value="<?= isset($lead_data['no_of_installment']) ? $lead_data['no_of_installment'] : "1" ?>">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
<?php if (isset($lead_data['is_installment']) && $lead_data['is_installment'] == 0 || !isset($lead_data['is_installment'])) { ?>
|
||||||
|
|
||||||
|
<div class="form-group col-md-3">
|
||||||
|
<label for="payment_date">Payment Date</label>
|
||||||
|
<input type="text" class="form-control" id="payment_date" name="payment_date" placeholder="DD/MM/YYY" value="<?= isset($lead_data['payment_date']) ? date('d/m/Y', strtotime($lead_data['payment_date'])) : "" ?>">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-md-3">
|
||||||
|
<label for="utr_no">UTR No.</label>
|
||||||
|
<input type="text" class="form-control" id="utr_no" name="utr_no" placeholder="Enter UTR No." value="<?= isset($lead_data['utr_no']) ? $lead_data['utr_no'] : "" ?>">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
<div id="installment_form_row">
|
||||||
|
<?= isset($lead_data['installment_data']) && !empty($lead_data['installment_data']) ? $lead_data['installment_data'] : '' ?>
|
||||||
</div>
|
</div>
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
|
|
||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-6">
|
||||||
@ -557,7 +580,7 @@
|
|||||||
>
|
>
|
||||||
<?php foreach ($exclusiveUserList as $user) { ?>
|
<?php foreach ($exclusiveUserList as $user) { ?>
|
||||||
<?php if ($page_name == "RFQ" || in_array($user['role'],[1,5]) || in_array($user['team_id'],[6,7])) { ?>
|
<?php if ($page_name == "RFQ" || in_array($user['role'],[1,5]) || in_array($user['team_id'],[6,7])) { ?>
|
||||||
<option value="<?= $user['id'];?>">
|
<option value="<?= $user['email'];?>">
|
||||||
<?= $user['first_name'].' - '.$user['email'];?>
|
<?= $user['first_name'].' - '.$user['email'];?>
|
||||||
</option>
|
</option>
|
||||||
<?php } }?>
|
<?php } }?>
|
||||||
@ -694,6 +717,7 @@
|
|||||||
policy_terms = JSON.parse(policy_terms_json);
|
policy_terms = JSON.parse(policy_terms_json);
|
||||||
|
|
||||||
jsonDataForHide = data?.premium_data ?? null;
|
jsonDataForHide = data?.premium_data ?? null;
|
||||||
|
console.log("data", data);
|
||||||
if(data){
|
if(data){
|
||||||
proposalDataForDropDown = data.proposal_data;
|
proposalDataForDropDown = data.proposal_data;
|
||||||
if(!data.premium_data){
|
if(!data.premium_data){
|
||||||
@ -837,7 +861,7 @@
|
|||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
setInterval(function () {
|
setInterval(function () {
|
||||||
submitData(1);
|
submitData(1);
|
||||||
}, 15000);
|
}, 20000);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@ -3194,7 +3218,7 @@ function insurerAndClientMailPopUp(){
|
|||||||
|
|
||||||
function placementMailPopUp() {
|
function placementMailPopUp() {
|
||||||
|
|
||||||
console.log(proposalDataForDropDown);
|
console.log("proposalDataForDropDown", proposalDataForDropDown);
|
||||||
|
|
||||||
const selectElement = document.getElementById('proposals');
|
const selectElement = document.getElementById('proposals');
|
||||||
|
|
||||||
@ -3451,137 +3475,6 @@ function constructURL(url_type) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// function constructURL_ForInsurerAndClientMailSend() {
|
|
||||||
|
|
||||||
// var lead_id = $('#lead_id').val();
|
|
||||||
// var mail_content = $('#insurer_and_client_mail_content').val();
|
|
||||||
// var subject = $('#mail_subject').val();
|
|
||||||
// var apiURL;
|
|
||||||
|
|
||||||
// if (RFQ_or_QCR == 2) {
|
|
||||||
// apiURL = '<?= base_url('leads/sendMail') ?>?lead_id=' + encodeURIComponent(lead_id) +
|
|
||||||
// '&file_type=qcr' +
|
|
||||||
// '&recipient_type=client' +
|
|
||||||
// '&recipient_mail='+
|
|
||||||
// '&mail_content=' + String(mail_content) +
|
|
||||||
// '&subject=' + String(subject);
|
|
||||||
|
|
||||||
// } else {
|
|
||||||
// var insurerContact = $('#insurerContact').val();
|
|
||||||
// insurerContact = insurerContact.map(Number);
|
|
||||||
// console.log(insurerContact);
|
|
||||||
|
|
||||||
// apiURL = '<?= base_url('leads/sendMail') ?>?lead_id=' + encodeURIComponent(lead_id) +
|
|
||||||
// '&file_type=rfq' +
|
|
||||||
// '&recipient_type=insurer' +
|
|
||||||
// '&recipient_mail=' + JSON.stringify(insurerContact)+
|
|
||||||
// '&mail_content=' + String(mail_content) +
|
|
||||||
// '&subject=' + String(subject);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// console.log(apiURL);
|
|
||||||
// ajaxRequest(apiURL);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// function constructURL_ForInternalMailSend() {
|
|
||||||
|
|
||||||
// var lead_id = $('#lead_id').val();
|
|
||||||
// let to = $('#to').val();
|
|
||||||
// let mail_content = $('#internal_mail_content').val();
|
|
||||||
// let subject = $('#subject').val();
|
|
||||||
|
|
||||||
|
|
||||||
// let cc = $('#cc').val();
|
|
||||||
// cc = cc.map(Number);
|
|
||||||
// cc = JSON.stringify(cc)
|
|
||||||
|
|
||||||
// var file_type = 'rfq';
|
|
||||||
// if (RFQ_or_QCR == 2) {
|
|
||||||
// file_type = 'qcr'
|
|
||||||
// }
|
|
||||||
|
|
||||||
// var queryParams = {
|
|
||||||
// lead_id: lead_id,
|
|
||||||
// file_type: file_type,
|
|
||||||
// recipient_type: 'internal',
|
|
||||||
// to: to,
|
|
||||||
// cc: cc,
|
|
||||||
// subject: subject,
|
|
||||||
// // mail_content: mail_content,
|
|
||||||
// recipient_mail: '',
|
|
||||||
// mail_content: mail_content,
|
|
||||||
// subject: subject,
|
|
||||||
// };
|
|
||||||
|
|
||||||
// const queryString = objectToQueryString(queryParams);
|
|
||||||
// console.log(queryString);
|
|
||||||
|
|
||||||
// var apiURL = '<?= base_url('leads/sendMail') ?>?'+queryString
|
|
||||||
|
|
||||||
// console.log(apiURL);
|
|
||||||
// ajaxRequest(apiURL);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// function constructURL_ForPlacementMailSend() {
|
|
||||||
|
|
||||||
// var lead_id = $('#lead_id').val();
|
|
||||||
// let to = $('#placement_to').val();
|
|
||||||
// console.log('to mail', to);
|
|
||||||
|
|
||||||
// let placement_date = $('#placement_date').val();
|
|
||||||
// let utr_no = $('#utr_no').val();
|
|
||||||
// let premium_amount = $('#premium_amount').val();
|
|
||||||
// let total_amount = $('#total_amount').val();
|
|
||||||
// let cd_amount = $('#cd_amount').val();
|
|
||||||
|
|
||||||
// let subject = $('#placement_subject').val();
|
|
||||||
// // let = mail_content = $('#placement_mail_content').val();
|
|
||||||
// let proposal_insurer = $('#proposals option:selected').data('id');
|
|
||||||
// let insurer_and_branch = $('#proposals').val();
|
|
||||||
|
|
||||||
// let cc = $('#placement_cc').val();
|
|
||||||
// cc = cc.map(Number);
|
|
||||||
// // cc = cc.split(',').map(email => email.trim());
|
|
||||||
// cc = JSON.stringify(cc);
|
|
||||||
|
|
||||||
// // to = to.map(String);
|
|
||||||
// // to = JSON.stringify(to)
|
|
||||||
// to = to.split(',').map(email => email.trim());
|
|
||||||
// to = JSON.stringify(to)
|
|
||||||
// console.log('to (array):', to);
|
|
||||||
|
|
||||||
// var file_type = 'rfq';
|
|
||||||
// if (RFQ_or_QCR == 2) {
|
|
||||||
// file_type = 'qcr'
|
|
||||||
// }
|
|
||||||
|
|
||||||
// var queryParams = {
|
|
||||||
// lead_id: lead_id,
|
|
||||||
// file_type: file_type,
|
|
||||||
// recipient_type: 'placement',
|
|
||||||
// to: to,
|
|
||||||
// cc: cc,
|
|
||||||
// subject: subject,
|
|
||||||
// proposal_insurer: proposal_insurer,
|
|
||||||
// insurer_and_branch: insurer_and_branch,
|
|
||||||
// recipient_mail: to,
|
|
||||||
|
|
||||||
// placement_date: placement_date,
|
|
||||||
// utr_no: utr_no,
|
|
||||||
// premium_amount: premium_amount,
|
|
||||||
// total_amount: total_amount,
|
|
||||||
// cd_amount: cd_amount,
|
|
||||||
// };
|
|
||||||
|
|
||||||
// const queryString = objectToQueryString(queryParams);
|
|
||||||
// console.log(queryString);
|
|
||||||
|
|
||||||
// var apiURL = '<?= base_url('leads/sendMail') ?>?'+queryString
|
|
||||||
|
|
||||||
// console.log(apiURL);
|
|
||||||
// ajaxRequest(apiURL);
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
// Insurer and Client Mail
|
// Insurer and Client Mail
|
||||||
function constructURL_ForInsurerAndClientMailSend() {
|
function constructURL_ForInsurerAndClientMailSend() {
|
||||||
@ -3694,16 +3587,44 @@ function constructURL_ForPlacementMailSend() {
|
|||||||
let proposal_insurer = $('#proposals option:selected').data('id');
|
let proposal_insurer = $('#proposals option:selected').data('id');
|
||||||
let insurer_and_branch = $('#proposals').val();
|
let insurer_and_branch = $('#proposals').val();
|
||||||
let cc = $('#placement_cc').val();
|
let cc = $('#placement_cc').val();
|
||||||
|
let no_of_installment = $('#no_of_installment').val();
|
||||||
|
let is_installment = $("#is_installment_switch").is(":checked") ? 1 : 0;
|
||||||
|
console.log("cc1", cc);
|
||||||
|
|
||||||
// Process `to` field
|
// Process `to` field
|
||||||
to = to.split(',').map(email => email.trim());
|
to = to.split(',').map(email => email.trim());
|
||||||
cc = cc.map(Number); // or split if it's a string: `cc.split(',').map(email => email.trim())`
|
// cc = cc.map(Number); // or split if it's a string: `cc.split(',').map(email => email.trim())`
|
||||||
|
|
||||||
|
|
||||||
var selectedFiles = [];
|
var selectedFiles = [];
|
||||||
$('#placement_mail_attachment .multi_file_attachment:checked').each(function () {
|
$('#placement_mail_attachment .multi_file_attachment:checked').each(function () {
|
||||||
selectedFiles.push($(this).val());
|
selectedFiles.push($(this).val());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
let data = [];
|
||||||
|
|
||||||
|
$('#installment_form_row .form-row').each(function () {
|
||||||
|
let installment_amount = $(this).find('input[name="installment_amount[]"]').val();
|
||||||
|
let payment_date = $(this).find('input[name="payment_date[]"]').val();
|
||||||
|
let utr_no = $(this).find('input[name="utr_no[]"]').val();
|
||||||
|
let id = $(this).find('input[name="installment_primary_key[]"]').val();
|
||||||
|
console.log('installment_primary_key', id);
|
||||||
|
|
||||||
|
let obj = {
|
||||||
|
lead_id: lead_id,
|
||||||
|
installment_amount: installment_amount,
|
||||||
|
payment_date: payment_date,
|
||||||
|
utr_no: utr_no
|
||||||
|
};
|
||||||
|
|
||||||
|
if (id != undefined && id != null && id != '') {
|
||||||
|
obj.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
data.push(obj);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
// Prepare FormData
|
// Prepare FormData
|
||||||
var formData = new FormData();
|
var formData = new FormData();
|
||||||
formData.append('lead_id', lead_id);
|
formData.append('lead_id', lead_id);
|
||||||
@ -3723,14 +3644,15 @@ function constructURL_ForPlacementMailSend() {
|
|||||||
formData.append('cd_amount', cd_amount);
|
formData.append('cd_amount', cd_amount);
|
||||||
formData.append('mail_content', mail_content);
|
formData.append('mail_content', mail_content);
|
||||||
formData.append('selected_attachment_files', JSON.stringify(selectedFiles));
|
formData.append('selected_attachment_files', JSON.stringify(selectedFiles));
|
||||||
|
formData.append('installments', JSON.stringify(data));
|
||||||
|
formData.append('no_of_installment', no_of_installment);
|
||||||
|
formData.append('is_installment', is_installment);
|
||||||
|
|
||||||
|
|
||||||
ajaxRequest(formData);
|
ajaxRequest(formData);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function ajaxRequest(formData) {
|
function ajaxRequest(formData) {
|
||||||
|
|
||||||
var apiURL = '<?= base_url('leads/sendMail') ?>';
|
var apiURL = '<?= base_url('leads/sendMail') ?>';
|
||||||
@ -3831,23 +3753,40 @@ function getInsurerBranchContacts(input){
|
|||||||
|
|
||||||
function appendInsurerContact(data) {
|
function appendInsurerContact(data) {
|
||||||
|
|
||||||
console.log(data)
|
console.log(data);
|
||||||
|
|
||||||
$('#placement_to').empty();
|
// Clear existing options and CC entries
|
||||||
$('#placement_to').append($('<option>', {
|
$('#placement_to').empty().append($('<option>', {
|
||||||
value: '',
|
value: '',
|
||||||
text: 'Select'
|
text: 'Select'
|
||||||
}));
|
}));
|
||||||
|
$('.ccInsurerMail').remove();
|
||||||
|
|
||||||
$.each(data, function(index, item) {
|
$.each(data, function(index, item) {
|
||||||
var option = $('<option>', {
|
$('#placement_to').append($('<option>', {
|
||||||
value: item.id,
|
value: item.id,
|
||||||
text: item.contact_person_email
|
text: item.contact_person_email
|
||||||
|
}));
|
||||||
|
|
||||||
|
$('#placement_cc').append($('<option>', {
|
||||||
|
value: item.contact_person_email ?? "",
|
||||||
|
text: (item.contact_person_name || '') + (item.contact_person_email ? ' - ' + item.contact_person_email : '') + ' (Insurer)',
|
||||||
|
class: 'ccInsurerMail'
|
||||||
|
}));
|
||||||
});
|
});
|
||||||
$('#placement_to').append(option);
|
|
||||||
|
// Re-initialize Select2
|
||||||
|
$('#placement_cc').val(null).select2({
|
||||||
|
placeholder: 'Select CC Mail'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Style Select2 textarea input
|
||||||
|
setTimeout(function () {
|
||||||
|
$('textarea.select2-search__field').attr('rows', '1').css('resize', 'none');
|
||||||
|
}, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$('.close').click(function(){
|
$('.close').click(function(){
|
||||||
|
|
||||||
$('#to').select2({
|
$('#to').select2({
|
||||||
@ -5760,7 +5699,6 @@ function appendMultiFileData(data) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function convertRFQJsonToQCRJson(json) {
|
function convertRFQJsonToQCRJson(json) {
|
||||||
|
|
||||||
if (json) {
|
if (json) {
|
||||||
@ -5889,6 +5827,28 @@ function appendMultiFileData(data) {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
$("#is_installment_switch").change(function (){
|
||||||
|
var switch_status = ($(this).is(":checked")? "on" : "off");
|
||||||
|
console.log("Switch status",switch_status);
|
||||||
|
if (switch_status == "on"){
|
||||||
|
$("#no_of_installment").show();
|
||||||
|
$("#payment_date").hide();
|
||||||
|
$("#utr_no").hide();
|
||||||
|
$("#no_of_installment").closest('.form-group').show();
|
||||||
|
$("#payment_date").closest('.form-group').hide();
|
||||||
|
$("#utr_no").closest('.form-group').hide();
|
||||||
|
addInstallmentHTML()
|
||||||
|
}else{
|
||||||
|
$("#no_of_installment").hide();
|
||||||
|
$("#payment_date").show();
|
||||||
|
$("#utr_no").show();
|
||||||
|
$("#no_of_installment").closest('.form-group').hide();
|
||||||
|
$("#payment_date").closest('.form-group').show();
|
||||||
|
$("#utr_no").closest('.form-group').show();
|
||||||
|
$('#installment_form_row').empty();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
$(document).on("input", "#cd_amount, #premium_amount", function() {
|
$(document).on("input", "#cd_amount, #premium_amount", function() {
|
||||||
|
|
||||||
// alert("Function called");
|
// alert("Function called");
|
||||||
@ -5928,6 +5888,193 @@ function appendMultiFileData(data) {
|
|||||||
return emails.every(email => getDomain(email) === firstDomain);
|
return emails.every(email => getDomain(email) === firstDomain);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function addInstallmentHTML() {
|
||||||
|
let html = `
|
||||||
|
<div class="form-row align-items-end">
|
||||||
|
<div class="form-group col-md-3">
|
||||||
|
<label for="installment_amount">Installment Amount</label>
|
||||||
|
<input type="text" class="form-control" name="installment_amount[]" placeholder="Enter Amount">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-md-3">
|
||||||
|
<label for="payment_date">Payment Date</label>
|
||||||
|
<input type="text" class="form-control payment_date" name="payment_date[]" placeholder="DD/MM/YYYY">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-md-3">
|
||||||
|
<label for="utr_no">UTR No.</label>
|
||||||
|
<input type="text" class="form-control" name="utr_no[]" placeholder="Enter UTR No.">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-md-2">
|
||||||
|
<button type="button" class="btn btn-danger remove-installment">X</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
|
||||||
|
$('#installment_form_row').append(html);
|
||||||
|
|
||||||
|
$('.payment_date').flatpickr({
|
||||||
|
dateFormat: 'd/m/Y',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
$(document).on('click', '.remove-installment', function () {
|
||||||
|
let $this = $(this); // Store reference to the clicked element
|
||||||
|
let row_count = $('#installment_form_row .form-row').length;
|
||||||
|
console.log("row_count", row_count);
|
||||||
|
|
||||||
|
let id = $this.closest('.form-row').find('input[name="installment_primary_key[]"]').val() ?? null;
|
||||||
|
console.log("id", id);
|
||||||
|
let ids = id ? [id] : [];
|
||||||
|
console.log("ids", ids);
|
||||||
|
|
||||||
|
if (id != null && row_count > 1) {
|
||||||
|
Swal.fire({
|
||||||
|
title: "Do you want to remove this?",
|
||||||
|
icon: "warning",
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonColor: "#3085d6",
|
||||||
|
cancelButtonColor: "#d33",
|
||||||
|
confirmButtonText: "Yes, Proceed!"
|
||||||
|
}).then((result) => {
|
||||||
|
if (result.isConfirmed) {
|
||||||
|
let url = '<?= base_url('util/removeInstallments') ?>';
|
||||||
|
let requestData = { id: ids };
|
||||||
|
|
||||||
|
$('.loader').fadeIn();
|
||||||
|
$('.loader-mask').fadeIn();
|
||||||
|
|
||||||
|
sendAjaxRequestForGlobal(url, 'GET', requestData, function(response) {
|
||||||
|
console.log('Data fetched successfully:', response);
|
||||||
|
|
||||||
|
if (response.status === true) {
|
||||||
|
toastr.success(response.message, 'SUCCESS');
|
||||||
|
|
||||||
|
$this.closest('.form-row').remove();
|
||||||
|
let updated_row_count = $('#installment_form_row .form-row').length;
|
||||||
|
$('#no_of_installment').val(updated_row_count);
|
||||||
|
console.log("after remove row_count", updated_row_count);
|
||||||
|
} else {
|
||||||
|
toastr.error(response.message, 'WARNING');
|
||||||
|
}
|
||||||
|
|
||||||
|
$('.loader').fadeOut();
|
||||||
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
|
||||||
|
}, function(xhr, status, error) {
|
||||||
|
$('.loader').fadeOut();
|
||||||
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
console.error('Error fetching data:', error);
|
||||||
|
console.error(xhr.responseText);
|
||||||
|
toastr.error('An error occurred while removing the installment.', 'ERROR');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
if (row_count > 1) {
|
||||||
|
$this.closest('.form-row').remove();
|
||||||
|
let updated_row_count = $('#installment_form_row .form-row').length;
|
||||||
|
$('#no_of_installment').val(updated_row_count);
|
||||||
|
console.log("after remove row_count", updated_row_count);
|
||||||
|
} else {
|
||||||
|
console.log("Only one row left. Not removing.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#no_of_installment').on('change', function () {
|
||||||
|
let no_of_installments = parseInt($(this).val());
|
||||||
|
let $installmentContainer = $('#installment_form_row');
|
||||||
|
let row_count = $installmentContainer.find('.form-row').length;
|
||||||
|
|
||||||
|
console.log("Form row count:", row_count);
|
||||||
|
|
||||||
|
if (row_count === 1) {
|
||||||
|
$installmentContainer.empty();
|
||||||
|
for (let index = 0; index < no_of_installments; index++) {
|
||||||
|
addInstallmentHTML();
|
||||||
|
}
|
||||||
|
} else if (no_of_installments === row_count) {
|
||||||
|
console.log('Same row count, no change needed.');
|
||||||
|
} else if (no_of_installments < row_count) {
|
||||||
|
|
||||||
|
// Remove extra rows from the end
|
||||||
|
let remove_count = row_count - no_of_installments;
|
||||||
|
let ids = $installmentContainer.find('.form-row')
|
||||||
|
.slice(-remove_count)
|
||||||
|
.find('input[name="installment_primary_key[]"]')
|
||||||
|
.map(function() {
|
||||||
|
return $(this).val();
|
||||||
|
}).get();
|
||||||
|
|
||||||
|
console.log('ids', ids);
|
||||||
|
|
||||||
|
if (ids != null) {
|
||||||
|
Swal.fire({
|
||||||
|
title: "Do you want to remove the last " + (remove_count ?? "") + " entries?",
|
||||||
|
icon: "warning",
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonColor: "#3085d6",
|
||||||
|
cancelButtonColor: "#d33",
|
||||||
|
confirmButtonText: "Yes, Proceed!"
|
||||||
|
}).then((result) => {
|
||||||
|
if (result.isConfirmed) {
|
||||||
|
let url = '<?= base_url('util/removeInstallments') ?>';
|
||||||
|
let requestData = { id: ids };
|
||||||
|
|
||||||
|
$('.loader').fadeIn();
|
||||||
|
$('.loader-mask').fadeIn();
|
||||||
|
|
||||||
|
sendAjaxRequestForGlobal(url, 'GET', requestData, function(response) {
|
||||||
|
console.log('Data fetched successfully:', response);
|
||||||
|
|
||||||
|
if (response.status === true) {
|
||||||
|
toastr.success(response.message, 'SUCCESS');
|
||||||
|
$installmentContainer.find('.form-row').slice(-remove_count).remove();
|
||||||
|
} else {
|
||||||
|
toastr.error(response.message, 'WARNING');
|
||||||
|
}
|
||||||
|
|
||||||
|
$('.loader').fadeOut();
|
||||||
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
|
||||||
|
}, function(xhr, status, error) {
|
||||||
|
$('.loader').fadeOut();
|
||||||
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
console.error('Error fetching data:', error);
|
||||||
|
console.error(xhr.responseText);
|
||||||
|
toastr.error('An error occurred while removing the installment.', 'ERROR');
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
$('#no_of_installment').val(row_count);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
$installmentContainer.find('.form-row').slice(-remove_count).remove();
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (no_of_installments > row_count) {
|
||||||
|
// Add extra rows from the end
|
||||||
|
let add_count = no_of_installments - row_count;
|
||||||
|
for (let index = 0; index < add_count; index++) {
|
||||||
|
addInstallmentHTML();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Add missing rows
|
||||||
|
let add_count = no_of_installments - row_count;
|
||||||
|
for (let index = 0; index < add_count; index++) {
|
||||||
|
addInstallmentHTML();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$(document).ready(function(){
|
||||||
|
setTimeout(function(){
|
||||||
|
$('.payment_date').flatpickr({
|
||||||
|
dateFormat: 'd/m/Y',
|
||||||
|
});
|
||||||
|
}, 2000)
|
||||||
|
})
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
Loading…
Reference in New Issue
Block a user