Email config alert

Added alert box to convey that email has not been setup
This commit is contained in:
Manish Verma
2018-08-10 16:12:51 +05:30
parent 0e9e447fbe
commit 0c49050172
4 changed files with 65 additions and 15 deletions

View File

@@ -316,9 +316,9 @@ class ApiController extends Controller
->groupby('tickets.id') ->groupby('tickets.id')
->distinct() ->distinct()
->paginate(10) ->paginate(10)
->toJson(); ->toArray();
return $result; return response($result);
} catch (\Exception $e) { } catch (\Exception $e) {
$error = $e->getMessage(); $error = $e->getMessage();
$line = $e->getLine(); $line = $e->getLine();
@@ -370,9 +370,9 @@ class ApiController extends Controller
->groupby('tickets.id') ->groupby('tickets.id')
->distinct() ->distinct()
->paginate(10) ->paginate(10)
->toJson(); ->toArray();
return $unassigned; return response($unassigned);
} catch (\Exception $e) { } catch (\Exception $e) {
$error = $e->getMessage(); $error = $e->getMessage();
$line = $e->getLine(); $line = $e->getLine();
@@ -423,9 +423,9 @@ class ApiController extends Controller
->groupby('tickets.id') ->groupby('tickets.id')
->distinct() ->distinct()
->paginate(10) ->paginate(10)
->toJson(); ->toArray();
return $result; return response($result);
} catch (\Exception $e) { } catch (\Exception $e) {
$error = $e->getMessage(); $error = $e->getMessage();
$line = $e->getLine(); $line = $e->getLine();
@@ -988,9 +988,8 @@ class ApiController extends Controller
->groupby('tickets.id') ->groupby('tickets.id')
->distinct() ->distinct()
->paginate(10) ->paginate(10)
->toJson(); ->toArray();
return response($inbox);
return $inbox;
} catch (\Exception $ex) { } catch (\Exception $ex) {
$error = $ex->getMessage(); $error = $ex->getMessage();
$line = $ex->getLine(); $line = $ex->getLine();
@@ -1072,9 +1071,9 @@ class ApiController extends Controller
->groupby('tickets.id') ->groupby('tickets.id')
->distinct() ->distinct()
->paginate(10) ->paginate(10)
->toJson(); ->toArray();
return $trash; return response($trash);
} catch (\Exception $e) { } catch (\Exception $e) {
$error = $e->getMessage(); $error = $e->getMessage();
$line = $e->getLine(); $line = $e->getLine();
@@ -1129,9 +1128,9 @@ class ApiController extends Controller
->groupby('tickets.id') ->groupby('tickets.id')
->distinct() ->distinct()
->paginate(10) ->paginate(10)
->toJson(); ->toArray();
return $result; return response($result);
} catch (\Exception $e) { } catch (\Exception $e) {
$error = $e->getMessage(); $error = $e->getMessage();
$line = $e->getLine(); $line = $e->getLine();

View File

@@ -3,6 +3,7 @@
namespace App\Http\ViewComposers; namespace App\Http\ViewComposers;
use App\Model\helpdesk\Agent\Department; use App\Model\helpdesk\Agent\Department;
use App\Model\helpdesk\Email\Emails;
use App\Model\helpdesk\Settings\Company; use App\Model\helpdesk\Settings\Company;
use App\Model\helpdesk\Ticket\Tickets; use App\Model\helpdesk\Ticket\Tickets;
use App\User; use App\User;
@@ -28,13 +29,14 @@ class AgentLayout
* *
* @return void * @return void
*/ */
public function __construct(Company $company, User $users, Tickets $tickets, Department $department) public function __construct(Company $company, User $users, Tickets $tickets, Department $department, Emails $emails)
{ {
$this->company = $company; $this->company = $company;
$this->auth = Auth::user(); $this->auth = Auth::user();
$this->users = $users; $this->users = $users;
$this->tickets = $tickets; $this->tickets = $tickets;
$this->department = $department; $this->department = $department;
$this->emails = $emails;
} }
/** /**
@@ -58,6 +60,7 @@ class AgentLayout
'department' => $this->departments(), 'department' => $this->departments(),
'overdues' => $this->overdues(), 'overdues' => $this->overdues(),
'due_today' => $this->getDueToday(), 'due_today' => $this->getDueToday(),
'is_mail_conigured' => $this->getEmailConfig(),
]); ]);
} }
@@ -194,4 +197,21 @@ class AgentLayout
->whereRaw('date(duedate) = ?', [date('Y-m-d')]); ->whereRaw('date(duedate) = ?', [date('Y-m-d')]);
} }
} }
/**
* @category function to check configured mails
*
* @var $emails
*
* @return bool true/false
*/
public function getEmailConfig()
{
$emails = $this->emails->where('sending_status', '=', 1)->where('fetching_status', '=', 1)->count();
if ($emails >= 1) {
return true;
}
return false;
}
} }

View File

@@ -374,7 +374,22 @@
<!-- Main content --> <!-- Main content -->
<section class="content"> <section class="content">
@if (!$is_mail_conigured)
<div class="row">
<div class="col-md-12">
<div class="callout callout-warning lead">
<h4><i class="fa fa-exclamation-triangle"></i>&nbsp;{{Lang::get('Alert')}}</h4>
<p style="font-size:0.8em">
@if (\Auth::user()->role == 'admin')
{{Lang::get('lang.system-outgoing-incoming-mail-not-configured')}}&nbsp;<a href="{{URL::route('emails.create')}}">{{Lang::get('lang.confihure-the-mail-now')}}</a>
@else
{{Lang::get('lang.system-mail-not-configured-agent-message')}}
@endif
</p>
</div>
</div>
</div>
@endif
@yield('content') @yield('content')
</section><!-- /.content --> </section><!-- /.content -->
<!-- /.content-wrapper --> <!-- /.content-wrapper -->

View File

@@ -400,6 +400,22 @@ $group = App\Model\helpdesk\Agent\Groups::where('id', '=', $agent_group)->first(
</section> </section>
<!-- Main content --> <!-- Main content -->
<section class="content"> <section class="content">
@if (!$is_mail_conigured)
<div class="row">
<div class="col-md-12">
<div class="callout callout-warning lead">
<h4><i class="fa fa-exclamation-triangle"></i>&nbsp;{{Lang::get('Alert')}}</h4>
<p style="font-size:0.8em">
@if (\Auth::user()->role == 'admin')
{{Lang::get('lang.system-outgoing-incoming-mail-not-configured')}}&nbsp;<a href="{{URL::route('emails.create')}}">{{Lang::get('lang.confihure-the-mail-now')}}</a>
@else
{{Lang::get('lang.system-mail-not-configured-agent-message')}}
@endif
</p>
</div>
</div>
</div>
@endif
@yield('content') @yield('content')
</section><!-- /.content --> </section><!-- /.content -->
</div> </div>