From 26b3557b6bd08fb40728e44e53360740af3107d5 Mon Sep 17 00:00:00 2001 From: Manish Verma Date: Thu, 16 Aug 2018 11:59:28 +0530 Subject: [PATCH] clean dummy data --- app/Http/ViewComposers/AgentLayout.php | 42 +++++++++++++------ .../default1/admin/layout/admin.blade.php | 7 +++- .../default1/agent/layout/agent.blade.php | 13 +++++- 3 files changed, 47 insertions(+), 15 deletions(-) diff --git a/app/Http/ViewComposers/AgentLayout.php b/app/Http/ViewComposers/AgentLayout.php index 41eacc42b..fb1ae83a8 100644 --- a/app/Http/ViewComposers/AgentLayout.php +++ b/app/Http/ViewComposers/AgentLayout.php @@ -6,6 +6,7 @@ use App\Model\helpdesk\Agent\Department; use App\Model\helpdesk\Email\Emails; use App\Model\helpdesk\Settings\Company; use App\Model\helpdesk\Ticket\Tickets; +use App\Model\helpdesk\Settings\CommonSettings; use App\User; use Auth; use Illuminate\View\View; @@ -29,7 +30,7 @@ class AgentLayout * * @return void */ - public function __construct(Company $company, User $users, Tickets $tickets, Department $department, Emails $emails) + public function __construct(Company $company, User $users, Tickets $tickets, Department $department, Emails $emails, CommonSettings $common_settings) { $this->company = $company; $this->auth = Auth::user(); @@ -37,6 +38,7 @@ class AgentLayout $this->tickets = $tickets; $this->department = $department; $this->emails = $emails; + $this->common_settings = $common_settings; } /** @@ -50,17 +52,18 @@ class AgentLayout { $notifications = \App\Http\Controllers\Common\NotificationController::getNotifications(); $view->with([ - 'company' => $this->company, - 'notifications' => $notifications, - 'myticket' => $this->myTicket(), - 'unassigned' => $this->unassigned(), - 'followup_ticket' => $this->followupTicket(), - 'deleted' => $this->deleted(), - 'tickets' => $this->inbox(), - 'department' => $this->departments(), - 'overdues' => $this->overdues(), - 'due_today' => $this->getDueToday(), - 'is_mail_conigured' => $this->getEmailConfig(), + 'company' => $this->company, + 'notifications' => $notifications, + 'myticket' => $this->myTicket(), + 'unassigned' => $this->unassigned(), + 'followup_ticket' => $this->followupTicket(), + 'deleted' => $this->deleted(), + 'tickets' => $this->inbox(), + 'department' => $this->departments(), + 'overdues' => $this->overdues(), + 'due_today' => $this->getDueToday(), + 'is_mail_conigured' => $this->getEmailConfig(), + 'dummy_installation' => $this->getDummyDataInstallation(), ]); } @@ -214,4 +217,19 @@ class AgentLayout return false; } + + /** + * @category function to check if dummy data is installed in the system or not + * @param null + * @return builder + */ + public function getDummyDataInstallation() { + $return_collection = $this->common_settings->select('status')->where('option_name', '=', 'dummy_data_installation')->first(); + if (!$return_collection) { + $return_collection = collect(['status' => 0]); + return $return_collection['status']; + } + + return $return_collection->status; + } } diff --git a/resources/views/themes/default1/admin/layout/admin.blade.php b/resources/views/themes/default1/admin/layout/admin.blade.php index 230fa29f6..da8d7e00c 100644 --- a/resources/views/themes/default1/admin/layout/admin.blade.php +++ b/resources/views/themes/default1/admin/layout/admin.blade.php @@ -374,7 +374,12 @@
- @if (!$is_mail_conigured) + @if($dummy_installation == 1 || $dummy_installation == '1') +
+ + {{Lang::get('lang.dummy_data_installation_message')}} {{Lang::get('lang.click')}} {{Lang::get('lang.clear-dummy-data')}} +
+ @elseif (!$is_mail_conigured)
diff --git a/resources/views/themes/default1/agent/layout/agent.blade.php b/resources/views/themes/default1/agent/layout/agent.blade.php index 0f694415c..18e44491d 100644 --- a/resources/views/themes/default1/agent/layout/agent.blade.php +++ b/resources/views/themes/default1/agent/layout/agent.blade.php @@ -400,7 +400,16 @@ $group = App\Model\helpdesk\Agent\Groups::where('id', '=', $agent_group)->first(
- @if (!$is_mail_conigured) + @if($dummy_installation == 1 || $dummy_installation == '1') +
+ + @if (\Auth::user()->role == 'admin') + {{Lang::get('lang.dummy_data_installation_message')}} {{Lang::get('lang.click')}} {{Lang::get('lang.clear-dummy-data')}} + @else + {{Lang::get('lang.clear-dummy-data-agent-message')}} + @endif +
+ @elseif (!$is_mail_conigured)
@@ -415,7 +424,7 @@ $group = App\Model\helpdesk\Agent\Groups::where('id', '=', $agent_group)->first(
- @endif + @endif @yield('content')