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 @@ <%= job.get_post_type_label.html_safe %> <% if job.post_type == "type1" %> - " target="_blank"><%= job.job_title %> + " target="_blank"><%= job.job_title %> <% elsif job.post_type == "type2" %> - " target="_blank"><%= job.job_title %> + " target="_blank"><%= job.job_title %> + <% elsif job.post_type == "type3" %> + " target="_blank"><%= job.job_title %> <% end %> <%= job.employer_profile.company_name %> diff --git a/app/views/recruitments/_employer_dashboard.html.erb b/app/views/recruitments/_employer_dashboard.html.erb index b326522..5599f41 100644 --- a/app/views/recruitments/_employer_dashboard.html.erb +++ b/app/views/recruitments/_employer_dashboard.html.erb @@ -18,10 +18,13 @@ <%= job.get_post_type_label.html_safe %> <% if job.post_type == "type1" %> - " target="_blank"><%= job.job_title %> + " target="_blank"><%= job.job_title %> <% elsif job.post_type == "type2" %> - " target="_blank"><%= job.job_title %> + " target="_blank"><%= job.job_title %> + <% elsif job.post_type == "type3" %> + " target="_blank"><%= job.job_title %> <% end %> + <%= job.created_at.strftime("%Y-%m-%d") %> <%= job.filled ? "Yes" : "No" %> @@ -32,7 +35,13 @@ <%= t("recruitment.show_application") %> <% end %> - <%= t("recruitment.edit") %> + <% if job.post_type == "type1" %> + <%= t("recruitment.edit") %> + <% elsif job.post_type == "type2" %> + <%= t("recruitment.edit") %> + <% elsif job.post_type == "type3" %> + <%= t("recruitment.edit") %> + <% end %> <% if !job.filled %> <%= t("recruitment.mark_filled") %> <% else %> @@ -48,4 +57,5 @@ \ No newline at end of file diff --git a/app/views/recruitments/_exchange_form.html.erb b/app/views/recruitments/_exchange_form.html.erb new file mode 100644 index 0000000..0791dd3 --- /dev/null +++ b/app/views/recruitments/_exchange_form.html.erb @@ -0,0 +1,243 @@ +<%# 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-fileupload" %> + <%= javascript_include_tag "lib/file-type" %> + <%= javascript_include_tag "lib/bootstrap-datetimepicker" %> + <%= javascript_include_tag "lib/datetimepicker/datetimepicker.js" %> +<%# end %> + + + + +
+ <% @site_in_use_locales.each_with_index do |locale, i| %> +
"> + + <%= f.fields_for :job_title_translations do |fe| %> +
+ <%= fe.label locale, t("recruitment.exchange_title"), :class => "col-sm-2 control-label" %> +
+ <%= fe.text_field locale, :class => "form-control", :value => @job.job_title_translations[locale] %> +
+
+ <% end %> + + <%= f.fields_for :job_description_translations do |fe| %> +
+ <%= fe.label locale, t("recruitment.exchange_description"), :class => "col-sm-2 control-label" %> +
+ <%= fe.text_area locale, :rows=>5, :class => "form-control", :value => @job.job_description_translations[locale] %> +
+
+ <% end %> + + + <%= f.fields_for :other_conditions_translations do |fe| %> +
+ <%= fe.label locale, t("recruitment.exchange_conditions"), :class => "col-sm-2 control-label" %> +
+ <%= fe.text_area locale, :rows=>5, :class => "form-control", :value => @job.other_conditions_translations[locale] %> +
+
+ <% end %> +
+ <% end %> +
+ + +
+ <%= f.label :min_credit_score, t("recruitment.min_credit_score"), :class => "col-sm-2 control-label" %> +
+ <%= f.number_field :min_credit_score, :class => "form-control", :max => 36, :min => 1 %> +
+
+ + + +
+ <%= f.label :internship_duration, t("recruitment.exchange_duration"), :class => "col-sm-2 control-label" %> +
+ +
+
+ + +
+ <%= f.label :exchange_start_date, t("recruitment.exchange_start_date"), :class => "col-sm-2 control-label" %> +
+ <%= f.datetime_picker :exchange_start_date, :no_label => true, :new_record => @job.new_record? %> +
+
+ + + + + + + + + +
+ <%= f.label :location_of_work, t("recruitment.location"), :class => "col-sm-2 control-label" %> +
+ <%= f.text_field :location_of_work, :class => "form-control"%> +
+
+ +
+ + + + + +
+ <%= f.label :work_experience_years, t("recruitment.work_experience"), :class => "col-sm-2 control-label" %> +
+ <%= f.number_field :work_experience_years, :class => "form-control", :max => 50, :min => 0 %> + +
+
+ <%= f.number_field :work_experience_months, :class => "form-control", :max => 11, :min => 0 %> + +
+
+ + +
+ <%= f.label :academic_type, t("recruitment.academic_type"), :class => "col-sm-2 control-label" %> +
+ <%= f.select :academic_type, @academic_types, {:include_blank => "Select Degree"},{:class => "form-control"} %> +
+
+ + +
+ <%= f.label :academic_requirement, t("recruitment.academic_requirement"), :class => "col-sm-2 control-label" %> +
+ <%= f.text_area :academic_requirement, :class => "form-control"%> +
+
+ + +
+ <%= f.label :language_requirement, t("recruitment.language"), :class => "col-sm-2 control-label" %> +
+ <%= f.text_field :language_requirement, :class => "form-control", :placeholder => t("recruitment.seperate_with_eng") %> +
+
+ +
+
+ <%= f.hidden_field :post_type, :value => "type3" %> + <%= f.hidden_field :employer_profile_id, :value => @profile.profile.id %> + <%= f.submit "Submit", :class =>"btn btn-primary" %> + <%= t("recruitment.cancel") %> +
+
+ + + + + diff --git a/app/views/recruitments/_internship_form.html.erb b/app/views/recruitments/_internship_form.html.erb index 1257a66..1d2769e 100644 --- a/app/views/recruitments/_internship_form.html.erb +++ b/app/views/recruitments/_internship_form.html.erb @@ -68,7 +68,7 @@ <%= f.label :internship_duration, t("recruitment.internship_duration"), :class => "col-sm-2 control-label" %>
@@ -226,11 +226,11 @@
<%= f.label :work_experience_years, t("recruitment.work_experience"), :class => "col-sm-2 control-label" %>
- <%= f.number_field :work_experience_years, :class => "form-control", :max => 50, :min => 0, :value => 0 %> + <%= f.number_field :work_experience_years, :class => "form-control", :max => 50, :min => 0 %>
- <%= f.number_field :work_experience_months, :class => "form-control", :max => 11, :min => 0, :value => 0 %> + <%= f.number_field :work_experience_months, :class => "form-control", :max => 11, :min => 0 %>
diff --git a/app/views/recruitments/_job_form.html.erb b/app/views/recruitments/_job_form.html.erb index 96ed347..d6ea2e4 100644 --- a/app/views/recruitments/_job_form.html.erb +++ b/app/views/recruitments/_job_form.html.erb @@ -187,11 +187,11 @@
<%= f.label :work_experience_years, t("recruitment.work_experience"), :class => "col-sm-2 control-label" %>
- <%= f.number_field :work_experience_years, :class => "form-control", :max => 50, :min => 0, :value => 0 %> + <%= f.number_field :work_experience_years, :class => "form-control", :max => 50, :min => 0 %>
- <%= f.number_field :work_experience_months, :class => "form-control", :max => 11, :min => 0, :value => 0 %> + <%= f.number_field :work_experience_months, :class => "form-control", :max => 11, :min => 0 %>
diff --git a/app/views/recruitments/addexchange.html.erb b/app/views/recruitments/addexchange.html.erb new file mode 100644 index 0000000..b5211a8 --- /dev/null +++ b/app/views/recruitments/addexchange.html.erb @@ -0,0 +1,8 @@ +
+ <%= render :partial => "dashboard_header" %> +

