public function getcamp() { $equipmenttypes = Camp::where($this->card_id, Input::get('id'))->orderby('name', 'asc')->lists('name', 'id'); $out = '<option value="">Select Option</option>'; if ($equipmenttypes) { foreach ($equipmenttypes as $key => $equipmenttype) { $out .= '<option value="' . $key . '">' . $equipmenttype . '</option>'; } } echo $out; }
/** * Display the specified resource. * * @param int $id * @return Response */ public function show($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'); $data['card'] = $card = Card::get_card_result($id); if ($card) { $data['project'] = Project::find($card->project_id); $data['goals'] = Project::get_goals($card->project_id); $data['campgoals'] = Card::get_campgoals($id); $data['plannedcampgoals'] = Card::get_panned_campgoals($id); $data['partner'] = Card::get_partner($id, $card->sector_id); $data['partners'] = Card::get_partners($id, $card->sector_id); $data['camps'] = Camp::where('card_id', $id)->get()->toArray(); $data['selectedpartner'] = PartnerCards::where('card_id', $id)->first(); $data['cardtimelines'] = Timeline::getFinalCardTimeline($id, 2); $data['campcreatebtn'] = Permission::hasPermission('camps.create'); $data['campeditbtn'] = Permission::hasPermission('camps.edit'); $data['campdeletebtn'] = Permission::hasPermission('camps.delete'); $data['campimportbtn'] = Permission::hasPermission('camps.import'); $data['taskimportbtn'] = Permission::hasPermission('tasks.import'); $data['taskeditbtn'] = Permission::hasPermission('tasks.edit'); $data['taskcreatebtn'] = Permission::hasPermission('tasks.create'); $data['taskdeletebtn'] = Permission::hasPermission('tasks.delete'); $data['tasklistbtn'] = Permission::hasPermission('tasks.index'); $data['campviewbtn'] = Permission::hasPermission('camps.show'); $data['tasks'] = Task::all(); return view('cards.view', $data); } else { Session::flash('danger', Lang::get('ruban.card.notfound')); return Redirect::route('ruban.cards.index'); } }
public static function get_camppayouts($card_id, $status = false) { $camppayouts = Camp::where('card_id', $card_id); if ($status) { $camppayouts->where('status', $status); } return $camppayouts->count(); }
/** * 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++; } }); }