diff --git a/app/Controllers/LeadsController.php b/app/Controllers/LeadsController.php index 6140f45..9ce3443 100755 --- a/app/Controllers/LeadsController.php +++ b/app/Controllers/LeadsController.php @@ -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); diff --git a/app/Controllers/NotificationController.php b/app/Controllers/NotificationController.php index 0c3890f..88306b8 100755 --- a/app/Controllers/NotificationController.php +++ b/app/Controllers/NotificationController.php @@ -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, diff --git a/app/Helpers/sendMailNotification.php b/app/Helpers/sendMailNotification.php index 358b362..859cd08 100755 --- a/app/Helpers/sendMailNotification.php +++ b/app/Helpers/sendMailNotification.php @@ -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']]; } } diff --git a/app/Views/mail_template.php b/app/Views/mail_template.php index 22582cf..e4f6f20 100644 --- a/app/Views/mail_template.php +++ b/app/Views/mail_template.php @@ -1,3 +1,20 @@ + + @@ -10,7 +27,7 @@ @@ -49,15 +85,21 @@ -
+
- -
- Client Logo + +