Merge branch 'dev' of bitbucket.org:jubilian/nhance into dev
This commit is contained in:
commit
e491214299
@ -352,6 +352,7 @@ $routes->group("/util", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->get('getTheEmpDataForClaimSearchByMobile/(:any)', 'ClientController::getTheEmpDataForClaimSearchByMobile/$1');
|
||||
$routes->get('getLeadNonEB/(:any)', 'LeadsController::getLeadNonEB/$1');
|
||||
$routes->get('getPolicyTypeFields', 'LeadsController::getPolicyTypeFields');
|
||||
$routes->get('removeMultiFile', 'LeadsController::removeMultiFile');
|
||||
});
|
||||
|
||||
$routes->group("policy_tranction", ["filter" => "authMVC"], function ($routes) {
|
||||
|
||||
@ -17,10 +17,14 @@ class EcardDownloadConversation extends Conversation
|
||||
|
||||
protected function showEcardMenu()
|
||||
{
|
||||
log_message('error', ('showEcardMenu function called'));
|
||||
|
||||
$chat_session_info = get_chatbot_session_info();
|
||||
$policy_list = ChatbotHelper::getListOfPolicies($chat_session_info);
|
||||
$buttons = [];
|
||||
$question = 'Choose Policy to Download Ecard:';
|
||||
log_message('error', ('policy_list : ' . json_encode($policy_list)));
|
||||
|
||||
if(is_array($policy_list) && count($policy_list))
|
||||
{
|
||||
foreach($policy_list as $policy)
|
||||
|
||||
@ -46,9 +46,16 @@ class MainMenuConversation extends Conversation
|
||||
$this->bot->reply($message);
|
||||
}
|
||||
|
||||
log_message('error', ('user_reponse before: ' . $user_reponse));
|
||||
|
||||
|
||||
if (!$answer->isInteractiveMessageReply()) {
|
||||
$user_reponse = null;
|
||||
}
|
||||
|
||||
log_message('error', ('user_reponse is interactive: ' . $answer->isInteractiveMessageReply()));
|
||||
|
||||
|
||||
// Get just the existing path array
|
||||
$path = $this->bot->userStorage()->get('path') ?? [];
|
||||
|
||||
@ -60,25 +67,35 @@ class MainMenuConversation extends Conversation
|
||||
'path' => $path
|
||||
]);
|
||||
|
||||
log_message('error', ('user_reponse after: ' . $user_reponse));
|
||||
|
||||
|
||||
switch ($user_reponse) {
|
||||
|
||||
case "ecard_download":
|
||||
$this->bot->startConversation(new EcardDownloadConversation());
|
||||
log_message('error', 'ecard_download clicked ');
|
||||
|
||||
break;
|
||||
case "network_hospital":
|
||||
$this->bot->startConversation(new NetworkHospitalConversation());
|
||||
log_message('error', 'network_hospital clicked ');
|
||||
break;
|
||||
case "reimbursement_claim":
|
||||
$this->bot->startConversation(new ReimbursementClaimProcessConversation());
|
||||
log_message('error', 'reimbursement_claim clicked ');
|
||||
break;
|
||||
case "reimbursement_status":
|
||||
$this->bot->startConversation(new ReimbursementClaimStatusConversation());
|
||||
log_message('error', 'reimbursement_status clicked ');
|
||||
break;
|
||||
case "new_policy":
|
||||
case "renew_policy":
|
||||
$this->bot->startConversation(new policyConversation());
|
||||
log_message('error', 'renew_policy || new_policy clicked ');
|
||||
break;
|
||||
default:
|
||||
log_message('error', 'default shown ');
|
||||
$this->say("Invalid selection. Please choose an option.");
|
||||
$this->bot->startConversation(new MainMenuConversation());
|
||||
break;
|
||||
|
||||
@ -59,7 +59,10 @@ class NetworkHospitalConversation extends Conversation
|
||||
$this->bot->userStorage()->save([
|
||||
'path' => $path
|
||||
]);
|
||||
log_message('error', ('user_reponse : ' . $answer->getValue()));
|
||||
|
||||
switch ($answer->getValue()) {
|
||||
|
||||
case is_string($answer->getValue()) && is_array(explode('#',$answer->getValue())) && count((explode('#',$answer->getValue()))) == 2:
|
||||
|
||||
$client_poilicy_id = explode('#',$answer->getValue())[1];
|
||||
|
||||
@ -46,6 +46,9 @@ class policyConversation extends Conversation
|
||||
if (!$answer->isInteractiveMessageReply()) {
|
||||
$user_reponse = null;
|
||||
}
|
||||
|
||||
log_message('error', ('user_reponse : ' . $answer->getValue()));
|
||||
|
||||
$path = $this->bot->userStorage()->get('path');
|
||||
array_push($path,
|
||||
$answer->getValue()
|
||||
|
||||
@ -84,12 +84,13 @@ class ChatbotControllerNew extends BaseController
|
||||
|
||||
public function index()
|
||||
{
|
||||
|
||||
if($this->session->get('CHATBOT_RANDOM_USER_ID') == '-' || $this->session->get('CHATBOT_RANDOM_USER_ID') == '')
|
||||
{
|
||||
|
||||
$user = $this->botman->getUser();
|
||||
$id = $user->getId();
|
||||
// $this->myLogger->logme('error', ('TEST' . $id));
|
||||
$this->myLogger->logme('error', ('TEST' . $id));
|
||||
$this->session->set('CHATBOT_RANDOM_USER_ID', $id);
|
||||
}
|
||||
|
||||
@ -100,6 +101,7 @@ class ChatbotControllerNew extends BaseController
|
||||
}
|
||||
|
||||
$this->botman->hears('.*', function ($bot) {
|
||||
log_message("error","Inside Bot Type Function");
|
||||
|
||||
$bot->types(); // Typing indicator for the first message
|
||||
sleep(0.5); // Delay
|
||||
@ -128,14 +130,14 @@ class ChatbotControllerNew extends BaseController
|
||||
$this->botman->listen();
|
||||
}
|
||||
|
||||
private function registerHandlers()
|
||||
{
|
||||
// Handling Policy and Claims
|
||||
$this->botman->hears('group:policy:{option}', [\App\Controllers\Chatbot\PolicyHandler::class, 'handle']);
|
||||
$this->botman->hears('group:claim:{option}', [\App\Libraries\Chatbot\ClaimHandler::class, 'handle']);
|
||||
// private function registerHandlers()
|
||||
// {
|
||||
// // Handling Policy and Claims
|
||||
// $this->botman->hears('group:policy:{option}', [\App\Controllers\Chatbot\PolicyHandler::class, 'handle']);
|
||||
// $this->botman->hears('group:claim:{option}', [\App\Libraries\Chatbot\ClaimHandler::class, 'handle']);
|
||||
|
||||
|
||||
}
|
||||
// }
|
||||
|
||||
public function chatbot()
|
||||
{
|
||||
|
||||
@ -1994,9 +1994,22 @@ class ClientController extends AdminController
|
||||
|
||||
if ($id) {
|
||||
$client_policy_data = $this->clientPolicyModel->where(['id' => $id, 'is_active' => 1])->first();
|
||||
|
||||
$insurer_id = $client_policy_data['insurer_id'];
|
||||
$client_id = $client_policy_data['client_id'];
|
||||
|
||||
if (!empty($client_policy_data['policy_start_date'])) {
|
||||
$client_policy_data['source_policy_start_date'] = change_date_format($client_policy_data['policy_start_date'], 'Y-m-d', 'd/m/Y');
|
||||
} else {
|
||||
$client_policy_data['source_policy_start_date'] = null;
|
||||
}
|
||||
|
||||
if (!empty($client_policy_data['policy_end_date'])) {
|
||||
$client_policy_data['source_policy_end_date'] = change_date_format($client_policy_data['policy_end_date'], 'Y-m-d', 'd/m/Y');
|
||||
} else {
|
||||
$client_policy_data['source_policy_end_date'] = null;
|
||||
}
|
||||
|
||||
$polices = $this->policesModel
|
||||
->select('policies.*, policy_type.policy_type')
|
||||
->join('policy_type', 'policy_type.id = policies.policy_type_id')
|
||||
@ -2022,7 +2035,7 @@ class ClientController extends AdminController
|
||||
'policy' => $polices,
|
||||
'client_policy_list' => $client_policy_list,
|
||||
'end_date' => $newDate,
|
||||
'new_start_date' => date('d/m/Y', strtotime($client_policy_data['policy_end_date']))
|
||||
'new_start_date' => date('d/m/Y', strtotime($client_policy_data['policy_end_date'] . ' +1 day')),
|
||||
], 200);
|
||||
} else {
|
||||
return $this->respond(['status' => false, 'code' => 404, 'message' => 'no data found'], 200);
|
||||
@ -4740,8 +4753,7 @@ class ClientController extends AdminController
|
||||
// }
|
||||
|
||||
// $data = $this->leadsModel->where('leads.id', 125)->where('leads.is_active', 1)->first();
|
||||
// $RFQdata = $RFQModel->getRFQTableDataWithLeadIDAndType(125, 2);
|
||||
// // Kint::dump($RFQdata);
|
||||
// $RFQdata = $RFQModel->getRFQTableDataWithLeadIDAndType(145, 2);
|
||||
// $returnData = $LeadsController->getPlacementJson($data);
|
||||
// Kint::dump($returnData);
|
||||
// $policy_terms = $LeadsController->convertNonEbQCRJsonToPolicyTerms(json_decode($returnData, true));
|
||||
@ -4751,6 +4763,20 @@ class ClientController extends AdminController
|
||||
// $this->clientPolicyModel->where('id', 6050)->set('policy_terms', $policy_terms)->update();
|
||||
// dd($returnData);
|
||||
|
||||
// Kint::dump($RFQdata['json']);
|
||||
// $inputJson = json_decode($RFQdata['json'], true);
|
||||
// Kint::dump($inputJson);
|
||||
// // print_rr($inputJson['table_data']);
|
||||
// $sortedJson = $this->reorderProposalsByInsurerTotal($inputJson);
|
||||
|
||||
// // If you want to convert back to JSON string
|
||||
// $finalJson = json_encode($sortedJson, JSON_PRETTY_PRINT);
|
||||
|
||||
// // $RFQModel->insert(['lead_id' => 145, 'json' => $finalJson, 'type' => 1]);
|
||||
|
||||
// dd($finalJson);
|
||||
|
||||
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------
|
||||
@ -5456,6 +5482,207 @@ class ClientController extends AdminController
|
||||
$id = $InsurerModel->insert($insurerData);
|
||||
return $id;
|
||||
}
|
||||
|
||||
private function reorderProposalsByInsurerTotal(array $data): array {
|
||||
|
||||
Kint::dump($data);
|
||||
if (!isset($data['premium_data']['data'])) return $data;
|
||||
|
||||
$original = $data['premium_data']['data'];
|
||||
$proposals = [];
|
||||
$others = [];
|
||||
$emptyKeyData = [];
|
||||
|
||||
foreach ($original as $key => $value) {
|
||||
// Match only keys that look like 'Proposal X'
|
||||
if (preg_match('/^Proposal\s+\d+$/', $key)) {
|
||||
// Get the insurer entry (not 'Quote Asked')
|
||||
foreach ($value as $subKey => $subVal) {
|
||||
if ($subKey !== 'Quote Asked' && isset($subVal['Total'])) {
|
||||
$proposals[$key] = $value;
|
||||
break;
|
||||
}else{
|
||||
$proposals[$key] = $value;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
if ($key === '' && isset($value['']) && is_array($value[''])) {
|
||||
// Capture empty key to push it later
|
||||
$emptyKeyData[$key] = $value;
|
||||
}else{
|
||||
$others[$key] = $value;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// dd($proposals, $others, $emptyKeyData);
|
||||
// Sort proposals by their insurer's total
|
||||
uasort($proposals, function($a, $b) {
|
||||
$totalA = 0;
|
||||
$totalB = 0;
|
||||
|
||||
foreach ($a as $key => $val) {
|
||||
if ($key !== 'Quote Asked' && isset($val['Total'])) {
|
||||
$totalA = floatval($val['Total']);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($b as $key => $val) {
|
||||
if ($key !== 'Quote Asked' && isset($val['Total'])) {
|
||||
$totalB = floatval($val['Total']);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $totalA <=> $totalB;
|
||||
});
|
||||
|
||||
// Merge back the sorted proposals into the full structure
|
||||
$data['premium_data']['data'] = array_merge($others, $proposals, $emptyKeyData);
|
||||
$data = $this->reorderProposalDataByPremiumOrder($data);
|
||||
return $data;
|
||||
}
|
||||
|
||||
private function reorderProposalDataByPremiumOrder(array $data): array {
|
||||
if (!isset($data['premium_data']['data'], $data['proposal_data']['over_all_column_data'])) {
|
||||
return $data;
|
||||
}
|
||||
|
||||
$premiumProposals = array_keys($data['premium_data']['data']);
|
||||
$filteredProposals = [];
|
||||
|
||||
// Collect proposal keys that match the pattern "Proposal X"
|
||||
foreach ($premiumProposals as $key) {
|
||||
if (preg_match('/^Proposal\s+\d+$/', $key) && isset($data['proposal_data']['over_all_column_data'][$key])) {
|
||||
$filteredProposals[$key] = $data['proposal_data']['over_all_column_data'][$key];
|
||||
}
|
||||
}
|
||||
|
||||
// dd($premiumProposals, $filteredProposals);
|
||||
|
||||
$data['proposal_data']['over_all_column_data'] = $filteredProposals;
|
||||
$data = $this->reorderProposalInHeaderAndData($data);
|
||||
return $data;
|
||||
}
|
||||
|
||||
private function reorderProposalInHeaderAndData(array $data): array {
|
||||
|
||||
// Kint::dump($data);
|
||||
$tableData = $data['table_data'];
|
||||
$sortedProposalOrder = $data['proposal_data']['over_all_column_data'];
|
||||
$headers = $tableData['headers'] ?? [];
|
||||
$dataRows = $tableData['data'] ?? [];
|
||||
|
||||
// Step 1: Separate static and proposal headers
|
||||
$staticHeaders = [];
|
||||
$proposalHeaders = [];
|
||||
$actionHeader = [];
|
||||
foreach ($headers as $header) {
|
||||
if (in_array($header['parentHeader'], array_keys($sortedProposalOrder))) {
|
||||
$proposalHeaders[$header['parentHeader']] = $header;
|
||||
} else {
|
||||
if($header['parentHeader'] == "Action"){
|
||||
$actionHeader[] = $header;
|
||||
}else{
|
||||
$staticHeaders[] = $header;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// dd($staticHeaders, $proposalHeaders, $sortedProposalOrder);
|
||||
|
||||
// Step 2: Reorder headers
|
||||
$reorderedHeaders = [];
|
||||
foreach ($sortedProposalOrder as $proposalKey => $proposalValue) {
|
||||
if (isset($proposalHeaders[$proposalKey])) {
|
||||
$reorderedHeaders[] = $proposalHeaders[$proposalKey];
|
||||
}
|
||||
}
|
||||
|
||||
// print_rr($reorderedHeaders); die;
|
||||
foreach ($reorderedHeaders as $key => &$value) {
|
||||
$value['parentHeader'] = 'Proposal ' . ($key + 1);
|
||||
}
|
||||
unset($value);
|
||||
|
||||
|
||||
$reorderedHeaders = array_merge($staticHeaders, $reorderedHeaders, $actionHeader);
|
||||
|
||||
|
||||
// Step 3: Reorder each row's `data` by matching parentth
|
||||
foreach ($dataRows as $dataRowIndex => &$row) {
|
||||
$staticData = [];
|
||||
$proposalData = [];
|
||||
$actionData = [];
|
||||
|
||||
foreach ($row['data'] as $entry) {
|
||||
if (in_array($entry['parentth'], array_keys($sortedProposalOrder))) {
|
||||
$proposalData[$entry['parentth']][] = $entry;
|
||||
} else {
|
||||
if($entry['parentth'] == "Action"){
|
||||
$actionData[] = $entry;
|
||||
}else{
|
||||
$staticData[] = $entry;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$reorderedProposalData = [];
|
||||
foreach ($sortedProposalOrder as $proposalKey => $proposalValue) {
|
||||
if (isset($proposalData[$proposalKey])) {
|
||||
foreach ($proposalData[$proposalKey] as $entry) {
|
||||
$reorderedProposalData[] = $entry;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$dubParTh = "";
|
||||
$increament = 0;
|
||||
foreach ($reorderedProposalData as $key => &$value) {
|
||||
|
||||
if($dubParTh == $value['parentth']){
|
||||
$value['parentth'] = 'Proposal ' . ($increament);
|
||||
}else{
|
||||
$dubParTh = $value['parentth'];
|
||||
$increament = $increament + 1;
|
||||
$value['parentth'] = 'Proposal ' . ($increament);
|
||||
}
|
||||
}
|
||||
unset($value);
|
||||
|
||||
$row['data'] = array_merge($staticData, $reorderedProposalData, $actionData);
|
||||
}
|
||||
|
||||
$data['table_data']['headers'] = $reorderedHeaders;
|
||||
$data['table_data']['data'] = $dataRows;
|
||||
|
||||
// dd('-----', $data);
|
||||
$renumberedArray = $this->renumberProposalKeys($data['proposal_data']['over_all_column_data']);
|
||||
$updatedDataSet = $this->renumberProposalKeys($data['premium_data']['data']);
|
||||
$data['proposal_data']['over_all_column_data'] = !empty($renumberedArray) ? $renumberedArray : $data['proposal_data']['over_all_column_data'];
|
||||
$data['premium_data']['data'] = !empty($updatedDataSet) ? $updatedDataSet : $data['premium_data']['data'];
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
private function renumberProposalKeys(array $input): array {
|
||||
$result = [];
|
||||
$counter = 1;
|
||||
|
||||
foreach ($input as $key => $value) {
|
||||
if (strpos($key, 'Proposal') === 0) {
|
||||
$newKey = 'Proposal ' . $counter++;
|
||||
$result[$newKey] = $value;
|
||||
} else {
|
||||
$result[$key] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -3124,6 +3124,18 @@ class EmployeeRestController extends AdminController
|
||||
$client_policy_id = $received_data['client_policy_id'];
|
||||
$insured_emp_id = $received_data['insured_emp_id'];
|
||||
|
||||
if (empty($received_data['doa'])) {
|
||||
$received_data['doa'] = null;
|
||||
} else{
|
||||
$ticket_data['doa'] = change_date_format($received_data['doa']);
|
||||
}
|
||||
|
||||
if (empty($received_data['dod'])) {
|
||||
$received_data['dod'] = null;
|
||||
} else{
|
||||
$ticket_data['dod'] = change_date_format($received_data['dod']);
|
||||
}
|
||||
|
||||
$sql = "
|
||||
select
|
||||
cp.policy_type_id,
|
||||
@ -3166,11 +3178,19 @@ class EmployeeRestController extends AdminController
|
||||
if(!empty($emp_ticket_data)){
|
||||
|
||||
$fetchData = $emp_ticket_data[0];
|
||||
$fetchData['claim_status_id'] = $this->claimStatusModel
|
||||
->select('id')
|
||||
->where('ticket_type', $fetchData['ticket_type_id'])
|
||||
->orderBy('id', 'asc')
|
||||
->first()['id'];
|
||||
|
||||
$claimStatusQuery = $this->claimStatusModel
|
||||
->select('id')
|
||||
->where('ticket_type', $fetchData['ticket_type_id'])
|
||||
->orderBy('id', 'asc');
|
||||
|
||||
if ($fetchData['ticket_type_id'] == 1 && !empty($fetchData['tpa_no'])) {
|
||||
$results = $claimStatusQuery->findAll(2);
|
||||
$fetchData['claim_status_id'] = $results[1]['id'] ?? $results[0]['id'];
|
||||
} else {
|
||||
$fetchData['claim_status_id'] = $claimStatusQuery->first()['id'];
|
||||
}
|
||||
|
||||
|
||||
$fetchData['priority'] = 1;
|
||||
$fetchData['mode_of_intimation'] = 3;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -122,6 +122,7 @@ class TicketController extends BaseController
|
||||
'((CLAIM_FORM_LINK))' => 'claim_form_link',
|
||||
'((CLAIM_FEEDBACK_FORM))' => 'claim_feedback_form',
|
||||
'((SETTLED_LETTER))' => 'settle_letter',
|
||||
'((APPROVED_LETTER))' => 'approved_letter',
|
||||
];
|
||||
$this->extraFields = [
|
||||
1 => ['non_id_reason'],
|
||||
@ -774,13 +775,20 @@ class TicketController extends BaseController
|
||||
{
|
||||
// log_message('error','Function called');die();
|
||||
// $ticket_master_id = $this->request->getPost('id');
|
||||
$user_id = get_session_userid();
|
||||
$logged_user = $this->userModel->select('first_name,last_name,profile')->where('id', $user_id)->first();
|
||||
$dataToSend = [];
|
||||
$dataToSend['user_name'] = $logged_user['first_name'] . ' ' . $logged_user['last_name'];
|
||||
$dataToSend['messages'] = $this->ticketMessageModel->where('is_active', 1)
|
||||
->where('ticket_id', $ticket_master_id)->orderBy('created_at', 'DESC')
|
||||
|
||||
$user_id = get_session_userid();
|
||||
// $logged_user = $this->userModel->select('first_name,last_name,profile')->where('id', $user_id)->first();
|
||||
// $dataToSend['user_name'] = $logged_user['first_name'] . ' ' . $logged_user['last_name'];
|
||||
|
||||
$dataToSend['messages'] = $this->ticketMessageModel
|
||||
->select('ticket_messages.*,up.first_name as user_name')
|
||||
->join('user_profiles up', 'up.id = ticket_messages.created_by', 'left')
|
||||
->where('ticket_messages.is_active', 1)
|
||||
->where('ticket_messages.ticket_id', $ticket_master_id)
|
||||
->orderBy('ticket_messages.created_at', 'DESC')
|
||||
->findAll();
|
||||
|
||||
foreach ($dataToSend['messages'] as $message) {
|
||||
$mail_content_converted = $this->convertHtmlToText($message['mail_content']);
|
||||
$message['mail_content'] = $mail_content_converted;
|
||||
@ -907,6 +915,8 @@ class TicketController extends BaseController
|
||||
$replaceData = '<a href="' . base_url('claims-feedback-form/' . md5($ticket_data['id'])) . '" target="_blank">Click to open Claim Feedback Form</a>';
|
||||
} else if ($value == "settle_letter"){
|
||||
$replaceData = '<a href="' . $ticket_data['settle_letter'] . '" target="_blank"> View Settlement Letter </a>';
|
||||
}else if ($value == "approved_letter"){
|
||||
$replaceData = '<a href="' . $ticket_data['approved_letter'] . '" target="_blank"> View Approved Letter </a>';
|
||||
}else {
|
||||
$replaceData = isset($ticket_data[$value]) ? $ticket_data[$value] : '';
|
||||
}
|
||||
@ -1034,7 +1044,7 @@ class TicketController extends BaseController
|
||||
th.old_value,
|
||||
th.new_value,
|
||||
th.created_at,
|
||||
CONCAT(creator.first_name, ' ', creator.last_name) as modified_by,
|
||||
CONCAT_WS(' ', creator.first_name, creator.last_name) AS modified_by,
|
||||
-- Claim Status
|
||||
old_status.claim_status as old_status_value,
|
||||
new_status.claim_status as new_status_value,
|
||||
@ -1094,6 +1104,7 @@ class TicketController extends BaseController
|
||||
ORDER BY
|
||||
th.created_at DESC";
|
||||
$data = $this->ticketHistoryModel->query($sql)->getResultArray();
|
||||
// dd(db_connect()->getLastQuery());
|
||||
$priorityType = $this->priorityType;
|
||||
$relationshipType = $this->relationshipType;
|
||||
$modeOFIntimate = $this->modeOFIntimate;
|
||||
@ -1228,7 +1239,7 @@ class TicketController extends BaseController
|
||||
if ($policy_type == 1){
|
||||
$viewData['column_order'] = [
|
||||
'ACM_NAME', 'ID NOT GENERATED', 'NON ID', 'CDA', 'INFORMATION REQUIRED',
|
||||
'UNDER PROCESS - CLAIM NO. UPDATION', 'UNDER PROCESS - INVESTIGATION STATUS',
|
||||
'UNDER PROCESS - CLAIM NO. UPDATION',
|
||||
'UNDER PROCESS - QUERY DOCUMENT RECEIVED', 'APPROVED', 'PAYMENT INITIATED',
|
||||
'TOTAL'
|
||||
];
|
||||
@ -1247,7 +1258,7 @@ class TicketController extends BaseController
|
||||
}else{
|
||||
$viewData['column_order'] = [
|
||||
'ACM_NAME', 'CLAIM INTIMATION', 'INTIMATION TO INSURER', 'CLIENT PENDING',
|
||||
'INSURER PENDING','INVESTIGATION','APPROVED','ON HOLD','TOTAL', 'NOT COVERED',
|
||||
'INSURER PENDING','INVESTIGATION','APPROVED','TOTAL', 'NOT COVERED',
|
||||
'CLOSED', 'SETTLED', 'CLEARED_TOTAL'
|
||||
];
|
||||
$ordered_data = [];
|
||||
@ -1269,7 +1280,7 @@ class TicketController extends BaseController
|
||||
|
||||
$viewData['column_order'] = [
|
||||
'TPA_NAME', 'NON ID', 'ID NOT GENERATED', 'CDA', 'INFORMATION REQUIRED',
|
||||
'UNDER PROCESS - CLAIM NO. UPDATION', 'UNDER PROCESS - INVESTIGATION STATUS',
|
||||
'UNDER PROCESS - CLAIM NO. UPDATION',
|
||||
'UNDER PROCESS - QUERY DOCUMENT RECEIVED', 'APPROVED', 'PAYMENT INITIATED',
|
||||
'TOTAL', 'SETTLED', 'CLOSED', 'CANCELLED', 'RETURNED', 'CLEARED_TOTAL'
|
||||
];
|
||||
|
||||
@ -17,10 +17,13 @@ class ExcelMergeHelper {
|
||||
{
|
||||
try {
|
||||
log_message('debug', 'Attempting merge with original file order');
|
||||
// echo "Attempting merge with original file order\n";
|
||||
return self::processFiles($filePaths, $outputPath);
|
||||
} catch (Exception $e) {
|
||||
log_message('error', 'First attempt failed: ' . $e->getMessage() . ' in ' . $e->getFile() . ' on line ' . $e->getLine());
|
||||
// echo "First attempt failed: " . $e->getMessage() . ' in ' . $e->getFile() . ' on line ' . $e->getLine() . "\n";
|
||||
log_message('debug', 'Retrying with reversed file order');
|
||||
// echo "Retrying with reversed file order\n";
|
||||
|
||||
// Reverse the file order and try again
|
||||
$reversedFiles = array_reverse($filePaths);
|
||||
@ -29,6 +32,7 @@ class ExcelMergeHelper {
|
||||
return self::processFiles($reversedFiles, $outputPath);
|
||||
} catch (Exception $e2) {
|
||||
log_message('error', 'Both attempts failed. Last error: ' . $e2->getMessage() . ' in ' . $e2->getFile() . ' on line ' . $e2->getLine());
|
||||
// echo "Both attempts failed. Last error: " . $e2->getMessage() . ' in ' . $e2->getFile() . ' on line ' . $e2->getLine() . "\n";
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -45,7 +49,9 @@ class ExcelMergeHelper {
|
||||
private static function processFiles(array $filePaths, string $outputPath): string
|
||||
{
|
||||
log_message('debug', 'Starting Excel merge process');
|
||||
// echo "Starting Excel merge process\n";
|
||||
log_message('debug', 'Files to process: ' . json_encode($filePaths));
|
||||
// echo "Files to process: " . json_encode($filePaths) . "\n";
|
||||
|
||||
if (empty($filePaths)) {
|
||||
throw new Exception("No files provided to merge");
|
||||
@ -66,6 +72,7 @@ class ExcelMergeHelper {
|
||||
|
||||
// Save the merged file
|
||||
log_message('debug', "Saving merged file to: {$outputPath}");
|
||||
// echo "Saving merged file to: {$outputPath}\n";
|
||||
$writer = IOFactory::createWriter($mergedSpreadsheet, 'Xlsx');
|
||||
$writer->setPreCalculateFormulas(false);
|
||||
$writer->save($outputPath);
|
||||
@ -76,6 +83,7 @@ class ExcelMergeHelper {
|
||||
gc_collect_cycles();
|
||||
|
||||
log_message('debug', 'Excel merge process completed successfully');
|
||||
// echo "Excel merge process completed successfully\n";
|
||||
return $outputPath;
|
||||
}
|
||||
|
||||
@ -87,15 +95,17 @@ class ExcelMergeHelper {
|
||||
* @param int|null $index
|
||||
* @throws Exception
|
||||
*/
|
||||
private static function processSingleFile(array $fileInfo, Spreadsheet $mergedSpreadsheet, int $index = null)
|
||||
private static function processSingleFile(array $fileInfo, Spreadsheet $mergedSpreadsheet, ?int $index = null)
|
||||
{
|
||||
if (!isset($fileInfo['file_path']) || !file_exists($fileInfo['file_path'])) {
|
||||
$path = $fileInfo['file_path'] ?? 'undefined';
|
||||
log_message('error', "File " . ($index ?? 'base') . ": Invalid or missing file path: {$path}");
|
||||
// echo "File " . ($index ?? 'base') . ": Invalid or missing file path: {$path}\n";
|
||||
return;
|
||||
}
|
||||
|
||||
log_message('debug', "Processing file " . ($index ?? 'base') . ": " . $fileInfo['file_path']);
|
||||
// echo "Processing file " . ($index ?? 'base') . ": " . $fileInfo['file_path'] . "\n";
|
||||
|
||||
try {
|
||||
// Load the source spreadsheet
|
||||
@ -105,6 +115,7 @@ class ExcelMergeHelper {
|
||||
$worksheets = $sourceSpreadsheet->getAllSheets();
|
||||
$totalSheets = count($worksheets);
|
||||
log_message('debug', "Total sheets in file: " . $totalSheets);
|
||||
// echo "Total sheets in file: " . $totalSheets . "\n";
|
||||
|
||||
$sheetsToMerge = $fileInfo['sheets'] ?? [];
|
||||
|
||||
@ -114,26 +125,30 @@ class ExcelMergeHelper {
|
||||
try {
|
||||
$sheetName = $worksheet->getTitle();
|
||||
log_message('debug', "Processing sheet: {$sheetName}");
|
||||
// echo "Processing sheet: {$sheetName}\n";
|
||||
|
||||
// Generate unique sheet name before cloning
|
||||
$newName = $sheetName;
|
||||
$counter = 1;
|
||||
|
||||
while (in_array($newName, $mergedSpreadsheet->getSheetNames())) {
|
||||
$newName = $sheetName . "_" . $counter++;
|
||||
// $newName = $sheetName . "_" . $counter++;
|
||||
log_message('debug', "Sheet name already exists. Trying new name: {$newName}");
|
||||
// echo "Sheet name already exists. Trying new name: {$newName}\n";
|
||||
}
|
||||
|
||||
// Clone the worksheet and set the new name
|
||||
$clonedSheet = clone $worksheet;
|
||||
$clonedSheet->setTitle($newName);
|
||||
// $clonedSheet = clone $worksheet;
|
||||
// $clonedSheet->setTitle($newName);
|
||||
|
||||
// Add as external sheet
|
||||
$mergedSpreadsheet->addExternalSheet($clonedSheet);
|
||||
$mergedSpreadsheet->addExternalSheet($worksheet);
|
||||
|
||||
log_message('debug', "Successfully added sheet: {$newName}");
|
||||
// echo "Successfully added sheet: {$newName}\n";
|
||||
} catch (Exception $e) {
|
||||
log_message('error', "Error processing sheet {$sheetName} as new name {$newName}: " . $e->getMessage() . ' in ' . $e->getFile() . ' on line ' . $e->getLine());
|
||||
// echo "Error processing sheet {$sheetName} as new name {$newName}: " . $e->getMessage() . ' in ' . $e->getFile() . ' on line ' . $e->getLine() . "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -145,6 +160,7 @@ class ExcelMergeHelper {
|
||||
|
||||
} catch (Exception $e) {
|
||||
log_message('error', "Error processing file {$fileInfo['file_path']}: " . $e->getMessage() . ' in ' . $e->getFile() . ' on line ' . $e->getLine());
|
||||
// echo "Error processing file {$fileInfo['file_path']}: " . $e->getMessage() . ' in ' . $e->getFile() . ' on line ' . $e->getLine() . "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
55
app/Models/LeadFilesModel.php
Normal file
55
app/Models/LeadFilesModel.php
Normal file
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use CodeIgniter\Model;
|
||||
|
||||
class LeadFilesModel extends Model
|
||||
{
|
||||
protected $table = 'lead_files';
|
||||
protected $primaryKey = 'id';
|
||||
protected $allowedFields = [
|
||||
'id',
|
||||
'lead_id',
|
||||
'docs_name',
|
||||
'file_name',
|
||||
'created_by',
|
||||
'updated_by',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'is_active'
|
||||
];
|
||||
|
||||
// Callbacks
|
||||
protected $allowCallbacks = true;
|
||||
protected $beforeInsert = ["checkAndADDCreatedByValue"];
|
||||
protected $afterInsert = [];
|
||||
protected $beforeUpdate = ["checkAndUpdateUpdatedByValue"];
|
||||
protected $afterUpdate = [];
|
||||
protected $beforeFind = [];
|
||||
protected $afterFind = [];
|
||||
protected $beforeDelete = [];
|
||||
protected $afterDelete = [];
|
||||
|
||||
protected function checkAndADDCreatedByValue(array $data)
|
||||
{
|
||||
// Check if 'updated_by' value is null or empty
|
||||
if (empty($data['data']['created_by'])) {
|
||||
// Set 'updated_by' value to the current session user ID
|
||||
$data['data']['created_by'] = get_session_userid();
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
protected function checkAndUpdateUpdatedByValue(array $data)
|
||||
{
|
||||
// Check if 'updated_by' value is null or empty
|
||||
if (empty($data['data']['updated_by'])) {
|
||||
// Set 'updated_by' value to the current session user ID
|
||||
$data['data']['updated_by'] = get_session_userid();
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
@ -87,6 +87,12 @@ class LeadsModel extends Model
|
||||
|
||||
'lead_form_type',
|
||||
'custom_fields',
|
||||
|
||||
'source_policy_start_date',
|
||||
'source_policy_end_date',
|
||||
|
||||
'payment_date',
|
||||
'is_cd'
|
||||
];
|
||||
|
||||
|
||||
|
||||
@ -134,5 +134,20 @@ class UserModel extends Model
|
||||
->getResultArray();
|
||||
}
|
||||
|
||||
public function getexclusiveUserListForRFQ(){
|
||||
$data = $this->db->table('user_profiles')
|
||||
->select('user_profiles.*,user_teams.team_id')
|
||||
->select('roles.role as user_role')
|
||||
->join('roles', 'roles.id = user_profiles.role')
|
||||
->join('user_teams', 'user_teams.user_id = user_profiles.id')
|
||||
->get()
|
||||
->getResultArray();
|
||||
|
||||
|
||||
// dd($data);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
@ -41,7 +41,7 @@
|
||||
origin: "mobile", // origin
|
||||
emp_code:"HTL-007",
|
||||
client_id:159,
|
||||
client_branch_id:125
|
||||
client_branch_id:126
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -80,6 +80,9 @@
|
||||
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.8.1/slick.min.js"></script>
|
||||
<!-- srinivas -->
|
||||
|
||||
<link href="https://cdn.jsdelivr.net/gh/gitbrent/bootstrap4-toggle@3.6.1/css/bootstrap4-toggle.min.css" rel="stylesheet">
|
||||
<script src="https://cdn.jsdelivr.net/gh/gitbrent/bootstrap4-toggle@3.6.1/js/bootstrap4-toggle.min.js"></script>
|
||||
<script src="https://editor.unlayer.com/embed.js"></script>
|
||||
|
||||
<!-- MD5 Hash Start -->
|
||||
|
||||
@ -162,6 +162,16 @@
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||
<label for="source_policy_start_date">Source Policy Start Date<span class="text-danger"></span></label>
|
||||
<input type="text" class="form-control readonly-select" id="source_policy_start_date" name="source_policy_start_date" readonly>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||
<label for="source_policy_end_date">Source Policy End Date<span class="text-danger"></span></label>
|
||||
<input type="text" class="form-control" id="source_policy_end_date" name="source_policy_end_date" readonly>
|
||||
</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"
|
||||
@ -228,9 +238,9 @@
|
||||
<div class="form-row">
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="salse_person_id">Sales Person<span class="text-danger">*</span></label>
|
||||
<label for="salse_person_id">Salse 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>
|
||||
<option value="">Select Salse Person</option>
|
||||
<?php if (isset($salse_team)) { ?>
|
||||
<?php foreach ($salse_team as $value) { ?>
|
||||
<option value="<?= $value['id']; ?>">
|
||||
@ -343,24 +353,24 @@
|
||||
1); // Set end date to last day of selected year
|
||||
policy_end_datePicker.setDate(policy_end_date);
|
||||
|
||||
console.log('this object', this);
|
||||
console.log('id of this element:', this.element);
|
||||
console.log('id of this element:', this.element.id);
|
||||
// console.log('this object', this);
|
||||
// console.log('id of this element:', this.element);
|
||||
// console.log('id of this element:', this.element.id);
|
||||
|
||||
let increment = this.element.id.split('_').pop();
|
||||
console.log(increment); // Outputs: 1
|
||||
// let increment = this.element.id.split('_').pop();
|
||||
// console.log(increment); // Outputs: 1
|
||||
|
||||
|
||||
console.log('increment', increment);
|
||||
console.log('policy_start_datePicker selectedDates', selectedDates);
|
||||
console.log('policy_start_datePicker incurred_claim_date_', $(
|
||||
"#incurred_claim_date_" + increment).val());
|
||||
// console.log('increment', increment);
|
||||
// console.log('policy_start_datePicker selectedDates', selectedDates);
|
||||
// console.log('policy_start_datePicker incurred_claim_date_', $(
|
||||
// "#incurred_claim_date_" + increment).val());
|
||||
|
||||
// Recalculate policy_run_days if incurred claim date is already selected
|
||||
if ($("#incurred_claim_date_" + increment).val()) {
|
||||
console.log('policy_start_datePicker selectedDates', selectedDates);
|
||||
calculatePolicyRunDays(increment);
|
||||
}
|
||||
// if ($("#incurred_claim_date_" + increment).val()) {
|
||||
// console.log('policy_start_datePicker selectedDates', selectedDates);
|
||||
// calculatePolicyRunDays(increment);
|
||||
// }
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -369,6 +379,11 @@
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false
|
||||
});
|
||||
|
||||
document.getElementById('source_policy_start_date').readOnly = true;
|
||||
document.getElementById('source_policy_end_date').readOnly = true;
|
||||
|
||||
$('#source_policy_start_date, #source_policy_end_date').addClass('readonly-select');
|
||||
});
|
||||
|
||||
console.log('increment count for insurer and tpa ', increment);
|
||||
@ -453,7 +468,7 @@
|
||||
|
||||
updateRenewalFields(dataIncrement);
|
||||
let incurred_claim_date_id = 'incurred_claim_date_' + dataIncrement;
|
||||
let premium_date_id = 'premium_date_' + dataIncrement;
|
||||
// let premium_date_id = 'premium_date_' + dataIncrement;
|
||||
|
||||
var incurred_claim_datepicker = flatpickr("#" + incurred_claim_date_id, {
|
||||
dateFormat: "d/m/Y",
|
||||
@ -466,11 +481,7 @@
|
||||
let increment = this.input.id.split('_').pop();
|
||||
console.log('Extracted increment:', increment);
|
||||
|
||||
var policyStartDate = $("#policy_start_date_" + increment)
|
||||
.length ?
|
||||
$("#policy_start_date_" + increment) :
|
||||
$("#policy_start_date");
|
||||
|
||||
var policyStartDate = $("#source_policy_start_date");
|
||||
console.log('Selected Dates:', selectedDates);
|
||||
console.log('policy start date instance', policyStartDate)
|
||||
console.log('Policy Start Date:', policyStartDate.val());
|
||||
@ -482,10 +493,10 @@
|
||||
}
|
||||
});
|
||||
|
||||
var premium_date_datepicker = flatpickr("#" + premium_date_id, {
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false
|
||||
});
|
||||
// var premium_date_datepicker = flatpickr("#" + premium_date_id, {
|
||||
// dateFormat: "d/m/Y",
|
||||
// allowInput: false
|
||||
// });
|
||||
|
||||
$('#proposed_insurer_' + dataIncrement).select2();
|
||||
$('#proposed_tpa_' + dataIncrement).select2();
|
||||
@ -651,6 +662,12 @@
|
||||
|
||||
if (res.status === true && res.data) {
|
||||
|
||||
console.log("res.data.source_policy_start_date", res.data.source_policy_start_date)
|
||||
console.log("res.data.source_policy_end_date", res.data.source_policy_end_date)
|
||||
|
||||
$('#source_policy_start_date').val(res.data.source_policy_start_date);
|
||||
$('#source_policy_end_date').val(res.data.source_policy_end_date);
|
||||
|
||||
for (let i = 1; i <= increment_count; i++) {
|
||||
|
||||
$(`#policy_type_id`).removeClass('readonly-select ').select2();
|
||||
@ -682,6 +699,7 @@
|
||||
$(`#proposed_tpa_${i}`).addClass('readonly-select ').select2('destroy');
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
console.warn('Invalid response:', res.message || 'Unknown error');
|
||||
// Reset fields if response is invalid
|
||||
@ -694,6 +712,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Hide loader
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
@ -787,7 +806,7 @@
|
||||
|
||||
updateRenewalFields(dataIncrement);
|
||||
let incurred_claim_date_id = 'incurred_claim_date_' + dataIncrement;
|
||||
let premium_date_id = 'premium_date_' + dataIncrement;
|
||||
// let premium_date_id = 'premium_date_' + dataIncrement;
|
||||
|
||||
var incurred_claim_datepicker = flatpickr("#" + incurred_claim_date_id, {
|
||||
dateFormat: "d/m/Y",
|
||||
@ -800,10 +819,7 @@
|
||||
let increment = this.input.id.split('_').pop();
|
||||
console.log('Extracted increment:', increment);
|
||||
|
||||
var policyStartDate = $("#policy_start_date_" + increment).length ?
|
||||
$("#policy_start_date_" + increment) :
|
||||
$("#policy_start_date");
|
||||
|
||||
var policyStartDate = $("#source_policy_start_date");
|
||||
console.log('Selected Dates:', selectedDates);
|
||||
console.log('policy start date instance', policyStartDate)
|
||||
console.log('Policy Start Date:', policyStartDate.val());
|
||||
@ -815,10 +831,10 @@
|
||||
}
|
||||
});
|
||||
|
||||
var premium_date_datepicker = flatpickr("#" + premium_date_id, {
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false
|
||||
});
|
||||
// var premium_date_datepicker = flatpickr("#" + premium_date_id, {
|
||||
// dateFormat: "d/m/Y",
|
||||
// allowInput: false
|
||||
// });
|
||||
|
||||
$('#proposed_insurer_' + dataIncrement).select2();
|
||||
$('#proposed_tpa_' + dataIncrement).select2();
|
||||
@ -917,12 +933,8 @@
|
||||
|
||||
<div id="appendArea_${increment}" class = "form-group col-md-12 appendArea"></div>
|
||||
|
||||
<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_${increment}" name="file_name[]" accept=".xls,.xlsx">
|
||||
<span class="text-danger" id="file_name_display"></span>
|
||||
</div>
|
||||
|
||||
<div id="multiFileAppendArea_${increment}"></div>
|
||||
|
||||
<div class="form-group col-md-12 btnDiv" style="position: relative;top: 28px;float: right;text-align: end;">
|
||||
<a class="btn btn-danger waves-effect waves-light" onclick="removeHTMLInput(this)">x</a>
|
||||
<a class="btn btn-primary waves-effect waves-light mr-1" onclick="addHTMLInput(1)">+</a>
|
||||
@ -931,6 +943,8 @@
|
||||
|
||||
container.appendChild(newRow);
|
||||
|
||||
//append mutli file html
|
||||
addFileField(increment);
|
||||
|
||||
var lead_type = $('#lead_type').val();
|
||||
leadTypeBsedHideAndShow(lead_type)
|
||||
@ -970,16 +984,16 @@
|
||||
console.log(increment); // Outputs: 1
|
||||
|
||||
|
||||
console.log('increment', increment);
|
||||
console.log('policy_start_datePicker selectedDates', selectedDates);
|
||||
console.log('policy_start_datePicker incurred_claim_date_', $("#incurred_claim_date_" +
|
||||
increment).val());
|
||||
// console.log('increment', increment);
|
||||
// console.log('policy_start_datePicker selectedDates', selectedDates);
|
||||
// console.log('policy_start_datePicker incurred_claim_date_', $("#incurred_claim_date_" +
|
||||
// increment).val());
|
||||
|
||||
// Recalculate policy_run_days if incurred claim date is already selected
|
||||
if ($("#incurred_claim_date_" + increment).val()) {
|
||||
console.log('policy_start_datePicker selectedDates', selectedDates);
|
||||
calculatePolicyRunDays(increment);
|
||||
}
|
||||
// if ($("#incurred_claim_date_" + increment).val()) {
|
||||
// console.log('policy_start_datePicker selectedDates', selectedDates);
|
||||
// calculatePolicyRunDays(increment);
|
||||
// }
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -1053,10 +1067,7 @@
|
||||
console.log('calculatePolicyRunDays function called');
|
||||
console.log('increment', increment);
|
||||
|
||||
var policyStartDate = $("#policy_start_date_" + increment).length ?
|
||||
$("#policy_start_date_" + increment) :
|
||||
$("#policy_start_date");
|
||||
|
||||
var policyStartDate = $("#source_policy_start_date");
|
||||
var policyStartDate = flatpickr.parseDate(policyStartDate.val(), "d/m/Y");
|
||||
var incurredClaimDate = flatpickr.parseDate($("#incurred_claim_date_" + increment).val(), "d/m/Y");
|
||||
|
||||
@ -1064,9 +1075,9 @@
|
||||
console.log('incurredClaimDate', incurredClaimDate)
|
||||
|
||||
if (policyStartDate && incurredClaimDate) {
|
||||
var timeDiff = incurredClaimDate - policyStartDate; // Time difference in milliseconds
|
||||
var timeDiff = Math.abs(policyStartDate - incurredClaimDate); // Time difference in milliseconds
|
||||
console.log('timeDiff', timeDiff);
|
||||
var daysDiff = Math.ceil(timeDiff / (1000 * 60 * 60 * 24)); // Convert to days and add 1
|
||||
var daysDiff = Math.ceil(timeDiff / (1000 * 60 * 60 * 24) + 1); // Convert to days and add 1
|
||||
console.log('daysDiff', daysDiff);
|
||||
$("#policy_run_days_" + increment).val(daysDiff); // Set value in the policy_run_days_ input
|
||||
}
|
||||
@ -1106,7 +1117,8 @@
|
||||
// ------------------------------------------------------------------------------------------
|
||||
|
||||
// Prevent division by zero in incurred claim ratio calculation
|
||||
let incurred_claim_ratio = annualised_claims > 0 ? incurred_claims / annualised_claims : 0;
|
||||
let premium_as_on_date = Number($('#premium_date_' + increment).val()) || 0;
|
||||
let incurred_claim_ratio = annualised_claims > 0 ? annualised_claims / premium_as_on_date : 0;
|
||||
let incurred_claim_ratio_roundoff = Math.round(incurred_claim_ratio);
|
||||
console.log('incurred_claim_ratio', incurred_claim_ratio_roundoff);
|
||||
|
||||
@ -1118,7 +1130,7 @@
|
||||
console.log('earned_premium', earned_premium);
|
||||
|
||||
// Prevent division by zero in earned claims ratio calculation
|
||||
let earned_claims_ratio = earned_premium > 0 ? incurred_claims / earned_premium : 0;
|
||||
let earned_claims_ratio = earned_premium > 0 ? annualised_claims / earned_premium : 0;
|
||||
let earned_claims_ration_roundoff = Math.round(earned_claims_ratio);
|
||||
console.log('earned_claims_ratio', earned_claims_ratio);
|
||||
|
||||
@ -1130,6 +1142,8 @@
|
||||
let increment = input.id.split('_').pop(); // Extract the increment part
|
||||
console.log('increment', increment);
|
||||
|
||||
let premium_as_on_date = Number($('#premium_date_' + increment).val()) || 0;
|
||||
|
||||
// Retrieve and convert the values to numbers, fallback to 0 if empty or invalid
|
||||
let premium_at_inception = Number($('#premium_at_inception_' + increment).val()) || 0;
|
||||
console.log('premium_at_inception', premium_at_inception);
|
||||
@ -1138,13 +1152,76 @@
|
||||
console.log('policy_run_days', policy_run_days);
|
||||
|
||||
// Prevent division by zero and calculate earned premium
|
||||
let earned_premium = policy_run_days > 0 ? premium_at_inception / policy_run_days : 0;
|
||||
let earned_premium = premium_as_on_date > 0 ? (premium_as_on_date / 365) * 364 : 0;
|
||||
console.log('earned_premium', earned_premium);
|
||||
let earned_premium_roundoff = Math.round(earned_premium);
|
||||
// Set the calculated value with two decimal places
|
||||
$('#earned_premium_' + increment).val(earned_premium_roundoff);
|
||||
}
|
||||
|
||||
$(document).on("input", "#incept_emp_count, #incept_dept_count, #renewal_emp_count, #renewal_dept_count, #exp_emp_count, #exp_dept_count", function() {
|
||||
calculateTotalLives(this);
|
||||
});
|
||||
|
||||
function calculateTotalLives(input) {
|
||||
|
||||
var lead_type = $('#lead_type').val();
|
||||
|
||||
if (lead_type == 1) {
|
||||
|
||||
let formRow = input.closest('.form-row');
|
||||
|
||||
if (formRow) {
|
||||
// Get the employee count and dependent count within the same row
|
||||
let empCountInput = formRow.querySelector('[name="incept_emp_count[]"]');
|
||||
let depCountInput = formRow.querySelector('[name="incept_dept_count[]"]');
|
||||
let totalLivesInput = formRow.querySelector('[name="incept_no_of_lives[]"]');
|
||||
|
||||
// Parse the input values as integers, defaulting to 0 if empty
|
||||
let empCount = empCountInput ? parseInt(empCountInput.value) || 0 : 0;
|
||||
let depCount = depCountInput ? parseInt(depCountInput.value) || 0 : 0;
|
||||
|
||||
// Calculate total lives
|
||||
let totalLives = empCount + depCount;
|
||||
|
||||
// Set the total lives input value
|
||||
if (totalLivesInput) {
|
||||
totalLivesInput.value = totalLives;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
console.log("Function Called");
|
||||
|
||||
if (input.id === "incept_emp_count" || input.id === "incept_dept_count") {
|
||||
var incept_emp_count = parseInt($("#incept_emp_count").val()) || 0;
|
||||
var incept_dept_count = parseInt($("#incept_dept_count").val()) || 0;
|
||||
|
||||
var totalCount = incept_emp_count + incept_dept_count;
|
||||
$("#incept_no_of_lives").val(totalCount);
|
||||
|
||||
} else if (input.id === "renewal_emp_count" || input.id === "renewal_dept_count") {
|
||||
var renewal_emp_count = parseInt($("#renewal_emp_count").val()) || 0;
|
||||
var renewal_dept_count = parseInt($("#renewal_dept_count").val()) || 0;
|
||||
|
||||
var totalCount = renewal_emp_count + renewal_dept_count;
|
||||
$("#renewal_no_of_lives").val(totalCount);
|
||||
|
||||
} else {
|
||||
var exp_emp_count = parseInt($("#exp_emp_count").val()) || 0;
|
||||
var exp_dept_count = parseInt($("#exp_dept_count").val()) || 0;
|
||||
|
||||
var totalCount = exp_emp_count + exp_dept_count;
|
||||
$("#exp_no_of_lives").val(totalCount);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//------------------------ FORM SUBMIT ---------------------------------------------------------------------------------
|
||||
|
||||
$("#leads_form_id").submit(function(event) {
|
||||
@ -1452,7 +1529,7 @@
|
||||
$('.freshFields').find('select, input').attr('required', 'required');
|
||||
$('.freshFields').show();
|
||||
|
||||
$('.proposed_div').hide().find('select, input').removeAttr('required');
|
||||
// $('.proposed_div').hide().find('select, input').removeAttr('required');
|
||||
|
||||
if (resetValues) {
|
||||
|
||||
@ -1486,11 +1563,15 @@
|
||||
$('.renewalFields').show();
|
||||
$('.renewalFields').find('select, input').attr('required', 'required');
|
||||
|
||||
$('.proposed_div').show().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');
|
||||
$('#source_policy_start_date').attr('readonly', 'readonly');
|
||||
$('#source_policy_end_date').attr('readonly', 'readonly');
|
||||
|
||||
console.log('readonly set', $('#source_policy_start_date').prop('readonly')); // should print true
|
||||
|
||||
if (resetValues) {
|
||||
|
||||
@ -1540,4 +1621,8 @@
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
</script>
|
||||
@ -86,6 +86,8 @@ if (isset($selected_lead_type)) {
|
||||
var temp_client_id = 0;
|
||||
var temp_branch_id = 0;
|
||||
var selected_lead_form_type = <?= isset($selected_lead_type) ? $selected_lead_type : 0 ?>;
|
||||
var fileIndex = 1; // Initialize index
|
||||
|
||||
|
||||
// select2 document ready
|
||||
$(document).ready(function() {
|
||||
@ -327,6 +329,127 @@ if (isset($selected_lead_type)) {
|
||||
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------------------------------------
|
||||
|
||||
function addFileField(increment) {
|
||||
|
||||
console.log('addFileField function called');
|
||||
|
||||
const container = document.getElementById(`multiFileAppendArea_${increment}`);
|
||||
if (!container) return;
|
||||
|
||||
const div = document.createElement("div");
|
||||
div.className = "form-row d-flex align-items-end";
|
||||
div.setAttribute("id", `fileField_${fileIndex}`);
|
||||
|
||||
let isFirstField = container.childElementCount === 0; // Check if it's the first field
|
||||
let placeholder = isFirstField ? 'First file must be Demography.' : '';
|
||||
let accept = isFirstField ? '.xls,.xlsx' : '';
|
||||
|
||||
if(selected_lead_form_type != 1){
|
||||
placeholder = '';
|
||||
accept = '';
|
||||
}
|
||||
|
||||
div.innerHTML = `
|
||||
<div class="form-group col-md-5">
|
||||
<label>Document Name<span class="text-danger"></span></label>
|
||||
<input type="text" class="form-control" name="docs_name_${increment}[]" placeholder="${placeholder}">
|
||||
</div>
|
||||
<div class="form-group col-md-5">
|
||||
<label>File Upload<span class="text-danger"></span></label>
|
||||
<input type="file" class="form-control" id="file_name_${fileIndex}" name="file_name_${increment}[]" accept="${accept}">
|
||||
</div>
|
||||
<div class="col-md-2" style="position: relative; bottom: 16px;">
|
||||
<button type="button" class="btn btn-danger" onclick="removeFileField(${fileIndex})">x</button>
|
||||
<button type="button" class="btn btn-primary" onclick="addFileField(${increment})">+</button>
|
||||
</div>
|
||||
`;
|
||||
container.appendChild(div);
|
||||
fileIndex++;
|
||||
}
|
||||
|
||||
function removeFileField(index, lead_file_id = null) {
|
||||
|
||||
if(index == 1){
|
||||
toastr.warning("You can't remove the first file field", 'WARNING');
|
||||
return false;
|
||||
}
|
||||
|
||||
if(lead_file_id != null) {
|
||||
|
||||
Swal.fire({
|
||||
title: "Do you want to remove this file?",
|
||||
// text: "Do you want Save this!",
|
||||
icon: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#3085d6",
|
||||
cancelButtonColor: "#d33",
|
||||
confirmButtonText: "Yes, Procced!"
|
||||
}).then((result) => {
|
||||
|
||||
if (result.isConfirmed) {
|
||||
|
||||
let url = '<?= base_url('util/removeMultiFile') ?>';
|
||||
|
||||
let requestData = {
|
||||
lead_file_id: lead_file_id
|
||||
};
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
// Send AJAX request
|
||||
sendAjaxRequestForGlobal(url, 'GET', requestData, function(response) {
|
||||
console.log('Data fetched successfully:', response);
|
||||
|
||||
if (response.status == true) {
|
||||
toastr.success(response.message, 'SUCCESS');
|
||||
|
||||
//remove the file field
|
||||
const field = document.getElementById(`fileField_${index}`);
|
||||
if(index != 1){
|
||||
if (field) field.remove();
|
||||
}
|
||||
|
||||
} else {
|
||||
toastr.error(response.message, 'WARNING');
|
||||
}
|
||||
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
|
||||
}, function(xhr, status, error) {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
console.error('Error fetching data:', error);
|
||||
console.error(xhr.responseText);
|
||||
toastr.error('An error occurred while checking the CD amount.', 'ERROR');
|
||||
});
|
||||
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}else{
|
||||
const field = document.getElementById(`fileField_${index}`);
|
||||
if(index != 1){
|
||||
if (field) field.remove();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function showFileName(input, index) {
|
||||
if (input.files.length > 0) {
|
||||
document.getElementById(`file_name_display_${index}`).textContent = input.files[0].name;
|
||||
} else {
|
||||
document.getElementById(`file_name_display_${index}`).textContent = "No file chosen";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
@ -334,10 +457,11 @@ if (isset($selected_lead_type)) {
|
||||
<?php if (isset($lead_edit_data)) { ?>
|
||||
<script>
|
||||
|
||||
setTimeout(function(){
|
||||
$(document).ready(async function () {
|
||||
handleEbAndNonEbEdit(
|
||||
<?= json_encode($lead_edit_data, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP) ?>);
|
||||
}, 1000)
|
||||
<?= json_encode($lead_edit_data, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP) ?>
|
||||
);
|
||||
});
|
||||
|
||||
function handleEbAndNonEbEdit(data){
|
||||
if(data.lead_form_type == 1){
|
||||
@ -349,10 +473,15 @@ if (isset($selected_lead_type)) {
|
||||
|
||||
function dynamicLeadsDataForEdit(data) {
|
||||
try {
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
console.log('########### THIS IS EB LEAD ###############')
|
||||
|
||||
console.log('Received data:', data);
|
||||
let dataIncrement = 1;
|
||||
fileIndex = data.lead_file_count + 1;
|
||||
|
||||
if (!data || typeof data !== 'object') {
|
||||
console.error('Invalid data received for editing.');
|
||||
@ -361,6 +490,7 @@ if (isset($selected_lead_type)) {
|
||||
|
||||
$('.btnDiv').hide();
|
||||
$('#appendArea_' + dataIncrement).empty();
|
||||
|
||||
|
||||
if (data.html) {
|
||||
$('#appendArea_' + dataIncrement).append(data.html);
|
||||
@ -368,6 +498,15 @@ if (isset($selected_lead_type)) {
|
||||
console.warn('HTML content missing in data.');
|
||||
}
|
||||
|
||||
if (data.multi_file_html && data.multi_file_html != '') {
|
||||
$('#multiFileAppendArea_' + dataIncrement).empty();
|
||||
setTimeout(function(){
|
||||
$('#multiFileAppendArea_' + dataIncrement).append(data.multi_file_html);
|
||||
}, 2000)
|
||||
} else {
|
||||
console.warn('MULTI FILE HTML content missing in data.');
|
||||
}
|
||||
|
||||
let policy_type_id = data.policy_type_id || null;
|
||||
let lead_type = data.lead_type || null;
|
||||
|
||||
@ -378,6 +517,10 @@ if (isset($selected_lead_type)) {
|
||||
|
||||
leadTypeBsedHideAndShow(lead_type);
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
|
||||
if (lead_type == 1) {
|
||||
$('.claim-row').hide();
|
||||
} else {
|
||||
@ -389,10 +532,10 @@ if (isset($selected_lead_type)) {
|
||||
$('.gpaClaimFileds').hide();
|
||||
$('.lifeClaimFields').show();
|
||||
} else {
|
||||
updateRenewalFields(dataIncrement);
|
||||
// updateRenewalFields(dataIncrement);
|
||||
|
||||
let incurred_claim_date_id = 'incurred_claim_date_' + dataIncrement;
|
||||
let premium_date_id = 'premium_date_' + dataIncrement;
|
||||
// let premium_date_id = 'premium_date_' + dataIncrement;
|
||||
|
||||
if ($('#' + incurred_claim_date_id).length) {
|
||||
flatpickr("#" + incurred_claim_date_id, {
|
||||
@ -401,10 +544,7 @@ if (isset($selected_lead_type)) {
|
||||
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");
|
||||
|
||||
let policyStartDate = $("#source_policy_start_date");
|
||||
if (policyStartDate.val()) {
|
||||
calculatePolicyRunDays(increment);
|
||||
}
|
||||
@ -417,15 +557,16 @@ if (isset($selected_lead_type)) {
|
||||
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.`);
|
||||
}
|
||||
// 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.`);
|
||||
// }
|
||||
|
||||
// console.log($('#proposed_insurer_' + dataIncrement).length);
|
||||
$('#proposed_insurer_' + dataIncrement).select2();
|
||||
$('#proposed_tpa_' + dataIncrement).select2();
|
||||
}
|
||||
@ -451,6 +592,8 @@ if (isset($selected_lead_type)) {
|
||||
$('#client_branch_id').val(data.client_branch_id || '').change();
|
||||
setTimeout(() => {
|
||||
$('#source_policy_id').val(data.source_policy_id || '');
|
||||
$('#source_policy_end_date').val(data.source_policy_end_date || '');
|
||||
$('#source_policy_start_date').val(data.source_policy_start_date || '');
|
||||
$('#pan').val(data.pan || '');
|
||||
$('#gst').val(data.gst || '');
|
||||
$('#branch_name').val(data.branch_name || '');
|
||||
@ -463,7 +606,7 @@ if (isset($selected_lead_type)) {
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, 1000);
|
||||
}, 1000);
|
||||
}, 1000);
|
||||
}, 5000);
|
||||
|
||||
let insurer = (data.insurer_branch_id && data.insurer_id)
|
||||
? `${data.insurer_branch_id}-${data.insurer_id}`
|
||||
@ -490,6 +633,8 @@ if (isset($selected_lead_type)) {
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error in dynamicLeadsDataForEdit function:', error);
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}
|
||||
}
|
||||
|
||||
@ -498,6 +643,7 @@ if (isset($selected_lead_type)) {
|
||||
console.log('########### THIS IS NON EB LEAD ###############')
|
||||
console.log('Received data:', data);
|
||||
let dataIncrement = 1;
|
||||
fileIndex = data.lead_file_count + 1;
|
||||
|
||||
if (!data || typeof data !== 'object') {
|
||||
console.error('Invalid data received for editing.');
|
||||
@ -505,6 +651,8 @@ if (isset($selected_lead_type)) {
|
||||
}
|
||||
|
||||
$('#appendArea').empty();
|
||||
$('#multiFileAppendArea_' + dataIncrement).empty();
|
||||
|
||||
|
||||
if (data.html) {
|
||||
$('#appendArea').append(data.html);
|
||||
@ -512,6 +660,15 @@ if (isset($selected_lead_type)) {
|
||||
console.warn('HTML content missing in data.');
|
||||
}
|
||||
|
||||
if (data.multi_file_html) {
|
||||
console.log(data.multi_file_html);
|
||||
setTimeout(function(){
|
||||
$('#multiFileAppendArea_' + dataIncrement).append(data.multi_file_html);
|
||||
}, 2000)
|
||||
} else {
|
||||
console.warn('MULTI FILE HTML content missing in data.');
|
||||
}
|
||||
|
||||
let policy_type_id = data.policy_type_id || null;
|
||||
let lead_type = data.lead_type || null;
|
||||
|
||||
|
||||
@ -290,14 +290,18 @@ hr.solid {
|
||||
|
||||
<hr>
|
||||
|
||||
<div id="multiFileAppendArea_1"></div>
|
||||
|
||||
<hr>
|
||||
|
||||
<!-- other row -->
|
||||
<div class="form-row">
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<!-- <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> -->
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="salse_person_id">Sales Person<span class="text-danger">*</span></label>
|
||||
@ -370,6 +374,8 @@ $(document).ready(function(){
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false
|
||||
});
|
||||
|
||||
addFileField(1);
|
||||
})
|
||||
|
||||
function getPolicyTypeFields(input) {
|
||||
|
||||
@ -10,9 +10,9 @@
|
||||
overflow-y: auto !important;
|
||||
}
|
||||
#editor-container {
|
||||
width: 100%;
|
||||
min-height: 600px;
|
||||
}
|
||||
width: 100%;
|
||||
min-height: 600px;
|
||||
}
|
||||
|
||||
.modal-dialog {
|
||||
max-width: 90% !important;
|
||||
@ -264,7 +264,7 @@
|
||||
<!-- Unlayer editor -->
|
||||
<div class="form-row" id="rac_rate_dropdown">
|
||||
<div class="form-group col-md-12">
|
||||
<div id="member_welcome_mail_editor_container" style="height: 600px;width:max-content"></div>
|
||||
<div id="member_welcome_mail_editor_container" style="height: 600px"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -360,7 +360,7 @@
|
||||
<!-- Unlayer editor -->
|
||||
<div class="form-row" id="rac_rate_dropdown">
|
||||
<div class="form-group col-md-12">
|
||||
<div id="member_reminder_mail_editor_container" style="height: 600px;width:max-content"></div>
|
||||
<div id="member_reminder_mail_editor_container" style="height: 600px"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -440,7 +440,7 @@
|
||||
<!-- Unlayer editor -->
|
||||
<div class="form-row" id="rac_rate_dropdown">
|
||||
<div class="form-group col-md-12">
|
||||
<div id="member_ecard_mail_editor_container" style="height: 600px;width:max-content"></div>
|
||||
<div id="member_ecard_mail_editor_container" style="height: 600px"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -542,7 +542,7 @@
|
||||
<!-- Unlayer editor -->
|
||||
<div class="form-row" id="rac_rate_dropdown">
|
||||
<div class="form-group col-md-12">
|
||||
<div id="member_review_and_summary_mail_editor_container" style="height: 600px;width:max-content"></div>
|
||||
<div id="member_review_and_summary_mail_editor_container" style="height: 600px;"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -615,7 +615,7 @@
|
||||
<!-- Unlayer editor -->
|
||||
<!-- <div class="form-row" id="rac_rate_dropdown"> -->
|
||||
<div class="form-group col-md-12">
|
||||
<div id="account_maneger_summary_mail_editor_container" style="height: 600px;width:max-content"></div>
|
||||
<div id="account_maneger_summary_mail_editor_container" style="height: 600px"></div>
|
||||
</div>
|
||||
<!-- </div> -->
|
||||
<div class="form-group text-right m-b-0">
|
||||
@ -702,7 +702,7 @@
|
||||
<!-- Unlayer editor -->
|
||||
<div class="form-row" id="rac_rate_dropdown">
|
||||
<div class="form-group col-md-12">
|
||||
<div id="client_hr_summary_mail_editor_container" style="height: 600px;width:max-content"></div>
|
||||
<div id="client_hr_summary_mail_editor_container" style="height: 600px"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
14
app/Views/rfq/attachment_files.php
Normal file
14
app/Views/rfq/attachment_files.php
Normal file
@ -0,0 +1,14 @@
|
||||
<?php if (!empty($multi_file_data)) : ?>
|
||||
<div class="form-group col-md-12">
|
||||
<label>Select Files:</label>
|
||||
<?php foreach ($multi_file_data as $file) : ?>
|
||||
<div class="form-check">
|
||||
|
||||
<input type="checkbox" class="form-check-input multi_file_attachment" id="file_<?= $file['id'] ?>" name="selected_attachment_files[]" value="<?= $file['id'] ?>" checked>
|
||||
<label class="form-check-label" for="file_<?= $file['id'] ?>">
|
||||
<?= htmlspecialchars($file['docs_name']) ?> - <?= htmlspecialchars($file['file_name']) ?>
|
||||
</label>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
@ -1,80 +1,80 @@
|
||||
|
||||
<?php $increment = isset($lead_edit_data) ? "_1" : ''; ?>
|
||||
<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"
|
||||
<input value="<?= isset($lead_edit_data['incurred_claims_date']) ? $lead_edit_data['incurred_claims_date'] : '' ?>" type="text" class="form-control incurred_claim" id="incurred_claim_date<?= $increment ?>"
|
||||
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[]"
|
||||
<input value="<?= isset($lead_edit_data['paid_claims']) ? $lead_edit_data['paid_claims'] : '' ?>" type="text" class="form-control" id="paid_claims<?= $increment ?>" 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[]"
|
||||
<input value="<?= isset($lead_edit_data['outstanding_claims']) ? $lead_edit_data['outstanding_claims'] : '' ?>" type="text" class="form-control" id="outstanding_claims<?= $increment ?>" 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[]"
|
||||
<input value="<?= isset($lead_edit_data['incurred_claims']) ? $lead_edit_data['incurred_claims'] : '' ?>" type="text" class="form-control" id="incurred_claims<?= $increment ?>" 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[]"
|
||||
<input value="<?= isset($lead_edit_data['policy_run_days']) ? $lead_edit_data['policy_run_days'] : '' ?>" type="text" class="form-control" id="policy_run_days<?= $increment ?>" 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[]"
|
||||
<input value="<?= isset($lead_edit_data['premium_at_inception']) ? $lead_edit_data['premium_at_inception'] : '' ?>" type="text" class="form-control" id="premium_at_inception<?= $increment ?>" 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[]"
|
||||
<label for="premium_date">Premium as on 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<?= $increment ?>" 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[]"
|
||||
<input value="<?= isset($lead_edit_data['earned_premium']) ? $lead_edit_data['earned_premium'] : '' ?>" type="text" class="form-control" id="earned_premium<?= $increment ?>" 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[]"
|
||||
<input value="<?= isset($lead_edit_data['annualised_claims']) ? $lead_edit_data['annualised_claims'] : '' ?>" type="text" class="form-control" id="annualised_claims<?= $increment ?>" 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"
|
||||
<input value="<?= isset($lead_edit_data['incurred_claims_ratio']) ? $lead_edit_data['incurred_claims_ratio'] : '' ?>" type="text" class="form-control" id="incurred_claims_ratio<?= $increment ?>"
|
||||
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[]"
|
||||
<input value="<?= isset($lead_edit_data['earned_claims_ratio']) ? $lead_edit_data['earned_claims_ratio'] : '' ?>" type="text" class="form-control" id="earned_claims_ratio<?= $increment ?>" name="earned_claims_ratio[]"
|
||||
placeholder="Enter Earned Claims Ratio">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||
<!-- <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>
|
||||
<input value="<?php //echo 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>
|
||||
@ -116,14 +116,14 @@
|
||||
<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>
|
||||
placeholder="Enter Lives" required oninput="calculateTotalLives(this)">
|
||||
</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>
|
||||
placeholder="Enter Lives" required oninput="calculateTotalLives(this)">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
|
||||
50
app/Views/rfq/multi_files.php
Normal file
50
app/Views/rfq/multi_files.php
Normal file
@ -0,0 +1,50 @@
|
||||
<?php
|
||||
$fileIndex = 1; // Initialize index
|
||||
$increment = 1; // Example increment value
|
||||
?>
|
||||
|
||||
<?php if (isset($lead_edit_data) && isset($lead_edit_data["multi_file_data"]) && !empty($lead_edit_data["multi_file_data"])) {
|
||||
foreach ($lead_edit_data["multi_file_data"] as $index => $value) {
|
||||
$isFirstField = ($index === 0); // First file must be Demography
|
||||
$placeholder = $isFirstField ? 'First file must be Demography.' : '';
|
||||
$accept = $isFirstField ? '.xls,.xlsx' : '';
|
||||
$index = $index + 1;
|
||||
?>
|
||||
|
||||
<div class="form-row d-flex align-items-end" id="fileField_<?= $index ?>">
|
||||
|
||||
<input type="hidden" name="leads_file_id[]"
|
||||
value="<?= htmlspecialchars($value['id']) ?>" id="file_id_<?= $index ?>">
|
||||
|
||||
<!-- Document Name Input -->
|
||||
<div class="form-group col-md-5">
|
||||
<label>Document Name<span class="text-danger"></span></label>
|
||||
<input type="text" class="form-control" name="docs_name_<?= $increment ?>[]"
|
||||
placeholder="<?= $placeholder ?>"
|
||||
value="<?= htmlspecialchars($value['docs_name']) ?>" id="docs_name_<?= $index ?>">
|
||||
</div>
|
||||
|
||||
<!-- File Upload Input -->
|
||||
<div class="form-group col-md-5">
|
||||
<label>
|
||||
File Upload
|
||||
<span class="text-danger"></span><br>
|
||||
<small id="file_name_display_<?= $index ?>" class="text-muted">
|
||||
<?= !empty($value['file_name']) ? htmlspecialchars($value['file_name']) : 'No file chosen' ?>
|
||||
</small>
|
||||
</label>
|
||||
|
||||
<input type="file" class="form-control" id="file_name_<?= $index ?>"
|
||||
name="file_name_<?= $increment ?>[]" accept="<?= $accept ?>"
|
||||
onchange="showFileName(this, <?= $index ?>)">
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Add/Remove Buttons -->
|
||||
<div class="col-md-2" style="position: relative; bottom: 16px;">
|
||||
<button type="button" class="btn btn-danger" onclick="removeFileField(<?= $index ?>, <?= htmlspecialchars($value['id']) ?>)">x</button>
|
||||
<button type="button" class="btn btn-primary" onclick="addFileField(<?= $increment ?>)">+</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php } } ?>
|
||||
@ -49,7 +49,7 @@
|
||||
<div class="row">
|
||||
<img src="https://venbait.in/nhance/helpdesk/dev/assets/helpdeskz/images/agent.jpg"
|
||||
class="user-avatar rounded-circle img-fluid col-mb-6" style="max-width: 70px">
|
||||
<div style="padding-left: 10px;padding-top: 15px;" class="col-mb-6"><?= $message_data['user_name'] ?></div>
|
||||
<div style="padding-left: 10px;padding-top: 15px;" class="col-mb-6"><?= $message['user_name'] ?? "Auto Mail" ?></div>
|
||||
|
||||
</div>
|
||||
<span style="text-align: center; position: relative;text-align: center;bottom: 28px;left: 15px;" class="badge badge-primary">Staff</span>
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
<td><?php echo $row['display_name']; ?></td>
|
||||
<td><?php echo $row['old_value'].' => '.$row['new_value']; ?></td>
|
||||
<!-- <td><?php //echo $row['new_value']; ?></td> -->
|
||||
<td><?php echo $row['modified_by'] ?? "Created by employee"; ?></td>
|
||||
<td><?php echo !empty($row['modified_by'])? $row['modified_by'] : "Created by employee"; ?></td>
|
||||
<!-- <td><?php //echo $row['created_at']; ?></td> -->
|
||||
<td><?php echo date("d-m-Y H:i:s a", strtotime($row['created_at'])) ?? " - "; ?></td>
|
||||
</tr>
|
||||
|
||||
@ -225,14 +225,18 @@
|
||||
|
||||
<button id="addQuote" class="btn btn-custom">Add New Proposal</button>
|
||||
<button id="submitData" class="btn btn-primary">Save RFQ</button>
|
||||
<?php if (in_array(get_role_id(), [1,2,3,5]) || in_array(BUSINESS_SUPPORT_TEAM_ID, user_team())) { ?>
|
||||
<?php if (in_array(get_role_id(), [1,2,5]) || in_array(BUSINESS_SUPPORT_TEAM_ID, user_team())) { ?>
|
||||
<button id="submitQCRData" onclick="checkTheTableDataChanged(5)" class="btn btn-primary">Procced to QCR</button>
|
||||
<?php } ?>
|
||||
<a id="submitExcel" onclick="checkTheTableDataChanged(2)" class="btn btn-primary" id>Export Excel</a>
|
||||
<button id="submitInternalMail" class="btn btn-primary" onclick="checkTheTableDataChanged(4)">Send Internal Mail</button>
|
||||
<button id="submitMail" class="btn btn-primary" onclick="checkTheTableDataChanged(3)">Send Insurer Mail</button>
|
||||
<?php if (get_role_id() == 1 || in_array($user_team,[6,7])) { ?>
|
||||
<button id="submitMail" class="btn btn-primary"
|
||||
onclick="checkTheTableDataChanged(3)">Send Insurer Mail</button>
|
||||
<?php } ?>
|
||||
<button id="submitPlacement" class="btn btn-primary" onclick="checkTheTableDataChanged(6)">Placement</button>
|
||||
<input type="hidden" id="lead_id" name="lead_id" value="<?= isset($lead_id) ? $lead_id : '' ?>">
|
||||
<input type="hidden" id="rfq_primaryKey" name="rfq_primaryKey" value="<?= isset($rfq_data['id']) ? $rfq_data['id'] : '' ?>">
|
||||
<input type="hidden" id="qcr_count" value="<?= isset($qcr_count) ? $qcr_count : 0 ?>">
|
||||
<!-- <button id="openDialogBtn">Open Dialog</button> -->
|
||||
|
||||
@ -373,6 +377,16 @@
|
||||
<div class="form-row" id="input_for_row">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
<h4>Attachments Files</h4>
|
||||
<hr>
|
||||
|
||||
<div class="form-group" id="insurer_or_clinet_mail_attachment">
|
||||
<div class="form-row" >
|
||||
<?php echo isset($attachment_html) && !empty($attachment_html) ? $attachment_html : ''; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group text-right m-b-0" id="hide_smbt_btn">
|
||||
<button type="submit" class="btn btn-primary" onclick="constructURL(1)">Send Mail</button>
|
||||
@ -394,47 +408,61 @@
|
||||
<div class="modal-body">
|
||||
|
||||
<div class="form-group">
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="to">To </label>
|
||||
<select class="form-control" id="to" name="to" required>
|
||||
<?php if (isset($userList)) { ?>
|
||||
<?php foreach ($userList as $user) { ?>
|
||||
<option value="<?= $user['email'];?>">
|
||||
<?= $user['first_name'].' - '.$user['email'];?>
|
||||
</option>
|
||||
<?php } ?>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="to">To </label>
|
||||
<select class="form-control" id="to" name="to" required>
|
||||
<?php if (isset($userList)) { ?>
|
||||
<?php foreach ($userList as $user) { ?>
|
||||
<option value="<?= $user['email'];?>">
|
||||
<?= $user['first_name'].' - '.$user['email'];?>
|
||||
</option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label for="cc">CC </label>
|
||||
<select class="form-control" id="cc" name="cc" required multiple>
|
||||
<?php if (isset($userList)) { ?>
|
||||
<?php foreach ($userList as $user) { ?>
|
||||
<option value="<?= $user['id'];?>">
|
||||
<?= $user['first_name'].' - '.$user['email'];?>
|
||||
</option>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-12">
|
||||
<label for="subject">Subject</label>
|
||||
<input id="subject" type="text" class="form-control" name="subject" value="<?= isset($subject) ? $subject : " " ?>">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-12">
|
||||
<label for="internal_mail_content">Mail Content</label>
|
||||
<textarea id="internal_mail_content" class="form-control" name="internal_mail_content" rows="3"><?= isset($mail_content) ? $mail_content : " " ?></textarea>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label for="cc">CC </label>
|
||||
<select class="form-control" id="cc" name="cc" required multiple>
|
||||
<?php if($page_name == "RFQ") { $exclusiveUserList = $userList; } ?>
|
||||
<?php if (isset($exclusiveUserList)) { ?>
|
||||
<?php foreach ($exclusiveUserList as $user) { ?>
|
||||
<?php if ($page_name == "RFQ" || in_array($user['role'],[1,5]) || in_array($user['team_id'],[6,7])) { ?>
|
||||
<option value="<?= $user['id'];?>">
|
||||
<?= $user['first_name'].' - '.$user['email'];?>
|
||||
</option>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-12">
|
||||
<label for="subject">Subject</label>
|
||||
<input id="subject" type="text" class="form-control" name="subject" value="<?= isset($subject) ? $subject : " " ?>">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-12">
|
||||
<label for="internal_mail_content">Mail Content</label>
|
||||
<textarea id="internal_mail_content" class="form-control" name="internal_mail_content" rows="3"><?= isset($mail_content) ? $mail_content : " " ?></textarea>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
|
||||
<br>
|
||||
<h4>Attachments Files</h4>
|
||||
<hr>
|
||||
|
||||
<div class="form-group" id="internal_mail_attachment">
|
||||
<div class="form-row" >
|
||||
<?php echo isset($attachment_html) && !empty($attachment_html) ? $attachment_html : ''; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
|
||||
<div class="form-group text-right m-b-0" id="hide_smbt_btn">
|
||||
<button type="submit" class="btn btn-primary" onclick="constructURL(2)">Send Mail</button>
|
||||
</div>
|
||||
@ -463,30 +491,45 @@
|
||||
|
||||
<div class="form-row">
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="payment_date">Payment Date</label>
|
||||
<input type="text" class="form-control" id="payment_date" name="payment_date" placeholder="DD/MM/YYY" value="<?= isset($lead_data['payment_date']) ? date('d/m/Y', strtotime($lead_data['payment_date'])) : "" ?>">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="utr_no">UTR No.</label>
|
||||
<input type="text" class="form-control" id="utr_no" name="utr_no" placeholder="Enter UTR No.">
|
||||
<input type="text" class="form-control" id="utr_no" name="utr_no" placeholder="Enter UTR No." value="<?= isset($lead_data['utr_no']) ? $lead_data['utr_no'] : "" ?>">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="placement_date">Placement Date</label>
|
||||
<input type="text" class="form-control" id="placement_date" name="placement_date" placeholder="DD/MM/YYY">
|
||||
<input type="text" class="form-control" id="placement_date" name="placement_date" placeholder="DD/MM/YYY" value="<?= isset($lead_data['placement_date']) ? date('d/m/Y', strtotime($lead_data['placement_date'])) : "" ?>">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label style = "padding-left: 15px;padding-top: 33px;" for="is_cd_switch">CD </label>
|
||||
<input id="is_cd_switch" type="checkbox" name = "is_cd" value = "1" data-toggle="toggle" data-on="With CD" data-off="Without CD" data-onstyle="info" data-offstyle="dark" data-style="border" data-width="150" <?= isset($lead_data['is_cd']) && $lead_data['is_cd'] != 1 ? '' : 'checked' ?>
|
||||
>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="premium_amount">Premium Amount</label>
|
||||
<input type="text" class="form-control" id="premium_amount" name="premium_amount" placeholder="Enter Premium Amount">
|
||||
<input type="text" class="form-control" id="premium_amount" name="premium_amount" placeholder="Enter Premium Amount" value="<?= isset($lead_data['premium_amount']) ? $lead_data['premium_amount'] : "" ?>">
|
||||
</div>
|
||||
|
||||
<?php if (isset($lead_data['is_cd']) && $lead_data['is_cd'] == 1 || !isset($lead_data['is_cd'])) { ?>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="cd_amount">CD Amount</label>
|
||||
<input type="text" class="form-control" id="cd_amount" name="cd_amount" placeholder="Enter CD Amount" value="<?= isset($lead_data['cd_amount']) ? $lead_data['cd_amount'] : "" ?>">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="total_amount">Total Amount</label>
|
||||
<input type="text" class="form-control" id="total_amount" name="total_amount" placeholder="Enter Total Amount">
|
||||
<input type="text" class="form-control" id="total_amount" name="total_amount" placeholder="Enter Total Amount" value="<?= isset($lead_data['cd_amount']) ? $lead_data['cd_amount'] : "" ?>">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="cd_amount">CD Amount</label>
|
||||
<input type="text" class="form-control" id="cd_amount" name="cd_amount" placeholder="Enter CD Amount">
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
<hr>
|
||||
@ -509,12 +552,15 @@
|
||||
<div class="form-group col-md-6">
|
||||
<label for="placement_cc">CC </label>
|
||||
<select class="form-control" id="placement_cc" name="placement_cc" required multiple>
|
||||
<?php if (isset($userList)) { ?>
|
||||
<?php foreach ($userList as $user) { ?>
|
||||
<?php if($page_name == "RFQ") { $exclusiveUserList = $userList; } ?>
|
||||
<?php if (isset($exclusiveUserList)) { ?>
|
||||
>
|
||||
<?php foreach ($exclusiveUserList as $user) { ?>
|
||||
<?php if ($page_name == "RFQ" || in_array($user['role'],[1,5]) || in_array($user['team_id'],[6,7])) { ?>
|
||||
<option value="<?= $user['id'];?>">
|
||||
<?= $user['first_name'].' - '.$user['email'];?>
|
||||
</option>
|
||||
<?php } ?>
|
||||
<?php } }?>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
@ -535,6 +581,16 @@
|
||||
|
||||
</div>
|
||||
|
||||
<br>
|
||||
<h4>Attachments Files</h4>
|
||||
<hr>
|
||||
|
||||
<div class="form-group" id="placement_mail_attachment">
|
||||
<div class="form-row" >
|
||||
<?php echo isset($attachment_html) && !empty($attachment_html) ? $attachment_html : ''; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group text-right m-b-0" id="hide_smbt_btn">
|
||||
<button type="submit" class="btn btn-primary" onclick="constructURL(3)">Send Mail</button>
|
||||
</div>
|
||||
@ -557,6 +613,7 @@
|
||||
var premium_data_check = false;
|
||||
var user_role_id = <?= get_role_id(); ?>;
|
||||
var jsonDataForHide = null;
|
||||
var multi_file_data = [];
|
||||
|
||||
const editorConfig = {
|
||||
buttons: [
|
||||
@ -595,7 +652,8 @@
|
||||
console.log('Type:', type);
|
||||
|
||||
let titile_client_name = "<?= isset($lead_data) ? $lead_data['client_name'] : '' ?>";
|
||||
|
||||
multi_file_data = <?= isset($multi_file_data) ? json_encode($multi_file_data) : '[]' ?>;
|
||||
appendMultiFileData(multi_file_data)
|
||||
RFQ_or_QCR = type;
|
||||
|
||||
var type_for_url = 1;
|
||||
@ -764,6 +822,11 @@
|
||||
allowInput: false,
|
||||
});
|
||||
|
||||
var payment_date_datePicker = flatpickr("#payment_date", {
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false,
|
||||
});
|
||||
|
||||
|
||||
})
|
||||
|
||||
@ -771,6 +834,13 @@
|
||||
|
||||
<script>
|
||||
|
||||
$(document).ready(function () {
|
||||
setInterval(function () {
|
||||
submitData(1);
|
||||
}, 15000);
|
||||
});
|
||||
|
||||
|
||||
const openDialogBtn = document.getElementById('openDialogBtn');
|
||||
const closeDialogBtn = document.getElementById('closeDialogBtn');
|
||||
|
||||
@ -797,6 +867,24 @@ var over_all_column_data = {
|
||||
'insurers': []
|
||||
}
|
||||
};
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
const textarea = document.getElementById('placement_mail_content');
|
||||
const textarea2 = document.getElementById("placement_subject");
|
||||
|
||||
if (textarea) {
|
||||
let content = textarea.value;
|
||||
if (content.includes('QCR')) {
|
||||
textarea.value = content.replace(/QCR/g, 'Placement');
|
||||
}
|
||||
}
|
||||
|
||||
if (textarea2){
|
||||
let content = textarea2.value;
|
||||
if (content.includes('QCR')) {
|
||||
textarea2.value = content.replace(/QCR/g, 'Placement');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// document.addEventListener("DOMContentLoaded", function () {
|
||||
const rfqTable = document.getElementById('rfqTable');
|
||||
@ -1250,19 +1338,34 @@ function moveAddRowButton() {
|
||||
rfqTable.addEventListener('click', function(e) {
|
||||
|
||||
if (e.target.classList.contains('removeRow')) {
|
||||
const row = e.target.closest('tr'); // Get the row to be removed
|
||||
const rowKey = row.getAttribute('id');
|
||||
Swal.fire({
|
||||
title: 'Are you sure?',
|
||||
text: "Do you want to remove the row?",
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#d33',
|
||||
cancelButtonColor: '#3085d6',
|
||||
confirmButtonText: 'Yes, remove it!',
|
||||
cancelButtonText: 'Cancel'
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
const row = e.target.closest('tr'); // Get the row to be removed
|
||||
const rowKey = row.getAttribute('id');
|
||||
|
||||
console.log(suggestionKeys);
|
||||
// Remove the key from suggestionKeys
|
||||
suggestionKeys = suggestionKeys.filter(key => key !== rowKey);
|
||||
row.remove();
|
||||
console.log(suggestionKeys);
|
||||
updateRowNumbers(); // Update row numbers
|
||||
moveAddRowButton(); // Move the add row button to the last row
|
||||
realignSpecialConditions();
|
||||
console.log(suggestionKeys);
|
||||
// Remove the key from suggestionKeys
|
||||
suggestionKeys = suggestionKeys.filter(key => key !== rowKey);
|
||||
row.remove();
|
||||
console.log(suggestionKeys);
|
||||
updateRowNumbers(); // Update row numbers
|
||||
moveAddRowButton(); // Move the add row button to the last row
|
||||
realignSpecialConditions();
|
||||
|
||||
isFormDataModified = true; // if any value changeing in the table to set true
|
||||
isFormDataModified = true; // if any value changeing in the table to set true
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
@ -1408,7 +1511,6 @@ function showSuggestions(input) {
|
||||
|
||||
// Function to handle answers suggestion box
|
||||
function showAnswersSuggestions(input) {
|
||||
|
||||
console.log(input.parentElement.id);
|
||||
console.log(input);
|
||||
//return;
|
||||
@ -2109,7 +2211,17 @@ function removeProposal(event) {
|
||||
let rfqTable = document.getElementById('rfqTable');
|
||||
console.log(rfqTable)
|
||||
|
||||
if (confirm("Are you sure you want to remove this column?")) {
|
||||
Swal.fire({
|
||||
title: 'Are you sure?',
|
||||
text: "Do you want to remove the Proposal?",
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#d33',
|
||||
cancelButtonColor: '#3085d6',
|
||||
confirmButtonText: 'Yes, remove it!',
|
||||
cancelButtonText: 'Cancel'
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
|
||||
const headerRows = rfqTable.querySelectorAll('thead tr');
|
||||
const parentTh = headerRows[0].children[colIndex];
|
||||
@ -2154,69 +2266,83 @@ function removeProposal(event) {
|
||||
console.log(`${proposal_name} does not exist.`);
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
function removeInsurer(event) {
|
||||
|
||||
if (confirm("Are you sure you want to remove this column?")) {
|
||||
// function removeSubColumnByIndex(tableId, subThIndex) {
|
||||
const table = document.getElementById('rfqTable');
|
||||
const headerRows = table.querySelectorAll('thead tr');
|
||||
Swal.fire({
|
||||
title: 'Are you sure?',
|
||||
text: "Do you want to remove the insurer?",
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#d33',
|
||||
cancelButtonColor: '#3085d6',
|
||||
confirmButtonText: 'Yes, remove it!',
|
||||
cancelButtonText: 'Cancel'
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
// function removeSubColumnByIndex(tableId, subThIndex) {
|
||||
const table = document.getElementById('rfqTable');
|
||||
const headerRows = table.querySelectorAll('thead tr');
|
||||
|
||||
const closestTh = event.target.closest('th');
|
||||
let insurerName = closestTh.innerText.split('⋮')[0]
|
||||
// alert(insurerName);return;
|
||||
let subThIndex = closestTh.cellIndex;
|
||||
console.log('subThIndex', subThIndex);
|
||||
const closestTh = event.target.closest('th');
|
||||
let insurerName = closestTh.innerText.split('⋮')[0]
|
||||
// alert(insurerName);return;
|
||||
let subThIndex = closestTh.cellIndex;
|
||||
console.log('subThIndex', subThIndex);
|
||||
|
||||
// Get the sub TH from the second header row
|
||||
const subTh = headerRows[1].children[subThIndex];
|
||||
console.log('subTh', subTh);
|
||||
// Get the sub TH from the second header row
|
||||
const subTh = headerRows[1].children[subThIndex];
|
||||
console.log('subTh', subTh);
|
||||
|
||||
let accumulatedColspan = 0;
|
||||
let parentTh = null;
|
||||
const firstHeaderRow = headerRows[0];
|
||||
// Find the parent TH for the specified sub TH index
|
||||
for (let i = 0; i < firstHeaderRow.children.length; i++) {
|
||||
const currentParentTh = firstHeaderRow.children[i];
|
||||
const currentColspan = parseInt(currentParentTh.getAttribute('colspan')) || 1;
|
||||
let accumulatedColspan = 0;
|
||||
let parentTh = null;
|
||||
const firstHeaderRow = headerRows[0];
|
||||
// Find the parent TH for the specified sub TH index
|
||||
for (let i = 0; i < firstHeaderRow.children.length; i++) {
|
||||
const currentParentTh = firstHeaderRow.children[i];
|
||||
const currentColspan = parseInt(currentParentTh.getAttribute('colspan')) || 1;
|
||||
|
||||
accumulatedColspan += currentColspan;
|
||||
accumulatedColspan += currentColspan;
|
||||
|
||||
if (subThIndex < accumulatedColspan) {
|
||||
parentTh = currentParentTh;
|
||||
break;
|
||||
if (subThIndex < accumulatedColspan) {
|
||||
parentTh = currentParentTh;
|
||||
break;
|
||||
}
|
||||
}
|
||||
console.log('parentth' + parentTh);
|
||||
console.log('sub col indexOf' + subThIndex);
|
||||
|
||||
|
||||
// Get the starting position of the sub TH
|
||||
const startIndex = Array.from(headerRows[1].children).indexOf(subTh);
|
||||
|
||||
// Remove the sub TH
|
||||
headerRows[1].removeChild(subTh);
|
||||
|
||||
// Reduce colspan of parent TH
|
||||
const parentColspan = parseInt(parentTh.getAttribute('colspan')) || 1;
|
||||
console.log('existing colspan' + parentColspan);
|
||||
parentTh.setAttribute('colspan', parentColspan - 1);
|
||||
console.log('new colspan' + (parentColspan - 1));
|
||||
|
||||
// Remove the corresponding TDs from each row
|
||||
table.querySelectorAll('tbody tr').forEach(row => {
|
||||
row.removeChild(row.children[startIndex]);
|
||||
});
|
||||
|
||||
removeInsurerFromPremiumTable(event, subThIndex)
|
||||
|
||||
//remove the insurer from gobal array
|
||||
let proposal_name = parentTh.innerText.split('⋮')[0];
|
||||
popInsurerInArray(proposal_name, insurerName);
|
||||
|
||||
isFormDataModified = true; // if any value changeing in the table to set true
|
||||
}
|
||||
}
|
||||
console.log('parentth' + parentTh);
|
||||
console.log('sub col indexOf' + subThIndex);
|
||||
|
||||
|
||||
// Get the starting position of the sub TH
|
||||
const startIndex = Array.from(headerRows[1].children).indexOf(subTh);
|
||||
|
||||
// Remove the sub TH
|
||||
headerRows[1].removeChild(subTh);
|
||||
|
||||
// Reduce colspan of parent TH
|
||||
const parentColspan = parseInt(parentTh.getAttribute('colspan')) || 1;
|
||||
console.log('existing colspan' + parentColspan);
|
||||
parentTh.setAttribute('colspan', parentColspan - 1);
|
||||
console.log('new colspan' + (parentColspan - 1));
|
||||
|
||||
// Remove the corresponding TDs from each row
|
||||
table.querySelectorAll('tbody tr').forEach(row => {
|
||||
row.removeChild(row.children[startIndex]);
|
||||
});
|
||||
|
||||
removeInsurerFromPremiumTable(event, subThIndex)
|
||||
|
||||
//remove the insurer from gobal array
|
||||
let proposal_name = parentTh.innerText.split('⋮')[0];
|
||||
popInsurerInArray(proposal_name, insurerName);
|
||||
|
||||
isFormDataModified = true; // if any value changeing in the table to set true
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
function showThreeDottedMenu(event) {
|
||||
@ -2706,8 +2832,8 @@ function handleChildQuestions(target) {
|
||||
let childCell = childRow.cells[currentColumnIndex];
|
||||
|
||||
if (childCell) {
|
||||
console.log('found cell');
|
||||
|
||||
console.log('found cell',inputValue);
|
||||
|
||||
if (inputValue.key == disable_at.key) {
|
||||
childCell.innerHTML = '';
|
||||
childCell.innerText = '';
|
||||
@ -2726,6 +2852,21 @@ function handleChildQuestions(target) {
|
||||
console.log(child.default_answer.display_value)
|
||||
childCell.contentEditable = false;
|
||||
} else {
|
||||
childCell.innerHTML = '';
|
||||
childCell.innerText = '';
|
||||
//hidden text box for store choosed answers object
|
||||
const hiddenInputBox = document.createElement('input');
|
||||
hiddenInputBox.type = 'hidden';
|
||||
hiddenInputBox.value = JSON.stringify(inputValue.display_value);
|
||||
|
||||
childCell.appendChild(hiddenInputBox);
|
||||
// alert(input.innerText);
|
||||
childCell.appendChild(document.createTextNode(inputValue.display_value));
|
||||
|
||||
// Set the default answer in the child cell
|
||||
// childCell.innerHTML = child.default_answer.display_value;
|
||||
// console.log('setting default value');
|
||||
// console.log(child.default_answer.display_value)
|
||||
childCell.contentEditable = true;
|
||||
}
|
||||
}
|
||||
@ -3103,7 +3244,7 @@ function ajaxRequestForGetMailData(url) {
|
||||
|
||||
function appendInput(data) {
|
||||
|
||||
console.log(data);
|
||||
console.log("append data:",data);
|
||||
var lead_id = $('#lead_id').val();
|
||||
$('#input_for_row').empty();
|
||||
let html = '';
|
||||
@ -3113,9 +3254,9 @@ function appendInput(data) {
|
||||
const url = '<?= base_url('leads/list') ?>?lead_id=' + lead_id;
|
||||
|
||||
html += `
|
||||
<div class="form-group col-md-4">
|
||||
<div class="form-group col-md-12">
|
||||
<label for="contact_mail">Client Contact Mail</label>
|
||||
<input value="${data.contact_person_email || ''}" type="text" id="contact_mail" class="form-control" placeholder="Contact Mail" readonly>
|
||||
<input value="${data.contact_person_email || ''}" type="text" id="contact_mail" class="form-control" placeholder="Contact Mail">
|
||||
</div>
|
||||
`;
|
||||
|
||||
@ -3131,29 +3272,33 @@ function appendInput(data) {
|
||||
|
||||
html += `
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="client_cc">CC </label>
|
||||
<select class="form-control" id="client_cc" name="client_cc" required multiple>
|
||||
<?php if (isset($userList)) { ?>
|
||||
<?php foreach ($userList as $user) { ?>
|
||||
<?php if($page_name == "RFQ") { $exclusiveUserList = $userList; } ?>
|
||||
<?php if (isset($exclusiveUserList)) { ?>
|
||||
<?php foreach ($exclusiveUserList as $user) { ?>
|
||||
<?php if ($page_name == "RFQ" || in_array($user['role'],[1,5]) || in_array($user['team_id'],[6,7])) { ?>
|
||||
<option value="<?= $user['id'];?>">
|
||||
<?= $user['first_name'].' - '.$user['email'];?>
|
||||
</option>
|
||||
<?php } ?>
|
||||
<?php } } ?>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="client_bcc">BCC </label>
|
||||
<select class="form-control" id="client_bcc" name="client_bcc" required multiple>
|
||||
<?php if (isset($userList)) { ?>
|
||||
<?php foreach ($userList as $user) { ?>
|
||||
<?php if($page_name == "RFQ") { $exclusiveUserList = $userList; } ?>
|
||||
<?php if (isset($exclusiveUserList)) { ?>
|
||||
<?php foreach ($exclusiveUserList as $user) { ?>
|
||||
<?php if ($page_name == "RFQ" || in_array($user['role'],[1,5]) || in_array($user['team_id'],[6,7])) { ?>
|
||||
<option value="<?= $user['id'];?>">
|
||||
<?= $user['first_name'].' - '.$user['email'];?>
|
||||
</option>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
<?php } } ?>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
`;
|
||||
@ -3163,7 +3308,7 @@ function appendInput(data) {
|
||||
html += `
|
||||
<div class="form-group col-md-12">
|
||||
<label for="mail_subject">Subject</label>
|
||||
<input type="text" id="mail_subject" class="form-control" value="'<?= isset($subject) ? $subject : " " ?>'" placeholder="Subject">
|
||||
<input type="text" id="mail_subject" class="form-control" value="<?= isset($subject) ? $subject : " " ?>" placeholder="Subject">
|
||||
</div>
|
||||
`;
|
||||
|
||||
@ -3196,25 +3341,28 @@ function appendInput(data) {
|
||||
<div class="form-group col-md-4">
|
||||
<label for="client_cc">CC </label>
|
||||
<select class="form-control" id="client_cc" name="client_cc" required multiple>
|
||||
<?php if (isset($userList)) { ?>
|
||||
<?php foreach ($userList as $user) { ?>
|
||||
<?php if($page_name == "RFQ") { $exclusiveUserList = $userList; } ?>
|
||||
<?php if (isset($exclusiveUserList)) { ?>
|
||||
<?php foreach ($exclusiveUserList as $user) { ?>
|
||||
<?php if ($page_name == "RFQ" || in_array($user['role'],[1,5]) || in_array($user['team_id'],[6,7])) { ?>
|
||||
<option value="<?= $user['id'];?>">
|
||||
<?= $user['first_name'].' - '.$user['email'];?>
|
||||
</option>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
<?php } }?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label for="client_bcc">BCC </label>
|
||||
<select class="form-control" id="client_bcc" name="client_bcc" required multiple>
|
||||
<?php if (isset($userList)) { ?>
|
||||
<?php foreach ($userList as $user) { ?>
|
||||
<option value="<?= $user['id'];?>">
|
||||
<?php if($page_name == "RFQ") { $exclusiveUserList = $userList; } ?>
|
||||
<?php if (isset($exclusiveUserList)) { ?>
|
||||
<?php foreach ($exclusiveUserList as $user) { ?>
|
||||
<?php if ($page_name == "RFQ" || in_array($user['role'],[1,5]) || in_array($user['team_id'],[6,7])) { ?>
|
||||
<?= $user['first_name'].' - '.$user['email'];?>
|
||||
</option>
|
||||
<?php } ?>
|
||||
<?php } } ?>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
@ -3274,7 +3422,13 @@ function appendInput(data) {
|
||||
function constructURL(url_type) {
|
||||
|
||||
if(url_type == 1){
|
||||
constructURL_ForInsurerAndClientMailSend()
|
||||
var validationStatus = checkMailValidation();
|
||||
|
||||
if (validationStatus){
|
||||
constructURL_ForInsurerAndClientMailSend();
|
||||
}else{
|
||||
toastr.error("All Client Mail ID's Should Contain Same Domain","ERROR");
|
||||
}
|
||||
}else if(url_type == 2){
|
||||
constructURL_ForInternalMailSend()
|
||||
}else if(url_type == 3){
|
||||
@ -3437,6 +3591,7 @@ function constructURL_ForInsurerAndClientMailSend() {
|
||||
var subject = $('#mail_subject').val();
|
||||
var bcc = $('#client_bcc').val();
|
||||
var cc = $('#client_cc').val();
|
||||
var contact_mail = $("#contact_mail").val();
|
||||
|
||||
console.log('lead_id', lead_id)
|
||||
console.log('subject', subject)
|
||||
@ -3452,6 +3607,11 @@ function constructURL_ForInsurerAndClientMailSend() {
|
||||
bcc = bcc.map(Number);
|
||||
bcc = JSON.stringify(bcc);
|
||||
|
||||
var selectedFiles = [];
|
||||
$('#insurer_or_clinet_mail_attachment .multi_file_attachment:checked').each(function () {
|
||||
selectedFiles.push($(this).val());
|
||||
});
|
||||
|
||||
// Prepare FormData object
|
||||
var formData = new FormData();
|
||||
formData.append('lead_id', lead_id);
|
||||
@ -3459,8 +3619,11 @@ function constructURL_ForInsurerAndClientMailSend() {
|
||||
formData.append('subject', subject);
|
||||
formData.append('cc', cc);
|
||||
formData.append('bcc', bcc);
|
||||
formData.append('selected_attachment_files', JSON.stringify(selectedFiles));
|
||||
|
||||
|
||||
if (RFQ_or_QCR == 2) {
|
||||
formData.append('contact_mail',contact_mail);
|
||||
formData.append('file_type', 'qcr');
|
||||
formData.append('recipient_type', 'client');
|
||||
formData.append('recipient_mail', '');
|
||||
@ -3493,6 +3656,11 @@ function constructURL_ForInternalMailSend() {
|
||||
// Determine file type
|
||||
var file_type = RFQ_or_QCR == 2 ? 'qcr' : 'rfq';
|
||||
|
||||
var selectedFiles = [];
|
||||
$('#internal_mail_attachment .multi_file_attachment:checked').each(function () {
|
||||
selectedFiles.push($(this).val());
|
||||
});
|
||||
|
||||
// Create FormData
|
||||
var formData = new FormData();
|
||||
formData.append('lead_id', lead_id);
|
||||
@ -3503,6 +3671,7 @@ function constructURL_ForInternalMailSend() {
|
||||
formData.append('subject', subject);
|
||||
formData.append('mail_content', mail_content);
|
||||
formData.append('recipient_mail', ''); // Empty value as per logic
|
||||
formData.append('selected_attachment_files', JSON.stringify(selectedFiles));
|
||||
|
||||
ajaxRequest(formData)
|
||||
|
||||
@ -3514,6 +3683,8 @@ function constructURL_ForPlacementMailSend() {
|
||||
var lead_id = $('#lead_id').val();
|
||||
let to = $('#placement_to').val();
|
||||
let placement_date = $('#placement_date').val();
|
||||
let payment_date = $('#payment_date').val();
|
||||
let is_cd = $("#is_cd_switch").is(":checked") ? 1 : 0;
|
||||
let utr_no = $('#utr_no').val();
|
||||
let premium_amount = $('#premium_amount').val();
|
||||
let total_amount = $('#total_amount').val();
|
||||
@ -3528,6 +3699,11 @@ function constructURL_ForPlacementMailSend() {
|
||||
to = to.split(',').map(email => email.trim());
|
||||
cc = cc.map(Number); // or split if it's a string: `cc.split(',').map(email => email.trim())`
|
||||
|
||||
var selectedFiles = [];
|
||||
$('#placement_mail_attachment .multi_file_attachment:checked').each(function () {
|
||||
selectedFiles.push($(this).val());
|
||||
});
|
||||
|
||||
// Prepare FormData
|
||||
var formData = new FormData();
|
||||
formData.append('lead_id', lead_id);
|
||||
@ -3539,11 +3715,15 @@ function constructURL_ForPlacementMailSend() {
|
||||
formData.append('proposal_insurer', proposal_insurer);
|
||||
formData.append('insurer_and_branch', insurer_and_branch);
|
||||
formData.append('placement_date', placement_date);
|
||||
formData.append('payment_date', payment_date);
|
||||
formData.append("is_cd",is_cd);
|
||||
formData.append('utr_no', utr_no);
|
||||
formData.append('premium_amount', premium_amount);
|
||||
formData.append('total_amount', total_amount);
|
||||
formData.append('cd_amount', cd_amount);
|
||||
formData.append('mail_content', mail_content);
|
||||
formData.append('selected_attachment_files', JSON.stringify(selectedFiles));
|
||||
|
||||
|
||||
ajaxRequest(formData);
|
||||
|
||||
@ -3608,7 +3788,7 @@ function ajaxRequest(formData) {
|
||||
$('#placement_cc').val('').select2({
|
||||
placeholder : 'select CC Mail'
|
||||
});
|
||||
$('#placement_subject').val('');
|
||||
// $('#placement_subject').val('');
|
||||
|
||||
$("textarea.select2-search__field").attr('rows', '1');
|
||||
$("textarea.select2-search__field").css('resize', 'none');
|
||||
@ -3685,7 +3865,7 @@ $('.close').click(function(){
|
||||
$('#placement_cc').val('').select2({
|
||||
placeholder : 'select CC Mail'
|
||||
});
|
||||
$('#placement_subject').val('');
|
||||
// $('#placement_subject').val('');
|
||||
|
||||
$("textarea.select2-search__field").attr('rows', '1');
|
||||
$("textarea.select2-search__field").css('resize', 'none');
|
||||
@ -5157,12 +5337,18 @@ function autoCaluculationForPremiumChildTable(input) {
|
||||
}
|
||||
|
||||
|
||||
function appendMultiFileData(data) {
|
||||
|
||||
console.log('appendMultiFileData function called');
|
||||
console.log(data)
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
async function submitData(json) {
|
||||
async function submitData(input) {
|
||||
|
||||
console.log(over_all_column_data);
|
||||
|
||||
try {
|
||||
@ -5177,6 +5363,7 @@ function autoCaluculationForPremiumChildTable(input) {
|
||||
// Create a FormData object
|
||||
const formData = new FormData();
|
||||
let lead_id = $('#lead_id').val();
|
||||
let rfq_primaryKey = $('#rfq_primaryKey').val();
|
||||
|
||||
let submit_type = "RFQ"
|
||||
if(RFQ_or_QCR == 2){submit_type = 'QCR'}
|
||||
@ -5185,6 +5372,10 @@ function autoCaluculationForPremiumChildTable(input) {
|
||||
formData.append('lead_id', lead_id);
|
||||
formData.append('submit_type', submit_type);
|
||||
|
||||
if(input == 1){
|
||||
formData.append('rfq_primaryKey', rfq_primaryKey);
|
||||
}
|
||||
|
||||
const postUrl = '<?= base_url('rfq/create')?>';
|
||||
console.log(postUrl);
|
||||
|
||||
@ -5200,11 +5391,14 @@ function autoCaluculationForPremiumChildTable(input) {
|
||||
|
||||
if (response.status == true) {
|
||||
toastr.success(response.message, 'SUCCESS');
|
||||
$('#rfq_primaryKey').val(response.id);
|
||||
} else {
|
||||
toastr.warning(response.message, 'WARNING');
|
||||
}
|
||||
|
||||
window.location.reload();
|
||||
if(input != 1){
|
||||
window.location.reload();
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.error('An error occurred during the AJAX request:');
|
||||
@ -5675,4 +5869,65 @@ function autoCaluculationForPremiumChildTable(input) {
|
||||
|
||||
}
|
||||
|
||||
$("#is_cd_switch").change(function (){
|
||||
var switch_status = ($("#is_cd_switch").is(":checked")? "on" : "off");
|
||||
console.log("Switch status",switch_status);
|
||||
if (switch_status == "on"){
|
||||
|
||||
$("#cd_amount").show();
|
||||
$("#total_amount").show();
|
||||
$("#cd_amount").closest('.form-group').show();
|
||||
$("#total_amount").closest('.form-group').show();
|
||||
|
||||
}else{
|
||||
|
||||
$("#cd_amount").hide();
|
||||
$("#total_amount").hide();
|
||||
$("#cd_amount").closest('.form-group').hide();
|
||||
$("#total_amount").closest('.form-group').hide();
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
$(document).on("input", "#cd_amount, #premium_amount", function() {
|
||||
|
||||
// alert("Function called");
|
||||
|
||||
var cd_amount = parseInt($("#cd_amount").val()) || 0;
|
||||
var premium_amount = parseInt($("#premium_amount").val()) || 0;
|
||||
|
||||
var total_amount = (cd_amount + premium_amount);
|
||||
$("#total_amount").val(total_amount);
|
||||
|
||||
|
||||
});
|
||||
|
||||
function checkMailValidation(){
|
||||
|
||||
emailString = $("#contact_mail").val();
|
||||
|
||||
if (RFQ_or_QCR == 1){
|
||||
if (typeof emailString !== 'string' || !emailString.includes(',')) return true;
|
||||
}else{
|
||||
if (typeof emailString !== 'string') return false;
|
||||
}
|
||||
|
||||
const invalidChars = /[;|]/;
|
||||
if (invalidChars.test(emailString)) return false;
|
||||
|
||||
|
||||
const emails = emailString.split(',').map(email => email.trim());
|
||||
|
||||
if (emails.length === 0) return false;
|
||||
|
||||
const getDomain = email => email.split('@')[1]?.toLowerCase();
|
||||
const firstDomain = getDomain(emails[0]);
|
||||
|
||||
if (!firstDomain) return false;
|
||||
|
||||
return emails.every(email => getDomain(email) === firstDomain);
|
||||
}
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
@ -309,11 +309,22 @@
|
||||
<button type="button" id="close_btn" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
|
||||
<div class="form-group">
|
||||
<div class="form-row" id="input_for_row">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
<h4>Attachments Files</h4>
|
||||
<hr>
|
||||
|
||||
<div class="form-group" id="insurer_or_clinet_mail_attachment">
|
||||
<div class="form-row" >
|
||||
<?php echo isset($attachment_html) && !empty($attachment_html) ? $attachment_html : ''; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group text-right m-b-0" id="hide_smbt_btn">
|
||||
<button type="submit" class="btn btn-primary" onclick="constructURL(1)">Send Mail</button>
|
||||
</div>
|
||||
@ -374,7 +385,17 @@
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<br>
|
||||
<h4>Attachments Files</h4>
|
||||
<hr>
|
||||
|
||||
<div class="form-group" id="internal_mail_attachment">
|
||||
<div class="form-row" >
|
||||
<?php echo isset($attachment_html) && !empty($attachment_html) ? $attachment_html : ''; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group text-right m-b-0" id="hide_smbt_btn">
|
||||
<button type="submit" class="btn btn-primary" onclick="constructURL(2)">Send Mail</button>
|
||||
</div>
|
||||
@ -475,6 +496,16 @@
|
||||
|
||||
</div>
|
||||
|
||||
<br>
|
||||
<h4>Attachments Files</h4>
|
||||
<hr>
|
||||
|
||||
<div class="form-group" id="placement_mail_attachment">
|
||||
<div class="form-row" >
|
||||
<?php echo isset($attachment_html) && !empty($attachment_html) ? $attachment_html : ''; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group text-right m-b-0" id="hide_smbt_btn">
|
||||
<button type="submit" class="btn btn-primary" onclick="constructURL(3)">Send Mail</button>
|
||||
</div>
|
||||
@ -4550,6 +4581,11 @@
|
||||
bcc = bcc.map(Number);
|
||||
bcc = JSON.stringify(bcc);
|
||||
|
||||
var selectedFiles = [];
|
||||
$('#insurer_or_clinet_mail_attachment .multi_file_attachment:checked').each(function () {
|
||||
selectedFiles.push($(this).val());
|
||||
});
|
||||
|
||||
// Prepare FormData object
|
||||
var formData = new FormData();
|
||||
formData.append('lead_id', lead_id);
|
||||
@ -4557,6 +4593,8 @@
|
||||
formData.append('subject', subject);
|
||||
formData.append('cc', cc);
|
||||
formData.append('bcc', bcc);
|
||||
formData.append('selected_attachment_files', JSON.stringify(selectedFiles));
|
||||
|
||||
|
||||
if (rfq_or_qcr == 2) {
|
||||
formData.append('file_type', 'qcr');
|
||||
@ -4591,6 +4629,12 @@
|
||||
// Determine file type
|
||||
var file_type = rfq_or_qcr == 2 ? 'qcr' : 'rfq';
|
||||
|
||||
var selectedFiles = [];
|
||||
$('#internal_mail_attachment .multi_file_attachment:checked').each(function () {
|
||||
selectedFiles.push($(this).val());
|
||||
});
|
||||
|
||||
|
||||
// Create FormData
|
||||
var formData = new FormData();
|
||||
formData.append('lead_id', lead_id);
|
||||
@ -4601,6 +4645,8 @@
|
||||
formData.append('subject', subject);
|
||||
formData.append('mail_content', mail_content);
|
||||
formData.append('recipient_mail', ''); // Empty value as per logic
|
||||
formData.append('selected_attachment_files', JSON.stringify(selectedFiles));
|
||||
|
||||
|
||||
ajaxRequest(formData)
|
||||
|
||||
@ -4626,6 +4672,13 @@
|
||||
to = to.split(',').map(email => email.trim());
|
||||
cc = cc.map(Number); // or split if it's a string: `cc.split(',').map(email => email.trim())`
|
||||
|
||||
|
||||
var selectedFiles = [];
|
||||
$('#placement_mail_attachment .multi_file_attachment:checked').each(function () {
|
||||
selectedFiles.push($(this).val());
|
||||
});
|
||||
|
||||
|
||||
// Prepare FormData
|
||||
var formData = new FormData();
|
||||
formData.append('lead_id', lead_id);
|
||||
@ -4642,11 +4695,14 @@
|
||||
formData.append('total_amount', total_amount);
|
||||
formData.append('cd_amount', cd_amount);
|
||||
formData.append('mail_content', mail_content);
|
||||
formData.append('selected_attachment_files', JSON.stringify(selectedFiles));
|
||||
|
||||
|
||||
ajaxRequest(formData);
|
||||
|
||||
}
|
||||
|
||||
|
||||
function ajaxRequest(formData) {
|
||||
|
||||
var apiURL = '<?= base_url('leads/sendMail') ?>';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user