mirror of
https://gitlab.com/TheGamecraft/c-cms.git
synced 2026-04-21 02:39:10 -04:00
Add Calendar in Admin
This commit is contained in:
@@ -5,6 +5,7 @@ namespace App\Http\Controllers;
|
||||
use Illuminate\Http\Request;
|
||||
use \App\Schedule;
|
||||
use function GuzzleHttp\json_encode;
|
||||
use PDF;
|
||||
|
||||
class ScheduleController extends Controller
|
||||
{
|
||||
@@ -76,7 +77,7 @@ class ScheduleController extends Controller
|
||||
if($event->date_begin >= $start && $event->date_begin <= $end) {
|
||||
array_push($events,$event);
|
||||
}
|
||||
if($event->date_end >= $start && $event->date_end <= $end) {
|
||||
else if($event->date_end >= $start && $event->date_end <= $end) {
|
||||
array_push($events,$event);
|
||||
}
|
||||
}
|
||||
@@ -91,6 +92,7 @@ class ScheduleController extends Controller
|
||||
'start' => $schedule->date.'T'.$schedule->data['event_begin_time'],
|
||||
'end' => $schedule->date.'T'.$schedule->data['event_end_time'],
|
||||
'color' => $color,
|
||||
'source' => 'schedule',
|
||||
'id' => $schedule->id
|
||||
];
|
||||
array_push($jsonevents,$event);
|
||||
@@ -105,6 +107,8 @@ class ScheduleController extends Controller
|
||||
'start' => $event->date_begin,
|
||||
'end' => $event->date_end,
|
||||
'color' => $color,
|
||||
'extraParams' => [
|
||||
'db_type' => 'event'],
|
||||
'id' => $event->id
|
||||
];
|
||||
array_push($jsonevents,$myevent);
|
||||
@@ -113,14 +117,30 @@ class ScheduleController extends Controller
|
||||
return json_encode($jsonevents);
|
||||
}
|
||||
|
||||
public function loadModal($id)
|
||||
public function loadModal($id,$db_type)
|
||||
{
|
||||
return view('public.modal.schedule',['event' => \App\Schedule::find($id)]);
|
||||
if($db_type == "event")
|
||||
{
|
||||
$event = \App\Event::find($id);
|
||||
}
|
||||
else
|
||||
{
|
||||
$event = \App\Schedule::find($id);
|
||||
}
|
||||
return view('public.modal.schedule',['event' => $event]);
|
||||
}
|
||||
|
||||
public function loadModalFull($id)
|
||||
public function loadModalFull($id,$db_type)
|
||||
{
|
||||
return view('admin.schedule.modal.show',['event' => \App\Schedule::find($id)]);
|
||||
if($db_type == "event")
|
||||
{
|
||||
$event = \App\Event::find($id);
|
||||
}
|
||||
else
|
||||
{
|
||||
$event = \App\Schedule::find($id);
|
||||
}
|
||||
return view('admin.schedule.modal.show',['event' => $event]);
|
||||
}
|
||||
|
||||
public function getColor($type)
|
||||
@@ -172,4 +192,11 @@ class ScheduleController extends Controller
|
||||
};
|
||||
return $color;
|
||||
}
|
||||
|
||||
public function printtopdf($id)
|
||||
{
|
||||
$event = \App\Event::find($id);
|
||||
$pdf = PDF::loadView('admin.schedule.modal.show',['event' => $event]);
|
||||
return $pdf->download($event->date_begin.'.pdf');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user