CHANGE_help_desk_tickets - VADIVEL J 2025-11-05 18:38

This commit is contained in:
vadivelJ96 2025-11-05 18:38:07 +05:30
parent 261a40212f
commit 45410dfc63
2 changed files with 96 additions and 4 deletions

View File

@ -201,10 +201,17 @@ class NotificationController extends AdminController
}
if( isset($value['template_name']) && !empty($value['template_name']) && $value['template_name'] == "member_common_mail"){
$value['common_mails'] = $this->CommonEMailModel->where('notification_id',$value['id'])->findAll()??[];
$common_mails = $this->CommonEMailModel
->where('notification_id',$value['id'])
->where('is_active',1)
->findAll()??[];
$value['comman_mails'] = !empty($common_mails)
? trim(implode("," , array_column( $common_mails,'email') ))
: [];
}
return json_encode($value);

View File

@ -359,6 +359,7 @@
<input type="hidden" class="form-control" id="template_name" name="template_name" value="Common Mail" readonly>
<input type="hidden" id="member_common_mail_template_name" value="member_common_mail">
<input type="hidden" id="notification_temp_id" name="notification_temp_id">
<div class="form-group">
@ -372,7 +373,7 @@
</div>
</div>
<div class="form-row" id="email_list">
<div class="form-row" id="rac_rate_dropdown">
<div class="form-group col-md-2">
<label for="emp_code">Email(s)</label>
</div>
@ -434,6 +435,8 @@
</div>
<div class="form-group text-right m-b-0">
<button type="button" class="btn btn-primary waves-effect waves-light mr-1"
onclick="sendCommonMails()" > Send Common Mails </button>
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1"
id="btnGridSubmit_2">Submit</button>
</div>
@ -1359,6 +1362,77 @@
}
function sendCommonMails(){
let test_mail_list = $('#email_list').val();
test_mail_list = test_mail_list.split(',');
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 (isValidEmail(test_mail)) {
var template_id = $('#notification_temp_id').val();
if (template_id) {
console.log("testmail ..!!");
console.log(test_mail);
let url = '<?= base_url('util/sentTestMail/') ?>' + template_id + '/' + test_mail;
console.log('testing mail url:', url);
$.ajax({
url: url,
type: "GET",
dataType: 'json',
success: function(res) {
console.log('Test mail send function response', res)
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
if (res.status == true) {
let respond = res.respond;
console.log('Parsed respond', respond)
if (respond.status == 'success') {
toastr.success(respond.message, 'SUCCESS')
} else {
toastr.warning(respond.message, 'WARNING')
}
} else {
toastr.warning('Failed to sent mail', 'WARNING')
}
},
error: function(xhr, status, error) {
console.error(xhr.responseText);
console.error(status, error);
}
});
}
}
}
})
}
function isValidEmail(email) {
const emailPattern = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
return emailPattern.test(email);
@ -1761,7 +1835,11 @@
$('#attachment_table').toggle(!!res.id);
$('#attachment_table_ecard').toggle(!!res.id);
$('.setid').attr('data-id', res.id || '');
} else {
if (template_name == "member_common_mail"){
$('#notification_temp_id').val(res.id);
}
}
else{
console.log("Inside else");
let retryCount = 0;
const initWithRetry = function() {
@ -1786,6 +1864,13 @@
initWithRetry();
}
if(res.comman_mails != []){
console.log("common mails recieved here ........!!!!!!!!!!!");
console.log(res);
$('#email_list').val(res.comman_mails);
}
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
},