Merge branch 'dev' of bitbucket.org:jubilian/nhance-enrollment into dev
This commit is contained in:
commit
c8fc801225
@ -246,7 +246,10 @@ class NotificationController extends AdminController
|
|||||||
// Insert file attachment record
|
// Insert file attachment record
|
||||||
if ($this->MailAttachmentModel->insert($data)) {
|
if ($this->MailAttachmentModel->insert($data)) {
|
||||||
// Retrieve active attachments to return in response
|
// 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([
|
return $this->respond([
|
||||||
'status' => true,
|
'status' => true,
|
||||||
'code' => 200,
|
'code' => 200,
|
||||||
|
|||||||
@ -81,6 +81,21 @@ class sendMailNotification
|
|||||||
$client_data = $params['client_data'];
|
$client_data = $params['client_data'];
|
||||||
$common = $params['common'];
|
$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'];
|
$subject = $notification_data['subject'];
|
||||||
$app_link = $_ENV['App_Url'];
|
$app_link = $_ENV['App_Url'];
|
||||||
$mail_content = $notification_data['mail_content'];
|
$mail_content = $notification_data['mail_content'];
|
||||||
@ -109,7 +124,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, 'bcc' => $client_data['common_mails'], 'attachments' => $attachments, 'reply_to' => $client_data['reply_to'], 'common' => $common];
|
||||||
|
|
||||||
return $wholeData;
|
return $wholeData;
|
||||||
} else if ($action == 'member_ecard_mail') {
|
} else if ($action == 'member_ecard_mail') {
|
||||||
@ -1264,6 +1279,23 @@ class sendMailNotification
|
|||||||
$client_data = $params['client_data'];
|
$client_data = $params['client_data'];
|
||||||
$mail = $params['test_mail'];
|
$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'];
|
$mail_content = $notification_data['mail_content'];
|
||||||
$subject = $notification_data['subject'];
|
$subject = $notification_data['subject'];
|
||||||
|
|
||||||
@ -1293,7 +1325,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'], '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']];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -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>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
|
||||||
@ -10,7 +27,7 @@
|
|||||||
<style>
|
<style>
|
||||||
|
|
||||||
.mail-template-header {
|
.mail-template-header {
|
||||||
max-width: 500px;
|
max-width: <?=$contentWidth?>px;
|
||||||
background-color: #ffffff !important;
|
background-color: #ffffff !important;
|
||||||
border-bottom: 1px solid #00999E;
|
border-bottom: 1px solid #00999E;
|
||||||
width: 100%; /* default: allow full width */
|
width: 100%; /* default: allow full width */
|
||||||
@ -26,12 +43,16 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.mail-template-footer {
|
.mail-template-footer {
|
||||||
max-width: 500px;
|
max-width: <?=$contentWidth?>px;
|
||||||
background-color: #ffffff !important;
|
background-color: #ffffff !important;
|
||||||
border-top: 1px solid #00999E;
|
border-top: 1px solid #00999E;
|
||||||
width: 100%; /* default: allow full width */
|
width: 100%; /* default: allow full width */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
p{
|
||||||
|
margin:0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
/* On screens smaller than 600px → force 100% */
|
/* On screens smaller than 600px → force 100% */
|
||||||
@media screen and (max-width: 600px) {
|
@media screen and (max-width: 600px) {
|
||||||
.mail-template-footer {
|
.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>
|
</style>
|
||||||
|
|
||||||
@ -49,15 +85,21 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
<!-- header -->
|
<!-- header -->
|
||||||
<div align="center">
|
<div align="center" class="header-div">
|
||||||
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="mail-template-header">
|
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="mail-template-header">
|
||||||
<tr style="height:90px; background-color: #ffffff !important;">
|
<tr style="height:90px; background-color: #ffffff !important;">
|
||||||
<td align="left" valign="middle" style="padding:20px;" width="50%">
|
<td align="left" class="client_logo" style="padding:5px;" width="50%">
|
||||||
<img src="<?= $client_logo?>"
|
<div style="
|
||||||
alt="Client Logo"
|
width:160px;
|
||||||
style="max-height:80px; max-width: 160px;">
|
height:80px;
|
||||||
|
background-image:url('<?= $client_logo ?>');
|
||||||
|
background-size:contain;
|
||||||
|
background-repeat:no-repeat;
|
||||||
|
">
|
||||||
|
</div>
|
||||||
|
|
||||||
</td>
|
</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'); ?>"
|
<img src="<?= base_url('/public/assets/images/Nhance-Logo-Final.png'); ?>"
|
||||||
alt="Default Logo"
|
alt="Default Logo"
|
||||||
style="height:auto; max-width: 120px;">
|
style="height:auto; max-width: 120px;">
|
||||||
@ -76,7 +118,7 @@
|
|||||||
|
|
||||||
|
|
||||||
<!-- footer -->
|
<!-- footer -->
|
||||||
<div align="center">
|
<div align="center" class="footer-div">
|
||||||
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="mail-template-footer">
|
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="mail-template-footer">
|
||||||
<tr style="background-color: #ffffff !important;">
|
<tr style="background-color: #ffffff !important;">
|
||||||
<td align="center" valign="middle" style="padding-top:5px;">
|
<td align="center" valign="middle" style="padding-top:5px;">
|
||||||
|
|||||||
@ -370,6 +370,18 @@
|
|||||||
|
|
||||||
<input type="file" id="Question_title_fileInput" style="display: none;">
|
<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>
|
||||||
|
|
||||||
<div class="form-group text-right m-b-0">
|
<div class="form-group text-right m-b-0">
|
||||||
@ -1144,13 +1156,56 @@
|
|||||||
var container = '';
|
var container = '';
|
||||||
if( template_name == 'member_welcome_mail' ) {
|
if( template_name == 'member_welcome_mail' ) {
|
||||||
container = document.getElementById('attachment_tbody');
|
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');
|
// container = document.getElementById('attachment_tbody_ecard');
|
||||||
// }
|
// }
|
||||||
|
|
||||||
if (data) {
|
if (data && template_name == "member_welcome_mail") {
|
||||||
|
|
||||||
$(container).empty();
|
$('#attachment_tbody').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 => {
|
data.forEach(item => {
|
||||||
const newRow = document.createElement('tr');
|
const newRow = document.createElement('tr');
|
||||||
@ -1186,6 +1241,8 @@
|
|||||||
container.appendChild(newFormRow);
|
container.appendChild(newFormRow);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
|
||||||
// If no data is passed, create a new empty row
|
// If no data is passed, create a new empty row
|
||||||
const newRow = document.createElement('tr');
|
const newRow = document.createElement('tr');
|
||||||
newRow.className = 'dynamic-form-row';
|
newRow.className = 'dynamic-form-row';
|
||||||
@ -1518,7 +1575,14 @@
|
|||||||
|
|
||||||
initWithRetry();
|
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);
|
addHTMLInput(res.data);
|
||||||
} //else {
|
} //else {
|
||||||
// addHTMLInput();
|
// addHTMLInput();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user