コード例 #1
0
ファイル: PlanController.php プロジェクト: m-gamal/crm
 public function doCreate(CreatePlanRequest $request)
 {
     $plan = new SMPlan();
     $plan->sm_id = \Auth::user()->id;
     $plan->month = $request->month . '-' . $request->year;
     $plan->date = $request->date;
     $plan->doctors = json_encode($request->doctors);
     try {
         $plan->save();
         return redirect()->back()->with('message', 'Visit Plan has been sent to your managers successfully! . Wait for approval');
     } catch (ParseException $ex) {
         echo 'Failed to create new plan , with error message: ' . $ex->getMessage();
     }
 }
コード例 #2
0
ファイル: DashboardController.php プロジェクト: m-gamal/crm
 public function index()
 {
     $AMsIds = Employee::select('id')->where('manager_id', \Auth::user()->id)->get();
     $employees = Employee::select('line_id')->whereIn('manager_id', $AMsIds)->get();
     //am_session
     $products = Product::whereIn('line_id', $employees)->get();
     $employeesId = Employee::select('id')->whereIn('manager_id', $AMsIds)->get();
     $customers = Customer::whereIn('mr_id', $employeesId)->get();
     $MRs = Employee::whereIn('manager_id', $AMsIds)->get();
     $AMs = Employee::where('manager_id', \Auth::user()->id)->get();
     $dataView = ['productsCount' => count($products), 'plansCount' => SMPlan::where('month', \Config::get('app.current_month'))->count(), 'reportsCount' => SMReport::where('month', \Config::get('app.current_month'))->count(), 'customersCount' => count($customers), 'employeesCount' => count($MRs) + count($AMs)];
     return view('sm.index', $dataView);
 }
コード例 #3
0
ファイル: PlanController.php プロジェクト: m-gamal/crm
 public function declineSM($id)
 {
     $plan = SMPlan::findOrFail($id);
     $plan->approved = 0;
     try {
         $plan->save();
         return redirect()->back()->with('message', 'Plan has been decline successfully !');
     } catch (ParseException $ex) {
         echo 'Failed to approve plan , with error message: ' . $ex->getMessage();
     }
 }
コード例 #4
0
ファイル: AppServiceProvider.php プロジェクト: m-gamal/crm
 public function getSMPendingPlans()
 {
     $plans = SMPlan::pending()->get();
     return count($plans);
 }