Esempio n. 1
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     if (Request::ajax() && array_key_exists('HTTP_X_PJAX', $_SERVER) && $_SERVER['HTTP_X_PJAX']) {
         return response()->view('backend.category');
     } else {
         if (Request::ajax()) {
             $search = Request::input('search', '');
             $sort = Request::input('sort');
             $order = Request::input('order');
             $limit = Request::input('limit');
             $offset = Request::input('offset');
             //			\DB::enableQueryLog();
             $searcher = Category::whereRaw('1=1');
             trim($search) != '' && $searcher->whereRaw('concat(name,desc) like \'%' . $search . '%\'');
             $total = $searcher->count();
             isset($offset) && isset($limit) && $searcher->skip($offset)->take($limit);
             isset($sort) && isset($order) && $searcher->orderBy($sort, $order);
             $data = $searcher->get();
             return ['total' => $total, 'rows' => $data];
         }
     }
     return response('错误的列表', 404);
 }
 public function view($id)
 {
     if ($alert = Session::get('alert')) {
         $param['alert'] = $alert;
     }
     $param['pageNo'] = 61;
     $param['people'] = PeopleModel::find($id);
     $param['selectTags'] = TagPeopleModel::whereRaw('peopleId =?', array($id))->get();
     $param['project'] = ProjectModel::whereRaw('peopleId = ?', array($id))->get();
     $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();
     $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['note'] = NoteModel::whereRaw('peopleId=?', array($id))->get();
     $note = NoteModel::whereRaw('peopleId=?', array($id))->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" >';
             }
         }
         if (strtoupper($note[$i]->noteCommType->noteCommType) == "PHONE") {
             $list .= '<div class="panel-heading forest-panel-heading-note" style="background: #3498db; ">';
         } else {
             if (strtoupper($note[$i]->noteCommType->noteCommType) == "EMAIL") {
                 $list .= '<div class="panel-heading forest-panel-heading-note" style="background: #2ecc71;">';
             }
         }
         $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 .= '<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('admin.contact.detail')->with($param);
 }
 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);
 }