CHANGE_PLACEMENT_MAIL_TEMPLATE

This commit is contained in:
VENKATESHWARAN 2025-10-28 11:56:14 +05:30
parent c96a06fcfc
commit 7e6ecd570d

View File

@ -1089,6 +1089,7 @@ class LeadsController extends BaseController
// 7. Define mail templates as constants or config
$mail_content = $this->getMailTemplate();
$placement_mail_content = $this->getMailTemplate('placement');
$subject = $this->getSubjectTemplate($lead_data);
// 8. Pre-calculate sum assured only for GPA
@ -1097,7 +1098,7 @@ class LeadsController extends BaseController
// 9. Transform mail content once
$data['mail_content'] = $this->transformMailContent($lead_data, $mail_content, $data['page_name']);
$data['subject'] = $this->transformMailContent($lead_data, $subject, $data['page_name']);
$data['placement_mail_content'] = $this->transformMailContent($lead_data, $mail_content, 'Placement');
$data['placement_mail_content'] = $this->transformMailContent($lead_data, $placement_mail_content, 'Placement');
$data['placement_subject'] = $this->transformMailContent($lead_data, $subject, 'Placement');
// 10. Combine related queries
@ -1150,24 +1151,43 @@ class LeadsController extends BaseController
}
// 13. Extract mail template to separate method for reusability
private function getMailTemplate()
{
return '
<p>Dear Sir,</p>
<p>Greetings From Nhance India!</p>
<p>Please find attached the {{RFQ_OR_QCR}} for <strong>{{POLICY_TYPE}}</strong> policy pertaining to <strong>{{CLIENT_NAME}}</strong>.</p>
<p>Kindly request you to share the competitive quotes at the earliest.</p>
<p>In case of any query, please feel free to contact us.</p>
<p>Thank You!</p><br>
<p>Best regards,</p>
private function getMailTemplate( $template_type = "" )
{
if($template_type == 'placement'){
return '
<p>Dear Sir,</p>
<p>Greetings From Nhance India!</p>
<p>Please find attached the {{RFQ_OR_QCR}} for <strong>{{POLICY_TYPE}}</strong> policy pertaining to <strong>{{CLIENT_NAME}}</strong>.</p>
<p>Kindly request you to issue the policy at the earliest.</p>
<p>In case of any query, please feel free to contact us.</p>
<p>Thank You!</p><br>
<p>Best regards,</p>
<div style="margin: 0; padding: 0; line-height: 1.2;">
<div>{{LOGGED_USER_NAME}}</div>
<div>Mobile: {{LOGGED_USER_MOBILE}}</div>
</div>
<div style="margin: 0; padding: 0; line-height: 1.2;">
<div>{{LOGGED_USER_NAME}}</div>
<div>Mobile: {{LOGGED_USER_MOBILE}}</div>
</div>
<img src="{{LOGO_PATH}}" alt="Nhance Logo" width="100" style="margin-top:10px;">
';
<img src="{{LOGO_PATH}}" alt="Nhance Logo" width="100" style="margin-top:10px;">
';
}else{
return '
<p>Dear Sir,</p>
<p>Greetings From Nhance India!</p>
<p>Please find attached the {{RFQ_OR_QCR}} for <strong>{{POLICY_TYPE}}</strong> policy pertaining to <strong>{{CLIENT_NAME}}</strong>.</p>
<p>Kindly request you to share the competitive quotes at the earliest.</p>
<p>In case of any query, please feel free to contact us.</p>
<p>Thank You!</p><br>
<p>Best regards,</p>
<div style="margin: 0; padding: 0; line-height: 1.2;">
<div>{{LOGGED_USER_NAME}}</div>
<div>Mobile: {{LOGGED_USER_MOBILE}}</div>
</div>
<img src="{{LOGO_PATH}}" alt="Nhance Logo" width="100" style="margin-top:10px;">
';
}
}
// 14. Extract subject template to separate method