Exemplo n.º 1
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $this->validate($request, ['position' => 'required', 'description' => 'required']);
     Position::create($request->all());
     flash()->success('Successfully Added!');
     return redirect('/admin/careers');
 }
Exemplo n.º 2
0
 /**
  * Remove position
  *
  * @param  int  $id
  * @return string
  */
 public function destroy()
 {
     $position = Position::find(Request::input('id'));
     $position->delete();
     $item = array("id" => $position->id, "name" => $position->name, "description" => $position->description);
     echo json_encode($item);
 }
Exemplo n.º 3
0
 public function edit($id)
 {
     $user = User::find($id);
     // список должностей для передачи в select формы
     $positions = Position::all();
     return view('user.edit', ['user' => $user, 'positions' => $positions]);
 }
Exemplo n.º 4
0
 /**
  * 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));
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  Request  $request
  * @param  int  $id
  * @return Response
  */
 public function update(PositionsRequest $request)
 {
     $position = Position::where('id', $request['positionID'])->first();
     $position->name = $request['name'];
     $position->save();
     \Session::flash('success', $request['name'] . ' has been successfully updated!');
     return redirect()->back();
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $positions = [['latitud' => '4.65599032', 'longitud' => '-74.09680434', 'icon' => 'canotaje.png', 'title' => 'Lago', 'description' => 'Es uno de los principales atractivos del parque; cuenta con 10 hectáreas y es protagonista de muestras acuáticas,competencias deportivas y con servicio de lanchas y remos. Su profundidad oscila entre los 1.00 y los 12.00 metros.Extensión del lago: 11 hectáreas.'], ['latitud' => '4.65835891', 'longitud' => '-74.09512997', 'icon' => 'canotaje.png', 'title' => 'Lago', 'description' => 'Es uno de los principales atractivos del parque; cuenta con 10 hectáreas y es protagonista de muestras acuáticas,competencias deportivas y con servicio de lanchas y remos. Su profundidad oscila entre los 1.00 y los 12.00 metros.Extensión del lago: 11 hectáreas.'], ['latitud' => '4.65599677', 'longitud' => '-74.096598', 'icon' => 'canotaje.png', 'title' => 'Isla', 'description' => 'Isla. Punto de biodiversidad ecológica dentro del parque.'], ['latitud' => '4.65694694', 'longitud' => '-74.09748263', 'icon' => 'canotaje.png', 'title' => 'Isla', 'description' => 'Isla. Punto de biodiversidad ecológica dentro del parque.'], ['latitud' => '4.65682922', 'longitud' => '-74.09762685', 'icon' => 'cafeteria.png', 'title' => 'Restaurante', 'description' => 'Unidad de servicio: 6 cafeterías y baños.'], ['latitud' => '4.6578631', 'longitud' => '-74.09192626', 'icon' => 'cafeteria.png', 'title' => 'Restaurante', 'description' => 'Unidad de servicio: 6 cafeterías y baños.'], ['latitud' => '4.65535941', 'longitud' => '-74.09649521', 'icon' => 'parque.png', 'title' => 'parque infantil', 'description' => 'zonas de juegos infantiles.'], ['latitud' => '4.65612933', 'longitud' => '-74.097206', 'icon' => 'parque.png', 'title' => 'parque infantil', 'description' => 'zonas de juegos infantiles.'], ['latitud' => '4.65624429', 'longitud' => '-74.0974313', 'icon' => 'parque.png', 'title' => 'parque infantil', 'description' => 'zonas de juegos infantiles.'], ['latitud' => '4.65572412', 'longitud' => '-74.09664784', 'icon' => 'parque.png', 'title' => 'parque infantil', 'description' => 'zonas de juegos infantiles.'], ['latitud' => '4.66249212', 'longitud' => '-74.09353387', 'icon' => 'parque.png', 'title' => 'parque infantil', 'description' => 'zonas de juegos infantiles.'], ['latitud' => '4.65773506', 'longitud' => '-74.09392531', 'icon' => 'parque.png', 'title' => 'parque infantil', 'description' => 'zonas de juegos infantiles.'], ['latitud' => '4.65777738', 'longitud' => '-74.09282847', 'icon' => 'parque.png', 'title' => 'parque infantil', 'description' => 'zonas de juegos infantiles.'], ['latitud' => '4.65749819', 'longitud' => '-74.09737781', 'icon' => 'kiosco.png', 'title' => 'Esferico', 'description' => 'Puntos de encuentro.'], ['latitud' => '4.66006311', 'longitud' => '-74.09494751', 'icon' => 'kiosco.png', 'title' => 'Esferico', 'description' => 'Puntos de encuentro: 11 kioscos.'], ['latitud' => '4.65989612', 'longitud' => '-74.0929542', 'icon' => 'kiosco.png', 'title' => 'kiosco', 'description' => 'Puntos de encuentro: 11 kioscos.'], ['latitud' => '4.65838714', 'longitud' => '-74.09401676', 'icon' => 'kiosco.png', 'title' => 'kiosco', 'description' => 'Puntos de encuentro: 11 kioscos.'], ['latitud' => '4.66071444', 'longitud' => '-74.09073194', 'icon' => 'concierto.png', 'title' => 'Plaza de Eventos', 'description' => 'Programas masivos públicos y privados, festivales como el famoso Festival de Verano; encuentros culturales, conciertos o Lunadas.'], ['latitud' => '4.65832792', 'longitud' => '-74.09072412', 'icon' => 'monumento.png', 'title' => 'Monumento', 'description' => 'Monumento Bolivariano.']];
     DB::table('positions')->delete();
     foreach ($positions as $position) {
         \App\Position::create($position);
     }
 }
