hide event

This commit is contained in:
Mathieu Lagacé
2020-10-06 18:54:56 -04:00
parent 63301aec97
commit f7845d8f1b
22 changed files with 614 additions and 187 deletions

View File

@@ -100,6 +100,15 @@ class EventController extends Controller
$event->use_schedule = 0;
}
if(\request("hidden"))
{
$event->hidden = 1;
}
else
{
$event->hidden = 0;
}
$event->calendar_color = \request('calendar_color');
$event->calendar_icon = \request('calendar_icon');
@@ -225,7 +234,15 @@ class EventController extends Controller
*/
public function edit($id)
{
return view('admin.schedule.event.edit',['event' => \App\Event::find($id)]);
$event = \App\Event::find($id);
if ($event->hidden == 1)
{
if (\Auth::user()->p('instruction_see_hidden_event') != 1)
{
return redirect('/admin/schedule')->with('error','Modification non authorisé');
}
}
return view('admin.schedule.event.edit',['event' => $event]);
}
/**
@@ -238,6 +255,13 @@ class EventController extends Controller
public function update($id)
{
$event = Event::findOrFail($id);
if ($event->hidden == 1)
{
if (\Auth::user()->p('instruction_see_hidden_event') != 1)
{
return redirect('/admin/schedule')->with('error','Modification non authorisé');
}
}
// if (\App\GoogleDriveFile::checkConfig())
// {
@@ -297,6 +321,15 @@ class EventController extends Controller
$event->use_schedule = 0;
}
if(\request("hidden"))
{
$event->hidden = 1;
}
else
{
$event->hidden = 0;
}
$event->calendar_color = \request('calendar_color');
$event->calendar_icon = \request('calendar_icon');