';
switch ($activity->type) {
case 'regular':
echo '
'.ucfirst($activity->data['event_name'])."
";
@@ -458,6 +459,7 @@ class CalendarController extends Controller
public function patch($id)
{
$schedule = Schedule::find($id);
+ $original = clone($schedule);
$schedule->date = request('event_date');
$schedule->type = request('event_type');
@@ -519,6 +521,171 @@ class CalendarController extends Controller
$schedule->save();
+ /** Notification */
+ $asChange = false;
+ $userToNotify = $schedule->getUserToNotify();
+ $changes = [];
+ $found = false;
+
+ if ($schedule->type == "regular") {
+ for ($p=1; $p < 3; $p++) {
+ for ($n=1; $n < 4; $n++) {
+ $pUser = \App\User::find($schedule->data['n'.$n.'_p'.$p.'_instructor']);
+ foreach ($userToNotify as $user) {
+ if ($user->id == $pUser->id) {
+ $found = true;
+ }
+ }
+ if (!$found) {
+ $userToNotify->push($pUser);
+ }
+ }
+ }
+ }
+
+ if ($schedule->data['event_begin_time'] != $original->data['event_begin_time']) {
+ array_push($changes,"L'heure de début a été modifié de ".$original->data['event_begin_time']." à ".$schedule->data['event_begin_time']);
+ }
+ if ($schedule->data['event_end_time'] != $original->data['event_end_time']) {
+ array_push($changes,"L'heure de fin a été modifié de ".$original->data['event_end_time']." à ".$schedule->data['event_end_time']);
+ }
+ if ($schedule->type != $original->type) {
+ array_push($changes,"Le type d'évenement a été modifié de ".$original->type." à ".$schedule->type);
+ }
+ if ($schedule->data['event_name'] != $original->data['event_name']) {
+ array_push($changes,"Le nom de l'évenement a été modifié de ".$original->data['event_name']." à ".$schedule->data['event_name']);
+ }
+ if ($schedule->data['is_event_mandatory'] != $original->data['is_event_mandatory']) {
+ if ($schedule->data['is_event_mandatory'] == "on") {
+ array_push($changes,"L'évenement est maintenant obligatoire");
+ } else {
+ array_push($changes,"L'évenement n'est plus obligatoire");
+ }
+ }
+ if ($schedule->data['event_location'] != $original->data['event_location']) {
+ array_push($changes,"Le lieu de l'évenement a été modifié de ".$original->data['event_location']." à ".$schedule->data['event_location']);
+ }
+ if ($schedule->data['event_desc'] != $original->data['event_desc']) {
+ array_push($changes,"La description de l'évenement a été modifié de ".$original->data['event_desc']." à ".$schedule->data['event_desc']);
+ }
+
+ if ($schedule->type == "regular") {
+ /** Check Instructor */
+ if ($schedule->data['n1_p1_instructor'] != $original->data['n1_p1_instructor']) {
+ array_push($changes,"L'instructeur du niveau 1 pour la première période a été changé de ".\App\User::find($original->data['n1_p1_instructor'])->fullname()." à ".\App\User::find($schedule->data['n1_p1_instructor'])->fullname());
+ \Notification::send(\App\User::find($original->data['n1_p1_instructor']), new mail(\Auth::User(),"Modification d'un de vos cours","Le cours ".$original->data['n1_p1_name']." du ".$original->date." vous a été retiré."));
+ \Notification::send(\App\User::find($schedule->data['n1_p1_instructor']), new mail(\Auth::User(),"Modification d'un de vos cours","Le cours ".$schedule->data['n1_p1_name']." du ".$schedule->date." vous a été ajouté."));
+ }
+ if ($schedule->data['n1_p2_instructor'] != $original->data['n1_p2_instructor']) {
+ array_push($changes,"L'instructeur du niveau 1 pour la deuxième période a été changé de ".\App\User::find($original->data['n1_p2_instructor'])->fullname()." à ".\App\User::find($schedule->data['n1_p2_instructor'])->fullname());
+ \Notification::send(\App\User::find($original->data['n1_p2_instructor']), new mail(\Auth::User(),"Modification d'un de vos cours","Le cours ".$original->data['n1_p2_name']." du ".$original->date." vous a été retiré."));
+ \Notification::send(\App\User::find($schedule->data['n1_p2_instructor']), new mail(\Auth::User(),"Modification d'un de vos cours","Le cours ".$schedule->data['n1_p2_name']." du ".$schedule->date." vous a été ajouté."));
+ }
+ if ($schedule->data['n2_p1_instructor'] != $original->data['n2_p1_instructor']) {
+ array_push($changes,"L'instructeur du niveau 2 pour la première période a été changé de ".\App\User::find($original->data['n2_p1_instructor'])->fullname()." à ".\App\User::find($schedule->data['n2_p1_instructor'])->fullname());
+ \Notification::send(\App\User::find($original->data['n2_p1_instructor']), new mail(\Auth::User(),"Modification d'un de vos cours","Le cours ".$original->data['n2_p1_name']." du ".$original->date." vous a été retiré."));
+ \Notification::send(\App\User::find($schedule->data['n2_p1_instructor']), new mail(\Auth::User(),"Modification d'un de vos cours","Le cours ".$schedule->data['n2_p1_name']." du ".$schedule->date." vous a été ajouté."));
+ }
+ if ($schedule->data['n2_p2_instructor'] != $original->data['n2_p2_instructor']) {
+ array_push($changes,"L'instructeur du niveau 2 pour la deuxième période a été changé de ".\App\User::find($original->data['n2_p2_instructor'])->fullname()." à ".\App\User::find($schedule->data['n2_p2_instructor'])->fullname());
+ \Notification::send(\App\User::find($original->data['n2_p2_instructor']), new mail(\Auth::User(),"Modification d'un de vos cours","Le cours ".$original->data['n2_p2_name']." du ".$original->date." vous a été retiré."));
+ \Notification::send(\App\User::find($schedule->data['n2_p2_instructor']), new mail(\Auth::User(),"Modification d'un de vos cours","Le cours ".$schedule->data['n2_p2_name']." du ".$schedule->date." vous a été ajouté."));
+ }
+ if ($schedule->data['n3_p1_instructor'] != $original->data['n3_p1_instructor']) {
+ array_push($changes,"L'instructeur du niveau 3 pour la première période a été changé de ".\App\User::find($original->data['n3_p1_instructor'])->fullname()." à ".\App\User::find($schedule->data['n3_p1_instructor'])->fullname());
+ \Notification::send(\App\User::find($original->data['n3_p1_instructor']), new mail(\Auth::User(),"Modification d'un de vos cours","Le cours ".$original->data['n3_p1_name']." du ".$original->date." vous a été retiré."));
+ \Notification::send(\App\User::find($schedule->data['n3_p1_instructor']), new mail(\Auth::User(),"Modification d'un de vos cours","Le cours ".$schedule->data['n3_p1_name']." du ".$schedule->date." vous a été ajouté."));
+ }
+ if ($schedule->data['n3_p2_instructor'] != $original->data['n3_p2_instructor']) {
+ array_push($changes,"L'instructeur du niveau 3 pour la deuxième période a été changé de ".\App\User::find($original->data['n3_p2_instructor'])->fullname()." à ".\App\User::find($schedule->data['n3_p2_instructor'])->fullname());
+ \Notification::send(\App\User::find($original->data['n3_p2_instructor']), new mail(\Auth::User(),"Modification d'un de vos cours","Le cours ".$original->data['n3_p2_name']." du ".$original->date." vous a été retiré."));
+ \Notification::send(\App\User::find($schedule->data['n3_p2_instructor']), new mail(\Auth::User(),"Modification d'un de vos cours","Le cours ".$schedule->data['n3_p2_name']." du ".$schedule->date." vous a été ajouté."));
+ }
+ /** Check OCOM */
+ if ($schedule->data['n1_p1_ocom'] != $original->data['n1_p1_ocom']) {
+ array_push($changes,"L'OCOM du niveau 1 pour la première période a été changé de ".$original->data['n1_p1_ocom']." à ".$schedule->data['n1_p1_ocom']);
+ \Notification::send(\App\User::find($schedule->data['n1_p1_instructor']), new mail(\Auth::User(),"Modification d'un de vos cours","L'ocom du cours ".$schedule->data['n1_p1_name']." du ".$schedule->date." a été changé pour ".$schedule->data['n1_p1_ocom']));
+ }
+ if ($schedule->data['n1_p2_ocom'] != $original->data['n1_p2_ocom']) {
+ array_push($changes,"L'OCOM du niveau 1 pour la deuxième période a été changé de ".$original->data['n1_p2_ocom']." à ".$schedule->data['n1_p2_ocom']);
+ \Notification::send(\App\User::find($schedule->data['n1_p2_instructor']), new mail(\Auth::User(),"Modification d'un de vos cours","L'ocom du cours ".$schedule->data['n1_p2_name']." du ".$schedule->date." a été changé pour ".$schedule->data['n1_p2_ocom']));
+ }
+ if ($schedule->data['n2_p1_ocom'] != $original->data['n2_p1_ocom']) {
+ array_push($changes,"L'OCOM du niveau 2 pour la première période a été changé de ".$original->data['n2_p1_ocom']." à ".$schedule->data['n2_p1_ocom']);
+ \Notification::send(\App\User::find($schedule->data['n2_p1_instructor']), new mail(\Auth::User(),"Modification d'un de vos cours","L'ocom du cours ".$schedule->data['n2_p1_name']." du ".$schedule->date." a été changé pour ".$schedule->data['n2_p1_ocom']));
+ }
+ if ($schedule->data['n2_p2_ocom'] != $original->data['n2_p2_ocom']) {
+ array_push($changes,"L'OCOM du niveau 2 pour la deuxième période a été changé de ".$original->data['n2_p2_ocom']." à ".$schedule->data['n2_p2_ocom']);
+ \Notification::send(\App\User::find($schedule->data['n2_p2_instructor']), new mail(\Auth::User(),"Modification d'un de vos cours","L'ocom du cours ".$schedule->data['n2_p2_name']." du ".$schedule->date." a été changé pour ".$schedule->data['n2_p2_ocom']));
+ }
+ if ($schedule->data['n3_p1_ocom'] != $original->data['n3_p1_ocom']) {
+ array_push($changes,"L'OCOM du niveau 3 pour la première période a été changé de ".$original->data['n3_p1_ocom']." à ".$schedule->data['n3_p1_ocom']);
+ \Notification::send(\App\User::find($schedule->data['n3_p1_instructor']), new mail(\Auth::User(),"Modification d'un de vos cours","L'ocom du cours ".$schedule->data['n3_p1_name']." du ".$schedule->date." a été changé pour ".$schedule->data['n3_p1_ocom']));
+ }
+ if ($schedule->data['n3_p2_ocom'] != $original->data['n3_p2_ocom']) {
+ array_push($changes,"L'OCOM du niveau 3 pour la deuxième période a été changé de ".$original->data['n3_p2_ocom']." à ".$schedule->data['n3_p2_ocom']);
+ \Notification::send(\App\User::find($schedule->data['n3_p2_instructor']), new mail(\Auth::User(),"Modification d'un de vos cours","L'ocom du cours ".$schedule->data['n3_p2_name']." du ".$schedule->date." a été changé pour ".$schedule->data['n3_p2_ocom']));
+ }
+ /** Check Local */
+ if ($schedule->data['n1_p1_local'] != $original->data['n1_p1_local']) {
+ array_push($changes,"Le local du niveau 1 pour la première période a été changé de ".$original->data['n1_p1_local']." à ".$schedule->data['n1_p1_local']);
+ }
+ if ($schedule->data['n1_p2_local'] != $original->data['n1_p2_local']) {
+ array_push($changes,"Le local du niveau 1 pour la deuxième période a été changé de ".$original->data['n1_p2_local']." à ".$schedule->data['n1_p2_local']);
+ }
+ if ($schedule->data['n2_p1_local'] != $original->data['n2_p1_local']) {
+ array_push($changes,"Le local du niveau 2 pour la première période a été changé de ".$original->data['n2_p1_local']." à ".$schedule->data['n2_p1_local']);
+ }
+ if ($schedule->data['n2_p2_local'] != $original->data['n2_p2_local']) {
+ array_push($changes,"Le local du niveau 2 pour la deuxième période a été changé de ".$original->data['n2_p2_local']." à ".$schedule->data['n2_p2_local']);
+ }
+ if ($schedule->data['n3_p1_local'] != $original->data['n3_p1_local']) {
+ array_push($changes,"Le local du niveau 3 pour la première période a été changé de ".$original->data['n3_p1_local']." à ".$schedule->data['n3_p1_local']);
+ }
+ if ($schedule->data['n3_p2_local'] != $original->data['n3_p2_local']) {
+ array_push($changes,"Le local du niveau 3 pour la deuxième période a été changé de ".$original->data['n3_p2_local']." à ".$schedule->data['n3_p2_local']);
+ }
+ /** Check Name */
+ if ($schedule->data['n1_p1_name'] != $original->data['n1_p1_name']) {
+ array_push($changes,"Le nom du cours niveau 1 pour la première période a été changé de ".$original->data['n1_p1_name']." à ".$schedule->data['n1_p1_name']);
+ \Notification::send(\App\User::find($schedule->data['n1_p1_instructor']), new mail(\Auth::User(),"Modification d'un de vos cours","Le nom du cours ".$original->data['n1_p1_name']." du ".$schedule->date." a été changé pour ".$schedule->data['n1_p1_name']));
+ }
+ if ($schedule->data['n1_p2_name'] != $original->data['n1_p2_name']) {
+ array_push($changes,"Le nom du cours niveau 1 pour la deuxième période a été changé de ".$original->data['n1_p2_name']." à ".$schedule->data['n1_p2_name']);
+ \Notification::send(\App\User::find($schedule->data['n1_p2_instructor']), new mail(\Auth::User(),"Modification d'un de vos cours","Le nom du cours ".$original->data['n1_p2_name']." du ".$schedule->date." a été changé pour ".$schedule->data['n1_p2_name']));
+ }
+ if ($schedule->data['n2_p1_name'] != $original->data['n2_p1_name']) {
+ array_push($changes,"Le nom du cours niveau 2 pour la première période a été changé de ".$original->data['n2_p1_name']." à ".$schedule->data['n2_p1_name']);
+ \Notification::send(\App\User::find($schedule->data['n2_p1_instructor']), new mail(\Auth::User(),"Modification d'un de vos cours","Le nom du cours ".$original->data['n2_p1_name']." du ".$schedule->date." a été changé pour ".$schedule->data['n2_p1_name']));
+ }
+ if ($schedule->data['n2_p2_name'] != $original->data['n2_p2_name']) {
+ array_push($changes,"Le nom du cours niveau 2 pour la deuxième période a été changé de ".$original->data['n2_p2_name']." à ".$schedule->data['n2_p2_name']);
+ \Notification::send(\App\User::find($schedule->data['n2_p2_instructor']), new mail(\Auth::User(),"Modification d'un de vos cours","Le nom du cours ".$original->data['n2_p2_name']." du ".$schedule->date." a été changé pour ".$schedule->data['n2_p2_name']));
+ }
+ if ($schedule->data['n3_p1_name'] != $original->data['n3_p1_name']) {
+ array_push($changes,"Le nom du cours niveau 3 pour la première période a été changé de ".$original->data['n3_p1_name']." à ".$schedule->data['n3_p1_name']);
+ \Notification::send(\App\User::find($schedule->data['n3_p1_instructor']), new mail(\Auth::User(),"Modification d'un de vos cours","Le nom du cours ".$original->data['n3_p1_name']." du ".$schedule->date." a été changé pour ".$schedule->data['n3_p1_name']));
+ }
+ if ($schedule->data['n3_p2_name'] != $original->data['n3_p2_name']) {
+ array_push($changes,"Le nom du cours niveau 3 pour la deuxième période a été changé de ".$original->data['n3_p2_name']." à ".$schedule->data['n3_p2_name']);
+ \Notification::send(\App\User::find($schedule->data['n3_p2_instructor']), new mail(\Auth::User(),"Modification d'un de vos cours","Le nom du cours ".$original->data['n3_p2_name']." du ".$schedule->date." a été changé pour ".$schedule->data['n3_p2_name']));
+ }
+ }
+
+ \Notification::send($userToNotify, new Alert(\Auth::User()->id,"Modification de l'activité, ".$schedule->data['event_name']." à l'horaire le ".$schedule->date,"/admin/calendar"));
+
+ $string_Change = "
";
+ foreach ($changes as $value) {
+ $string_Change = $string_Change."- ".$value."
";
+ }
+ $string_Change = $string_Change."
";
+ if(\App\Config::where('name','is_schedule_build')->first()->state == 1)
+ {
+ \Notification::send($userToNotify, new mail(\Auth::User(),"Modification d'une activité a l'horaire",\Auth::User()->fullname()." à modifié l'activité, ".$schedule->data['event_name']." à l'horaire le ".$schedule->date."
".$string_Change));
+ }
+
+ Log::saveLog("Modification de l'activité, ".$schedule->data['event_name']." à l'horaire le ".$schedule->date);
+
return redirect('/admin/calendar');
}
@@ -530,5 +697,44 @@ class CalendarController extends Controller
$schedule = Schedule::find($id);
$schedule->delete();
+
+ \Notification::send($userToNotify, new Alert(\Auth::User()->id,"Suppresion 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(),"Suppression d'une activité a l'horaire",\Auth::User()->fullname()." à supprimé l'activité, ".$schedule->data['event_name']." à l'horaire le ".$schedule->date));
+ }
+
+ Log::saveLog("Suppression de l'activité, ".$schedule->data['event_name']." à l'horaire le ".$schedule->date);
+
+ }
+
+ private function listClass()
+ {
+ $schedules = \App\Schedule::all();
+ $filtered_schedules = collect();
+ $classes = [];
+
+ foreach($schedules as $schedule)
+ {
+ if($schedule->type == "regular")
+ {
+ $filtered_schedules->push($schedule);
+ }
+ }
+
+ foreach($filtered_schedules as $schedule)
+ {
+ array_push($classes,$schedule->data['n1_p1_ocom']);
+ array_push($classes,$schedule->data['n1_p2_ocom']);
+ array_push($classes,$schedule->data['n2_p1_ocom']);
+ array_push($classes,$schedule->data['n2_p2_ocom']);
+ array_push($classes,$schedule->data['n3_p1_ocom']);
+ array_push($classes,$schedule->data['n3_p2_ocom']);
+ }
+
+ $filtered_classes = array_unique($classes);
+
+ return $filtered_classes;
}
}
diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php
index 27f62e27..9a398a34 100644
--- a/app/Http/Controllers/UserController.php
+++ b/app/Http/Controllers/UserController.php
@@ -173,4 +173,46 @@ class UserController extends Controller
$notification->delete();
return redirect(request('url'));
}
+
+ public function notificationmarkALL()
+ {
+ $notifications = \Auth::User()->unreadNotifications;
+ foreach($notifications as $notification)
+ {
+ $notification->delete();
+ }
+ return redirect()->back();
+ }
+
+ public function notificationmarkECC($id)
+ {
+ $notification = \Auth::User()->unreadNotifications->where('id',$id)->first();
+
+ $notification->delete();
+ return redirect('/ecc');
+ }
+
+ public function showUserProfil($id = 0)
+ {
+ if ($id == 0) {
+ $id = \Auth::User()->id;
+ }
+ return view('admin.user.profil',['user' => \App\User::find($id)]);
+ }
+
+ public function editUserAvatar($id)
+ {
+ $user = \Auth::User();
+
+ $user->avatar = $id;
+
+ $user->save();
+
+ return redirect('/admin/profil/avatar')->with('status', 'Modification enregistré');
+ }
+
+ public function UserAvatar()
+ {
+ return view('admin.user.profil.avatar');
+ }
}
diff --git a/public/assets/admin/assets/scss/style.css b/public/assets/admin/assets/scss/style.css
index 78397373..666d4e81 100644
--- a/public/assets/admin/assets/scss/style.css
+++ b/public/assets/admin/assets/scss/style.css
@@ -2253,7 +2253,6 @@ header .form-inline {
vertical-align: middle !important;
border: solid 1px #d9d9d9 !important;
padding: 0px !important;
- display: flex;
}
.calendar-date{
float: left;
@@ -2261,11 +2260,14 @@ header .form-inline {
}
.calendar-text{
float: right;
- margin-top: 1.5rem;
}
.calendar-text > div {
text-align:start;
}
+.calendar_event_name {
+ height: 3rem;
+ overflow: hidden;
+}
@media only screen and (max-width: 800px) {
.calendar-container{
width: 100%;
diff --git a/public/assets/js/calendar/calendar.js b/public/assets/js/calendar/calendar.js
index 50c6cbb4..f1231eda 100644
--- a/public/assets/js/calendar/calendar.js
+++ b/public/assets/js/calendar/calendar.js
@@ -180,7 +180,7 @@ function switchType()
eventBeginTime.value = "";
eventEndTime.value = "";
eventLocation.value = "";
- eventDesc.value = "";
+ eventDesc.value = "Financement";
divSpecialSection.style.display = "none";
break;
@@ -190,7 +190,7 @@ function switchType()
eventBeginTime.value = "";
eventEndTime.value = "";
eventLocation.value = "";
- eventDesc.value = "";
+ eventDesc.value = "Bénévolat";
divSpecialSection.style.display = "none";
break;
@@ -200,7 +200,7 @@ function switchType()
eventBeginTime.value = "";
eventEndTime.value = "";
eventLocation.value = "";
- eventDesc.value = "";
+ eventDesc.value = "Autre";
divSpecialSection.style.display = "none";
break;
}
diff --git a/resources/views/admin/dashboard.blade.php b/resources/views/admin/dashboard.blade.php
index 13a546dc..feb91459 100644
--- a/resources/views/admin/dashboard.blade.php
+++ b/resources/views/admin/dashboard.blade.php
@@ -7,6 +7,14 @@
Cours a venir
diff --git a/resources/views/ecc/guide.blade.php b/resources/views/ecc/guide.blade.php
index 516ede1f..a6eb01e2 100644
--- a/resources/views/ecc/guide.blade.php
+++ b/resources/views/ecc/guide.blade.php
@@ -20,22 +20,22 @@