diff --git a/app/assets/javascripts/recruitment.js b/app/assets/javascripts/recruitment.js index db6ff7a..d055630 100644 --- a/app/assets/javascripts/recruitment.js +++ b/app/assets/javascripts/recruitment.js @@ -1 +1,2 @@ -//= require jquery_ujs \ No newline at end of file +//= require jquery_ujs +//= require ckeditor/init \ No newline at end of file diff --git a/app/controllers/recruitments_controller.rb b/app/controllers/recruitments_controller.rb index bfc5d3d..0db19c1 100644 --- a/app/controllers/recruitments_controller.rb +++ b/app/controllers/recruitments_controller.rb @@ -6,8 +6,67 @@ class RecruitmentsController < PseudoSessionController layout :get_layout def index - jobs = [] params = OrbitHelper.params + if params[:page_id] == "jobs" + load_jobs(params) + elsif params[:page_id] == "candidates" + load_candidates(params) + end + end + + def load_candidates(params) + data = [] + if params[:type].present? && params[:type] == "aq" + candidates = advanced_filter_candidates(params) + criteria = "- " + elsif params[:q].present? + candidates = filter_candidates(params) + criteria = "- " + params[:q] + " " + else + criteria = "" + 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) + total_pages = candidates.total_pages + else + candidates = [] + total_pages = 0 + end + candidates.each do |candidate| + company = !candidate.current_company.nil? && candidate.current_company != "" ? candidate.current_company : candidate.get_current_exp + company = "N/A" if company.nil? + if candidate.experience_years == 0 && candidate.experience_months == 0 + wey = t("recruitment.fresher") + wem = "" + else + wey = (candidate.experience_years.to_s rescue "0") + " year(s)" + wem = (candidate.experience_months.to_s rescue "0") + " month(s)" + end + data << { + "name" => candidate.recruit_profile.name, + "designation" => candidate.desired_job_title, + "company_name" => company, + "location" => candidate.desired_place, + "url_to_show" => OrbitHelper.url_to_show(candidate.recruit_profile.to_param), + "work_experience_years" => wey, + "work_experience_months" => wem, + "introduction" => candidate.introduction, + "skills" => candidate.skills.collect{|skill| {"skill-tag" => skill}}, + "avatar" => candidate.get_avatar + } + end + { + "candidates" => data, + "extras" => { + "criteria" => criteria + }, + "total_pages" => total_pages + } + end + + def load_jobs(params) + jobs = [] if params[:type].present? && params[:type] == "aq" rjobs = advanced_filter_jobs(params) criteria = "- " @@ -60,6 +119,26 @@ class RecruitmentsController < PseudoSessionController def show params = OrbitHelper.params + if params[:page_id] == "jobs" + show_job(params) + elsif params[:page_id] == "candidates" + show_candidate(params) + end + end + + def get_show_type + { + "type" => OrbitHelper.params[:page_id] + } + end + + def show_candidate(params) + { + "data" => {} + } + end + + def show_job(params) job = RecruitmentJob.where(:uid => params[:uid]).first profile = job.employer_profile infos = [] @@ -161,12 +240,58 @@ class RecruitmentsController < PseudoSessionController def createprofile profile = RecruitProfile.create(profile_params) - redirect_to mydashboard_path + if profile.is_employer? + redirect_to mydashboard_path + elsif profile.is_employee? + if params[:commit] == "Next" && params[:step] == "step1" + redirect_to employee_academics_path + elsif params[:commit] == "Save" + redirect_to mydashboard_path + end + end + end + + def employee_academics + @academic = EmployeeAcademic.new + @academics = @profile.profile.employee_academics + @academic_types = ["type1","type2","type3","type4"].collect{|t| [t("recruitment.academic_type.#{t}"), t]} + end + + def edit_employee_academic + @academic = EmployeeAcademic.find(params[:id]) + @academic_types = ["type1","type2","type3","type4"].collect{|t| [t("recruitment.academic_type.#{t}"), t]} + end + + def update_academic + academic = EmployeeAcademic.find(params[:id]) + academic.update_attributes(employee_academic_params) + redirect_to employee_academics_path + end + + def create_academic + if params[:commit] == "Add" + academic = EmployeeAcademic.create(employee_academic_params) + redirect_to employee_academics_path + elsif params[:commit] = "Next" + if params[:employee_academic][:degree_name].present? + academic = EmployeeAcademic.create(employee_academic_params) + end + redirect_to employee_portfolio_path + end + end + + + def employee_portfolio end def recruitment_dashboard - @jobsposted = @profile.profile.recruitment_jobs.desc(:created_at) - @page = "/#{I18n.locale.to_s}" + Page.where(:module => "recruitment").first.url rescue "#" + if @profile.is_employer? + @jobsposted = @profile.profile.recruitment_jobs.desc(:created_at) + @page = "/#{I18n.locale.to_s}" + Page.where(:module => "recruitment").first.url rescue "#" + elsif @profile.is_employee? + @applications = @profile.profile.employee_job_applications.desc(:created_at) + @page = "/#{I18n.locale.to_s}" + Page.where(:module => "recruitment").first.url rescue "#" + end end def editprofile @@ -174,7 +299,46 @@ class RecruitmentsController < PseudoSessionController def updateprofile @profile.update_attributes(profile_params) - redirect_to mydashboard_path + if @profile.is_employer? + redirect_to mydashboard_path + elsif @profile.is_employee? + if params[:commit] == "Next" + if params[:step] == "step3" + redirect_to employee_experience_path + elsif params[:step] == "step1" + redirect_to employee_academics_path + end + elsif params[:commit] == "Save" + redirect_to mydashboard_path + end + end + end + + def employee_experience + @exeperiences = @profile.employee_profile.employee_experiences.desc(:created_at) + @experience = EmployeeExperience.new + end + + def create_experience + if params[:commit] == "Add" + academic = EmployeeExperience.create(employee_exp_params) + redirect_to employee_experience_path + elsif params[:commit] = "Finish" + if params[:employee_experience][:job_title].present? || params[:employee_experience][:company_name].present? + academic = EmployeeExperience.create(employee_exp_params) + end + redirect_to mydashboard_path + end + end + + def edit_employee_experience + @experience = EmployeeExperience.find(params[:id]) + end + + def update_exmployee_experience + experience = EmployeeExperience.find(params[:id]) + experience.update_attributes(employee_exp_params) + redirect_to employee_experience_path end def addjob @@ -281,6 +445,12 @@ class RecruitmentsController < PseudoSessionController rjobs end + def filter_candidates + end + + def advanced_filter_candidates + end + def get_layout "recruit" end @@ -290,7 +460,20 @@ class RecruitmentsController < PseudoSessionController end def profile_params - params.require(:recruit_profile).permit! + par = params.require(:recruit_profile).permit! + if par[:employee_profile_attributes][:skills].present? + par[:employee_profile_attributes][:skills] = par[:employee_profile_attributes][:skills].split(",") + par[:employee_profile_attributes][:skills].collect!{|sk| sk.strip} + end + par + end + + def employee_academic_params + params.require(:employee_academic).permit! + end + + def employee_exp_params + params.require(:employee_experience).permit! end def recruitment_job_params diff --git a/app/models/employee_academic.rb b/app/models/employee_academic.rb new file mode 100644 index 0000000..6f486f1 --- /dev/null +++ b/app/models/employee_academic.rb @@ -0,0 +1,12 @@ +class EmployeeAcademic + include Mongoid::Document + include Mongoid::Timestamps + + field :academic_type #type1 -> bachelors, type2 -> masters, type3 -> phd, type4 -> course + field :degree_name, localize: true + field :start_date, type: DateTime + field :end_date, type: DateTime + field :note, localize: true + + belongs_to :employee_profile +end \ No newline at end of file diff --git a/app/models/employee_experience.rb b/app/models/employee_experience.rb new file mode 100644 index 0000000..8590083 --- /dev/null +++ b/app/models/employee_experience.rb @@ -0,0 +1,14 @@ +class EmployeeExperience + include Mongoid::Document + include Mongoid::Timestamps + + field :company_name, localize: true + field :job_title, localize: true + field :responsibilities, localize: true + field :start_date, type: DateTime + field :end_date, type: DateTime + + belongs_to :employee_profile + + +end \ No newline at end of file diff --git a/app/models/employee_job_application.rb b/app/models/employee_job_application.rb new file mode 100644 index 0000000..fc300fd --- /dev/null +++ b/app/models/employee_job_application.rb @@ -0,0 +1,12 @@ +class EmployeeJobApplication + include Mongoid::Document + include Mongoid::Timestamps + + field :job + + belongs_to :employee_profile + + def get_job + RecruitmentJob.find(self.job) rescue nil + end +end \ No newline at end of file diff --git a/app/models/employee_profile.rb b/app/models/employee_profile.rb index ebc44a6..3bf0d6e 100644 --- a/app/models/employee_profile.rb +++ b/app/models/employee_profile.rb @@ -2,5 +2,55 @@ class EmployeeProfile include Mongoid::Document include Mongoid::Timestamps + # personal info + mount_uploader :avatar, ImageUploader + + field :gender #type1 -> male, type2 -> female, type3 -> other + field :dob, type: DateTime + field :marital_status #type1 -> unmarried, type2 -> married + field :phone_number + field :country_code + field :website + field :address, localize: true + field :autobiography, localize: true + field :employment_status #type1 -> employed, type2 -> unemployed + field :active, type: Boolean, :default => true + + # job info + field :desired_job_title, localize: true + field :current_company, localize: true + field :resume_content, localize: true + field :desired_place + field :working_time #type1 -> day shift type2 -> night shift + field :skills, type: Array, :default => [] + field :languages + field :recommendation1_info + field :recommendation2_info + field :experience_years, type: Integer, :default => 0 + field :experience_months, type: Integer, :default => 0 + field :introduction, localize: true + + mount_uploader :resume, AssetUploader + + + belongs_to :recruit_profile + + has_many :employee_academics + has_many :employee_experiences + has_many :employee_job_applications + + scope :job_seekers, ->{where(:active => true)} + + def get_avatar + if self.avatar.url.nil? + return "/assets/person.png" + else + return self.avatar.url + end + end + + def get_current_exp + self.employee_experiences.where(:end_date => nil).first rescue nil + end end \ No newline at end of file diff --git a/app/models/recruit_profile.rb b/app/models/recruit_profile.rb index 4d2ee6e..2f881a0 100644 --- a/app/models/recruit_profile.rb +++ b/app/models/recruit_profile.rb @@ -1,13 +1,14 @@ class RecruitProfile include Mongoid::Document include Mongoid::Timestamps + include Slug EMPLOYEE=1 EMPLOYER=2 field :pseudo_member_id field :email - field :first_name + field :first_name, as: :slug_title field :last_name field :user_type, type: Integer, default: 1 diff --git a/app/views/recruitments/_dashboard_header.html.erb b/app/views/recruitments/_dashboard_header.html.erb index d15bd93..a5a4a44 100644 --- a/app/views/recruitments/_dashboard_header.html.erb +++ b/app/views/recruitments/_dashboard_header.html.erb @@ -1,9 +1,17 @@

