FEAT_NON_EB_LEAD_PAGES : RV

This commit is contained in:
VENKATESHWARAN 2025-03-19 09:02:51 +05:30
parent 33761b31ac
commit a8b80b31c6
26 changed files with 3814 additions and 1531 deletions

View File

@ -22,7 +22,7 @@ $routes->get("update-policy-terms-for-corrections", "ClientController::updatePol
$routes->get("update_rack_rate_json", "ClientController::updateRackRateJson");
$routes->get("updatajson", "EmpDataServiceController::updatajson");
$routes->get("view", "EmployeeController::viewECard/$1");
// $routes->get("exportQCRandRFQ", "LeadsController::exportQCRandRFQ");
$routes->get("exportQCRandRFQ/(:any)", "LeadsController::exportQCRandRFQ/$1");
$routes->get("smapletest", "ClientController::smapletest");
$routes->get("testMailAttachments", "ClientController::testMailAttachments");
$routes->get("updatePolicyTermsKey", "ClientController::updatePolicyTermsKey");
@ -346,6 +346,8 @@ $routes->group("/util", ["filter" => "authMVC"], function ($routes) {
$routes->get('getCDAmount', 'ClientController::getCDAmount');
$routes->get('getTheEmpDataForClaim/(:any)', 'ClientController::getTheEmpDataForClaim/$1');
$routes->get('getTheEmpDataForClaimSearchByMobile/(:any)', 'ClientController::getTheEmpDataForClaimSearchByMobile/$1');
$routes->get('getLeadNonEB/(:any)', 'LeadsController::getLeadNonEB/$1');
$routes->get('getPolicyTypeFields', 'LeadsController::getPolicyTypeFields');
});
$routes->group("policy_tranction", ["filter" => "authMVC"], function ($routes) {

View File

@ -3679,8 +3679,11 @@ class ClientController extends AdminController
{
// ---------for client-----------------------------------------------------------------------------
$clients = $this->clientModel->where('is_active', 1)->findAll();
$clients = $this->clientModel
->select("*, DATE_FORMAT(dob, '%d-%m-%Y') as dob")
->where('is_active', 1)
->findAll();
$clientIds = array_column($clients, 'id');
// Fetch branches in a single query
@ -3814,7 +3817,7 @@ class ClientController extends AdminController
// Add additional fields if client type is 2
if ($client_type == 2) {
$client_data = array_merge($client_data, [
'dob' => $postData['dob'],
'dob' => change_date_format($postData['dob']),
'aadhar' => $postData['aadhar'],
'phone' => $postData['phone'],
'email' => $postData['email'],

View File

@ -118,14 +118,6 @@ class LeadsController extends BaseController
public function viewLeadsList()
{
// $d = $this->constructExcelToSaveTemp(24, 1, $propsal_and_insurer = null);
// $job_details = new Jobs();
// $r = Jobs::addJob(['job_name' => 'calculateMembersDemography', 'payload' => ['lead_id' => 24]]);
// $d = $this->calculateMembersDemography(['lead_id' => 24]);
//$this->mergeQuoteExcelFileWithMembersListExcelFile(24, 1, $propsal_and_insurer = null);
// dd($d);
$data['page_name'] = 'Leads';
// Set basic data
@ -138,23 +130,6 @@ class LeadsController extends BaseController
$data['policy_type'] = $this->policyTypeModel->where('is_active', 1)->findAll();
$data['entity'] = $this->kycEntityTypeModel->where('is_active', 1)->findAll();
// Fetch insurer and TPA branch data
$data['insurer'] = $this->insurerBranchModel->getInsurerBranchesWithInsurerNames();
$data['tpa'] = $this->tpaBranchModel->getTpaBranchesWithTpaNames();
// print_r($data['tpa']);die();
// Fetch sales team members who are active in team 5
$data['salse_team'] = $this->userModel
->select('user_profiles.*')
->join('user_teams', 'user_profiles.id = user_teams.user_id')
->where('user_teams.team_id', 5)
->where('user_teams.is_active', 1)
->where('user_profiles.is_active', 1)
->findAll();
// dd($data);
$data['lastFiveYears'] = $this->getLastFiveFinancialYears();
$data['gpaClaimType'] = $this->claim_type_for_gpa;
$data['causeOfDeath'] = $this->cause_of_death;
// dd($lastFiveYears);
if ($this->request->is('get')) {
// Fetch leads data
@ -184,7 +159,7 @@ class LeadsController extends BaseController
// print_r($this->request->getPost()); die;
$id = $this->request->getPost('id');
$data = $this->prepareLeadData();
// print_r($this->request->getPost()); die;
// print_r($data); die;
if (!$id) {
@ -215,11 +190,69 @@ class LeadsController extends BaseController
$data['client_code'] = generate_client_code('IC');
}
$data = $this->prepareMultipleLeadData($data);
if(isset($data['lead_form_type'])){
$data = $this->prepareSingleLeadData($data);
}else{
$data = $this->prepareMultipleLeadData($data);
}
// print_r($data); die;
return $data;
}
private function prepareSingleLeadData($data)
{
// print_r($data); die;
$uploadFilePath = WRITEPATH . 'uploads/lead_files/';
// Get all uploaded files for 'file_name[]'
$files = $this->request->getFileMultiple('file_name');
// print_r($files); die;
// Separate the insurer and insurer branch, handle missing or invalid data
if (isset($data['insurer']) && strpos($data['insurer'], '-') !== false) {
list($insurer_branch_id, $insurer_id) = explode('-', $data['insurer']);
}else{
$insurer_branch_id = 0;
$insurer_id = 0;
}
$data['insurer_id'] = $insurer_id;
$data['insurer_branch_id'] = $insurer_branch_id;
// Separate the insurer and insurer branch, handle missing or invalid data
if (isset($data['tpa']) && strpos($data['tpa'], '-') !== false) {
list($tpa_branch_id, $tpa_id) = explode('-', $data['tpa']);
} else {
$tpa_branch_id = 0;
$tpa_id = 0;
}
$data['tpa_id'] = $tpa_id;
$data['tpa_branch_id'] = $tpa_branch_id;
if (!empty($data['policy_start_date'])) {
$data['policy_start_date'] = change_date_format($data['policy_start_date']);
} else {
$data['policy_start_date'] = null;
}
if (!empty($data['policy_end_date'])) {
$data['policy_end_date'] = change_date_format($data['policy_end_date']);
} else {
$data['policy_end_date'] = null;
}
$data['file_name'] = file_Upload($files, $uploadFilePath);
$processcedData[] = $data;
// print_r($data);die();
return $processcedData;
}
private function prepareMultipleLeadData($data)
{
// print_r($data); die;
@ -291,22 +324,8 @@ class LeadsController extends BaseController
$file_name = file_Upload($files[$index], $uploadFilePath);
$last_3_years_claims = null;
if($value != 2){
$last_3_years_claims = [];
$finyear = json_decode($data['finyear']);
$last_3_years_claims = $data['finyear'];
foreach ($finyear as $year){
$received_policy_type = ($year->finyear[0]->policy_type);
if ($value == $received_policy_type){
array_push($last_3_years_claims,$year);
}else{
continue;
}
}
$last_3_years_claims = json_encode($last_3_years_claims);
}
$processedData[] = [
'lead_type' => $data['lead_type'],
'issuer' => $data['issuer'],
@ -328,18 +347,18 @@ class LeadsController extends BaseController
'policy_type_id' => $value,
'salse_person_id' => $data['salse_person_id'] ?? 0,
'insurer_id' => $insurer_id ?? 0,
'insurer_branch_id' => $insurer_branch_id ?? 0,
'tpa_id' => $tpa_id ?? 0,
'tpa_branch_id' => $tpa_branch_id ?? 0,
'policy_start_date' => $policy_start_date,
'policy_end_date' => $policy_end_date,
'no_of_lives' => $data['no_of_lives'][$index] ?? null,
'incurred_claims' => $data['incurred_claims'][$index] ?? 0,
'location' => $data['location'][$index] ?? null,
'proposed_insurer_id' => $proposed_insurer_id ?? 0,
'proposed_insurer_branch_id' => $proposed_insurer_branch_id ?? 0,
'proposed_tpa_id' => $proposed_tpa_id ?? 0,
'insurer_id' => $insurer_id ?? 0,
'insurer_branch_id' => $insurer_branch_id ?? 0,
'tpa_id' => $tpa_id ?? 0,
'tpa_branch_id' => $tpa_branch_id ?? 0,
'policy_start_date' => $policy_start_date,
'policy_end_date' => $policy_end_date,
'no_of_lives' => $data['no_of_lives'][$index] ?? null,
'incurred_claims' => $data['incurred_claims'][$index] ?? 0,
'location' => $data['location'][$index] ?? null,
'proposed_insurer_id' => $proposed_insurer_id ?? 0,
'proposed_insurer_branch_id' => $proposed_insurer_branch_id ?? 0,
'proposed_tpa_id' => $proposed_tpa_id ?? 0,
'proposed_tpa_branch_id' => $proposed_tpa_branch_id ?? 0,
'renewal_emp_count' => $data['renewal_emp_count'][$index] ?? 0,
@ -370,6 +389,9 @@ class LeadsController extends BaseController
'status' => $data['status'] ?? null,
'notes' => $data['notes'] ?? null,
'lead_form_type' => $data['lead_form_type'] ?? 1,
'custom_fields' => $data['custom_fields'] ?? null,
];
}
// print_r($processedData);die();
@ -384,11 +406,13 @@ class LeadsController extends BaseController
$insertCount[] = $insert;
$this->insertLeadStatus($insert, $value['status'], 3);
//for this push the job to the calculateMembersDemography() function
$job_details = new Jobs();
$r = Jobs::addJob(['job_name' => 'calculateMembersDemography', 'payload' => [
'lead_id' => $insert,
]]);
if($value['lead_form_type'] == 1){
//for this push the job to the calculateMembersDemography() function
$job_details = new Jobs();
$r = Jobs::addJob(['job_name' => 'calculateMembersDemography', 'payload' => [
'lead_id' => $insert,
]]);
}
}
if (count($insertCount) > 0) {
@ -416,6 +440,12 @@ class LeadsController extends BaseController
->where('leads.is_active', 1)
->first();
$data['lead_edit_data'] = $this->leadsModel
->where('leads.id', $id)
->where('leads.is_active', 1)
->first();
if (!empty($data['policy_start_date'])) {
$data['policy_start_date'] = change_date_format($data['policy_start_date'], 'Y-m-d', 'd/m/Y');
} else {
@ -440,6 +470,19 @@ class LeadsController extends BaseController
$data['premium_date'] = null;
}
$data['lastFiveYears'] = $this->getLastFiveFinancialYears();
$data['gpaClaimType'] = $this->claim_type_for_gpa;
$data['causeOfDeath'] = $this->cause_of_death;
if (!empty($data['fin_years_claims'])) {
$decoded = json_decode($data['fin_years_claims'], true);
$data['lead_edit_data']['fin_years_claims_array'] = isset($decoded['finyear']) ? $decoded['finyear'] : [];
} else {
$data['lead_edit_data']['fin_years_claims_array'] = [];
}
$data['html'] = $this->generateViewPageHtml($data['policy_type_id'], $data) ?? "";
if ($data) {
return $this->respond(['status' => true, 'data' => $data], 200);
} else {
@ -590,15 +633,20 @@ class LeadsController extends BaseController
//export main route function
public function exportQCRandRFQ($lead_id, $type, $export_type)
public function exportQCRandRFQ($lead_id, $type, $lead_form_type)
{
$this->exportExcelForQCRandRFQ($lead_id, $type);
$this->exportExcelForQCRandRFQ($lead_id, $type, $lead_form_type);
}
//FOR EXCEL
public function exportExcelForQCRandRFQ($lead_id, $type)
{
$filepath = $this->constructExcelToSaveTemp($lead_id, $type);
public function exportExcelForQCRandRFQ($lead_id, $type, $lead_form_type = 1)
{
if($lead_form_type == 2){
$filepath = $this->constructNonEbExcelToSaveTemp($lead_id, $type);
}else{
$filepath = $this->constructExcelToSaveTemp($lead_id, $type);
}
$lead_data = $this->RFQModel->getRFQTableDataWithLeadIDAndType($lead_id, $type);
// dd($filepath);
@ -2279,69 +2327,6 @@ class LeadsController extends BaseController
//------------------------------------------------------------------------------------------------
// public function transformMailContent($lead_id, $page_name)
// {
// helper('excel_util_helper');
// // $params = $this->request->getGet();
// // print_r($params); die;
// // $lead_id = $params['lead_id'];
// // $file_type = $params['file_type']; //rfq or qcr
// // $recipient_type = $params['recipient_type']; //insurer or client or internal or placement
// // $recipient_mail = $params['recipient_mail']; // - only primary key of contacts
// // $propsal_and_insurer = isset($params['proposal_insurer']) ? $params['proposal_insurer'] : null;
// // if ($recipient_type == 'insurer' && empty($recipient_mail)) {
// // return $this->respond(['status' => 'failed', 'code' => 400, 'data' => '', 'messgae' => 'Recipient mail not found ! '], 200);
// // }
// //gather lead info
// $lead_data = $this->leadsModel
// ->select('leads.*,policy_type.long_name,policy_type.policy_type,user_profiles.email as created_person_email')
// ->join('policy_type', 'leads.policy_type_id = policy_type.id', 'left')
// ->join('user_profiles', 'leads.created_by = user_profiles.id', 'left')
// ->where('leads.id', $lead_id)
// ->first();
// // dd($lead_data);
// if($lead_data){
// $recipient_data = ['name' => "Team"];
// // $original_message = '<div style="width:100%;max-width:600px;margin:0 auto;padding:20px;border:1px solid #e0e0e0;background-color:#f9f9f9;font-family:Arial,sans-serif;color:#333;line-height:1.6"><div style=background-color:#4a90e2;color:#fff;padding:15px;text-align:center><h1 style=margin:0;font-size:24px>Request for Quotation (RFQ)</h1></div><div style=padding:20px;background-color:#fff><h2 style=color:#4a90e2;font-size:20px;margin-top:0>Dear {{RECIPIENT_NAME}},</h2><p>We are reaching out to request a quotation for the following insurance coverage. Please review the details below and provide your quote at your earliest convenience.<h2 style=color:#4a90e2;font-size:20px;margin-top:20px>RFQ Details</h2><table style=width:100%;border-collapse:collapse;margin-top:20px><tr><th style="border:1px solid #ddd;padding:10px;text-align:left;background-color:#f2f2f2">Client name<td style="border:1px solid #ddd;padding:10px;text-align:left">{{CLIENT_NAME}}<tr><th style="border:1px solid #ddd;padding:10px;text-align:left;background-color:#f2f2f2">Coverage Type<td style="border:1px solid #ddd;padding:10px;text-align:left">{{POLICY_LONG_NAME}}<tr><th style="border:1px solid #ddd;padding:10px;text-align:left;background-color:#f2f2f2">Policy Start Date<td style="border:1px solid #ddd;padding:10px;text-align:left">{{POLICY_START_DATE}}<tr><th style="border:1px solid #ddd;padding:10px;text-align:left;background-color:#f2f2f2">Policy Duration<td style="border:1px solid #ddd;padding:10px;text-align:left">{{DURATION}}</table><div style="margin-top:20px;padding:10px;background-color:#f7f7f7;border-left:4px solid #4a90e2;font-style:italic">Please note: Additional terms and details are included in the attachment for your reference.</div><p>Please feel free to reach out if you require any further information to prepare the quote. We look forward to receiving your proposal.<p>Best regards,<p><strong>Nhance India Pvt Ltd</strong><br></div><div style=margin-top:20px;font-size:12px;color:#777;text-align:center><p>© Nhance India Pvt Ltd. All rights reserved.</div></div>';
// $original_message = `Dear Sir,
// Greetings From Nhance India!
// Please find attached the RFQ for {{POLICY_TYPE}} policy pertaining to {{RECIPIENT_NAME}}
// Kindly request you to share the competitive quotes at the earliest
// In case of any query, Please feel free to contact us.
// Thank You !`;
// $message = $original_message;
// $message = str_replace("{{RECIPIENT_NAME}}", $lead_data['client_name'], $message);
// $message = str_replace("{{POLICY_LONG_NAME}}", $lead_data['long_name'] ?? $lead_data['policy_type'], $message);
// $message = str_replace("{{POLICY_TYPE}}", $lead_data['policy_type'], $message);
// $message = str_replace("{{RFQ_OR_QCR}}", $page_name, $message);
// $message = str_replace("{{CLIENT_NAME}}", $lead_data['client_name'], $message);
// $message = str_replace("{{POLICY_START_DATE}}", change_date_format($lead_data['policy_start_date'], 'Y-m-d', 'd-m-Y'), $message);
// $message = str_replace("{{DURATION}}", calculate_days_bw_dates($lead_data['policy_end_date'] ?? "", $lead_data['policy_start_date'] ?? "")->days, $message) ?? '--';
// dd($message);
// // return $this->respond(['status' => true, 'code' => 200, 'data' => $message], 200);
// return $message;
// }else{
// // return $this->respond(['status' => false, 'code' => 404, 'message' => "This lead has not data"], 200);
// return '';
// }
// }
public function transformMailContent($lead_data, $mail_content, $page_name)
{
$current_year = date('Y');
@ -2365,7 +2350,8 @@ class LeadsController extends BaseController
}
}
function getLastFiveFinancialYears() {
function getLastFiveFinancialYears()
{
$currentYear = date('Y');
$currentMonth = date('m');
@ -2385,11 +2371,610 @@ class LeadsController extends BaseController
return $financialYears;
}
public function rfqNonEB(){
// ------------RFQ NON EB-----------------------------------------------------------------------------------------
public function rfqNonEB()
{
$this->loadLayout('view_rfq_non_eb');
}
// public function getLeadNonEB($type, $id = null)
// {
// // Set basic data
// $data['issuer'] = $this->issuer;
// $data['client_type'] = $this->clientType;
// $data['lead_type'] = $this->leadType;
// $data['lead_status'] = $this->leadsStatus;
// // Fetch policy types and entity data
// $data['policy_type'] = $this->policyTypeModel->where('is_active', 1)->findAll();
// $data['entity'] = $this->kycEntityTypeModel->where('is_active', 1)->findAll();
// // Fetch insurer and TPA branch data
// $data['insurer'] = $this->insurerBranchModel->getInsurerBranchesWithInsurerNames();
// $data['tpa'] = $this->tpaBranchModel->getTpaBranchesWithTpaNames();
// // print_r($data['tpa']);die();
// // Fetch sales team members who are active in team 5
// $data['salse_team'] = $this->userModel
// ->select('user_profiles.*')
// ->join('user_teams', 'user_profiles.id = user_teams.user_id')
// ->where('user_teams.team_id', 5)
// ->where('user_teams.is_active', 1)
// ->where('user_profiles.is_active', 1)
// ->findAll();
// // dd($data);
// $data['lastFiveYears'] = $this->getLastFiveFinancialYears();
// $data['gpaClaimType'] = $this->claim_type_for_gpa;
// $data['causeOfDeath'] = $this->cause_of_death;
// $data['selected_lead_type'] = $type;
// if(!empty($id)){
// $data['lead_edit_data'] = $this->leadsModel->where('id', $id)->first();
// if (!empty($data['lead_edit_data'])) {
// $data['lead_edit_data']['policy_start_date'] = !empty($data['lead_edit_data']['policy_start_date'])
// ? change_date_format($data['lead_edit_data']['policy_start_date'], 'Y-m-d', 'd/m/Y')
// : null;
// $data['lead_edit_data']['policy_end_date'] = !empty($data['lead_edit_data']['policy_end_date'])
// ? change_date_format($data['lead_edit_data']['policy_end_date'], 'Y-m-d', 'd/m/Y')
// : null;
// $data['lead_edit_data']['incurred_claims_date'] = !empty($data['lead_edit_data']['incurred_claims_date'])
// ? change_date_format($data['lead_edit_data']['incurred_claims_date'], 'Y-m-d', 'd/m/Y')
// : null;
// $data['lead_edit_data']['premium_date'] = !empty($data['lead_edit_data']['premium_date'])
// ? change_date_format($data['lead_edit_data']['premium_date'], 'Y-m-d', 'd/m/Y')
// : null;
// } else {
// $data['lead_edit_data'] = [];
// }
// if (!empty($data['lead_edit_data']['fin_years_claims'])) {
// $decoded = json_decode($data['lead_edit_data']['fin_years_claims'], true);
// $data['lead_edit_data']['fin_years_claims_array'] = isset($decoded['finyear']) ? $decoded['finyear'] : [];
// } else {
// $data['lead_edit_data']['fin_years_claims_array'] = [];
// }
// $data['lead_edit_data']['html'] = $this->generateViewPageHtml($data['lead_edit_data']['policy_type_id'], $data) ?? "";
// }
// // dd($data);
// return $this->loadLayout('leads_form_handler', $data);
// }
public function getLeadNonEB($type, $id = null)
{
// Set basic data
$data = [
'issuer' => $this->issuer,
'client_type' => $this->clientType,
'lead_type' => $this->leadType,
'lead_status' => $this->leadsStatus,
'policy_type' => $this->policyTypeModel->where('is_active', 1)->findAll(),
'entity' => $this->kycEntityTypeModel->where('is_active', 1)->findAll(),
'insurer' => $this->insurerBranchModel->getInsurerBranchesWithInsurerNames(),
'tpa' => $this->tpaBranchModel->getTpaBranchesWithTpaNames(),
'lastFiveYears' => $this->getLastFiveFinancialYears(),
'gpaClaimType' => $this->claim_type_for_gpa,
'causeOfDeath' => $this->cause_of_death,
'selected_lead_type' => $type,
];
// Fetch sales team members who are active in team 5
$data['salse_team'] = $this->userModel
->select('user_profiles.*')
->join('user_teams', 'user_profiles.id = user_teams.user_id')
->where('user_teams.team_id', 5)
->where('user_teams.is_active', 1)
->where('user_profiles.is_active', 1)
->findAll();
if (!empty($id)) {
$data['lead_edit_data'] = $this->leadsModel->where('id', $id)->first() ?? [];
// Decode and merge custom fields if present
$custom_fields_data = !empty($data['lead_edit_data']['custom_fields'])
? json_decode($data['lead_edit_data']['custom_fields'], true)
: [];
if (!empty($custom_fields_data) && is_array($custom_fields_data)) {
$data['lead_edit_data'] = array_merge($data['lead_edit_data'], $custom_fields_data);
}
if (!empty($data['lead_edit_data'])) {
foreach (['policy_start_date', 'policy_end_date', 'incurred_claims_date', 'premium_date'] as $dateField) {
$data['lead_edit_data'][$dateField] = !empty($data['lead_edit_data'][$dateField])
? change_date_format($data['lead_edit_data'][$dateField], 'Y-m-d', 'd/m/Y')
: null;
}
$data['lead_edit_data']['fin_years_claims_array'] = !empty($data['lead_edit_data']['fin_years_claims'])
? json_decode($data['lead_edit_data']['fin_years_claims'], true)['finyear'] ?? []
: [];
$data['lead_edit_data']['html'] = $this->generateViewPageHtml(
$data['lead_edit_data']['policy_type_id'] ?? null,
$data
) ?? "";
}
}
// dd($data);
return $this->loadLayout('leads_form_handler', $data);
}
public function getPolicyTypeFields()
{
$policy_type_id = $this->request->getGET('policy_type_id');
$html = $this->generateViewPageHtml($policy_type_id) ?? "";
if(!empty($html)){
return $this->respond(['status' => true, 'code' => 200, 'message' => 'Policy Type FIELDS are found', 'data' => $html], 200);
}else{
return $this->respond(['status' => false, 'code' => 400, 'message' => 'Fields not found for this policy type'], 200);
}
}
public function generateViewPageHtml($policy_type_id, $data = [])
{
$data['insurer'] = $this->insurerBranchModel->getInsurerBranchesWithInsurerNames();
$data['tpa'] = $this->tpaBranchModel->getTpaBranchesWithTpaNames();
$viewMap = [
1 => 'rfq/gpa', 6 => 'rfq/gpa', 7 => 'rfq/gpa',
2 => 'rfq/gmc', 3 => 'rfq/gmc', 4 => 'rfq/gmc', 5 => 'rfq/gmc',
22 => 'rfq/car', 23 => 'rfq/cpm', 24 => 'rfq/cyber_crime',
25 => 'rfq/do', 27 => 'rfq/eo', 49 => 'rfq/money',
19 => 'rfq/cgl', 59 => 'rfq/sfsp', 63 => 'rfq/wc',
15 => 'rfq/blu', 16 => 'rfq/bsu',
44 => 'rfq/marine', 45 => 'rfq/marine', 46 => 'rfq/marine', 47 => 'rfq/marine',
50 => 'rfq/office'
];
return isset($viewMap[$policy_type_id]) ? view($viewMap[$policy_type_id], $data) : "";
}
// public function generateViewPageHtml($policy_type_id, $data = [])
// {
// $data['insurer'] = $this->insurerBranchModel->getInsurerBranchesWithInsurerNames();
// $data['tpa'] = $this->tpaBranchModel->getTpaBranchesWithTpaNames();
// $html = "";
// if(in_array($policy_type_id, [1,6,7])){
// $html = view('rfq/gpa', $data);
// }else if(in_array($policy_type_id, [2,3,4,5])) {
// $html = view('rfq/gmc', $data);
// }else if($policy_type_id == 22) {
// $html = view('rfq/car');
// }else if($policy_type_id == 23) {
// $html = view('rfq/cpm');
// }else if($policy_type_id == 24) {
// $html = view('rfq/cyber_crime');
// }else if($policy_type_id == 25) {
// $html = view('rfq/do');
// }else if($policy_type_id == 27) {
// $html = view('rfq/eo');
// }else if($policy_type_id == 49) {
// $html = view('rfq/money');
// }else if($policy_type_id == 19) {
// $html = view('rfq/cgl');
// }else if($policy_type_id == 59) {
// $html = view('rfq/sfsp');
// }else if($policy_type_id == 63) {
// $html = view('rfq/wc');
// }else if($policy_type_id == 15) {
// $html = view('rfq/blu');
// }else if($policy_type_id == 16) {
// $html = view('rfq/bsu');
// }else if(in_array($policy_type_id, [44,45,46,47])) {
// $html = view('rfq/marine');
// }
// return $html;
// }
// ----------------------------------------------------------------------------------------------------------
//Construct excel file and save the file to the folder and return file path
public function constructNonEbExcelToSaveTemp($lead_id, $type, $propsal_and_insurer = null)
{
$rfq_data = $this->RFQModel->getRFQTableDataWithLeadIDAndType($lead_id, $type);
$lead_data = json_decode($rfq_data['custom_fields'], true);
$lead_data = array_merge(['Insured' => $rfq_data['client_name']], $lead_data);
// dd($lead_data);
// dd($rfq_data, $lead_id, $type, $propsal_and_insurer);
// print_r($propsal_and_insurer); die;
// $data = json_decode($rfq_data['json'], true);
// $proposalData = end($data);
// array_pop($data);
// foreach ($data as $key => $value) {
// Kint::dump($value);
// }
// dd($data);
// if ($type == 2) {
// $data = $this->convertJsonForQCR($data, $type);
// if ($propsal_and_insurer !== null) {
// list($proposal_key, $insurer_key) = explode('-', $propsal_and_insurer, 2);
// $data = $this->transformProposelData($data, $proposal_key, $insurer_key);
// }
// } else if ($type == 1) {
// $data = $this->convertJsonForQCR($data, $type);
// // dd($data);
// }
// dd($data);
$spreadsheet = new Spreadsheet();
$sheet = $spreadsheet->getActiveSheet();
// Start with lead_data at the top
$rowNumber = 1;
$title = "Nhance India Insurance Broking Pvt Ltd";
$mergeRange1 = "A{$rowNumber}:B{$rowNumber}";
$sheet->mergeCells($mergeRange1);
$sheet->setCellValue("A{$rowNumber}", $title);
$sheet->getStyle("A{$rowNumber}")->applyFromArray([
'font' => [
'bold' => true,
'size' => 20
],
'alignment' => [
'horizontal' => \PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER,
'vertical' => \PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER,
],
]);
// Calculate title width
$maxWidthA = mb_strlen($title);
// 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 C
$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
$sheet->getStyle("C{$rowNumber}")->getAlignment()->setHorizontal(\PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER);
$sheet->getStyle("C{$rowNumber}")->getAlignment()->setVertical(\PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER);
$rowNumber++;
// Initialize max width tracking variables
$maxWidthB = 0;
foreach ($lead_data as $key => $value) {
$formattedKey = ucwords(str_replace('_', ' ', $key));
// Merge A:B for key
$mergeRangeKey = "A{$rowNumber}:B{$rowNumber}";
$sheet->mergeCells($mergeRangeKey);
// Set values in merged cells
$sheet->setCellValue("A{$rowNumber}", $formattedKey);
$sheet->setCellValue("C{$rowNumber}", $value);
// Apply styles for alignment and bold text in A:B
$sheet->getStyle($mergeRangeKey)->applyFromArray([
'font' => ['bold' => true],
'alignment' => [
'horizontal' => \PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER,
'vertical' => \PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER,
],
]);
// Apply bold style to C column if the key is "Insured"
if ($key === "Insured") {
$sheet->getStyle("C{$rowNumber}")->applyFromArray([
'font' => ['bold' => true],
]);
}
// Track max width needed for columns
$maxWidthA = max($maxWidthA, mb_strlen($formattedKey)); // Consider title and keys
$maxWidthB = max($maxWidthB, mb_strlen((string) $value));
$rowNumber++;
}
// Set column width based on max content length (adjusted for padding)
$sheet->getColumnDimension('A')->setWidth($maxWidthA * 1.2);
$sheet->getColumnDimension('B')->setWidth($maxWidthA * 1.2);
$sheet->getColumnDimension('C')->setWidth($maxWidthB * 1.2);
$sheet->getColumnDimension('D')->setWidth($maxWidthB * 1.2);
// // $rowNumber += 2;
// // Add headers and subheaders
// $headers = $data['table_data']['headers'];
// $sheet->setCellValue("A{$rowNumber}", "Details of Coverage");
// $sheet->getStyle("A{$rowNumber}")->applyFromArray([
// 'font' => [
// 'bold' => true,
// ],
// 'fill' => [
// 'fillType' => Fill::FILL_SOLID,
// 'startColor' => ['rgb' => 'ADD8E6'],
// ],
// 'borders' => [
// 'allBorders' => [
// 'borderStyle' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN,
// 'color' => ['argb' => 'FF000000'], // Black color
// ],
// ],
// ]);
// $subheader_count = array_sum(array_map(fn($header) => count($header['subHeaders']), $data['table_data']['headers']));
// $subheader_count = $subheader_count - 2;
// $headerCount = count($data['table_data']['headers']);
// $lastColumn = Coordinate::stringFromColumnIndex($subheader_count);
// // dd( $headerCount, $lastColumn);
// // Merge cells from A to the last column
// $mergeRange = "A{$rowNumber}:{$lastColumn}{$rowNumber}";
// $sheet->getStyle($mergeRange)->applyFromArray([
// 'borders' => [
// 'allBorders' => [
// 'borderStyle' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN,
// 'color' => ['argb' => 'FF000000'], // Black color
// ],
// ],
// ]);
// $sheet->mergeCells($mergeRange);
// $rowNumber = $rowNumber + 1;
// $subHeaderRow = $rowNumber + 1;
// $columnLetter = 'A';
// foreach ($headers as $header) {
// if (in_array($header['parentHeader'], ['Item Key', 'Action'])) {
// continue;
// }
// if ($header['parentHeader'] === 'Sno') {
// $header['parentHeader'] = 'S.No.';
// $sheet->getColumnDimension('A')->setWidth(10);
// }
// if ($header['parentHeader'] === 'Particulars') {
// $sheet->getColumnDimension('B')->setWidth(40);
// }
// $startColumn = $columnLetter; // Start of the current header range
// $subHeaderCount = count($header['subHeaders']); // Number of subheaders for this parent header
// // Set parent header value
// $sheet->setCellValue("{$startColumn}{$rowNumber}", $header['parentHeader']);
// $sheet->getStyle("{$startColumn}{$rowNumber}")->applyFromArray([
// 'font' => ['bold' => true],
// 'alignment' => [
// 'horizontal' => \PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER,
// 'vertical' => \PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER,
// ],
// ]);
// // Merge header cells if it spans multiple subheaders
// if ($subHeaderCount > 1) {
// $endColumn = chr(ord($startColumn) + $subHeaderCount - 1); // Calculate the end column
// $sheet->mergeCells("{$startColumn}{$rowNumber}:{$endColumn}{$rowNumber}");
// } else {
// $endColumn = $startColumn; // No merge needed if only one subheader
// }
// // Add subheaders
// foreach ($header['subHeaders'] as $subHeader) {
// $sheet->setCellValue("{$columnLetter}{$subHeaderRow}", $subHeader);
// if ($columnLetter != "A" && $columnLetter != "B" && $columnLetter != "C" && $columnLetter != "D") {
// $sheet->getColumnDimension($columnLetter)->setWidth(35);
// } else {
// $sheet->getColumnDimension('A')->setWidth(10);
// }
// $sheet->getStyle("{$columnLetter}{$subHeaderRow}")->applyFromArray([
// 'font' => ['bold' => true],
// 'alignment' => [
// 'horizontal' => \PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER,
// 'vertical' => \PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER,
// ],
// ]);
// $columnLetter++; // Move to the next column for subheaders
// }
// }
// // Apply border to the header range
// $headerRange = "A{$rowNumber}:" . chr(ord($columnLetter) - 1) . "{$subHeaderRow}";
// $sheet->getStyle($headerRange)->applyFromArray([
// 'borders' => [
// 'allBorders' => [
// 'borderStyle' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN,
// 'color' => ['argb' => 'FF000000'], // Black color
// ],
// ],
// ]);
// // Increase row height for headers and subheaders
// $sheet->getRowDimension($rowNumber)->setRowHeight(25); // Header row height
// $sheet->getRowDimension($subHeaderRow)->setRowHeight(20); // Subheader row height
// $rowNumber = $subHeaderRow + 2;
// $column_data = $data['table_data']['data'];
// $serial_no = 1;
// $maxColumnWidths = [];
// // Add table data rows
// foreach ($column_data as $dataRow) {
// $columnLetter = 'A';
// foreach ($dataRow['data'] as $cellData) {
// if (in_array($cellData['parentth'], ['Item Key', 'Action'])) {
// continue;
// }
// if ($cellData['parentth'] == 'Sno') {
// $sheet->setCellValue("{$columnLetter}{$rowNumber}", $serial_no);
// } else {
// $sheet->setCellValue("{$columnLetter}{$rowNumber}", $cellData['value']);
// }
// $columnLetter++;
// }
// $rowNumber++;
// $serial_no++;
// }
// $dataRange = "A" . ($subHeaderRow + 1) . ":" . chr(ord($columnLetter) - 1) . ($rowNumber - 1);
// $sheet->getStyle($dataRange)->applyFromArray([
// 'borders' => [
// 'allBorders' => [
// 'borderStyle' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN,
// 'color' => ['argb' => 'FF000000'], // Black color
// ],
// ],
// ]);
// if ($type == 2) {
// $rowNumber += 2;
// // Add premium data
// // dd($data);
// $labelArray = ["Premium", "GST (%)", "GST Amount (₹)", "Total"];
// $premiumData = $data['premium_data']['data'];
// $premium = [$labelArray[0]];
// $gst = [$labelArray[1]];
// $gstAmt = [$labelArray[2]];
// $total = [$labelArray[3]];
// foreach ($premiumData as $proposal => $insurers) {
// if ($proposal != 'Particulars') {
// foreach ($insurers as $insurer => $values) {
// $premium[] = $values[$labelArray[0]];
// $gst[] = $values[$labelArray[1]];
// $gstAmt[] = $values[$labelArray[2]];
// $total[] = $values[$labelArray[3]];
// }
// }
// }
// foreach ([$premium, $gst, $gstAmt, $total] as $index => $rowData) {
// $columnLetter = 'B';
// foreach ($rowData as $key => $value) {
// $sheet->setCellValue("{$columnLetter}{$rowNumber}", $value);
// if ($key === 0) {
// $sheet->getStyle("{$columnLetter}{$rowNumber}")->applyFromArray(['font' => ['bold' => true,],]);
// }
// $columnLetter++;
// }
// $rowNumber++;
// }
// $premiumRange = "B" . ($rowNumber - 4) . ":" . chr(ord($columnLetter) - 2) . ($rowNumber - 1);
// // dd($premiumRange);
// $sheet->getStyle($premiumRange)->applyFromArray([
// 'borders' => [
// 'allBorders' => [
// 'borderStyle' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN,
// 'color' => ['argb' => 'FF000000'], // Black color
// ],
// ],
// ]);
// }
// // Auto-size columns
// // foreach ($sheet->getColumnIterator() as $column) {
// // $sheet->getColumnDimension($column->getColumnIndex())->setAutoSize(true);
// // }
// $dataRange = $sheet->calculateWorksheetDimension();
// $sheet->getStyle($dataRange)->getAlignment()
// ->setHorizontal(Alignment::HORIZONTAL_CENTER)
// ->setVertical(Alignment::VERTICAL_CENTER)
// ->setWrapText(true);
// $sheet->getStyle('A1')->applyFromArray([
// 'alignment' => [
// 'wrapText' => false, // Disables text wrapping for A1
// ],
// ]);
// // Apply border to the entire sheet
// preg_match('/([A-Z]+)(\d+):([A-Z]+)(\d+)/', $dataRange, $matches);
// if ($matches) {
// $startColumn = $matches[1]; // A
// $startRow = $matches[2]; // 1
// $endColumn = $matches[3]; // G
// $endRow = $matches[4]; // 75
// // Convert column letter to index, reduce by 1, and convert back
// $endColumnIndex = Coordinate::columnIndexFromString($endColumn) - 1;
// $newEndColumn = Coordinate::stringFromColumnIndex($endColumnIndex);
// // Generate the new range (e.g., "A1:F75" instead of "A1:G75")
// $newDataRange = "{$startColumn}{$startRow}:{$newEndColumn}{$endRow}";
// // $sheet->getStyle($newDataRange)->getBorders()->getAllBorders()->setBorderStyle(Border::BORDER_THIN);
// }
// $lastRow = count($lead_data) + 1;
// $leadRange = "A1:D{$lastRow}";
// $sheet->getStyle($leadRange)->applyFromArray([
// 'borders' => [
// 'allBorders' => [
// 'borderStyle' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN,
// 'color' => ['argb' => 'FF000000'], // Black color
// ],
// ],
// ]);
// Set filename
$string = ($type == 2) ? 'QCR' : 'RFQ';
$filename = "{$string}_{$rfq_data['client_short_name']}_{$rfq_data['policy_type']}_" . date('YmdHis') . '.xlsx';
// Save to temporary location
$uploadFilePath = WRITEPATH . 'tmp/' . $filename;
$writer = new Xlsx($spreadsheet);
$writer->save($uploadFilePath);
return [
'filePath' => $uploadFilePath,
'fileName' => $filename,
];
}
}

View File

@ -84,6 +84,9 @@ class LeadsModel extends Model
'total_si_at_incept',
'total_si_at_renewal',
'fin_years_claims',
'lead_form_type',
'custom_fields',
];

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,519 @@
<style>
.table th,
.table td {
padding: 8px;
}
table.dataTable tbody td {
padding: 4px 4px !important;
}
.col-12 {
max-width: 98% !important;
}
.dataTables_filter {
position: absolute;
}
.highlight {
border: 2px solid red;
background-color: #ffe6e6;
}
.column-header {
margin-right: 10px;
}
.form-section {
border: 1px solid #ccc;
padding: 15px;
margin-bottom: 20px;
}
.row-box {
border: 1px solid #ccc;
padding: 10px;
margin-bottom: 10px;
}
.custom-dropdown-menu {
display: none;
position: absolute;
background-color: #ffffff !important;
border: 1px solid rgba(0, 0, 0, 0.15);
border-radius: 0.25rem;
padding: 0.5rem 0;
min-width: 10rem;
z-index: 9999;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
.custom-dropdown-menu .dropdown-item {
display: block !important;
width: 100% !important;
padding: 0.5rem 1rem !important;
color: #212529 !important;
text-decoration: none !important;
background-color: transparent !important;
}
.custom-dropdown-menu .dropdown-item:hover {
background-color: #f8f9fa !important;
color: #16181b !important;
cursor: pointer !important;
}
</style>
<?php
if (isset($selected_lead_type)) {
if ($selected_lead_type == 1) {
include('leads_form.php');
} else {
include('leads_non_eb.php');
}
}
?>
<script>
var client_list = ''; // local variable for storing the client branch list
var branch_list = ''; // local variable for storing the client branch list
var policy_list = ''; // local variable for storing the client policy list
// select2 document ready
$(document).ready(function() {
getClientAndBranchAndPolicy()
$('#client_id').select2();
$('#client_branch_id').select2();
$('#salse_person_id').select2({
placeholder: "Select Salse Person",
});
$('#policy_type_id').select2();
$("textarea.select2-search__field").attr('rows', '1');
$("textarea.select2-search__field").css('resize', 'none');
})
//--------------------------------------------------------------------------------------------------------
function hide_list_show_add() {
$('#leads_list').hide()
$('#lead_filter_div').hide()
$('#leads_form').show()
}
function show_list_hide_add() {
$('#leads_list').show()
$('#lead_filter_div').show()
$('#leads_form').hide()
}
function getClientAndBranchAndPolicy() {
console.log('getClientAndBranchAndPolicy function called')
$.ajax({
url: '<?= base_url("/util/getClientAndBranchAndPolicy") ?>',
type: "GET",
dataType: 'json',
success: function(res) {
console.log('getClientAndBranchAndPolicy', res);
if (res.status == true) {
client_list = res.client_data;
branch_list = res.branch_data;
policy_list = res.policy_data;
appendClients(res.client_data);
} else {
console.log('No data found');
}
},
error: function(xhr, status, error) {
console.error(xhr.responseText);
console.error(status, error);
}
});
}
function appendClients(data) {
$('#client_id').empty();
$('#client_id').append($('<option>', {
value: '',
text: 'Select Client'
}));
$.each(data, function(index, item) {
var option = $('<option>', {
value: item.id,
text: item.client_name,
'data-cn': item.client_name,
'data-ct': item.client_type,
class: (item.client_type == 1) ? 'group' : (item.client_type == 2) ? 'individual' : ''
});
$('#client_id').append(option);
});
}
function appendBranch(data) {
$('#client_branch_id').empty();
$('#client_branch_id').append($('<option>', {
value: '',
text: 'Select Branch'
}));
$.each(data, function(index, item) {
var option = $('<option>', {
value: item.id,
text: item.branch_name
});
$('#client_branch_id').append(option);
});
}
function appendRenewalPolicies(data) {
console.log('appendRenewalPolicies', data);
$('#source_policy_id').empty();
$('#source_policy_id').append($('<option>', {
value: '',
text: 'Select Policy',
}));
$.each(data, function(index, item) {
var option = $('<option>', {
value: item.id,
text: item.policy_type + '-' + item.policy_no,
});
$('#source_policy_id').append(option);
});
}
//--------------------------------------------------------------------------------------------------------
$(document).ready(function() {
$('#client_id').change(function() {
let client_id = $(this).val();
console.log("client_id", client_id)
let client_type = $('#client_id option:selected').data('ct');
if (branch_list[client_id] != '' && branch_list[client_id] != null && client_id != '') {
console.log('branch_list', branch_list[client_id]);
let data = branch_list[client_id];
appendBranch(data);
} else {
toastr.warning("No Branch Found for the selected Client", 'Warning');
}
})
$('#client_branch_id').change(function() {
let client_branch_id = $(this).val();
if (policy_list[client_branch_id] != '' && policy_list[client_branch_id] != null &&
client_branch_id != '' && client_branch_id != null) {
console.log('policy_list', policy_list[client_branch_id]);
let data = policy_list[client_branch_id];
appendRenewalPolicies(data);
} else {
$('#source_policy_id').empty();
toastr.warning("No Policies Found for the selected Branch", 'Warning');
}
})
});
//--------------------------------------------------------------------------------------------------------
// Salse team user list data
function selecSalsePerson(salse_person_ids) {
salse_person_ids = JSON.parse(salse_person_ids);
// Loop through each insurer-branch combination
$.each(salse_person_ids, function(index, value) {
// Use value in the format 'branch_id-insurer_id'
$('#salse_person_id option').each(function() {
if ($(this).val() === value) {
$(this).prop('selected', true); // Select the matching option
}
});
});
// Trigger change for plugins (like Select2)
$('#salse_person_id').trigger('change');
}
</script>
<?php if (isset($lead_edit_data)) { ?>
<script>
setTimeout(function(){
handleEbAndNonEbEdit(
<?= json_encode($lead_edit_data, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP) ?>);
}, 1000)
function handleEbAndNonEbEdit(data){
if(data.lead_form_type == 1){
dynamicLeadsDataForEdit(data)
}else{
dynamicNonEbLeadsDataForEdit(data)
}
}
function dynamicLeadsDataForEdit(data) {
try {
console.log('########### THIS IS EB LEAD ###############')
console.log('Received data:', data);
let dataIncrement = 1;
if (!data || typeof data !== 'object') {
console.error('Invalid data received for editing.');
return;
}
$('.btnDiv').hide();
$('#appendArea_' + dataIncrement).empty();
if (data.html) {
$('#appendArea_' + dataIncrement).append(data.html);
} else {
console.warn('HTML content missing in data.');
}
let policy_type_id = data.policy_type_id || null;
let lead_type = data.lead_type || null;
if ([1, 6, 7].includes(policy_type_id)) {
let newId = 'appendAreaForClaim_' + dataIncrement;
$('#appendAreaForClaim').attr('id', newId);
}
leadTypeBsedHideAndShow(lead_type);
if (lead_type == 1) {
$('.claim-row').hide();
} else {
$('.claim-row').show();
if (policy_type_id == 1) {
$('.gpaClaimFileds').show();
$('.lifeClaimFields').hide();
} else if (policy_type_id === 6 || policy_type_id === 7) {
$('.gpaClaimFileds').hide();
$('.lifeClaimFields').show();
} else {
updateRenewalFields(dataIncrement);
let incurred_claim_date_id = 'incurred_claim_date_' + dataIncrement;
let premium_date_id = 'premium_date_' + dataIncrement;
if ($('#' + incurred_claim_date_id).length) {
flatpickr("#" + incurred_claim_date_id, {
dateFormat: "d/m/Y",
allowInput: false,
onChange: function (selectedDates) {
try {
let increment = this.input.id.split('_').pop();
let policyStartDate = $("#policy_start_date_" + increment).length
? $("#policy_start_date_" + increment)
: $("#policy_start_date");
if (policyStartDate.val()) {
calculatePolicyRunDays(increment);
}
} catch (error) {
console.error('Error in incurred_claim_datepicker:', error);
}
}
});
} else {
console.warn(`Incurred claim date field #${incurred_claim_date_id} not found.`);
}
if ($('#' + premium_date_id).length) {
flatpickr("#" + premium_date_id, {
dateFormat: "d/m/Y",
allowInput: false
});
} else {
console.warn(`Premium date field #${premium_date_id} not found.`);
}
$('#proposed_insurer_' + dataIncrement).select2();
$('#proposed_tpa_' + dataIncrement).select2();
}
}
hide_list_show_add();
$('#page_title').text('Edit Lead');
$('#leads_primarykey').val(data.id || '');
$('#policy_start_date').val(data.policy_end_date || '');
$('#lead_type').val(data.lead_type || '');
$('#issuer').val(data.issuer || '');
$('#client_type').val(data.client_type || '');
$('#client_name').val(data.client_name || '');
$('#client_short_name').val(data.client_short_name || '');
$('#entity_type_id').val(data.entity_type_id || '');
$('#lead_status').val(data.status || '');
$('#notes').val(data.notes || '');
setTimeout(() => {
$('#client_id').val(data.client_id || '').change();
setTimeout(() => {
$('#client_branch_id').val(data.client_branch_id || '').change();
setTimeout(() => {
$('#source_policy_id').val(data.source_policy_id || '');
$('#pan').val(data.pan || '');
$('#gst').val(data.gst || '');
$('#branch_name').val(data.branch_name || '');
$('#branch_code').val(data.branch_code || '');
$('#contact_person_name').val(data.contact_person_name || '');
$('#contact_person_mobile').val(data.contact_person_mobile || '');
$('#contact_person_email').val(data.contact_person_email || '');
$('#policy_type_id_1').val(data.policy_type_id || '').select2();
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
}, 1000);
}, 1000);
}, 1000);
let insurer = (data.insurer_branch_id && data.insurer_id)
? `${data.insurer_branch_id}-${data.insurer_id}`
: '';
let tpa = (data.tpa_branch_id && data.tpa_id)
? `${data.tpa_branch_id}-${data.tpa_id}`
: '';
let proposed_insurer = (data.proposed_insurer_branch_id && data.proposed_insurer_id)
? `${data.proposed_insurer_branch_id}-${data.proposed_insurer_id}`
: '';
let proposed_tpa = (data.proposed_tpa_branch_id && data.proposed_tpa_id)
? `${data.proposed_tpa_branch_id}-${data.proposed_tpa_id}`
: '';
$('#insurer_1').val(insurer).select2();
$('#tpa_1').val(tpa).select2();
$('#policy_start_date_1').val(data.policy_start_date || '');
$('#policy_end_date_1').val(data.policy_end_date || '');
$('#file_name_display').text(`Upload File Name : ${data.file_name || 'N/A'}`);
if (data.salse_person_id) {
selecSalsePerson(data.salse_person_id);
}
} catch (error) {
console.error('Error in dynamicLeadsDataForEdit function:', error);
}
}
function dynamicNonEbLeadsDataForEdit(data) {
try {
console.log('########### THIS IS NON EB LEAD ###############')
console.log('Received data:', data);
let dataIncrement = 1;
if (!data || typeof data !== 'object') {
console.error('Invalid data received for editing.');
return;
}
$('#appendArea').empty();
if (data.html) {
$('#appendArea').append(data.html);
} else {
console.warn('HTML content missing in data.');
}
let policy_type_id = data.policy_type_id || null;
let lead_type = data.lead_type || null;
leadTypeBsedHideAndShow(lead_type);
$('#page_title').text('Edit Lead');
$('#leads_primarykey').val(data.id || '');
$('#policy_start_date').val(data.policy_end_date || '');
$('#lead_type').val(data.lead_type || '');
$('#issuer').val(data.issuer || '');
$('#client_type').val(data.client_type || '');
$('#client_name').val(data.client_name || '');
$('#client_short_name').val(data.client_short_name || '');
$('#entity_type_id').val(data.entity_type_id || '');
$('#lead_status').val(data.status || '');
$('#notes').val(data.notes || '');
setTimeout(() => {
$('#client_id').val(data.client_id || '').change();
setTimeout(() => {
$('#client_branch_id').val(data.client_branch_id || '').change();
setTimeout(() => {
$('#source_policy_id').val(data.source_policy_id || '');
$('#pan').val(data.pan || '');
$('#gst').val(data.gst || '');
$('#branch_name').val(data.branch_name || '');
$('#branch_code').val(data.branch_code || '');
$('#contact_person_name').val(data.contact_person_name || '');
$('#contact_person_mobile').val(data.contact_person_mobile || '');
$('#contact_person_email').val(data.contact_person_email || '');
$('#policy_type_id').val(data.policy_type_id || '').select2();
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
}, 1000);
}, 1000);
}, 2000);
let insurer = (data.insurer_branch_id && data.insurer_id)
? `${data.insurer_branch_id}-${data.insurer_id}`
: '';
let tpa = (data.tpa_branch_id && data.tpa_id)
? `${data.tpa_branch_id}-${data.tpa_id}`
: '';
let proposed_insurer = (data.proposed_insurer_branch_id && data.proposed_insurer_id)
? `${data.proposed_insurer_branch_id}-${data.proposed_insurer_id}`
: '';
let proposed_tpa = (data.proposed_tpa_branch_id && data.proposed_tpa_id)
? `${data.proposed_tpa_branch_id}-${data.proposed_tpa_id}`
: '';
$('#insurer').val(insurer).select2();
$('#tpa').val(tpa).select2();
$('#policy_start_date').val(data.policy_start_date || '');
$('#policy_end_date').val(data.policy_end_date || '');
$('#file_name_display').text(`Upload File Name : ${data.file_name || 'N/A'}`);
if (data.salse_person_id) {
selecSalsePerson(data.salse_person_id);
}
} catch (error) {
console.error('Error in dynamicLeadsDataForEdit function:', error);
}
}
</script>
<?php } ?>

View File

@ -77,7 +77,7 @@ table.dataTable tbody td {
</div>
<div class="col-3" id="status_change" style="text-align: right; position: relative;top: 56px; left: 291px;">
<button type="button" id="btnAdd" class="btn btn-primary waves-effect waves-light" onclick="hide_list_show_add();">Add</button>
<button type="button" id="btnAdd" class="btn btn-primary waves-effect waves-light" onclick="openLeadTypeAskModal();">Add</button>
</div>
</div>
<div>
@ -124,7 +124,7 @@ table.dataTable tbody td {
<i class="mdi mdi-dots-horizontal"></i>
</a>
<div class="dropdown-menu dropdown-menu-right">
<a class="dropdown-item btnEdit" data-id="<?= $row['id']; ?>" onclick="getLeadsDataForEdit('<?= htmlspecialchars($row['id'], ENT_QUOTES) ?>')">
<a class="dropdown-item btnEdit" data-id="<?= $row['id']; ?>" data-ft="<?= $row['lead_form_type']; ?>" onclick="getLeadsDataForEdit('<?= htmlspecialchars($row['id'], ENT_QUOTES) ?>', '<?= htmlspecialchars($row['lead_form_type'], ENT_QUOTES) ?>')">
<i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit
</a>
<a href="<?= base_url('/rfq/list/').$row['id'] . '/' . 1; ?>" class="dropdown-item btnEdit2" data-id="<?= $row['id']; ?>">
@ -156,7 +156,30 @@ table.dataTable tbody td {
</div>
<?php include('leads_form.php'); ?>
<div class="modal fade" id="New_Lead_modal" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="myCenterModalLabel"></h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body">
<div class="form-row">
<div class="form-group col-md-12">
<label for="lead_form_type"> Policy Type <span class="text-danger"></span></label>
<select class="form-control" id="openLeadTypeAskModal">
<option value="1">Lead EB</option>
<option value="2">Lead Non-EB</option>
</select>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" onclick="submitToRedirectLeadNewUrl(this)">Submit</button>
</div>
</div>
</div>
</div>
<script>
@ -223,8 +246,10 @@ document.addEventListener("DOMContentLoaded", function () {
// For edit functionality
if (this.classList.contains('btnEdit')) {
const id = this.getAttribute('data-id');
const lead_form_type = this.getAttribute('data-ft');
console.log('second drop lead_form_type', lead_form_type)
if (id) {
getLeadsDataForEdit(id);
getLeadsDataForEdit(id, lead_form_type);
}
}else{
const onclickAttr = this.getAttribute('onclick');
@ -261,218 +286,63 @@ document.addEventListener("DOMContentLoaded", function () {
<script>
var client_list = ''; // local variable for storing the client branch list
var branch_list = ''; // local variable for storing the client branch list
var policy_list = ''; // local variable for storing the client policy list
// Datatable document ready
$(document).ready(function() {
var ticketsTable = $('#tickets-table');
// select2 document ready
$(document).ready(function(){
getClientAndBranchAndPolicy()
<?php if (session()->has('create_failed')) : ?>
toastr.error('<?= session()->getFlashdata('create_failed') ?>', 'Failed');
<?php endif; ?>
<?php if (session()->has('update_failed')) : ?>
toastr.error('<?= session()->getFlashdata('update_failed') ?>', 'Failed');
<?php endif; ?>
<?php if (session()->has('create_success')) : ?>
toastr.success('<?= session()->getFlashdata('create_success') ?>', 'success');
<?php endif; ?>
<?php if (session()->has('update_success')) : ?>
toastr.success('<?= session()->getFlashdata('update_success') ?>', 'success');
<?php endif; ?>
$('#client_id').select2();
$('#client_branch_id').select2();
// $('#source_policy_id').select2();
$('#salse_person_id').select2({
placeholder: "Select Salse Person",
});
$('#policy_type_id').select2();
})
// Datatable document ready
$(document).ready(function() {
var ticketsTable = $('#tickets-table');
if (ticketsTable.length) {
ticketsTable.DataTable({
// scrollX: true,
dom: "<'row'<'col-sm-6'f><'col-sm-5 text-right'B>>" + // Filter left, buttons right
"<'row'<'col-sm-12'tr>>" +
"<'row'<'col-sm-5'i><'col-sm-7'p>>", // Pagination at the bottom, without page length selector
buttons: [{
extend: 'csv',
text: 'CSV',
title: 'Policy-Tranction-Inception-List',
exportOptions: {
columns: ':not(:last-child)'
if (ticketsTable.length) {
ticketsTable.DataTable({
// scrollX: true,
dom: "<'row'<'col-sm-6'f><'col-sm-5 text-right'B>>" + // Filter left, buttons right
"<'row'<'col-sm-12'tr>>" +
"<'row'<'col-sm-5'i><'col-sm-7'p>>", // Pagination at the bottom, without page length selector
buttons: [{
extend: 'csv',
text: 'CSV',
title: 'Policy-Tranction-Inception-List',
exportOptions: {
columns: ':not(:last-child)'
},
}, ],
language: {
search: "_INPUT_",
searchPlaceholder: "Search..."
},
}, ],
language: {
search: "_INPUT_",
searchPlaceholder: "Search..."
},
paging: true, // Enable pagination
pageLength: 25, // Set default number of rows per page (optional)
// ordering: false,
});
} else {
console.error("Table not found.");
paging: true, // Enable pagination
pageLength: 25, // Set default number of rows per page (optional)
// ordering: false,
});
} else {
console.error("Table not found.");
}
});
function openLeadTypeAskModal(){
var myModal = new bootstrap.Modal(document.getElementById('New_Lead_modal'));
myModal.show();
}
});
function submitToRedirectLeadNewUrl(){
//--------------------------------------------------------------------------------------------------------
console.log('function called')
function hide_list_show_add()
{
$('#leads_list').hide()
$('#lead_filter_div').hide()
$('#leads_form').show()
}
let Lead_type = $('#openLeadTypeAskModal').val()
console.log('Lead_type ', Lead_type)
let url = '<?=base_url('/util/getLeadNonEB/')?>' + Lead_type
console.log('url ', url)
window.location.href = url;
function show_list_hide_add()
{
$('#leads_list').show()
$('#lead_filter_div').show()
$('#leads_form').hide()
}
}
function getClientAndBranchAndPolicy()
{
$.ajax({
url: '<?= base_url("/util/getClientAndBranchAndPolicy") ?>',
type: "GET",
dataType: 'json',
success: function(res) {
function getLeadsDataForEdit(lead_id, lead_form_type){
console.log('getClientAndBranchAndPolicy', res);
if(res.status == true){
client_list = res.client_data;
branch_list = res.branch_data;
policy_list = res.policy_data;
appendClients(res.client_data);
}else{
console.log('No data found');
}
},
error: function(xhr, status, error) {
console.error(xhr.responseText);
console.error(status, error);
}
});
}
function appendClients(data)
{
$('#client_id').empty();
$('#client_id').append($('<option>', {
value: '',
text: 'Select Client'
}));
$.each(data, function(index, item) {
var option = $('<option>', {
value: item.id,
text: item.client_name,
'data-cn': item.client_name,
'data-ct': item.client_type,
class: (item.client_type == 1) ? 'group' : (item.client_type == 2) ? 'individual' : ''
});
$('#client_id').append(option);
});
}
function appendBranch(data)
{
$('#client_branch_id').empty();
$('#client_branch_id').append($('<option>', {
value: '',
text: 'Select Branch'
}));
$.each(data, function(index, item) {
var option = $('<option>', {
value: item.id,
text: item.branch_name
});
$('#client_branch_id').append(option);
});
}
function appendRenewalPolicies(data)
{
console.log('appendRenewalPolicies', data);
$('#source_policy_id').empty();
$('#source_policy_id').append($('<option>', {
value: '',
text: 'Select Policy',
}));
$.each(data, function(index, item) {
var option = $('<option>', {
value: item.id,
text: item.policy_type + '-' + item.policy_no,
});
$('#source_policy_id').append(option);
});
}
//--------------------------------------------------------------------------------------------------------
$(document).ready(function(){
$('#client_id').change(function(){
let client_id = $(this).val();
let client_type = $('#client_id option:selected').data('ct');
if(branch_list[client_id] != '' && branch_list[client_id] != null && client_id != '') {
console.log('branch_list', branch_list[client_id]);
let data = branch_list[client_id];
appendBranch(data);
}else{
toastr.warning("No Branch Found for the selected Client",'Warning');
}
})
$('#client_branch_id').change(function(){
let client_branch_id = $(this).val();
if(policy_list[client_branch_id] != '' && policy_list[client_branch_id] != null && client_branch_id != ''&& client_branch_id != null) {
console.log('policy_list', policy_list[client_branch_id]);
let data = policy_list[client_branch_id];
appendRenewalPolicies(data);
}else{
toastr.warning("No Policies Found for the selected Branch",'Warning');
}
})
});
//--------------------------------------------------------------------------------------------------------
console.log('lead_id', lead_id);
console.log('lead_form_type', lead_form_type);
let url = '<?=base_url('/util/getLeadNonEB/')?>' + lead_form_type + '/' + lead_id
console.log('url ', url)
window.location.href = url;
}
</script>

804
app/Views/leads_non_eb.php Normal file
View File

@ -0,0 +1,804 @@
<!-- Leads Non EB -->
<style>
.readonly-color {
background-color: #e0e0e0;
/* Darker background */
color: #666;
/* Darker text color */
}
.readonly-select {
pointer-events: none;
background-color: #f0f0f0;
color: #666;
}
hr.solid {
border-top: 3px solid #bbb;
}
.select2-hidden-accessible+.select2-container .select2-dropdown {
display: none !important;
}
.select2-container .select2-selection--multiple .select2-selection__choice {
color: #000000;
}
.select2-selection__choice {
background-color: #0a8794 !important;
color: white !important;
font-weight: bold;
}
.select2-selection__choice__remove {
color: white !important;
margin-right: 5px;
}
</style>
<div class="row" id="leads_non_eb_form">
<div class="col-12">
<div class="card">
<div class="card-body">
<div class="row" style="margin-bottom:1rem;">
<div class="col-6" style="align-self: center;">
<h4 id="page_title" style="position: relative;">Add Lead</h4>
</div>
<div class="col-6" style="text-align: right; position: relative;">
<a href="<?= base_url('leads/list') ?>" type="button" id="btnAdd"
class="btn btn-primary waves-effect waves-light">Back</a>
</div>
</div>
<form role="form" class="parsley-examples" method="post" id="leads_form_id"
enctype="multipart/form-data">
<input type="hidden" name="id" id="leads_primarykey">
<input type="hidden" name="lead_form_type" id="lead_form_type_id" value="2">
<div class="form-row">
<div class="form-group col-md-3">
<label for="lead_type">Lead Type<span class="text-danger">*</span></label>
<select class="form-control" id="lead_type" name="lead_type" required>
<option value="">Select Lead Type</option>
<?php
if (isset($lead_type) && count($lead_type)) {
foreach ($lead_type as $key => $value) {
if ($key == 1) {
echo "<option value=" . $key . " selected>" . $value . "</option>";
} else {
echo "<option value=" . $key . ">" . $value . "</option>";
}
}
}
?>
</select>
</div>
<div class="form-group col-md-3">
<label for="issuer">Issuer<span class="text-danger">*</span></label>
<select class="form-control" id="issuer" name="issuer" required>
<option value="">Select Issuer</option>
<?php
if (isset($issuer) && count($issuer)) {
foreach ($issuer as $key => $value) {
echo "<option value=" . $key . ">" . $value . "</option>";
}
}
?>
</select>
</div>
</div>
<hr>
<!-- client row -->
<div class="form-row">
<div class="form-group col-md-3 freshFields">
<label for="client_type">Client Type<span class="text-danger">*</span></label>
<select class="form-control" id="client_type" name="client_type" required>
<option value="">Select Client type</option>
<?php
if (isset($client_type) && count($client_type)) {
foreach ($client_type as $key => $value) {
echo "<option value='" . $key . "' >" . $value . "</option>";
}
}
?>
</select>
</div>
<div class="form-group col-md-3 freshFields">
<label for="entity_type_id">Entity Type<span class="text-danger">*</span></label>
<select class="form-control" id="entity_type_id" name="entity_type_id" required>
<option value="" selected>Select Entity</option>
<?php
if (isset($entity) && count($entity)) {
foreach ($entity as $key => $value) {
echo "<option value=" . $value['id'] . ">" . $value['name'] . "</option>";
}
}
?>
</select>
</div>
<div class="form-group col-md-3 freshFields">
<label for="client_name">Client Name<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="client_name" name="client_name"
placeholder="Enter Client Name" required>
</div>
<div class="form-group col-md-3 freshFields">
<label for="client_short_name">Client Short Name<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="client_short_name" name="client_short_name"
placeholder="Enter Client Short Name" required>
</div>
<div class="form-group col-md-3 renewalFields" style="display: none;">
<label for="client_id">Client<span class="text-danger">*</span></label>
<select class="form-control" id="client_id" name="client_id">
<option value="">Select Client</option>
</select>
</div>
<div class="form-group col-md-3 renewalFields" style="display: none;">
<label for="client_branch_id">Branch<span class="text-danger">*</span></label>
<select class="form-control" id="client_branch_id" name="client_branch_id"
onchange="getBranchData(this)">
<option value="">Select Branch</option>
</select>
</div>
<div class="form-group col-md-3 renewalFields" style="display: none;">
<label for="source_policy_id"> Source Policy <span id="base_danger"
class="text-danger">*</span></label>
<select class="form-control" id="source_policy_id" name="source_policy_id" onchange="getPolicyData(this)">
<option value="" selected>Select Source Policy</option>
</select>
</div>
<div class="form-group col-md-3">
<label for="pan">PAN<span class="text-danger"></span></label>
<input type="text" class="form-control" id="pan" placeholder="Enter PAN Number"
data-parsley-error-message="Invalid PAN Number. Example: ABCDE1234F" name="pan"
data-parsley-trigger="change" data-parsley-pattern="^[A-Z]{5}[0-9]{4}[A-Z]$">
</div>
</div>
<!-- end client row -->
<hr>
<!-- branch row-->
<div class="form-row">
<div class="form-group col-md-3">
<label for="gst">GST<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="gst" placeholder="Enter GST Number"
data-parsley-error-message="Invalid GST Number. Example: 12ABCDE1234F5Z6" name="gst"
data-parsley-trigger="change"
data-parsley-pattern="^\d{2}[A-Z]{5}\d{4}[A-Z]{1}[A-Z\d]{1}[Z]{1}[A-Z\d]{1}$" required>
</div>
<div class="form-group col-md-3">
<label for="client_branch">Branch Name<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="branch_name" name="branch_name"
placeholder="Enter Branch Name" required>
</div>
<div class="form-group col-md-3">
<label for="client_branch">Branch Code<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="branch_code" name="branch_code"
placeholder="Enter Branch Code" required>
</div>
<div class="form-group col-md-3">
<label for="client_branch">Contact Person Name<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="contact_person_name" name="contact_person_name"
placeholder="Enter Contact Name" required>
</div>
<div class="form-group col-md-3">
<label for="contact_person_mobile">Contact Person Mobile<span
class="text-danger">*</span></label>
<input type="text" class="form-control" id="contact_person_mobile"
name="contact_person_mobile" placeholder="Enter Contact Mobile" required>
</div>
<div class="form-group col-md-3">
<label for="contact_person_email">Contact Person Email<span
class="text-danger">*</span></label>
<input type="text" class="form-control" id="contact_person_email"
name="contact_person_email" placeholder="Enter Contact Email" required>
</div>
</div>
<hr>
<!-- policy row -->
<div class="form-row" id="dynamic-form-container">
<div class="form-group col-md-3">
<label for="policy_type_id">Policy Type <span class="text-danger">*</span></label>
<select class="form-control" id="policy_type_id" name="policy_type_id"
onchange="getPolicyTypeFields(this)" required>
<option value="">Select Policy Type</option>
<?php
if (isset($policy_type) && count($policy_type)) {
foreach ($policy_type as $value) {
if(in_array($value['allocg'], ["Non-EB", "Marine"])){
echo "<option value='" . $value['id'] . "'>" . $value['policy_type'] ."</option>";
}
}
}
?>
</select>
</div>
<div class="form-group col-md-3">
<label for="insurer">Insurer <span class="text-danger"></span></label>
<select class="form-control" id="insurer" name="insurer">
<option value="">Select Insurer</option>
<?php if (isset($insurer)) { ?>
<?php foreach ($insurer as $value) { ?>
<option value="<?= $value['id'] . '-' . $value['insurer_id'] ?>">
<?= $value['insurer_name'] . '-' . $value['branch_code'] ?>
</option>
<?php } ?>
<?php } ?>
</select>
</div>
<div class="form-group col-md-3">
<label for="tpa">TPA <span class="text-danger"></span></label>
<select class="form-control" id="tpa" name="tpa">
<option value="">Select TPA</option>
<?php if (isset($tpa)) { ?>
<?php foreach ($tpa as $value) { ?>
<option value="<?= $value['id'] . '-' . $value['tpa_id'] ?>">
<?= $value['tpa_short_name'] . '-' . $value['branch_code'] ?>
</option>
<?php } ?>
<?php } ?>
</select>
</div>
<div class="form-group col-md-3">
<label for="">Date of Commencement <span class="text-danger">*</span></label>
<input type="text" class="form-control policy_start_date" id="policy_start_date" name="policy_start_date"
placeholder="Enter DOC" required>
</div>
<div class="form-group col-md-3">
<label for="">Date of Expiry <span class="text-danger">*</span></label>
<input type="text" class="form-control policy_end_date" id="policy_end_date" name="policy_end_date"
placeholder="Enter DOE" required>
</div>
</div>
<div id="appendArea"></div>
<div id="appendAreaForClaim"></div>
<hr>
<!-- other row -->
<div class="form-row">
<div class="form-group col-md-3">
<label for="file_upload">File Upload<span class="text-danger"></span></label>
<input type="file" class="form-control" id="file_name" name="file_name" accept=".xls,.xlsx">
<span class="text-danger" id="file_name_display"></span>
</div>
<div class="form-group col-md-3">
<label for="salse_person_id">Sales Person<span class="text-danger">*</span></label>
<select class="form-control" id="salse_person_id" name="salse_person_id" multiple required>
<option value="">Select Sales Person</option>
<?php if (isset($salse_team)) { ?>
<?php foreach ($salse_team as $value) { ?>
<option value="<?= $value['id']; ?>">
<?= $value['first_name']; ?>
</option>
<?php } ?>
<?php } ?>
</select>
</div>
<div class="form-group col-md-3">
<label for="status"> Status <span id="base_danger" class="text-danger">*</span></label>
<select class="form-control" id="lead_status" name="status" required>
<option value="" selected>Select Status</option>
<?php
if (isset($lead_status) && count($lead_status)) {
foreach ($lead_status as $key => $value) {
if ($key == 'queued') {
echo "<option value=" . $key . " selected>" . $value . "</option>";
} else {
echo "<option value=" . $key . ">" . $value . "</option>";
}
}
}
?>
</select>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-12">
<label for="notes">Note</label>
<textarea class="form-control" id="notes" name="notes" rows="4"></textarea>
</div>
</div>
<div class="form-group text-right m-b-0" id="submitButton">
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1"
id="btnSubmit">Submit</button>
</div>
</form>
</div>
</div>
</div>
</div>
<script>
$(document).ready(function(){
var policy_start_datePicker = flatpickr("#policy_start_date", {
dateFormat: "d/m/Y",
allowInput: false
});
var policy_end_datePicker = flatpickr("#policy_end_date", {
dateFormat: "d/m/Y",
allowInput: false
});
})
function getPolicyTypeFields(input) {
console.log('getPolicyTypeFields', input);
let policy_type_id = $(input).val();
console.log(policy_type_id)
let url = '<?= base_url('util/getPolicyTypeFields/') ?>';
let requestData = {
policy_type_id: policy_type_id,
};
// Show loader
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
// Send AJAX request
sendAjaxRequestForGlobal(url, 'GET', requestData, function(response) {
console.log('Data fetched successfully:', response);
$('#appendArea').empty();
$('#appendAreaForClaim').empty();
if (response.status == true) {
console.log(response.message, 'SUCCESS');
$('#appendArea').append(response.data);
let lead_type = $('#lead_type').val();
if(lead_type != 1){
let html = `<hr><div class="form-row"> <div class="form-group col-md-3"><h4> Claim Details </h4></div></div>`
let referenceDiv = document.getElementById('appendAreaForClaim');
referenceDiv.insertAdjacentHTML('beforeend', html);
appendThreeYearsClaims();
}
var retro_active_datePicker = flatpickr("#retro_active_date", {
dateFormat: "d/m/Y",
allowInput: false
});
var project_start_datePicker = flatpickr("#project_start_date", {
dateFormat: "d/m/Y",
allowInput: false
});
} else {
console.log(response.message, 'WARNING');
}
// Hide loader
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
}, function(xhr, status, error) {
console.error('Error fetching data:', error);
console.error(xhr.responseText);
toastr.error('An error occurred while fetch data.', 'ERROR');
// Hide loader
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
});
}
$("#leads_form_id").submit(function(event) {
event.preventDefault();
var isValid = $('#leads_form_id').parsley().validate();
if (!isValid) {
$('#leads_form_id').find('input, select, textarea').each(function() {
if ($(this).parsley().isValid() === false && !$(this).val()) {
console.log('Empty field ID:', this.id);
}
});
console.log('Form is Empty', 'Warning');
return;
}
var salse_person_id = $("#salse_person_id").val();
console.log('salse_person_id : ', salse_person_id);
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
var formData = new FormData($('#leads_form_id')[0]);
var policy_type_ids = formData.getAll('policy_type_id[]');
console.log('form policy ', policy_type_ids);
const jsonString = JSON.stringify(salse_person_id);
console.log('jsonString', jsonString);
let customFieldData = {};
$('.custom_fields').find('input, select, textarea').each(function () {
let key = $(this).attr('name');
let value;
if ($(this).is(':radio')) {
if ($(this).is(':checked')) {
value = $(this).val();
} else {
return; // Skip unchecked radio buttons
}
} else if ($(this).is(':checkbox')) {
value = $(this).is(':checked') ? $(this).val() : ''; // Store value if checked, otherwise empty
} else {
value = $(this).val();
}
customFieldData[key] = value;
});
// Append the JSON string to the FormData object
formData.append('salse_person_id', jsonString);
formData.append('custom_fields', JSON.stringify(customFieldData));
form_action = '<?= base_url('leads/create') ?>';
$.ajax({
data: formData,
url: form_action,
type: "POST",
dataType: 'json',
processData: false,
contentType: false,
success: function(res) {
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
console.log('inception_form_response', res)
if (res.status == true) {
toastr.success(res.message, 'Success');
window.location.href = '<?= base_url('leads/list') ?>';
} else {
toastr.error(res.message, 'Error');
}
},
error: function(xhr, status, error) {
console.error(xhr.responseText);
console.error(status, error);
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
}
});
});
$('#lead_type').change(function() {
let value = $(this).val()
leadTypeBsedHideAndShow(value, true)
})
function leadTypeBsedHideAndShow(value, resetValues = false) {
if (value == 1) {
$('.btnDiv').show();
$('.claim-row').hide();
$('.emp_title').text('No of Employees')
$('.depnd_title').text('No of Dependents')
$('.total_title').text('Total Lives')
$('.renewalFields').find('select, input').removeAttr('required');
$('.renewalFields').hide();
$('.freshFields').find('select, input').attr('required', 'required');
$('.freshFields').show();
$('#policy_end_date').attr('required', 'required');
$('#policy_start_date').attr('required', 'required');
if(resetValues){
$('#gst').val('');
$('#pan').val('');
$('#branch_name').val('');
$('#branch_code').val('');
$('#contact_person_name').val('');
$('#contact_person_mobile').val('');
$('#contact_person_email').val('');
$('#client_type').val('');
$('#client_name').val('');
$('#client_short_name').val('');
$('#entity_type_id').val('');
}
} else {
$('.btnDiv').hide();
$('.claim-row').show();
$('.emp_title').text('No of Employees at Inception')
$('.depnd_title').text(' No of Dependents at Inception')
$('.total_title').text('Total Lives at Inception')
$('.freshFields').find('select, input').removeAttr('required');
$('.freshFields').hide();
$('.renewalFields').show();
$('.renewalFields').find('select, input').attr('required', 'required');
$('.proposed_div').show().find('select, input').attr('required', 'required');
$('#policy_end_date').removeAttr('required');
$('#policy_start_date').removeAttr('required');
$('#claims').removeAttr('required');
if(resetValues){
$('#gst').val('');
$('#pan').val('');
$('#branch_name').val('');
$('#branch_code').val('');
$('#contact_person_name').val('');
$('#contact_person_mobile').val('');
$('#contact_person_email').val('');
}
}
}
function getBranchData(input) {
var client_branch_id = $(input).val();
if (client_branch_id) {
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
$.ajax({
url: '<?php echo base_url('util/get_client_branch_data/'); ?>' + client_branch_id,
type: "GET",
dataType: 'json',
success: function(res) {
console.log('getBranchData response', res);
if (res.status == true) {
$('#gst').val(res.data.gst);
$('#pan').val(res.data.pan);
$('#branch_name').val(res.data.branch_name);
$('#branch_code').val(res.data.branch_code);
$('#contact_person_name').val(res?.contact?.name || '');
$('#contact_person_mobile').val(res?.contact?.mobile || '');
$('#contact_person_email').val(res?.contact?.email || '');
$('#pan').prop('readOnly', true);
$('#gst').prop('readOnly', true);
$('#branch_name').prop('readOnly', true);
$('#branch_code').prop('readOnly', true);
$('#contact_person_name').prop('readOnly', true);
$('#contact_person_mobile').prop('readOnly', true);
$('#contact_person_email').prop('readOnly', true);
// $('#policy_type_id_1').prop('readOnly', true);
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
} else {
$('#gst').val('');
$('#pan').val('');
$('#branch_name').val('');
$('#branch_code').val('');
$('#contact_person_name').val('');
$('#contact_person_mobile').val('');
$('#contact_person_email').val('');
console.log(res.message, 'warning');
}
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
},
error: function(xhr, status, error) {
console.error(xhr.responseText);
console.error(status, error);
}
});
}
}
// Client Policy Data
function getPolicyData(input) {
var client_policy_id = $(input).val();
console.log('client_policy_id', client_policy_id);
if (client_policy_id) {
// Show loader
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
$.ajax({
url: '<?php echo base_url('client/policy/list/'); ?>' + client_policy_id,
type: "GET",
dataType: 'json',
success: function(res) {
console.log('getPolicyData response:', res);
if (res.status === true && res.data) {
$(`#policy_type_id`).removeClass('readonly-select ').select2();
$(`#insurer`).removeClass('readonly-select ').select2();
$(`#tpa`).removeClass('readonly-select ').select2();
const insurer = `${res.data.insurer_branch_id}-${res.data.insurer_id}`;
const tpa = `${res.data.tpa_branch_id}-${res.data.tpa_id}`;
// Update fields with response data
$(`#policy_type_id`).val(res.data.policy_type_id).trigger('change');
$(`#insurer`).val(insurer).trigger('change');
$(`#tpa`).val(tpa).trigger('change');
$('#policy_start_date').val(res.new_start_date);
$('#policy_end_date').val(res.end_date);
$("#policy_end_date").prop('readOnly', true);
$("#policy_start_date").prop("readOnly", true);
$(`#policy_type_id`).addClass('readonly-select ').select2('destroy');
$(`#insurer`).addClass('readonly-select ').select2('destroy');
$(`#tpa`).addClass('readonly-select ').select2('destroy');
} else {
console.warn('Invalid response:', res.message || 'Unknown error');
// Reset fields if response is invalid
$(`#policy_type_id`).val('').trigger('change');
$(`#insurer`).val('').trigger('change');
$(`#tpa`).val('').trigger('change');
}
// Hide loader
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
},
error: function(xhr, status, error) {
console.error('AJAX Error:', xhr.responseText || error);
// Reset fields on error
$(`#policy_type_id`).val('').trigger('change');
$(`#insurer`).val('').trigger('change');
$(`#tpa`).val('').trigger('change');
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
}
});
} else {
console.warn('Client policy ID is required.');
// Reset fields if no client policy ID is provided
$(`#policy_type_id`).val('').trigger('change');
$(`#insurer`).val('').trigger('change');
$(`#tpa`).val('').trigger('change');
}
}
var increment = 1;
function appendThreeYearsClaims(count) {
let claimsFields = `
<div class="row claim-row">
<div class="form-group col-md-2">
<label for="first_year_${increment}">Year<span class="text-danger">*</span></label>
<select class="form-control first_year_" id="first_year_${increment}" name="first_year[]">
<option value="">Select Year</option>
<?php foreach ($lastFiveYears as $year) {
echo "<option value='$year'>$year</option>";
} ?>
</select>
</div>
<div class="form-group col-md-2">
<label for="first_claim_amount_${increment}">Claim Amount<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="first_claim_amount_${increment}" name="first_claim_amount[]">
</div>
<div class="form-group col-md-2">
<label for="first_claim_amount_${increment}">Settled Amount<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="first_claim_amount_${increment}" name="first_claim_amount[]">
</div>
<div class="form-group col-md-2">
<label for="first_cause_of_death_${increment}">Cause Of Loss <span class="text-danger">*</span></label>
<select class="form-control" id="first_cause_of_death_${increment}" name="first_cause_of_death[]">
<option value="">Select Cause of Death</option>
<?php foreach ($causeOfDeath as $cause => $death_value) {
echo "<option value='$cause'>$death_value</option>";
} ?>
</select>
</div>
<div class="form-group col-md-2">
<label for="first_claim_status_${increment}">Claim Status<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="first_claim_status_${increment}" name="first_claim_status[]">
</div>
<div class="form-group col-md-2">
<div class="" style="position: relative; top: 28px; float: right; text-align: end;">
<a class="btn btn-danger waves-effect waves-light" onclick="removeClaim(this, ${count})">x</a>
<a class="btn btn-primary waves-effect waves-light mr-1" onclick="appendThreeYearsClaims(${count})">+</a>
</div>
</div>
</div>
`;
// Append new claim fields
let referenceDiv = document.getElementById('appendAreaForClaim');
referenceDiv.insertAdjacentHTML('beforeend', claimsFields);
// Increment claim index
increment = increment + 1;
}
</script>

View File

@ -3525,7 +3525,7 @@ $('#client_type').on('change', function() {
let client_show_name = item.client_name;
if (item.client_type == 2) {
client_show_name = item.client_name + ' - ' + (item.pan ?? 'N/A');
client_show_name = item.client_name + ' - ' + (item.dob ?? 'N/A');
}
var option = $('<option>', {
value: item.id,

View File

@ -737,7 +737,7 @@ function appendClients(data)
let client_show_name = item.client_name;
if (item.client_type == 2) {
client_show_name = item.client_name + ' - ' + (item.pan ?? 'N/A');
client_show_name = item.client_name + ' - ' + (item.dob ?? 'N/A');
}
var option = $('<option>', {

28
app/Views/rfq/blu.php Normal file
View File

@ -0,0 +1,28 @@
<hr>
<div class="form-row custom_fields">
<!-- Risk Location -->
<div class="form-group col-md-6">
<label>Risk Location</label><br>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="risk_location" value="single" <?= isset($lead_edit_data['risk_location']) && $lead_edit_data['risk_location'] == 'single' ? 'checked' : ''; ?>>
<label class="form-check-label">Single</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="risk_location" value="multi_with_floter" <?= isset($lead_edit_data['risk_location']) && $lead_edit_data['risk_location'] == 'multi_with_floter' ? 'checked' : ''; ?>>
<label class="form-check-label">Multi with Floter</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="risk_location" value="multi_without_floter" <?= isset($lead_edit_data['risk_location']) && $lead_edit_data['risk_location'] == 'multi_without_floter' ? 'checked' : ''; ?>>
<label class="form-check-label">Multi without Floter</label>
</div>
</div>
<!-- Address -->
<div class="form-group col-md-6">
<label for="address">Address</label>
<textarea class="form-control" id="address" name="address" rows="1"><?= isset($lead_edit_data['address']) ? htmlspecialchars($lead_edit_data['address']) : ''; ?></textarea>
</div>
</div>

28
app/Views/rfq/bsu.php Normal file
View File

@ -0,0 +1,28 @@
<hr>
<div class="form-row custom_fields">
<!-- Risk Location -->
<div class="form-group col-md-6">
<label>Risk Location</label><br>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="risk_location" value="single" <?= isset($lead_edit_data['risk_location']) && $lead_edit_data['risk_location'] == 'single' ? 'checked' : ''; ?>>
<label class="form-check-label">Single</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="risk_location" value="multi_with_floter" <?= isset($lead_edit_data['risk_location']) && $lead_edit_data['risk_location'] == 'multi_with_floter' ? 'checked' : ''; ?>>
<label class="form-check-label">Multi with Floter</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="risk_location" value="multi_without_floter" <?= isset($lead_edit_data['risk_location']) && $lead_edit_data['risk_location'] == 'multi_without_floter' ? 'checked' : ''; ?>>
<label class="form-check-label">Multi without Floter</label>
</div>
</div>
<!-- Address -->
<div class="form-group col-md-6">
<label for="address">Address</label>
<textarea class="form-control" id="address" name="address" rows="1"><?= isset($lead_edit_data['address']) ? htmlspecialchars($lead_edit_data['address']) : ''; ?></textarea>
</div>
</div>

75
app/Views/rfq/car.php Normal file
View File

@ -0,0 +1,75 @@
<!-- Contractor's All Risk Policy (CAR) -->
<hr>
<div class="form-row custom_fields">
<!-- Sum Insured -->
<div class="form-group col-md-3">
<label for="sum_insured">Sum Insured:</label>
<input type="text" class="form-control" id="sum_insured" name="sum_insured"
value="<?= isset($lead_edit_data['sum_insured']) ? htmlspecialchars($lead_edit_data['sum_insured']) : ''; ?>">
</div>
<!-- Policy Period -->
<div class="form-group col-md-3">
<label for="policy_period">Policy Period:</label>
<select class="form-control" id="policy_period" name="policy_period">
<option value="">Select Policy Period</option>
<?php for ($i = 1; $i <= 24; $i++):
$selected = (isset($lead_edit_data['policy_period']) && $lead_edit_data['policy_period'] == "$i Month") ? 'selected' : ''; ?>
<option value="<?= $i . " Month" ?>" <?= $selected ?>><?= $i ?> Month</option>
<?php endfor; ?>
</select>
</div>
<!-- Maintenance Period -->
<div class="form-group col-md-3">
<label for="maintenance_period">Maintenance Period:</label>
<select class="form-control" id="maintenance_period" name="maintenance_period">
<option value="">Select Maintenance Period</option>
<?php for ($i = 6; $i <= 24; $i += 2):
$selected = (isset($lead_edit_data['maintenance_period']) && $lead_edit_data['maintenance_period'] == "$i Month") ? 'selected' : ''; ?>
<option value="<?= $i . " Month" ?>" <?= $selected ?>><?= $i ?> Month</option>
<?php endfor; ?>
</select>
</div>
<!-- Project Start Date -->
<div class="form-group col-md-3">
<label for="project_start_date">Project Start Date:</label>
<input type="text" class="form-control" id="project_start_date" name="project_start_date" placeholder="DD/MM/YYYY"
value="<?= isset($lead_edit_data['project_start_date']) ? htmlspecialchars($lead_edit_data['project_start_date']) : ''; ?>">
</div>
<!-- Was the Project Earlier Insured? -->
<div class="form-group col-md-3">
<label>Was the Project earlier insured?</label>
<div>
<input type="radio" id="insured_yes" name="insured" value="yes"
<?= (isset($lead_edit_data['insured']) && $lead_edit_data['insured'] == 'yes') ? 'checked' : ''; ?>>
<label for="insured_yes">Yes</label>
<input type="radio" id="insured_no" name="insured" value="no"
<?= (isset($lead_edit_data['insured']) && $lead_edit_data['insured'] == 'no') ? 'checked' : ''; ?>>
<label for="insured_no">No</label>
</div>
</div>
<!-- Project Exposure -->
<div class="form-group col-md-6">
<label>Does the project have exposure to Underground Operations, Tunnels, Hilly areas, Offshore, Wet Risks, Oil Rigs, or Hydro projects?</label>
<div>
<input type="radio" id="exposure_yes" name="exposure" value="yes"
<?= (isset($lead_edit_data['exposure']) && $lead_edit_data['exposure'] == 'yes') ? 'checked' : ''; ?>>
<label for="exposure_yes">Yes</label>
<input type="radio" id="exposure_no" name="exposure" value="no"
<?= (isset($lead_edit_data['exposure']) && $lead_edit_data['exposure'] == 'no') ? 'checked' : ''; ?>>
<label for="exposure_no">No</label>
</div>
</div>
<!-- Address -->
<div class="form-group col-md-6">
<label for="address">Address:</label>
<textarea class="form-control" id="address" name="address"><?= isset($lead_edit_data['address']) ? htmlspecialchars($lead_edit_data['address']) : ''; ?></textarea>
</div>
</div>

89
app/Views/rfq/cgl.php Normal file
View File

@ -0,0 +1,89 @@
<hr>
<div class="form-row custom_fields">
<!-- Risk Location -->
<div class="form-group col-md-6">
<label>Risk Location</label>
<div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" id="single" name="risk_location" value="Single"
<?= isset($lead_edit_data['risk_location']) && $lead_edit_data['risk_location'] == 'Single' ? 'checked' : ''; ?>>
<label class="form-check-label" for="single">Single</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" id="multi_floater" name="risk_location" value="multi_with_floter"
<?= isset($lead_edit_data['risk_location']) && $lead_edit_data['risk_location'] == 'multi_with_floter' ? 'checked' : ''; ?>>
<label class="form-check-label" for="multi_floater">multi_with_floter</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" id="multi_no_floater" name="risk_location" value="multi_without_floter"
<?= isset($lead_edit_data['risk_location']) && $lead_edit_data['risk_location'] == 'multi_without_floter' ? 'checked' : ''; ?>>
<label class="form-check-label" for="multi_no_floater">Multi without Floater</label>
</div>
</div>
</div>
<!-- Nature of Business -->
<div class="form-group col-md-3">
<label for="nature_of_business">Nature of Business</label>
<input type="text" class="form-control" id="nature_of_business" name="nature_of_business"
value="<?= isset($lead_edit_data['nature_of_business']) ? htmlspecialchars($lead_edit_data['nature_of_business']) : ''; ?>">
</div>
<!-- Retro-active Date -->
<div class="form-group col-md-3">
<label for="retro_active_date">Retro-active Date</label>
<input type="text" class="form-control" id="retro_active_date" name="retro_active_date" placeholder="DD/MM/YYYY"
value="<?= isset($lead_edit_data['retro_active_date']) ? htmlspecialchars($lead_edit_data['retro_active_date']) : ''; ?>">
</div>
<!-- Annual Turnover -->
<div class="form-group col-md-3">
<label for="annual_turnover">Annual Turnover</label>
<input type="text" class="form-control" id="annual_turnover" name="annual_turnover"
value="<?= isset($lead_edit_data['annual_turnover']) ? htmlspecialchars($lead_edit_data['annual_turnover']) : ''; ?>">
</div>
<!-- Territory -->
<div class="form-group col-md-3">
<label for="territory">Territory</label>
<input type="text" class="form-control" id="territory" name="territory"
value="<?= isset($lead_edit_data['territory']) ? htmlspecialchars($lead_edit_data['territory']) : ''; ?>">
</div>
<!-- Jurisdiction -->
<div class="form-group col-md-3">
<label for="jurisdiction">Jurisdiction</label>
<input type="text" class="form-control" id="jurisdiction" name="jurisdiction"
value="<?= isset($lead_edit_data['jurisdiction']) ? htmlspecialchars($lead_edit_data['jurisdiction']) : ''; ?>">
</div>
<!-- AOA (Any One Accident) -->
<div class="form-group col-md-3">
<label for="aoa">AOA (Any One Accident)</label>
<input type="text" class="form-control" id="aoa" name="aoa"
value="<?= isset($lead_edit_data['aoa']) ? htmlspecialchars($lead_edit_data['aoa']) : ''; ?>">
</div>
<!-- AOY (Any One Year) -->
<div class="form-group col-md-3">
<label for="aoy">AOY (Any One Year)</label>
<input type="text" class="form-control" id="aoy" name="aoy"
value="<?= isset($lead_edit_data['aoy']) ? htmlspecialchars($lead_edit_data['aoy']) : ''; ?>">
</div>
<!-- Designated Premises -->
<div class="form-group col-md-3">
<label for="designated_premises">Designated Premises</label>
<input type="text" class="form-control" id="designated_premises" name="designated_premises"
value="<?= isset($lead_edit_data['designated_premises']) ? htmlspecialchars($lead_edit_data['designated_premises']) : ''; ?>">
</div>
<!-- Communication Address -->
<div class="form-group col-md-6">
<label for="address">Communication Address</label>
<textarea class="form-control" id="address" name="address" rows="1"><?= isset($lead_edit_data['address']) ? htmlspecialchars($lead_edit_data['address']) : ''; ?></textarea>
</div>
</div>

77
app/Views/rfq/cpm.php Normal file
View File

@ -0,0 +1,77 @@
<!-- CPM -->
<hr>
<div class="form-row custom_fields">
<!-- Specific Location -->
<div class="form-group col-md-3">
<label for="specific_location">Specific Location</label>
<input type="text" class="form-control" id="specific_location" name="specific_location" value="<?= isset($lead_edit_data['specific_location']) ? htmlspecialchars($lead_edit_data['specific_location']) : ''; ?>">
</div>
<!-- Plant and Machinery Value -->
<div class="form-group col-md-3">
<label for="machinery_value">Plant and Machinery Value</label>
<input type="text" class="form-control" id="machinery_value" name="machinery_value" value="<?= isset($lead_edit_data['machinery_value']) ? htmlspecialchars($lead_edit_data['machinery_value']) : ''; ?>">
</div>
<!-- Machinery -->
<div class="form-group col-md-3">
<label for="machinery">Machinery</label>
<input type="text" class="form-control" id="machinery" name="machinery" value="<?= isset($lead_edit_data['machinery']) ? htmlspecialchars($lead_edit_data['machinery']) : ''; ?>">
</div>
<!-- Plant and Machinery Type -->
<div class="form-group col-md-3">
<label>Plant and Machinery Type</label>
<div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="plant_machinery_type" id="new" value="New" <?= isset($lead_edit_data['plant_machinery_type']) && $lead_edit_data['plant_machinery_type'] == 'New' ? 'checked' : ''; ?>>
<label class="form-check-label" for="new">New</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="plant_machinery_type" id="old" value="Old" <?= isset($lead_edit_data['plant_machinery_type']) && $lead_edit_data['plant_machinery_type'] == 'Old' ? 'checked' : ''; ?>>
<label class="form-check-label" for="old">Old</label>
</div>
</div>
</div>
<!-- Used on Public Road -->
<div class="form-group col-md-3">
<label>Is it used on public road?</label>
<div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="used_on_road" id="yes_used_on_road" value="Yes" <?= isset($lead_edit_data['used_on_road']) && $lead_edit_data['used_on_road'] == 'Yes' ? 'checked' : ''; ?>>
<label class="form-check-label" for="yes_used_on_road">Yes</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="used_on_road" id="no_used_on_road" value="No" <?= isset($lead_edit_data['used_on_road']) && $lead_edit_data['used_on_road'] == 'No' ? 'checked' : ''; ?>>
<label class="form-check-label" for="no_used_on_road">No</label>
</div>
</div>
</div>
<!-- RTO Registered -->
<div class="form-group col-md-3">
<label>Is your machinery RTO registered?</label>
<div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="rto_registered" id="yes_rto" value="Yes" <?= isset($lead_edit_data['rto_registered']) && $lead_edit_data['rto_registered'] == 'Yes' ? 'checked' : ''; ?>>
<label class="form-check-label" for="yes_rto">Yes</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="rto_registered" id="no_rto" value="No" <?= isset($lead_edit_data['rto_registered']) && $lead_edit_data['rto_registered'] == 'No' ? 'checked' : ''; ?>>
<label class="form-check-label" for="no_rto">No</label>
</div>
</div>
</div>
<!-- Address -->
<div class="form-group col-md-6">
<label for="address">Address</label>
<textarea class="form-control" id="address" name="address" rows="1"><?= isset($lead_edit_data['address']) ? htmlspecialchars($lead_edit_data['address']) : ''; ?></textarea>
</div>
</div>

View File

@ -0,0 +1,22 @@
<hr>
<div class="form-row custom_fields">
<!-- Business Activity -->
<div class="form-group col-md-3">
<label for="business_activity">Business Activity</label>
<input type="text" class="form-control" id="business_activity" name="business_activity" value="<?= isset($lead_edit_data['business_activity']) ? htmlspecialchars($lead_edit_data['business_activity']) : ''; ?>">
</div>
<!-- Limit of Indemnity -->
<div class="form-group col-md-3">
<label for="limit_of_indemnity">Limit of Indemnity</label>
<input type="text" class="form-control" id="limit_of_indemnity" name="limit_of_indemnity" value="<?= isset($lead_edit_data['limit_of_indemnity']) ? htmlspecialchars($lead_edit_data['limit_of_indemnity']) : ''; ?>">
</div>
<!-- Address of the Insured -->
<div class="form-group col-md-6">
<label for="address">Address of the Insured</label>
<textarea class="form-control" id="address" name="address" rows="1"><?= isset($lead_edit_data['address']) ? htmlspecialchars($lead_edit_data['address']) : ''; ?></textarea>
</div>
</div>

44
app/Views/rfq/do.php Normal file
View File

@ -0,0 +1,44 @@
<hr>
<div class="form-row custom_fields">
<!-- Business Activity -->
<div class="form-group col-md-3">
<label for="business_activity">Business Activity</label>
<input type="text" class="form-control" id="business_activity" name="business_activity" value="<?= isset($lead_edit_data['business_activity']) ? htmlspecialchars($lead_edit_data['business_activity']) : ''; ?>">
</div>
<!-- Basis of Policy -->
<div class="form-group col-md-4">
<label>Basis of Policy</label>
<div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" id="claims_made" name="basis_of_policy" value="Claims Made Basis" <?= (isset($lead_edit_data['basis_of_policy']) && $lead_edit_data['basis_of_policy'] == 'Claims Made Basis') ? 'checked' : ''; ?>>
<label class="form-check-label" for="claims_made">Claims Made Basis</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" id="occurrence_basis" name="basis_of_policy" value="Occurrence Basis" <?= (isset($lead_edit_data['basis_of_policy']) && $lead_edit_data['basis_of_policy'] == 'Occurrence Basis') ? 'checked' : ''; ?>>
<label class="form-check-label" for="occurrence_basis">Occurrence Basis</label>
</div>
</div>
</div>
<!-- Limit of Indemnity -->
<div class="form-group col-md-3">
<label for="limit_of_indemnity">Limit of Indemnity</label>
<input type="text" class="form-control" id="limit_of_indemnity" name="limit_of_indemnity" value="<?= isset($lead_edit_data['limit_of_indemnity']) ? htmlspecialchars($lead_edit_data['limit_of_indemnity']) : ''; ?>">
</div>
<!-- Retro-active Date -->
<div class="form-group col-md-3">
<label for="retro_active_date">Retro-active Date</label>
<input type="text" class="form-control" id="retro_active_date" name="retro_active_date" placeholder="DD/MM/YYYY" value="<?= isset($lead_edit_data['retro_active_date']) ? htmlspecialchars($lead_edit_data['retro_active_date']) : ''; ?>">
</div>
<!-- Address of the Insured -->
<div class="form-group col-md-6">
<label for="address">Address of the Insured</label>
<textarea class="form-control" id="address" name="address" rows="1"><?= isset($lead_edit_data['address']) ? htmlspecialchars($lead_edit_data['address']) : ''; ?></textarea>
</div>
</div>

42
app/Views/rfq/eo.php Normal file
View File

@ -0,0 +1,42 @@
<hr>
<div class="form-row custom_fields">
<!-- Business Activity -->
<div class="form-group col-md-3">
<label for="business_activity">Business Activity</label>
<input type="text" class="form-control" id="business_activity" name="business_activity">
</div>
<!-- Basis of Policy -->
<div class="form-group col-md-4">
<label>Basis of Policy</label>
<div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" id="claims_made" name="basis_of_policy" value="Claims Made Basis">
<label class="form-check-label" for="claims_made">Claims Made Basis</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" id="occurrence_basis" name="basis_of_policy" value="Occurrence Basis">
<label class="form-check-label" for="occurrence_basis">Occurrence Basis</label>
</div>
</div>
</div>
<!-- Limit of Indemnity -->
<div class="form-group col-md-3">
<label for="limit_of_indemnity">Limit of Indemnity</label>
<input type="text" class="form-control" id="limit_of_indemnity" name="limit_of_indemnity">
</div>
<!-- Retro-active Date -->
<div class="form-group col-md-3">
<label for="retro_active_date">Retro-active Date</label>
<input type="text" class="form-control" id="retro_active_date" name="retro_active_date" placeholder="DD/MM/YYYY">
</div>
<!-- Address of the Insured -->
<div class="form-group col-md-6">
<label for="address">Address of the Insured</label>
<textarea class="form-control" id="address" name="address" rows="1"></textarea>
</div>
</div>

186
app/Views/rfq/gmc.php Normal file
View File

@ -0,0 +1,186 @@
<hr>
<div class="form-row renewalCalculation">
<div class="form-group col-md-3 renewalFields" style="display: none;">
<label for="incurred_claim_date">Incurred Claim Date<span class="text-danger"></span></label>
<input value="<?= isset($lead_edit_data['incurred_claim_date']) ? $lead_edit_data['incurred_claim_date'] : '' ?>" type="text" class="form-control incurred_claim" id="incurred_claim_date"
name="incurred_claim_date[]" placeholder="Enter DOE">
</div>
<div class="form-group col-md-3 renewalFields" style="display: none;">
<label for="paid_claims">Paid Claims<span class="text-danger">*</span></label>
<input value="<?= isset($lead_edit_data['paid_claims']) ? $lead_edit_data['paid_claims'] : '' ?>" type="text" class="form-control" id="paid_claims" name="paid_claims[]"
placeholder="Enter Paid Claims" oninput="incurredClaimSum(this)">
</div>
<div class="form-group col-md-3 renewalFields" style="display: none;">
<label for="outstanding_claims">Outstanding Claims<span class="text-danger">*</span></label>
<input value="<?= isset($lead_edit_data['outstanding_claims']) ? $lead_edit_data['outstanding_claims'] : '' ?>" type="text" class="form-control" id="outstanding_claims" name="outstanding_claims[]"
placeholder="Enter Outstanding Claims" oninput="incurredClaimSum(this)">
</div>
<div class="form-group col-md-3 renewalFields" style="display: none;">
<label for="incurred_claims">Incurred Claim<span class="text-danger">*</span></label>
<input value="<?= isset($lead_edit_data['incurred_claims']) ? $lead_edit_data['incurred_claims'] : '' ?>" type="text" class="form-control" id="incurred_claims" name="incurred_claims[]"
placeholder="Enter Incurred Claim" oninput="incurredClaimSum(this)">
</div>
<div class="form-group col-md-3 renewalFields" style="display: none;">
<label for="policy_run_days">Policy Run Days<span class="text-danger">*</span></label>
<input value="<?= isset($lead_edit_data['policy_run_days']) ? $lead_edit_data['policy_run_days'] : '' ?>" type="text" class="form-control" id="policy_run_days" name="policy_run_days[]"
placeholder="Enter Policy Run Days" oninput="earnedPremiumCalc(this)" onkeyup="incurredClaimSum(this)">
</div>
<div class="form-group col-md-3 renewalFields" style="display: none;">
<label for="premium_at_inception">Premium Paid at Inception<span
class="text-danger">*</span></label>
<input value="<?= isset($lead_edit_data['premium_at_inception']) ? $lead_edit_data['premium_at_inception'] : '' ?>" type="text" class="form-control" id="premium_at_inception" name="premium_at_inception[]"
placeholder="Enter Premium Paid" oninput="earnedPremiumCalc(this)">
</div>
<div class="form-group col-md-3 renewalFields" style="display: none;">
<label for="premium_date">Premium Date<span class="text-danger"></span></label>
<input value="<?= isset($lead_edit_data['premium_date']) ? $lead_edit_data['premium_date'] : '' ?>" type="text" class="form-control" id="premium_date" name="premium_date[]"
placeholder="Enter Premium Date">
</div>
<div class="form-group col-md-3 renewalFields" style="display: none;">
<label for="earned_premium">Earned Premium<span class="text-danger">*</span></label>
<input value="<?= isset($lead_edit_data['earned_premium']) ? $lead_edit_data['earned_premium'] : '' ?>" type="text" class="form-control" id="earned_premium" name="earned_premium[]"
placeholder="Enter Earned Premium" oninput="incurredClaimSum(this)">
</div>
<div class="form-group col-md-3 renewalFields" style="display: none;">
<label for="annualised_claims">Annualised Claims<span class="text-danger">*</span></label>
<input value="<?= isset($lead_edit_data['annualised_claims']) ? $lead_edit_data['annualised_claims'] : '' ?>" type="text" class="form-control" id="annualised_claims" name="annualised_claims[]"
placeholder="Enter Annualised Claims">
</div>
<div class="form-group col-md-3 renewalFields" style="display: none;">
<label for="incurred_claims_ratio">Incurred Claims Ratio<span
class="text-danger">*</span></label>
<input value="<?= isset($lead_edit_data['incurred_claims_ratio']) ? $lead_edit_data['incurred_claims_ratio'] : '' ?>" type="text" class="form-control" id="incurred_claims_ratio"
name="incurred_claims_ratio[]" placeholder="Enter Incurred Claims Ratio">
</div>
<div class="form-group col-md-3 renewalFields" style="display: none;">
<label for="earned_claims_ratio">Earned Claims Ratio<span class="text-danger">*</span></label>
<input value="<?= isset($lead_edit_data['earned_claims_ratio']) ? $lead_edit_data['earned_claims_ratio'] : '' ?>" type="text" class="form-control" id="earned_claims_ratio" name="earned_claims_ratio[]"
placeholder="Enter Earned Claims Ratio">
</div>
<div class="form-group col-md-3 renewalFields" style="display: none;">
<label for="location">Location <span class="text-danger">*</span></label>
<input value="<?= isset($lead_edit_data['location']) ? $lead_edit_data['location'] : '' ?>" type="text" class="form-control" id="location" name="location[]" placeholder="Enter Location">
</div>
<div class="form-group col-md-3 proposed_div" style="display: none;">
<label for="proposed_insurer">Proposed Insurer <span class="text-danger"></span></label>
<select class="form-control" id="proposed_insurer" name="proposed_insurer[]">
<option value="">Select Insurer</option>
<?php
if (isset($insurer) && count($insurer)) {
foreach ($insurer as $key => $value) {
$selected = (isset($lead_edit_data) && $lead_edit_data['proposed_insurer_branch_id'] == $value['id'] && $lead_edit_data['proposed_insurer_id'] == $value['insurer_id']) ? 'selected' : '';
echo "<option value=" . $value['id'] . '-' . $value['insurer_id'] . " $selected >" . $value['insurer_name'] . '-' . $value['branch_code'] . "</option>";
}
}
?>
</select>
</div>
<div class="form-group col-md-3 proposed_div" style="display: none;">
<label for="proposed_tpa">Proposed TPA <span class="text-danger"></span></label>
<select class="form-control" id="proposed_tpa" name="proposed_tpa[]">
<option value="">Select TPA</option>
<?php
if (isset($tpa) && count($tpa)) {
foreach ($tpa as $key => $value) {
$selected = (isset($lead_edit_data) && $lead_edit_data['proposed_tpa_branch_id'] == $value['id'] && $lead_edit_data['proposed_tpa_id'] == $value['tpa_id']) ? 'selected' : '';
echo "<option value=" . $value['id'] . '-' . $value['tpa_id'] . " $selected >" . $value['tpa_short_name'] . '-' . $value['branch_code'] . "</option>";
}
}
?>
</select>
</div>
</div>
<hr>
<div class="form-row">
<div class="form-group col-md-3">
<label for="incept_emp_count" class="emp_title"> No of Employees at Inception <span
class="text-danger">*</span></label>
<input value="<?= isset($lead_edit_data['incept_emp_count']) ? $lead_edit_data['incept_emp_count'] : '' ?>" type="text" class="form-control" id="incept_emp_count" name="incept_emp_count[]"
placeholder="Enter Lives" required>
</div>
<div class="form-group col-md-3">
<label for="incept_dept_count" class="depnd_title"> No of Dependents at Inception <span
class="text-danger">*</span></label>
<input value="<?= isset($lead_edit_data['incept_dept_count']) ? $lead_edit_data['incept_dept_count'] : '' ?>" type="text" class="form-control" id="incept_dept_count" name="incept_dept_count[]"
placeholder="Enter Lives" required>
</div>
<div class="form-group col-md-3">
<label for="incept_no_of_lives" class="total_title"> Total Lives at Inception <span
class="text-danger">*</span></label>
<input value="<?= isset($lead_edit_data['incept_no_of_lives']) ? $lead_edit_data['incept_no_of_lives'] : '' ?>" type="text" class="form-control" id="incept_no_of_lives" name="incept_no_of_lives[]"
placeholder="Enter Lives" required>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-3 renewalFields" style="display: none;">
<label for="renewal_emp_count"> No of Employees at Renewal <span
class="text-danger">*</span></label>
<input value="<?= isset($lead_edit_data['renewal_emp_count']) ? $lead_edit_data['renewal_emp_count'] : '' ?>" type="text" class="form-control" id="renewal_emp_count" name="renewal_emp_count[]"
placeholder="Enter Lives">
</div>
<div class="form-group col-md-3 renewalFields" style="display: none;">
<label for="renewal_dept_count"> No of Dependents at Renewal <span
class="text-danger">*</span></label>
<input value="<?= isset($lead_edit_data['renewal_dept_count']) ? $lead_edit_data['renewal_dept_count'] : '' ?>" type="text" class="form-control" id="renewal_dept_count" name="renewal_dept_count[]"
placeholder="Enter Lives">
</div>
<div class="form-group col-md-3 renewalFields" style="display: none;">
<label for="renewal_no_of_lives"> Total Lives at Renewal <span
class="text-danger">*</span></label>
<input value="<?= isset($lead_edit_data['renewal_no_of_lives']) ? $lead_edit_data['renewal_no_of_lives'] : '' ?>" type="text" class="form-control" id="renewal_no_of_lives" name="renewal_no_of_lives[]"
placeholder="Enter Lives">
</div>
</div>
<div class="form-row">
<div class="form-group col-md-3 renewalFields" style="display: none;">
<label for="exp_emp_count"> No of Employees at Expiry <span class="text-danger">*</span></label>
<input value="<?= isset($lead_edit_data['exp_emp_count']) ? $lead_edit_data['exp_emp_count'] : '' ?>" type="text" class="form-control" id="exp_emp_count" name="exp_emp_count[]"
placeholder="Enter Lives">
</div>
<div class="form-group col-md-3 renewalFields" style="display: none;">
<label for="exp_dept_count"> No of Dependents at Expiry <span
class="text-danger">*</span></label>
<input value="<?= isset($lead_edit_data['exp_dept_count']) ? $lead_edit_data['exp_dept_count'] : '' ?>" type="text" class="form-control" id="exp_dept_count" name="exp_dept_count[]"
placeholder="Enter Lives">
</div>
<div class="form-group col-md-3 renewalFields" style="display: none;">
<label for="exp_no_of_lives"> Total Lives at Expiry <span class="text-danger">*</span></label>
<input value="<?= isset($lead_edit_data['exp_no_of_lives']) ? $lead_edit_data['exp_no_of_lives'] : '' ?>" type="text" class="form-control" id="exp_no_of_lives" name="exp_no_of_lives[]"
placeholder="Enter Lives">
</div>
</div>

92
app/Views/rfq/gpa.php Normal file
View File

@ -0,0 +1,92 @@
<hr>
<div class="form-row" >
<div class="form-group col-md-3">
<label for="incept_emp_count" class="emp_title"> No of Employees at Inception <span class="text-danger">*</span></label>
<input value="<?= isset($lead_edit_data['incept_emp_count']) ? $lead_edit_data['incept_emp_count'] : '' ?>" type="text" class="form-control" id="incept_emp_count" name="incept_emp_count[]" placeholder="Enter Lives" required>
</div>
<div class="form-group col-md-3">
<label for="total_si_at_incept" class="total_title"> Total Sum Insured at Inception <span class="text-danger">*</span></label>
<input value="<?= isset($lead_edit_data['total_si_at_incept']) ? $lead_edit_data['total_si_at_incept'] : '' ?>" type="text" class="form-control" id="total_si_at_incept" name="total_si_at_incept[]" placeholder="Enter Lives" required>
</div>
<div class="form-group col-md-3 renewalFields">
<label for="renewal_emp_count"> No of Employees at Renewal <span class="text-danger">*</span></label>
<input value="<?= isset($lead_edit_data['renewal_emp_count']) ? $lead_edit_data['renewal_emp_count'] : '' ?>" type="text" class="form-control" id="renewal_emp_count" name="renewal_emp_count[]" placeholder="Enter Lives" >
</div>
<div class="form-group col-md-3 renewalFields">
<label for="total_si_at_renewal"> Total Sum Insured at Renewal <span class="text-danger">*</span></label>
<input value="<?= isset($lead_edit_data['total_si_at_renewal']) ? $lead_edit_data['total_si_at_renewal'] : '' ?>" type="text" class="form-control" id="total_si_at_renewal" name="total_si_at_renewal[]" placeholder="Enter Lives" >
</div>
</div>
<hr>
<?php if(isset($lead_edit_data)) { ?>
<div class="form-row" id="appendAreaForClaim_1">
<?php
$claims = !empty($lead_edit_data['fin_years_claims_array']) ? $lead_edit_data['fin_years_claims_array'] : [ ['year' => '', 'claim_amount' => '', 'status' => '', 'claim_type' => '', 'cause_of_death' => '', 'death_date' => ''] ];
foreach ($claims as $key => $value) { ?>
<div class="row claim-row">
<div class="form-group col-md-2">
<label for="first_year">Year<span class="text-danger">*</span></label>
<select class="form-control first_year_" id="first_year" name="first_year[]">
<option value="">Select Year</option>
<?php foreach ($lastFiveYears as $year) {
$selected = ($year == $value['year']) ? 'selected' : '';
echo "<option value='$year' $selected>$year</option>";
} ?>
</select>
</div>
<div class="form-group col-md-2">
<label for="first_claim_amount">Claim/Settled Amount<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="first_claim_amount" name="first_claim_amount[]" value="<?= htmlspecialchars($value['claim_amount']) ?>">
</div>
<div class="form-group col-md-2">
<label for="first_claim_status">Claim Status<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="first_claim_status" name="first_claim_status[]" value="<?= htmlspecialchars($value['status']) ?>">
</div>
<div class="form-group col-md-2 lifeClaimFields" style="display:none;">
<label for="first_cause_of_death">Nature/Cause Of Death <span class="text-danger">*</span></label>
<select class="form-control" id="first_cause_of_death" name="first_cause_of_death[]">
<option value="">Select Cause of Death</option>
<?php foreach ($causeOfDeath as $cause => $death_value) {
$selected = ($cause == $value['cause_of_death']) ? 'selected' : '';
echo "<option value='$cause' $selected>$death_value</option>";
} ?>
</select>
</div>
<div class="form-group col-md-2 lifeClaimFields" style="display:none;">
<label for="first_death_date">Date of Death<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="first_death_date" name="first_death_date[]" value="<?= htmlspecialchars($value['death_date']) ?>">
</div>
<div class="form-group col-md-2 gpaClaimFileds" style="display:none;">
<label for="claim_type">Claim Type<span class="text-danger">*</span></label>
<select class="form-control" id="claim_type" name="claim_type[]">
<option value="">Select Claim Type</option>
<?php foreach ($gpaClaimType as $claimType => $claim_value) {
$selected = ($claimType == $value['claim_type']) ? 'selected' : '';
echo "<option value='$claimType' $selected>$claim_value</option>";
} ?>
</select>
</div>
<div class="form-group col-md-2">
<div class="" style="position: relative; top: 28px; float: right; text-align: end;">
<a class="btn btn-danger waves-effect waves-light" onclick="removeClaim(this, 1)">x</a>
<a class="btn btn-primary waves-effect waves-light mr-1" onclick="appendThreeYearsClaims(1)">+</a>
</div>
</div>
</div>
<?php } ?>
</div>
<?php } else { ?>
<div class="form-row" id="appendAreaForClaim"></div>
<?php } ?>

186
app/Views/rfq/marine.php Normal file
View File

@ -0,0 +1,186 @@
<hr>
<div class="form-row custom_fields">
<!-- Policy Period -->
<div class="form-group col-md-3">
<label for="policy_period">Policy Period</label>
<select class="form-control" id="policy_period" name="policy_period">
<?php for ($i = 1; $i <= 24; $i++) {
$selected = (isset($lead_edit_data) && $lead_edit_data['policy_period'] == $i) ? 'selected' : '';
?>
<option value="<?= $i ?>" <?= $selected; ?>><?= $i ?> Month</option>
<?php } ?>
</select>
</div>
<!-- Commodity Type -->
<div class="form-group col-md-3">
<label for="commodity_type">Commodity Type</label>
<select class="form-control" id="commodity_type" name="commodity_type">
<option value="new_machinery_or_equipment_for_industrial_use"
<?= (isset($lead_edit_data) && $lead_edit_data['commodity_type'] == 'new_machinery_or_equipment_for_industrial_use') ? 'selected' : ''; ?>>
New machinery or equipment for industrial use
</option>
<option value="iron_steel_rods_metal_pipes_tubes"
<?= (isset($lead_edit_data) && $lead_edit_data['commodity_type'] == 'iron_steel_rods_metal_pipes_tubes') ? 'selected' : ''; ?>>
Iron & steel rods, metal pipes, tubes
</option>
<option value="electronic_and_white_goods"
<?= (isset($lead_edit_data) && $lead_edit_data['commodity_type'] == 'electronic_and_white_goods') ? 'selected' : ''; ?>>
Electronic and white goods
</option>
<option value="automobiles"
<?= (isset($lead_edit_data) && $lead_edit_data['commodity_type'] == 'automobiles') ? 'selected' : ''; ?>>
Automobiles
</option>
<option value="all_types_of_fmcg_commodities"
<?= (isset($lead_edit_data) && $lead_edit_data['commodity_type'] == 'all_types_of_fmcg_commodities') ? 'selected' : ''; ?>>
All types of FMCG commodities
</option>
<option value="other"
<?= (isset($lead_edit_data) && $lead_edit_data['commodity_type'] == 'other') ? 'selected' : ''; ?>>
Other
</option>
</select>
</div>
<!-- Mode of Transit -->
<div class="form-group col-md-3">
<label for="mode_of_transit">Mode of Transit</label>
<select class="form-control" id="mode_of_transit" name="mode_of_transit">
<option value="air" <?= (isset($lead_edit_data) && $lead_edit_data['mode_of_transit'] == 'air') ? 'selected' : ''; ?>>Air</option>
<option value="courier" <?= (isset($lead_edit_data) && $lead_edit_data['mode_of_transit'] == 'courier') ? 'selected' : ''; ?>>Courier</option>
<option value="registered_post" <?= (isset($lead_edit_data) && $lead_edit_data['mode_of_transit'] == 'registered_post') ? 'selected' : ''; ?>>Registered Post</option>
<option value="rail" <?= (isset($lead_edit_data) && $lead_edit_data['mode_of_transit'] == 'rail') ? 'selected' : ''; ?>>Rail</option>
<option value="road" <?= (isset($lead_edit_data) && $lead_edit_data['mode_of_transit'] == 'road') ? 'selected' : ''; ?>>Road</option>
<option value="sea" <?= (isset($lead_edit_data) && $lead_edit_data['mode_of_transit'] == 'sea') ? 'selected' : ''; ?>>Sea</option>
</select>
</div>
<!-- Coverage -->
<div class="form-group col-md-3">
<label for="coverage">Coverage</label>
<select class="form-control" id="coverage" name="coverage">
<option value="icc_a" <?= (isset($lead_edit_data) && $lead_edit_data['coverage'] == 'icc_a') ? 'selected' : ''; ?>>ICC A</option>
<option value="srcc" <?= (isset($lead_edit_data) && $lead_edit_data['coverage'] == 'srcc') ? 'selected' : ''; ?>>SRCC</option>
<option value="war" <?= (isset($lead_edit_data) && $lead_edit_data['coverage'] == 'war') ? 'selected' : ''; ?>>WAR</option>
<option value="including_loading_and_unloading" <?= (isset($lead_edit_data) && $lead_edit_data['coverage'] == 'including_loading_and_unloading') ? 'selected' : ''; ?>>Including Loading and Unloading</option>
<option value="itc_b" <?= (isset($lead_edit_data) && $lead_edit_data['coverage'] == 'itc_b') ? 'selected' : ''; ?>>ITC B</option>
</select>
</div>
<!-- What type of cover do you want? -->
<div class="form-group col-md-3">
<label>What type of cover do you want?</label><br>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="cover_type" value="single_transit"
<?= (isset($lead_edit_data) && $lead_edit_data['cover_type'] == 'single_transit') ? 'checked' : ''; ?>>
<label class="form-check-label">Single Transit</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="cover_type" value="annual_open"
<?= (isset($lead_edit_data) && $lead_edit_data['cover_type'] == 'annual_open') ? 'checked' : ''; ?>>
<label class="form-check-label">Annual Open</label>
</div>
</div>
<!-- Where will your goods be shipped? -->
<div class="form-group col-md-3">
<label>Where will your goods be shipped?</label><br>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="shipping_location" value="inland_domestic"
<?= (isset($lead_edit_data) && $lead_edit_data['shipping_location'] == 'inland_domestic') ? 'checked' : ''; ?>>
<label class="form-check-label">Inland (Domestic)</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="shipping_location" value="export"
<?= (isset($lead_edit_data) && $lead_edit_data['shipping_location'] == 'export') ? 'checked' : ''; ?>>
<label class="form-check-label">Export</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="shipping_location" value="import"
<?= (isset($lead_edit_data) && $lead_edit_data['shipping_location'] == 'import') ? 'checked' : ''; ?>>
<label class="form-check-label">Import</label>
</div>
</div>
<!-- Type of Goods in Transit -->
<div class="form-group col-md-3">
<label>Please select the type of goods in transit</label><br>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="goods_type" value="new_goods"
<?= (isset($lead_edit_data) && $lead_edit_data['goods_type'] == 'new_goods') ? 'checked' : ''; ?>>
<label class="form-check-label">New Goods</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="goods_type" value="old_goods"
<?= (isset($lead_edit_data) && $lead_edit_data['goods_type'] == 'old_goods') ? 'checked' : ''; ?>>
<label class="form-check-label">Old Goods</label>
</div>
</div>
<!-- Standard of Packing -->
<div class="form-group col-md-3">
<label>Standard of Packing</label><br>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="packing_standard" value="standard_packing"
<?= (isset($lead_edit_data) && $lead_edit_data['packing_standard'] == 'standard_packing') ? 'checked' : ''; ?>>
<label class="form-check-label">Standard Packing</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="packing_standard" value="customary_packing"
<?= (isset($lead_edit_data) && $lead_edit_data['packing_standard'] == 'customary_packing') ? 'checked' : ''; ?>>
<label class="form-check-label">Customary Packing</label>
</div>
</div>
<!-- Estimated Annual Sales -->
<div class="form-group col-md-3">
<label for="annual_sales">Estimated Annual Sales</label>
<input value="<?= isset($lead_edit_data['annual_sales']) ? $lead_edit_data['annual_sales'] : '' ?>" type="text" class="form-control" id="annual_sales" name="annual_sales">
</div>
<!-- Limit Per Location -->
<div class="form-group col-md-3">
<label for="limit_per_location">Limit Per Location</label>
<input value="<?= isset($lead_edit_data['limit_per_location']) ? $lead_edit_data['limit_per_location'] : '' ?>" type="text" class="form-control" id="limit_per_location" name="limit_per_location">
</div>
<!-- Single Carrying Limit -->
<div class="form-group col-md-3">
<label for="single_carrying_limit">Single Carrying Limit</label>
<input value="<?= isset($lead_edit_data['single_carrying_limit']) ? $lead_edit_data['single_carrying_limit'] : '' ?>" type="text" class="form-control" id="single_carrying_limit" name="single_carrying_limit">
</div>
<!-- Basis of Valuation -->
<div class="form-group col-md-3">
<label for="basis_of_valuation">Basis of Valuation</label>
<input value="<?= isset($lead_edit_data['basis_of_valuation']) ? $lead_edit_data['basis_of_valuation'] : '' ?>" type="text" class="form-control" id="basis_of_valuation" name="basis_of_valuation">
</div>
<!-- Description of Cargo -->
<div class="form-group col-md-3">
<label for="cargo_description">Description of Cargo</label>
<input value="<?= isset($lead_edit_data['cargo_description']) ? $lead_edit_data['cargo_description'] : '' ?>" type="text" class="form-control" id="cargo_description" name="cargo_description">
</div>
<!-- Excess -->
<div class="form-group col-md-3">
<label for="excess">Excess</label>
<input value="<?= isset($lead_edit_data['excess']) ? $lead_edit_data['excess'] : '' ?>" type="text" class="form-control" id="excess" name="excess">
</div>
<!-- Address -->
<div class="form-group col-md-6">
<label for="address">Address</label>
<textarea class="form-control" id="address" name="address" rows="1">value="<?= isset($lead_edit_data['address']) ? $lead_edit_data['address'] : '' ?>"</textarea>
</div>
</div>

75
app/Views/rfq/money.php Normal file
View File

@ -0,0 +1,75 @@
<hr>
<div class="form-row custom_fields">
<!-- Risk Location -->
<div class="form-group col-md-6">
<label>Risk Location</label>
<div>
<?php
$risk_location = isset($lead_edit_data['risk_location']) ? $lead_edit_data['risk_location'] : '';
?>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" id="single" name="risk_location" value="Single" <?= ($risk_location == 'Single') ? 'checked' : ''; ?>>
<label class="form-check-label" for="single">Single</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" id="multi_floater" name="risk_location" value="multi_with_floter" <?= ($risk_location == 'multi_with_floter') ? 'checked' : ''; ?>>
<label class="form-check-label" for="multi_floater">Multi with Floter</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" id="multi_no_floater" name="risk_location" value="multi_without_floter" <?= ($risk_location == 'multi_without_floter') ? 'checked' : ''; ?>>
<label class="form-check-label" for="multi_no_floater">Multi without Floater</label>
</div>
</div>
</div>
<!-- Policy Period -->
<div class="form-group col-md-3">
<label for="policy_period">Policy Period</label>
<select class="form-control" id="policy_period" name="policy_period">
<?php
$selected_period = isset($lead_edit_data['policy_period']) ? $lead_edit_data['policy_period'] : '';
for ($i = 1; $i <= 24; $i++) :
?>
<option value="<?= $i ?>" <?= ($selected_period == $i) ? 'selected' : ''; ?>><?= $i ?> Month</option>
<?php endfor; ?>
</select>
</div>
<!-- Estimated Annual Turnover -->
<div class="form-group col-md-3">
<label for="estimated_turnover">Estimated Annual Turnover</label>
<input type="text" class="form-control" id="estimated_turnover" name="estimated_turnover" value="<?= isset($lead_edit_data['estimated_turnover']) ? htmlspecialchars($lead_edit_data['estimated_turnover']) : ''; ?>">
</div>
<!-- Single Carrying Limit -->
<div class="form-group col-md-3">
<label for="single_carrying_limit">Single Carrying Limit</label>
<input type="text" class="form-control" id="single_carrying_limit" name="single_carrying_limit" value="<?= isset($lead_edit_data['single_carrying_limit']) ? htmlspecialchars($lead_edit_data['single_carrying_limit']) : ''; ?>">
</div>
<!-- Cash in Safe -->
<div class="form-group col-md-3">
<label for="cash_in_safe">Cash in Safe</label>
<input type="text" class="form-control" id="cash_in_safe" name="cash_in_safe" value="<?= isset($lead_edit_data['cash_in_safe']) ? htmlspecialchars($lead_edit_data['cash_in_safe']) : ''; ?>">
</div>
<!-- Cash in TILL -->
<div class="form-group col-md-3">
<label for="cash_in_till">Cash in TILL</label>
<input type="text" class="form-control" id="cash_in_till" name="cash_in_till" value="<?= isset($lead_edit_data['cash_in_till']) ? htmlspecialchars($lead_edit_data['cash_in_till']) : ''; ?>">
</div>
<!-- Description -->
<div class="form-group col-md-3">
<label for="description">Description</label>
<textarea class="form-control" id="description" name="description" rows="1"><?= isset($lead_edit_data['description']) ? htmlspecialchars($lead_edit_data['description']) : ''; ?></textarea>
</div>
<!-- Communication Address -->
<div class="form-group col-md-6">
<label for="address">Communication Address</label>
<textarea class="form-control" id="address" name="address" rows="1"><?= isset($lead_edit_data['address']) ? htmlspecialchars($lead_edit_data['address']) : ''; ?></textarea>
</div>
</div>

35
app/Views/rfq/office.php Normal file
View File

@ -0,0 +1,35 @@
<hr>
<div class="form-row custom_fields">
<!-- Risk Location -->
<div class="form-group col-md-5">
<label>Risk Location</label><br>
<?php $risk_location = isset($lead_edit_data['risk_location']) ? $lead_edit_data['risk_location'] : ''; ?>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="risk_location" value="single" <?= ($risk_location == 'single') ? 'checked' : ''; ?>>
<label class="form-check-label">Single</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="risk_location" value="multi_with_floter" <?= ($risk_location == 'multi_with_floter') ? 'checked' : ''; ?>>
<label class="form-check-label">Multi with Floater</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="risk_location" value="multi_without_floter" <?= ($risk_location == 'multi_without_floter') ? 'checked' : ''; ?>>
<label class="form-check-label">Multi without Floater</label>
</div>
</div>
<!-- Business Description -->
<div class="form-group col-md-3">
<label for="business_description">Business Description</label>
<textarea class="form-control" id="business_description" name="business_description" rows="1"><?= isset($lead_edit_data['business_description']) ? htmlspecialchars($lead_edit_data['business_description']) : ''; ?></textarea>
</div>
<!-- Address -->
<div class="form-group col-md-4">
<label for="address">Address</label>
<textarea class="form-control" id="address" name="address" rows="1"><?= isset($lead_edit_data['address']) ? htmlspecialchars($lead_edit_data['address']) : ''; ?></textarea>
</div>
</div>

43
app/Views/rfq/sfsp.php Normal file
View File

@ -0,0 +1,43 @@
<hr>
<div class="form-row custom_fields">
<!-- Risk Location -->
<div class="form-group col-md-6">
<label>Risk Location</label>
<div>
<?php $risk_location = isset($lead_edit_data['risk_location']) ? $lead_edit_data['risk_location'] : ''; ?>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" id="single" name="risk_location" value="Single" <?= ($risk_location == 'Single') ? 'checked' : ''; ?>>
<label class="form-check-label" for="single">Single</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" id="multi_floater" name="risk_location" value="multi_with_floter" <?= ($risk_location == 'multi_with_floter') ? 'checked' : ''; ?>>
<label class="form-check-label" for="multi_floater">Multi with Floater</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" id="multi_no_floater" name="risk_location" value="multi_without_floter" <?= ($risk_location == 'multi_without_floter') ? 'checked' : ''; ?>>
<label class="form-check-label" for="multi_no_floater">Multi without Floater</label>
</div>
</div>
</div>
<!-- Product -->
<div class="form-group col-md-3">
<label for="product">Product</label>
<input type="text" class="form-control" id="product" name="product" value="<?= isset($lead_edit_data['product']) ? htmlspecialchars($lead_edit_data['product']) : ''; ?>">
</div>
<!-- Nature of Business -->
<div class="form-group col-md-3">
<label for="nature_of_business">Nature of Business</label>
<input type="text" class="form-control" id="nature_of_business" name="nature_of_business" value="<?= isset($lead_edit_data['nature_of_business']) ? htmlspecialchars($lead_edit_data['nature_of_business']) : ''; ?>">
</div>
<!-- Communication Address -->
<div class="form-group col-md-6">
<label for="address">Communication Address</label>
<textarea class="form-control" id="address" name="address" rows="1"><?= isset($lead_edit_data['address']) ? htmlspecialchars($lead_edit_data['address']) : ''; ?></textarea>
</div>
</div>

42
app/Views/rfq/wc.php Normal file
View File

@ -0,0 +1,42 @@
<hr>
<div class="form-row custom_fields">
<!-- Proposal Type -->
<div class="form-group col-md-3">
<label for="proposal_type">Proposal Type</label>
<input type="text" class="form-control" id="proposal_type" name="proposal_type" value="<?= isset($lead_edit_data['proposal_type']) ? htmlspecialchars($lead_edit_data['proposal_type']) : ''; ?>">
</div>
<!-- GST -->
<div class="form-group col-md-3">
<label for="gst">GST</label>
<input type="text" class="form-control" id="gst" name="gst" value="<?= isset($lead_edit_data['gst']) ? htmlspecialchars($lead_edit_data['gst']) : ''; ?>">
</div>
<!-- Trade Description -->
<div class="form-group col-md-3">
<label for="trade_description">Trade Description</label>
<input type="text" class="form-control" id="trade_description" name="trade_description" value="<?= isset($lead_edit_data['trade_description']) ? htmlspecialchars($lead_edit_data['trade_description']) : ''; ?>">
</div>
<!-- Jurisdiction -->
<div class="form-group col-md-3">
<label for="jurisdiction">Jurisdiction</label>
<input type="text" class="form-control" id="jurisdiction" name="jurisdiction" value="<?= isset($lead_edit_data['jurisdiction']) ? htmlspecialchars($lead_edit_data['jurisdiction']) : ''; ?>">
</div>
<!-- Address of the Premises to be Insured -->
<div class="form-group col-md-6">
<label for="premises_address">Address of the Premises to be Insured</label>
<textarea class="form-control" id="premises_address" name="premises_address" rows="1"><?= isset($lead_edit_data['premises_address']) ? htmlspecialchars($lead_edit_data['premises_address']) : ''; ?></textarea>
</div>
<!-- Communication Address -->
<div class="form-group col-md-6">
<label for="address">Communication Address</label>
<textarea class="form-control" id="address" name="address" rows="1"><?= isset($lead_edit_data['address']) ? htmlspecialchars($lead_edit_data['address']) : ''; ?></textarea>
</div>
</div>

View File

@ -608,7 +608,7 @@
$('#rfq_qcr_page_title').text('RFQ - ' + titile_client_name)
}
let excel_url = '<?= base_url('leads/exportQCRandRFQ/') ?>' + lead_id + '/' + type_for_url + '/' + 'excel'
let excel_url = '<?= base_url('leads/exportQCRandRFQ/') ?>' + lead_id + '/' + type_for_url + '/' + 1
$('#submitExcel').attr('data-url', excel_url);
// let mail_url = '<?= base_url('leads/exportQCRandRFQ/') ?>' + lead_id + '/' + type_for_url + '/' + 'mail'