CHANGE UI LEVEL FIXES - VADIVEL J 2025-08-21
This commit is contained in:
parent
ba95c07642
commit
9fc5a33d61
@ -114,10 +114,13 @@ class ThzController extends BaseController
|
||||
return $this->response->setJSON((['status' => 'error', 'message' => 'No tickets found']))->setStatusCode(404);
|
||||
}
|
||||
|
||||
$emailNotificationResult = $this->ticketConversationSaveNotification($data);
|
||||
|
||||
|
||||
return $this->response->setJSON([
|
||||
'status' => $result ? 'success' : 'error',
|
||||
'message' => $result ? "Ticket Notes created successfully" : "Unable to create ticket notes. Please try again."
|
||||
'message' => $result ? "Ticket Notes created successfully" : "Unable to create ticket notes. Please try again." ,
|
||||
'notification' => $emailNotificationResult ? 'Email Notification Success..!!' : 'Email Notification Failed..!!'
|
||||
])->setStatusCode($result ? 200 : 400);
|
||||
|
||||
}
|
||||
@ -179,10 +182,6 @@ class ThzController extends BaseController
|
||||
|
||||
}
|
||||
|
||||
public function ticketConversationSaveNotification($data){
|
||||
|
||||
}
|
||||
|
||||
public function ticketAssigning(){
|
||||
|
||||
$returnType = strtolower($this->request->getGet('return_type') ?? 'api');
|
||||
@ -275,6 +274,32 @@ class ThzController extends BaseController
|
||||
|
||||
}
|
||||
|
||||
private function ticketConversationSaveNotification($data){
|
||||
|
||||
$thz_id = $data['thz_id'] ;
|
||||
|
||||
$user_email = $data['email'] ?? '';
|
||||
|
||||
$assignee_email = $this->findAssigneeEmail($data['assign_to']) ?? '';
|
||||
|
||||
$sender_mail = $data['notes_by'] == "User" ? $user_email : $assignee_email ;
|
||||
$receiver_mail = $data['notes_by'] == "User" ? $assignee_email : $user_email ;
|
||||
|
||||
$templateName = "ticket_conversation_save_notification";
|
||||
|
||||
$to_email = $receiver_mail;
|
||||
|
||||
$ticketId = $thz_id;
|
||||
|
||||
$message = $data['notes'] ?? '';
|
||||
|
||||
$this->sendEmail( $templateName, $data , $to_email , $ticketId , $message);
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
private function findAssigneeEmail($assignee_id){
|
||||
|
||||
$row = $this->userModel->where('id', $assignee_id)->get()->getRow();
|
||||
@ -361,25 +386,27 @@ class ThzController extends BaseController
|
||||
}
|
||||
|
||||
|
||||
private function sendEmail( $templateName, $data , $to_email , $ticketId){
|
||||
private function sendEmail( $templateName, $data , $to_email , $ticketId , $message = ""){
|
||||
|
||||
$mail = $this->ticketMailTemplateModel->where('template_name',$templateName )->findAll()[0] ?? [];
|
||||
$mailTemplate = $this->ticketMailTemplateModel->where('template_name',$templateName )->findAll()[0] ?? [];
|
||||
|
||||
if(empty($mail)){
|
||||
if(empty($mailTemplate)){
|
||||
return ;
|
||||
}
|
||||
|
||||
$mail['subject'] = str_replace('%subject%', $data['subject'] ?? '', $mail['subject']);
|
||||
$mailTemplate['subject'] = str_replace('%subject%', $data['subject'] ?? '', $mailTemplate['subject']);
|
||||
|
||||
$mail['mail_content'] = str_replace('%subject%', $data['subject'] ?? '', $mail['mail_content']);
|
||||
$mailTemplate['mail_content'] = str_replace('%subject%', $data['subject'] ?? '', $mailTemplate['mail_content']);
|
||||
|
||||
$mail['mail_content'] = str_replace('%ticketId%', $ticketId ?? '', $mail['mail_content']);
|
||||
$mailTemplate['mail_content'] = str_replace('%ticketId%', $ticketId ?? '', $mailTemplate['mail_content']);
|
||||
|
||||
$mailTemplate['mail_content'] = str_replace('%message%', $message ?? '', $mailTemplate['mail_content']);
|
||||
|
||||
$from_mail = "";
|
||||
$to_mail = $to_email;
|
||||
$cc_string = "";
|
||||
$subject = $mail['subject'] ;
|
||||
$message = $mail['mail_content'] ;
|
||||
$subject = $mailTemplate['subject'] ;
|
||||
$message = $mailTemplate['mail_content'] ;
|
||||
$attachments = "";
|
||||
$reply_to = "";
|
||||
$bcc_string = "";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user