public function editCompany($id) { $user_id = Session::get('user_id'); $param['member'] = MembersModel::find($user_id); if ($alert = Session::get('alert')) { $param['alert'] = $alert; } $param['type'] = TypeModel::whereRaw(true)->orderBy('type', 'asc')->get(); $param['people'] = PeopleModel::whereRaw(true)->orderBy('firstName', 'asc')->get(); $param['company'] = CompanyModel::all(); $param['companyItem'] = CompanyModel::find($id); return View::make('user.company.edit')->with($param); }
public function delete($id) { try { $list = ProjectModel::whereRaw('peopleId = ?', array($id))->get(); for ($i = 0; $i < count($list); $i++) { QuoteModel::whereRaw('projectId = ?', array($list[$i]->id))->delete(); } ProjectModel::whereRaw('peopleId = ?', array($id))->delete(); PeopleModel::find($id)->delete(); $alert['msg'] = 'This contact has been deleted successfully'; $alert['type'] = 'success'; } catch (\Exception $ex) { $alert['msg'] = 'This contact focus has been already used'; $alert['type'] = 'danger'; } return Redirect::route('admin.contact')->with('alert', $alert); }
public function quote($peopleId, $projectId, $quoteId) { if ($alert = Session::get('alert')) { $param['alert'] = $alert; } $user_id = Session::get('user_id'); $param['member'] = MembersModel::find($user_id); $param['people'] = PeopleModel::find($peopleId); $param['project'] = ProjectModel::find($projectId); $param['quote'] = QuoteModel::whereRaw('projectId = ? ', array($projectId))->get(); $param['members'] = Members::whereRaw(true)->orderBy('first_name', 'asc')->get(); $param['payment'] = PaymentModel::whereRaw(true)->orderBy('payment', 'asc')->get(); $param['quoteItem'] = QuoteModel::find($quoteId); return View::make('user.project.quoteEdit')->with($param); }
public function getContact() { if (Request::ajax()) { $searchContactName = Input::get('searchContactName'); if ($searchContactName == "") { $resultList = PeopleModel::all(); } else { $resultList = PeopleModel::where('titleName', 'like', '%' . $searchContactName . '%')->orWhere('firstName', 'like', '%' . $searchContactName . '%')->orWhere('firstName', 'like', '%' . $searchContactName . '%')->orWhere('middleName', 'like', '%' . $searchContactName . '%')->orWhere('lastName', 'like', '%' . $searchContactName . '%')->orWhere('companyName', 'like', '%' . $searchContactName . '%')->orWhere('email', 'like', '%' . $searchContactName . '%')->orWhere('phone', 'like', '%' . $searchContactName . '%')->orWhere('mobile', 'like', '%' . $searchContactName . '%')->orWhere('fax', 'like', '%' . $searchContactName . '%')->get(); } if (count($resultList) > 0) { $list = ''; for ($i = 0; $i < count($resultList); $i++) { $list .= ' <div class="col-md-12"> <div class="panel panel-blue margin-bottom-40"> <div class="panel-heading"> <h3 class="panel-title">'; $list .= '<a href="' . URL::route("user.contact.main", $resultList[$i]->id) . '" style="cursor: pointer"> [ Edit ] </a>'; $list .= $resultList[$i]->firstName; if ($resultList[$i]->lastName) { $list .= ", " . $resultList[$i]->lastName; } if ($resultList[$i]->companyName) { $list .= ", " . $resultList[$i]->companyName; } if ($resultList[$i]->email) { $list .= ", " . $resultList[$i]->email; } if ($resultList[$i]->phone) { $list .= ", " . $resultList[$i]->phone; } if ($resultList[$i]->mobile) { $list .= ", " . $resultList[$i]->mobile; } $list .= ' </h3> </div> </div> </div>'; } return Response::json(['result' => 'success', 'list' => $list]); } else { $message = " You don't have contact for your search."; return Response::json(['result' => 'empty', 'message' => $message]); } } }