/** * Display the specified resource. * GET /policies/{id} * * @param int $id * @return Response */ public function show() { $leavecount = LeaveCounter::where('employee_id', Auth::user()->employee_id)->first(); $profile = UserDetails::where('employee_id', Auth::user()->employee_id)->first(); $policies = AdminPolicies::orderBy('created_at', 'desc')->get(); return View::make('dashboard.policies')->with('profile', $profile)->with('policies', $policies)->with('countleave', $leavecount)->with('title', 'STI | School Policies'); }
public function show_announce($id) { $post_comment = AnnouncementComments::where('post_id', $id)->orderBy('created_at', 'desc')->get(); $leavecount = LeaveCounter::where('employee_id', Auth::user()->employee_id)->first(); $announce = Announcements::with('user')->where('post_id', $id)->orderBy('created_at', 'desc')->first(); $profile = UserDetails::where('employee_id', '=', Auth::user()->employee_id)->first(); $recentleave = LeaveWPay::with('user')->where('employee_id', Auth::user()->employee_id)->orderBy('created_at', 'desc')->get(); $recentwleave = LeaveWOPay::with('user')->where('employee_id', Auth::user()->employee_id)->orderBy('created_at', 'desc')->get(); return View::make('dashboard.announcement')->with('post', $announce)->with('post_comment', $post_comment)->with('profile', $profile)->with('countleave', $leavecount)->with('rleave', $recentleave)->with('sleave', $recentwleave)->with('title', 'STI | Show Announcement'); }
/** * Display a listing of the resource. * GET /notification * * @return Response */ public function index() { $leavelog = UserLeaveLog::with('user')->where('employee_id', Auth::user()->employee_id)->orderBy('created_at', 'desc')->get(); $leaveoblog = LeaveOB::with('user')->where('employee_id', Auth::user()->employee_id)->orderBy('created_at', 'desc')->get(); $leavecount = LeaveCounter::where('employee_id', Auth::user()->employee_id)->first(); $profile = UserDetails::where('employee_id', '=', Auth::user()->employee_id)->first(); $recentleave = LeaveWPay::with('user')->where('employee_id', Auth::user()->employee_id)->orderBy('created_at', 'desc')->get(); $recentwleave = LeaveWOPay::with('user')->where('employee_id', Auth::user()->employee_id)->orderBy('created_at', 'desc')->get(); $obleave = LeaveOB::with('user')->where('employee_id', Auth::user()->employee_id)->orderBy('created_at', 'desc')->get(); $awtleave = LeaveAWT::with('user')->where('employee_id', Auth::user()->employee_id)->orderBy('created_at', 'desc')->get(); return View::make('dashboard.notification_box')->with('profile', $profile)->with('leavelog', $leavelog)->with('rleave', $recentleave)->with('sleave', $recentwleave)->with('leaveob', $leaveoblog)->with('leaveawt', $awtleave)->with('countleave', $leavecount)->with('obleave', $obleave)->with('title', 'STI | Notification Box'); }
/** * Show the form for editing the specified resource. * GET /leavewopay/{id}/edit * * @param int $id * @return Response */ public function edit($id) { // $validate = LeaveWPay::validate(Input::all()); if ($validate->passes()) { $count = LeaveCounter::where('employee_id', $id)->first(); if (Input::get('totalleaves') < 0 or Input::get('totalleaves') === 'NaN') { $message = 'Please select correct date!'; return Redirect::to('leavewopay')->with('error_message', $message); } elseif (Input::get('totalleaves') <= '0.0') { $message = 'Date and time not allowed.Please try again.'; return Redirect::to('leavewopay')->with('error_message', $message); } elseif (Input::get('totalleaves') > 10) { $message = 'You rich maximum limit of leave!'; return Redirect::to('leavewopay')->with('error_message', $message); } elseif (Input::get('totalleaves') > $count->remaining_leave_wopay) { $message = 'Insufficient number of leave!'; return Redirect::to('leavewopay')->with('error_message', $message); } else { $leavecount = LeaveCounter::where('employee_id', $id)->first(); $leavecount->remaining_leave_wopay = $leavecount->remaining_leave_wopay - Input::get('totalleaves'); $leavecount->save(); $lastrow = LeaveWOPay::orderBy('created_at', 'desc')->first(); $userdata = new LeaveWOPay(); $userdata->employee_id = Auth::user()->employee_id; if ($lastrow == null) { $userdata->leave_id = Str::random(30); } else { $userdata->leave_id = Str::random(30) . $lastrow->id; } $userdata->days_of_leave = Input::get('totalleaves'); $userdata->wdays_of_leave = Input::get('totalleave'); $userdata->date_from = Input::get('date_from'); $userdata->time_from = Input::get('time_from'); $userdata->date_to = Input::get('date_to'); $userdata->time_to = Input::get('time_to'); $userdata->reason = Input::get('reason'); $userdata->save(); return Redirect::to('leavewopay')->with('message', 'Your Application for leave is successfully send.Please Check Your Notification box to see if your leave has been approved.'); } } else { return Redirect::to('leavewopay')->withErrors($validate); } }
public function ob_log($id) { $leavecount = LeaveCounter::where('employee_id', Auth::user()->employee_id)->first(); $leaveob = LeaveOB::where('leave_id', $id)->first(); $profile = UserDetails::where('employee_id', Auth::user()->employee_id)->first(); $rleave = LeaveOB::where('employee_id', Auth::user()->employee_id)->orderBy('created_at', 'desc')->get(); return View::make('dashboard.leave_oblog')->with('profile', $profile)->with('countleave', $leavecount)->with('getleave', $leaveob)->with('rleave', $rleave)->with('title', 'STI | OB Log'); }
public function post_leave($id) { $validate = LeaveCounter::validate(Input::all()); if ($validate->passes()) { $updateleave = LeaveCounter::where('employee_id', $id)->first(); $updateleave->remaining_leave = Input::get('withpay'); $updateleave->remaining_leave_wopay = Input::get('withoutpay'); $updateleave->save(); return Redirect::to('u_leave/' . $id)->with('message', 'The number of leave has been successfully updated!'); } else { return Redirect::to('u_leave/' . $id)->withErrors($validate); } }