/**
  * Show the form for editing the specified resource.
  *
  * @param  int      $id
  * @return Response
  */
 public function edit(TaskRequest $request)
 {
     $this->checkTimezone();
     $task = $request->entity();
     $actions = [];
     if ($task->invoice) {
         $actions[] = ['url' => URL::to("invoices/{$task->invoice->public_id}/edit"), 'label' => trans("texts.view_invoice")];
     } else {
         $actions[] = ['url' => 'javascript:submitAction("invoice")', 'label' => trans("texts.invoice_task")];
         // check for any open invoices
         $invoices = $task->client_id ? $this->invoiceRepo->findOpenInvoices($task->client_id) : [];
         foreach ($invoices as $invoice) {
             $actions[] = ['url' => 'javascript:submitAction("add_to_invoice", ' . $invoice->public_id . ')', 'label' => trans("texts.add_to_invoice", ["invoice" => $invoice->invoice_number])];
         }
     }
     $actions[] = DropdownButton::DIVIDER;
     if (!$task->trashed()) {
         $actions[] = ['url' => 'javascript:submitAction("archive")', 'label' => trans('texts.archive_task')];
         $actions[] = ['url' => 'javascript:onDeleteClick()', 'label' => trans('texts.delete_task')];
     } else {
         $actions[] = ['url' => 'javascript:submitAction("restore")', 'label' => trans('texts.restore_task')];
     }
     $data = ['task' => $task, 'clientPublicId' => $task->client ? $task->client->public_id : 0, 'method' => 'PUT', 'url' => 'tasks/' . $task->public_id, 'title' => trans('texts.edit_task'), 'duration' => $task->is_running ? $task->getCurrentDuration() : $task->getDuration(), 'actions' => $actions, 'timezone' => Auth::user()->account->timezone ? Auth::user()->account->timezone->name : DEFAULT_TIMEZONE, 'datetimeFormat' => Auth::user()->account->getMomentDateTimeFormat()];
     $data = array_merge($data, self::getViewModel());
     return View::make('tasks.edit', $data);
 }
Esempio n. 2
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(TaskRequest $request)
 {
     $task = new Task($request->all());
     $task->save();
     alert()->success('Enorabuena', 'La Tarea ' . $task->name . ' a sido de forma exitosa');
     return redirect()->route('tasks.index');
 }
Esempio n. 3
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(TaskRequest $request)
 {
     $request->merge(['user_id' => Sentinel::getUser()->id]);
     $task = new Task($request->except('_token'));
     $task->save();
     return $task->id;
 }
Esempio n. 4
0
 /**
  * Update the specified resource in storage via ajax.
  */
 public function update(TaskRequest $request, $id)
 {
     if ($request->ajax()) {
         $task = Task::findOrFail($id);
         $task->update($request->all());
         return $task;
     }
     return view('errors.404');
 }
Esempio n. 5
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Requests\TaskRequest $request)
 {
     $task = new Task();
     $task->fill($request->all());
     $task->created_by = Auth::user()->id;
     if ($task->save()) {
         return redirect('/task/all')->with('success', 'Task created succssfully');
     } else {
         return redirect('/project')->with('error', 'A problem occured, please try again later!');
     }
 }
Esempio n. 6
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Requests\TaskRequest $request)
 {
     $task = \App\Task::firstOrNew(['node_id' => $request->get('node_id'), 'user_id' => \Auth::user()->id]);
     $task->intervall = \Carbon\Carbon::createFromFormat('H:i', $request->get('intervall'))->toDateTimeString();
     $task->active = 0;
     if ($request->get('smsalarm')) {
         $task->smsalarm = $request->get('smsalarm') == 'on' ? 1 : 0;
     }
     $task->save();
     return $this->index();
 }
Esempio n. 7
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(TaskRequest $request)
 {
     //
     if ($request->hasFile('attachment')) {
         $data = $request->except(['_token', 'attachment']);
         $task = Task::create($data);
         $date = Carbon::now()->format('Y_m_d');
         $path = base_path() . '/up/TASK/' . $date;
         $ext = $request->file('attachment')->getClientOriginalExtension();
         $filename = "TASK_INIT" . Carbon::now()->timestamp . "." . $ext;
         $request->file('attachment')->move($path, $filename);
         $tasklog['task_id'] = $task->id;
         $tasklog['step_id'] = $task->step_id;
         $tasklog['attachment'] = $path . "/" . $filename;
         TaskLog::create($tasklog);
     }
     return back();
 }
