public function delMember($id)
 {
     if (!Auth::check()) {
         return redirect("/");
     }
     $memberID = \Input::get('memberID');
     $member = Membermanagement::find($memberID);
     $member->active = 1;
     $member->save();
     $board = Board::find($id);
     $boardManager = $board->manager_id;
     $MemMa = Membermanagement::where('User_id', '=', $boardManager)->where('Board_id', '=', $id)->get();
     $cards = Card::where('MemberManagement_id', '=', $member->id)->get();
     foreach ($cards as $card) {
         $card->MemberManagement_id = $MemMa[0]->id;
         $card->save();
     }
     return redirect("member/{$id}");
 }
Example #2
0
 public static function get_cardpayouts($project_id, $status = false)
 {
     $cardpayouts = Card::where('project_id', $project_id);
     if ($status) {
         $cardpayouts->where('status', $status);
     }
     return $cardpayouts->count();
 }
Example #3
0
 public function addNewCommentMoveAllBack($id)
 {
     if (!Auth::check()) {
         return redirect("/");
     }
     $newComment = new Comment();
     $newComment->detail = "(แก้ไข)(" . Input::get('before') . "  To  " . Input::get('before') . ") " . Input::get('detail');
     $newComment->edit_status = 1;
     $newComment->Card_id = $id;
     $newComment->User_id = Auth::user()->id;
     $newComment->save();
     $card = Card::find($id);
     $card->type_id = 2;
     $card->status_complete = 0;
     $card->save();
     $card->Board_id;
     $getAllCards = Card::where('Board_id', '=', $card->Board_id)->get();
     foreach ($getAllCards as $getCard) {
         if ($getCard->status_id != 1 && $getCard->id != $id) {
             $getCard->status_id = 1;
             $getCard->type_id = 2;
             $getCard->save();
             $newComment = new Comment();
             $newComment->detail = "(แก้ไข โดย " . $card->name . ")(" . Input::get('before') . "  To  " . Input::get('before') . ") " . Input::get('detail');
             $newComment->edit_status = 1;
             $newComment->Card_id = $getCard->id;
             $newComment->User_id = Auth::user()->id;
             $newComment->save();
         }
     }
 }
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     $data['project'] = $project = Project::get_project($id);
     $data['colors'] = array('red', 'yellow', 'aqua', 'blue', 'light-blue', 'green', 'navy', 'teal', 'olive', 'lime', 'orange', 'fuchsia', 'purple', 'maroon', 'black', 'red-active', 'yellow-active', 'aqua-active', 'blue-active', 'light-blue-active', 'green-active', 'navy-active', 'teal-active', 'olive-active', 'lime-active', 'orange-active', 'fuchsia-active', 'purple-active', 'maroon-active', 'black-active');
     if ($project) {
         $data['goals'] = Project::get_goals($id);
         $data['campgoals'] = Project::get_camp_goals($id);
         $data['plancampgoals'] = Project::get_camp_planned_goals($id);
         $data['cards'] = Card::where('project_id', $id)->get();
         $data['timelines'] = Timeline::getFinalTimeline($id, 1);
         return view('projects.view', $data);
     } else {
         Session::flash($this->danger, Lang::get('ruban.project.notfound'));
         return Redirect::route('ruban.projects.index');
     }
 }
Example #5
0
 public function index(Card $card)
 {
     $cards = $card->where('type', '!=', 'Land')->get();
     $this->setJavascriptData(compact('cards'));
 }
Example #6
0
 public function hardDeleteBoard($id)
 {
     if (!Auth::check()) {
         return redirect("/");
     }
     if (Auth::user()->Level_id == 1) {
         return redirect('/managementAccount');
     }
     $data = Board::find($id);
     if (Auth::user()->id != $data->manager_id) {
         return redirect("/");
     }
     $cards = Card::where('Board_id', '=', $id)->get();
     $ids = [];
     foreach ($cards as $cards) {
         $ids[] = $cards['id'];
     }
     Checklist::whereIn('Card_id', $ids)->delete();
     Comment::whereIn('Card_id', $ids)->delete();
     Card::where('Board_id', '=', $id)->whereNotNull('child_id')->delete();
     Card::where('Board_id', '=', $id)->delete();
     Membermanagement::where('Board_id', '=', $id)->delete();
     $data->delete();
     return redirect('/home');
 }
 /**
  * static function to read the xls and store
  *
  * @param  int  $id
  * @return Response*/
 public static function import_xls($pathname, $card_id = false, $camp_id = false)
 {
     Excel::load($pathname, function ($reader) use($card_id, $camp_id) {
         // Getting all results
         $results = $reader->get();
         $cnt = 1;
         foreach ($results as $result) {
             //checking existing Ditrict in db
             if ($cnt < 6) {
                 if ($card_id) {
                     $exitdist = Card::where('id', $card_id)->first();
                 } else {
                     $exitdist = Card::where('name', $result->card)->first();
                 }
                 if ($camp_id) {
                     $camp = Camp::where('id', $camp_id)->first();
                 } else {
                     $camp = Camp::where('name', $result->camp)->first();
                 }
                 $save['card_id'] = @$exitdist->id;
                 $save['camp_id'] = @$camp->id;
                 $save['title'] = $result->title;
                 $save['description'] = ' Order Id :' . $result->order_id . ', Ship date:' . $result->ship_date;
                 $save['added_by'] = Auth::user()->id;
                 $save['status'] = $result->status;
                 $save['order_amount'] = $result->order_amount;
                 $save['actual_time_to_deliver'] = $result->actual_time_to_deliver;
                 $save['payment_method'] = $result->payment_method;
                 $save['address_type'] = $result->address_type;
                 $save['address'] = ' Customer_name:' . $result->customer_name . ', Status:' . $result->status . ', City:' . $result->city . ', District' . $result->district . ', Province' . $result->province . ', Customer Phone' . $result->customer_phone;
                 Task::create($save);
                 if (@$camp->title) {
                     $timeline['description'] = Auth::user()->first_name . ' ' . Auth::user()->last_name . ' has imported the task for <a href="javascript:;">' . $camp->title . '</a>';
                     $timeline['object_type'] = 6;
                     $timeline['object_id'] = $camp->id;
                     Timeline::create($timeline);
                 }
                 if (@$exitdist->name) {
                     $timeline['description'] = Auth::user()->first_name . ' ' . Auth::user()->last_name . ' has imported the task for <a href="javascript:;">' . @$exitdist->name . '</a>';
                     $timeline['object_type'] = 6;
                     $timeline['object_id'] = $exitdist->id;
                     Timeline::create($timeline);
                 }
                 unset($save);
             }
             $cnt++;
         }
     });
 }