Commit 7aa058de by thanhnd

applied jobs list

parent b8396dbd
Pipeline #627 failed with stages
in 0 seconds
......@@ -30,6 +30,17 @@ class JobsController < ApplicationController
apply_job.save!
end
def applyjoblist
@applyjoblist = AppliedJob.job_by_id(current_user.id)
@aj = []
@applyjoblist.each do |applyjob|
@aj << Job.find(applyjob.job_id)
end
end
def history
@historyjobs = HistoryJob.job_by_id(current_user.id)
@hj = []
......
......@@ -3,4 +3,8 @@ class AppliedJob < ApplicationRecord
belongs_to :user
validates :fullname, presence: true
validates :email, presence: true
def self.job_by_id(user_id)
select('job_id').where(user_id: user_id)
end
end
<div id="search" class="container p-5 my-2 bg-secondary text-white">
<!-- Search form -->
<form class="form-inline md-form mr-auto mb-4">
<input class="form-control mr-sm-2" type="text" placeholder="Search" aria-label="Search">
<button class="btn btn-outline-warning btn-rounded btn-sm my-0" type="submit">Search</button>
</form>
</div>
<div id="job_favorites"class="container p-5 my-2 bg-secondary text-white">
<% if @applyjoblist.nil? == true %>
<div> This id is not available. </div>
<% else %>
<font color="red"><b><label > Applied - Jobs :</label></b></font>
<ul>
<% @aj.each do |j| %>
<li><%= link_to j.job_name, job_detail_url(j.id) %></li>
<li><%= j.salary %></li>
<li><%= j.level %></li>
<li><%= j.experience %></li>
<li ><span class="text"><%= j.description %></span>
</li>
<br>
<% end %>
</ul>
<% end %>
</div>
\ No newline at end of file
......@@ -16,6 +16,7 @@ Rails.application.routes.draw do
post 'done', to: 'jobs#done', as: :job_done
get 'history', to: 'jobs#history'
get 'favorites', to: 'jobs#favorites'
get 'applyjoblist', to: 'jobs#applyjoblist'
get 'jobs/search' => 'jobs#search', as: :job_search
root 'top_page#index'
# For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment