Merge branch 'dev' of bitbucket.org:jubilian/nhance-enrollment into dev

This commit is contained in:
VENKATESHWARAN 2025-11-10 14:15:47 +05:30
commit c8fc801225
5 changed files with 161 additions and 20 deletions

View File

@ -135,7 +135,7 @@ class LeadsController extends BaseController
// dd($data);
// Fetch leads data
$data ['lead_data_list'] = $this->leadsModel->getLeadDataForLising();
$data['lead_data_list'] = $this->leadsModel->getLeadDataForLising();
// Load layout and pass data
$this->loadLayout('leads_list', $data);

View File

@ -246,7 +246,10 @@ class NotificationController extends AdminController
// Insert file attachment record
if ($this->MailAttachmentModel->insert($data)) {
// Retrieve active attachments to return in response
$attachment_data = $this->MailAttachmentModel->where('is_active', 1)->findAll();
$attachment_data = $this->MailAttachmentModel
->where('notification_id',$find_notification['id'])
->where('is_active', 1)->findAll();
return $this->respond([
'status' => true,
'code' => 200,

View File

@ -81,6 +81,21 @@ class sendMailNotification
$client_data = $params['client_data'];
$common = $params['common'];
$mailAttachmentModel = new MailAttachmentModel();
$attachment_data = $mailAttachmentModel
->select('file_path, file_name')
->where('notification_id', $notification_data['id'])
->where('is_active', 1)
->findAll()??[];
$attachments = [];
foreach ($attachment_data as $data) {
$attachments[] = [
"filePath" => WRITEPATH . $data['file_path'],
"fileName" => $data['file_name']
];
}
$subject = $notification_data['subject'];
$app_link = $_ENV['App_Url'];
$mail_content = $notification_data['mail_content'];
@ -109,7 +124,7 @@ class sendMailNotification
$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, 'bcc' => $client_data['common_mails'], 'attachments' => $attachments, 'reply_to' => $client_data['reply_to'], 'common' => $common];
return $wholeData;
} else if ($action == 'member_ecard_mail') {
@ -1264,6 +1279,23 @@ class sendMailNotification
$client_data = $params['client_data'];
$mail = $params['test_mail'];
$mailAttachmentModel = new MailAttachmentModel();
$attachment_data = $mailAttachmentModel
->select('file_path, file_name')
->where('notification_id', $notification_data['id'])
->where('is_active', 1)
->findAll()??[];
$attachments = [];
foreach ($attachment_data as $data) {
$attachments[] = [
"filePath" => WRITEPATH . $data['file_path'],
"fileName" => $data['file_name']
];
}
$mail_content = $notification_data['mail_content'];
$subject = $notification_data['subject'];
@ -1293,7 +1325,7 @@ class sendMailNotification
$data['mail_content'] = $mail_content;
$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']];
$wholeData = ['mail' => $mail, 'subject' => $subject, 'message' => $mail_content, 'bcc' => $client_data['common_mails'], 'attachments' => $attachments , 'reply_to' => $client_data['reply_to']];
}
}

View File

