FIX_UNLAYER_EDITOR,FEAT_SIDEBAR_EXTENDED,FIX_MAIL_HELPER_SRINIVAS

This commit is contained in:
Srinivas-Saravanan 2025-01-22 11:24:25 +05:30
parent 209f66b484
commit 5c35f32a3f
6 changed files with 177 additions and 106 deletions

View File

@ -1658,7 +1658,7 @@ class MasterController extends AdminController
$email_id = CLI::getOption('to') ? CLI::getOption('to') : $email_id; $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]); $res = MailHelper::send_email(['mail' => $email_id, 'subject' => 'Mail Via CLI', 'message' => $message,'attachments' => $attachments,'common'=>$common]);
echo "Inside the master controller"; echo "Inside the master controller";
print_r($res); print_r($res['data']['zepto_api']);
} }
@ -1669,10 +1669,11 @@ class MasterController extends AdminController
["filePath" => ROOTPATH."public/sample_excel/sample_inception.xls","fileName" => "sample_inception.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/assets/images/login_bg.jpg","fileName" => "login_bg.jpg"]
]; ];
$email_id = 'srinivas.saravanan@venbainfotech.com'; $email_id = 'hariharan@nhanceindia.in';
$common = ['mail_type'=>'test_mail_cli']; $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 // Send email and get response
$result = MailHelper::send_email(['mail' => $email_id, 'subject' => 'Mail Via CLI', 'message' => $message,'attachments' => $attachments,'common'=>$common]); $result = MailHelper::send_email(['mail' => $email_id, 'subject' => 'Mail Via CLI','bcc'=>$bcc ,'message' => $message,'attachments' => $attachments,'common'=>$common]);
log_message('error',json_encode($result)); log_message('error',json_encode($result));

View File

