Commit 404a9c9c by Ngô Trung Hưng

create method search applied

parent 7e991bbd
Pipeline #1080 failed with stages
in 0 seconds
...@@ -77,4 +77,48 @@ ...@@ -77,4 +77,48 @@
#apply_industry_id { #apply_industry_id {
@include admin_select__child() @include admin_select__child()
}
.block_result_applied {
margin-top: 100px;
}
.card {
margin-bottom: 10px !important;
}
.job_name.big_w {
font-size: 18px !important;
}
.info__name {
margin-bottom: 0px !important;
}
.card {
background-color: antiquewhite !important;
&:hover {
box-shadow: 0px 0px 5px 1px #3e3712;
transition: 0.3s;
}
}
.avt_user {
text-align: center;
}
.img_avt_user {
width: 170px;
height: 170px;
border: 2px solid #666;
border-radius: 50%;
}
.content_user {
font-family: 'Raleway', sans-serif;
}
.h_user_info {
font-size: 30px;
}
@media only screen and (max-width: 768px) {
.block_result_applied {
padding-top: 60px;
}
} }
\ No newline at end of file
...@@ -712,7 +712,7 @@ $main-color: #23303D; ...@@ -712,7 +712,7 @@ $main-color: #23303D;
} }
.job_name { .job_name {
font-size: 16px; font-size: 16px;
line-height: 14px; // line-height: 14px;
font-weight: 600; font-weight: 600;
color: #d41323; color: #d41323;
overflow: hidden; overflow: hidden;
......
# frozen_string_literal: true
class Searches
attr_accessor :params
def initialize(params)
@params = params
end
def search
debugger
@result_after_fillter_date = AppliedJob.where("created_at BETWEEN ? AND ?", parse_date[:past_time], parse_date[:currnet_time] )
end
def parse_date
dt = {}
dt[:past_time] = Date.new(params['past_time(1i)'].to_i, params['past_time(2i)'].to_i, params['past_time(3i)'].to_i)
dt[:currnet_time] = Date.new(params['current_time(1i)'].to_i, params['current_time(2i)'].to_i, params['current_time(3i)'].to_i)
dt
end
end
...@@ -9,8 +9,7 @@ class AdminController < ApplicationController ...@@ -9,8 +9,7 @@ class AdminController < ApplicationController
def index def index
debugger debugger
# data_time = Apply.parse_datetime(params[:apply]) @applied = (Searches.new(params[:apply]).search if params[:apply].present?) || AppliedJob.order(created_at: :desc)
puts 'ahihi'
@apply = Apply.new @apply = Apply.new
end end
......
...@@ -9,6 +9,12 @@ class UsersController < ApplicationController ...@@ -9,6 +9,12 @@ class UsersController < ApplicationController
def my_page; end def my_page; end
def personal_page
@user = User.find_by_id params[:user_id]
return render 'error/page_not_found' if @user.blank?
@jobs = @user.applied_jobs.includes(:job).order(created_at: :desc)
end
def set_lang def set_lang
current_user.update_current_language(params[:lang]) if user_signed_in? current_user.update_current_language(params[:lang]) if user_signed_in?
redirect_to '/' redirect_to '/'
......
class AdminDecorator < Draper::Decorator
delegate_all
# Define presentation-specific methods here. Helpers are accessed through
# `helpers` (aka `h`). You can override attributes, for example:
#
# def created_at
# helpers.content_tag :span, class: 'time' do
# object.created_at.strftime("%a %m/%d/%y")
# end
# end
end
...@@ -5,4 +5,8 @@ class AppliedJobDecorator < Draper::Decorator ...@@ -5,4 +5,8 @@ class AppliedJobDecorator < Draper::Decorator
def applied_at def applied_at
object.created_at.localtime.strftime('%H:%M %d - %m - %Y') object.created_at.localtime.strftime('%H:%M %d - %m - %Y')
end end
def applied_at_in_admin_page
object.created_at.localtime.strftime('%d - %m - %Y')
end
end end
# frozen_string_literal: true
# Decorator
class UserDecorator < Draper::Decorator
delegate_all
def join_at
created_at.strftime('%d - %m - %Y')
end
end
\ No newline at end of file
<div class="container">
<div class="block_result_applied">
<hr>
<div class="row">
<%= render partial: 'card_candidate', collection: @applied, as: :data %>
</div>
</div>
</div>
<%# <%= render 'shared/paginate', data: @applied, as: :data %> %>
<div class="col-lg-6 col-sm-12">
<div class="card">
<div class="card-body">
<div class="lol">
<%= link_to data.job.name, detail_job_path(id: data.job_id), class: 'job_name big_w' %>
</div>
<span class="info__name"><b><%= t('pages.mypage.name')%></b></span>: <%= link_to data.name, personal_page_path(user_id: data.user_id), class: 'info__name' %>
<div class="lol">
<p class="info__name"><b><%= t('pages.mypage.cv') %>: <%= link_to data.cv.identifier, data.cv.url, target: '_blank', class: 'link_ct pdf' %></b></p>
</div>
<p class="info__name"><b><%= t('pages.mypage.email') %>: <%= data.email %></b></p>
<p class="info__name"><b><%= t('pages.mypage.applied_at') %><%= data.decorate.applied_at_in_admin_page %></b></p>
</div>
</div>
</div>
<% provide(:title, 'Admin') %>
<%= render 'box_filter' %> <%= render 'box_filter' %>
<%= render 'shared/scroll_top' %> <%= render 'shared/scroll_top' %>
<div class="" style="width: 100%; height: 300vh;"></div> <%= render 'box_result_applied' %>
\ No newline at end of file
<div class="container">
<div class="row">
<div class="col-lg-12">
<div class="breadcrumb_total_search_pagination_jobs">
<div class="pagination_jobs">
<div class="paginator">
<%= paginate data %>
</div>
</div>
</div>
</div>
</div>
</div>
\ No newline at end of file
<% provide(:title, 'Trang cá nhân') %>
<hr>
<div class="container">
<div class="row">
<div class="col-lg-2">
<div class="avt_user">
<%= image_tag 'avt', class: 'img_avt_user'%>
</div>
</div>
<div class="col-lg-10">
<div class="content_user">
<h5 class="h_user_info"><%= t('profile.title') %><h5><hr>
<span><b><%= t('profile.name') %></b></span><span class="user_info"><%= @user.name %></span><br>
<span><b><%= t('profile.email') %></b></span><span class="user_info"><%= @user.email %></span><br>
<span><b><%= t('profile.join_at') %></b></span><span class="user_info"><%= @user.decorate.join_at %></span>
</div><hr>
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="col-lg-12">
<hr>
<div class="box_text_five_jobs">
<span><%= t('apply_job.title') %></span>
</div>
<hr>
</div>
<% if @jobs.blank? %>
<div class="col-lg-12">
<div class="breadcrumb_total_search">
<span class="breadcrumb-item active">
<%= t('apply_job.no_record') %>
</span>
</div>
</div>
<% else %>
<%= render partial: 'apply_job/block_info_job', collection: @jobs, as: :data %>
<% end %>
</div>
</div>
<%= render 'shared/scroll_top' %>
...@@ -72,6 +72,7 @@ en: ...@@ -72,6 +72,7 @@ en:
myjob: 'My jobs' myjob: 'My jobs'
nofile: 'Please upload your cv' nofile: 'Please upload your cv'
you_are_using: "You're using:" you_are_using: "You're using:"
applied_at: 'Applied at: '
errors: errors:
back_to_home: "Let's go back to the homepage" back_to_home: "Let's go back to the homepage"
error_500_1: 'There are some errors in this path' error_500_1: 'There are some errors in this path'
...@@ -151,3 +152,8 @@ en: ...@@ -151,3 +152,8 @@ en:
admin: admin:
search: 'Search' search: 'Search'
dl: 'Download CSV' dl: 'Download CSV'
profile:
title: 'Profile'
name: 'Name: '
email: 'Email: '
join_at: 'Join at: '
...@@ -72,6 +72,7 @@ vi: ...@@ -72,6 +72,7 @@ vi:
myjob: 'Công việc của tôi' myjob: 'Công việc của tôi'
nofile: 'Vui lòng tải lên cv của bạn' nofile: 'Vui lòng tải lên cv của bạn'
you_are_using: 'Bạn đang sử dụng:' you_are_using: 'Bạn đang sử dụng:'
applied_at: 'Ứng tuyển lúc: '
errors: errors:
back_to_home: 'Cùng mình quay lại trang chủ nhé' back_to_home: 'Cùng mình quay lại trang chủ nhé'
error_500_1: ' vài lỗi trong đường dẫn này' error_500_1: ' vài lỗi trong đường dẫn này'
...@@ -151,4 +152,9 @@ vi: ...@@ -151,4 +152,9 @@ vi:
admin: admin:
search: 'Tìm kiếm' search: 'Tìm kiếm'
dl: 'Tải về CSV' dl: 'Tải về CSV'
profile:
title: 'Thông tin thí sinh'
name: 'Họ tên: '
email: 'Email: '
join_at: 'Ngày tham gia: '
\ No newline at end of file
...@@ -10,6 +10,7 @@ Rails.application.routes.draw do ...@@ -10,6 +10,7 @@ Rails.application.routes.draw do
get 'admin/applies', to: 'admin#index', as: :applies get 'admin/applies', to: 'admin#index', as: :applies
get 'admin', to: 'admin#routing', as: :admin get 'admin', to: 'admin#routing', as: :admin
get 'info/user/:user_id', to: 'users#personal_page', as: :personal_page
get 'register/:code', to: 'users#confirm_sign_up', as: :confirm_sign_up get 'register/:code', to: 'users#confirm_sign_up', as: :confirm_sign_up
get 'industries', to: 'industry#index', as: :industry_index get 'industries', to: 'industry#index', as: :industry_index
......
# frozen_string_literal: true
namespace :admin do
task create_acc: :environment do
Admin.create do |ad|
ad.email = 'admin@mi.com'
ad.password = '11111111'
ad.password_confirmation = '11111111'
end
end
end
\ No newline at end of file
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