@ -1,3 +1,20 @@
<?php
$value = "";
if(isset($params['notification_data'])){
$value = $params['notification_data'];
}
if(isset($params['notification'])){
$value = $params['notification'];
}
$value = json_decode($value['mail_content_json'] ?? '[]', true);
$contentWidth = (int) $value['body']['values']['contentWidth'] ?? 500;
?>
<!DOCTYPE html>
<html lang="en">
@ -10,7 +27,7 @@
<style>
.mail-template-header {
max-width: 500px;
max-width: <?=$contentWidth?>px;
background-color: #ffffff !important;
border-bottom: 1px solid #00999E;
width: 100%; /* default: allow full width */
@ -26,12 +43,16 @@
}
.mail-template-footer {
max-width: 500px;
max-width: <?=$contentWidth?>px;
background-color: #ffffff !important;
border-top: 1px solid #00999E;
width: 100%; /* default: allow full width */
}
p{
margin:0 !important;
}
/* On screens smaller than 600px → force 100% */
@media screen and (max-width: 600px) {
.mail-template-footer {
@ -41,7 +62,22 @@
}
}
@media screen and (max-width: 600px){
.header-div{
width: 100% !important;
}
.footer-div{
width : 100% !important ;
}
}
.client_logo,
.nhance_logo
{
vertical-align: middle !important;
}
</style>
@ -49,15 +85,21 @@
<body>
<!-- header -->
<div align="center">
<div align="center" class="header-div">
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="mail-template-header">
<tr style="height:90px; background-color: #ffffff !important;">
<td align="left" valign="middle" style="padding:20px;" width="50%">
<img src="<?= $client_logo?>"
alt="Client Logo"
style="max-height:80px; max-width: 160px;">
<td align="left" class="client_logo" style="padding:5px;" width="50%">
<div style="
width:160px;
height:80px;
background-image:url('<?= $client_logo ?>');
background-size:contain;
background-repeat:no-repeat;
">
</div>
</td>
<td align="right" valign="middle" style="padding:20px;" width="50%">
<td align="right" class="nhance_logo" style="padding:5px;" width="50%">
<img src="<?= base_url('/public/assets/images/Nhance-Logo-Final.png'); ?>"
alt="Default Logo"
style="height:auto; max-width: 120px;">
@ -76,7 +118,7 @@
<!-- footer -->
<div align="center">
<div align="center" class="footer-div">
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="mail-template-footer">
<tr style="background-color: #ffffff !important;">
<td align="center" valign="middle" style="padding-top:5px;">

View File

@ -370,6 +370,18 @@
<input type="file" id="Question_title_fileInput" style="display: none;">
<table id="attachment_table" class="table table-sm mb-0" style="margin-top: 30px;">
<thead>
<tr>
<th>Attachments</th>
<th>Action</th>
</tr>
</thead>
<tbody id="attachment_tbody_reminder_mail_attachments">
</tbody>
</table>
</div>
<div class="form-group text-right m-b-0">
@ -1142,15 +1154,58 @@
console.log('addHTMLInput function called');
console.log(template_name);
var container = '';
if (template_name == 'member_welcome_mail') {
if( template_name == 'member_welcome_mail' ) {
container = document.getElementById('attachment_tbody');
} //else {
}
else if( template_name == "member_reminder_mail" ){
container = document.getElementById('attachment_tbody_reminder_mail_attachments');
}
//else {
// container = document.getElementById('attachment_tbody_ecard');
// }
// }
if (data && template_name == "member_welcome_mail") {
if (data) {
$('#attachment_tbody').empty();
$(container).empty();
data.forEach(item => {
const newRow = document.createElement('tr');
newRow.className = 'dynamic-form-row';
newRow.innerHTML = `
<td> ${item.file_name} </td>
<td> <a class="fa fa-trash" data-id="${item.id}" onclick="removeAttachment('${item.id}')"></a></td>
`;
container.appendChild(newRow);
});
// Creating another row for the form with file input
const newFormRow = document.createElement('tr');
newFormRow.className = 'dynamic-form-row';
newFormRow.innerHTML = `
<td>
<form class="ajax" onsubmit="submitAttachmentForm(event, this)">
<div class="form-row">
<div class="form-group col-3">
<input type="file" class="file-input__input" name="file" required>
</div>
<div class="form-group col-2">
<button type="submit" class="btn btn-sm btn-primary">Submit</button>
</div>
</div>
</form>
</td>
`;
container.appendChild(newFormRow);
}
else if (data && template_name == "member_reminder_mail") {
$('#attachment_tbody_reminder_mail_attachments').empty();
data.forEach(item => {
const newRow = document.createElement('tr');
@ -1186,6 +1241,8 @@
container.appendChild(newFormRow);
} else {
// If no data is passed, create a new empty row
const newRow = document.createElement('tr');
newRow.className = 'dynamic-form-row';
@ -1518,7 +1575,14 @@
initWithRetry();
if (res.data && template_name == 'member_welcome_mail') {
if (res.data && (template_name == 'member_welcome_mail' )) {
console.log("file attachment for member_welcome_mail");
console.log(template_name);
addHTMLInput(res.data);
}
if (res.data && ( template_name == "member_reminder_mail" )) {
console.log("file attachment for member_reminder_mail");
console.log(template_name);
addHTMLInput(res.data);
} //else {
// addHTMLInput();