diff --git a/app/controllers/admin/recruitments_controller.rb b/app/controllers/admin/recruitments_controller.rb index ea62dfe..47c3596 100644 --- a/app/controllers/admin/recruitments_controller.rb +++ b/app/controllers/admin/recruitments_controller.rb @@ -66,7 +66,7 @@ class Admin::RecruitmentsController < OrbitAdminController def postings @filter_fields = {:application_type => [{:title => "recruitment.post_t.type1", :id => "type1"},{:title => "recruitment.post_t.type2", :id => "type2"},{:title => "recruitment.post_t.type3", :id => "type3"}]} - @table_fields = ["recruitment.job_title", "recruitment.company_name", "recruitment.position_filled", "recruitment.number_of_applicants", "recruitment.post_type", "recruitment.actions"] + @table_fields = ["recruitment.job_title", "recruitment.company_name", "recruitment.position_filled", "recruitment.number_of_applicants", "recruitment.post_type", "recruitment.expiry_date", "recruitment.actions"] if params[:filters].present? && params[:filters]["application_type"].present? @jobs = RecruitmentJob.where(:post_type.in => params[:filters]["application_type"]) else diff --git a/app/controllers/recruitments_controller.rb b/app/controllers/recruitments_controller.rb index 8aed7b6..d486166 100644 --- a/app/controllers/recruitments_controller.rb +++ b/app/controllers/recruitments_controller.rb @@ -28,7 +28,12 @@ class RecruitmentsController < PseudoSessionController criteria = "- " + params[:q] + " " else criteria = "" - candidates = EmployeeProfile.job_seekers + u_type = check_login_user_type + if u_type["type"] == "1" + candidates = EmployeeProfile.job_seekers.where(:recruit_profile_id => u_type["upid"]) + else + candidates = EmployeeProfile.job_seekers + end end if !candidates.nil? && !candidates.is_a?(Array) candidates = candidates.job_seekers.desc(:updated_at).page(OrbitHelper.page_number).per(OrbitHelper.page_data_count) @@ -231,7 +236,7 @@ class RecruitmentsController < PseudoSessionController "gender" => t("recruitment.gender.#{profile.gender}"), "martial-title" => t("recruitment.martial_title"), "martial" => (!profile.marital_status.nil? && profile.marital_status != "" ? t("recruitment.martial.#{profile.marital_status}") : t("recruitment.not_available")), - "employment_status-title" => t("recruitment.gender_title"), + "employment_status-title" => t("recruitment.employment_status"), "employment_status" => t("recruitment.employment.#{profile.employment_status}"), "employee_identity-title" => t("recruitment.employee_identity_title"), "employee_identity" => t("recruitment.employee_identity.#{profile.employee_identity}"), @@ -713,11 +718,28 @@ class RecruitmentsController < PseudoSessionController query << {:desired_job_title.in => keywords} end if !query.empty? - candidates = EmployeeProfile.any_of(query) + u_type = check_login_user_type + if u_type["type"] == "1" + candidates = EmployeeProfile.any_of(query).where(:recruit_profile_id => u_type["upid"]) + else + candidates = EmployeeProfile.any_of(query) + end end candidates end + def check_login_user_type + session = OrbitHelper.request.session + 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? + u_type = {"type" => "1","upid" => current_loggedin_user.id.to_s} + else + u_type = {"type" => "2"} + end + u_type + end + def advanced_filter_candidates end diff --git a/app/views/admin/recruitments/_posting_index.html.erb b/app/views/admin/recruitments/_posting_index.html.erb index 87b3d14..8d0618d 100644 --- a/app/views/admin/recruitments/_posting_index.html.erb +++ b/app/views/admin/recruitments/_posting_index.html.erb @@ -18,7 +18,8 @@