示例#1
0
 protected function portalUpdateTimesheet() {
     
     $authUserId = \Auth::id();
     
     $authEmployee = Employee::where('userId','=',$authUserId)->first();
     
     $empId = $authEmployee->id;
     
     $timesheet = Timesheet::where('empId','=',$empId)->first();
     
     $sun = Input::get('sunday');
     $mon = Input::get('monday');
     $tues = Input::get('tuesday');
     $wed = Input::get('wednesday');
     $thurs = Input::get('thursday');
     $fri = Input::get('friday');
     $sat = Input::get('saturday');
     $total = $sun + $mon + $tues + $wed + $thurs + $fri + $sat;
     
     $timesheet->sunday = $sun;
     $timesheet->monday = $mon;
     $timesheet->tuesday = $tues;
     $timesheet->wednesday = $wed;
     $timesheet->thursday = $thurs;
     $timesheet->friday = $fri;
     $timesheet->saturday = $sat;
     $timesheet->total = $total;
     $timesheet->updated_at = gmdate("Y-m-d H:i:s");
     
     $timesheet->save();
     
     return Redirect::to('/portal-timesheet');
 }
示例#2
0
                               <?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) {
    echo \Auth::user()->rooms()->where('id', $salle->room_id)->first()->nom_salle;
}
?>


                            </td>

                            <td>
                                <?php 
$classroom = \App\Classroom::where('id', $plan->classroom_id)->first();
foreach ($classroom->lesNiveaux as $niveau) {
    echo $niveau->niveau;
}
foreach ($classroom->levels as $niveau) {
示例#3
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>';
             }
         }
     }
 }
示例#4
0
 public function del()
 {
     if (\Request::ajax()) {
         $id = \Input::get('id');
         $ok = Timesheet::where('user_id', \Auth::user()->id)->where('id', $id)->first();
         $ok->delete();
     }
 }
示例#5
0
 public function showef($id)
 {
     $ts = Timesheet::where('classroom_id', $id)->first();
     return view('classrooms.showef', compact('ts'));
 }
示例#6
0
    protected function portalResetTimesheet($id) {
        
        if ( \Auth::user() ) {
            
            $userTypeID = \Auth::user()->userTypeId;
            
            if ( $userTypeID == 1 ) {
                
                $authUserId = \Auth::id();
        
                $authEmployee = Employee::where('userId','=',$authUserId)->first();

                $empId = $id;
                $timesheet =  Timesheet::where('empId','=',$empId)->first();

                $timesheet->sunday = 0;
                $timesheet->monday = 0;
                $timesheet->tuesday = 0;
                $timesheet->wednesday = 0;
                $timesheet->thursday = 0;
                $timesheet->friday = 0;
                $timesheet->saturday = 0;
                $timesheet->total = 0;

                $timesheet->save();

                return Redirect::to('/portal-emp-timesheets/' . $empId);
                
            } else if ( $userTypeID == 2 ) {
              
                return Redirect::to('/portal-settings');
                
            } else {

                return Redirect::to('/account');

            }
            
        } else {
            
            return Redirect::to('/');
            
        }
        
    }