Exemplo n.º 7
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $this->data['user'] = User::where('deleted_at', null)->count();
     $this->data['user_disabled'] = User::where('deleted_at', !null)->count();
     $this->data['department'] = Department::where('enabled', 1)->count();
     $this->data['position'] = Position::where('enabled', 1)->count();
     return view('pages.admin.dashboard', $this->data);
 }
 public function sync()
 {
     $timecard_data = Input::get('timecard_data');
     $inventory_data = Input::get('inventory_data');
     $positions_modified = Input::get('positions_modified');
     $users_modified = Input::get('users_modified');
     $timecard_modified = Input::get('timecard_modified');
     $checklists_modified = Input::get('checklists_modified');
     $inventory_modified = Input::get('inventory_modified');
     foreach ($inventory_data as $entry) {
         $record = \App\Inventory::findOrFail($entry["guid"]);
         $record->quantity_on_hand = $entry["quantity_on_hand"];
         $record->updated_at = Carbon::createFromTimestamp($entry["last_modified"], 'America/Chicago');
         $record->save();
         $adj = new \App\InventoryAdjustment();
         $adj->inventory_id = $record->id;
         $adj->quantity_on_hand = $record->quantity_on_hand;
         $adj->save();
     }
     $stamp = "";
     foreach ($timecard_data as $entry) {
         $stamp = date_default_timezone_get();
         $record = \App\Timecard::where('guid', $entry["guid"])->first();
         if ($record) {
             $record->guid = $entry["guid"];
             $record->clock_in = Carbon::createFromTimestamp($entry["clock_in"], 'America/Chicago');
             if ($entry["clock_out"] == '0') {
                 $record->clock_out = null;
             } else {
                 $record->clock_out = Carbon::createFromTimestamp($entry["clock_out"], 'America/Chicago');
             }
             $record->save();
         } else {
             $record = new \App\Timecard();
             $record->guid = $entry["guid"];
             $record->clock_in = Carbon::createFromTimestamp($entry["clock_in"], 'America/Chicago');
             if ($entry["clock_out"] == '0') {
                 $record->clock_out = null;
             } else {
                 $record->clock_out = Carbon::createFromTimestamp($entry["clock_out"], 'America/Chicago');
             }
             $record->user_id = $entry["user_id"];
             $record->position_id = $entry["position_id"];
             $record->save();
         }
     }
     $users_last_modified = Carbon::createFromTimestamp($users_modified)->toDateTimeString();
     $users = \App\User::where('updated_at', '>', $users_last_modified)->get();
     $timecard_last_modified = Carbon::createFromTimestamp($timecard_modified)->toDateTimeString();
     $timecards = \App\Timecard::where('updated_at', '>', $timecard_last_modified)->get();
     $positions_last_modified = Carbon::createFromTimestamp($positions_modified)->toDateTimeString();
     $positions = \App\Position::withTrashed()->where('updated_at', '>', $positions_last_modified)->get();
     $checklists_last_modified = Carbon::createFromTimestamp($checklists_modified)->toDateTimeString();
     $checklist = \App\Checklist::withTrashed()->where('updated_at', '>', $checklists_last_modified)->get();
     $inventory_last_modified = Carbon::createFromTimestamp($inventory_modified)->toDateTimeString();
     $inventory = \App\Inventory::withTrashed()->where('updated_at', '>', $inventory_last_modified)->get();
     return Response::json(["users" => $users, "checklist" => $checklist, "inventory" => $inventory, "timecards" => $timecards, "positions" => $positions]);
 }
 /**
  * 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);
 }
Exemplo n.º 10
0
 /**
  * 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'));
 }
Exemplo n.º 11
0
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     $position = Position::find($id);
     $position_title = $request->get('position_title');
     $position_shortcode = $request->get('position_shortcode');
     $position->title = $position_title;
     $position->shortcode = $position_shortcode;
     $position->save();
     flash()->success('', 'Pakeista pozicija!');
     return redirect()->back();
 }
 /**
  * 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'));
 }
Exemplo n.º 13
0
 /**
  * Update the specified resource in storage.
  *
  * @param  PositionRequest $request
  * @param  int $id
  * @return \Illuminate\Http\Response
  */
 public function update(PositionRequest $request, $id)
 {
     try {
         $position = Position::findOrFail($id);
         $position->fill($request->all())->save();
     } catch (ModelNotFoundException $ex) {
         Flash::error('No position available' . $ex);
         return redirect()->route('positions.index');
     }
     Flash::success('Position updated successfully');
     return redirect()->route('positions.index');
 }
