コード例 #1
0
ファイル: PlanController.php プロジェクト: m-gamal/crm
 public function ajaxPlans()
 {
     $arr = array();
     $plans = SMPlan::where('sm_id', \Auth::user()->id)->approved()->get();
     $leave = SMLeaveRequest::where('sm_id', \Auth::user()->id)->approved()->get();
     $i = 0;
     foreach ($plans as $singlePlan) {
         foreach ((array) json_decode($singlePlan['doctors']) as $singleDoctorId) {
             $color = $this->isDoctorVisited($singleDoctorId, $singlePlan['date']) == true ? 'green' : 'red';
             $url = $this->isDoctorVisited($singleDoctorId, $singlePlan['date']) != true ? \URL::route('smAddReport', $singleDoctorId) : NULL;
             $arr[$i]['url'] = $url;
             $arr[$i]['title'] = Customer::findOrFail($singleDoctorId)->name;
             $arr[$i]['start'] = $singlePlan['date'];
             $arr[$i]['color'] = $color;
             $i++;
         }
     }
     foreach ($leave as $singleLeave) {
         $arr[$i]['title'] = 'Holiday';
         $arr[$i]['start'] = $singleLeave['leave_start'];
         $arr[$i]['end'] = date('Y-m-d', strtotime($singleLeave['leave_end'] . "+1 days"));
         $arr[$i]['color'] = '#9b59b6';
         $arr[$i]['allDay'] = true;
         $i++;
     }
     return json_encode($arr);
 }
コード例 #2
0
ファイル: PlanController.php プロジェクト: m-gamal/crm
 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);
 }
コード例 #3
0
ファイル: ReportController.php プロジェクト: m-gamal/crm
 public function listAllLeaveRequests()
 {
     $leaveRequests = SMLeaveRequest::where('sm_id', \Auth::user()->id)->get();
     $dataView = ['leaveRequests' => $leaveRequests];
     return view('sm.leave_request.list', $dataView);
 }