fix candidates and show expiry date

This commit is contained in:
IT 2018-08-07 17:03:28 +08:00
parent 326c5f1ec0
commit 1f1db7331a
3 changed files with 28 additions and 5 deletions

View File

@ -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

View File

@ -28,7 +28,12 @@ class RecruitmentsController < PseudoSessionController
criteria = "<span class='criteria'><i>- " + params[:q] + "</i></span> <span class='reset-search'><a href='#{params[:url].gsub("/","")}'><i class='fa fa-refresh' aria-hidden='true'></i></a></span>"
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

View File

@ -18,7 +18,8 @@
<td><span class="label label-<%= (job.filled ? "success" : "important" ) %>"><%= (job.filled ? "Yes" : "No" ) %></span></td>
<% jobcount = job.get_application_count %>
<td><%= jobcount %></td>
<td><%= job.get_post_type_label.html_safe %></td>
<td><%= job.get_post_type_label.html_safe %></td>
<td><%= job.expiry_date.strftime("%Y/%m/%d %H:%M") %></td>
<td>
<% if jobcount > 0 %>
<a href="<%= applications_admin_recruitment_path(job.id) %>" class="btn btn-default"><%= t("recruitment.show_application") %></a>