public function edit($id) { $user = User::find($id); // список должностей для передачи в select формы $positions = Position::all(); return view('user.edit', ['user' => $user, 'positions' => $positions]); }
/** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit($id) { $player = Player::find($id); $seasons = Season::all(); $positions = Position::all(); $countries = Country::all(); return view('admin.players.edit', compact('player', $player, 'seasons', $seasons, 'positions', $positions, 'countries', $countries)); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $positions = \App\Position::all(); $response = array(); foreach ($positions as $position) { $response[] = array('lat' => $position->latitud, 'lon' => $position->longitud, 'title' => $position->title, 'icon' => $position->icon, 'description' => $position->description); } return response()->json($response); }
/** * return json list position */ public function listposition() { $position = Position::all(); $response = array(); $number = 1; foreach ($position as $key => $value) { $item = array("id" => $number++, "name" => $value->name, "description" => $value->description); array_push($response, $item); } return json_encode($response); }
/** * Display list devices * * @return Response */ public function index() { $devices = Device::all(); $position = Position::all(); foreach ($devices as $key => $value) { $value->device_name = $value->kind_device->device_name; $value->contract_number = $value->infomation_device->contract_number; $value->os_name = $value->operating_system->os_name; } return view('devices.listdevice', compact('devices', 'position')); }
/** * Show Cv information * * @param int $id * @return Response */ public function show($id) { $positions = Position::all(); $employee = Employee::find($id); $educations = Education::where('employee_id', '=', $employee->id)->get(); $employee_skills = EmployeeSkill::where('employee_id', '=', $employee->id)->get(); $experiences = WorkingExperience::where('employee_id', '=', $employee->id)->get(); $taken_projects = TakenProject::where('employee_id', '=', $employee->id)->get(); $nationalities = Nationality::all(); $category_skill = CategorySkill::all(); return view('printpreview.printpreview', compact('taken_projects', 'position', 'employee_skills', 'nationalities', 'employee', 'educations', 'experiences', 'category_skill')); }
/** * Show and Export CV information * * @param [int] $id * @return Response */ public function show($id) { $positions = Position::all(); $employee = Employee::find($id); $educations = Education::where('employee_id', '=', $employee->id)->get(); $employee_skills = EmployeeSkill::where('employee_id', '=', $employee->id)->get(); $experiences = WorkingExperience::where('employee_id', '=', $employee->id)->get(); $taken_projects = TakenProject::where('employee_id', '=', $employee->id)->get(); $nationalities = Nationality::all(); $category_skill = CategorySkill::all(); $parameterr = array(); $parameter['employee'] = $employee; $parameter['educations'] = $educations; $parameter['category_skill'] = $category_skill; $parameter['employee_skills'] = $employee_skills; $parameter['taken_projects'] = $taken_projects; $parameter['experiences'] = $experiences; $parameter['nationalities'] = $nationalities; $pdf = \PDF::loadView('welcome', $parameter)->setPaper('a4')->setOrientation('landscape')->setWarnings(false); return $pdf->download('cv.pdf'); }
/** * Show the form for creating a new resource. * * @return \Illuminate\Http\Response */ public function create() { $position_list = Position::all()->lists('position', 'id')->toArray(); return view('pages.add-duty', compact('position_list')); }
/** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit($id) { $position = Position::all(); // if is Leader // if staff edit != dev or yourself => denied if (Gate::allows('check-leader')) { $staff = Staff::find($id)->level->role; if ($staff->name != "Developer" && $id != Auth::user()->id) { return redirect()->route('admin.staff.index')->with('message', 'Access is denied'); } else { $level = Level::where('role_id', 4)->get(); $department = Department::where('id', Auth::user()->department_id)->where('active', 1)->get()->first(); } } else { if (Gate::allows('check-admin')) { $staff = Staff::find($id)->level->role; if ($staff->name == "Developer" && $id != Auth::user()->id) { return redirect()->route('admin.staff.index')->with('message', 'Access is denied'); } else { $department = Department::where('active', 1)->get(); $level = Level::where(['role_id' => 2, 'active' => 1])->orWhere(['role_id' => 3, 'active' => 1])->get(); } } else { if (Gate::allows('check-manager')) { $staff = Staff::find($id)->level->role; if ($staff->name == "Manager" && $id != Auth::user()->id) { return redirect()->route('admin.staff.index')->with('message', 'Access is denied'); } else { $level = Level::where('role_id', 3)->orWhere('role_id', 4)->get(); if ($id == Auth::user()->id) { $department = ''; } $department = Department::where('active', 1)->get(); } } else { $staff_id = Auth::user()->id; if ($staff_id != $id) { return redirect()->route('admin.staff.index')->with('message', 'Access is denied'); } else { $position = Position::where('id', Auth::user()->position_id)->where('active', 1)->get(); $level = Level::where('id', Auth::user()->level_id)->where('active', 1)->get(); $department = Department::where('id', Auth::user()->department_id)->where('active', 1)->get()->first(); } } } } if ($id == Auth::user()->id) { $check_account = 1; } else { $check_account = 0; } $staff = Staff::find($id); return view('admin.staff.update', compact('id', 'staff', 'position', 'level', 'department', 'check_account')); }
/** * Filter info in overview device * @return void */ public function filter() { $type_id = Input::get('type_device'); $model_id = Input::get('model_device'); $kind_id = Input::get('kind_device'); $status_id = Input::get('status_device'); $os_id = Input::get('os_device'); $contract_id = Input::get('contract_number'); $position = Position::all(); $types = TypeDevice::all(); $models = ModelDevice::all(); $kinds = KindDevice::all(); $statuses = StatusDevice::all(); $os = OperatingSystem::all(); $contract = InformationDevice::all(); /*Thuc hien cau truy van de lay du lieu sau khi filter*/ $devices = Device::whereHas('kind_device', function ($query) use($type_id) { if ($type_id) { $query->whereHas('model_device', function ($query) use($type_id) { $query->whereHas('type_devices', function ($query) use($type_id) { $query->where('id', '=', $type_id); }); }); } })->whereHas('kind_device', function ($query) use($model_id) { if ($model_id) { $query->whereHas('model_device', function ($query) use($model_id) { $query->where('id', '=', $model_id); }); } })->whereHas('kind_device', function ($query) use($kind_id) { if ($kind_id) { $query->where('id', '=', $kind_id); } })->whereHas('status_devices', function ($query) use($status_id) { if ($status_id) { $query->where('id', '=', $status_id); } })->whereHas('operating_system', function ($query) use($os_id) { if ($os_id) { $query->where('id', '=', $os_id); } })->whereHas('infomation_device', function ($query) use($contract_id) { if ($contract_id) { $query->where('id', '=', $contract_id); } })->get(); foreach ($devices as $key => $value) { $value->device_name = $value->kind_device->device_name; $value->status = $value->status_devices->status; $employee = $value->employee; if ($employee) { $value->employee_code = $employee->employee_code; $value->fullname = $employee->lastname . " " . $employee->firstname; $value->employee_position = $employee->departments['name']; } else { $value->employee_code = ""; $value->fullname = ""; $value->employee_position = ""; } } echo json_encode($devices); }
public function index() { $position = Position::all(); return view('admin.position.list', compact('position')); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $positions = \App\Position::all(); return $positions; }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $positions = Position::all(); return view('admin.positions.index', compact('positions', $positions)); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $positions = Position::all(); return view('pages.index-career', compact('positions')); }
/** * Store a newly profile * * @param [int] $id * @return Response */ public function store(AddEditEmployeeRequest $request) { $positions = Position::all(); $employee = Auth::user()->employee()->get()->first(); $img = Request::get('imageup'); $requestdata = Request::all(); $requestdata['date_of_birth'] = $this->convert_datepicker_to_datetimesql(Request::input('dateofbirth')); if ($img != "") { $requestdata['avatar'] = 'avatar/' . $requestdata['avatar']; $img = str_replace('data:image/png;base64,', '', $img); $img = str_replace(' ', '+', $img); $data = base64_decode($img); $file = public_path() . "/avatar/" . Request::input('avatar'); $bytes_written = File::put($file, $data); } else { $requestdata['avatar'] = $requestdata['avatar_save']; } $employee->update($requestdata); $educations = Education::where('employee_id', '=', $employee->id)->get(); $employee->date_of_birth = $this->convert_datepicker_to_datetimesql($employee->date_of_birth); foreach ($educations as $k_edu => $k_val) { $yearstart = Request::input('edu_yearstart' . $k_val->id); if ($yearstart == null) { Education::destroy($k_val->id); continue; } $yearend = Request::input('edu_yearend' . $k_val->id); $education = Request::input('edu_education' . $k_val->id); $edu = Education::find($k_val->id); $edu->update(['year_start' => $yearstart, 'year_end' => $yearend, 'education' => $education]); } $yearstart_new = Request::input('edu_yearstart'); $yearend_new = Request::input('edu_yearend'); $education_new = Request::input('edu_education'); if ($yearstart_new != null && $yearstart_new[0] != "") { foreach ($yearstart_new as $k_n => $v_n) { $user = Education::create(array('employee_id' => $employee->id, 'year_start' => $yearstart_new[$k_n], 'year_end' => $yearend_new[$k_n], 'education' => $education_new[$k_n])); } } $educations = Education::where('employee_id', '=', $employee->id)->get(); $nationalities = Nationality::all(); $working_experience = WorkingExperience::where('employee_id', '=', $employee->id)->delete(); $company = Request::input('company'); $startdate = Request::input('startdate'); $enddate = Request::input('enddate'); $position = Request::input('position'); $mainduties = Request::input('mainduties'); if (!empty($startdate)) { foreach ($startdate as $key => $value) { $startdate[$key] = $this->convert_datepicker_to_datetimesql($value); } foreach ($enddate as $key => $value) { $enddate[$key] = $this->convert_datepicker_to_datetimesql($value); } } if (!empty($company)) { foreach ($company as $key => $value) { if ($value == "") { continue; } $companys = WorkingExperience::create(array('employee_id' => $employee->id, 'company' => $value, 'year_start' => $startdate[$key], 'year_end' => $enddate[$key], 'position' => $position[$key], 'main_duties' => $mainduties[$key])); } } $taken_project = TakenProject::where('employee_id', '=', $employee->id)->delete(); $projectname = Request::input('projectname'); $customername = Request::input('customername'); $role = Request::input('role'); $numberpeople = Request::input('numberpeople'); $projectdescription = Request::input('projectdescription'); $projectperiod = Request::input('projectperiod'); $skillset = Request::input('skillset'); if (!empty($projectname)) { foreach ($projectname as $key => $value) { if ($value == "") { continue; } //dd($numberpeople[$key]); $projects = TakenProject::create(array('employee_id' => $employee->id, 'project_name' => $value, 'customer_name' => $customername[$key], 'number_people' => $numberpeople[$key], 'role' => $role[$key], 'project_description' => $projectdescription[$key], 'project_period' => $projectperiod[$key], 'skill_set_ultilized' => $skillset[$key])); } } $skill = array(); $experience = array(); $skill = Request::input('skill'); $experience = Request::input('month_experience'); EmployeeSkill::where("employee_id", "=", $employee->id)->delete(); foreach ($skill as $key => $value) { if ($value < 0) { unset($experience[$key]); unset($skill[$key]); } else { if ($experience[$key] < 0) { $experience[$key] = 0; } $employeeskill = EmployeeSkill::create(array("employee_id" => $employee->id, "skill_id" => $value, "month_experience" => $experience[$key])); } } $request->session()->flash('flagMessage', 'true'); return redirect()->route('profiles.index'); }
/** * Filter employee * @return [type] [description] */ public function filter() { $positions = Input::get('position'); $nationalities = Input::get('nationality'); $genders = Input::get('gender'); $birthdays = Input::get('birthday'); /*Thuc hien cau truy van de lay du lieu ra ben ngoai*/ $query = Employee::where('position_id', 'LIKE', "%{$positions}")->where('nationality', 'LIKE', "%{$nationalities}%")->where('gender', 'LIKE', "%{$genders}%")->where('date_of_birth', 'LIKE', "%{$birthdays}%")->get(); /*Tra ve view list employee*/ $results = array(); foreach ($query as $key => $value) { $results[] = $value; } $employees = $results; foreach ($employees as $key => $value) { $employees[$key]->position_name = Position::find($value->position_id)->name; $employees[$key]->national_name = Nationality::find($value->nationality)->name; } $positions = Position::all(); $nationalities = Nationality::all(); return view('employee.listemployee', compact('employees', 'positions', 'nationalities')); }
/** * Bootstrap any application services. * * @return void */ public function boot() { if (\Schema::hasTable('positions')) { $positions = Position::all(); $selectPositions = array(); $selectPositions[0] = "Select / All"; foreach ($positions as $position) { $selectPositions[$position->slug] = $position->name; } \View::share('selectPositions', $selectPositions); } if (\Schema::hasTable('cases_priorities')) { $priorities = CasePriority::all(); $selectPriorities = array(); $selectPriorities[0] = "Select / All"; foreach ($priorities as $priority) { $selectPriorities[$priority->slug] = $priority->name; } \View::share('selectPriorities', $selectPriorities); } if (\Schema::hasTable('titles')) { $titles = Title::all(); $selectTitles = array(); $selectTitles[0] = "Select / All"; foreach ($titles as $title) { $selectTitles[$title->slug] = $title->name; } \View::share('selectTitles', $selectTitles); } if (\Schema::hasTable('languages')) { $languages = Language::all(); $selectLanguages = array(); $selectLanguages[0] = "Select / All"; foreach ($languages as $language) { $selectLanguages[$language->slug] = $language->name; } \View::share('selectLanguages', $selectLanguages); } if (\Schema::hasTable('departments')) { $departments = Department::all(); $selectDepartments = array(); $selectDepartments[0] = "Select / All"; foreach ($departments as $department) { $selectDepartments[$department->slug] = $department->name; } \View::share('selectDepartments', $selectDepartments); } if (\Schema::hasTable('users_roles')) { $roles = UserRole::all(); $selectRoles = array(); $selectRoles[0] = "Select / All"; foreach ($roles as $role) { $selectRoles[$role->slug] = $role->name; } \View::share('selectRoles', $selectRoles); } if (\Schema::hasTable('provinces')) { $provinces = Province::all(); $selectProvinces = array(); $selectProvinces[0] = "Select / All"; foreach ($provinces as $Province) { $selectProvinces[$Province->slug] = $Province->name; } \View::share('selectProvinces', $selectProvinces); } if (\Schema::hasTable('districts')) { $districts = District::all(); $selectDistrict = array(); $selectDistricts[0] = "Select / All"; foreach ($districts as $district) { $selectDistricts[$district->slug] = $district->name; } \View::share('selectDistricts', $selectDistricts); } if (\Schema::hasTable('municipalities')) { $municipalities = Municipality::all(); $selectMunicipalities = array(); $selectMunicipalities[0] = "Select / All"; foreach ($municipalities as $municipality) { $selectMunicipalities[$municipality->slug] = $municipality->name; } \View::share('selectMunicipalities', $selectMunicipalities); } if (\Schema::hasTable('wards')) { $wards = Ward::all(); $selectWards = array(); $selectWards[0] = "Select / All"; foreach ($wards as $ward) { $selectWards[$ward->slug] = $ward->name; } \View::share('selectWards', $selectWards); } if (\Schema::hasTable('categories')) { $categories = Category::all(); $selectCategories = array(); $selectCategories[0] = "Select / All"; foreach ($categories as $category) { $selectCategories[$category->slug] = $category->name; } \View::share('selectCategories', $selectCategories); } if (\Schema::hasTable('sub_categories')) { $subCategories = SubCategory::all(); $selectSubCategories = array(); $selectSubCategories[0] = "Select / All"; foreach ($subCategories as $subCategory) { $selectSubCategories[$subCategory->slug] = $subCategory->name; } \View::share('selectSubCategories', $selectSubCategories); } if (\Schema::hasTable('sub_sub_categories')) { $subSubCategories = SubSubCategory::all(); $selectSubSubCategories = array(); $selectSubSubCategories[0] = "Select / All"; foreach ($subSubCategories as $subSubCategory) { $selectSubSubCategories[$subSubCategory->slug] = $subSubCategory->name; } \View::share('selectSubSubCategories', $selectSubSubCategories); } if (\Schema::hasTable('relationships')) { $relationships = Relationship::all(); $selectRelationships = array(); $selectRelationships[0] = "Select / All"; foreach ($relationships as $relationship) { $selectRelationships[$relationship->id] = $relationship->name; } \View::share('selectRelationships', $selectRelationships); } if (\Schema::hasTable('cases')) { $cases = \DB::table('cases')->join('users', 'cases.reporter', '=', 'users.id')->select(\DB::raw("\n IF(`cases`.`addressbook` = 1,(SELECT CONCAT(`first_name`, ' ', `surname`) FROM `addressbook` WHERE `addressbook`.`id`= `cases`.`reporter`), (SELECT CONCAT(users.`name`, ' ', users.`surname`) FROM `users` WHERE `users`.`id`= `cases`.`reporter`)) as reporterName\n\n "))->get(); $reporters = array(); $reporters[0] = "Select / All"; foreach ($cases as $case) { $reporters[$case->reporterName] = $case->reporterName; } \View::share('selectReporters', $reporters); } View()->composer('master', function ($view) { $view->with('addressBookNumber', addressbook::all()); if (\Auth::check()) { $number = addressbook::where('user', '=', \Auth::user()->id)->get(); $view->with('addressBookNumber', $number); $allUsers = User::where('id', '<>', \Auth::user()->id)->get(); $view->with('loggedInUsers', $allUsers); $noPrivateMessages = Message::where('to', '=', \Auth::user()->id)->where('read', '=', 0)->where('message_type', '=', 0)->get(); $view->with('noPrivateMessages', $noPrivateMessages); $noInboxMessages = Message::where('to', '=', \Auth::user()->id)->where('message_type', '=', 0)->get(); $view->with('noInboxMessages', $noInboxMessages); $noDepartments = Department::all(); $view->with('noDepartments', $noDepartments); $noUsers = User::all(); $view->with('noUsers', $noUsers); $noRoles = UserRole::all(); $view->with('noRoles', $noRoles); $noPositions = Position::all(); $view->with('noPositions', $noPositions); $noRelationships = Relationship::all(); $view->with('noRelationships', $noRelationships); $noProvinces = Province::all(); $view->with('noProvinces', $noProvinces); $noCaseStatuses = CaseStatus::all(); $view->with('noCaseStatuses', $noCaseStatuses); $userRole = UserRole::where('id', '=', \Auth::user()->role)->first(); $view->with('systemRole', $userRole); $noCasesPriorities = CasePriority::all(); $view->with('noCasesPriorities', $noCasesPriorities); } }); }
protected function leagueData() { $committees = Committee::where('active', 1)->orderBy('name')->get(); $positions = Position::all(); $requirements = $this->currentYearBaseReqs(); $teams = Team::where('active', 1)->orderBy('name')->get(); $groups = Group::orderBy('name')->get(); $roles = Role::orderBy('name')->get(); return array('committees' => $committees, 'positions' => $positions, 'requirements' => $requirements, 'teams' => $teams, 'groups' => $groups, 'roles' => $roles); }