Exemplo n.º 14
0
 public function delete($id)
 {
     $position = Position::find($id);
     // находим хотя бы одного пользователя по данной должности
     $user = Position::find($id)->users->first();
     // если должность не используется ни у одного из пользователей, удаляем её
     if (!$user) {
         $position->delete();
         return redirect()->back()->withSuccess('Запись удалена');
     } else {
         return redirect()->back()->with('message', 'Должность используется');
     }
 }
Exemplo n.º 15
0
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     if (Request::isMethod('get')) {
         $this->data['positions'] = Position::where('enabled', 1)->get();
         $this->data['departments'] = Department::where('enabled', 1)->get();
         $this->data['item'] = User::find($id);
         if ($this->data['item']) {
             return view('pages.user.update', $this->data);
         } else {
             return redirect('user');
         }
     } elseif (Request::isMethod('post')) {
         $user = User::find($id);
         $user->update(Input::all());
         return redirect('user');
     }
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  *
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $validator = \Validator::make($request->all(), ['body' => 'required', 'translation_id' => 'sometimes|exists:translations,id', 'via_dictionary' => 'sometimes|boolean']);
     if ($validator->passes()) {
         if ($request->input('via_dictionary')) {
             $definitions = \YaDictionary::lookup($request->input('body'));
             if ($definitions) {
                 foreach ($definitions as $definition) {
                     $partOfSpeech = $definition->getPartOfSpeech();
                     if (!($position = Position::where('body', $partOfSpeech)->first())) {
                         $position = Position::create(['body' => $partOfSpeech]);
                     }
                     if (!Word::where('body', $definition->getText())->where('position_id', $position->id)->first()) {
                         $word = new Word();
                         $word->body = $definition->getText();
                         $word->ts = $definition->getTranscription();
                         $word->position()->associate($position);
                         $word->save();
                         $translationIds = [];
                         foreach ($definition->getTranslations() as $yaTranslation) {
                             if (!($translation = Translation::where('body', $yaTranslation->getText())->first())) {
                                 $translation = Translation::create(['body' => $yaTranslation->getText()]);
                             }
                             $translationIds[] = $translation->id;
                         }
                         $word->translations()->attach($translationIds);
                     }
                 }
                 $response = response('This word has created from the dictionary', 201);
             } else {
                 $response = response()->json(['errors' => ['This word has not found in the dictionary.']], 404);
             }
         } else {
             if ($translationId = $request->input('translation_id')) {
                 $word = Word::create(['body' => $request->input('body')]);
                 $word->translations()->attach($translationId);
                 $response = response()->json(['id' => $word->getId()], 201);
             } else {
                 $response = response()->json(['errors' => ['It needs a translation.']], 400);
             }
         }
     } else {
         $response = response()->json(['errors' => $validator->messages()->all()], 400);
     }
     return $response;
 }
