From 5c35f32a3f6bbc069386ba88399abf99e9cce82b Mon Sep 17 00:00:00 2001 From: Srinivas-Saravanan Date: Wed, 22 Jan 2025 11:24:25 +0530 Subject: [PATCH] FIX_UNLAYER_EDITOR,FEAT_SIDEBAR_EXTENDED,FIX_MAIL_HELPER_SRINIVAS --- app/Controllers/MasterController.php | 7 +- app/Helpers/ExcelSanitizeHelper.php | 2 +- app/Helpers/MailHelper.php | 49 ++++++---- app/Views/layout/header.php | 139 +++++++++++++++++---------- app/Views/notification.php | 84 ++++++++++------ app/Views/report_bds.php | 2 +- 6 files changed, 177 insertions(+), 106 deletions(-) diff --git a/app/Controllers/MasterController.php b/app/Controllers/MasterController.php index d7f9628a..921a9f3d 100755 --- a/app/Controllers/MasterController.php +++ b/app/Controllers/MasterController.php @@ -1658,7 +1658,7 @@ class MasterController extends AdminController $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); + 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/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']; + $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, '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)); diff --git a/app/Helpers/ExcelSanitizeHelper.php b/app/Helpers/ExcelSanitizeHelper.php index b4950b34..67aaa55e 100644 --- a/app/Helpers/ExcelSanitizeHelper.php +++ b/app/Helpers/ExcelSanitizeHelper.php @@ -15,7 +15,7 @@ class ExcelSanitizeHelper "\x0A", "\x0B", "\x0C", "\x0D", "\x0E", "\x0F", "\x10", "\x11", "\x12", "\x13", "\x14", "\x15", "\x16", "\x17", "\x18", "\x19", "\x1A", "\x1B", "\x1C", "\x1D", "\x1E", "\x1F", "\x7F", "_x000D_", "_x000A_", "_x0009_", "_x0008_", "_x0007_", - "_x0006_", "_x0005_", "_x0004_", "_x0003_", "_x0002_", "_x0001_" + "_x0006_", "_x0005_", "_x0004_", "_x0003_", "_x0002_", "_x0001_","\u200C" ]; /** diff --git a/app/Helpers/MailHelper.php b/app/Helpers/MailHelper.php index c55c2796..99490bde 100755 --- a/app/Helpers/MailHelper.php +++ b/app/Helpers/MailHelper.php @@ -325,31 +325,42 @@ class MailHelper // Add CC recipients if provided if (!empty($cc)) { - $postData['cc'] = []; - // Handle both string and array inputs for CC - $ccEmails = is_array($cc) ? $cc : [$cc]; - foreach ($ccEmails as $ccEmail) { - $postData['cc'][] = [ + $ccList = explode(',', $cc); + $ccList = array_map('trim', $ccList); + $postData['cc'] = array_map(function($email) { + return [ '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 - if (!empty($bcc)) { - $postData['bcc'] = []; - // Handle both string and array inputs for BCC - $bccEmails = is_array($bcc) ? $bcc : [$bcc]; - foreach ($bccEmails as $bccEmail) { - $postData['bcc'][] = [ - 'email_address' => [ - 'address' => $bccEmail - ] - ]; - } - } + // if (!empty($bcc)) { + // $postData['bcc'] = []; + // // Handle both string and array inputs for BCC + // $bccEmails = is_array($bcc) ? $bcc : [$bcc]; + // foreach ($bccEmails as $bccEmail) { + // $postData['bcc'][] = [ + // 'email_address' => [ + // 'address' => $bccEmail + // ] + // ]; + // } + // } // Handle attachments if (!empty($attachments)) { diff --git a/app/Views/layout/header.php b/app/Views/layout/header.php index fa415c34..e8f0dd11 100755 --- a/app/Views/layout/header.php +++ b/app/Views/layout/header.php @@ -671,61 +671,98 @@ -
  • - - - 2 - Policy Transactions - -
    - -
    -
  • diff --git a/app/Views/notification.php b/app/Views/notification.php index 246ace3c..0c58056e 100755 --- a/app/Views/notification.php +++ b/app/Views/notification.php @@ -1802,40 +1802,13 @@ function getMailTemplateData(element) { const design = JSON.parse(res.mail_content_json); editorInstance.loadDesign(design); console.log("Design loaded successfully"); - $('iframe').on('load', function() { - console.log('Iframe loaded.'); - const iframe = $(this); - - // Overlay the branding area - const overlay = $('
    ', { - 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.'); - }); - - - - + hideBranding(); } catch (error) { console.error("Error parsing mail content JSON:", error); toastr.error('Error loading email template'); } + }else{ + hideBranding() } }); }; @@ -1852,6 +1825,29 @@ function getMailTemplateData(element) { $('.testmail').toggle(!!res.id); $('#attachment_table').toggle(!!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(); @@ -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 = $('
    ', { + 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.'); + }); +} diff --git a/app/Views/report_bds.php b/app/Views/report_bds.php index 706116ce..44d06bd6 100644 --- a/app/Views/report_bds.php +++ b/app/Views/report_bds.php @@ -213,7 +213,7 @@ $(document).ready(function() { for (var i = 0; i < data.body.length; i++) { for (var j = 0; j < data.body[i].length; j++) { // 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]; } }