diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ef3a80fb..f903d505 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -44,6 +44,7 @@ deploy_697: environment: name: escadron697 url: http://escadron697.ca + when: manual only: - master @@ -60,6 +61,7 @@ deploy_736: environment: name: escadron736 url: http://736.exvps.ca + when: manual only: - master @@ -76,6 +78,7 @@ deploy_227: environment: name: CCMRC227 url: http://227.exvps.ca + when: manual only: - master @@ -92,6 +95,7 @@ deploy_117: environment: name: CCMRC117 url: http://117.exvps.ca + when: manual only: - master @@ -108,5 +112,6 @@ deploy_dev: environment: name: dev url: http://dev.exvps.ca + when: manual only: - - dev \ No newline at end of file + - dev diff --git a/app/Event.php b/app/Event.php index 346b71d2..1c7748fd 100644 --- a/app/Event.php +++ b/app/Event.php @@ -143,4 +143,17 @@ class Event extends Model { return count($this->schedule["niveaux"]); } + + static function getMaxLevels($events) + { + $maxlevel = 0; + foreach ($events as $e) + { + if ($e->nbNiveau() > $maxlevel) + { + $maxlevel = $e->nbNiveau(); + } + } + return $maxlevel; + } } diff --git a/app/Http/Controllers/CalendarController.php b/app/Http/Controllers/CalendarController.php index d020b94e..229d0ad8 100644 --- a/app/Http/Controllers/CalendarController.php +++ b/app/Http/Controllers/CalendarController.php @@ -32,715 +32,11 @@ class CalendarController extends Controller */ public function index() { - - $this->listClass(); - return view('admin.calendar.calendar_display'); } - public function generate() + public function indexTable() { - $lang = str_replace('_', '-', app()->getLocale()); - setlocale(LC_ALL, $lang.'_'.strtoupper($lang).'.utf8','fra'); - - $month = request('month'); - $year = request('year'); - - $nextMonth = $month + 1; - $nextYear = $year; - - if ($nextMonth > 12) { - $nextMonth = 1; - $nextYear = $nextYear + 1; - } - - $prevMonth = $month - 1; - $prevYear = $year; - - if ($prevMonth < 1) { - $prevMonth = 12; - $prevYear = $prevYear - 1; - } - - $calendar = array(); - - $dayinmonth = cal_days_in_month(CAL_GREGORIAN, $month, $year); - - $firstdaymonth = date("w", strtotime("01-".$month."-".$year)); - - $addingday = 0; - - for ($i=$firstdaymonth ; $addingday < $dayinmonth ; $i++) { - $addingday = $addingday + 1; - $calendar[$i] = $addingday; - } - - echo '
'; - echo '
'; - echo '
'.ucfirst(strftime("%B %Y", strtotime("01-".$month."-".$year))).'
'; - echo '
Dimanche
Lundi
Mardi
Mercredi
Jeudi
Vendredi
Samedi
'; - echo '
'; - echo '
'; - for ($i=0; $i < 6 ; $i++) - { - echo ''; - } - - } - - public function load() - { - - $lang = str_replace('_', '-', app()->getLocale()); - setlocale(LC_ALL, $lang.'_'.strtoupper($lang).'.utf8','fra'); - - $Requestdate = request('date'); - - $url = str_replace("-","_", $Requestdate); - - - $today = Schedule::where('date','=',$Requestdate)->get(); - $isEmpty = $today->isEmpty(); - - echo ''; - } - - public function add($date) - { - $lang = str_replace('_', '-', app()->getLocale()); - setlocale(LC_ALL, $lang.'_'.strtoupper($lang).'.utf8','fra'); - - $date = str_replace("_", "-", $date); - - $UserList = User::all(); - $LocalList = Local::all(); - - return view('admin.calendar.calendar_add' ,[ - 'RequestDate' => $date, - 'Userslist' => $UserList, - 'LocalsList' => $LocalList, - 'ComplementaryActivity' => \App\ComplementaryActivity::all()]); - } - - public function edit($id) - { - $schedule = Schedule::find($id); - $UserList = User::all(); - $LocalList = Local::all(); - - return view('admin.calendar.calendar_edit' ,['RequestSchedule' => $schedule, 'Userslist' => $UserList, 'LocalsList' => $LocalList]); - } - - public function store() - { - $schedule = new Schedule; - - $schedule->date = request('event_date'); - $schedule->type = request('event_type'); - - if(request('event_type') == "regular") - { - $eventData = [ - "event_name" => request('event_name'), - "is_event_mandatory" => request('is_event_mandatory'), - "event_date" => request('event_date'), - "event_begin_time" => request('event_begin_time'), - "event_end_time" => request('event_end_time'), - "event_location" => request('event_location'), - "event_desc" => request('event_desc'), - "n1_p1_name" => request('n1_p1_name'), - "n1_p1_ocom" => request('n1_p1_ocom'), - "n1_p1_instructor" => request('n1_p1_instructor'), - "n1_p1_local" => request('n1_p1_local'), - "n1_p1_plandone" => request('n1_p1_plandone'), - "n1_p2_name" => request('n1_p2_name'), - "n1_p2_ocom" => request('n1_p2_ocom'), - "n1_p2_instructor" => request('n1_p2_instructor'), - "n1_p2_local" => request('n1_p2_local'), - "n1_p2_plandone" => request('n1_p2_plandone'), - "n2_p1_name" => request('n2_p1_name'), - "n2_p1_ocom" => request('n2_p1_ocom'), - "n2_p1_instructor" => request('n2_p1_instructor'), - "n2_p1_local" => request('n2_p1_local'), - "n2_p1_plandone" => request('n2_p1_plandone'), - "n2_p2_name" => request('n2_p2_name'), - "n2_p2_ocom" => request('n2_p2_ocom'), - "n2_p2_instructor" => request('n2_p2_instructor'), - "n2_p2_local" => request('n2_p2_local'), - "n2_p2_plandone" => request('n2_p2_plandone'), - "n3_p1_name" => request('n3_p1_name'), - "n3_p1_ocom" => request('n3_p1_ocom'), - "n3_p1_instructor" => request('n3_p1_instructor'), - "n3_p1_local" => request('n3_p1_local'), - "n3_p1_plandone" => request('n3_p1_plandone'), - "n3_p2_name" => request('n3_p2_name'), - "n3_p2_ocom" => request('n3_p2_ocom'), - "n3_p2_instructor" => request('n3_p2_instructor'), - "n3_p2_local" => request('n3_p2_local'), - "n3_p2_plandone" => request('n3_p2_plandone'), - ]; - } else { - $eventData = [ - "event_name" => request('event_name'), - "is_event_mandatory" => request('is_event_mandatory'), - "event_date" => request('event_date'), - "event_begin_time" => request('event_begin_time'), - "event_end_time" => request('event_end_time'), - "event_location" => request('event_location'), - "event_desc" => request('event_desc'), - ]; - } - - $schedule->data = $eventData; - - $schedule->save(); - - - $userToNotify = $schedule->getUserToNotify(); - \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->data['event_name']." à l'horaire le ".$schedule->date)); - } - return redirect('/admin/calendar'); - - } - - public function patch($id) - { - $schedule = Schedule::find($id); - $original = clone($schedule); - - $schedule->date = request('event_date'); - $schedule->type = request('event_type'); - - if(request('event_type') == "regular") - { - $eventData = [ - "event_name" => request('event_name'), - "is_event_mandatory" => request('is_event_mandatory'), - "event_date" => request('event_date'), - "event_begin_time" => request('event_begin_time'), - "event_end_time" => request('event_end_time'), - "event_location" => request('event_location'), - "event_desc" => request('event_desc'), - "n1_p1_name" => request('n1_p1_name'), - "n1_p1_ocom" => request('n1_p1_ocom'), - "n1_p1_instructor" => request('n1_p1_instructor'), - "n1_p1_local" => request('n1_p1_local'), - "n1_p1_plandone" => request('n1_p1_plandone'), - "n1_p2_name" => request('n1_p2_name'), - "n1_p2_ocom" => request('n1_p2_ocom'), - "n1_p2_instructor" => request('n1_p2_instructor'), - "n1_p2_local" => request('n1_p2_local'), - "n1_p2_plandone" => request('n1_p2_plandone'), - "n2_p1_name" => request('n2_p1_name'), - "n2_p1_ocom" => request('n2_p1_ocom'), - "n2_p1_instructor" => request('n2_p1_instructor'), - "n2_p1_local" => request('n2_p1_local'), - "n2_p1_plandone" => request('n2_p1_plandone'), - "n2_p2_name" => request('n2_p2_name'), - "n2_p2_ocom" => request('n2_p2_ocom'), - "n2_p2_instructor" => request('n2_p2_instructor'), - "n2_p2_local" => request('n2_p2_local'), - "n2_p2_plandone" => request('n2_p2_plandone'), - "n3_p1_name" => request('n3_p1_name'), - "n3_p1_ocom" => request('n3_p1_ocom'), - "n3_p1_instructor" => request('n3_p1_instructor'), - "n3_p1_local" => request('n3_p1_local'), - "n3_p1_plandone" => request('n3_p1_plandone'), - "n3_p2_name" => request('n3_p2_name'), - "n3_p2_ocom" => request('n3_p2_ocom'), - "n3_p2_instructor" => request('n3_p2_instructor'), - "n3_p2_local" => request('n3_p2_local'), - "n3_p2_plandone" => request('n3_p2_plandone'), - ]; - } else { - $eventData = [ - "event_name" => request('event_name'), - "is_event_mandatory" => request('is_event_mandatory'), - "event_date" => request('event_date'), - "event_begin_time" => request('event_begin_time'), - "event_end_time" => request('event_end_time'), - "event_location" => request('event_location'), - "event_desc" => request('event_desc'), - ]; - } - - $schedule->data = $eventData; - - $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 = ""; - 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)); - } - - - return redirect('/admin/calendar'); - - } - - public function delete() - { - $id = request('id'); - - $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)); - } - - - } - - 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; - } - - public function show() - { - $date = request('date'); - return view('admin.calendar.modal.show',['schedules' => \App\Schedule::all()->where('date',$date),'date' => $date]); + return view('admin.schedule.table.index',['events' => \App\Event::allThisYear()]); } } diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php index d020936b..81e62479 100644 --- a/app/Http/Controllers/UserController.php +++ b/app/Http/Controllers/UserController.php @@ -250,6 +250,22 @@ class UserController extends Controller return redirect('/admin/profil')->with('success', 'Modification enregistré'); } + public function UserTelephone() + { + return view('admin.user.profil.telephone'); + } + + public function editUserTelephone() + { + $user = \Auth::user(); + + $user->telephone = request('telephone'); + + $user->save(); + + return redirect('/admin/profil')->with('success', 'Modification enregistré'); + } + public function apiList() { $users = \App\User::all(); diff --git a/config/version.yml b/config/version.yml index 48ffa03a..dc5178ad 100644 --- a/config/version.yml +++ b/config/version.yml @@ -5,7 +5,7 @@ current: major: 3 minor: 2 patch: 5 - prerelease: 14-g039b09b6 + prerelease: 41-g465bac0e buildmetadata: '' commit: 41845 timestamp: diff --git a/public/css/custom.css b/public/css/custom.css index a648f115..e8c53df6 100644 --- a/public/css/custom.css +++ b/public/css/custom.css @@ -243,6 +243,19 @@ height: 3rem; overflow: hidden; } + +.schedule-table-ocom { + width: 200rem; +} + +.table-borderless > tbody > tr > td { + border: none !important; +} + +.schedule-table-week > td { + border: lightgrey 2px solid; +} + .autocomplete-items { position: absolute; border: 1px solid #d4d4d4; diff --git a/resources/custom.css b/resources/custom.css index a648f115..e8c53df6 100644 --- a/resources/custom.css +++ b/resources/custom.css @@ -243,6 +243,19 @@ height: 3rem; overflow: hidden; } + +.schedule-table-ocom { + width: 200rem; +} + +.table-borderless > tbody > tr > td { + border: none !important; +} + +.schedule-table-week > td { + border: lightgrey 2px solid; +} + .autocomplete-items { position: absolute; border: 1px solid #d4d4d4; diff --git a/resources/views/admin/calendar/calendar_display.blade.php b/resources/views/admin/calendar/calendar_display.blade.php index aa524fa2..92d5b4a3 100644 --- a/resources/views/admin/calendar/calendar_display.blade.php +++ b/resources/views/admin/calendar/calendar_display.blade.php @@ -1,6 +1,11 @@ @extends('layouts.admin.main') @section('content') +
diff --git a/resources/views/admin/configs/ranks/add.blade.php b/resources/views/admin/configs/ranks/add.blade.php index d4b4bd93..fd262bde 100644 --- a/resources/views/admin/configs/ranks/add.blade.php +++ b/resources/views/admin/configs/ranks/add.blade.php @@ -14,14 +14,14 @@
- + Nom du grade
- + Description du grade
diff --git a/resources/views/admin/job/edit.blade.php b/resources/views/admin/job/edit.blade.php index 811abfe0..e628e8fa 100644 --- a/resources/views/admin/job/edit.blade.php +++ b/resources/views/admin/job/edit.blade.php @@ -14,14 +14,14 @@
- + Nom du poste
- + Description du poste
diff --git a/resources/views/admin/schedule/table/index.blade.php b/resources/views/admin/schedule/table/index.blade.php new file mode 100644 index 00000000..4faa3a10 --- /dev/null +++ b/resources/views/admin/schedule/table/index.blade.php @@ -0,0 +1,131 @@ +@extends('layouts.admin.main') + +@section('content') + +
+
+
+

