コード例 #1
1
ファイル: MeetingMinutes.php プロジェクト: gfdeveloper/LCCB
 public function buildApprove($start, $end)
 {
     return Approval::select(['approvals.choice', 'approvals.comment', 'approvals.created_at', 'u.name AS approver', 'r.description AS description', 'approvals.request_id AS id'])->join('users AS u', 'u.id', '=', 'approvals.user_id')->join('requests AS r', 'r.id', '=', 'approvals.request_id')->whereBetween('approvals.created_at', [$start, $end])->get();
 }
コード例 #2
0
ファイル: LCCBController.php プロジェクト: gfdeveloper/LCCB
 public function edit($id)
 {
     $request = Request::with(['equipment', 'area', 'location', 'category', 'uploads', 'approvers', 'status', 'actions' => function ($query) {
         $query->orderBy('created_at', 'desc');
     }, 'actions.submitted', 'comments.author' => function ($query) {
         $query->orderBy('created_at', 'asc');
     }])->find($id);
     if (is_null($request)) {
         return view('security.not-found');
     }
     $data['request'] = $request;
     $data['areas'] = Area::all(['id', 'name']);
     $data['organizations'] = Organization::all();
     $data['categories'] = Category::all(['id', 'name']);
     $data['locations'] = Location::all(['id', 'name']);
     $data['approvers'] = Approval::getRecent($id);
     $data['hasApproved'] = Approval::hasApproved($id)->exists();
     if ($request->Status->name == 'Approved') {
         return view('request.view', $data);
     }
     if ($request->submitted_by != Auth::User()->id && !Auth::User()->hasRole(['administrator', 'approver'])) {
         return view('security.401');
     }
     return view('request.edit', $data);
 }
コード例 #3
0
 public function approvals($start, $end)
 {
     $columns = ['id', 'approved_offline'];
     $approvals = Approval::whereBetween('created_at', [$start, $end])->get($columns);
     if ($approvals->isEmpty()) {
         $json = ['status' => 'error', 'title' => 'Error', 'message' => 'No approvals found in this date range!'];
         return $json;
     }
     $offline = $online = 0;
     foreach ($approvals as $approval) {
         if ($approval['approved_offline']) {
             $offline++;
         } else {
             $online++;
         }
     }
     $chart = new Highchart();
     $chart->chart->height = "250";
     $chart->credits->enabled = false;
     $chart->title->text = "";
     $chart->plotOptions->pie->colors = array("#D4D4D4", "#8DB6CD");
     $data[] = array("Offline", $offline);
     $data[] = array("Online", $online);
     $chart->series[] = array('type' => "pie", 'name' => "Approvals", 'data' => $data);
     echo $chart->renderOptions();
 }
コード例 #4
0
ファイル: StatusComposer.php プロジェクト: alerj/edemocracia
 public function compose($view)
 {
     $proposals = Proposal::all();
     $proposals_count = $proposals->count();
     $approvals_count = Approval::all()->count();
     $users_count = User::all()->count();
     $not_responded_count = round($proposals->where('approved_by', null)->where('disapproved_by', null)->where('response', null)->count() / $proposals->count() * 100, 2);
     $view->with(compact('proposals_count'))->with(compact('approvals_count'))->with(compact('users_count'))->with(compact('not_responded_count'));
 }
コード例 #5
0
 public function revoke($id)
 {
     Approval::where('request_id', $id)->where('user_id', Auth::user()->id)->delete();
     $approvals = Approval::getRecent($id);
     $status = array('Approve' => 0, 'Reject' => 0);
     foreach ($approvals as $approval) {
         $status[$approval->choice]++;
     }
     $sub = \App\Request::find($id);
     $this->updateStatus($sub, $status);
     return response()->json(['status' => 'success']);
 }
コード例 #6
0
ファイル: SendFinalEmail.php プロジェクト: gfdeveloper/LCCB
 /**
  * Handle the event.
  *
  * @param  FinalStatusSubmitted  $event
  * @return void
  */
 public function handle(FinalStatusSubmitted $event)
 {
     $event->request->load('requester', 'equipment', 'area', 'location', 'category', 'uploads', 'comments');
     $users = User::emailList()->get();
     Mail::send('emails.finished', ['request' => $event->request, 'approvers' => Approval::getRecent($event->request->id)], function ($message) use($event, $users) {
         $message->from('*****@*****.**', 'LCCB Autobot');
         foreach ($users as $user) {
             $message->to($user->email);
         }
         $message->subject('Change Request Closed');
         foreach ($event->request->uploads as $file) {
             $message->attach('D:\\www\\lccb\\uploads\\lccbRequests\\' . $file->request_id . '\\' . $file->file_name);
         }
     });
 }
コード例 #7
0
ファイル: SneakController.php プロジェクト: gfdeveloper/LCCB
 public function updateStatues()
 {
     $approvedList = Approval::groupBy('request_id')->havingRaw("COUNT(*) > 1")->get();
     dd($approvedList);
 }
コード例 #8
0
ファイル: MonitorController.php プロジェクト: stiwarih/p4
 /**
  *
  */
 public function getDoDeleteApproval($id)
 {
     $approval = \App\Approval::find($id);
     if (is_null($approval)) {
         \Session::flash('flash_message', 'Approval not found.');
         return redirect('\\monitor');
     }
     $approval->delete();
     $code = \App\CodeEntry::find(\Session::get('code_id'));
     $code->approval_id = 0;
     $code->save();
     \Session::flash('flash_message', $approval->comments . ' was deleted.');
     return redirect('/monitor');
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $approval = Approval::where('id', $id)->delete();
 }
コード例 #10
0
ファイル: User.php プロジェクト: alerj/edemocracia
 public function getApprovalsCountAttribute()
 {
     return Approval::where('user_id', $this->id)->count();
 }