<%= t("recruitment.add_exchange") %>

+
+ <%= form_for @job, url: {:action => "createjob"}, html: {:class => "form-horizontal main-forms"} do |f| %> + <%= render :partial => "exchange_form", locals: {f: f} %> + <% end %> +
\ No newline at end of file diff --git a/app/views/recruitments/editinternship.html.erb b/app/views/recruitments/editinternship.html.erb new file mode 100644 index 0000000..fe559a0 --- /dev/null +++ b/app/views/recruitments/editinternship.html.erb @@ -0,0 +1,8 @@ +
+ <%= render :partial => "dashboard_header" %> +

<%= t("recruitment.edit_internship") %>

+
+ <%= form_for @job, url: "/recruit/#{@job.id.to_s}/updatejob", html: {:class => "form-horizontal main-forms"} do |f| %> + <%= render :partial => "internship_form", locals: {f: f} %> + <% end %> +
\ No newline at end of file diff --git a/app/views/recruitments/employee_recommendation.html.erb b/app/views/recruitments/employee_recommendation.html.erb index 98d5bd3..4a5d519 100644 --- a/app/views/recruitments/employee_recommendation.html.erb +++ b/app/views/recruitments/employee_recommendation.html.erb @@ -75,6 +75,14 @@

<%= rec.email %>

+ <% if !rec.file.nil? && !rec.file.url.nil? %> +
+ + +
+ <% end %>
diff --git a/app/views/recruitments/show.html.erb b/app/views/recruitments/show.html.erb index 057f997..29d9ad2 100644 --- a/app/views/recruitments/show.html.erb +++ b/app/views/recruitments/show.html.erb @@ -4,11 +4,13 @@ <%= render_view %> <% elsif data["type"] == "internships" %> <%= render_view("internships") %> + <% elsif data["type"] == "exchanges" %> + <%= render_view("exchanges") %> <% elsif data["type"] == "candidates" %> <%= render_view("candidate_show") %> <% end %> <% case data["type"] - when "jobs", "internships" %> + when "jobs", "internships", "exchanges" %>