Update v1.0.6.10

This commit is contained in:
sujitprasad
2016-04-01 10:37:46 +05:30
parent d8400d6d79
commit ce796d2a89
10 changed files with 562 additions and 81 deletions

View File

@@ -2,15 +2,17 @@
namespace App\Http\Controllers\Agent\helpdesk;
// controllers
// controllers
use App\Http\Controllers\Common\PhpMailController;
// Model
use App\Http\Controllers\Controller;
// Model
use App\Model\helpdesk\Agent\Department;
use App\Model\helpdesk\Agent\Teams;
use App\Model\helpdesk\Settings\Company;
use App\Model\helpdesk\settings\Email;
use App\Model\helpdesk\Utility\Log_notification;
use App\User;
use View;
// classes
@@ -22,8 +24,13 @@ use App\User;
*/
class NotificationController extends Controller
{
public function __construct(PhpMailController $PhpMailController)
{
$this->PhpMailController = $PhpMailController;
}
/**
* This function is for sending daily report/notification about the system.
* This function is for sending daily report/notification about the system.
* */
public function send_notification()
{
@@ -52,11 +59,11 @@ class NotificationController extends Controller
}
/**
* Admin Notification/Report.
* Admin Notification/Report.
*
* @param company
* @param company
*
* @return mail
* @return mail
* */
public function send_notification_to_admin($company)
{
@@ -66,16 +73,20 @@ class NotificationController extends Controller
// Send notification details to admin
$email = $user->email;
$user_name = $user->first_name.' '.$user->last_name;
\Mail::send('emails.notifications.admin', ['company' => $company, 'name' => $user_name], function ($message) use ($email, $user_name, $company) {
$message->to($email, $user_name)->subject($company.' Daily Report ');
});
$view = View::make('emails.notifications.admin', ['company' => $company, 'name' => $user_name]);
$contents = $view->render();
$this->PhpMailController->sendEmail($from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => $user_name, 'email' => $email], $message = ['subject' => 'Dily Report', 'scenario' => null, 'body' => $contents]);
// \Mail::send('emails.notifications.admin', ['company' => $company, 'name' => $user_name], function ($message) use ($email, $user_name, $company) {
// $message->to($email, $user_name)->subject($company.' Daily Report ');
// });
}
}
/**
* Department Manager Notification/Report.
* Department Manager Notification/Report.
*
* @return mail
* @return mail
* */
public function send_notification_to_manager($company)
{
@@ -89,9 +100,13 @@ class NotificationController extends Controller
// Send notification details to manager of a department
$email = $user->email;
$user_name = $user->first_name.' '.$user->last_name;
\Mail::send('emails.notifications.manager', ['company' => $company, 'name' => $user_name, 'dept_id' => $dept->id, 'dept_name' => $dept->name], function ($message) use ($email, $user_name, $company, $dept_name) {
$message->to($email, $user_name)->subject($company.' Daily Report for department manager of '.$dept_name.' department.');
});
$view = View::make('emails.notifications.manager', ['company' => $company, 'name' => $user_name]);
$contents = $view->render();
$this->PhpMailController->sendEmail($from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => $user_name, 'email' => $email], $message = ['subject' => 'Dily Report', 'scenario' => null, 'body' => $contents]);
// \Mail::send('emails.notifications.manager', ['company' => $company, 'name' => $user_name, 'dept_id' => $dept->id, 'dept_name' => $dept->name], function ($message) use ($email, $user_name, $company, $dept_name) {
// $message->to($email, $user_name)->subject($company.' Daily Report for department manager of '.$dept_name.' department.');
// });
}
}
}
@@ -100,7 +115,7 @@ class NotificationController extends Controller
/**
* Team Lead Notification/Report.
*
* @return mail
* @return mail
* */
public function send_notification_to_team_lead($company)
{
@@ -114,18 +129,22 @@ class NotificationController extends Controller
// Send notification details to team lead
$email = $user->email;
$user_name = $user->first_name.' '.$user->last_name;
\Mail::send('emails.notifications.lead', ['company' => $company, 'name' => $user_name, 'team_id' => $team->id], function ($message) use ($email, $user_name, $company, $team_name) {
$message->to($email, $user_name)->subject($company.' Daily Report for Team Lead of team '.$team_name);
});
$view = View::make('emails.notifications.lead', ['company' => $company, 'name' => $user_name]);
$contents = $view->render();
$this->PhpMailController->sendEmail($from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => $user_name, 'email' => $email], $message = ['subject' => 'Dily Report', 'scenario' => null, 'body' => $contents]);
// \Mail::send('emails.notifications.lead', ['company' => $company, 'name' => $user_name, 'team_id' => $team->id], function ($message) use ($email, $user_name, $company, $team_name) {
// $message->to($email, $user_name)->subject($company.' Daily Report for Team Lead of team '.$team_name);
// });
}
}
}
}
/**
* Agent Notification/Report.
* Agent Notification/Report.
*
* @return mail
* @return mail
* */
public function send_notification_to_agent($company)
{
@@ -135,9 +154,13 @@ class NotificationController extends Controller
// Send notification details to all the agents
$email = $user->email;
$user_name = $user->first_name.' '.$user->last_name;
\Mail::send('emails.notifications.agent', ['company' => $company, 'name' => $user_name, 'user_id' => 1], function ($message) use ($email, $user_name, $company) {
$message->to($email, $user_name)->subject($company.' Daily Report for Agents');
});
$view = View::make('emails.notifications.agent', ['company' => $company, 'name' => $user_name]);
$contents = $view->render();
$this->PhpMailController->sendEmail($from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => $user_name, 'email' => $email], $message = ['subject' => 'Dily Report', 'scenario' => null, 'body' => $contents]);
// \Mail::send('emails.notifications.agent', ['company' => $company, 'name' => $user_name, 'user_id' => 1], function ($message) use ($email, $user_name, $company) {
// $message->to($email, $user_name)->subject($company.' Daily Report for Agents');
// });
}
}
@@ -162,10 +185,10 @@ class NotificationController extends Controller
// // testing
// public function test(){
// $email = "sujit.prasad@ladybirdweb.com";
// $user_name = "sujit prasad";
// \Mail::send('emails.notifications.test', ['user_id' => 1], function ($message) use($email, $user_name) {
// $message->to($email, $user_name)->subject('testing reporting');
// });
// $email = "sujit.prasad@ladybirdweb.com";
// $user_name = "sujit prasad";
// \Mail::send('emails.notifications.test', ['user_id' => 1], function ($message) use($email, $user_name) {
// $message->to($email, $user_name)->subject('testing reporting');
// });
// }
}