/**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(TeacherRequest $request)
 {
     if ($request->fonction == 'professeur' && !$request->admin) {
         $teacher = new Teacher();
         $teacher->nom_teacher = $request->nom_teacher;
         $teacher->date_naissance = $request->date_naissance;
         $teacher->poste = Matter::where('user_id', \Auth::user()->id)->where('id', $request->poste)->first()->nom_matiere;
         $teacher->fonction = $request->fonction;
         $teacher->sexe = $request->sexe;
         $teacher->nationalite = \DB::table('countries')->where('id', $request->nationalite)->first()->nom_fr_fr;
         $teacher->email = $request->email;
         $teacher->num_fix = $request->num_fix;
         $teacher->num_portable = $request->num_portable;
         $teacher->adresse = $request->adresse;
         $teacher->cin = $request->cin;
         $teacher->salaire = $request->salaire;
         $teacher->user_id = \Auth::user()->id;
         $teacher->save();
         if ($teacher) {
             $teacher->matters()->sync([$request->poste]);
         }
     } elseif ($request->fonction == 'rh' && !$request->admin) {
         $teacher = new Teacher();
         $teacher->nom_teacher = $request->nom_teacher;
         $teacher->date_naissance = $request->date_naissance;
         $teacher->poste = 'Ressources Humains';
         $teacher->fonction = $request->fonction;
         $teacher->sexe = $request->sexe;
         $teacher->email = $request->email;
         $teacher->num_fix = $request->num_fix;
         $teacher->num_portable = $request->num_portable;
         $teacher->nationalite = \DB::table('countries')->where('id', $request->nationalite)->first()->nom_fr_fr;
         $teacher->adresse = $request->adresse;
         $teacher->cin = $request->cin;
         $teacher->salaire = $request->salaire;
         $teacher->user_id = \Auth::user()->id;
         $teacher->save();
     } else {
         $teacher = new Teacher();
         $teacher->nom_teacher = $request->nom_teacher;
         $teacher->date_naissance = $request->date_naissance;
         $teacher->poste = 'Ressources Humains';
         $teacher->fonction = 'Administrateur';
         $teacher->sexe = $request->sexe;
         $teacher->email = $request->email;
         $teacher->num_fix = $request->num_fix;
         $teacher->num_portable = $request->num_portable;
         $teacher->nationalite = \DB::table('countries')->where('id', $request->nationalite)->first()->nom_fr_fr;
         $teacher->adresse = $request->adresse;
         $teacher->cin = $request->cin;
         $teacher->salaire = $request->salaire;
         $teacher->user_id = \Auth::user()->id;
         $teacher->save();
     }
     return redirect()->back()->with('success', "Les Informations Ont Bien été Enregistrés ! ");
 }
Beispiel #2
0
                            <th>Branche</th>
                        </tr>
                        </thead>
                        <tbody>
                        @foreach($plans as $plan)
                            @if($plan->matter_id !== 0)
                        <tr>
                            <td>{{ \App\Classroom::where('id',$plan->classroom_id)->first()->nom_classe }}</td>
                                <td>
                                    {{ \App\Matter::where('id',$plan->matter_id)
                                ->first()->nom_matiere }}
                                </td>
                            <td>

                               <?php 
$matiere = \App\Matter::where('id', $plan->matter_id)->first();
foreach ($matiere->lesteachers->unique() as $item) {
    echo $item->nom_teacher;
}
?>

                            </td>
                            <td>
                            {{ $plan->dayname }}
                            </td>

                            <td>{{ substr(\Carbon\Carbon::parse($plan->time)->toTimeString(),0,-3)  }}</td>
                            <td>
                                <?php 
$salle = \App\Timesheet::where('classroom_id', $plan->classroom_id)->where('time', $plan->time)->where('user_id', \Auth::user()->id)->where('color', '#525252')->where('dayname', $plan->dayname)->first();
if ($salle) {
 public function gestion()
 {
     $matter_count = Matter::where('user_id', \Auth::user()->id)->count();
     $branch_count = \Auth::user()->branches()->where('school_year_id', \App\SchoolYear::getSchoolYearId())->count();
     $level_count = \Auth::user()->leslevels()->where('school_year_id', \App\SchoolYear::getSchoolYearId())->count();
     $cr_count = Classroom::where('user_id', \Auth::user()->id)->CurrentYear()->count();
     $room_count = Room::where('user_id', \Auth::user()->id)->count();
     return view('statistics.gestion', compact('matter_count', 'branch_count', 'level_count', 'cr_count', 'room_count'));
 }
Beispiel #4
0
 public function trierparsalle()
 {
     if (\Request::ajax()) {
         $room_id = \Input::get('room_id');
         $plans = Timesheet::where('user_id', \Auth::user()->id)->CurrentYear()->where('matter_id', '!=', 0)->get();
         foreach ($plans as $plan) {
             $salle = Timesheet::where("classroom_id", $plan->classroom_id)->where("time", $plan->time)->where("user_id", \Auth::user()->id)->where("color", "#525252")->where("dayname", $plan->dayname)->CurrentYear()->first();
             if ($salle && $salle->room_id == $room_id) {
                 echo '<tr>';
                 echo '    <td> ' . Classroom::where('id', $plan->classroom_id)->CurrentYear()->first()->nom_classe . '</td>';
                 echo '  <td>
                                 ' . Matter::where('id', $plan->matter_id)->first()->nom_matiere . '
                             </td>';
                 echo '   <td>';
                 foreach (Matter::where('id', $plan->matter_id)->first()->lesteachers->unique() as $item) {
                     echo $item->nom_teacher;
                 }
                 echo '</td>';
                 echo '<td>';
                 echo $plan->dayname;
                 echo '</td>';
                 echo '<td>';
                 echo substr(Carbon::parse($plan->time)->toTimeString(), 0, -3);
                 echo '</td>';
                 echo '<td>';
                 $salle = Timesheet::where("classroom_id", $plan->classroom_id)->where("time", $plan->time)->where("user_id", \Auth::user()->id)->where("color", "#525252")->CurrentYear()->where("dayname", $plan->dayname)->first();
                 if ($salle) {
                     echo \Auth::user()->rooms()->where('id', $salle->room_id)->first()->nom_salle;
                 }
                 echo '</td>';
                 echo '<td>';
                 $classroom = Classroom::where('id', $plan->classroom_id)->CurrentYear()->first();
                 foreach ($classroom->lesNiveaux as $niveau) {
                     echo $niveau->niveau;
                 }
                 foreach ($classroom->levels as $niveau) {
                     echo $niveau->niveau;
                 }
                 echo '</td>';
                 echo '<td>';
                 $classroom = Classroom::where('id', $plan->classroom_id)->CurrentYear()->first();
                 if ($classroom->branches->isEmpty()) {
                     echo '--';
                 } else {
                     foreach ($classroom->branches as $br) {
                         echo $br->nom_branche;
                     }
                 }
                 echo '</td>';
                 echo ' </tr>';
             }
         }
     }
 }
 /**
  * Show the form for creating a new resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function create()
 {
     $matieres = Matter::where('user_id', \Auth::user()->id)->get();
     return view('classrooms.create', compact('matieres'));
 }
Beispiel #6
0
 public function supprimer()
 {
     if (\Request::ajax()) {
         $numbers = substr(\Input::get('boxes'), 0, -1);
         $ids = explode(',', $numbers);
         $ids = array_unique($ids);
         foreach ($ids as $id) {
             $b = Matter::where('user_id', \Auth::user()->id)->where('id', $id)->first();
             $b->delete();
         }
     }
 }