mirror of
https://gitlab.com/TheGamecraft/c-cms.git
synced 2026-04-21 02:39:10 -04:00
ALPHA 3.0.5
This commit is contained in:
@@ -26,7 +26,23 @@ class AdminController extends Controller
|
||||
{
|
||||
Log::saveLog('Affichage du tableau de bord');
|
||||
|
||||
return view('admin.dashboard');
|
||||
$futureEvent_to_filtered = \App\Schedule::all()->sortBy('date');
|
||||
$futureEvent_to_filtered_pass_1 = collect();
|
||||
$futureEvent = collect();
|
||||
|
||||
foreach ($futureEvent_to_filtered as $day) {
|
||||
if ($day->date >= date('Y-m-d')) {
|
||||
$futureEvent_to_filtered_pass_1->push($day);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($futureEvent_to_filtered_pass_1 as $day) {
|
||||
if ($day->date <= date('Y-m-d',strtotime("+2 week"))) {
|
||||
$futureEvent->push($day);
|
||||
}
|
||||
}
|
||||
|
||||
return view('admin.dashboard',['futureEvent' => $futureEvent,'userClasse' => \Auth::User()->getClasse()->forPage(1,6)]);
|
||||
}
|
||||
|
||||
public function update()
|
||||
|
||||
@@ -191,9 +191,6 @@ class CalendarController extends Controller
|
||||
'<a type="button" class="btn btn-danger" onclick="deleteEvent('.$date->id.');"><i class="fa fa-times-circle" style="color:white;"></i></a>'.
|
||||
'</div>'.
|
||||
'</div>'.
|
||||
'<p>'.
|
||||
"L'activité auras lieux a l'escadron entre 18h30 et 21h30".
|
||||
'</p>'.
|
||||
'<p>'.$date->data['event_desc'].
|
||||
'</p>'
|
||||
);
|
||||
@@ -445,14 +442,14 @@ class CalendarController extends Controller
|
||||
$schedule->save();
|
||||
|
||||
/** Logs and Notification */
|
||||
Log::saveLog("Ajout de l'activité, ".$schedule->name." à l'horaire le ".$schedule->date);
|
||||
Log::saveLog("Ajout de l'activité, ".$schedule->data['event_name']." à l'horaire le ".$schedule->date);
|
||||
|
||||
$userToNotify = $schedule->getUserToNotify();
|
||||
\Notification::send($userToNotify, new Alert(\Auth::User()->id,"Ajout de l'activité, ".$schedule->name." à l'horaire le ".$schedule->date,"/admin/calendar"));
|
||||
\Notification::send($userToNotify, new Alert(\Auth::User()->id,"Ajout de l'activité, ".$schedule->data['event_name']." à l'horaire le ".$schedule->date,"/admin/calendar"));
|
||||
|
||||
if(\App\Config::where('name','is_schedule_build')->first()->state == 1)
|
||||
{
|
||||
\Notification::send($userToNotify, new mail(\Auth::User(),"Ajout d'une activité a l'horaire",\Auth::User()->fullname()." à ajouté l'activité, ".$schedule->name." à l'horaire le ".$schedule->date));
|
||||
\Notification::send($userToNotify, new mail(\Auth::User(),"Ajout d'une activité a l'horaire",\Auth::User()->fullname()." à ajouté l'activité, ".$schedule->data['event_name']." à l'horaire le ".$schedule->date));
|
||||
}
|
||||
return redirect('/admin/calendar');
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ class ConfigController extends Controller
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
return view ('admin.configs.general',['configs' => Config::all()]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -67,9 +67,19 @@ class ConfigController extends Controller
|
||||
* @param \App\Config $config
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, Config $config)
|
||||
public function update()
|
||||
{
|
||||
//
|
||||
$config = Config::all()->where('name',request('perm'))->first();
|
||||
|
||||
if (request('value') == "true") {
|
||||
$config->state = 1;
|
||||
} else {
|
||||
$config->state = 0;
|
||||
}
|
||||
|
||||
$config->save();
|
||||
|
||||
\App\Log::saveLog('Modification de la configuration du site');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -247,25 +247,43 @@ class ECCController extends Controller
|
||||
|
||||
foreach ($items_array as $item_array) {
|
||||
if ($item_array != "") {
|
||||
$items->push(\App\Item::find($item_array));
|
||||
$item_array_ex = explode(":",$item_array);
|
||||
$this_item = \App\Item::find($item_array_ex[0]);
|
||||
$this_item->quantity = $item_array_ex[1];
|
||||
$items->push($this_item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return view('ecc.booking',['schedule' => $schedule, 'periode' => $periode, 'niveau' => $niveau, 'items' => $items, 'dispo_item' => $schedule->getInventory($periode)]);
|
||||
}
|
||||
|
||||
public function booking_add($id,$periode,$niveau)
|
||||
{
|
||||
$schedule = Schedule::find($id);
|
||||
|
||||
$id_to_modify = "passet";
|
||||
$qt_to_add = 0;
|
||||
$periode_item = 'n'.$niveau.'_p'.$periode.'_item';
|
||||
|
||||
if (isset($schedule->$periode_item)) {
|
||||
$array_items = explode("-",$schedule->$periode_item);
|
||||
array_push($array_items,request('add'));
|
||||
for ($i=0; $i < count($array_items); $i++) {
|
||||
$array_item_id = explode(":",$array_items[$i]);
|
||||
|
||||
if ($array_item_id[0] == request('add')) {
|
||||
$id_to_modify = $i;
|
||||
$qt_to_add = $array_item_id[1];
|
||||
}
|
||||
}
|
||||
if ($id_to_modify === "passet") {
|
||||
array_push($array_items,request('add').":".request('qt'));
|
||||
} else {
|
||||
$toadd = $qt_to_add+request('qt');
|
||||
$array_items[$id_to_modify] = request('add').":".$toadd;
|
||||
}
|
||||
} else {
|
||||
$array_items = [];
|
||||
array_push($array_items,request('add'));
|
||||
array_push($array_items,request('add').":".request('qt'));
|
||||
}
|
||||
|
||||
$final_items = implode("-",$array_items);
|
||||
@@ -273,7 +291,7 @@ class ECCController extends Controller
|
||||
$schedule->$periode_item = $final_items;
|
||||
|
||||
$schedule->save();
|
||||
|
||||
|
||||
return redirect('/ecc/inventory/'.$id.'/'.$niveau.'/'.$periode);
|
||||
}
|
||||
|
||||
|
||||
@@ -54,15 +54,29 @@ class InventoryController extends Controller
|
||||
public function store($id,$periode,$niveau)
|
||||
{
|
||||
$schedule = Schedule::find($id);
|
||||
|
||||
$id_to_modify = "passet";
|
||||
$qt_to_add = 0;
|
||||
$periode_item = 'n'.$niveau.'_p'.$periode.'_item';
|
||||
|
||||
if (isset($schedule->$periode_item)) {
|
||||
$array_items = explode("-",$schedule->$periode_item);
|
||||
array_push($array_items,request('add'));
|
||||
for ($i=0; $i < count($array_items); $i++) {
|
||||
$array_item_id = explode(":",$array_items[$i]);
|
||||
|
||||
if ($array_item_id[0] == request('add')) {
|
||||
$id_to_modify = $i;
|
||||
$qt_to_add = $array_item_id[1];
|
||||
}
|
||||
}
|
||||
if ($id_to_modify === "passet") {
|
||||
array_push($array_items,request('add').":".request('qt'));
|
||||
} else {
|
||||
$toadd = $qt_to_add+request('qt');
|
||||
$array_items[$id_to_modify] = request('add').":".$toadd;
|
||||
}
|
||||
} else {
|
||||
$array_items = [];
|
||||
array_push($array_items,request('add'));
|
||||
array_push($array_items,request('add').":".request('qt'));
|
||||
}
|
||||
|
||||
$final_items = implode("-",$array_items);
|
||||
@@ -70,7 +84,7 @@ class InventoryController extends Controller
|
||||
$schedule->$periode_item = $final_items;
|
||||
|
||||
$schedule->save();
|
||||
|
||||
|
||||
return redirect('/admin/inventory/'.$id.'/'.$periode.'/'.$niveau);
|
||||
}
|
||||
|
||||
@@ -91,10 +105,14 @@ class InventoryController extends Controller
|
||||
|
||||
foreach ($items_array as $item_array) {
|
||||
if ($item_array != "") {
|
||||
$items->push(Item::find($item_array));
|
||||
$item_array_ex = explode(":",$item_array);
|
||||
$this_item = Item::find($item_array_ex[0]);
|
||||
$this_item->quantity = $item_array_ex[1];
|
||||
$items->push($this_item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return view('admin.inventory.show',['schedule' => $schedule, 'periode' => $periode, 'niveau' => $niveau, 'items' => $items, 'dispo_item' => $schedule->getInventory($periode)]);
|
||||
}
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@ class ItemController extends Controller
|
||||
|
||||
$item->name = request('name');
|
||||
$item->desc = request('desc');
|
||||
$item->quantiy = request('qt');
|
||||
|
||||
$item->save();
|
||||
|
||||
@@ -82,6 +83,7 @@ class ItemController extends Controller
|
||||
|
||||
$item->name = request('name');
|
||||
$item->desc = request('desc');
|
||||
$item->quantity = request('qt');
|
||||
|
||||
$item->save();
|
||||
|
||||
|
||||
19
app/Http/helpers.php
Normal file
19
app/Http/helpers.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
function getStatus()
|
||||
{
|
||||
$client = new GuzzleHttp\Client();
|
||||
$incidents = $client->get('https://status.c-cms.cf/api/v1/incidents');
|
||||
|
||||
$isBroken = false;
|
||||
|
||||
$incidents_decode = json_decode($incidents->getBody(),true);
|
||||
|
||||
foreach ($incidents_decode['data'] as $incident) {
|
||||
if (!$incident['is_resolved']) {
|
||||
$isBroken = true;
|
||||
}
|
||||
}
|
||||
|
||||
return $isBroken;
|
||||
}
|
||||
Reference in New Issue
Block a user