Esempio n. 8
0
 public function update($id, TaskRequest $request)
 {
     $task = Task::findOrFail($id);
     $task->name_en = $request->input('name_en');
     $task->name_bn = $request->input('name_bn');
     $task->component_id = $request->input('component_id');
     $task->module_id = $request->input('module_id');
     $task->route = $request->input('route');
     $task->icon = $request->input('icon');
     $task->description = $request->input('description');
     $task->ordering = $request->input('ordering');
     $task->updated_by = Auth::user()->id;
     $task->updated_at = time();
     $task->update();
     Session()->flash('flash_message', 'Task has been updated!');
     return redirect('tasks');
 }
Esempio n. 9
0
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @param  TaskRequest  $request
  * @return Response
  */
 public function update($id, TaskRequest $request)
 {
     $task = Task::findOrFail($id);
     $task->completed = $request->input('completed');
     $task->content = $request->input('content');
     $task->priority = $request->input('priority');
     $task->location = $request->input('location');
     $task->time = $request->input('time');
     $task->completed = $request->input('completed');
     $task->save();
     return response()->json();
 }
Esempio n. 10
0
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update(TaskRequest $request, $id)
 {
     $task = Task::findOrFail($id);
     $task->update($request->all());
     return redirect('tasks');
 }
Esempio n. 11
0
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update(TaskRequest $request, $id)
 {
     $timeline['action'] = 'update';
     $camp = Task::findOrFail($id);
     $input = $request->all();
     if ($camp->status != $input['status']) {
         $timeline['description'] = '<a href="javascript:;">' . Auth::user()->first_name . ' ' . Auth::user()->last_name . '</a> changed the ' . $camp->title . ' task status to ' . $input['status'] . '.';
     } else {
         $timeline['description'] = '<a href="javascript:;">' . $camp->title . '</a> task has been updated by ' . Auth::user()->first_name . ' ' . Auth::user()->last_name . '.';
     }
     $input['updated_by'] = Auth::user()->id;
     $camp->fill($input);
     $camp->save();
     Session::flash($this->success, Lang::get('ruban.task.updated'));
     $timeline['object_type'] = 6;
     $timeline['object_id'] = $id;
     Timeline::create($timeline);
     return Redirect::route('ruban.tasks.index');
 }
Esempio n. 12
0
 /**
  * Se dispara el evento de que la tarea se ha asignado cuando haya un cambio de responsable
  *
  * @param TaskRequest $request
  * @param Task $task
  * @param User $oldResponsible
  */
 private function notifyToNewResponsible(TaskRequest $request, Task $task, User $oldResponsible)
 {
     if ($oldResponsible->id != $request->input('responsible_id')) {
         event(new TaskWasAssigned($task, $this->user));
         Log::info("Tarea Actualizada", ['task' => $task->name, 'responsible' => $task->responsible->name]);
     }
 }
Esempio n. 13
0
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(TaskRequest $request, $id)
 {
     $task = $this->taskRepo->update($id, $request->all());
     Flash('Updated Task');
     return Redirect()->route('clients.edit', $task->client->id);
 }
Esempio n. 14
0
 /**
  * create a Task
  * @param  TaskRequest $request
  * @return task               created task Object
  */
 private function createTask(TaskRequest $request)
 {
     $task = Auth::user()->tasks()->create($request->all());
     if ($request->input('tag_list')) {
         $this->syncTags($task, $request->input('tag_list'));
     }
     return $task;
 }
Esempio n. 15
0
 public function postCreate(TaskRequest $request)
 {
     $this->task->create($request->all());
     return redirect()->back()->with('success', 'Task created');
 }
 /**
  * Update the specified resource in storage.
  *
  * @param Task $task
  * @param TaskRequest $taskRequest
  * @return Response
  */
 public function update(Task $task, TaskRequest $taskRequest)
 {
     $task->update($taskRequest->input());
     return redirect()->route('tasks.show', $task->id);
 }
Esempio n. 17
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(TaskRequest $request)
 {
     $request->user()->tasks()->create($request->all());
     return redirect('/task')->with('success', 'Tarea creada correctamente :3');
 }