diff --git a/app/assets/stylesheets/recruitment/recruitment.scss b/app/assets/stylesheets/recruitment/recruitment.scss index bb14164..5deccd6 100644 --- a/app/assets/stylesheets/recruitment/recruitment.scss +++ b/app/assets/stylesheets/recruitment/recruitment.scss @@ -25,6 +25,9 @@ font-weight: bolder; } } + .logout { + font-size: 16px; + } } ul.nav { diff --git a/app/controllers/recruitments_controller.rb b/app/controllers/recruitments_controller.rb index 8bbaf44..c759c6b 100644 --- a/app/controllers/recruitments_controller.rb +++ b/app/controllers/recruitments_controller.rb @@ -126,8 +126,13 @@ class RecruitmentsController < PseudoSessionController end end - def get_show_type + def check_session + page = Page.where(:module => "pseudo_member").first + session = OrbitHelper.request.session + available = session[:current_pseudo_user_id].present? && !session[:current_pseudo_user_id].nil? ? "true" : "false" { + "session" => available, + "url" => "/" + I18n.locale.to_s + page.url, "type" => OrbitHelper.params[:page_id] } end @@ -135,9 +140,25 @@ class RecruitmentsController < PseudoSessionController def show_candidate(params) rp = RecruitProfile.where(:uid => params[:uid]).first profile = rp.profile - phone = !profile.country_code.nil? ? profile.country_code + " - " + profile.phone_number : profile.phone_number - skills = profile.skills + phone = !profile.country_code.nil? ? "+" + profile.country_code + " - " + profile.phone_number : profile.phone_number + skills = profile.skills.collect{|skill| {"skill-name" => skill}} if !profile.skills.empty? + infos = [] + ["autobiography", "resume_content", "recommendation1_info", "recommendation2_info"].each do |t| + if !profile.send(t).nil? && profile.send(t) != "" + infos << { + "title" => t("recruitment.#{t}"), + "text" => simple_format(profile.send(t)) + } + end + end + if profile.experience_years == 0 && profile.experience_months == 0 + experience = t("recruitment.fresher") + else + experience = (profile.experience_years.to_s rescue "0") + " year(s) " + (profile.experience_months.to_s rescue "0") + " month(s)" + end { + "skills" => skills, + "infos" => infos, "data" => { "name" => rp.name, "job-title" => profile.desired_job_title, @@ -145,7 +166,21 @@ class RecruitmentsController < PseudoSessionController "phone" => phone, "email" => rp.email, "website" => profile.website, - + "avatar" => profile.get_avatar, + "resume-url" => (profile.resume.url rescue ""), + "resume-text" => t("recruitment.resume_text"), + "location-title" => t("recruitment.location"), + "location" => profile.desired_place, + "experience-title" => t("recruitment.experience_title"), + "experience" => experience, + "gender-title" => t("recruitment.gender_title"), + "gender" => t("recruitment.gender.#{profile.gender}"), + "martial-title" => t("recruitment.martial_title"), + "martial" => t("recruitment.martial.#{profile.marital_status}"), + "language-title" => t("recruitment.language_title"), + "language" => profile.languages, + "workingtime-title" => t("recruitment.workingtime_title"), + "workingtime" => t("recruitment.working_time.#{profile.working_time}") } } end @@ -160,7 +195,7 @@ class RecruitmentsController < PseudoSessionController "text" => simple_format(profile.company_profile) } end - ["job_description", "responsibility", "other_conditions"].each do |jj| + ["job_description", "other_conditions"].each do |jj| if !job.send(jj).nil? && job.send(jj) != "" infos << { "title" => t("recruitment.#{jj}"), @@ -189,6 +224,19 @@ class RecruitmentsController < PseudoSessionController else holiday = t("recruitment.not_available") end + session = OrbitHelper.request.session + applybtn = "" + if session[:current_pseudo_user_id].present? && !session[:current_pseudo_user_id].nil? + pu = PseudoUser.find(session[:current_pseudo_user_id]) rescue nil + current_loggedin_user = RecruitProfile.where(:pseudo_member_id => pu.user_name).first rescue nil + if !current_loggedin_user.nil? && current_loggedin_user.is_employee? + if !current_loggedin_user.profile.is_job_applied?(job.id.to_s) + applybtn = "Apply" + else + applybtn = "Already Applied" + end + end + end { "infos" => infos, "data" => { @@ -220,6 +268,8 @@ class RecruitmentsController < PseudoSessionController "workingtime" => (!job.working_time.nil? && job.working_time != "" ? t("recruitment.working_time.#{job.working_time}") : t("recruitment.not_available")), "holiday-title" => t("recruitment.holiday_title"), "holiday" => holiday, + "apply-btn" => applybtn, + "job-id" => job.id.to_s } } end @@ -232,6 +282,20 @@ class RecruitmentsController < PseudoSessionController end end + def job_applications + if @profile.is_employee? || @profile.profile.recruitment_jobs.where(:id => params[:id]).count == 0 + redirect_to mydashboard_path and return + end + @applications = EmployeeJobApplication.where(:job => params[:id]).not_archived.desc(:created_at) + end + + def archive_application + eja = EmployeeJobApplication.find(params[:id]) + eja.archived = true + eja.save + redirect_to "/recruit/#{eja.id.to_s}/job_applications" + end + def advancedform @industries = RecruitmentIndustry.all.asc(:industry_title).collect{|ri| [ri.industry_title, ri.id]} @categories = RecruitmentCategory.all.asc(:job_category).collect{|ri| [ri.job_category, ri.id]} @@ -239,6 +303,17 @@ class RecruitmentsController < PseudoSessionController render :layout => false end + def applyjob + if @profile.is_employee? + eja = EmployeeJobApplication.new + eja.job = params[:job_id] + eja.cover_letter = params[:cover_letter] + eja.employee_profile_id = @profile.profile.id + eja.save + end + redirect_to mydashboard_path + end + def select_profile end diff --git a/app/models/employee_job_application.rb b/app/models/employee_job_application.rb index fc300fd..e24add2 100644 --- a/app/models/employee_job_application.rb +++ b/app/models/employee_job_application.rb @@ -3,9 +3,13 @@ class EmployeeJobApplication include Mongoid::Timestamps field :job + field :cover_letter + field :archived, type: Boolean, :default => false belongs_to :employee_profile + scope :not_archived, ->{ where(:archived => false) } + def get_job RecruitmentJob.find(self.job) rescue nil end diff --git a/app/models/employee_profile.rb b/app/models/employee_profile.rb index 3bf0d6e..fd0570a 100644 --- a/app/models/employee_profile.rb +++ b/app/models/employee_profile.rb @@ -42,6 +42,10 @@ class EmployeeProfile scope :job_seekers, ->{where(:active => true)} + def is_job_applied?(jobid) + self.employee_job_applications.where(:job => jobid).count > 0 + end + def get_avatar if self.avatar.url.nil? return "/assets/person.png" diff --git a/app/models/recruitment_job.rb b/app/models/recruitment_job.rb index 2969a1c..8a09c9a 100644 --- a/app/models/recruitment_job.rb +++ b/app/models/recruitment_job.rb @@ -35,4 +35,8 @@ class RecruitmentJob RecruitmentCategory.find(self.category).job_category rescue "" end + def get_application_count + EmployeeJobApplication.where(:job => self.id.to_s).not_archived.count + end + end \ No newline at end of file diff --git a/app/views/recruitments/_dashboard_header.html.erb b/app/views/recruitments/_dashboard_header.html.erb index a5a4a44..dc3dd33 100644 --- a/app/views/recruitments/_dashboard_header.html.erb +++ b/app/views/recruitments/_dashboard_header.html.erb @@ -1,4 +1,7 @@ -

Welcome <%= @profile.name %>!

+

+ Welcome <%= @profile.name %>! +
Logout
+