@ -15,7 +15,7 @@ class ExcelSanitizeHelper
"\x0A", "\x0B", "\x0C", "\x0D", "\x0E", "\x0F", "\x10", "\x11", "\x12", "\x13", "\x0A", "\x0B", "\x0C", "\x0D", "\x0E", "\x0F", "\x10", "\x11", "\x12", "\x13",
"\x14", "\x15", "\x16", "\x17", "\x18", "\x19", "\x1A", "\x1B", "\x1C", "\x1D", "\x14", "\x15", "\x16", "\x17", "\x18", "\x19", "\x1A", "\x1B", "\x1C", "\x1D",
"\x1E", "\x1F", "\x7F", "_x000D_", "_x000A_", "_x0009_", "_x0008_", "_x0007_", "\x1E", "\x1F", "\x7F", "_x000D_", "_x000A_", "_x0009_", "_x0008_", "_x0007_",
"_x0006_", "_x0005_", "_x0004_", "_x0003_", "_x0002_", "_x0001_" "_x0006_", "_x0005_", "_x0004_", "_x0003_", "_x0002_", "_x0001_","\u200C"
]; ];
/** /**

View File

@ -325,31 +325,42 @@ class MailHelper
// Add CC recipients if provided // Add CC recipients if provided
if (!empty($cc)) { if (!empty($cc)) {
$postData['cc'] = []; $ccList = explode(',', $cc);
// Handle both string and array inputs for CC $ccList = array_map('trim', $ccList);
$ccEmails = is_array($cc) ? $cc : [$cc]; $postData['cc'] = array_map(function($email) {
foreach ($ccEmails as $ccEmail) { return [
$postData['cc'][] = [
'email_address' => [ 'email_address' => [
'address' => $ccEmail 'address' => $email
] ]
]; ];
} }, $ccList);
}
// Add BCC if present
if (!empty($bcc)) {
$bccList = explode(',', $bcc);
$bccList = array_map('trim', $bccList);
$postData['bcc'] = array_map(function($email) {
return [
'email_address' => [
'address' => $email
]
];
}, $bccList);
} }
// Add BCC recipients if provided // Add BCC recipients if provided
if (!empty($bcc)) { // if (!empty($bcc)) {
$postData['bcc'] = []; // $postData['bcc'] = [];
// Handle both string and array inputs for BCC // // Handle both string and array inputs for BCC
$bccEmails = is_array($bcc) ? $bcc : [$bcc]; // $bccEmails = is_array($bcc) ? $bcc : [$bcc];
foreach ($bccEmails as $bccEmail) { // foreach ($bccEmails as $bccEmail) {
$postData['bcc'][] = [ // $postData['bcc'][] = [
'email_address' => [ // 'email_address' => [
'address' => $bccEmail // 'address' => $bccEmail
] // ]
]; // ];
} // }
} // }
// Handle attachments // Handle attachments
if (!empty($attachments)) { if (!empty($attachments)) {

View File

@ -671,61 +671,98 @@
<?php if((get_role_id() == 1 || get_role_id() == 5) && (in_array(BUSINESS_TEAM_ID, user_team()) || in_array(FINANCE_TEAM_ID, user_team()) || in_array(MANAGEMENT_TEAM_ID, user_team()))) { ?> <?php if((get_role_id() == 1 || get_role_id() == 5) && (in_array(BUSINESS_TEAM_ID, user_team()) || in_array(FINANCE_TEAM_ID, user_team()) || in_array(MANAGEMENT_TEAM_ID, user_team()))) { ?>
<li> <li>
<a href="#sidebarDashboards" data-toggle="collapse" class="waves-effect"> <a href="#policyTransactions" data-toggle="collapse" class="waves-effect">
<i class="mdi mdi-format-list-bulleted"></i> <i class="mdi mdi-format-list-bulleted"></i>
<span class="badge badge-success badge-pill float-right">2</span> <span class="badge badge-success badge-pill float-right">2</span>
<span> Policy Transactions </span> <span> Policy Transactions </span>
</a> </a>
<div class="collapse" id="sidebarDashboards"> <div class="collapse" id="policyTransactions">
<ul class="nav-second-level"> <ul class="nav-second-level">
<li> <li>
<a href="<?= base_url('/policy_tranction/inception/list') ?>">Policy</a> <a href="#policyTransactions" data-toggle="collapse" class="waves-effect">
</li> <i class="mdi mdi-format-list-bulleted"></i>
<li>
<a href="<?= base_url('/policy_tranction/endorsement/list') ?>">Endorsement</a>
</li>
<?php if (in_array(FINANCE_TEAM_ID, user_team()) || in_array(MANAGEMENT_TEAM_ID, user_team())) { ?> <span>Policy Transactions</span>
</a>
<div class="collapse" id="policyTransactions">
<ul>
<li>
<a href="<?= base_url('/policy_tranction/inception/list') ?>">Policy</a>
</li>
<li>
<a href="<?= base_url('/policy_tranction/endorsement/list') ?>">Endorsement</a>
</li>
<li> <?php if (in_array(FINANCE_TEAM_ID, user_team()) || in_array(MANAGEMENT_TEAM_ID, user_team())) { ?>
<a href="<?= base_url('/policy_tranction/statement/list') ?>">Statement upload</a> <li>
</li> <a href="<?= base_url('/policy_tranction/statement/list') ?>">Statement Upload</a>
</li>
</ul>
</div>
</li>
<li>
<a href="#policyReports" data-toggle="collapse" class="waves-effect">
<i class="ri-file-chart-fill"></i>
<span> Policy Reports </span>
</a>
<div class="collapse" id="policyReports">
<ul class="nav-third-level">
<li>
<a href="<?= base_url('/policy_tranction/report/list') ?>">BDS</a>
</li>
<li>
<a href="<?= base_url('/policy_tranction/report/report-varience-list') ?>">Variance</a>
</li>
<li>
<a href="<?= base_url('/policy_tranction/report/report-outstanding-list') ?>">Outstanding</a>
</li>
<li> <?php } ?>
<a href="<?= base_url('/policy_tranction/report/list') ?>">BDS</a> </ul>
</li> </div>
<li> </li>
<a href="<?= base_url('/policy_tranction/report/report-varience-list') ?>">Variance</a> <li>
</li> <li>
<li> <a href="#policyMasters" data-toggle="collapse" class="waves-effect">
<a href="<?= base_url('/policy_tranction/report/report-outstanding-list') ?>">Outstanding</a> <i class="mdi mdi-timer-sand"></i>
</li> <span> Policy Pending Actions </span>
<li> </a>
<a href="<?= base_url('/policy_tranction/report/report-finance-list') ?>">Finance Team</a> <div class="collapse" id="policyReports">
</li> <ul class="nav-third-level">
<a href="<?= base_url('/policy_tranction/report/report-finance-list') ?>">Finance Team</a>
</li>
<?php } ?>
<?php } ?> <?php if (in_array(BUSINESS_TEAM_ID, user_team()) || in_array(MANAGEMENT_TEAM_ID, user_team())) { ?>
<li>
<a href="<?= base_url('/policy_tranction/report/report-business-list') ?>">Business Team</a>
</li>
</li></ul></div>
<?php if (in_array(BUSINESS_TEAM_ID, user_team()) || in_array(MANAGEMENT_TEAM_ID, user_team())) { ?> <li>
<a href="#policyMasters" data-toggle="collapse" class="waves-effect">
<i class="ri-database-2-line"></i>
<span> Masters </span>
</a>
<div class="collapse" id="policyReports">
<ul class="nav-third-level">
<li>
<a href="<?= base_url('/master/cash_deposite/list') ?>">CD Master</a>
</li>
<li>
<a href="<?= base_url('/master/vehicle/list') ?>">Vehicle Master</a>
</li>
</ul></div>
</li>
<li> <li>
<a href="<?= base_url('/policy_tranction/report/report-business-list') ?>">Business Team</a> <a href="<?= base_url('/dmsSearch') ?>"><i class="ri-book-open-line"></i><span> Documents</span></a>
</li> </li>
</ul>
</div>
</li>
<?php } ?>
<li>
<a href="<?= base_url('/master/cash_deposite/list') ?>">CD Master</a>
</li>
<li>
<a href="<?= base_url('/master/vehicle/list') ?>">Vehicle Master</a>
</li>
<li>
<a href="<?= base_url('/dmsSearch') ?>">Documents</a>
</li>
</ul>
</div>
</li>
<?php } ?> <?php } ?>

View File

@ -1802,40 +1802,13 @@ function getMailTemplateData(element) {
const design = JSON.parse(res.mail_content_json); const design = JSON.parse(res.mail_content_json);
editorInstance.loadDesign(design); editorInstance.loadDesign(design);
console.log("Design loaded successfully"); console.log("Design loaded successfully");
$('iframe').on('load', function() { hideBranding();
console.log('Iframe loaded.');
const iframe = $(this);
// Overlay the branding area
const overlay = $('<div>', {
css: {
position: 'absolute',
bottom: '0', // Adjust based on branding position
left: '0',
width: iframe.width(),
height: '30px', // Adjust height to cover branding
backgroundColor: 'white',
zIndex: '9999',
pointerEvents: 'none',
},
});
const iframeParent = iframe.parent();
if (iframeParent.css('position') === 'static') {
iframeParent.css('position', 'relative');
}
iframeParent.append(overlay);
console.log('Overlay added to hide branding.');
});
} catch (error) { } catch (error) {
console.error("Error parsing mail content JSON:", error); console.error("Error parsing mail content JSON:", error);
toastr.error('Error loading email template'); toastr.error('Error loading email template');
} }
}else{
hideBranding()
} }
}); });
}; };
@ -1852,6 +1825,29 @@ function getMailTemplateData(element) {
$('.testmail').toggle(!!res.id); $('.testmail').toggle(!!res.id);
$('#attachment_table').toggle(!!res.id); $('#attachment_table').toggle(!!res.id);
$('.setid').attr('data-id', res.id || ''); $('.setid').attr('data-id', res.id || '');
}else{
console.log("Inside else");
let retryCount = 0;
const initWithRetry = function() {
initializeEditor(function(editorInstance) {
if (!editorInstance && retryCount < 3) {
console.log(`Retrying editor initialization (${retryCount + 1}/3)...`);
retryCount++;
setTimeout(initWithRetry, 1000);
return;
}
if (!editorInstance) {
console.error("Editor initialization failed after retries");
toastr.error('Editor initialization failed. Please refresh the page.');
return;
}
hideBranding();
});
};
initWithRetry();
} }
$('.loader').fadeOut(); $('.loader').fadeOut();
@ -1926,6 +1922,32 @@ $('#account_maneger_summary_mail_form').submit(function (event) {
}); });
}); });
function hideBranding(){
$('iframe').on('load', function() {
console.log('Iframe loaded.');
const iframe = $(this);
// Overlay the branding area
const overlay = $('<div>', {
css: {
position: 'absolute',
bottom: '0', // Adjust based on branding position
left: '0',
width: iframe.width(),
height: '30px', // Adjust height to cover branding
backgroundColor: 'white',
zIndex: '9999',
pointerEvents: 'none',
},
});
const iframeParent = iframe.parent();
if (iframeParent.css('position') === 'static') {
iframeParent.css('position', 'relative');
}
iframeParent.append(overlay);
console.log('Overlay added to hide branding.');
});
}
</script> </script>

View File

@ -213,7 +213,7 @@ $(document).ready(function() {
for (var i = 0; i < data.body.length; i++) { for (var i = 0; i < data.body.length; i++) {
for (var j = 0; j < data.body[i].length; j++) { for (var j = 0; j < data.body[i].length; j++) {
// Check if the column is the 9th index (10th column) // Check if the column is the 9th index (10th column)
if (j === 9) { // 8 is the 9th index (0-based) if (j === 9) {
data.body[i][j] = '\u200C' + data.body[i][j]; data.body[i][j] = '\u200C' + data.body[i][j];
} }
} }