Horaire tableau

+
+
+
+ + + + + @for($i = 1;$i <= \App\Event::getMaxLevels($events); $i++) + + @endfor + + + + @for($i = 1;$i <= \App\Event::getMaxLevels($events); $i++) + + @endfor + + + @foreach($events as $event) + + + @for($n = 1;$n <= $event->nbNiveau();$n++) + + @endfor + + @endforeach +
+ Niveau {{$i}} +
+
+
+ Semaine +
+
+ Nom +
+
+ Date +
+
+ Période +
+
+
+
+
+ OCOM - Description +
+
+ Instructeur +
+
+ Salle +
+
+ Materiel +
+
+
+
+
+ 1 +
+
+ {{$event->name}} +
+
+ {{$event->date_begin}} +
+
+ @foreach($event->schedule["periodes"] as $periode) + + + + +
+ P{{$loop->iteration}} - {{ $periode['begin_time'] }} à {{ $periode['end_time'] }} +
+ @endforeach +
+
+
+ @for($p = 1;$p <= $event->nbPeriode();$p++) + + nbPeriode())class="border-bottom"@endif> + + +
+
+ @php($course = $event->course($p,$n)) +
+ @if(!$course->use_course()) + {{ $course->ocom }} - {{ $course->name }} + @else + {{ $course->desc }} + @endif +
+
+ {{ $course->instructor() }} +
+
+ {{ $course->location }} +
+
+ NA +
+ @php($course = null) +
+
+ @endfor +
+
+
+
+
+@endsection + +@section('custom_scripts') +@endsection diff --git a/resources/views/admin/user/profil.blade.php b/resources/views/admin/user/profil.blade.php index 6dd3b0c4..40d43ec1 100644 --- a/resources/views/admin/user/profil.blade.php +++ b/resources/views/admin/user/profil.blade.php @@ -43,18 +43,7 @@

