Exemple #1
0
 public function doSMSearch(SMPlanSearchRequest $request)
 {
     $sm = $request->sm;
     $planSearchResult = [];
     $leaveRequestSearchResult = [];
     $from = $request->date_from;
     $to = $request->date_to;
     $allSearchedPlan = SMPlan::where('sm_id', $sm)->where('date', '>=', $from)->where('date', '<=', $to)->approved()->get();
     $allSearchLeaveRequest = SMLeaveRequest::where('sm_id', $sm)->where('date', '>=', $from)->where('date', '<=', $to)->approved()->get();
     foreach ($allSearchedPlan as $singleReport) {
         $planSearchResult[] = $singleReport;
     }
     foreach ($allSearchLeaveRequest as $singleLeaveRequest) {
         $leaveRequestSearchResult[] = $singleLeaveRequest;
     }
     $dataView = ['planSearchResult' => $planSearchResult, 'leaveRequestSearchResult' => $leaveRequestSearchResult];
     \Session::flash('emp', $sm);
     \Session::flash('date_from', $from);
     \Session::flash('date_to', $to);
     \Session::flash('planSearchResult', $planSearchResult);
     \Session::flash('leaveRequestSearchResult', $leaveRequestSearchResult);
     return view('admin.search.plans.result', $dataView);
 }
Exemple #2
0
 public function listAllLeaveRequests()
 {
     $leaveRequests = SMLeaveRequest::where('sm_id', \Auth::user()->id)->get();
     $dataView = ['leaveRequests' => $leaveRequests];
     return view('sm.leave_request.list', $dataView);
 }
Exemple #3
0
 public function doSearch(PlanSearchRequest $request)
 {
     $mrs[] = $request->mrs;
     $planSearchResult = [];
     $leaveRequestSearchResult = [];
     $from = $request->date_from;
     $to = $request->date_to;
     $allSearchedPlan = Plan::whereIn('mr_id', $mrs)->where('date', '>=', $from)->where('date', '<=', $to)->approved()->get();
     $allSearchLeaveRequest = SMLeaveRequest::whereIn('sm_id', $mrs)->where('date', '>=', $from)->where('date', '<=', $to)->approved()->get();
     foreach ($allSearchedPlan as $singleReport) {
         $planSearchResult[] = $singleReport;
     }
     foreach ($allSearchLeaveRequest as $singleLeaveRequest) {
         $leaveRequestSearchResult[] = $singleLeaveRequest;
     }
     $dataView = ['planSearchResult' => $planSearchResult, 'leaveRequestSearchResult' => $leaveRequestSearchResult];
     return view('sm.search.plans.result', $dataView);
 }
Exemple #4
0
 public function getSMPendingLeaveRequests()
 {
     $leaveRequests = SMLeaveRequest::pending()->get();
     return count($leaveRequests);
 }