Welcome <%= @profile.name %>!

-<% if params[:action] == "recruitment_dashboard" %> +<% if params[:action] == "recruitment_dashboard" && @profile.is_employer? %>
Add Job
diff --git a/app/views/recruitments/_employee_academic_form.html.erb b/app/views/recruitments/_employee_academic_form.html.erb new file mode 100644 index 0000000..eab8fae --- /dev/null +++ b/app/views/recruitments/_employee_academic_form.html.erb @@ -0,0 +1,56 @@ + +
+ <%= f.label :academic_type, "Academic Type", :class => "col-sm-2 control-label" %> +
+ <%= f.select :academic_type, @academic_types, {}, {:class => "form-control"} %> +
+
+ + +
+ <%= f.label :start_date, "Start Date", :class => "col-sm-2 control-label" %> +
+ <%= f.datetime_picker :start_date, :no_label => true, :new_record => @academic.new_record?, :data=>{"picker-type" => "range", "range" => "start"} %> +
+
+ + +
+ <%= f.label :end_date, "End Date", :class => "col-sm-2 control-label" %> +
+ <%= f.datetime_picker :end_date, :no_label => true, :new_record => @academic.new_record?, :data=>{"picker-type" => "range", "range" => "end"} %> +
+
+ + + +
+ <% @site_in_use_locales.each_with_index do |locale, i| %> +
"> + + <%= f.fields_for :degree_name_translations do |fe| %> +
+ <%= fe.label locale, "Degree Name", :class => "col-sm-2 control-label" %> +
+ <%= fe.text_field locale, :class => "form-control", :value => @academic.degree_name_translations[locale] %> +
+
+ <% end %> + + <%= f.fields_for :note_translations do |fe| %> +
+ <%= fe.label locale, "Note", :class => "col-sm-2 control-label" %> +
+ <%= fe.text_area locale, :rows => 10, :class => "form-control", :value => @academic.note_translations[locale] %> +
+
+ <% end %> +
+ <% end %> +
\ No newline at end of file diff --git a/app/views/recruitments/_employee_dashboard.html.erb b/app/views/recruitments/_employee_dashboard.html.erb new file mode 100644 index 0000000..56704aa --- /dev/null +++ b/app/views/recruitments/_employee_dashboard.html.erb @@ -0,0 +1,23 @@ + + + + + + + + + + <% if @applications.blank? %> + + <% else %> + <% @applications.each do |app| %> + <% job = app.get_job %> + + + + + + <% end %> + <% end %> + +
Job TitleCompany NameApplied Date
No jobs applied.
" target="_blank"><%= job.job_title %><%= job.employer_profile.company_name %><%= app.created_at.strftime("%d %B %Y") %>
\ No newline at end of file diff --git a/app/views/recruitments/_employee_experience_form.html.erb b/app/views/recruitments/_employee_experience_form.html.erb new file mode 100644 index 0000000..9036dd9 --- /dev/null +++ b/app/views/recruitments/_employee_experience_form.html.erb @@ -0,0 +1,61 @@ + + +
+ <% @site_in_use_locales.each_with_index do |locale, i| %> +
"> + + <%= f.fields_for :company_name_translations do |fe| %> +
+ <%= fe.label locale, "Company Name", :class => "col-sm-2 control-label" %> +
+ <%= fe.text_field locale, :class => "form-control", :value => @experience.company_name_translations[locale] %> +
+
+ <% end %> + + + <%= f.fields_for :job_title_translations do |fe| %> +
+ <%= fe.label locale, "Job Title", :class => "col-sm-2 control-label" %> +
+ <%= fe.text_field locale, :class => "form-control", :value => @experience.job_title_translations[locale] %> +
+
+ <% end %> + + <%= f.fields_for :responsibilities_translations do |fe| %> +
+ <%= fe.label locale, "Job Responsibilities", :class => "col-sm-2 control-label" %> +
+ <%= fe.text_area locale, :rows => 10, :class => "form-control", :value => @experience.responsibilities_translations[locale] %> +
+
+ <% end %> +
+ <% end %> +
+ + +
+ <%= f.label :start_date, "Start Date", :class => "col-sm-2 control-label" %> +
+ <%= f.datetime_picker :start_date, :no_label => true, :new_record => @experience.new_record?, :data=>{"picker-type" => "range", "range" => "start"} %> +
+
+ + +
+ <%= f.label :end_date, "End Date", :class => "col-sm-2 control-label" %> +
+ <%= f.datetime_picker :end_date, :no_label => true, :new_record => @experience.new_record?, :data=>{"picker-type" => "range", "range" => "end"} %> +
Leave blank if its your current job
+
+
+ + \ No newline at end of file diff --git a/app/views/recruitments/_employee_form.html.erb b/app/views/recruitments/_employee_form.html.erb new file mode 100644 index 0000000..613c663 --- /dev/null +++ b/app/views/recruitments/_employee_form.html.erb @@ -0,0 +1,199 @@ +<%# content_for :page_specific_css do %> + <%= stylesheet_link_tag "lib/main-forms" %> + <%= stylesheet_link_tag "lib/fileupload" %> + <%= stylesheet_link_tag "lib/main-list" %> +<%# end %> +<%# content_for :page_specific_javascript do %> + <%= javascript_include_tag "lib/bootstrap-datetimepicker" %> + <%= javascript_include_tag "lib/datetimepicker/datetimepicker.js" %> + <%= javascript_include_tag "lib/bootstrap-fileupload" %> + <%= javascript_include_tag "lib/file-type" %> +<%# end %> + +

