added candidates search

This commit is contained in:
Bomrah Harry 2018-07-18 19:42:46 +08:00
parent c4b1bbdedf
commit ac92b58c4a
4 changed files with 23 additions and 2 deletions

View File

@ -31,7 +31,7 @@ class RecruitmentsController < PseudoSessionController
candidates = EmployeeProfile.job_seekers
end
if !candidates.nil? && !candidates.is_a?(Array)
candidates = candidates.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
else
candidates = []
@ -693,6 +693,25 @@ class RecruitmentsController < PseudoSessionController
end
def filter_candidates
candidates = []
keywords = params[:q].split(",").collect{|s| /#{s.strip}/i}
names = RecruitProfile.any_of({:first_name.in => keywords}, {:last_name.in => keywords}).pluck(:id)
designations = EmployerProfile.where(:desired_job_title.in => keywords)
skills = EmployerProfile.where(:skills.in => keywords)
query = []
if names.count > 0
query << {:recruit_profile_id.in => names}
end
if skills.count > 0
query << {:skills.in => keywords}
end
if designations.count > 0
query << {:desired_job_title.in => keywords}
end
if !query.empty?
candidates = EmployerProfile.any_of(query)
end
candidates
end
def advanced_filter_candidates

View File

@ -9,7 +9,7 @@
</thead>
<tbody>
<% if @applications.blank? %>
<tr><td class="no-jobs" colspan="3"><%= t("recruitment.no_jobs_found") %></td></tr>
<tr><td class="no-jobs" colspan="4"><%= t("recruitment.no_jobs_applied") %></td></tr>
<% else %>
<% @applications.each do |app| %>
<% job = app.get_job %>

View File

@ -158,6 +158,7 @@ en:
company_name: Company Name
applied_date: Application Date
no_jobs_found: No Jobs Posted.
no_jobs_applied: No Jobs Applied.
emp_personal_profile: Employee / Fresher Personal Profile
dob: Date of birth
country_code: Country Code

View File

@ -160,6 +160,7 @@ zh_tw:
company_name: 公司名稱
applied_date: 應徵日期
no_jobs_found: 無相關工作
no_jobs_applied: 沒有工作申請
emp_personal_profile: 應徵者個人資料
dob: 生日
country_code: 國籍