Exemplo n.º 17
0
 /**
  * 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');
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(UserRequest $request, User $user)
 {
     /*  New User Table */
     $user->name = $request['Fname'];
     $user->surname = $request['Sname'];
     $user->cellphone = $request['Cell1'];
     $user->username = $request['Email'];
     $user->email = $request['Cell1'];
     $position = Position::where('slug', '=', $request['Position'])->first();
     $user->position = $position->id;
     $province = Province::where('slug', '=', $request['Province'])->first();
     $user->province = $province->id;
     $district = District::where('slug', '=', $request['District'])->first();
     $user->district = $district->id;
     $municipalityIds = array();
     foreach ($request['Municipality'] as $municipalityName) {
         $municipality = Municipality::where('slug', '=', $municipalityName)->first();
         $municipalityIds[] = $municipality->id;
     }
     $user->municipality = implode(",", $municipalityIds);
     $department = Department::where('slug', '=', $request['Department'])->first();
     $user->department = $department->id;
     $password = rand(1000, 99999);
     $user->password = \Hash::make($password);
     $user->api_key = uniqid();
     $user->status = 1;
     $user->role = 2;
     $user->save();
     \Session::flash('success', $request['Fname'] . ' ' . $request['Sname'] . ' has been added successfully!');
     $data = array('name' => $user->name, 'username' => $user->email, 'password' => $password);
     \Mail::send('emails.registrationConfirmation', $data, function ($message) use($user) {
         $message->from('*****@*****.**', 'Siyaleader');
         $message->to($user->username)->subject("Siyaleader User Registration Confirmation: " . $user->name);
     });
     return redirect('list-users');
 }
 /**
  * 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);
         }
     });
 }
}
foreach ($cases as $case) {
    if ($case->addressbook == 1) {
        $userObj = addressbook::find($case->reporter);
        $ReporterName = $userObj->FirstName . ' ' . $userObj->Surname;
        $ReporterPosition = "";
        $ReporterMobile = $userObj->cellphone;
    } else {
        $userObj = user::find($case->reporter);
        $ReporterName = $userObj->name . ' ' . $userObj->surname;
        $RepPos = Position::find($userObj->position);
        $ReporterPosition = $RepPos->name;
        $ReporterMobile = $userObj->email;
    }
    $user = User::find($case->user);
    $position = Position::find($user->position);
    $ID = $case->id;
    $GPS = $case->gps_lat . ',' . $case->gps_lng;
    $Province = 'KZN';
    $Port = Municipality::find($case->precinct);
    $Port = $Port->name;
    $precinctObj = Municipality::find($case->precinct);
    $Precinct = $precinctObj->name;
    $Submitted = $case->created_at;
    $Status = $case->status;
    $catObjCat = Category::find($case->category);
    $Category = $catObjCat->name;
    \Log::info($Category);
    $PhotoURL = "http://41.216.130.6:8080/siyaleader-dbnports-mobileApp-api/port_backend/public/" . $case->img_url;
    $LastActivity = $case->updated_at;
    $Reporter = $ReporterName;
Exemplo n.º 21
0
 /**
  * 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'));
 }
Exemplo n.º 22
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $position = Position::where('active', 1)->get();
     // 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'));
 }
 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);
 }
 /**
  * Bootstrap any application services.
  *
  * @return void
  */
 public function boot()
 {
     if (\Schema::hasTable('positions')) {
         $positions = Position::orderBy('name', 'ASC')->get();
         $selectPositions = array();
         $selectPositions[0] = "Select / All";
         foreach ($positions as $position) {
             $selectPositions[$position->slug] = $position->name;
         }
         \View::share('selectPositions', $selectPositions);
     }
     if (\Schema::hasTable('departments')) {
         $departments = Department::orderBy('name', 'ASC')->get();
         $selectDepartments = array();
         $selectDepartments[0] = "Select / All";
         foreach ($departments as $department) {
             $selectDepartments[$department->slug] = $department->name;
         }
         \View::share('selectDepartments', $selectDepartments);
     }
     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('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(`FirstName`, ' ', `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('online', '=', 0)->get();
             $view->with('noPrivateMessages', $noPrivateMessages);
             $noInboxMessages = Message::where('to', '=', \Auth::user()->id)->where('online', '=', 0)->get();
             $view->with('noInboxMessages', $noInboxMessages);
         }
     });
 }