Employee / Fresher Personal Profile

+
+<%= f.fields_for :employee_profile do |fe| %> + +
+ +
+ + + +
+
+ + +
+ <%= fe.label :dob, "Date of Birth", :class => "col-sm-2 control-label" %> +
+ <%= fe.datetime_picker :dob, :no_label => true, :new_record => @profile.new_record? %> +
+
+ + +
+ +
+ + +
+
+ + +
+ <%= fe.label :country_code, "Country Code", :class => "col-sm-2 control-label" %> +
+ <%= fe.text_field :country_code, :class => "form-control" %> +
+
+ + +
+ <%= fe.label :phone_number, "Phone Number", :class => "col-sm-2 control-label" %> +
+ <%= fe.text_field :phone_number, :class => "form-control" %> +
+
+ + +
+ +
+ + +
+
+ + +
+ <%= fe.label :website, "Website / Link", :class => "col-sm-2 control-label" %> +
+ <%= fe.text_field :website, :class => "form-control" %> +
+
+ +
+ <%= fe.label :avatar, "Avatar", :class => "col-sm-2 control-label" %> +
+
+
+ <% if !@profile.new_record? && @profile.employee_profile.avatar.file %> + <%= image_tag @profile.employee_profile.avatar %> + <% else %> + + <% end %> +
+
+ + <%= t(:select_image) %> + <%= t(:change) %> + <%= fe.file_field :avatar %> + + <%= t(:cancel) %> +
+ +
+
+
+
+<% end %> + + +
+ <% @site_in_use_locales.each_with_index do |locale, i| %> +
"> + <%= f.fields_for :employee_profile do |fe| %> + + <%= fe.fields_for :address_translations do |fe| %> +
+ <%= fe.label locale, "Address", :class => "col-sm-2 control-label" %> +
+ <%= fe.text_area locale, :class => "form-control", :value => @profile.employee_profile.address_translations[locale] %> +
+
+ <% end %> + + <%= fe.fields_for :autobiography_translations do |fe| %> +
+ <%= fe.label locale, "Autobiography", :class => "col-sm-2 control-label" %> +
+ <%= fe.text_area locale, :class => "form-control", :value => @profile.employee_profile.autobiography_translations[locale] %> +
+
+ <% end %> + <% end %> +
+ <% end %> +
+
+
+ <%= f.hidden_field :pseudo_member_id, :value => current_pseudo_user.user_name %> + <%= f.hidden_field :email, :value => current_pseudo_user.email %> + <%= f.hidden_field :first_name, :value => current_pseudo_user.first_name %> + <%= f.hidden_field :last_name, :value => current_pseudo_user.last_name %> + <%= f.hidden_field :user_type, :value => "1" %> + + <%= f.submit "Save", :class =>"btn btn-primary" %> + <%= f.submit "Next", :class =>"btn btn-primary" %> +
+
\ No newline at end of file diff --git a/app/views/recruitments/_employer_dashboard.html.erb b/app/views/recruitments/_employer_dashboard.html.erb new file mode 100644 index 0000000..8e271b9 --- /dev/null +++ b/app/views/recruitments/_employer_dashboard.html.erb @@ -0,0 +1,37 @@ + + + + + + + + + + + + <% if @jobsposted.blank? %> + + <% else %> + <% @jobsposted.each do |job| %> + + + + + + + + <% end %> + <% end %> + +
Job TitleJob PostedPosition FilledApplied CandidatesActions
No jobs posted.
" target="_blank"><%= job.job_title %><%= job.created_at.strftime("%Y-%m-%d") %><%= job.filled ? "Yes" : "No" %> + Edit + <% if !job.filled %> + Mark Filled + <% else %> + Not Filled + <% end %> + Delete +
+
+ Add Job +
\ No newline at end of file diff --git a/app/views/recruitments/_employer_form.html.erb b/app/views/recruitments/_employer_form.html.erb index 04c33f8..ea6bb9b 100644 --- a/app/views/recruitments/_employer_form.html.erb +++ b/app/views/recruitments/_employer_form.html.erb @@ -7,6 +7,18 @@ <%= javascript_include_tag "lib/bootstrap-fileupload" %> <%= javascript_include_tag "lib/file-type" %> <%# end %> + + +

Employer Personal Profile

+
+