diff --git a/app/controllers/recruitments_controller.rb b/app/controllers/recruitments_controller.rb index 0aa9314..9fc7753 100644 --- a/app/controllers/recruitments_controller.rb +++ b/app/controllers/recruitments_controller.rb @@ -38,7 +38,7 @@ class RecruitmentsController < PseudoSessionController total_pages = 0 end candidates.each do |candidate| - company = !candidate.current_company.nil? && candidate.current_company != "" ? candidate.current_company : candidate.get_current_exp + company = !candidate.current_company.nil? && candidate.current_company != "" ? candidate.current_company : candidate.get_current_exp.company_name company = "N/A" if company.nil? if candidate.experience_years == 0 && candidate.experience_months == 0 wey = t("recruitment.fresher") @@ -163,12 +163,16 @@ class RecruitmentsController < PseudoSessionController end recommendations = [] - profile.employee_recommendations.desc(:creted_at).each do |rec| - recommendations << { + profile.employee_recommendations.desc(:created_at).each do |rec| + t = { "name" => rec.name, "email" => rec.email, "rec-letter" => rec.info } + + t["download-file"] = !rec.file.nil? && !rec.file.url.nil? ? "#{t("recruitment.download_file")}" : "" + + recommendations << t end academics = [] @@ -294,11 +298,17 @@ class RecruitmentsController < PseudoSessionController if job.part_time? parttime = "#{t("recruitment.internship_part_time")}" end + { "infos" => infos, "data" => { "post-type" => job.get_post_type_label, "part-time" => parttime, + "exchange-duration-title" => t("recruitment.exchange_duration"), + "min-credit-title" => t("recruitment.min_credit_score"), + "min-credit" => (job.min_credit_score > 0 ? job.min_credit_score : t("recruitment.not_available")), + "exchange-start-title" => t("recruitment.exchange_start_date"), + "exchange-start" => (job.exchange_start_date.nil? ? t("recruitment.not_available") : job.exchange_start_date ), "internship-duration-title" => t("recruitment.internship_duration"), "internship-duration" => duration, "perks-title" => t("recruitment.perks_title"), @@ -510,7 +520,9 @@ class RecruitmentsController < PseudoSessionController end def create_recommendation - rec = EmployeeRecommendation.create(recommendation_params) + if request.request_method == "POST" + rec = EmployeeRecommendation.create(recommendation_params) + end end def delete_employee_recommendation @@ -575,13 +587,30 @@ class RecruitmentsController < PseudoSessionController end - # ------ ------ internship ------ ------- # + # ------ ------ internship ------ ------- # def addinternship @job = RecruitmentJob.new @academic_types = ["type1","type2","type3"].collect{|t| [t("recruitment.academic_type.#{t}"), t]} end + def editinternship + @job = RecruitmentJob.find(params[:id]) + @academic_types = ["type1","type2","type3"].collect{|t| [t("recruitment.academic_type.#{t}"), t]} + end + + # ------ ------ exchange ------ ------- # + + def addexchange + @job = RecruitmentJob.new + @academic_types = ["type1","type2","type3"].collect{|t| [t("recruitment.academic_type.#{t}"), t]} + end + + def editexchange + @job = RecruitmentJob.find(params[:id]) + @academic_types = ["type1","type2","type3"].collect{|t| [t("recruitment.academic_type.#{t}"), t]} + end + private def filter_jobs(params, type) @@ -676,9 +705,11 @@ class RecruitmentsController < PseudoSessionController def recruitment_job_params par = params.require(:recruitment_job).permit! - if par[:skills].present? + if par[:skills].present? par[:skills] = par[:skills].split(",") par[:skills].collect!{|sk| sk.strip} + elsif par[:skills] == "" + par[:skills] = [] end par end diff --git a/app/models/employee_recommendation.rb b/app/models/employee_recommendation.rb index efa2db3..c0039a7 100644 --- a/app/models/employee_recommendation.rb +++ b/app/models/employee_recommendation.rb @@ -6,6 +6,7 @@ class EmployeeRecommendation field :email field :info field :employee_recommendation_token + mount_uploader :file, AssetUploader belongs_to :employee_profile end \ No newline at end of file diff --git a/app/models/recruitment_job.rb b/app/models/recruitment_job.rb index d685c83..10d0416 100644 --- a/app/models/recruitment_job.rb +++ b/app/models/recruitment_job.rb @@ -34,6 +34,10 @@ class RecruitmentJob field :internship_duration, type: Integer, :default => 0 field :perks #type1 => certificate, type2 => placement offer, type3 => informal dress code + #exchanges + field :exchange_start_date, type: DateTime + field :min_credit_score, type: Integer, :default => 0 + field :filled, type: Boolean, :default => false diff --git a/app/views/recruitments/_dashboard_header.html.erb b/app/views/recruitments/_dashboard_header.html.erb index c7fbbd3..855d5e3 100644 --- a/app/views/recruitments/_dashboard_header.html.erb +++ b/app/views/recruitments/_dashboard_header.html.erb @@ -19,5 +19,6 @@ <% 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 index 8ebff2e..d368f99 100644 --- a/app/views/recruitments/_employee_dashboard.html.erb +++ b/app/views/recruitments/_employee_dashboard.html.erb @@ -17,9 +17,11 @@
<%= rec.email %>