CHANGE UI LEVEL FIXES - VADIVEL J 2025-08-20
This commit is contained in:
parent
ef11ed776e
commit
157caeda03
@ -3,6 +3,7 @@
|
|||||||
namespace App\Controllers;
|
namespace App\Controllers;
|
||||||
|
|
||||||
use App\Controllers\BaseController;
|
use App\Controllers\BaseController;
|
||||||
|
use App\Helpers\MailHelper;
|
||||||
use CodeIgniter\HTTP\ResponseInterface;
|
use CodeIgniter\HTTP\ResponseInterface;
|
||||||
|
|
||||||
use App\Models\ThzMasterModel;
|
use App\Models\ThzMasterModel;
|
||||||
@ -36,16 +37,25 @@ class ThzController extends BaseController
|
|||||||
public function ticketSave(){
|
public function ticketSave(){
|
||||||
|
|
||||||
$data = $this->request->getPost();
|
$data = $this->request->getPost();
|
||||||
// $data = $this->request->getJSON(true);
|
|
||||||
// $return_type = isset($data['return_type']) ? $data['return_type'] : 'api';
|
|
||||||
if (!empty($data['thz_id'])) {
|
if (!empty($data['thz_id'])) {
|
||||||
|
|
||||||
$text = "update";
|
$text = "update";
|
||||||
$result = $this->updateTicket($data);
|
$result = $this->updateTicket($data);
|
||||||
|
$updateID = $data['thz_id'];
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
$text = "create";
|
$text = "create";
|
||||||
$result = $this->insertTicket($data);
|
$insertID = $this->insertTicket($data);
|
||||||
|
$result = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$id = isset($insertID) && !empty($insertID) ? $insertID : $updateID ;
|
||||||
|
|
||||||
|
$this->ticketSaveNotification($data , $insertOrUpdate = $text , $id);
|
||||||
|
|
||||||
return $this->response->setJSON([
|
return $this->response->setJSON([
|
||||||
'status' => $result ? 'success' : 'error',
|
'status' => $result ? 'success' : 'error',
|
||||||
'message' => $result ? "Ticket {$text}d successfully" : "Unable to {$text} ticket. Please try again."
|
'message' => $result ? "Ticket {$text}d successfully" : "Unable to {$text} ticket. Please try again."
|
||||||
@ -124,9 +134,7 @@ class ThzController extends BaseController
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function ticketSaveNotification($data){
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public function ticketConversationSaveNotification($data){
|
public function ticketConversationSaveNotification($data){
|
||||||
|
|
||||||
@ -201,20 +209,152 @@ class ThzController extends BaseController
|
|||||||
->findAll();
|
->findAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
private function notificationBasedOnRole($data){
|
|
||||||
|
|
||||||
$id = $data['thz_id'] ?? null;
|
|
||||||
$assign_to = $data['assign_to'] ?? null;
|
|
||||||
$mobile = $data['mobile'] ?? null;
|
|
||||||
|
|
||||||
if (!empty($assign_to)) {
|
private function ticketSaveNotification( $data , $insertOrUpdate , $id){
|
||||||
|
|
||||||
|
$user_email = $data['email'] ?? null;
|
||||||
|
|
||||||
|
$assignee_id = $data['assign_to'] ?? null;
|
||||||
|
|
||||||
|
$assignee_email = $this->findAssigneeEmail($assignee_id);
|
||||||
|
|
||||||
|
$emailToNotified = [
|
||||||
|
'user_email' => $user_email,
|
||||||
|
'assignee_email' => $assignee_email
|
||||||
|
];
|
||||||
|
|
||||||
|
$ticketId = $id;
|
||||||
|
|
||||||
|
$result = $this->emailNotificationBasedOnRole($emailToNotified , $insertOrUpdate , $ticketId , $data);
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($id) && !empty($mobile)) {
|
private function findAssigneeEmail($assignee_id){
|
||||||
|
|
||||||
|
$result = $this->userModel->where('id',$assignee_id)->find()->getResultArray();
|
||||||
|
|
||||||
|
$assigneeEmail = $result[0]['email'];
|
||||||
|
|
||||||
|
return $assigneeEmail;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function emailNotificationBasedOnRole($emailToNotified , $insertOrUpdate , $ticketId , $data){
|
||||||
|
|
||||||
|
$user_email = $emailToNotified['user_email'] ?? null;
|
||||||
|
$assignee_email = $emailToNotified['assignee_email'] ?? null;
|
||||||
|
|
||||||
|
|
||||||
|
if (!empty($assignee_email)) {
|
||||||
|
|
||||||
|
switch ($insertOrUpdate) {
|
||||||
|
|
||||||
|
case 'update':
|
||||||
|
|
||||||
|
$messageUpdated = "<p>Hi From <b> Nhance Support</b>,
|
||||||
|
<p>Your Assigned Ticket No -%ticketId% for Subject - %subject% Updated With Latest Information . </p> </p>
|
||||||
|
<p align='center' >Thank you</p>" ;
|
||||||
|
|
||||||
|
|
||||||
|
$from_mail = "";
|
||||||
|
$to_mail = $assignee_email;
|
||||||
|
$cc_string = "";
|
||||||
|
$subject = "<p> Ticket Created For %subject% </p>";
|
||||||
|
$message = $messageUpdated ;
|
||||||
|
$attachments = "";
|
||||||
|
$reply_to = "";
|
||||||
|
$bcc_string = "";
|
||||||
|
|
||||||
|
$res = 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]);
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'create':
|
||||||
|
|
||||||
|
$messageCreated = "<p>Hi From <b> Nhance Support</b>,
|
||||||
|
<p>Your Assigned With New Ticket No -%ticketId% for Subject %subject% Updated With Latest Information . </p> </p>
|
||||||
|
<p align='center' >Thank you</p>";
|
||||||
|
|
||||||
|
$from_mail = "";
|
||||||
|
$to_mail = $assignee_email;
|
||||||
|
$cc_string = "";
|
||||||
|
$subject = "<p> Ticket Created For %subject% </p>";
|
||||||
|
$message = $messageCreated ;
|
||||||
|
$attachments = "";
|
||||||
|
$reply_to = "";
|
||||||
|
$bcc_string = "";
|
||||||
|
|
||||||
|
$res = 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]);
|
||||||
|
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
# code...
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($user_email)) {
|
||||||
|
|
||||||
|
switch ($insertOrUpdate) {
|
||||||
|
|
||||||
|
case 'update':
|
||||||
|
|
||||||
|
$messageUpdated = "<p>Hi From <b> Nhance Support</b>,
|
||||||
|
<p>Your Ticket for Subject %subject% Updated With Latest Information For Your Ticket No %ticketId%. </p> </p>
|
||||||
|
<p align='center' >Thank you</p>";
|
||||||
|
|
||||||
|
$from_mail = "";
|
||||||
|
$to_mail = $user_email;
|
||||||
|
$cc_string = "";
|
||||||
|
$subject = "<p> Ticket Created For %subject% </p>";
|
||||||
|
$message = $messageUpdated ;
|
||||||
|
$attachments = "";
|
||||||
|
$reply_to = "";
|
||||||
|
$bcc_string = "";
|
||||||
|
|
||||||
|
$res = 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]);
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'create':
|
||||||
|
|
||||||
|
$messageForAssigned = "<p>Hi From <b> Nhance Support</b>,
|
||||||
|
<p>Your Ticket for Subject %subject% Created and Assigned To %assignee_email%. TicketNo - %ticketId% </p> </p>
|
||||||
|
<p align='center' >Thank you</p>";
|
||||||
|
|
||||||
|
$messageForUnAssigned = "<p>Hi From <b> Nhance Support</b>,
|
||||||
|
<p>Your Ticket for Subject %subject% Created and Will be Assigned Shortly.Here is Your TicketNo - %ticketId% </p> </p>
|
||||||
|
<p align='center' >Thank you</p>";
|
||||||
|
|
||||||
|
$from_mail = "";
|
||||||
|
$to_mail = $user_email;
|
||||||
|
$cc_string = "";
|
||||||
|
$subject = "<p> Ticket Created For %subject% </p>";
|
||||||
|
$message = empty($assignee_email) ? $messageForUnAssigned : $messageForAssigned ;
|
||||||
|
$attachments = "";
|
||||||
|
$reply_to = "";
|
||||||
|
$bcc_string = "";
|
||||||
|
|
||||||
|
$res = 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]);
|
||||||
|
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
# code...
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -228,14 +368,13 @@ class ThzController extends BaseController
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function insertTicket($data){
|
private function insertTicket($data)
|
||||||
|
{
|
||||||
$data['created_by'] = get_session_userid();
|
$data['created_by'] = get_session_userid();
|
||||||
$result = $this->thzMasterModel->insert($data);
|
$this->thzMasterModel->insert($data);
|
||||||
|
|
||||||
return $result;
|
return $this->thzMasterModel->insertID(); // returns the inserted row's ID
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -95,7 +95,7 @@ class ThzMasterNotesModel extends Model
|
|||||||
LEFT JOIN thz_master
|
LEFT JOIN thz_master
|
||||||
ON thz_master.thz_id = thz_master_notes.thz_id
|
ON thz_master.thz_id = thz_master_notes.thz_id
|
||||||
AND LOWER(thz_master_notes.notes_by) = 'user'
|
AND LOWER(thz_master_notes.notes_by) = 'user'
|
||||||
WHERE thz_master_notes.thz_id = " . (int)$thz_id . "
|
WHERE thz_master_notes.thz_id = '.(int)$thz_id.'
|
||||||
ORDER BY thz_master_notes.created_at ASC";
|
ORDER BY thz_master_notes.created_at ASC";
|
||||||
|
|
||||||
$result = $this->db->query($notes_sql)->getResultArray();
|
$result = $this->db->query($notes_sql)->getResultArray();
|
||||||
|
|||||||
@ -570,16 +570,17 @@ body {
|
|||||||
if (otherCard !== card) {
|
if (otherCard !== card) {
|
||||||
const otherContent = otherCard.querySelector('.card-content');
|
const otherContent = otherCard.querySelector('.card-content');
|
||||||
const otherIcon = otherCard.querySelector('.accordion-icon i');
|
const otherIcon = otherCard.querySelector('.accordion-icon i');
|
||||||
otherIcon.classList.add('mdi mdi-chevron-down');
|
otherIcon.setAttribute('class', 'mdi mdi-chevron-down');
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Toggle current accordion
|
// Toggle current accordion
|
||||||
content.classList.toggle('active');
|
content.classList.toggle('active');
|
||||||
if (content.classList.contains('active')) {
|
if (content.classList.contains('active')) {
|
||||||
icon.classList.add('mdi mdi-chevron-up');
|
icon.classList.setAttribute('class', 'mdi mdi-chevron-up');
|
||||||
} else {
|
} else {
|
||||||
icon.classList.add('mdi mdi-chevron-down');
|
icon.classList.setAttribute('class', 'mdi mdi-chevron-down');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user