CHANGE_help_desk_tickets - VADIVEL J 2025-11-05 14:51
This commit is contained in:
parent
5e3219913e
commit
f98cf9b232
@ -352,7 +352,8 @@ $routes->group("/util", ["filter" => "authMVC"], function ($routes) {
|
|||||||
$routes->get("get_client_policy_data_using_policy_no_and_endo_no", "ClientController::get_client_policy_data_using_policy_no_and_endo_no");
|
$routes->get("get_client_policy_data_using_policy_no_and_endo_no", "ClientController::get_client_policy_data_using_policy_no_and_endo_no");
|
||||||
$routes->get("checkInvoiceStatus/(:any)", "PolicyTransactionController::checkInvoiceStatus/$1");
|
$routes->get("checkInvoiceStatus/(:any)", "PolicyTransactionController::checkInvoiceStatus/$1");
|
||||||
$routes->get("base_policy_for_policy_inception/(:any)", "PolicyTransactionController::getBasePolicy/$1");
|
$routes->get("base_policy_for_policy_inception/(:any)", "PolicyTransactionController::getBasePolicy/$1");
|
||||||
$routes->get("sentTestMail/(:any)", "NotificationController::sentTestMail/$1");
|
$routes->get("sentTestMail/(:any)","NotificationController::sentTestMail/$1");
|
||||||
|
$routes->post("sendCommonTestMail","NotificationController::sendCommonTestMail");
|
||||||
$routes->get("send_manual_reminder/(:any)", "DashboardController::sendManualReminder/$1");
|
$routes->get("send_manual_reminder/(:any)", "DashboardController::sendManualReminder/$1");
|
||||||
$routes->get("send_manual_ecard/(:any)", "DashboardController::sendManualEcard/$1");
|
$routes->get("send_manual_ecard/(:any)", "DashboardController::sendManualEcard/$1");
|
||||||
$routes->get("get_client_policy_list_for_remainder/(:any)", "EmployeeController::get_client_policy_list_for_remainder/$1");
|
$routes->get("get_client_policy_list_for_remainder/(:any)", "EmployeeController::get_client_policy_list_for_remainder/$1");
|
||||||
|
|||||||
@ -57,72 +57,30 @@ class NotificationController extends AdminController
|
|||||||
$form_data['mail_content'] = $this->request->getPost('mailContent');
|
$form_data['mail_content'] = $this->request->getPost('mailContent');
|
||||||
$form_data['client_id'] = $this->request->getPost('client_id');
|
$form_data['client_id'] = $this->request->getPost('client_id');
|
||||||
$form_data['mail_content_json'] = $this->request->getPost('mailJson');
|
$form_data['mail_content_json'] = $this->request->getPost('mailJson');
|
||||||
$form_data['email_list'] = $this->request->getPost('email_list')??'';
|
$form_data['common_mail'] = $this->request->getPost('common_mail')??'';
|
||||||
$notificationModel = new NotificationModel();
|
$notificationModel = new NotificationModel();
|
||||||
|
|
||||||
$find_notification = $notificationModel->where('client_id',$form_data['client_id'])->where('template_name',$form_data['template_name'])->first();
|
$find_notification = $notificationModel->where('client_id',$form_data['client_id'])->where('template_name',$form_data['template_name'])->first();
|
||||||
|
|
||||||
if ($find_notification) {
|
if ($find_notification) {
|
||||||
|
$this->logger->debug("inside notification update");
|
||||||
|
|
||||||
$id = $find_notification['id'] ?? '';
|
$id = $find_notification['id'] ?? '';
|
||||||
$form_data['updated_by'] = get_session_userid();
|
$form_data['updated_by'] = get_session_userid();
|
||||||
$notificationModel->update($id,$form_data);
|
$notificationModel->update($id,$form_data);
|
||||||
$this->save_common_mail($id , $form_data);
|
|
||||||
$complete = "Update";
|
$complete = "Update";
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
|
$this->logger->debug("inside notification insert");
|
||||||
|
|
||||||
$form_data['created_by'] = get_session_userid();
|
$form_data['created_by'] = get_session_userid();
|
||||||
$id = $notificationModel->insert($form_data);
|
$id = $notificationModel->insert($form_data);
|
||||||
$this->save_common_mail($id , $form_data);
|
|
||||||
$complete = "Inserted";
|
$complete = "Inserted";
|
||||||
}
|
}
|
||||||
|
|
||||||
return json_encode($complete);
|
return json_encode($complete);
|
||||||
|
|
||||||
}
|
}
|
||||||
private function save_common_mail($id, $form_data)
|
|
||||||
{
|
|
||||||
|
|
||||||
$this->logger->debug("step 1 - inside save common mail");
|
|
||||||
|
|
||||||
if (empty($form_data['email_list'])) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$this->logger->debug("step 2 - id and form_data are present");
|
|
||||||
|
|
||||||
$emails = array_map('trim', explode(',', $form_data['email_list']));
|
|
||||||
|
|
||||||
|
|
||||||
$this->logger->debug("step 3 common emails were present");
|
|
||||||
|
|
||||||
$common_mail_data = [];
|
|
||||||
|
|
||||||
foreach ($emails as $email) {
|
|
||||||
$common_mail_data[] = ['notification_id' => $id , 'email' => $email , 'is_active' => 1];
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->logger->debug("step 4 common email data \n" . json_encode($common_mail_data));
|
|
||||||
|
|
||||||
|
|
||||||
// Deactivate existing emails
|
|
||||||
$this->CommonEMailModel
|
|
||||||
->where('notification_id', $id)
|
|
||||||
->set(['is_active' => 0])
|
|
||||||
->update();
|
|
||||||
|
|
||||||
$this->logger->debug("step 5 deleted old common email data");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Insert all at once
|
|
||||||
$this->CommonEMailModel->insertBatch($common_mail_data);
|
|
||||||
|
|
||||||
$this->logger->debug("step 6 common mail data insertion done ..!!");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// This is for the Enabls in Notification area and Update the Recipient and HR Mail Id in( Enables -> Notification table and Mail id's -> Client table)
|
// This is for the Enabls in Notification area and Update the Recipient and HR Mail Id in( Enables -> Notification table and Mail id's -> Client table)
|
||||||
@ -201,14 +159,8 @@ class NotificationController extends AdminController
|
|||||||
}
|
}
|
||||||
|
|
||||||
if( isset($value['template_name']) && !empty($value['template_name']) && $value['template_name'] == "member_common_mail"){
|
if( isset($value['template_name']) && !empty($value['template_name']) && $value['template_name'] == "member_common_mail"){
|
||||||
$common_mails = $this->CommonEMailModel
|
$common_mails = $value['common_mail']??[];
|
||||||
->where('notification_id',$value['id'])
|
$value['comman_mails'] = !empty($common_mails) ? $common_mails : "";
|
||||||
->where('is_active',1)
|
|
||||||
->findAll()??[];
|
|
||||||
$value['comman_mails'] = !empty($common_mails)
|
|
||||||
? trim(implode("," , array_column( $common_mails,'email') ))
|
|
||||||
: [];
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -299,6 +251,51 @@ class NotificationController extends AdminController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public function sendCommonTestMail()
|
||||||
|
{
|
||||||
|
|
||||||
|
$template_id = $this->request->getPost('template_id');
|
||||||
|
|
||||||
|
$test_mail = $this->request->getPost('test_mail');
|
||||||
|
|
||||||
|
$test_mail_list = $this->request->getPost('test_mail_list');
|
||||||
|
|
||||||
|
|
||||||
|
$notification_data = $this->notificationModel->where('id', $template_id)->first();
|
||||||
|
$client_data = $this->clientModel->where('id', $notification_data['client_id'])->where('is_active', 1)->first();
|
||||||
|
|
||||||
|
if(!empty($notification_data)){
|
||||||
|
|
||||||
|
$params = [
|
||||||
|
'client_data' => $client_data,
|
||||||
|
'notification_data' => $notification_data,
|
||||||
|
'test_mail' => $test_mail,
|
||||||
|
'test_mail_list' => $test_mail_list
|
||||||
|
];
|
||||||
|
|
||||||
|
$testMailData = sendMailNotification::sendMailNotificationForTesting($notification_data['template_name'], $params);
|
||||||
|
// print_r($testMailData); die;
|
||||||
|
if (!empty($testMailData)) {
|
||||||
|
|
||||||
|
$mail_send_return1 = MailHelper::send_email($testMailData);
|
||||||
|
$this->myLogger->logme("info", $mail_send_return1);
|
||||||
|
$this->myLogger->logme("info", $mail_send_return1);
|
||||||
|
|
||||||
|
return $this->respond(['status' => true,'code' => 200, 'respond' => json_decode($mail_send_return1)]);
|
||||||
|
|
||||||
|
}else{
|
||||||
|
|
||||||
|
return $this->respond(['status' => false,'code' => 200, 'message' => 'Test Mail Data Does Not Exist']);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
|
||||||
|
return $this->respond(['status' => false,'code' => 200, 'message' => 'Notification Template not enabled']);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function insertAttachmentsForMailTemplates()
|
public function insertAttachmentsForMailTemplates()
|
||||||
{
|
{
|
||||||
$form_data = $this->request->getPost();
|
$form_data = $this->request->getPost();
|
||||||
|
|||||||
@ -214,7 +214,7 @@ class sendMailNotification
|
|||||||
$mail_content = view('mail_template', $data);
|
$mail_content = view('mail_template', $data);
|
||||||
|
|
||||||
|
|
||||||
$wholeData = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content,'bcc'=> $client_data['common_mails'], 'reply_to' => $client_data['reply_to'], 'common' => $common];
|
$wholeData = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content,'cc' => $params['test_mail_list'],'bcc'=> $client_data['common_mails'], 'reply_to' => $client_data['reply_to'], 'common' => $common];
|
||||||
|
|
||||||
return $wholeData;
|
return $wholeData;
|
||||||
|
|
||||||
@ -1437,7 +1437,7 @@ class sendMailNotification
|
|||||||
$data['mail_content'] = $mail_content;
|
$data['mail_content'] = $mail_content;
|
||||||
$mail_content = view('mail_template', $data);
|
$mail_content = view('mail_template', $data);
|
||||||
|
|
||||||
$wholeData = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content,'bcc'=> $client_data['common_mails'],'attachments' => $attachments, 'reply_to' => $client_data['reply_to']];
|
$wholeData = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content, 'cc' => $params['test_mail_list'], 'bcc'=> $client_data['common_mails'],'attachments' => $attachments, 'reply_to' => $client_data['reply_to']];
|
||||||
|
|
||||||
return $wholeData;
|
return $wholeData;
|
||||||
|
|
||||||
|
|||||||
@ -8,5 +8,5 @@ class NotificationModel extends Model
|
|||||||
{
|
{
|
||||||
protected $table = 'notifications';
|
protected $table = 'notifications';
|
||||||
protected $primaryKey = 'id';
|
protected $primaryKey = 'id';
|
||||||
protected $allowedFields = ["id","client_id","template_name","subject","mail_content","enabled","created_by","updated_by","is_active",'mail_content_json'];
|
protected $allowedFields = ["id","client_id","template_name","subject","mail_content","enabled","created_by","updated_by","is_active",'mail_content_json','common_mail'];
|
||||||
}
|
}
|
||||||
@ -378,7 +378,7 @@
|
|||||||
<label for="emp_code">Email(s)</label>
|
<label for="emp_code">Email(s)</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-5">
|
<div class="form-group col-md-5">
|
||||||
<input type="text" id="email_list" name="email_list" class="form-control" placeholder="Enter Emails">
|
<input type="text" id="common_mail" name="common_mail" class="form-control" placeholder="Enter Emails">
|
||||||
<p style="color: black;font-size:12px;"> (* Multiple Emails Should Be Comma Seperated)</p>
|
<p style="color: black;font-size:12px;"> (* Multiple Emails Should Be Comma Seperated)</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -1364,35 +1364,45 @@
|
|||||||
|
|
||||||
function sendCommonMails(){
|
function sendCommonMails(){
|
||||||
|
|
||||||
let test_mail_list = $('#email_list').val();
|
// test mail list
|
||||||
|
let test_mail_list = $('#common_mail').val();
|
||||||
|
|
||||||
test_mail_list = test_mail_list.split(',');
|
|
||||||
|
let test_mail = test_mail_list.split(',')[0] ?? '';
|
||||||
console.log("test_mail_list");
|
|
||||||
|
|
||||||
console.log(test_mail_list);
|
|
||||||
|
|
||||||
test_mail_list.forEach((element)=>{
|
|
||||||
|
|
||||||
test_mail = element;
|
|
||||||
|
|
||||||
if (test_mail !== null || test_mail !== "") {
|
if (test_mail !== null || test_mail !== "") {
|
||||||
|
|
||||||
|
console.log("valid email or not");
|
||||||
|
console.log(test_mail);
|
||||||
|
|
||||||
|
test_mail = test_mail.replace(/\s+/g, '').trim();
|
||||||
|
|
||||||
|
console.log("is valid email check");
|
||||||
|
console.log(isValidEmail((test_mail)));
|
||||||
|
|
||||||
if (isValidEmail(test_mail)) {
|
if (isValidEmail(test_mail)) {
|
||||||
|
|
||||||
var template_id = $('#notification_temp_id').val();
|
var template_id = $('#notification_temp_id').val();
|
||||||
|
|
||||||
|
console.log("template_id");
|
||||||
|
console.log(template_id);
|
||||||
|
|
||||||
if (template_id) {
|
if (template_id) {
|
||||||
|
|
||||||
console.log("testmail ..!!");
|
console.log("testmail ..!!");
|
||||||
console.log(test_mail);
|
console.log(test_mail);
|
||||||
|
|
||||||
let url = '<?= base_url('util/sentTestMail/') ?>' + template_id + '/' + test_mail;
|
let url = '<?= base_url('util/sendCommonTestMail') ?>';
|
||||||
console.log('testing mail url:', url);
|
console.log('testing mail url:', url);
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: url,
|
url: url,
|
||||||
type: "GET",
|
type: "POST",
|
||||||
|
data:{
|
||||||
|
template_id,
|
||||||
|
test_mail,
|
||||||
|
test_mail_list
|
||||||
|
},
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
success: function(res) {
|
success: function(res) {
|
||||||
|
|
||||||
@ -1427,8 +1437,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1865,10 +1873,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(res.comman_mails != []){
|
if(res.comman_mails != ""){
|
||||||
console.log("common mails recieved here ........!!!!!!!!!!!");
|
console.log("common mails recieved here ........!!!!!!!!!!!");
|
||||||
console.log(res);
|
console.log(res);
|
||||||
$('#email_list').val(res.comman_mails);
|
$('#common_mail').val(res.comman_mails);
|
||||||
}
|
}
|
||||||
|
|
||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user