Exemple #1
0
 public function ajaxPlans()
 {
     $arr = array();
     $plans = AMPlan::where('am_id', \Auth::user()->id)->approved()->get();
     $leave = AMLeaveRequest::where('am_id', \Auth::user()->id)->approved()->get();
     $i = 0;
     foreach ($plans as $singlePlan) {
         foreach (json_decode($singlePlan['doctors']) as $singleDoctorId) {
             $color = $this->isDoctorVisited($singleDoctorId, $singlePlan['date']) == true ? 'green' : 'red';
             $url = $this->isDoctorVisited($singleDoctorId, $singlePlan['date']) != true ? \URL::route('amAddReport', $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);
 }
Exemple #2
0
 public function index()
 {
     $employees = Employee::select('line_id')->where('manager_id', \Auth::user()->id)->get();
     $products = Product::whereIn('line_id', $employees)->get();
     $employees = Employee::select('id')->where('manager_id', \Auth::user()->id)->get();
     $customers = Customer::whereIn('mr_id', $employees)->get();
     $employees = Employee::where('manager_id', \Auth::user()->id)->get();
     $dataView = ['productsCount' => count($products), 'plansCount' => AMPlan::where('month', \Config::get('app.current_month'))->count(), 'reportsCount' => AMReport::where('month', \Config::get('app.current_month'))->count(), 'customersCount' => count($customers), 'employeesCount' => count($employees)];
     return view('am.index', $dataView);
 }
Exemple #3
0
 public function doAMSearch(AMPlanSearchRequest $request)
 {
     $am = $request->am;
     $planSearchResult = [];
     $leaveRequestSearchResult = [];
     $from = $request->date_from;
     $to = $request->date_to;
     $allSearchedPlan = AMPlan::where('am_id', $am)->where('date', '>=', $from)->where('date', '<=', $to)->approved()->get();
     $allSearchLeaveRequest = AMLeaveRequest::where('am_id', $am)->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', $am);
     \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);
 }