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 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"}]} @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? if params[:filters].present? && params[:filters]["application_type"].present?
@jobs = RecruitmentJob.where(:post_type.in => params[:filters]["application_type"]) @jobs = RecruitmentJob.where(:post_type.in => params[:filters]["application_type"])
else else

View File

@ -28,8 +28,13 @@ 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>" 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 else
criteria = "" criteria = ""
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 candidates = EmployeeProfile.job_seekers
end end
end
if !candidates.nil? && !candidates.is_a?(Array) if !candidates.nil? && !candidates.is_a?(Array)
candidates = candidates.job_seekers.desc(:updated_at).page(OrbitHelper.page_number).per(OrbitHelper.page_data_count) candidates = candidates.job_seekers.desc(:updated_at).page(OrbitHelper.page_number).per(OrbitHelper.page_data_count)
total_pages = candidates.total_pages total_pages = candidates.total_pages
@ -231,7 +236,7 @@ class RecruitmentsController < PseudoSessionController
"gender" => t("recruitment.gender.#{profile.gender}"), "gender" => t("recruitment.gender.#{profile.gender}"),
"martial-title" => t("recruitment.martial_title"), "martial-title" => t("recruitment.martial_title"),
"martial" => (!profile.marital_status.nil? && profile.marital_status != "" ? t("recruitment.martial.#{profile.marital_status}") : t("recruitment.not_available")), "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}"), "employment_status" => t("recruitment.employment.#{profile.employment_status}"),
"employee_identity-title" => t("recruitment.employee_identity_title"), "employee_identity-title" => t("recruitment.employee_identity_title"),
"employee_identity" => t("recruitment.employee_identity.#{profile.employee_identity}"), "employee_identity" => t("recruitment.employee_identity.#{profile.employee_identity}"),
@ -713,11 +718,28 @@ class RecruitmentsController < PseudoSessionController
query << {:desired_job_title.in => keywords} query << {:desired_job_title.in => keywords}
end end
if !query.empty? if !query.empty?
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) candidates = EmployeeProfile.any_of(query)
end end
end
candidates candidates
end 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 def advanced_filter_candidates
end end

View File

@ -19,6 +19,7 @@
<% jobcount = job.get_application_count %> <% jobcount = job.get_application_count %>
<td><%= jobcount %></td> <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> <td>
<% if jobcount > 0 %> <% if jobcount > 0 %>
<a href="<%= applications_admin_recruitment_path(job.id) %>" class="btn btn-default"><%= t("recruitment.show_application") %></a> <a href="<%= applications_admin_recruitment_path(job.id) %>" class="btn btn-default"><%= t("recruitment.show_application") %></a>