2017-09-12 13:43:59 +03:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
|
|
|
|
|
|
use App\Jobs\GenerateCalendarEvents;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Class ReportController.
|
|
|
|
|
*/
|
|
|
|
|
class CalendarController extends BaseController
|
|
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* @return \Illuminate\Contracts\View\View
|
|
|
|
|
*/
|
|
|
|
|
public function showCalendar()
|
|
|
|
|
{
|
|
|
|
|
$data = [
|
2018-02-14 15:51:23 +02:00
|
|
|
'title' => trans('texts.calendar'),
|
2017-09-13 11:56:26 +03:00
|
|
|
'account' => auth()->user()->account,
|
2017-09-12 13:43:59 +03:00
|
|
|
];
|
|
|
|
|
|
|
|
|
|
return view('calendar', $data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function loadEvents()
|
|
|
|
|
{
|
2017-09-13 11:56:26 +03:00
|
|
|
if (auth()->user()->account->hasFeature(FEATURE_REPORTS)) {
|
2019-09-12 19:30:10 -04:00
|
|
|
$events = dispatch_now(new GenerateCalendarEvents());
|
2017-09-13 11:56:26 +03:00
|
|
|
} else {
|
|
|
|
|
$events = [];
|
|
|
|
|
}
|
2017-09-12 13:43:59 +03:00
|
|
|
|
|
|
|
|
return response()->json($events);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|