diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index 1b7310b6..5b568b48 100755 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -4174,7 +4174,11 @@ class EmployeeRestController extends AdminController ]; // Save into DB - $this->hrFileUploadModel->insert($data); + $result = $this->hrFileUploadModel->insert($data); + + if($result && $data['file_action'] == "addition"){ + $this->giveNotificationToClientsAccountManager($data); + } return $this->respondCreated([ 'status' => true, @@ -4188,6 +4192,39 @@ class EmployeeRestController extends AdminController } + 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'), + // ]; + + + $account_manager_email = $this->clientRMModel->findAccountManagerEmail($data['client_id']); + + + + $from_mail = ""; + $to_mail = $account_manager_email; + $subject = "Inception Notification"; + $message = "Inception for Policy_No -" . $data['policy_no'] . " is uploaded . Awaiting Action..!!"; + $cc_string = ""; + $attachments = ""; + $reply_to = ""; + $bcc_string = ""; + + + MailHelper::send_email(['from_mail' => $from_mail, 'mail' => $to_mail, 'cc' => $cc_string, 'subject' => $subject, 'message' => $message, 'attachments' => $attachments, 'reply_to' => $reply_to, 'bcc' => $bcc_string]); + + } + public function updateHrFileUploadData() { try {