示例#1
0
 /**
  * Update a specific note. Besides notes id, the user_id has to match, if it
  * doesn't, throw not found exception
  *
  * @param array request input
  * @param int   note's id
  *
  * @return App\Model\Note
  */
 public function update($input, $id)
 {
     $user = $this->container->get('currentUser');
     $note = Note::where('id', $id)->where('user_id', $user->userId)->firstOrFail();
     $note->body = $input['body'];
     $note->save();
     return $note;
 }
示例#2
0
 public function run()
 {
     $user = User::where('username', 'paul')->first();
     Note::create(['body' => 'First note', 'user_id' => $user->id]);
     Note::create(['body' => 'Second note', 'user_id' => $user->id]);
     $user = User::where('username', 'john')->first();
     Note::create(['body' => 'Third note', 'user_id' => $user->id]);
     Note::create(['body' => 'Fourth note', 'user_id' => $user->id]);
 }
 public function delete($id)
 {
     try {
         NoteModel::find($id)->delete();
         $alert['msg'] = 'This note  has been deleted successfully';
         $alert['type'] = 'success';
     } catch (\Exception $ex) {
         $alert['msg'] = 'This note   focus has been already used';
         $alert['type'] = 'danger';
     }
     return Redirect::route('admin.note')->with('alert', $alert);
 }
示例#4
0
 /**
  * Delete a single note if specified its id or delete all if no id is
  * passed in the request
  *
  * @param  \Psr\Http\Message\ServerRequestInterface $request  PSR7 request
  * @param  \Psr\Http\Message\ResponseInterface      $response PSR7 response
  * @param  callable                                 $next     Next middleware
  *
  * @return \Psr\Http\Message\ResponseInterface
  */
 public function dispatch(Request $request, Response $response, $args)
 {
     $user = $this->container->get('currentUser');
     $id = isset($args['id']) ? (int) $args['id'] : null;
     if ($id) {
         Note::destroy($id);
     } else {
         Note::where('user_id', $user->userId)->delete();
     }
     $response = $response->withStatus(204);
     return $response;
 }
示例#5
0
 public function dispatch(Request $request, Response $response, $args)
 {
     $user = $this->container->get('currentUser');
     $id = isset($args['id']) ? (int) $args['id'] : null;
     $notes = [];
     if ($id) {
         $note = Note::where('id', $id)->where('user_id', $user->userId)->firstOrFail();
         $notes = [$note];
     } else {
         $notes = User::findOrFail($user->userId)->notes;
     }
     return $response->write(json_encode(['message' => 'List of Notes', 'data' => $notes]));
 }
 public function project($peopleId, $projectId)
 {
     if ($alert = Session::get('alert')) {
         $param['alert'] = $alert;
     }
     $param['pageNo'] = 61;
     $param['people'] = PeopleModel::find($peopleId);
     $param['project'] = ProjectModel::find($projectId);
     $param['projectZone'] = ProjectZoneModel::whereRaw('projectId =?', array($projectId))->get();
     $param['quote'] = QuoteModel::whereRaw('projectId =?', array($projectId))->get();
     $param['note'] = NoteModel::whereRaw('peopleId=?', array($peopleId))->get();
     $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" >';
             }
         }
         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.project')->with($param);
 }
 public function project($peopleId, $projectId)
 {
     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['pageNo'] = 7;
     $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();
     $param['projectType'] = ProjectTypeModel::whereRaw(true)->orderBy('type', 'asc')->get();
     $param['unit'] = UnitModel::whereRaw(true)->orderBy('unit', 'asc')->get();
     $param['velocityUnit'] = VelocityUnitModel::whereRaw(true)->orderBy('unit', 'asc')->get();
     $param['tempUnit'] = TempUnitModel::whereRaw(true)->orderBy('unit', 'asc')->get();
     $param['members'] = MembersModel::whereRaw(true)->orderBy('first_name', 'asc')->get();
     $note = NoteModel::whereRaw('peopleId=?', array($peopleId))->get();
     $param['project'] = ProjectModel::find($projectId);
     $param['note'] = $note;
     $param['projectZone'] = ProjectZoneModel::whereRaw('projectId =?', array($projectId))->get();
     $param['quote'] = QuoteModel::whereRaw('projectId =?', array($projectId))->get();
     $list = "";
     for ($i = 0; $i < count($note); $i++) {
         $list .= '<div class="col-md-12 margin-bottom-20 forest-change-note-header">';
         if (strtoupper($note[$i]->noteCommType->noteCommType) == "PHONE") {
             $list .= '<div class="panel panel-blue margin-bottom-40">';
         } else {
             if (strtoupper($note[$i]->noteCommType->noteCommType) == "EMAIL") {
                 $list .= '<div class="panel panel-green margin-bottom-40">';
             }
         }
         $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.project.editQuote')->with($param);
 }
 public function searchNoteContent()
 {
     if (Request::ajax()) {
         $noteID = Input::get('id');
         $note = NoteModel::findOrNew($noteID);
         return Response::json(['result' => 'success', 'note' => $note]);
     }
 }