Téléphone
- @if ($user->telephone != "Inconnu") - @php - $data = '+'.$user->telephone; - if(preg_match( '/^\+\d(\d{3})(\d{3})(\d{4})$/',$data,$matches)) - { - $result = $matches[1] . '-' .$matches[2] . '-' . $matches[3]; - echo $result; - } - @endphp - @else - Inconnu - @endif + {{ $user->telephone }}

@@ -96,7 +85,7 @@
Modifier mon mot de passe Modifier ma photo de profil - + Modifier mon numéro de téléphone Modifier mon adresse Déconnexion diff --git a/resources/views/admin/user/profil/telephone.blade.php b/resources/views/admin/user/profil/telephone.blade.php new file mode 100644 index 00000000..df7dc5e4 --- /dev/null +++ b/resources/views/admin/user/profil/telephone.blade.php @@ -0,0 +1,28 @@ +@extends('layouts.admin.main') + +@section('content') +
+
+
+ Modification de mon numéro de téléphone +
+
+
+ @csrf +
+ + +
+ +
+
+
+
+@endsection + +@section('custom_scripts') + +@endsection diff --git a/routes/breadcrumbs.php b/routes/breadcrumbs.php index a97a4334..4e79339e 100644 --- a/routes/breadcrumbs.php +++ b/routes/breadcrumbs.php @@ -37,6 +37,12 @@ Breadcrumbs::for('admin.schedule', function ($trail) { $trail->push('Horaire', route('admin.schedule')); }); +// Admin > Schedule > Table +Breadcrumbs::for('admin.schedule.tableview', function ($trail) { + $trail->parent('admin.schedule'); + $trail->push('Tableau', route('admin.schedule.tableview')); +}); + // Admin > Schedule > Add Breadcrumbs::for('admin.schedule.add', function ($trail,$date) { $trail->parent('admin.schedule'); @@ -269,6 +275,12 @@ Breadcrumbs::for('admin.profil.adress', function ($trail) { $trail->push('Adresse', route('admin.profil.adress')); }); +// Admin > Profil > Telephone +Breadcrumbs::for('admin.profil.telephone', function ($trail) { + $trail->parent('admin.profil'); + $trail->push('Téléphone', route('admin.profil.telephone')); +}); + // Admin > Profil > Password Breadcrumbs::for('admin.profil.psw', function ($trail) { $trail->parent('admin.profil'); @@ -281,7 +293,7 @@ Breadcrumbs::for('admin.profil.courses', function ($trail) { $trail->push('Mes cours', route('admin.profil.courses')); }); -// Admin > Profil > Adress +// Admin > Profil > Notification Breadcrumbs::for('admin.profil.notifications', function ($trail) { $trail->parent('admin.profil'); $trail->push('Mes notifications', route('admin.profil.notifications')); diff --git a/routes/web.php b/routes/web.php index 9e19820b..29469a89 100644 --- a/routes/web.php +++ b/routes/web.php @@ -48,6 +48,7 @@ Route::middleware(['auth', 'firstlogin'])->name('admin.')->group(function () { /** Schedule */ Route::get('/admin/schedule', 'CalendarController@index')->middleware('perm:schedule_see')->name('schedule'); + Route::get('/admin/schedule/table', 'CalendarController@indexTable')->middleware('perm:schedule_see')->name('schedule.tableview'); Route::get('/admin/schedule/pdf/event/{id}', 'ScheduleController@printtopdf')->middleware('perm:schedule_see')->name('schedule.pdf'); Route::get('/admin/schedule/add/{date}', 'ScheduleController@create')->middleware('perm:schedule_add')->name('schedule.add'); Route::get('/admin/schedule/edit/{id}', 'EventController@edit')->middleware('perm:schedule_edit')->name('schedule.edit'); @@ -165,8 +166,10 @@ Route::middleware(['auth', 'firstlogin'])->name('admin.')->group(function () { Route::get('/admin/profil/avatar', 'UserController@UserAvatar')->name('profil.avatar'); Route::get('/admin/profil/password', 'UserController@UserPassword')->name('profil.psw'); Route::get('/admin/profil/adress', 'UserController@UserAdress')->name('profil.adress'); + Route::get('/admin/profil/telephone', 'UserController@UserTelephone')->name('profil.telephone'); Route::get('/admin/profil/notifications', 'UserController@userNotification')->name('profil.notifications'); Route::post('/admin/profil/edit/adress', 'UserController@editUserAdress'); + Route::post('/admin/profil/edit/telephone', 'UserController@editUserTelephone'); Route::post('/admin/profil/edit/password', 'UserController@editUserPassword'); Route::get('/admin/profil/edit/avatar/{id}', 'UserController@editUserAvatar'); Route::get('/admin/profil/{id?}', 'UserController@showUserProfil')->name('profil');