public function selectProgram(Request $request)
 {
     $data = $request->all();
     if (!isset($data['nationality']) || !isset($data['country']) || !isset($data['program_name']) || !isset($data['exam_mode']) || !isset($data['id']) || !isset($data['agree']) || !isset($data['dual_specialization'])) {
         return Response::json(array('status' => 'failure', 'msg' => 'Enter correct information'));
     }
     // get region of a user
     $nationality = new Nationality();
     $region = $nationality->getStudentType($data['nationality'], $data['country']);
     $program = SelectProgram::where('registration_id', '=', $data['id'])->first();
     if (!$program) {
         $program = new SelectProgram();
     } else {
         if ($program->read_only == 'True') {
             return Response::json(array("status" => "failure", "msg" => "Already applied for program"));
         }
     }
     $program->fill($data);
     $program->registration_id = $data['id'];
     $program->student_region = $region;
     if ($program->save()) {
         return Response::json(array('status' => 'success', 'msg' => 'Data has been saved successfully', 'id' => $data['id']));
     } else {
         return Response::json(array('status' => 'failure', 'msg' => 'Problem in saving data'));
     }
 }
Example #2
0
 public function getStudentType($nationality, $country)
 {
     $region = Nationality::where('Adjective', 'like', $nationality)->first();
     $student_type = 'Rest of the World';
     if (!empty($region)) {
         $region = json_decode($region, true);
         $region = $region['country_region'];
     } else {
         $region = '';
     }
     if (strcasecmp($nationality, 'Indian') == 0) {
         if (strcasecmp($country, 'India') == 0) {
             $student_type = 'Indian Nationals';
         } else {
             $student_type = 'Indian Overseas';
         }
     } else {
         if (strcasecmp($region, 'Africa') == 0) {
             $student_type = 'Africa';
         } elseif (strcasecmp($region, 'South East Asia') == 0) {
             $student_type = 'South East Asia';
         } elseif (strcasecmp($region, 'West / Western Asia') == 0) {
             $student_type = 'West / Western Asia';
         } elseif (strcasecmp($region, 'SAARC') == 0) {
             $student_type = 'SAARC';
         } else {
             $student_type = 'Rest of the World';
         }
     }
     return $student_type;
 }
 /**
  * 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'));
 }
 public function getCountry()
 {
     $data = Nationality::orderBy('Country', 'ASC')->get();
     $allNations = array();
     $allNations[0]['id'] = ' - Select Country - ';
     $allNations[0]['name'] = ' - Select Country - ';
     foreach ($data as $nations) {
         $nation['id'] = $nations->id;
         $nation['name'] = $nations->Country;
         $allNations[] = $nation;
     }
     return Response::json(array('data' => $allNations));
 }
 /**
  * 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');
 }
Example #6
0
 public function postDistricts(Request $request, $nationality_id, $state_id, $lga_id)
 {
     $rules = array('title' => 'required');
     $validator = Validator::make($request->all(), $rules);
     if ($validator->fails()) {
         return Redirect::to('/place/' . $nationality_id . '/' . $state_id . '/' . $lga_id)->withErrors($validator)->withInput($request->except('password'));
     } else {
         $user = new User();
         $user->id = 1;
         //$user = Auth::user();
         $record = new District();
         $record->title = $request->get('title');
         $record->lga()->associate(Lga::find($lga_id));
         $record->state()->associate(State::find($state_id));
         $record->nationality()->associate(Nationality::find($nationality_id));
         $record->user()->associate($user);
         $record->save();
         // redirect
         Session::flash('message', 'Successfully updated!');
         return Redirect::to('/place/' . $nationality_id . '/' . $state_id . '/' . $lga_id);
     }
 }
Example #7
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show(Employee $employee)
 {
     $nat = ['' => 'Select'] + Nationality::lists('name', 'id')->toArray();
     return view('backend.employees.show', compact('employee', 'nat'));
 }
 /**
  * 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'));
 }