mirror of
https://gitlab.com/TheGamecraft/c-cms.git
synced 2026-04-21 10:49:10 -04:00
Add Material Design for Public and Admin
This commit is contained in:
@@ -133,9 +133,13 @@ class CalendarController extends Controller
|
||||
case 'volunteer':
|
||||
echo '<div class="row" style="color:#DF0174;"><span class="fa-stack fa-lg col-md-2"><i class="fa fa-circle fa-stack-2x"></i><i class="fa fa-handshake-o fa-stack-1x fa-inverse"></i></span><div class="col-md-10 calendar_event_name">'.ucfirst($activity->data['event_name'])."</div></div>";
|
||||
break;
|
||||
|
||||
case 'other':
|
||||
echo '<div class="row" style="color:#DF0174;"><span class="fa-stack fa-lg col-md-2"><i class="fa fa-circle fa-stack-2x"></i><i class="fa fa-handshake-o fa-stack-1x fa-inverse"></i></span><div class="col-md-10 calendar_event_name">'.ucfirst($activity->data['event_name'])."</div></div>";
|
||||
break;
|
||||
|
||||
default:
|
||||
echo '<div class="row" style="color:#0B615E;"><span class="fa-stack fa-lg col-md-2"><i class="fa fa-circle fa-stack-2x"></i></span><div class="col-md-10 calendar_event_name">'.ucfirst($activity->data['event_name'])."</div></div>";
|
||||
echo '<div class="row" style="color:'.\App\ComplementaryActivity::find($activity->type)->calendar_color.';"><span class="fa-stack fa-lg col-md-2">'.\App\ComplementaryActivity::find($activity->type)->calendar_icon.'</span><div class="col-md-10 calendar_event_name">'.ucfirst($activity->data['event_name'])."</div></div>";
|
||||
break;
|
||||
}
|
||||
echo '</div>';
|
||||
@@ -366,7 +370,11 @@ class CalendarController extends Controller
|
||||
$UserList = User::all();
|
||||
$LocalList = Local::all();
|
||||
|
||||
return view('admin.calendar.calendar_add' ,['RequestDate' => $date, 'Userslist' => $UserList, 'LocalsList' => $LocalList]);
|
||||
return view('admin.calendar.calendar_add' ,[
|
||||
'RequestDate' => $date,
|
||||
'Userslist' => $UserList,
|
||||
'LocalsList' => $LocalList,
|
||||
'ComplementaryActivity' => \App\ComplementaryActivity::all()]);
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
@@ -737,4 +745,10 @@ class CalendarController extends Controller
|
||||
|
||||
return $filtered_classes;
|
||||
}
|
||||
|
||||
public function show()
|
||||
{
|
||||
$date = request('date');
|
||||
return view('admin.calendar.modal.show',['schedules' => \App\Schedule::all()->where('date',$date),'date' => $date]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ class ComplementaryActivityController extends Controller
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
return view('public.activity');
|
||||
return view('admin.configs.activity',['configs' => \App\Config::all(),'activities' => \App\ComplementaryActivity::all()]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -24,7 +24,7 @@ class ComplementaryActivityController extends Controller
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
//
|
||||
return view('admin.configs.activity-add');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -33,9 +33,38 @@ class ComplementaryActivityController extends Controller
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
public function store()
|
||||
{
|
||||
//
|
||||
$activity = new ComplementaryActivity();
|
||||
|
||||
$activity->name = request('name');
|
||||
$activity->admin_desc = request('admin_desc');
|
||||
$activity->public_body = 'Veuillez modifier le text de description publique par défaut';
|
||||
$activity->calendar_color = request('calendar_color');
|
||||
$activity->calendar_icon = request('calendar_icon');
|
||||
$activity->begin_time = request('begin_time');
|
||||
$activity->end_time = request('end_time');
|
||||
$activity->location = request('location');
|
||||
if(request('is_mandatory') == 'on')
|
||||
{
|
||||
$activity->is_mandatory = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$activity->is_mandatory = false;
|
||||
}
|
||||
if(request('is_promoted') == 'on')
|
||||
{
|
||||
$activity->is_promoted = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$activity->is_promoted = false;
|
||||
}
|
||||
|
||||
$activity->save();
|
||||
|
||||
return redirect('/admin/config/activity')->with('status','Activité ajouté avec succes');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -55,9 +84,9 @@ class ComplementaryActivityController extends Controller
|
||||
* @param \App\ComplementaryActivity $complementaryActivity
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit(ComplementaryActivity $complementaryActivity)
|
||||
public function edit($id)
|
||||
{
|
||||
//
|
||||
return view('admin.configs.activity-edit',['activity' => \App\ComplementaryActivity::find($id)]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -67,9 +96,37 @@ class ComplementaryActivityController extends Controller
|
||||
* @param \App\ComplementaryActivity $complementaryActivity
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, ComplementaryActivity $complementaryActivity)
|
||||
public function update($id)
|
||||
{
|
||||
//
|
||||
$activity = ComplementaryActivity::find($id);
|
||||
|
||||
$activity->name = request('name');
|
||||
$activity->admin_desc = request('admin_desc');
|
||||
$activity->calendar_color = request('calendar_color');
|
||||
$activity->calendar_icon = request('calendar_icon');
|
||||
$activity->begin_time = request('begin_time');
|
||||
$activity->end_time = request('end_time');
|
||||
$activity->location = request('location');
|
||||
if(request('is_mandatory') == 'on')
|
||||
{
|
||||
$activity->is_mandatory = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$activity->is_mandatory = false;
|
||||
}
|
||||
if(request('is_promoted') == 'on')
|
||||
{
|
||||
$activity->is_promoted = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$activity->is_promoted = false;
|
||||
}
|
||||
|
||||
$activity->save();
|
||||
|
||||
return redirect('/admin/config/activity')->with('success','Modification sauvegarder avec succes');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -78,8 +135,12 @@ class ComplementaryActivityController extends Controller
|
||||
* @param \App\ComplementaryActivity $complementaryActivity
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy(ComplementaryActivity $complementaryActivity)
|
||||
public function destroy()
|
||||
{
|
||||
//
|
||||
$id = request('id');
|
||||
|
||||
$activity = ComplementaryActivity::find($id);
|
||||
|
||||
$activity->delete();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ class PublicController extends Controller
|
||||
{
|
||||
return view('public.index',[
|
||||
'news' => \App\News::all()->sortByDesc('created_at')->take(3),
|
||||
'activities' => \App\ComplementaryActivity::all(),
|
||||
'activities' => \App\ComplementaryActivity::all()->where('is_promoted','1'),
|
||||
'pictures' => \App\Picture::all()->sortByDesc('created_at')->take(\App\Config::getData('nb_activity_public'))
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -4,8 +4,119 @@ namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use \App\Schedule;
|
||||
use function GuzzleHttp\json_encode;
|
||||
|
||||
class ScheduleController extends Controller
|
||||
{
|
||||
//
|
||||
public function index()
|
||||
{
|
||||
return view('admin.configs.schedule',['configs' => \App\Config::all()]);
|
||||
}
|
||||
|
||||
public function update()
|
||||
{
|
||||
$configs = ['admin_periode_nb'];
|
||||
|
||||
foreach ($configs as $config) {
|
||||
$c = \App\Config::all()->where('name',$config)->first();
|
||||
$c->data = [request($config)];
|
||||
$c->save();
|
||||
}
|
||||
|
||||
$new_admin_periode_begin = [];
|
||||
$new_admin_periode_end = [];
|
||||
for ($i=1; $i <= request('admin_periode_nb'); $i++) {
|
||||
if(request('admin_periode_begin_'.$i))
|
||||
{
|
||||
$new_admin_periode_begin[$i] = request('admin_periode_begin_'.$i);
|
||||
}
|
||||
else
|
||||
{
|
||||
$new_admin_periode_begin[$i] = "00:00";
|
||||
}
|
||||
if(request('admin_periode_end_'.$i))
|
||||
{
|
||||
$new_admin_periode_end[$i] = request('admin_periode_end_'.$i);
|
||||
}
|
||||
else
|
||||
{
|
||||
$new_admin_periode_end[$i] = "00:00";
|
||||
}
|
||||
}
|
||||
|
||||
$temp = \App\Config::all()->where('name','admin_periode_begin')->first();
|
||||
$temp->data = $new_admin_periode_begin;
|
||||
$temp->save();
|
||||
|
||||
$temp = \App\Config::all()->where('name','admin_periode_end')->first();
|
||||
$temp->data = $new_admin_periode_end;
|
||||
$temp->save();
|
||||
|
||||
return redirect('/admin/config/schedule')->with('success','Modification sauvegarder avec succes !');
|
||||
}
|
||||
|
||||
public function apiIndex()
|
||||
{
|
||||
$schedules = Schedule::all();
|
||||
$activity = \App\ComplementaryActivity::all();
|
||||
|
||||
$events = [];
|
||||
|
||||
foreach ($schedules as $schedule) {
|
||||
$color = 'blue';
|
||||
switch ($schedule->type) {
|
||||
case 'regular':
|
||||
$color = 'orange';
|
||||
break;
|
||||
|
||||
case 'pilotage':
|
||||
$color = '#58D3F7';
|
||||
break;
|
||||
|
||||
case 'drill':
|
||||
$color = 'blue';
|
||||
break;
|
||||
|
||||
case 'music':
|
||||
$color = 'green';
|
||||
break;
|
||||
|
||||
case 'biathlon':
|
||||
$color = 'red';
|
||||
break;
|
||||
|
||||
case 'marksmanship':
|
||||
$color = 'grey';
|
||||
break;
|
||||
|
||||
case 'founding':
|
||||
$color = '#00FF40';
|
||||
break;
|
||||
|
||||
case 'volunteer':
|
||||
$color = '#DF0174';
|
||||
break;
|
||||
|
||||
case 'other':
|
||||
$color = '#DF0174';
|
||||
break;
|
||||
|
||||
default:
|
||||
if ($activity->find($schedule->type)) {
|
||||
$color = $activity->find($schedule->type)->calendar_color;
|
||||
}
|
||||
break;
|
||||
};
|
||||
|
||||
$event = [
|
||||
'title' => $schedule->data['event_name'],
|
||||
'start' => $schedule->date.'T'.$schedule->data['event_begin_time'],
|
||||
'end' => $schedule->date.'T'.$schedule->data['event_end_time'],
|
||||
'color' => $color
|
||||
];
|
||||
array_push($events,$event);
|
||||
}
|
||||
|
||||
return json_encode($events);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user