1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace App\Http\Controllers\Admin\helpdesk; |
4
|
|
|
|
5
|
|
|
// controllers |
6
|
|
|
use App\Http\Controllers\Controller; |
7
|
|
|
// requests |
8
|
|
|
use App\Http\Requests\helpdesk\CompanyRequest; |
9
|
|
|
use App\Http\Requests\helpdesk\EmailRequest; |
10
|
|
|
use App\Http\Requests\helpdesk\SystemRequest; |
11
|
|
|
// models |
12
|
|
|
use App\Model\helpdesk\Agent\Department; |
13
|
|
|
use App\Model\helpdesk\Email\Emails; |
14
|
|
|
use App\Model\helpdesk\Email\Template; |
15
|
|
|
use App\Model\helpdesk\Manage\Help_topic; |
16
|
|
|
use App\Model\helpdesk\Manage\Sla_plan; |
17
|
|
|
use App\Model\helpdesk\Notification\UserNotification; |
18
|
|
|
use App\Model\helpdesk\Settings\Access; |
19
|
|
|
use App\Model\helpdesk\Settings\Alert; |
20
|
|
|
use App\Model\helpdesk\Settings\Company; |
21
|
|
|
use App\Model\helpdesk\Settings\Email; |
22
|
|
|
use App\Model\helpdesk\Settings\Responder; |
23
|
|
|
use App\Model\helpdesk\Settings\System; |
24
|
|
|
use App\Model\helpdesk\Settings\Ticket; |
25
|
|
|
use App\Model\helpdesk\Ticket\Ticket_Priority; |
26
|
|
|
use App\Model\helpdesk\Utility\Date_format; |
27
|
|
|
use App\Model\helpdesk\Utility\Date_time_format; |
28
|
|
|
use App\Model\helpdesk\Utility\Time_format; |
29
|
|
|
use App\Model\helpdesk\Utility\Timezones; |
30
|
|
|
use DateTime; |
31
|
|
|
// classes |
32
|
|
|
use DB; |
33
|
|
|
use Exception; |
34
|
|
|
use Illuminate\Http\Request; |
35
|
|
|
use Input; |
36
|
|
|
use Lang; |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* SettingsController. |
40
|
|
|
* |
41
|
|
|
* @author Ladybird <[email protected]> |
42
|
|
|
*/ |
43
|
|
|
class SettingsController2 extends Controller |
44
|
|
|
{ |
45
|
|
|
/** |
46
|
|
|
* Create a new controller instance. |
47
|
|
|
* |
48
|
|
|
* @return void |
|
|
|
|
49
|
|
|
*/ |
50
|
|
|
public function __construct() |
51
|
|
|
{ |
52
|
|
|
// $this->smtp(); |
|
|
|
|
53
|
|
|
$this->middleware('auth'); |
54
|
|
|
$this->middleware('roles'); |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* Main Settings Page. |
59
|
|
|
* |
60
|
|
|
* @return type view |
61
|
|
|
*/ |
62
|
|
|
public function settings() |
63
|
|
|
{ |
64
|
|
|
return view('themes.default1.admin.helpdesk.setting'); |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
public function notificationSettings() |
68
|
|
|
{ |
69
|
|
|
return view('themes.default1.admin.helpdesk.settings.notification'); |
70
|
|
|
} |
71
|
|
|
|
72
|
|
View Code Duplication |
public function deleteReadNoti() |
|
|
|
|
73
|
|
|
{ |
74
|
|
|
$markasread = UserNotification::where('is_read', '=', 1)->get(); |
75
|
|
|
foreach ($markasread as $mark) { |
76
|
|
|
$mark->delete(); |
77
|
|
|
\App\Model\helpdesk\Notification\Notification::whereId($mark->notification_id)->delete(); |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
return redirect()->back()->with('success', 'You have deleted all the read notifications'); |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
public function deleteNotificationLog() |
84
|
|
|
{ |
85
|
|
|
$days = Input::get('no_of_days'); |
86
|
|
|
$date = new DateTime(); |
87
|
|
|
$date->modify($days.' day'); |
88
|
|
|
$formatted_date = $date->format('Y-m-d H:i:s'); |
89
|
|
|
$markasread = DB::table('user_notification')->where('created_at', '<=', $formatted_date)->get(); |
90
|
|
|
foreach ($markasread as $mark) { |
91
|
|
|
$mark->delete(); |
92
|
|
|
\App\Model\helpdesk\Notification\Notification::whereId($mark->notification_id)->delete(); |
93
|
|
|
} |
94
|
|
|
|
95
|
|
|
return redirect()->back()->with('success', 'You have deleted all the notification records since '.$days.' days.'); |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
/** |
99
|
|
|
* @param int $id |
|
|
|
|
100
|
|
|
* @param $compant instance of company table |
101
|
|
|
* |
102
|
|
|
* get the form for company setting page |
103
|
|
|
* |
104
|
|
|
* @return Response |
105
|
|
|
*/ |
106
|
|
View Code Duplication |
public function getStatuses() |
|
|
|
|
107
|
|
|
{ |
108
|
|
|
try { |
109
|
|
|
/* fetch the values of company from company table */ |
110
|
|
|
$statuss = \DB::table('ticket_status')->get(); |
111
|
|
|
/* Direct to Company Settings Page */ |
112
|
|
|
return view('themes.default1.admin.helpdesk.settings.status', compact('statuss')); |
113
|
|
|
} catch (Exception $e) { |
114
|
|
|
return redirect()->back()->with('fails', $e->errorInfo[2]); |
|
|
|
|
115
|
|
|
} |
116
|
|
|
} |
117
|
|
|
|
118
|
|
|
/** |
119
|
|
|
* @param int $id |
120
|
|
|
* @param $compant instance of company table |
121
|
|
|
* |
122
|
|
|
* get the form for company setting page |
123
|
|
|
* |
124
|
|
|
* @return Response |
125
|
|
|
*/ |
126
|
|
|
public function editStatuses($id) |
127
|
|
|
{ |
128
|
|
|
try { |
129
|
|
|
/* fetch the values of company from company table */ |
130
|
|
|
$statuss = \App\Model\helpdesk\Ticket\Ticket_Status::whereId($id)->first(); |
131
|
|
|
$statuss->name = Input::get('name'); |
132
|
|
|
$statuss->icon_class = Input::get('icon_class'); |
133
|
|
|
$statuss->email_user = Input::get('email_user'); |
134
|
|
|
$statuss->sort = Input::get('sort'); |
135
|
|
|
$delete = Input::get('delete'); |
136
|
|
|
if ($delete == 'yes') { |
137
|
|
|
$statuss->state = 'delete'; |
138
|
|
|
} else { |
139
|
|
|
$statuss->state = Input::get('state'); |
140
|
|
|
} |
141
|
|
|
$statuss->sort = Input::get('sort'); |
142
|
|
|
$statuss->save(); |
143
|
|
|
/* Direct to Company Settings Page */ |
144
|
|
|
return redirect()->back()->with('success', 'Status has been updated!'); |
145
|
|
|
} catch (Exception $e) { |
146
|
|
|
return redirect()->back()->with('fails', $e->errorInfo[2]); |
|
|
|
|
147
|
|
|
} |
148
|
|
|
} |
149
|
|
|
|
150
|
|
|
public function createStatuses(\App\Model\helpdesk\Ticket\Ticket_Status $statuss) |
151
|
|
|
{ |
152
|
|
|
// try { |
153
|
|
|
/* fetch the values of company from company table */ |
154
|
|
|
$statuss->name = Input::get('name'); |
|
|
|
|
155
|
|
|
$statuss->icon_class = Input::get('icon_class'); |
|
|
|
|
156
|
|
|
$statuss->email_user = Input::get('email_user'); |
|
|
|
|
157
|
|
|
$statuss->sort = Input::get('sort'); |
|
|
|
|
158
|
|
|
$delete = Input::get('delete'); |
159
|
|
|
if ($delete == 'yes') { |
160
|
|
|
$statuss->state = 'delete'; |
|
|
|
|
161
|
|
|
} else { |
162
|
|
|
$statuss->state = Input::get('state'); |
|
|
|
|
163
|
|
|
} |
164
|
|
|
$statuss->sort = Input::get('sort'); |
|
|
|
|
165
|
|
|
$statuss->save(); |
166
|
|
|
/* Direct to Company Settings Page */ |
167
|
|
|
return redirect()->back()->with('success', 'Status has been created!'); |
168
|
|
|
// } catch (Exception $ex) { |
|
|
|
|
169
|
|
|
// return redirect()->back()->with('fails', $ex->errorInfo[2]); |
170
|
|
|
// } |
171
|
|
|
} |
172
|
|
|
|
173
|
|
|
public function deleteStatuses($id) |
174
|
|
|
{ |
175
|
|
|
try { |
176
|
|
View Code Duplication |
if ($id > 5) { |
|
|
|
|
177
|
|
|
/* fetch the values of company from company table */ |
178
|
|
|
\App\Model\helpdesk\Ticket\Ticket_Status::whereId($id)->delete(); |
179
|
|
|
/* Direct to Company Settings Page */ |
180
|
|
|
return redirect()->back()->with('success', 'Status has been deleted'); |
181
|
|
|
} else { |
182
|
|
|
return redirect()->back()->with('failed', 'You cannot delete this status'); |
183
|
|
|
} |
184
|
|
|
} catch (Exception $e) { |
185
|
|
|
return redirect()->back()->with('fails', $e->errorInfo[2]); |
|
|
|
|
186
|
|
|
} |
187
|
|
|
} |
188
|
|
|
|
189
|
|
|
/** |
190
|
|
|
* @param int $id |
|
|
|
|
191
|
|
|
* @param $compant instance of company table |
192
|
|
|
* |
193
|
|
|
* get the form for company setting page |
194
|
|
|
* |
195
|
|
|
* @return Response |
196
|
|
|
*/ |
197
|
|
|
public function getcompany(Company $company) |
198
|
|
|
{ |
199
|
|
|
try { |
200
|
|
|
/* fetch the values of company from company table */ |
201
|
|
|
$companys = $company->whereId('1')->first(); |
|
|
|
|
202
|
|
|
/* Direct to Company Settings Page */ |
203
|
|
|
return view('themes.default1.admin.helpdesk.settings.company', compact('companys')); |
204
|
|
|
} catch (Exception $e) { |
205
|
|
|
return redirect()->back()->with('fails', $e->getMessage()); |
206
|
|
|
} |
207
|
|
|
} |
208
|
|
|
|
209
|
|
|
/** |
210
|
|
|
* Update the specified resource in storage. |
211
|
|
|
* |
212
|
|
|
* @param type int $id |
213
|
|
|
* @param type Company $company |
214
|
|
|
* @param type CompanyRequest $request |
215
|
|
|
* |
216
|
|
|
* @return Response |
217
|
|
|
*/ |
218
|
|
View Code Duplication |
public function postcompany($id, Company $company, CompanyRequest $request) |
|
|
|
|
219
|
|
|
{ |
220
|
|
|
/* fetch the values of company request */ |
221
|
|
|
$companys = $company->whereId('1')->first(); |
|
|
|
|
222
|
|
|
if (Input::file('logo')) { |
223
|
|
|
$name = Input::file('logo')->getClientOriginalName(); |
224
|
|
|
$destinationPath = 'uploads/company/'; |
225
|
|
|
$fileName = rand(0000, 9999).'.'.$name; |
226
|
|
|
Input::file('logo')->move($destinationPath, $fileName); |
227
|
|
|
$companys->logo = $fileName; |
228
|
|
|
} |
229
|
|
|
if ($request->input('use_logo') == null) { |
230
|
|
|
$companys->use_logo = '0'; |
231
|
|
|
} |
232
|
|
|
/* Check whether function success or not */ |
233
|
|
|
try { |
234
|
|
|
$companys->fill($request->except('logo'))->save(); |
235
|
|
|
/* redirect to Index page with Success Message */ |
236
|
|
|
return redirect('getcompany')->with('success', 'Company Updated Successfully'); |
237
|
|
|
} catch (Exception $e) { |
238
|
|
|
/* redirect to Index page with Fails Message */ |
239
|
|
|
return redirect('getcompany')->with('fails', 'Company can not Updated'.'<li>'.$e->getMessage().'</li>'); |
240
|
|
|
} |
241
|
|
|
} |
242
|
|
|
|
243
|
|
|
/** |
244
|
|
|
* function to delete system logo. |
245
|
|
|
* |
246
|
|
|
* @return type string |
247
|
|
|
*/ |
248
|
|
View Code Duplication |
public function deleteLogo() |
|
|
|
|
249
|
|
|
{ |
250
|
|
|
$path = $_GET['data1']; //get file path of logo image |
251
|
|
|
if (!unlink($path)) { |
252
|
|
|
return 'false'; |
253
|
|
|
} else { |
254
|
|
|
$companys = Company::where('id', '=', 1)->first(); |
255
|
|
|
$companys->logo = null; |
256
|
|
|
$companys->use_logo = '0'; |
257
|
|
|
$companys->save(); |
258
|
|
|
|
259
|
|
|
return 'true'; |
260
|
|
|
} |
261
|
|
|
// return $res; |
262
|
|
|
} |
263
|
|
|
|
264
|
|
|
/** |
265
|
|
|
* get the form for System setting page. |
266
|
|
|
* |
267
|
|
|
* @param type System $system |
268
|
|
|
* @param type Department $department |
269
|
|
|
* @param type Timezones $timezone |
270
|
|
|
* @param type Date_format $date |
271
|
|
|
* @param type Date_time_format $date_time |
272
|
|
|
* @param type Time_format $time |
273
|
|
|
* |
274
|
|
|
* @return type Response |
275
|
|
|
*/ |
276
|
|
|
public function getsystem(System $system, Department $department, Timezones $timezone, Date_format $date, Date_time_format $date_time, Time_format $time) |
277
|
|
|
{ |
278
|
|
|
try { |
279
|
|
|
/* fetch the values of system from system table */ |
280
|
|
|
$systems = $system->whereId('1')->first(); |
|
|
|
|
281
|
|
|
/* Fetch the values from Department table */ |
282
|
|
|
$departments = $department->get(); |
|
|
|
|
283
|
|
|
/* Fetch the values from Timezones table */ |
284
|
|
|
$timezones = $timezone->get(); |
|
|
|
|
285
|
|
|
/* Direct to System Settings Page */ |
286
|
|
|
return view('themes.default1.admin.helpdesk.settings.system', compact('systems', 'departments', 'timezones', 'time', 'date', 'date_time')); |
287
|
|
|
} catch (Exception $e) { |
288
|
|
|
return redirect()->back()->with('fails', $e->getMessage()); |
289
|
|
|
} |
290
|
|
|
} |
291
|
|
|
|
292
|
|
|
/** |
293
|
|
|
* Update the specified resource in storage. |
294
|
|
|
* |
295
|
|
|
* @param type int $id |
296
|
|
|
* @param type System $system |
297
|
|
|
* @param type SystemRequest $request |
298
|
|
|
* |
299
|
|
|
* @return type Response |
300
|
|
|
*/ |
301
|
|
|
public function postsystem($id, System $system, SystemRequest $request) |
|
|
|
|
302
|
|
|
{ |
303
|
|
|
try { |
304
|
|
|
// dd($request); |
|
|
|
|
305
|
|
|
/* fetch the values of system request */ |
306
|
|
|
$systems = $system->whereId('1')->first(); |
|
|
|
|
307
|
|
|
/* fill the values to coompany table */ |
308
|
|
|
/* Check whether function success or not */ |
309
|
|
|
$systems->fill($request->input())->save(); |
310
|
|
|
/* redirect to Index page with Success Message */ |
311
|
|
|
return redirect('getsystem')->with('success', 'System Updated Successfully'); |
312
|
|
|
} catch (Exception $e) { |
313
|
|
|
/* redirect to Index page with Fails Message */ |
314
|
|
|
return redirect('getsystem')->with('fails', 'System can not Updated'.'<li>'.$e->getMessage().'</li>'); |
315
|
|
|
} |
316
|
|
|
} |
317
|
|
|
|
318
|
|
|
/** |
319
|
|
|
* get the form for Ticket setting page. |
320
|
|
|
* |
321
|
|
|
* @param type Ticket $ticket |
322
|
|
|
* @param type Sla_plan $sla |
323
|
|
|
* @param type Help_topic $topic |
324
|
|
|
* @param type Priority $priority |
325
|
|
|
* |
326
|
|
|
* @return type Response |
327
|
|
|
*/ |
328
|
|
|
public function getticket(Ticket $ticket, Sla_plan $sla, Help_topic $topic, Ticket_Priority $priority) |
329
|
|
|
{ |
330
|
|
|
try { |
331
|
|
|
/* fetch the values of ticket from ticket table */ |
332
|
|
|
$tickets = $ticket->whereId('1')->first(); |
|
|
|
|
333
|
|
|
/* Fetch the values from SLA Plan table */ |
334
|
|
|
$slas = $sla->get(); |
|
|
|
|
335
|
|
|
/* Fetch the values from Help_topic table */ |
336
|
|
|
$topics = $topic->get(); |
|
|
|
|
337
|
|
|
/* Direct to Ticket Settings Page */ |
338
|
|
|
return view('themes.default1.admin.helpdesk.settings.ticket', compact('tickets', 'slas', 'topics', 'priority')); |
339
|
|
|
} catch (Exception $e) { |
340
|
|
|
return redirect()->back()->with('fails', $e->getMessage()); |
341
|
|
|
} |
342
|
|
|
} |
343
|
|
|
|
344
|
|
|
/** |
345
|
|
|
* Update the specified resource in storage. |
346
|
|
|
* |
347
|
|
|
* @param type int $id |
348
|
|
|
* @param type Ticket $ticket |
349
|
|
|
* @param type Request $request |
350
|
|
|
* |
351
|
|
|
* @return type Response |
352
|
|
|
*/ |
353
|
|
View Code Duplication |
public function postticket($id, Ticket $ticket, Request $request) |
|
|
|
|
354
|
|
|
{ |
355
|
|
|
try { |
356
|
|
|
/* fetch the values of ticket request */ |
357
|
|
|
$tickets = $ticket->whereId('1')->first(); |
|
|
|
|
358
|
|
|
/* fill the values to coompany table */ |
359
|
|
|
$tickets->fill($request->except('captcha', 'claim_response', 'assigned_ticket', 'answered_ticket', 'agent_mask', 'html', 'client_update'))->save(); |
360
|
|
|
/* insert checkbox to Database */ |
361
|
|
|
$tickets->captcha = $request->input('captcha'); |
362
|
|
|
$tickets->claim_response = $request->input('claim_response'); |
363
|
|
|
$tickets->assigned_ticket = $request->input('assigned_ticket'); |
364
|
|
|
$tickets->answered_ticket = $request->input('answered_ticket'); |
365
|
|
|
$tickets->agent_mask = $request->input('agent_mask'); |
366
|
|
|
$tickets->html = $request->input('html'); |
367
|
|
|
$tickets->client_update = $request->input('client_update'); |
368
|
|
|
$tickets->collision_avoid = $request->input('collision_avoid'); |
369
|
|
|
/* Check whether function success or not */ |
370
|
|
|
$tickets->save(); |
371
|
|
|
/* redirect to Index page with Success Message */ |
372
|
|
|
return redirect('getticket')->with('success', 'Ticket Updated Successfully'); |
373
|
|
|
} catch (Exception $e) { |
374
|
|
|
/* redirect to Index page with Fails Message */ |
375
|
|
|
return redirect('getticket')->with('fails', 'Ticket can not Updated'.'<li>'.$e->getMessage().'</li>'); |
376
|
|
|
} |
377
|
|
|
} |
378
|
|
|
|
379
|
|
|
/** |
380
|
|
|
* get the form for Email setting page. |
381
|
|
|
* |
382
|
|
|
* @param type Email $email |
383
|
|
|
* @param type Template $template |
384
|
|
|
* @param type Emails $email1 |
385
|
|
|
* |
386
|
|
|
* @return type Response |
387
|
|
|
*/ |
388
|
|
|
public function getemail(Email $email, Template $template, Emails $email1) |
389
|
|
|
{ |
390
|
|
|
try { |
391
|
|
|
/* fetch the values of email from Email table */ |
392
|
|
|
$emails = $email->whereId('1')->first(); |
|
|
|
|
393
|
|
|
/* Fetch the values from Template table */ |
394
|
|
|
$templates = $template->get(); |
|
|
|
|
395
|
|
|
/* Fetch the values from Emails table */ |
396
|
|
|
$emails1 = $email1->get(); |
|
|
|
|
397
|
|
|
/* Direct to Email Settings Page */ |
398
|
|
|
return view('themes.default1.admin.helpdesk.settings.email', compact('emails', 'templates', 'emails1')); |
399
|
|
|
} catch (Exception $e) { |
400
|
|
|
return redirect()->back()->with('fails', $e->getMessage()); |
401
|
|
|
} |
402
|
|
|
} |
403
|
|
|
|
404
|
|
|
/** |
405
|
|
|
* Update the specified resource in storage. |
406
|
|
|
* |
407
|
|
|
* @param type int $id |
408
|
|
|
* @param type Email $email |
409
|
|
|
* @param type EmailRequest $request |
410
|
|
|
* |
411
|
|
|
* @return type Response |
412
|
|
|
*/ |
413
|
|
View Code Duplication |
public function postemail($id, Email $email, EmailRequest $request) |
|
|
|
|
414
|
|
|
{ |
415
|
|
|
try { |
416
|
|
|
/* fetch the values of email request */ |
417
|
|
|
$emails = $email->whereId('1')->first(); |
|
|
|
|
418
|
|
|
/* fill the values to email table */ |
419
|
|
|
$emails->fill($request->except('email_fetching', 'all_emails', 'email_collaborator', 'strip', 'attachment'))->save(); |
420
|
|
|
/* insert checkboxes to database */ |
421
|
|
|
// $emails->email_fetching = $request->input('email_fetching'); |
|
|
|
|
422
|
|
|
// $emails->notification_cron = $request->input('notification_cron'); |
|
|
|
|
423
|
|
|
$emails->all_emails = $request->input('all_emails'); |
424
|
|
|
$emails->email_collaborator = $request->input('email_collaborator'); |
425
|
|
|
$emails->strip = $request->input('strip'); |
426
|
|
|
$emails->attachment = $request->input('attachment'); |
427
|
|
|
/* Check whether function success or not */ |
428
|
|
|
$emails->save(); |
429
|
|
|
/* redirect to Index page with Success Message */ |
430
|
|
|
return redirect('getemail')->with('success', 'Email Updated Successfully'); |
431
|
|
|
} catch (Exception $e) { |
432
|
|
|
/* redirect to Index page with Fails Message */ |
433
|
|
|
return redirect('getemail')->with('fails', 'Email can not Updated'.'<li>'.$e->getMessage().'</li>'); |
434
|
|
|
} |
435
|
|
|
} |
436
|
|
|
|
437
|
|
|
/** |
438
|
|
|
* get the form for cron job setting page. |
439
|
|
|
* |
440
|
|
|
* @param type Email $email |
441
|
|
|
* @param type Template $template |
442
|
|
|
* @param type Emails $email1 |
443
|
|
|
* |
444
|
|
|
* @return type Response |
445
|
|
|
*/ |
446
|
|
View Code Duplication |
public function getSchedular(Email $email, Template $template, Emails $email1) |
|
|
|
|
447
|
|
|
{ |
448
|
|
|
// try { |
449
|
|
|
/* fetch the values of email from Email table */ |
450
|
|
|
$emails = $email->whereId('1')->first(); |
|
|
|
|
451
|
|
|
/* Fetch the values from Template table */ |
452
|
|
|
$templates = $template->get(); |
|
|
|
|
453
|
|
|
/* Fetch the values from Emails table */ |
454
|
|
|
$emails1 = $email1->get(); |
|
|
|
|
455
|
|
|
|
456
|
|
|
return view('themes.default1.admin.helpdesk.settings.crone', compact('emails', 'templates', 'emails1')); |
457
|
|
|
// } catch { |
|
|
|
|
458
|
|
|
|
459
|
|
|
// } |
460
|
|
|
} |
461
|
|
|
|
462
|
|
|
/** |
463
|
|
|
* Update the specified resource in storage for cron job. |
464
|
|
|
* |
465
|
|
|
* @param type Email $email |
466
|
|
|
* @param type EmailRequest $request |
467
|
|
|
* |
468
|
|
|
* @return type Response |
469
|
|
|
*/ |
470
|
|
|
public function postSchedular(Email $email, Template $template, Emails $email1, Request $request) |
|
|
|
|
471
|
|
|
{ |
472
|
|
|
// dd($request); |
|
|
|
|
473
|
|
|
try { |
474
|
|
|
/* fetch the values of email request */ |
475
|
|
|
$emails = $email->whereId('1')->first(); |
|
|
|
|
476
|
|
|
if ($request->email_fetching) { |
477
|
|
|
$emails->email_fetching = $request->email_fetching; |
478
|
|
|
} else { |
479
|
|
|
$emails->email_fetching = 0; |
480
|
|
|
} |
481
|
|
|
if ($request->notification_cron) { |
482
|
|
|
$emails->notification_cron = $request->notification_cron; |
483
|
|
|
} else { |
484
|
|
|
$emails->notification_cron = 0; |
485
|
|
|
} |
486
|
|
|
$emails->save(); |
487
|
|
|
/* redirect to Index page with Success Message */ |
488
|
|
|
return redirect('job-scheduler')->with('success', Lang::get('lang.job-scheduler-success')); |
489
|
|
|
} catch (Exception $e) { |
490
|
|
|
/* redirect to Index page with Fails Message */ |
491
|
|
|
return redirect('job-scheduler')->with('fails', Lang::get('lang.job-scheduler-error').'<li>'.$e->getMessage().'</li>'); |
492
|
|
|
} |
493
|
|
|
} |
494
|
|
|
|
495
|
|
|
/** |
496
|
|
|
* get the form for Access setting page. |
497
|
|
|
* |
498
|
|
|
* @param type Access $access |
499
|
|
|
* |
500
|
|
|
* @return type Response |
501
|
|
|
*/ |
502
|
|
|
// public function getaccess(Access $access) { |
|
|
|
|
503
|
|
|
// try { |
504
|
|
|
// /* fetch the values of access from access table */ |
505
|
|
|
// $accesses = $access->whereId('1')->first(); |
|
|
|
|
506
|
|
|
// // Direct to Access Settings Page |
507
|
|
|
// return view('themes.default1.admin.helpdesk.settings.access', compact('accesses')); |
|
|
|
|
508
|
|
|
// } catch (Exception $e) { |
|
|
|
|
509
|
|
|
// return view('404'); |
|
|
|
|
510
|
|
|
// } |
511
|
|
|
// } |
512
|
|
|
|
513
|
|
|
/** |
514
|
|
|
* Update the specified resource in storage. |
515
|
|
|
* |
516
|
|
|
* @param type Access $access |
517
|
|
|
* @param type Request $request |
518
|
|
|
* |
519
|
|
|
* @return type Response |
520
|
|
|
*/ |
521
|
|
|
// public function postaccess(Access $access, Request $request) { |
|
|
|
|
522
|
|
|
// try { |
523
|
|
|
// /* fetch the values of access request */ |
524
|
|
|
// $accesses = $access->whereId('1')->first(); |
|
|
|
|
525
|
|
|
// /* fill the values to access table */ |
526
|
|
|
// $accesses->fill($request->except('password_reset', 'bind_agent_ip', 'reg_require', 'quick_access'))->save(); |
|
|
|
|
527
|
|
|
// /* insert checkbox value to DB */ |
528
|
|
|
// $accesses->password_reset = $request->input('password_reset'); |
|
|
|
|
529
|
|
|
// $accesses->bind_agent_ip = $request->input('bind_agent_ip'); |
|
|
|
|
530
|
|
|
// $accesses->reg_require = $request->input('reg_require'); |
|
|
|
|
531
|
|
|
// $accesses->quick_access = $request->input('quick_access'); |
|
|
|
|
532
|
|
|
// /* Check whether function success or not */ |
533
|
|
|
// if ($accesses->save() == true) { |
|
|
|
|
534
|
|
|
// /* redirect to Index page with Success Message */ |
535
|
|
|
// return redirect('getaccess')->with('success', 'Access Updated Successfully'); |
|
|
|
|
536
|
|
|
// } else { |
|
|
|
|
537
|
|
|
// /* redirect to Index page with Fails Message */ |
538
|
|
|
// return redirect('getaccess')->with('fails', 'Access can not Updated'); |
|
|
|
|
539
|
|
|
// } |
540
|
|
|
// } catch (Exception $e) { |
|
|
|
|
541
|
|
|
// /* redirect to Index page with Fails Message */ |
542
|
|
|
// return redirect('getaccess')->with('fails', 'Access can not Updated'); |
|
|
|
|
543
|
|
|
// } |
544
|
|
|
// } |
545
|
|
|
|
546
|
|
|
/** |
547
|
|
|
* get the form for Responder setting page. |
548
|
|
|
* |
549
|
|
|
* @param type Responder $responder |
550
|
|
|
* |
551
|
|
|
* @return type Response |
552
|
|
|
*/ |
553
|
|
|
public function getresponder(Responder $responder) |
554
|
|
|
{ |
555
|
|
|
try { |
556
|
|
|
/* fetch the values of responder from responder table */ |
557
|
|
|
$responders = $responder->whereId('1')->first(); |
|
|
|
|
558
|
|
|
/* Direct to Responder Settings Page */ |
559
|
|
|
return view('themes.default1.admin.helpdesk.settings.responder', compact('responders')); |
560
|
|
|
} catch (Exception $e) { |
561
|
|
|
return redirect()->back()->with('fails', $e->getMessage()); |
562
|
|
|
} |
563
|
|
|
} |
564
|
|
|
|
565
|
|
|
/** |
566
|
|
|
* Update the specified resource in storage. |
567
|
|
|
* |
568
|
|
|
* @param type Responder $responder |
569
|
|
|
* @param type Request $request |
570
|
|
|
* |
571
|
|
|
* @return type |
572
|
|
|
*/ |
573
|
|
View Code Duplication |
public function postresponder(Responder $responder, Request $request) |
|
|
|
|
574
|
|
|
{ |
575
|
|
|
try { |
576
|
|
|
/* fetch the values of responder request */ |
577
|
|
|
$responders = $responder->whereId('1')->first(); |
|
|
|
|
578
|
|
|
/* insert Checkbox value to DB */ |
579
|
|
|
$responders->new_ticket = $request->input('new_ticket'); |
580
|
|
|
$responders->agent_new_ticket = $request->input('agent_new_ticket'); |
581
|
|
|
$responders->submitter = $request->input('submitter'); |
582
|
|
|
$responders->participants = $request->input('participants'); |
583
|
|
|
$responders->overlimit = $request->input('overlimit'); |
584
|
|
|
/* fill the values to coompany table */ |
585
|
|
|
/* Check whether function success or not */ |
586
|
|
|
$responders->save(); |
587
|
|
|
/* redirect to Index page with Success Message */ |
588
|
|
|
return redirect('getresponder')->with('success', 'Responder Updated Successfully'); |
589
|
|
|
} catch (Exception $e) { |
590
|
|
|
/* redirect to Index page with Fails Message */ |
591
|
|
|
return redirect('getresponder')->with('fails', 'Responder can not Updated'.'<li>'.$e->getMessage().'</li>'); |
592
|
|
|
} |
593
|
|
|
} |
594
|
|
|
|
595
|
|
|
/** |
596
|
|
|
* get the form for Alert setting page. |
597
|
|
|
* |
598
|
|
|
* @param type Alert $alert |
599
|
|
|
* |
600
|
|
|
* @return type Response |
601
|
|
|
*/ |
602
|
|
|
public function getalert(Alert $alert) |
603
|
|
|
{ |
604
|
|
|
try { |
605
|
|
|
/* fetch the values of alert from alert table */ |
606
|
|
|
$alerts = $alert->whereId('1')->first(); |
|
|
|
|
607
|
|
|
/* Direct to Alert Settings Page */ |
608
|
|
|
return view('themes.default1.admin.helpdesk.settings.alert', compact('alerts')); |
609
|
|
|
} catch (Exception $e) { |
610
|
|
|
return redirect()->back()->with('fails', $e->getMessage()); |
611
|
|
|
} |
612
|
|
|
} |
613
|
|
|
|
614
|
|
|
/** |
615
|
|
|
* Update the specified resource in storage. |
616
|
|
|
* |
617
|
|
|
* @param type $id |
618
|
|
|
* @param type Alert $alert |
619
|
|
|
* @param type Request $request |
620
|
|
|
* |
621
|
|
|
* @return type Response |
622
|
|
|
*/ |
623
|
|
View Code Duplication |
public function postalert($id, Alert $alert, Request $request) |
|
|
|
|
624
|
|
|
{ |
625
|
|
|
try { |
626
|
|
|
/* fetch the values of alert request */ |
627
|
|
|
$alerts = $alert->whereId('1')->first(); |
|
|
|
|
628
|
|
|
/* Insert Checkbox to DB */ |
629
|
|
|
$alerts->assignment_status = $request->input('assignment_status'); |
630
|
|
|
$alerts->ticket_status = $request->input('ticket_status'); |
631
|
|
|
$alerts->overdue_department_member = $request->input('overdue_department_member'); |
632
|
|
|
$alerts->sql_error = $request->input('sql_error'); |
633
|
|
|
$alerts->excessive_failure = $request->input('excessive_failure'); |
634
|
|
|
$alerts->overdue_status = $request->input('overdue_status'); |
635
|
|
|
$alerts->overdue_assigned_agent = $request->input('overdue_assigned_agent'); |
636
|
|
|
$alerts->overdue_department_manager = $request->input('overdue_department_manager'); |
637
|
|
|
$alerts->internal_status = $request->input('internal_status'); |
638
|
|
|
$alerts->internal_last_responder = $request->input('internal_last_responder'); |
639
|
|
|
$alerts->internal_assigned_agent = $request->input('internal_assigned_agent'); |
640
|
|
|
$alerts->internal_department_manager = $request->input('internal_department_manager'); |
641
|
|
|
$alerts->assignment_assigned_agent = $request->input('assignment_assigned_agent'); |
642
|
|
|
$alerts->assignment_team_leader = $request->input('assignment_team_leader'); |
643
|
|
|
$alerts->assignment_team_member = $request->input('assignment_team_member'); |
644
|
|
|
$alerts->system_error = $request->input('system_error'); |
645
|
|
|
$alerts->transfer_department_member = $request->input('transfer_department_member'); |
646
|
|
|
$alerts->transfer_department_manager = $request->input('transfer_department_manager'); |
647
|
|
|
$alerts->transfer_assigned_agent = $request->input('transfer_assigned_agent'); |
648
|
|
|
$alerts->transfer_status = $request->input('transfer_status'); |
649
|
|
|
$alerts->message_organization_accmanager = $request->input('message_organization_accmanager'); |
650
|
|
|
$alerts->message_department_manager = $request->input('message_department_manager'); |
651
|
|
|
$alerts->message_assigned_agent = $request->input('message_assigned_agent'); |
652
|
|
|
$alerts->message_last_responder = $request->input('message_last_responder'); |
653
|
|
|
$alerts->message_status = $request->input('message_status'); |
654
|
|
|
$alerts->ticket_organization_accmanager = $request->input('ticket_organization_accmanager'); |
655
|
|
|
$alerts->ticket_department_manager = $request->input('ticket_department_manager'); |
656
|
|
|
$alerts->ticket_department_member = $request->input('ticket_department_member'); |
657
|
|
|
$alerts->ticket_admin_email = $request->input('ticket_admin_email'); |
658
|
|
|
|
659
|
|
|
if ($request->input('system_error') == null) { |
660
|
|
|
$str = '%0%'; |
661
|
|
|
$path = app_path('../config/app.php'); |
662
|
|
|
$content = \File::get($path); |
663
|
|
|
$content = str_replace('%1%', $str, $content); |
664
|
|
|
\File::put($path, $content); |
665
|
|
|
} else { |
666
|
|
|
$str = '%1%'; |
667
|
|
|
$path = app_path('../config/app.php'); |
668
|
|
|
$content = \File::get($path); |
669
|
|
|
$content = str_replace('%0%', $str, $content); |
670
|
|
|
\File::put($path, $content); |
671
|
|
|
} |
672
|
|
|
/* fill the values to coompany table */ |
673
|
|
|
/* Check whether function success or not */ |
674
|
|
|
$alerts->save(); |
675
|
|
|
/* redirect to Index page with Success Message */ |
676
|
|
|
return redirect('getalert')->with('success', 'Alert Updated Successfully'); |
677
|
|
|
} catch (Exception $e) { |
678
|
|
|
/* redirect to Index page with Fails Message */ |
679
|
|
|
return redirect('getalert')->with('fails', 'Alert can not Updated'.'<li>'.$e->getMessage().'</li>'); |
680
|
|
|
} |
681
|
|
|
} |
682
|
|
|
|
683
|
|
|
/** |
684
|
|
|
* To display the list of ratings in the system. |
685
|
|
|
* |
686
|
|
|
* @return type View |
687
|
|
|
*/ |
688
|
|
|
public function RatingSettings() |
689
|
|
|
{ |
690
|
|
|
$ratings = DB::table('settings_ratings')->get(); |
691
|
|
|
|
692
|
|
|
return view('themes.default1.admin.helpdesk.settings.ratings', compact('ratings')); |
693
|
|
|
} |
694
|
|
|
|
695
|
|
|
/** |
696
|
|
|
* To store rating data. |
697
|
|
|
* |
698
|
|
|
* @return type Redirect |
699
|
|
|
*/ |
700
|
|
View Code Duplication |
public function PostRatingSettings($slug) |
|
|
|
|
701
|
|
|
{ |
702
|
|
|
$name = Input::get('rating_name'); |
703
|
|
|
$publish = Input::get('publish'); |
704
|
|
|
$modify = Input::get('modify'); |
705
|
|
|
DB::table('settings_ratings')->whereSlug($slug)->update(['rating_name' => $name, 'publish' => $publish, 'modify' => $modify]); |
706
|
|
|
|
707
|
|
|
return redirect()->back()->with('success', 'Successfully updated'); |
708
|
|
|
} |
709
|
|
|
|
710
|
|
View Code Duplication |
public function createRating() |
|
|
|
|
711
|
|
|
{ |
712
|
|
|
$name = Input::get('rating_name'); |
713
|
|
|
$publish = Input::get('publish'); |
714
|
|
|
$modify = Input::get('modify'); |
715
|
|
|
DB::table('settings_ratings')->insert(['rating_name' => $name, 'publish' => $publish, 'modify' => $modify]); |
716
|
|
|
|
717
|
|
|
return redirect()->back()->with('success', 'Successfully created this rating'); |
718
|
|
|
} |
719
|
|
|
|
720
|
|
|
/** |
721
|
|
|
* To delete a type of rating. |
722
|
|
|
* |
723
|
|
|
* @return type Redirect |
724
|
|
|
*/ |
725
|
|
|
public function RatingDelete($slug) |
726
|
|
|
{ |
727
|
|
|
DB::table('settings_ratings')->whereSlug($slug)->delete(); |
728
|
|
|
|
729
|
|
|
return redirect()->back()->with('success', 'Successfully Deleted'); |
730
|
|
|
} |
731
|
|
|
|
732
|
|
|
/** |
733
|
|
|
* Generate Api key. |
734
|
|
|
* |
735
|
|
|
* @return type json |
736
|
|
|
*/ |
737
|
|
|
public function generateApiKey() |
738
|
|
|
{ |
739
|
|
|
$key = str_random(32); |
740
|
|
|
|
741
|
|
|
return $key; |
742
|
|
|
} |
743
|
|
|
} |
744
|
|
|
|
Adding a
@return
annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.