CHANGE_inception mail notification template updation - VADIVEL J 2025-10-27 10:23

This commit is contained in:
vadivelJ96 2025-10-29 10:24:01 +05:30
parent 8b6549117b
commit 317e456daf

View File

@ -4179,7 +4179,7 @@ class EmployeeRestController extends AdminController
// Save into DB // Save into DB
$result = $this->hrFileUploadModel->insert($data); $result = $this->hrFileUploadModel->insert($data);
if($result && $data['file_action'] == "addition"){ if($result){
$this->giveNotificationToClientsAccountManager($data); $this->giveNotificationToClientsAccountManager($data);
} }
@ -4196,24 +4196,12 @@ class EmployeeRestController extends AdminController
} }
private function giveNotificationToClientsAccountManager($data){ private function giveNotificationToClientsAccountManager($data){
// $data = [
// 'client_id' => $this->request->getPost('client_id'),
// 'client_branch_id' => $this->request->getPost('client_branch_id'),
// 'policy_id' => $this->request->getPost('policy_id'),
// 'policy_no' => $this->request->getPost('policy_no'),
// 'file_name' => $newFileName,
// 'file_action' => $this->request->getPost('file_action'),
// 'status' => 'Yet to start',
// 'created_by' => $this->request->getPost('created_by'),
// 'updated_by' => $this->request->getPost('created_by'),
// ];
$client_name = $this->clientModel->where('id',$data['client_id'])->findAll()[0]['client_name'] ?? [] ; $client_name = $this->clientModel->where('id',$data['client_id'])->findAll()[0]['client_name'] ?? [] ;
$account_manager_email = $this->clientRMModel->findAccountManagerEmail($data['client_id']); $account_manager_email = $this->clientRMModel->findAccountManagerEmail($data['client_id']);
$templateName = "inception_addition"; $templateName = "hr_endorsement_template";
$mailTemplate = $this->ticketMailTemplateModel->where('template_name', $templateName)->findAll()[0] ?? []; $mailTemplate = $this->ticketMailTemplateModel->where('template_name', $templateName)->findAll()[0] ?? [];
@ -4223,9 +4211,13 @@ class EmployeeRestController extends AdminController
return ; return ;
} }
$mailTemplate['mail_content'] = str_replace('%file_action%', $data['file_action'] ?? '', $mailTemplate['mail_content']);
$mailTemplate['mail_content'] = str_replace('%client_name%', $client_name ?? '', $mailTemplate['mail_content']); $mailTemplate['mail_content'] = str_replace('%client_name%', $client_name ?? '', $mailTemplate['mail_content']);
$mailTemplate['mail_content'] = str_replace('%policy_no%', $data['policy_no'] ?? '', $mailTemplate['mail_content']); $mailTemplate['mail_content'] = str_replace('%policy_no%', $data['policy_no'] ?? '', $mailTemplate['mail_content']);
$mailTemplate['subject'] = str_replace('%subject%',$data['file_action']??'',$mailTemplate['subject']);
$mailTemplate['subject'] = str_replace('%client_name%',$client_name??'',$mailTemplate['subject']);
$from_mail = ""; $from_mail = "";
$to_mail = $account_manager_email; $to_mail = $account_manager_email;
$subject = $mailTemplate['subject']; $subject = $mailTemplate['subject'];