CHANGE_email notification to acc manger while inception - VADIVEL J 2025-10-27

This commit is contained in:
vadivelJ96 2025-10-27 10:48:56 +05:30
parent 5af308f596
commit da6b733b73

View File

@ -53,6 +53,7 @@ use Illuminate\Http\Request;
use App\Controllers\EmployeeServiceController;
use App\Models\ClaimFilesModel;
use App\Models\TicketMailTemplateModel;
use Kreait\Firebase\Factory;
use Kreait\Firebase\Messaging\CloudMessage;
use Kreait\Firebase\Messaging\Notification;
@ -90,6 +91,7 @@ class EmployeeRestController extends AdminController
protected $hrAccessControlModel;
protected $insurerModel;
protected $hrFileUploadModel;
protected $ticketMailTemplateModel;
public function __construct()
@ -122,6 +124,7 @@ class EmployeeRestController extends AdminController
$this->hrAccessControlModel = new HRAccessControlModel();
$this->insurerModel = new InsurerModel();
$this->hrFileUploadModel = new HrFileUploadModel();
$this->ticketMailTemplateModel = new TicketMailTemplateModel();
}
@ -4206,15 +4209,27 @@ class EmployeeRestController extends AdminController
// 'updated_by' => $this->request->getPost('created_by'),
// ];
$client_name = $this->clientModel->where('id',$data['client_id'])->findAll()[0]['client_name'] ?? [] ;
$account_manager_email = $this->clientRMModel->findAccountManagerEmail($data['client_id']);
$templateName = "inception_addition";
$mailTemplate = $this->ticketMailTemplateModel->where('template_name', $templateName)->findAll()[0] ?? [];
if(empty($mailTemplate)){
//empty mail template please update the template in database or create one..!!
log_message("error","Empty mail template for inception_addition please update the template in database or create one..!!");
return ;
}
$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']);
$from_mail = "";
$to_mail = $account_manager_email;
$subject = "Inception Notification";
$message = "Inception for Policy_No -" . $data['policy_no'] . " is uploaded . Awaiting Action..!!";
$subject = $mailTemplate['subject'];
$message = $mailTemplate['content'];
$cc_string = "";
$attachments = "";
$reply_to = "";