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 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 main($id) { if ($alert = Session::get('alert')) { $param['alert'] = $alert; } $user_id = Session::get('user_id'); $param['member'] = MembersModel::find($user_id); $param['people'] = PeopleModel::find($id); $param['category'] = CategoryModel::whereRaw(true)->orderBy('category', 'asc')->get(); $param['industry'] = IndustryModel::whereRaw(true)->orderBy('industry', 'asc')->get(); $param['tags'] = TagsModel::whereRaw(true)->orderBy('tags', 'asc')->get(); $param['company'] = CompanyModel::whereRaw(true)->orderBy('companyName', 'asc')->get(); $param['type'] = TypeModel::whereRaw(true)->orderBy('type', 'asc')->get(); $param['selectTags'] = TagPeopleModel::whereRaw('peopleId =?', array($id))->get(); $param['members'] = MembersModel::whereRaw(true)->orderBy('first_name', 'asc')->get(); /****note base*******/ $param['noteType'] = NoteTypeModel::whereRaw(true)->orderBy('notesType', 'asc')->get(); $param['noteCommType'] = NoteCommTypeModel::whereRaw(true)->orderBy('noteCommType', 'asc')->get(); $param['noteAssign'] = NoteAssignModel::whereRaw(true)->orderBy('noteAssign', 'asc')->get(); $param['noteStatus'] = NoteStatusModel::whereRaw(true)->orderBy('notesStatus', 'asc')->get(); $param['noteTypeDetails'] = NoteTypeDetailsModel::whereRaw(true)->orderBy('noteTypeDetails', 'asc')->get(); /****note ***/ $param['note'] = NoteModel::whereRaw('peopleId=?', array($id))->get(); /******Projects****/ $param['project'] = ProjectModel::whereRaw('peopleId =?', array($id))->get(); $projectIDs = ProjectModel::whereRaw('peopleId =?', array($id))->get(); $k = 0; $listQuote = array(); for ($i = 0; $i < count($projectIDs); $i++) { $quotes = QuoteModel::whereRaw('projectId = ?', array($projectIDs[$i]->id))->get(); for ($j = 0; $j < count($quotes); $j++) { $listQuote[$k] = $quotes[$j]; $k++; } } $param['listQuote'] = $listQuote; $param['pageNo'] = "4"; $peopleId = $id; $note = NoteModel::whereRaw('peopleId=?', array($peopleId))->get(); $list = ""; for ($i = 0; $i < count($note); $i++) { $list .= '<div class="col-md-12 margin-bottom-10 forest-change-note-header">'; if (strtoupper($note[$i]->noteCommType->noteCommType) == "PHONE") { $list .= '<div class="panel panel-blue margin-bottom-20">'; } else { if (strtoupper($note[$i]->noteCommType->noteCommType) == "EMAIL") { $list .= '<div class="panel panel-green margin-bottom-20">'; } } $list .= '<div class="panel-heading forest-panel-heading-note">'; $list .= '<h3 class="panel-title forest-panel-title-note">'; if (strtoupper($note[$i]->noteCommType->noteCommType) == "PHONE") { $list .= '<img src="/images/Modern-Phone-icon.jpg" style="width:30px; height:30px;">'; } else { if (strtoupper($note[$i]->noteCommType->noteCommType) == "EMAIL") { $list .= '<img src="/images/Email.png" style="width:30px; height:30px;">'; } } $list .= '<a href = "javascript:void(0)" onclick = "onEditNoteChange(' . $note[$i]->id . ')">Edit</a>'; $list .= '<span>(' . ucfirst($note[$i]->noteType->notesType) . ')</span>'; $list .= '<span>(' . substr($note[$i]->updated_at, 0, 16) . ')</span>'; $list .= '<span>(' . ucfirst($note[$i]->noteStatus->notesStatus) . ')</span>'; $list .= ' </h3> </div> <div class="panel-body">'; $list .= $note[$i]->notes; $list .= ' </div> </div> </div>'; } $param['list'] = $list; return View::make('user.contact.main')->with($param); }