public function updating(TaskType $taskType) { // check to see if the task_type.type exists. $result = $taskType->checkIfTypeExists($taskType); if ($result > 0) { session()->forget(appGlobals()->getInfoMessageType()); session()->flash(appGlobals()->getInfoMessageType(), appGlobals()->getInfoMessageText($result)); return false; } return true; }
/** * Show the form for creating a new resource. * * @return Response */ public function create() { $data['breadcrumbPages'] = [['name' => 'task', 'link' => route('task.index')], ['name' => 'create task']]; $data['taskTypes'] = TaskType::lists('name', 'id'); $data['taskMembers'] = $this->user->household->getHouseholdMembers($this->user->id); return view('members.tasks.create', $data); }
/** * Register any other events for your application. * * @param \Illuminate\Contracts\Events\Dispatcher $events * @return void */ public function boot(DispatcherContract $events) { parent::boot($events); // register the ProjectObserver class. Client::observe(new ClientObserver()); // register the ProjectObserver class. Project::observe(new ProjectObserver()); // register the WorkTypeObserver class. WorkType::observe(new WorkTypeObserver()); // register the TimeCardFormatObserver class. TimeCardFormat::observe(new TimeCardFormatObserver()); // register the WorkObserver class. Work::observe(new WorkObserver()); // register the TimeCardObserver class. TimeCard::observe(new TimeCardObserver()); // register the TimeCardHoursWorkedObserver class. TimeCardHoursWorked::observe(new TimeCardHoursWorkedObserver()); // register the TaskTypeObserver class. TaskType::observe(new TaskTypeObserver()); // register the TaskObserver class. Task::observe(new TaskObserver()); }
public function add() { $activeTab = Input::get('task_type_id') ? Input::get('task_type_id') : '1'; $task_types = TaskType::all(); $saleTypes = SaleType::all(); $user = Auth::user(); $point = intval(Input::get('point')); $task = Task::findOrFail(Input::get('task_id')); $pointAudit = new PointAudit(); $pointAudit->point = $point * $task->value; $pointAudit->user_id = $user->id; $pointAudit->company_id = $user->company_id; $pointAudit->date = new \DateTime(); $pointAudit->task_id = $task->id; $pointAudit->save(); $pointID = $user->id . date("mdY"); $pointEntity = Point::find($pointID); if ($pointEntity != null) { $pointEntity->points = $pointEntity->points + $point * $task->value; $pointEntity->update(); } else { $pointEntity = new Point(); $pointEntity->id = $pointID; $pointEntity->month = date("m"); $pointEntity->year = date("Y"); $pointEntity->user_id = $user->id; $pointEntity->company_id = $user->company_id; $pointEntity->points = $point * $task->value; $pointEntity->save(); } $message = 'You have ' . ($pointAudit->point > 0 ? 'added' : 'adjusted') . ' <strong> ' . intval($point) . ' points</strong> to <strong>' . $task->name . '</strong>.'; $today_total = $this->getTodaysStats(); $today_target = 140; $isErr = false; return view('myStat.add', compact('user', 'today_total', 'task_types', 'tasks', 'activeTab', 'isErr', 'message', 'today_target', 'saleTypes')); }
/** * @param $id * * @return \Illuminate\Http\RedirectResponse */ public function destroy($id) { TaskType::destroy($id); return redirect()->back(); }
$myArray['SAT'] = 10.0; $description = 'Day of week starts on SAT and ends on SUN'; $timeCardFormat = TimeCardFormat::where('description', '=', $description)->first(); for ($j = 0; $j < appGlobals::DAYS_IN_WEEK_NUM; $j++) { $pos = $timeCardFormat->{"dow_0" . $j}; echo "For {$pos} the hours worked are: " . $myArray[$pos] . "<br>"; } }); Route::get('task_fail', function () { $startTime = '17:00:00'; $endTime = '12:00:00'; $hoursWorked = 5.0; $notes = "error testing"; if (is_null($task = Task::checkIfExists($startTime))) { // get $taskType->id $taskType = TaskType::where('type', '=', 'Code')->first(); // get $timeCard->id $timeCard = TimeCard::where('date_worked', '=', '2015-11-12')->first(); $task = new Task(); $task->start_time = $startTime; $task->end_time = $endTime; $task->hours_worked = $hoursWorked; $task->notes = $notes; $task->task_type_id = $taskType->id; $task->time_card_id = $timeCard->id; try { $task->save(); } catch (QueryException $e) { if ($e->getCode() == appGlobals::TBL_TASK_START_TIME_GT_END_TIME) { appGlobals::reportError($e, __FILE__, __LINE__); }
/** * Run the database seeds. * * @return void */ public function run() { foreach ($this->types as $name) { TaskType::create(['name' => $name]); } }
/** * updateRec() tests * - attribute description changed. * * @test */ public function POS_it_checks_updateRec_att_description_changed() { // create the record to check $description = 'was here'; $taskType = new TaskType(); $taskType->setType('Bob'); $taskType->setDescription($description); $taskType->created_at = Carbon::now(); $taskType->updated_at = Carbon::now(); $taskType->client_id = 1; $taskType->save(); // create the changed record $changeDescription = 'sorry bob is no longer here'; $stdClass = new \stdClass(); $stdClass->id = $taskType->id; $stdClass->type = $taskType->getType(); $stdClass->desc = $changeDescription; $stdClass->client_id = $taskType->client_id; $taskType->updateRec($stdClass); $result = $taskType::where('id', $taskType->getId())->first(); $this->assertEquals($result->getDescription(), $changeDescription); }
public function open(Project $project) { $tasktype = TaskType::orderBy('typename')->where('project_id', $project->id)->lists('typename', 'typename'); //dd($tasktype); return view('projects.open', compact('project', 'tasktype')); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy(Project $project, TaskType $tasktype) { $tasktype->delete(); return Redirect::route('projects.open', $project->slug)->with('message', 'Task Type deleted.'); }