CHANGE_CD_MASTER_CR : RV
This commit is contained in:
parent
e6f292901b
commit
d32b5e7fa1
@ -635,6 +635,7 @@ class ClientController extends AdminController
|
||||
$balances = $this->clientPolicyModel->getBalances($id);
|
||||
$data['balances'] = $balances;
|
||||
|
||||
// dd($data);
|
||||
if($requestFrom == 'rest'){ return $data; }
|
||||
|
||||
echo view('layout/header', $headerData);
|
||||
@ -746,12 +747,15 @@ class ClientController extends AdminController
|
||||
$this->myLogger->logme('error', 'Edit Client Onboarding function called');
|
||||
$headerData['page_name'] = 'Edit Client Onboarding';
|
||||
|
||||
$editData['RM'] = $this->userModel->where('is_active', 1)->findAll();
|
||||
$editData['RM'] = $this->userModel->where('is_active', 1)->findAll();
|
||||
$editData['tpa'] = $this->tpaBranchModel->getTpaBranchesWithTpaNames();
|
||||
$editData['state'] = $this->stateModel->getAllStates();
|
||||
$editData['police'] = $this->policesModel->findAll();
|
||||
$editData['entity'] = $this->kycEntityTypeModel->findAll();
|
||||
$editData['insurer'] = $this->insurerBranchModel->getInsurerBranchesWithInsurerNames();
|
||||
$editData['insurers'] = $this->insurerModel->where('is_active', 1)->findAll();
|
||||
$editData['insurer_branch'] = $this->insurerBranchModel->where('is_active', 1)->findAll();
|
||||
$editData['clients'] = $this->clientModel->where('is_active', 1)->findAll();
|
||||
$editData['kyc_docs'] = $this->kycDocsModel->findAll();
|
||||
$editData['policyGridData'] = $this->policyGridModel->findAll();
|
||||
$editData['policy_types'] = $this->policyTypeModel->findAll();
|
||||
@ -3551,12 +3555,13 @@ class ClientController extends AdminController
|
||||
return $this->respond(['status' => true, 'code' => 200, 'message' => 'Additionaly Rack Rate Data Remove Successfully'], 200);
|
||||
}
|
||||
|
||||
public function get_cd_ac($client_id, $insurer_id)
|
||||
public function get_cd_ac($client_id, $insurer_id, $insurer_branch_id)
|
||||
{
|
||||
|
||||
$cd_data = $this->CDMasterModel
|
||||
->where('client_id', $client_id)
|
||||
->where('insurer_id', $insurer_id)
|
||||
->where('insurer_branch_id', $insurer_branch_id)
|
||||
->where('is_active', 1)
|
||||
->findAll();
|
||||
|
||||
@ -4095,12 +4100,13 @@ class ClientController extends AdminController
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function getCDAccNoByClientAndInsurer($client, $insurer)
|
||||
|
||||
public function getCDAccNoByClientAndInsurer($client, $insurer, $insurer_branch_id)
|
||||
{
|
||||
$cdmData = $this->CDMasterModel
|
||||
->where('client_id', $client)
|
||||
->where('insurer_id', $insurer)
|
||||
->where('insurer_branch_id', $insurer_branch_id)
|
||||
->where('is_active', 1)
|
||||
->findAll();
|
||||
|
||||
@ -6208,6 +6214,14 @@ class ClientController extends AdminController
|
||||
|
||||
$pre_client_data = $db2->table('clients')->where('is_active', 1)->where('short_name', $post_client_data['short_name'])->get()->getRowArray();
|
||||
|
||||
if(empty($pre_client_data)){
|
||||
|
||||
$hrAccessData['pre_hr_data'] = [];
|
||||
$hrAccessData['pre_policy_data'] = [];
|
||||
$combinedHrAccessData = $this->constructHrAccessData($hrAccessData, $client_id);
|
||||
return $combinedHrAccessData;
|
||||
}
|
||||
|
||||
$hrAccessData['pre_hr_data'] = $db2->table('client_branch')
|
||||
->select('lc.id as pre_hr_id, lc.name as hr_name, lc.mobile as hr_mobile, lc.email as hr_mail')
|
||||
->join('level_contacts lc', 'client_branch.id = lc.ref_id')
|
||||
|
||||
@ -1225,53 +1225,204 @@ class MasterController extends AdminController
|
||||
$data['page_name'] = 'CD Master List';
|
||||
$data['CD_Master_Data'] = $this->CDMasterModel->getCDMasterList();
|
||||
$data['insurers'] = $this->insurerModel->where('is_active', 1)->findAll();
|
||||
$data['insurer_branch'] = $this->insurerBranchModel->where('is_active', 1)->findAll();
|
||||
$data['clients'] = $this->clientModel->where('is_active', 1)->findAll();
|
||||
$this->loadLayout('cd_master_list', $data);
|
||||
}
|
||||
|
||||
public function createCDMasterData()
|
||||
{
|
||||
// public function createCDMasterData()
|
||||
// {
|
||||
|
||||
// $data = $this->request->getPost();
|
||||
// $id = $data['PrimaryKey'];
|
||||
// $date = (string) $this->request->getPost('opening_date');
|
||||
// $data['opening_date'] = date('Y-m-d', strtotime($date));
|
||||
// // print_rr($data);die();
|
||||
|
||||
// $loggedInUserID = get_session_userid();
|
||||
|
||||
// if (empty($id)) {
|
||||
|
||||
// if ($data) {
|
||||
|
||||
// $insert = $this->CDMasterModel->insert($data);
|
||||
|
||||
// if ($insert) {
|
||||
|
||||
// // Prepare the array with data
|
||||
// $cd_tranction_data = [
|
||||
// 'amount' => $data['opening_bal'],
|
||||
// 'sub_type_id' => 7,
|
||||
// 'client_id' => $data['client_id'],
|
||||
// 'client_policy_id' => null,
|
||||
// 'cd_ac_no' => $data['cd_ac_no'],
|
||||
// 'endorsement_no' => null,
|
||||
// 'insurer_id' => $data['insurer_id'],
|
||||
// 'description' => 'opening Amount',
|
||||
// 'transaction_type' => 'Credit',
|
||||
// 'event_name' => null,
|
||||
// 'updated_by' => 1,
|
||||
// ];
|
||||
|
||||
// $cd_tranction_data['cd_ac_pk'] = $this->CDMasterModel->insertID();
|
||||
// $response = DepositHelper::saveDeposit($cd_tranction_data, $loggedInUserID);
|
||||
|
||||
// session()->setFlashdata('success', "Cash Deposite Master Added Successfully");
|
||||
// return redirect()->to(base_url('/master/cash_deposite/list'));
|
||||
// } else {
|
||||
|
||||
// session()->setFlashdata('error', "Cash Deposite Master Added Failed");
|
||||
// return redirect()->to(base_url('/master/cash_deposite/list'));
|
||||
// }
|
||||
// } else {
|
||||
|
||||
// session()->setFlashdata('error', "Cash Deposite Master Added Failed. Data Not Found");
|
||||
// return redirect()->to(base_url('/master/cash_deposite/list'));
|
||||
// }
|
||||
|
||||
// } else {
|
||||
|
||||
// if ($data) {
|
||||
|
||||
// $insert = $this->CDMasterModel->where('id', $id)->set($data)->update();
|
||||
|
||||
// $data = $this->CDMasterModel->where('id', $id)->first();
|
||||
|
||||
// $cd_transaction_updated_data = [
|
||||
// 'balance' => $data['opening_bal'],
|
||||
// 'amount' => $data['opening_bal']
|
||||
// ];
|
||||
|
||||
// $cd_tranction = $this->clientDepositModel
|
||||
// ->where('client_id', $data['client_id'])
|
||||
// ->where('insurer_id', $data['insurer_id'])
|
||||
// ->where('cd_ac_no', $data['cd_ac_no'])
|
||||
// ->where('sub_type', 7)
|
||||
// ->set($cd_transaction_updated_data)->update();
|
||||
|
||||
// if ($insert) {
|
||||
|
||||
// session()->setFlashdata('success', "Cash Deposite Master Updated Successfully");
|
||||
// return redirect()->to(base_url('/master/cash_deposite/list'));
|
||||
// } else {
|
||||
|
||||
// session()->setFlashdata('error', "Cash Deposite Master Update Failed");
|
||||
// return redirect()->to(base_url('/master/cash_deposite/list'));
|
||||
// }
|
||||
// } else {
|
||||
|
||||
// session()->setFlashdata('error', "Cash Deposite Master Update Failed. Data Not Found");
|
||||
// return redirect()->to(base_url('/master/cash_deposite/list'));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
public function createCDMasterData()
|
||||
{
|
||||
$this->myLogger->logme("error", 'Create CD Master Data API called.');
|
||||
$data = $this->request->getPost();
|
||||
$date = (string) $this->request->getPost('opening_date');
|
||||
$this->myLogger->logme("error", 'Received POST data: ' . json_encode($data));
|
||||
|
||||
$id = $data['PrimaryKey'] ?? null;
|
||||
$date = (string) ($data['opening_date'] ?? '');
|
||||
$data['opening_date'] = date('Y-m-d', strtotime($date));
|
||||
// print_rr($data);die();
|
||||
// Prepare the array with data
|
||||
$cd_tranction_data = [
|
||||
'amount' => $data['opening_bal'],
|
||||
'sub_type_id' => 7,
|
||||
'client_id' => $data['client_id'],
|
||||
'client_policy_id' => null,
|
||||
'cd_ac_no' => $data['cd_ac_no'],
|
||||
'endorsement_no' => null,
|
||||
'insurer_id' => $data['insurer_id'],
|
||||
'description' => 'opening Amount',
|
||||
'transaction_type' => 'Credit',
|
||||
'event_name' => null,
|
||||
'updated_by' => 1,
|
||||
];
|
||||
$this->myLogger->logme("error", 'Formatted opening_date: ' . $data['opening_date']);
|
||||
|
||||
$loggedInUserID = get_session_userid();
|
||||
|
||||
if ($data) {
|
||||
$this->myLogger->logme("error", 'Logged in user ID: ' . $loggedInUserID);
|
||||
|
||||
// === INSERT ===
|
||||
if (empty($id)) {
|
||||
|
||||
$this->myLogger->logme("error", 'Performing INSERT operation.');
|
||||
$insert = $this->CDMasterModel->insert($data);
|
||||
$this->myLogger->logme("error", 'Insert result: ' . json_encode($insert));
|
||||
|
||||
if ($insert) {
|
||||
$cd_tranction_data['cd_ac_pk'] = $this->CDMasterModel->insertID();
|
||||
$response = DepositHelper::saveDeposit($cd_tranction_data, $loggedInUserID);
|
||||
|
||||
session()->setFlashdata('success', "Cash Deposite Master Added Successfully");
|
||||
return redirect()->to(base_url('/master/cash_deposite/list'));
|
||||
$cd_tranction_data = [
|
||||
'amount' => $data['opening_bal'],
|
||||
'sub_type_id' => 7,
|
||||
'client_id' => $data['client_id'],
|
||||
'client_policy_id' => null,
|
||||
'cd_ac_no' => $data['cd_ac_no'],
|
||||
'endorsement_no' => null,
|
||||
'insurer_id' => $data['insurer_id'],
|
||||
'description' => 'Opening Amount',
|
||||
'transaction_type' => 'Credit',
|
||||
'event_name' => null,
|
||||
'updated_by' => 1,
|
||||
'cd_ac_pk' => $insert,
|
||||
];
|
||||
|
||||
$this->myLogger->logme("error", 'Saving initial deposit with data: ' . json_encode($cd_tranction_data));
|
||||
$response = DepositHelper::saveDeposit($cd_tranction_data, $loggedInUserID);
|
||||
$this->myLogger->logme("error", 'Deposit save response: ' . json_encode($response));
|
||||
|
||||
$cd_master_data = $this->CDMasterModel->where('is_active', 1)->where('id', $insert)->first();
|
||||
$this->myLogger->logme("error", 'Inserted CD Master data: ' . json_encode($cd_master_data));
|
||||
|
||||
$cd_master_full_data = $this->CDMasterModel->where('is_active', 1)
|
||||
->where('client_id', $data['client_id'])
|
||||
->where('insurer_id', $data['insurer_id'])
|
||||
->where('insurer_branch_id', $data['insurer_branch_id'])
|
||||
->findAll();
|
||||
|
||||
return $this->respond([
|
||||
'status' => true,
|
||||
'code' => 500,
|
||||
'message' => "CD Master Added Successfully",
|
||||
'cd_master_data' => $cd_master_data,
|
||||
'data' => $cd_master_full_data
|
||||
]);
|
||||
|
||||
} else {
|
||||
|
||||
session()->setFlashdata('error', "Cash Deposite Master Added Failed");
|
||||
return redirect()->to(base_url('/master/cash_deposite/list'));
|
||||
$this->myLogger->logme('error', 'CD Master Insert Failed.');
|
||||
return $this->respond([
|
||||
'status' => true,
|
||||
'code' => 500,
|
||||
'message' => "CD Master Add Failed",
|
||||
], 200);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
|
||||
session()->setFlashdata('error', "Cash Deposite Master Added Failed. Data Not Found");
|
||||
return redirect()->to(base_url('/master/cash_deposite/list'));
|
||||
// === UPDATE ===
|
||||
$this->myLogger->logme("error", 'Performing UPDATE operation for ID: ' . $id);
|
||||
|
||||
$updated = $this->CDMasterModel->where('id', $id)->set($data)->update();
|
||||
$this->myLogger->logme("error", 'Update result: ' . json_encode($updated));
|
||||
|
||||
$existingData = $this->CDMasterModel->where('is_active', 1)->where('id', $id)->first();
|
||||
$this->myLogger->logme("error", 'Existing data after update: ' . json_encode($existingData));
|
||||
|
||||
$cd_transaction_updated_data = [
|
||||
'balance' => $existingData['opening_bal'],
|
||||
'amount' => $existingData['opening_bal']
|
||||
];
|
||||
|
||||
$updateDeposit =$this->clientDepositModel
|
||||
->where('client_id', $existingData['client_id'])
|
||||
->where('insurer_id', $existingData['insurer_id'])
|
||||
->where('cd_ac_no', $existingData['cd_ac_no'])
|
||||
->where('sub_type', 7)
|
||||
->set($cd_transaction_updated_data)
|
||||
->update();
|
||||
$this->myLogger->logme("error", 'Client Deposit Update result: ' . json_encode($updateDeposit));
|
||||
|
||||
if ($updated) {
|
||||
$this->myLogger->logme("error", 'CD Master Updated Successfully.');
|
||||
return $this->respond([
|
||||
'status' => true,
|
||||
'message' => "CD Master Updated Successfully"
|
||||
]);
|
||||
} else {
|
||||
$this->myLogger->logme('error', 'CD Master Update Failed.');
|
||||
return $this->respond([
|
||||
'status' => true,
|
||||
'code' => 500,
|
||||
'message' => "CD Master Updated Failed",
|
||||
], 200);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1598,7 +1749,6 @@ class MasterController extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function generateNewGmailAPIToken()
|
||||
{
|
||||
$gmailapi = \Config\Services::gmailapi();
|
||||
@ -1609,49 +1759,46 @@ class MasterController extends AdminController
|
||||
//testing a sample mail from front end
|
||||
public function testGmailAPI()
|
||||
{
|
||||
|
||||
if ($this->request->getMethod() == 'post') {
|
||||
// $gmailapi = \Config\Services::gmailapi();
|
||||
|
||||
$to = $this->request->getPost('to');
|
||||
$subject = $this->request->getPost('subject');
|
||||
$mail_content = $this->request->getPost('content');
|
||||
$common = ['mail_type'=>'test_mail_ui'];
|
||||
/*****CHOOSE ANY ONE AT A TIME, COMMENT ANOTHER ONE******/
|
||||
if ($this->request->getMethod() == 'post') {
|
||||
// $gmailapi = \Config\Services::gmailapi();
|
||||
|
||||
/*****CALLING DIRECLT USING LIB******/
|
||||
// $res = $gmailapi->sendMessage($to, $subject, $mail_content, 'info@nhanceindia.in', 'info@nhanceindia.in', $cc = [], $bcc = []);
|
||||
$to = $this->request->getPost('to');
|
||||
$subject = $this->request->getPost('subject');
|
||||
$mail_content = $this->request->getPost('content');
|
||||
$common = ['mail_type' => 'test_mail_ui'];
|
||||
/*****CHOOSE ANY ONE AT A TIME, COMMENT ANOTHER ONE******/
|
||||
|
||||
// if($res['status'])
|
||||
// {
|
||||
// return $this->respond(['status' => 'success','code' => 200,'data' => $res],200);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// $this->respond(['status' => 'failed','code' => 500,'data' => $res],200);
|
||||
// }
|
||||
/*****CALLING DIRECLT USING LIB******/
|
||||
/*****CALLING DIRECLT USING LIB******/
|
||||
// $res = $gmailapi->sendMessage($to, $subject, $mail_content, 'info@nhanceindia.in', 'info@nhanceindia.in', $cc = [], $bcc = []);
|
||||
|
||||
/*****CALLING VIA MAIL HELPER******/
|
||||
$res = MailHelper::send_email(['mail' => $to, 'subject' => $subject,'common'=>$common ,'message' => $mail_content]);
|
||||
return $this->respond(['status' => 'success','code' => 200,'data' => $res],200);
|
||||
/*****CALLING VIA MAIL HELPER******/
|
||||
// if($res['status'])
|
||||
// {
|
||||
// return $this->respond(['status' => 'success','code' => 200,'data' => $res],200);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// $this->respond(['status' => 'failed','code' => 500,'data' => $res],200);
|
||||
// }
|
||||
/*****CALLING DIRECLT USING LIB******/
|
||||
|
||||
}
|
||||
/*****CALLING VIA MAIL HELPER******/
|
||||
$res = MailHelper::send_email(['mail' => $to, 'subject' => $subject, 'common' => $common, 'message' => $mail_content]);
|
||||
return $this->respond(['status' => 'success', 'code' => 200, 'data' => $res], 200);
|
||||
/*****CALLING VIA MAIL HELPER******/
|
||||
}
|
||||
|
||||
$this->loadLayout('mail_test');
|
||||
|
||||
}
|
||||
|
||||
|
||||
//testing a sample mail from cli
|
||||
|
||||
//testing a sample mail from cli
|
||||
public function testGmailAPIViaCLI(string $email_id = 'velmurugan.s@venbainfotech.com')
|
||||
{
|
||||
|
||||
|
||||
$email_id = CLI::getOption('to') ? CLI::getOption('to') : $email_id;
|
||||
// print_r($email_id);die();
|
||||
// $gmailapi = \Config\Services::gmailapi();
|
||||
$message = '<style>body{font-family:Arial,sans-serif;color:#333;line-height:1.6;margin:0;padding:0}.email-container{width:100%;max-width:600px;margin:0 auto;padding:20px;border:1px solid #e0e0e0;background-color:#f9f9f9}.header{background-color:#4a90e2;color:#fff;padding:15px;text-align:center}.header h1{margin:0;font-size:24px}.content{padding:20px;background-color:#fff}.content h2{color:#4a90e2;font-size:20px;margin-top:0}.content p{margin:10px 0}.details-table{width:100%;border-collapse:collapse;margin-top:20px}.details-table td,.details-table th{border:1px solid #ddd;padding:10px;text-align:left}.details-table th{background-color:#f2f2f2}.footer{margin-top:20px;font-size:12px;color:#777;text-align:center}.attachment-note{margin-top:20px;padding:10px;background-color:#f7f7f7;border-left:4px solid #4a90e2;font-style:italic}</style><div class=email-container><div class=header><h1>Request for Quotation (RFQ)</h1></div><div class=content><h2>Dear {{RECIPIENT_NAME}},</h2><p>We are reaching out to request a quotation for the following insurance coverage. Please review the details below and provide your quote at your earliest convenience.<h2>RFQ Details</h2><table class=details-table><tr><th>Client name<td>{{CLIENT_NAME}}<tr><th>Coverage Type<td>{{POLICY_LONG_NAME}}<tr><th>Policy Start Date<td>{{POLICY_START_DATE}}<tr><th>Policy Duration<td>{{DURATION}}</table><div class=attachment-note>Please note: Additional terms and details are included in the attachment for your reference.</div><p>Please feel free to reach out if you require any further information to prepare the quote. We look forward to receiving your proposal.<p>Best regards,<p><strong>Nhance India Pvt Ltd</strong><br></div><div class=footer><p>© Nhance India Pvt Ltd. All rights reserved.</div></div>';
|
||||
// $gmailapi = \Config\Services::gmailapi();
|
||||
$message = '<style>body{font-family:Arial,sans-serif;color:#333;line-height:1.6;margin:0;padding:0}.email-container{width:100%;max-width:600px;margin:0 auto;padding:20px;border:1px solid #e0e0e0;background-color:#f9f9f9}.header{background-color:#4a90e2;color:#fff;padding:15px;text-align:center}.header h1{margin:0;font-size:24px}.content{padding:20px;background-color:#fff}.content h2{color:#4a90e2;font-size:20px;margin-top:0}.content p{margin:10px 0}.details-table{width:100%;border-collapse:collapse;margin-top:20px}.details-table td,.details-table th{border:1px solid #ddd;padding:10px;text-align:left}.details-table th{background-color:#f2f2f2}.footer{margin-top:20px;font-size:12px;color:#777;text-align:center}.attachment-note{margin-top:20px;padding:10px;background-color:#f7f7f7;border-left:4px solid #4a90e2;font-style:italic}</style><div class=email-container><div class=header><h1>Request for Quotation (RFQ)</h1></div><div class=content><h2>Dear {{RECIPIENT_NAME}},</h2><p>We are reaching out to request a quotation for the following insurance coverage. Please review the details below and provide your quote at your earliest convenience.<h2>RFQ Details</h2><table class=details-table><tr><th>Client name<td>{{CLIENT_NAME}}<tr><th>Coverage Type<td>{{POLICY_LONG_NAME}}<tr><th>Policy Start Date<td>{{POLICY_START_DATE}}<tr><th>Policy Duration<td>{{DURATION}}</table><div class=attachment-note>Please note: Additional terms and details are included in the attachment for your reference.</div><p>Please feel free to reach out if you require any further information to prepare the quote. We look forward to receiving your proposal.<p>Best regards,<p><strong>Nhance India Pvt Ltd</strong><br></div><div class=footer><p>© Nhance India Pvt Ltd. All rights reserved.</div></div>';
|
||||
|
||||
// $attachments = [
|
||||
// ["filePath" => WRITEPATH."uploads/excel/sample/correction.xls","fileName" => "correction.xls"],
|
||||
@ -1661,34 +1808,34 @@ class MasterController extends AdminController
|
||||
// ];
|
||||
|
||||
$attachments = [
|
||||
["filePath" => ROOTPATH."public/sample_excel/sample_addition.xls","fileName" => "sample_addition.xls"],
|
||||
["filePath" => ROOTPATH."public/sample_excel/sample_inception.xls","fileName" => "sample_inception.xls"],
|
||||
["filePath" => ROOTPATH."public/assets/images/login_bg.jpg","fileName" => "login_bg.jpg"]
|
||||
["filePath" => ROOTPATH . "public/sample_excel/sample_addition.xls", "fileName" => "sample_addition.xls"],
|
||||
["filePath" => ROOTPATH . "public/sample_excel/sample_inception.xls", "fileName" => "sample_inception.xls"],
|
||||
["filePath" => ROOTPATH . "public/assets/images/login_bg.jpg", "fileName" => "login_bg.jpg"]
|
||||
];
|
||||
$common = ['mail_type'=>'test_mail_cli'];
|
||||
$common = ['mail_type' => 'test_mail_cli'];
|
||||
$email_id = CLI::getOption('to') ? CLI::getOption('to') : $email_id;
|
||||
$res = MailHelper::send_email(['mail' => $email_id, 'subject' => 'Mail Via CLI', 'message' => $message,'attachments' => $attachments,'common'=>$common]);
|
||||
echo "Inside the master controller";
|
||||
print_r($res);
|
||||
|
||||
$res = MailHelper::send_email(['mail' => $email_id, 'subject' => 'Mail Via CLI', 'message' => $message, 'attachments' => $attachments, 'common' => $common]);
|
||||
echo "Inside the master controller";
|
||||
print_r($res);
|
||||
}
|
||||
|
||||
public function testZeptoSMTP() {
|
||||
public function testZeptoSMTP()
|
||||
{
|
||||
$message = '<style>body{font-family:Arial,sans-serif;color:#333;line-height:1.6;margin:0;padding:0}.email-container{width:100%;max-width:600px;margin:0 auto;padding:20px;border:1px solid #e0e0e0;background-color:#f9f9f9}.header{background-color:#4a90e2;color:#fff;padding:15px;text-align:center}.header h1{margin:0;font-size:24px}.content{padding:20px;background-color:#fff}.content h2{color:#4a90e2;font-size:20px;margin-top:0}.content p{margin:10px 0}.details-table{width:100%;border-collapse:collapse;margin-top:20px}.details-table td,.details-table th{border:1px solid #ddd;padding:10px;text-align:left}.details-table th{background-color:#f2f2f2}.footer{margin-top:20px;font-size:12px;color:#777;text-align:center}.attachment-note{margin-top:20px;padding:10px;background-color:#f7f7f7;border-left:4px solid #4a90e2;font-style:italic}</style><div class=email-container><div class=header><h1>Request for Quotation (RFQ)</h1></div><div class=content><h2>Dear {{RECIPIENT_NAME}},</h2><p>We are reaching out to request a quotation for the following insurance coverage. Please review the details below and provide your quote at your earliest convenience.<h2>RFQ Details</h2><table class=details-table><tr><th>Client name<td>{{CLIENT_NAME}}<tr><th>Coverage Type<td>{{POLICY_LONG_NAME}}<tr><th>Policy Start Date<td>{{POLICY_START_DATE}}<tr><th>Policy Duration<td>{{DURATION}}</table><div class=attachment-note>Please note: Additional terms and details are included in the attachment for your reference.</div><p>Please feel free to reach out if you require any further information to prepare the quote. We look forward to receiving your proposal.<p>Best regards,<p><strong>Nhance India Pvt Ltd</strong><br></div><div class=footer><p>© Nhance India Pvt Ltd. All rights reserved.</div></div>';
|
||||
$attachments = [
|
||||
["filePath" => ROOTPATH."public/sample_excel/sample_addition.xls","fileName" => "sample_addition.xls"],
|
||||
["filePath" => ROOTPATH."public/sample_excel/sample_inception.xls","fileName" => "sample_inception.xls"],
|
||||
["filePath" => ROOTPATH."public/assets/images/login_bg.jpg","fileName" => "login_bg.jpg"]
|
||||
["filePath" => ROOTPATH . "public/sample_excel/sample_addition.xls", "fileName" => "sample_addition.xls"],
|
||||
["filePath" => ROOTPATH . "public/sample_excel/sample_inception.xls", "fileName" => "sample_inception.xls"],
|
||||
["filePath" => ROOTPATH . "public/assets/images/login_bg.jpg", "fileName" => "login_bg.jpg"]
|
||||
];
|
||||
$email_id = ['srinivas.saravanan@venbainfotech.com','srinivassaravanan2002@gmail.com'];
|
||||
$params = ['mail'=>$email_id];
|
||||
$common = ['mail_type'=>'test_mail_cli'];
|
||||
$email_id = ['srinivas.saravanan@venbainfotech.com', 'srinivassaravanan2002@gmail.com'];
|
||||
$params = ['mail' => $email_id];
|
||||
$common = ['mail_type' => 'test_mail_cli'];
|
||||
// $bcc = "vijayalakshmi@nhanceindia.in,vitvelz@gmail.com,velmurugan.s@venbainfotech.com,hariharan@nhanceindia.in,hariharan@jubiliant.in,srinivas.saravanan@venbainfotech.com";
|
||||
// Send email and get response
|
||||
$result = MailHelper::send_email(['mail' => $email_id, 'params'=>$params,'subject' => 'Mail Via CLI','message' => $message,'attachments' => $attachments,'common'=>$common]);
|
||||
|
||||
$result = MailHelper::send_email(['mail' => $email_id, 'params' => $params, 'subject' => 'Mail Via CLI', 'message' => $message, 'attachments' => $attachments, 'common' => $common]);
|
||||
|
||||
log_message('error',json_encode($result));
|
||||
|
||||
log_message('error', json_encode($result));
|
||||
// Format the response for display/debugging
|
||||
$response = [
|
||||
'success' => $result['success'] ?? false,
|
||||
@ -1703,15 +1850,16 @@ class MasterController extends AdminController
|
||||
// Return JSON response
|
||||
return $this->response->setJSON($result);
|
||||
}
|
||||
|
||||
public function testCheckBounceMails()
|
||||
{
|
||||
$gmailapi = \Config\Services::gmailapi();
|
||||
$from_date = CLI::getOption('from') ? CLI::getOption('from') : null;
|
||||
$to_date = CLI::getOption('to') ? CLI::getOption('to') : null;
|
||||
$count = CLI::getOption('count') ? CLI::getOption('count') : null;
|
||||
$page = CLI::getOption('page') ? CLI::getOption('page') : null;
|
||||
$res = $gmailapi->checkBounceStatus(from_date:$from_date,to_date:$to_date,count:$count,page:$page);
|
||||
print_r($res);
|
||||
$gmailapi = \Config\Services::gmailapi();
|
||||
$from_date = CLI::getOption('from') ? CLI::getOption('from') : null;
|
||||
$to_date = CLI::getOption('to') ? CLI::getOption('to') : null;
|
||||
$count = CLI::getOption('count') ? CLI::getOption('count') : null;
|
||||
$page = CLI::getOption('page') ? CLI::getOption('page') : null;
|
||||
$res = $gmailapi->checkBounceStatus(from_date: $from_date, to_date: $to_date, count: $count, page: $page);
|
||||
print_r($res);
|
||||
}
|
||||
|
||||
public function appCheckList()
|
||||
@ -1721,7 +1869,6 @@ class MasterController extends AdminController
|
||||
$this->checkGoogleOAuthCredentialsinDB();
|
||||
$this->getCronJobsList();
|
||||
$this->checkGdriveRootFolderID();
|
||||
|
||||
}
|
||||
|
||||
public function checkAndCreateDirectories()
|
||||
@ -1740,7 +1887,7 @@ class MasterController extends AdminController
|
||||
'tmp' => WRITEPATH . 'tmp/',
|
||||
'e_card_imgs' => ROOTPATH . 'public/e_card_imgs',
|
||||
'uploads' => ROOTPATH . 'public/uploads',
|
||||
'add_image_upload' => ROOTPATH . 'public/uploads/add_image_upload/',//adverdisement images for enrollment app
|
||||
'add_image_upload' => ROOTPATH . 'public/uploads/add_image_upload/', //adverdisement images for enrollment app
|
||||
'logo' => ROOTPATH . 'public/uploads/logo/',
|
||||
'template_bg' => ROOTPATH . 'public/uploads/template_bg/',
|
||||
'attachments' => WRITEPATH . 'uploads/attachments/',
|
||||
@ -1776,21 +1923,18 @@ class MasterController extends AdminController
|
||||
|
||||
echo "################ CHECKING GMAIL OAUTH FOR EMAIL ###################\n";
|
||||
if (is_array($token) && is_null($token['gmail_api_oauth_credentials'])) {
|
||||
|
||||
|
||||
echo "Email OAuth credentials not found in database.\n";
|
||||
echo "Check the following..!\n";
|
||||
echo "1. Update Gmail Oauth credentials in 'gmail_api_oauth_credentials' field in 'settings' table in JSON format.\n";
|
||||
echo "2. Call this cli route to generate new access token: 'php public/index.php cli/new_gmail_token' from root of the project.\n";
|
||||
echo "3. Call this cli route : 'php public/index.php cli/send_mail_cli --to someone@gmail.com' to send test mail to testGmailAPIViaCLI ( replace someone@gmail.com with real time mail).\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
echo "Gmail OAuth for sending email is set in DB\n";
|
||||
}
|
||||
echo "################################################################\n\n";
|
||||
}
|
||||
|
||||
|
||||
function getCronJobsList()
|
||||
{
|
||||
// Execute the shell command to get cron jobs
|
||||
@ -1806,7 +1950,7 @@ class MasterController extends AdminController
|
||||
} elseif ($output) {
|
||||
// Return the cron job list
|
||||
echo nl2br($output);
|
||||
echo "\n" ;// Convert newlines to <br> for easier HTML rendering
|
||||
echo "\n"; // Convert newlines to <br> for easier HTML rendering
|
||||
} else {
|
||||
echo "Error retrieving cron jobs or no cron jobs set.\n";
|
||||
}
|
||||
@ -1818,13 +1962,10 @@ class MasterController extends AdminController
|
||||
{
|
||||
echo "#################### CHECKING GDRIVE FOLDER ID IN ENV FILE ############################\n";
|
||||
$id = getenv('GDRIVE_ROOT_FOLDER_ID');
|
||||
if($id)
|
||||
{
|
||||
echo $this->cli_colors['green'] . "ID is :". $id . $this->cli_colors['reset']. "\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo $this->cli_colors['red'] ."Gdrive Folder id not set in env file. set it under 'GDRIVE_ROOT_FOLDER_ID' in env file.". $this->cli_colors['reset'] ."\n";
|
||||
if ($id) {
|
||||
echo $this->cli_colors['green'] . "ID is :" . $id . $this->cli_colors['reset'] . "\n";
|
||||
} else {
|
||||
echo $this->cli_colors['red'] . "Gdrive Folder id not set in env file. set it under 'GDRIVE_ROOT_FOLDER_ID' in env file." . $this->cli_colors['reset'] . "\n";
|
||||
}
|
||||
echo "################################################################\n\n";
|
||||
}
|
||||
@ -1834,16 +1975,16 @@ class MasterController extends AdminController
|
||||
|
||||
$message = '<style>body{font-family:Arial,sans-serif;color:#333;line-height:1.6;margin:0;padding:0}.email-container{width:100%;max-width:600px;margin:0 auto;padding:20px;border:1px solid #e0e0e0;background-color:#f9f9f9}.header{background-color:#4a90e2;color:#fff;padding:15px;text-align:center}.header h1{margin:0;font-size:24px}.content{padding:20px;background-color:#fff}.content h2{color:#4a90e2;font-size:20px;margin-top:0}.content p{margin:10px 0}.details-table{width:100%;border-collapse:collapse;margin-top:20px}.details-table td,.details-table th{border:1px solid #ddd;padding:10px;text-align:left}.details-table th{background-color:#f2f2f2}.footer{margin-top:20px;font-size:12px;color:#777;text-align:center}.attachment-note{margin-top:20px;padding:10px;background-color:#f7f7f7;border-left:4px solid #4a90e2;font-style:italic}</style><div class=email-container><div class=header><h1>Request for Quotation (RFQ)</h1></div><div class=content><h2>Dear {{RECIPIENT_NAME}},</h2><p>We are reaching out to request a quotation for the following insurance coverage. Please review the details below and provide your quote at your earliest convenience.<h2>RFQ Details</h2><table class=details-table><tr><th>Client name<td>{{CLIENT_NAME}}<tr><th>Coverage Type<td>{{POLICY_LONG_NAME}}<tr><th>Policy Start Date<td>{{POLICY_START_DATE}}<tr><th>Policy Duration<td>{{DURATION}}</table><div class=attachment-note>Please note: Additional terms and details are included in the attachment for your reference.</div><p>Please feel free to reach out if you require any further information to prepare the quote. We look forward to receiving your proposal.<p>Best regards,<p><strong>Nhance India Pvt Ltd</strong><br></div><div class=footer><p>© Nhance India Pvt Ltd. All rights reserved.</div></div>';
|
||||
$attachments = [
|
||||
["filePath" => ROOTPATH."public/sample_excel/sample_addition.xls","fileName" => "sample_addition.xls"],
|
||||
["filePath" => ROOTPATH."public/sample_excel/sample_inception.xls","fileName" => "sample_inception.xls"],
|
||||
["filePath" => ROOTPATH."public/assets/images/login_bg.jpg","fileName" => "login_bg.jpg"]
|
||||
["filePath" => ROOTPATH . "public/sample_excel/sample_addition.xls", "fileName" => "sample_addition.xls"],
|
||||
["filePath" => ROOTPATH . "public/sample_excel/sample_inception.xls", "fileName" => "sample_inception.xls"],
|
||||
["filePath" => ROOTPATH . "public/assets/images/login_bg.jpg", "fileName" => "login_bg.jpg"]
|
||||
];
|
||||
$email_id = 'venkateshraman786@gmail.com';
|
||||
$params = ['mail'=>$email_id];
|
||||
$params = ['mail' => $email_id];
|
||||
$multi_mails = ['venkateshraman786@gmail.com', 'gowtham.manavalan.la@gmail.com', 'venkatesh.r@venbainfotech.com'];
|
||||
$common = ['mail_type'=>'test_mail_cli'];
|
||||
$common = ['mail_type' => 'test_mail_cli'];
|
||||
$bcc = "vitvelz@gmail.com,velmurugan.s@venbainfotech.com,srinivas.saravanan@venbainfotech.com";
|
||||
$result = MailHelper::send_email(['mail' => $multi_mails, 'bcc'=>$bcc, 'params'=>$params,'subject' => 'Send Multiple " To " emails','message' => $message,'attachments' => $attachments,'common'=>$common]);
|
||||
$result = MailHelper::send_email(['mail' => $multi_mails, 'bcc' => $bcc, 'params' => $params, 'subject' => 'Send Multiple " To " emails', 'message' => $message, 'attachments' => $attachments, 'common' => $common]);
|
||||
dd($result);
|
||||
}
|
||||
|
||||
|
||||
@ -17,6 +17,7 @@ class CDMasterModel extends Model
|
||||
'id',
|
||||
'client_id',
|
||||
'insurer_id',
|
||||
'insurer_branch_id',
|
||||
'cd_ac_no',
|
||||
'opening_bal',
|
||||
'opening_date',
|
||||
@ -66,9 +67,10 @@ class CDMasterModel extends Model
|
||||
|
||||
$query = $this->db->table('cd_master')
|
||||
|
||||
->select('cd_master.*, clients.client_name, clients.short_name, insurers.name AS insurer_name, user_profiles.first_name AS user_name, IFNULL(cd_ac_counts.cd_ac_no_count, 0) AS cd_ac_no_count, IFNULL(cd_ac_counts_for_cdt.cd_ac_no_count_cd_tranction, 0) AS cd_ac_no_count_cd_tranction')
|
||||
->select('cd_master.*, clients.client_name, clients.short_name, insurers.name AS insurer_name, user_profiles.first_name AS user_name, IFNULL(cd_ac_counts.cd_ac_no_count, 0) AS cd_ac_no_count, IFNULL(cd_ac_counts_for_cdt.cd_ac_no_count_cd_tranction, 0) AS cd_ac_no_count_cd_tranction, insurer_branch.branch_name as insurer_branch_name')
|
||||
->join('clients', 'clients.id = cd_master.client_id')
|
||||
->join('insurers', 'insurers.id = cd_master.insurer_id')
|
||||
->join('insurer_branch', 'cd_master.insurer_branch_id = insurer_branch.id', "left")
|
||||
->join('user_profiles', 'user_profiles.id = cd_master.created_by')
|
||||
->join(
|
||||
'(SELECT cd_master.cd_ac_no, cd_master.id, COUNT(client_policy.cd_ac_no) AS cd_ac_no_count
|
||||
@ -102,6 +104,7 @@ class CDMasterModel extends Model
|
||||
->where('clients.is_active', 1)
|
||||
->where('insurers.is_active', 1)
|
||||
->where('user_profiles.is_active', 1)
|
||||
->orderBy('cd_master.id', "desc")
|
||||
->get();
|
||||
|
||||
$result = $query->getResultArray();
|
||||
|
||||
@ -174,10 +174,11 @@ class ClientPolicyModel extends Model
|
||||
|
||||
$builder = $this->db->table('client_policy')
|
||||
->select('client_policy.*, cd_master.cd_ac_no as cd_master_account_no')
|
||||
->select('insurers.name as insurer_name, insurers.short_name as insurer_short')
|
||||
->select('insurers.name as insurer_name, insurers.short_name as insurer_short, insurer_branch.branch_name as insurer_branch_name')
|
||||
->select('clients.client_name as client_name')
|
||||
->join('clients', 'clients.id = client_policy.client_id')
|
||||
->join('insurers', 'insurers.id = client_policy.insurer_id')
|
||||
->join('insurer_branch', 'client_policy.insurer_branch_id = insurer_branch.id', 'left')
|
||||
->join('cd_master', 'cd_master.insurer_id = insurers.id AND cd_master.client_id = client_policy.client_id')
|
||||
->where('client_policy.client_id', $id)
|
||||
->where('cd_master.id = client_policy.cd_ac_pk')
|
||||
@ -190,7 +191,9 @@ class ClientPolicyModel extends Model
|
||||
$builder->whereIn('client_policy.id', $policyId);
|
||||
}
|
||||
|
||||
return $builder->get()->getResult();
|
||||
$data = $builder->get()->getResult();
|
||||
// dd($this->db->getLastQuery());
|
||||
return $data;
|
||||
|
||||
|
||||
|
||||
|
||||
306
app/Views/cd_master_add_modal.php
Normal file
306
app/Views/cd_master_add_modal.php
Normal file
@ -0,0 +1,306 @@
|
||||
<!-- modal content -->
|
||||
<div id="con-close-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" data-backdrop="static">
|
||||
<div class="modal-dialog" <?= !isset($CD_Master_Data) ? 'style="max-width: 35% !important;"' : '' ?>>
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="title">Add Opening Amount</h4>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true" onclick="resetCdMasterFormModal()">×</button>
|
||||
</div>
|
||||
|
||||
<div class="modal-body p-4">
|
||||
<div class="">
|
||||
<form role="form" class="parsley-examples" id="CDMasterForm" enctype="multipart/form-data">
|
||||
<input type="hidden" name="PrimaryKey" id="CD_Master_ID" />
|
||||
<div class="form-group">
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-12">
|
||||
<label for="emp_code">Client<span class="text-danger">*</span></label>
|
||||
<select class="form-control <?= !isset($CD_Master_Data) ? 'readonly-select' : '' ?>" id="cd_client_id" name="client_id" required>
|
||||
<option value="" >Select Client</option>
|
||||
<?php foreach($clients as $value) {
|
||||
if(isset($client['id']) && $value['id'] == $client['id']){
|
||||
$client_select = "selected";
|
||||
}else{
|
||||
$client_select = "";
|
||||
}
|
||||
?>
|
||||
|
||||
<option value="<?= $value['id'] ?>" <?= $client_select ?>><?= $value['client_name'] ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-12">
|
||||
<label for="profile">Insurer<span class="text-danger">*</span></label>
|
||||
<select class="form-control <?= !isset($CD_Master_Data) ? 'readonly-select' : '' ?>" id="insurer_id_for_cd" name="insurer_id" <?= isset($CD_Master_Data) ? 'onchange="filterInsurerBranch(this)"' : '' ?> required>
|
||||
<option value="">Select Insurer</option>
|
||||
<?php foreach($insurers as $value) { ?>
|
||||
<option value="<?= $value['id'] ?>"><?= $value['name'] ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-12">
|
||||
<label for="insurer_branch_id">Insurer Branch<span class="text-danger">*</span></label>
|
||||
<select class="form-control <?= !isset($CD_Master_Data) ? 'readonly-select' : '' ?>" id="insurer_branch_id" name="insurer_branch_id" required>
|
||||
<option value="">Select Insurer Branch</option>
|
||||
<?php if(isset($insurer_branch) && !empty($insurer_branch))
|
||||
{ foreach($insurer_branch as $branch) { ?>
|
||||
<option data-insurer="<?= $branch['insurer_id'] ?>" value="<?= $branch['id'] ?>"><?= $branch['branch_name'] ?></option>
|
||||
<?php } } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-12">
|
||||
<label for="email">Opening Date<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" name="opening_date" id="opening_date" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-12">
|
||||
<label for="mobile">CD Account Number<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="cd_ac_no_for_cd_master" name="cd_ac_no" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-12">
|
||||
<label for="mobile">Opening Amount<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="opening_bal" name="opening_bal" onkeypress="return onlyNumbers(event)" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="cdButtonWrapper" class="form-group text-right m-b-0">
|
||||
<button class="btn btn-primary waves-effect waves-light mr-1" id="btnSubmit">Submit</button>
|
||||
<!-- <button type="button" class="btn btn-secondry waves-effect waves-light mr-1" data-dismiss="modal" aria-hidden="true">Close</button> -->
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.modal -->
|
||||
|
||||
<script>
|
||||
|
||||
//checking and setting this is CD master page or not
|
||||
var isCdMasterPage = <?php echo isset($CD_Master_Data) ? 'true' : 'false'; ?>;
|
||||
console.log("isCdMasterPage", isCdMasterPage);
|
||||
|
||||
$(document).ready(function(){
|
||||
|
||||
var openingDatePicker = flatpickr("#opening_date", {
|
||||
dateFormat: "d-m-Y",
|
||||
allowInput: false
|
||||
});
|
||||
|
||||
if(isCdMasterPage == true){
|
||||
$('#cd_client_id').select2();
|
||||
$('#insurer_id_for_cd').select2();
|
||||
$('#insurer_branch_id').select2();
|
||||
}
|
||||
})
|
||||
|
||||
$('#cd_ac_no_for_cd_master').keyup(function(){
|
||||
console.log('key chnage detected');
|
||||
var cd_ac_no = $(this).val();
|
||||
console.log(cd_ac_no +'-'+cd_ac_no.length);
|
||||
cd_ac_no = cd_ac_no.trim();
|
||||
console.log(cd_ac_no +'-'+cd_ac_no.length);
|
||||
|
||||
$.ajax({
|
||||
url: '<?php echo base_url('util/check_cd_ac_no/');?>'+cd_ac_no,
|
||||
type: "GET",
|
||||
dataType: 'json',
|
||||
success: function (res) {
|
||||
|
||||
console.log(res)
|
||||
if(res.status == true){
|
||||
toastr.warning(res.message, 'warning');
|
||||
// $('#cd_ac_no').val('');
|
||||
$('#btnSubmit').prop('disabled',true);
|
||||
return;
|
||||
}
|
||||
$('#btnSubmit').prop('disabled',false);
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
}
|
||||
});
|
||||
|
||||
})
|
||||
|
||||
$('#CDMasterForm').submit(function(event) {
|
||||
|
||||
event.preventDefault();
|
||||
console.log("submit CD Master Form Data function called");
|
||||
|
||||
var isValid = $('#CDMasterForm').parsley().validate();
|
||||
|
||||
if (!isValid) {
|
||||
$('#CDMasterForm').find('input, select, textarea').each(function() {
|
||||
if ($(this).parsley().isValid() === false && !$(this).val()) {
|
||||
console.log('Empty field ID:', this.id);
|
||||
}
|
||||
});
|
||||
console.log('Form is Empty', 'Warning');
|
||||
return;
|
||||
}
|
||||
|
||||
let formData = new FormData($('#CDMasterForm')[0]);
|
||||
console.log("formData", formData);
|
||||
|
||||
let url = '<?= base_url('master/cash_deposite/create') ?>';
|
||||
console.log("url", url);
|
||||
|
||||
$.ajax({
|
||||
data: formData,
|
||||
url: url,
|
||||
type: "POST",
|
||||
dataType: 'json',
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(res) {
|
||||
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
|
||||
console.log('CD Mater Form Submit Responce', res);
|
||||
|
||||
if (res.status == true) {
|
||||
toastr.success(res.message, 'Success');
|
||||
|
||||
if(isCdMasterPage == false){
|
||||
appendCDACNO(res.data, res.cd_master_data.id);
|
||||
// appendCdAccNo(res.cd_master_data);
|
||||
}
|
||||
|
||||
} else {
|
||||
toastr.warning(res.message, 'WARNING');
|
||||
}
|
||||
|
||||
//this function for reset the form values after submitting the form or closing the form
|
||||
resetCdMasterFormModal()
|
||||
$('.close').click();
|
||||
|
||||
//if this page is CD mater form page than the page reload other wise not to reload
|
||||
if(isCdMasterPage == true){
|
||||
window.location.href = '<?= base_url('master/cash_deposite/list') ?>';
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
toastr.error('An error occurred while adding the CD account number.', 'ERROR');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function onlyNumbers(event) {
|
||||
var charcode;
|
||||
charcode = event.which || event.keyCode;
|
||||
if (charcode >= 48 && charcode <= 57 || charcode == 46) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
function resetCdMasterFormModal(){
|
||||
|
||||
console.log("resetCdMasterFormModal() function called");
|
||||
|
||||
$('#CD_Master_ID').val('');
|
||||
$('#opening_date').val('');
|
||||
$('#cd_ac_no_for_cd_master').val('');
|
||||
$('#opening_bal').val('');
|
||||
$('#CDMasterForm').parsley().reset();
|
||||
$('#cd_ac_no_for_cd_master').prop("disabled", false);
|
||||
$('#opening_bal').prop("disabled", false);
|
||||
|
||||
if(isCdMasterPage == true){
|
||||
$('#client_id').val('').change();
|
||||
$('#insurer_id_for_cd').val('').change();
|
||||
$('#insurer_branch_id').val('').change();
|
||||
|
||||
$('#client_id').prop("disabled", false);
|
||||
$('#insurer_id_for_cd').prop("disabled", false);
|
||||
$('#insurer_branch_id').prop("disabled", false);
|
||||
|
||||
$('#CDMasterForm')[0].reset();
|
||||
}
|
||||
}
|
||||
|
||||
function filterInsurerBranch(input) {
|
||||
|
||||
console.log("filterInsurerBranch function called");
|
||||
|
||||
let insurer_id = $(input).val();
|
||||
console.log("insurer_id", insurer_id);
|
||||
|
||||
let branch_data = <?= isset($insurer_branch) && !empty($insurer_branch) ? json_encode($insurer_branch) : '[]' ?>;
|
||||
console.log("branch_data", branch_data);
|
||||
|
||||
let filteredBranches = branch_data.filter(branch => branch.insurer_id == insurer_id);
|
||||
console.log("filteredBranches", filteredBranches);
|
||||
|
||||
let $branchSelect = $('#insurer_branch_id');
|
||||
$branchSelect.empty().append('<option value="">Select Insurer Branch</option>');
|
||||
|
||||
filteredBranches.forEach(branch => {
|
||||
$branchSelect.append(
|
||||
$('<option>', {
|
||||
value: branch.id,
|
||||
text: branch.branch_name
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
$branchSelect.val('').trigger('change.select2');
|
||||
}
|
||||
|
||||
function showCdMasterAddModal(){
|
||||
|
||||
if(isCdMasterPage == true){
|
||||
$('#client_id').val('');
|
||||
$('#insurer_id_for_cd').val('');
|
||||
$('#insurer_branch_id').val('');
|
||||
}
|
||||
|
||||
$('#opening_date').val('');
|
||||
$('#cd_ac_no_for_cd_master').val('');
|
||||
$('#opening_bal').val('');
|
||||
// $('#CDMasterForm').attr('action', '<?php echo base_url('master/cash_deposite/create');?>');
|
||||
$('#title').html('Add Opening Amount');
|
||||
$('#btnSubmit').html('Submit');
|
||||
|
||||
var myModal = new bootstrap.Modal(document.getElementById('con-close-modal'));
|
||||
myModal.show();
|
||||
}
|
||||
|
||||
function appendCdAccNo(data) {
|
||||
|
||||
console.log("appendCdAccNo function called :", data);
|
||||
const option = $('<option>', {
|
||||
value: data.id,
|
||||
text: data.cd_ac_no,
|
||||
selected: true // directly set selected in the object
|
||||
});
|
||||
|
||||
console.log("option", option);
|
||||
$('#cd_ac_no_for_cd_master').append(option);
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
@ -16,6 +16,7 @@ table.dataTable thead th {
|
||||
|
||||
max-width: 98% !important;
|
||||
}
|
||||
|
||||
.custom-dropdown-menu {
|
||||
display: none;
|
||||
position: absolute;
|
||||
@ -42,6 +43,15 @@ table.dataTable thead th {
|
||||
color: #16181b !important;
|
||||
cursor: pointer !important;
|
||||
}
|
||||
|
||||
.addbtnStyle{
|
||||
margin-left: 20px !important;
|
||||
}
|
||||
|
||||
.dataTables_filter {
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<div class="row" id="client_list">
|
||||
@ -53,17 +63,18 @@ table.dataTable thead th {
|
||||
<h4 style="position: relative;">CD Master List</h4>
|
||||
</div>
|
||||
<div class="col-6" style="text-align: right; position: relative;top: 56px;">
|
||||
<button type="button" id="btnAdd" class="btn btn-primary waves-effect waves-light"
|
||||
<!-- <button type="button" id="btnAdd" class="btn btn-primary waves-effect waves-light"
|
||||
data-toggle="modal" data-target="#con-close-modal" data-placement="top" title="Add"
|
||||
data-trigger="hover">ADD</button>
|
||||
data-trigger="hover">ADD</button> -->
|
||||
</div>
|
||||
</div>
|
||||
<table class="table table-sm table-hover m-0 table-centered dt-responsive w-100" cellspacing="0"
|
||||
id="tickets-table">
|
||||
<table id="scroll-horizontal-datatable" class="table w-100 nowrap" >
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
<th class="font-weight-medium">S.No.</th>
|
||||
<th class="font-weight-medium">Client Name</th>
|
||||
<th class="font-weight-medium">Insurer Name</th>
|
||||
<th class="font-weight-medium">Insurer Branch Name</th>
|
||||
<th class="font-weight-medium">Opening Date</th>
|
||||
<th class="font-weight-medium">CD Account No</th>
|
||||
<th class="font-weight-medium">Opening Amount</th>
|
||||
@ -71,17 +82,17 @@ table.dataTable thead th {
|
||||
<th class="font-weight-medium">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<?php foreach($CD_Master_Data as $row){ ?>
|
||||
<?php foreach($CD_Master_Data as $index => $row){ ?>
|
||||
<tr>
|
||||
<td><?= $index + 1; ?></td>
|
||||
<td><?php echo $row['client_name']; ?>( <?= $row['short_name'] ?> )</td>
|
||||
<td><?php echo $row['insurer_name']; ?></td>
|
||||
<td><?php echo $row['insurer_branch_name']; ?></td>
|
||||
<td><?php echo date('d-m-Y', strtotime($row['opening_date'])); ?></td>
|
||||
<td><?php echo $row['cd_ac_no']; ?></td>
|
||||
<td><?php echo $row['opening_bal']; ?></td>
|
||||
<td><?php echo date('d-M-Y h:i A', strtotime($row['created_at'])) ?> by
|
||||
<?php echo $row['user_name']; ?></td>
|
||||
<td><?php echo date('d-M-Y h:i A', strtotime($row['created_at'])) ?> by <?php echo $row['user_name']; ?></td>
|
||||
<td>
|
||||
<div class="btn-group dropdown">
|
||||
<a href="javascript: void(0);"class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown"aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
|
||||
@ -103,199 +114,129 @@ table.dataTable thead th {
|
||||
</div>
|
||||
<!-- end row -->
|
||||
|
||||
<?php include("cd_master_add_modal.php"); ?>
|
||||
|
||||
<!-- modal content -->
|
||||
|
||||
<div id="con-close-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
|
||||
aria-hidden="true" data-backdrop="static" style="display: none;">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="title">Add Opening Amount</h4>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
</div>
|
||||
|
||||
<div class="modal-body p-4">
|
||||
<div class="">
|
||||
|
||||
<form role="form" class="parsley-examples" method="post" id="CDMasterForm" action=""
|
||||
enctype="multipart/form-data">
|
||||
<input type="hidden" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>" />
|
||||
<input type="hidden" name="PrimaryKey" id="CD_Master_ID" />
|
||||
<div class="form-group">
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-12">
|
||||
<label for="emp_code">Client<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="client_id" name="client_id" required>
|
||||
<option value="">Select Client</option>
|
||||
<?php foreach($clients as $value) { ?>
|
||||
<option value="<?= $value['id'] ?>"><?= $value['client_name'] ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-12">
|
||||
<label for="profile">Insurer<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="insurer_id" name="insurer_id" required>
|
||||
<option value="">Select Insurer</option>
|
||||
<?php foreach($insurers as $value) { ?>
|
||||
<option value="<?= $value['id'] ?>"><?= $value['name'] ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-12">
|
||||
<label for="email">Opening Date<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" name="opening_date" id="opening_date" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-12">
|
||||
<label for="mobile">CD Account Number<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="cd_ac_no" name="cd_ac_no" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-12">
|
||||
<label for="mobile">Opening Amount<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="opening_bal" name="opening_bal" onkeypress="return onlyNumbers(event)" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-group text-right m-b-0">
|
||||
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1"
|
||||
id="btnSubmit">Submit</button>
|
||||
<!-- <button type="button" class="btn btn-secondry waves-effect waves-light mr-1" data-dismiss="modal" aria-hidden="true">Close</button> -->
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- /.modal -->
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
const table = document.getElementById("tickets-table");
|
||||
|
||||
// Create custom dropdown
|
||||
function createCustomDropdown(row) {
|
||||
const originalDropdown = row.querySelector('.dropdown-menu');
|
||||
if (!originalDropdown) return null;
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
const table = document.getElementById("scroll-horizontal-datatable");
|
||||
|
||||
const customDropdown = document.createElement('div');
|
||||
customDropdown.className = 'custom-dropdown-menu';
|
||||
customDropdown.innerHTML = originalDropdown.innerHTML;
|
||||
// Create custom dropdown
|
||||
function createCustomDropdown(row) {
|
||||
const originalDropdown = row.querySelector('.dropdown-menu');
|
||||
if (!originalDropdown) return null;
|
||||
|
||||
return customDropdown;
|
||||
}
|
||||
const customDropdown = document.createElement('div');
|
||||
customDropdown.className = 'custom-dropdown-menu';
|
||||
customDropdown.innerHTML = originalDropdown.innerHTML;
|
||||
|
||||
let activeDropdown = null;
|
||||
return customDropdown;
|
||||
}
|
||||
|
||||
// Add click event listener to rows
|
||||
table.querySelectorAll("tbody tr").forEach(row => {
|
||||
const customDropdown = createCustomDropdown(row);
|
||||
if (!customDropdown) return;
|
||||
let activeDropdown = null;
|
||||
|
||||
row.customDropdown = customDropdown;
|
||||
document.body.appendChild(customDropdown);
|
||||
// Add click event listener to rows
|
||||
table.querySelectorAll("tbody tr").forEach(row => {
|
||||
const customDropdown = createCustomDropdown(row);
|
||||
if (!customDropdown) return;
|
||||
|
||||
row.addEventListener("click", function(event) {
|
||||
// Ignore clicks on the last column (action column)
|
||||
if (event.target.closest('td') === row.lastElementChild) {
|
||||
return;
|
||||
}
|
||||
row.customDropdown = customDropdown;
|
||||
document.body.appendChild(customDropdown);
|
||||
|
||||
// Hide any active dropdown
|
||||
if (activeDropdown && activeDropdown !== customDropdown) {
|
||||
activeDropdown.style.display = 'none';
|
||||
}
|
||||
|
||||
// Toggle the dropdown display
|
||||
const isActive = customDropdown.style.display === 'block';
|
||||
customDropdown.style.display = isActive ? 'none' : 'block';
|
||||
|
||||
// Set the position of the dropdown
|
||||
const rect = event.target.closest('td').getBoundingClientRect();
|
||||
customDropdown.style.position = 'absolute';
|
||||
customDropdown.style.left = `${rect.left}px`;
|
||||
customDropdown.style.top = `${rect.bottom + 5}px`;
|
||||
|
||||
// Set as active dropdown
|
||||
activeDropdown = isActive ? null : customDropdown;
|
||||
|
||||
event.stopPropagation();
|
||||
});
|
||||
|
||||
// Preserve click handlers for modal actions
|
||||
customDropdown.querySelectorAll('.dropdown-item').forEach(item => {
|
||||
item.addEventListener('click', function(e) {
|
||||
const isModalAction = this.hasAttribute('data-toggle') && this.getAttribute('data-toggle') === 'modal';
|
||||
if (isModalAction) {
|
||||
return; // Allow modal to function normally
|
||||
row.addEventListener("click", function(event) {
|
||||
// Ignore clicks on the last column (action column)
|
||||
if (event.target.closest('td') === row.lastElementChild) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Close the dropdown if it's not related to modal
|
||||
if (activeDropdown) {
|
||||
// Hide any active dropdown
|
||||
if (activeDropdown && activeDropdown !== customDropdown) {
|
||||
activeDropdown.style.display = 'none';
|
||||
activeDropdown = null;
|
||||
}
|
||||
|
||||
const onclickAttr = this.getAttribute('onclick');
|
||||
if (onclickAttr) {
|
||||
eval(onclickAttr);
|
||||
}
|
||||
// Toggle the dropdown display
|
||||
const isActive = customDropdown.style.display === 'block';
|
||||
customDropdown.style.display = isActive ? 'none' : 'block';
|
||||
|
||||
const href = this.getAttribute('href');
|
||||
if (href && href !== '#') {
|
||||
window.location.href = href;
|
||||
}
|
||||
// Set the position of the dropdown
|
||||
const rect = event.target.closest('td').getBoundingClientRect();
|
||||
customDropdown.style.position = 'absolute';
|
||||
customDropdown.style.left = `${rect.left}px`;
|
||||
customDropdown.style.top = `${rect.bottom + 5}px`;
|
||||
|
||||
e.stopPropagation();
|
||||
// Set as active dropdown
|
||||
activeDropdown = isActive ? null : customDropdown;
|
||||
|
||||
event.stopPropagation();
|
||||
});
|
||||
|
||||
// Preserve click handlers for modal actions
|
||||
customDropdown.querySelectorAll('.dropdown-item').forEach(item => {
|
||||
item.addEventListener('click', function(e) {
|
||||
const isModalAction = this.hasAttribute('data-toggle') && this.getAttribute('data-toggle') === 'modal';
|
||||
if (isModalAction) {
|
||||
return; // Allow modal to function normally
|
||||
}
|
||||
|
||||
// Close the dropdown if it's not related to modal
|
||||
if (activeDropdown) {
|
||||
activeDropdown.style.display = 'none';
|
||||
activeDropdown = null;
|
||||
}
|
||||
|
||||
const onclickAttr = this.getAttribute('onclick');
|
||||
if (onclickAttr) {
|
||||
eval(onclickAttr);
|
||||
}
|
||||
|
||||
const href = this.getAttribute('href');
|
||||
if (href && href !== '#') {
|
||||
window.location.href = href;
|
||||
}
|
||||
|
||||
e.stopPropagation();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// Close dropdown when clicking outside
|
||||
document.addEventListener("click", function() {
|
||||
if (activeDropdown) {
|
||||
activeDropdown.style.display = 'none';
|
||||
activeDropdown = null;
|
||||
}
|
||||
// Close dropdown when clicking outside
|
||||
document.addEventListener("click", function() {
|
||||
if (activeDropdown) {
|
||||
activeDropdown.style.display = 'none';
|
||||
activeDropdown = null;
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
$('#tickets-table').DataTable({
|
||||
dom: "<'row'<'col-sm-0'f><'col-sm-9 text-right'B>>" +
|
||||
$('#scroll-horizontal-datatable').DataTable({
|
||||
scrollX: true,
|
||||
dom: "<'row'<'col-sm-6'f><'col-sm-6 text-right'B>>" +
|
||||
"<'row'<'col-sm-12'tr>>" +
|
||||
"<'row'<'col-sm-5'i><'col-sm-7'p>>",
|
||||
buttons: [{
|
||||
extend: 'csv',
|
||||
text: 'CSV',
|
||||
title: 'CD-Master-List',
|
||||
className: 'my_class',
|
||||
exportOptions: {
|
||||
columns: ':not(:last-child)'
|
||||
},
|
||||
}],
|
||||
buttons: [
|
||||
{
|
||||
extend: 'csv',
|
||||
text: 'CSV',
|
||||
title: 'CD-Master-List',
|
||||
className: 'my_class',
|
||||
exportOptions: {
|
||||
columns: ':not(:last-child)'
|
||||
},
|
||||
},
|
||||
{
|
||||
text: 'Add',
|
||||
className: 'buttons-html5 addbtnStyle',
|
||||
action: function (e, dt, node, config) {
|
||||
showCdMasterAddModal();
|
||||
}
|
||||
}
|
||||
],
|
||||
language: {
|
||||
search: "_INPUT_",
|
||||
searchPlaceholder: "Search..."
|
||||
@ -314,45 +255,6 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||
<?php if (session()->has('success')) : ?>
|
||||
toastr.success('<?= session()->getFlashdata('success') ?>', 'success');
|
||||
<?php endif; ?>
|
||||
|
||||
var endDatePicker = flatpickr("#opening_date", {
|
||||
dateFormat: "d-m-Y",
|
||||
// defaultDate: endDate,
|
||||
allowInput: false
|
||||
});
|
||||
|
||||
$('#client_id').select2();
|
||||
$('#insurer_id').select2();
|
||||
|
||||
})
|
||||
|
||||
$('#btnAdd').click(function(){
|
||||
$('#client_id').val('');
|
||||
$('#insurer_id').val('');
|
||||
$('#opening_date').val('');
|
||||
$('#cd_ac_no').val('');
|
||||
$('#opening_bal').val('');
|
||||
$('#CDMasterForm').attr('action', '<?php echo base_url('master/cash_deposite/create');?>');
|
||||
$('#title').html('Add Opening Amount');
|
||||
$('#btnSubmit').html('Submit');
|
||||
|
||||
|
||||
})
|
||||
|
||||
$('.close').click(function(){
|
||||
$('#CD_Master_ID').val('');
|
||||
$('#client_id').val('').change();
|
||||
$('#insurer_id').val('').change();
|
||||
$('#opening_date').val('');
|
||||
$('#cd_ac_no').val('');
|
||||
$('#opening_bal').val('');
|
||||
$('#CDMasterForm')[0].reset();
|
||||
$('#CDMasterForm').parsley().reset();
|
||||
$('#client_id').prop("disabled", false);
|
||||
$('#insurer_id').prop("disabled", false);
|
||||
$('#cd_ac_no').prop("disabled", false);
|
||||
$('#opening_bal').prop("disabled", false)
|
||||
|
||||
})
|
||||
|
||||
$('body').on('click', '.btnEdit', function () {
|
||||
@ -371,10 +273,12 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||
$('#updateModal').modal('show');
|
||||
$('#CDMasterForm').attr('action', '<?php echo base_url('master/cash_deposite/edit');?>');
|
||||
$('#CD_Master_ID').val(res.data.id);
|
||||
$('#client_id').val(res.data.client_id).change();
|
||||
$('#client_id').prop("disabled", true);
|
||||
$('#insurer_id').val(res.data.insurer_id).change();
|
||||
$('#insurer_id').prop("disabled", true);
|
||||
$('#cd_client_id').val(res.data.client_id).change();
|
||||
$('#cd_client_id').prop("disabled", true);
|
||||
$('#insurer_id_for_cd').val(res.data.insurer_id).change();
|
||||
$('#insurer_id_for_cd').prop("disabled", true);
|
||||
$('#insurer_branch_id').val(res.data.insurer_id).change();
|
||||
$('#insurer_branch_id').prop("disabled", true);
|
||||
$('#opening_date').val(res.data.opening_date);
|
||||
$('#cd_ac_no').val(res.data.cd_ac_no);
|
||||
//$('#cd_ac_no').prop("disabled", true);
|
||||
@ -394,37 +298,6 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||
});
|
||||
});
|
||||
|
||||
$('#cd_ac_no').keyup(function(){
|
||||
console.log('key chnage detected');
|
||||
var cd_ac_no = $(this).val();
|
||||
console.log(cd_ac_no +'-'+cd_ac_no.length);
|
||||
cd_ac_no = cd_ac_no.trim();
|
||||
console.log(cd_ac_no +'-'+cd_ac_no.length);
|
||||
|
||||
|
||||
$.ajax({
|
||||
url: '<?php echo base_url('util/check_cd_ac_no/');?>'+cd_ac_no,
|
||||
type: "GET",
|
||||
dataType: 'json',
|
||||
success: function (res) {
|
||||
|
||||
console.log(res)
|
||||
if(res.status == true){
|
||||
toastr.warning(res.message, 'warning');
|
||||
// $('#cd_ac_no').val('');
|
||||
$('#btnSubmit').prop('disabled',true);
|
||||
return;
|
||||
}
|
||||
$('#btnSubmit').prop('disabled',false);
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
}
|
||||
});
|
||||
|
||||
})
|
||||
|
||||
function removeCDMaster(element) {
|
||||
|
||||
Swal.fire({
|
||||
@ -470,10 +343,4 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||
|
||||
}
|
||||
|
||||
function onlyNumbers(event) {
|
||||
var charcode;
|
||||
charcode = event.which || event.keyCode;
|
||||
if (charcode >= 48 && charcode <= 57 || charcode == 46) return true;
|
||||
return false;
|
||||
}
|
||||
</script>
|
||||
@ -21,6 +21,7 @@
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
<th class="font-weight-medium">Insurer Name</th>
|
||||
<th class="font-weight-medium">Insurer Branch Name</th>
|
||||
<th class="font-weight-medium">CD Account Number</th>
|
||||
<th class="font-weight-medium">Current Balance</th>
|
||||
<th class="font-weight-medium">Action</th>
|
||||
@ -33,6 +34,7 @@
|
||||
<?php foreach ($clientData as $value): ?>
|
||||
|
||||
<td><?php echo $value->insurer_name;?></td>
|
||||
<td><?php echo $value->insurer_branch_name;?></td>
|
||||
<td><?php echo $value->cd_master_account_no;?></td>
|
||||
|
||||
<td>₹
|
||||
|
||||
@ -32,6 +32,13 @@ body {
|
||||
margin: 0 5px 10px!important;
|
||||
}
|
||||
|
||||
.readonly-select {
|
||||
pointer-events: none;
|
||||
/* background-color: #f0f0f0; */
|
||||
background-color: #e0e0e0;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<style>
|
||||
|
||||
@ -56,7 +56,6 @@
|
||||
</select>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label for="policy_type"> Policy Type<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="policy_type" name="policy_type_id" required>
|
||||
@ -80,10 +79,10 @@
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label for="insurer">Insurer<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="insurer" name="insurer" required>
|
||||
<select class="form-control" id="insurer" name="insurer" onchange="setInsuerAndBranchValue(this)" required>
|
||||
<option value="">Select Insurer</option>
|
||||
<?php foreach ($insurer as $value) { ?>
|
||||
<option value="<?= $value['id'] . '-' . $value['insurer_id'] ?>">
|
||||
<option data-id="<?= $value['insurer_id']?>" value="<?= $value['id'] . '-' . $value['insurer_id'] ?>">
|
||||
<?= $value['insurer_name'] . '-' . $value['branch_code'] ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
@ -206,6 +205,7 @@
|
||||
<?php include('policy_gmc_terms.php'); ?>
|
||||
<?php include('policy_gpa_terms.php'); ?>
|
||||
<?php include('other_policy_terms.php'); ?>
|
||||
<?php include('cd_master_add_modal.php'); ?>
|
||||
|
||||
<!-- Center modal content -->
|
||||
<div class="modal fade" id="lead_modal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="false">
|
||||
@ -690,36 +690,43 @@
|
||||
$('#insurer').change(function() {
|
||||
|
||||
var id = $(this).val();
|
||||
var insurer_id = $(this).find('option:selected').data('id');
|
||||
console.log('insurer_id', insurer_id)
|
||||
console.log('insurer and branch ids', id)
|
||||
var client_id = $('#client_id_policy').val()
|
||||
var parts = id.split('-');
|
||||
|
||||
var firstPart = parts[0];
|
||||
var secondPart = parts[1];
|
||||
|
||||
console.log('firstPart', firstPart);
|
||||
console.log('secondPart', secondPart);
|
||||
|
||||
var url = "<?= base_url("util/police-by-insurer/") ?>" + secondPart;
|
||||
var url_for_cd = "<?= base_url("util/get_cd_ac/") ?>" + client_id + '/' + secondPart;
|
||||
var url_for_cd = "<?= base_url("util/get_cd_ac/") ?>" + client_id + '/' + secondPart + '/' + firstPart;
|
||||
|
||||
var selectedOption = $('#base_policy').find(':selected');
|
||||
var base_policy_data_id = selectedOption.data('id');
|
||||
|
||||
if(secondPart && firstPart){
|
||||
$.get(url_for_cd, function(response){
|
||||
|
||||
|
||||
$.get(url_for_cd, function(response){
|
||||
|
||||
// console.log(response)
|
||||
// console.log(response.data)
|
||||
|
||||
if(response.status == false && response.insurer_id != 'undefined'){
|
||||
toastr.warning('The CD Account Number not found.', 'Warning');
|
||||
return;
|
||||
}
|
||||
|
||||
appendCDACNO(response.data)
|
||||
|
||||
}).fail(function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
});
|
||||
// console.log(response)
|
||||
// console.log(response.data)
|
||||
|
||||
if(response.status == false && response.insurer_id != 'undefined'){
|
||||
toastr.warning('The CD Account Number not found.', 'Warning');
|
||||
return;
|
||||
}
|
||||
appendCDACNO(response.data)
|
||||
|
||||
}).fail(function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
$(document).ready(function() {
|
||||
@ -1204,7 +1211,6 @@
|
||||
return word.trim();
|
||||
}
|
||||
|
||||
|
||||
function convertCommaNumberToWords(input) {
|
||||
|
||||
let number;
|
||||
@ -1683,19 +1689,28 @@
|
||||
text: 'Select CD Account Number'
|
||||
}));
|
||||
|
||||
$('#cd_ac_no').append($('<option>', {
|
||||
value: 'add_cd',
|
||||
text: '+ Add New CD'
|
||||
}));
|
||||
|
||||
$.each(data, function(index, item) {
|
||||
const option = $('<option>', {
|
||||
value: item.id,
|
||||
text: item.cd_ac_no
|
||||
});
|
||||
|
||||
if (select === item.id) {
|
||||
if (select == item.id) {
|
||||
//console.log('selected');
|
||||
option.attr('selected', true);
|
||||
}
|
||||
|
||||
$('#cd_ac_no').append(option);
|
||||
});
|
||||
|
||||
if (select) {
|
||||
$('#cd_ac_no').val(select).trigger('change');
|
||||
}
|
||||
}
|
||||
|
||||
// append Base Policy to the dropdown for edit only
|
||||
@ -2095,4 +2110,33 @@
|
||||
});
|
||||
}
|
||||
|
||||
$('#cd_ac_no').change(function(){
|
||||
|
||||
let cd_ac_no = $(this).val();
|
||||
|
||||
if(cd_ac_no == "add_cd"){
|
||||
showCdMasterAddModal();
|
||||
$(this).val("");
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
function setInsuerAndBranchValue(input){
|
||||
|
||||
var id = $(input).val();
|
||||
console.log('id', id);
|
||||
|
||||
var parts = id.split('-');
|
||||
console.log('parts', parts);
|
||||
|
||||
var firstPart = parts[0];
|
||||
console.log('firstPart', firstPart);
|
||||
|
||||
var secondPart = parts[1];
|
||||
console.log('secondPart', secondPart);
|
||||
|
||||
$('#insurer_branch_id').val(firstPart).trigger('change');
|
||||
$('#insurer_id_for_cd').val(secondPart).trigger('change');
|
||||
}
|
||||
|
||||
</script>
|
||||
@ -2983,16 +2983,18 @@ function getCDAccountNumber(input)
|
||||
let client_id = $('#client_id').val();
|
||||
let client_type = $('#client_type').val();
|
||||
let insurer_id = $(input).find('option:selected').attr('data-id');
|
||||
let insurer_branch_id = $(input).find('option:selected').attr('data-bid');
|
||||
|
||||
console.log('insurer', insurer);
|
||||
console.log('follow_insurer_id client_id', client_id);
|
||||
console.log('follow_insurer_id insurer_id', insurer_id);
|
||||
console.log('follow_insurer_id insurer_branch_id', insurer_branch_id);
|
||||
console.log('follow_insurer_id unique_id', unique_id);
|
||||
|
||||
if(client_id && insurer_id){
|
||||
if(client_type == 1){
|
||||
$.ajax({
|
||||
url: '<?= base_url("/util/getCDAccNoByClientAndInsurer/") ?>' + client_id + '/' + insurer_id,
|
||||
url: '<?= base_url("/util/getCDAccNoByClientAndInsurer/") ?>' + client_id + '/' + insurer_id + '/' + insurer_branch_id,
|
||||
type: "GET",
|
||||
dataType: 'json',
|
||||
success: function(res) {
|
||||
|
||||
@ -3970,7 +3970,7 @@ function ajaxRequest(formData) {
|
||||
|
||||
console.log(res);
|
||||
if (res.status == 'success' && res.code == 200) {
|
||||
toastr.success('Mail send Successfully', 'SUCCESS')
|
||||
toastr.success('Mail sent Successfully', 'SUCCESS')
|
||||
if(res.is_placement == true){
|
||||
clearInterval(intervalId);
|
||||
console.log('******** Intervel Cleared ********')
|
||||
|
||||
Loading…
Reference in New Issue
Block a user