Exemplo n.º 25
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $findPosition = Staff::where('position_id', $id)->get()->toArray();
     if (!empty($findPosition)) {
         return redirect()->route('admin.position.index')->with('message', 'Can\'t delete position !');
     }
     $position = Position::find($id);
     $position->delete();
     return redirect()->route('admin.position.index')->with('message', 'Delete position success!');
 }
Exemplo n.º 26
0
 /**
  * Display candidate's information
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     $candidate = Candidate::find($id);
     $candidate->date_of_birth = $this->convert_datetimesql_to_datepicker($candidate->date_of_birth);
     $candidate->date_submit = $this->convert_datetimesql_to_datepicker($candidate->date_submit);
     $f1 = FileCandidate::lists('id');
     $f2 = $candidate->filecandidates()->get();
     $status_records = StatusRecord::whereIn('id', array(1, 3, 4))->get();
     $res_status = array();
     foreach ($status_records as $k_sta => $v_sta) {
         $res_status += array($v_sta->id => $v_sta->name);
     }
     $status_records = $res_status;
     $positions = Position::lists('name', 'id');
     return view('candidates.editcandidate', compact('positions', 'status_records', 'candidate', 'f1', 'f2'));
 }
Exemplo n.º 27
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $checklistItem = \App\Position::find($id);
     $checklistItem->delete();
 }
Exemplo n.º 28
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function delete($id)
 {
     $department = Position::find($id);
     $department->enabled = 0;
     $department->delete();
     return redirect('position');
 }
Exemplo n.º 29
0
 public function getAvailableUnits($id)
 {
     $file = file_get_contents("units.txt");
     $units = json_decode($file, true);
     $position = Position::find($id);
     $x = $position->x;
     $y = $position->y;
     $position = Position::where('y', $y)->where('x', $x)->get()->lists('id');
     $city = City::whereIn('position_id', $position)->get();
     if (count($city) == 0) {
         return $city;
     } else {
         switch ($city[0]->tier) {
             case 1:
                 $txt = 'tier1';
                 break;
             case 2:
                 $txt = 'tier2';
                 break;
         }
         $units = Unit::whereIn('Id', $units[$txt])->with('resource')->get();
         return \App\CityEffectApplier::modifyUnitPricesByCity($units, $city[0]);
     }
 }
Exemplo n.º 30
0
 /**
  * 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);
 }