rails_attend 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +20 -0
- data/README.md +22 -0
- data/Rakefile +32 -0
- data/app/controllers/attend/admin/absence_stats_controller.rb +60 -0
- data/app/controllers/attend/admin/absences_controller.rb +77 -0
- data/app/controllers/attend/admin/attendance_logs_controller.rb +103 -0
- data/app/controllers/attend/admin/attendance_settings_controller.rb +86 -0
- data/app/controllers/attend/admin/attendance_stats_controller.rb +58 -0
- data/app/controllers/attend/admin/attendances_controller.rb +57 -0
- data/app/controllers/attend/admin/base_controller.rb +4 -0
- data/app/controllers/attend/admin/extra_days_controller.rb +63 -0
- data/app/controllers/attend/admin/financial_months_controller.rb +69 -0
- data/app/controllers/attend/admin/overtimes_controller.rb +59 -0
- data/app/controllers/attend/me/absences_controller.rb +71 -0
- data/app/controllers/attend/me/attendance_logs_controller.rb +74 -0
- data/app/controllers/attend/me/attendance_settings_controller.rb +52 -0
- data/app/controllers/attend/me/attendance_stats_controller.rb +27 -0
- data/app/controllers/attend/me/attendances_controller.rb +43 -0
- data/app/controllers/attend/me/base_controller.rb +4 -0
- data/app/controllers/attend/me/calendars_controller.rb +33 -0
- data/app/controllers/attend/me/overtimes_controller.rb +65 -0
- data/app/javascript/packs/controllers/attend/admin/attendance_logs/index.js +1 -0
- data/app/javascript/packs/controllers/attend/admin/attendance_logs/my.js +14 -0
- data/app/javascript/packs/controllers/attend/admin/attendance_settings/create.js +1 -0
- data/app/javascript/packs/controllers/attend/admin/attendance_settings/index.js +1 -0
- data/app/javascript/packs/controllers/attend/admin/attendance_settings/my.js +13 -0
- data/app/javascript/packs/controllers/attend/admin/attendance_settings/new.js +11 -0
- data/app/javascript/packs/controllers/attend/me/absences/new.js +16 -0
- data/app/javascript/packs/controllers/attend/me/absences/update.js +3 -0
- data/app/javascript/packs/controllers/attend/me/attendance_settings/create.js +1 -0
- data/app/javascript/packs/controllers/attend/me/attendance_settings/edit.js +1 -0
- data/app/javascript/packs/controllers/attend/me/attendance_settings/new.js +2 -0
- data/app/javascript/packs/controllers/attend/me/calendars/show.js +48 -0
- data/app/jobs/attendance_job.rb +14 -0
- data/app/models/absence/attend/annual_leave.rb +5 -0
- data/app/models/absence/attend/bereavement_leave.rb +5 -0
- data/app/models/absence/attend/business_trip.rb +5 -0
- data/app/models/absence/attend/children_day_leave.rb +5 -0
- data/app/models/absence/attend/compensatory_leave.rb +5 -0
- data/app/models/absence/attend/marriage_leave.rb +4 -0
- data/app/models/absence/attend/maternity_leave.rb +5 -0
- data/app/models/absence/attend/parental_leave.rb +5 -0
- data/app/models/absence/attend/personal_leave.rb +5 -0
- data/app/models/absence/attend/prenatal_leave.rb +4 -0
- data/app/models/absence/attend/sick_leave.rb +5 -0
- data/app/models/absence/attend/vacation_leave.rb +5 -0
- data/app/models/absence/attend/welfare_leave.rb +5 -0
- data/app/models/attend/absence.rb +5 -0
- data/app/models/attend/absence_stat.rb +5 -0
- data/app/models/attend/application_record.rb +5 -0
- data/app/models/attend/attendance.rb +5 -0
- data/app/models/attend/attendance_log.rb +5 -0
- data/app/models/attend/attendance_setting.rb +5 -0
- data/app/models/attend/attendance_stat.rb +5 -0
- data/app/models/attend/ext/member.rb +33 -0
- data/app/models/attend/extra_day.rb +5 -0
- data/app/models/attend/financial_month.rb +5 -0
- data/app/models/attend/model/absence/business_trip.rb +10 -0
- data/app/models/attend/model/absence/compensatory_leave.rb +5 -0
- data/app/models/attend/model/absence/personal_leave.rb +5 -0
- data/app/models/attend/model/absence/welfare_leave/annual_leave.rb +16 -0
- data/app/models/attend/model/absence/welfare_leave/vacation_leave.rb +16 -0
- data/app/models/attend/model/absence/welfare_leave.rb +5 -0
- data/app/models/attend/model/absence.rb +208 -0
- data/app/models/attend/model/absence_stat.rb +17 -0
- data/app/models/attend/model/attendance.rb +314 -0
- data/app/models/attend/model/attendance_log.rb +165 -0
- data/app/models/attend/model/attendance_setting.rb +61 -0
- data/app/models/attend/model/attendance_stat.rb +104 -0
- data/app/models/attend/model/extra_day.rb +21 -0
- data/app/models/attend/model/financial_month.rb +114 -0
- data/app/models/attend/model/overtime.rb +93 -0
- data/app/models/attend/overtime.rb +5 -0
- data/app/models/attend.rb +11 -0
- data/app/models/concerns/absent.rb +103 -0
- data/app/views/admin/_attend_nav.html.erb +15 -0
- data/app/views/attend/admin/absence_stats/_filter_form.html.erb +9 -0
- data/app/views/attend/admin/absence_stats/_form.html.erb +12 -0
- data/app/views/attend/admin/absence_stats/_index_tbody.html.erb +3 -0
- data/app/views/attend/admin/absence_stats/_index_thead.html.erb +4 -0
- data/app/views/attend/admin/absence_stats/index.html.erb +5 -0
- data/app/views/attend/admin/absences/_absence.html.erb +38 -0
- data/app/views/attend/admin/absences/_edit_form.html.erb +3 -0
- data/app/views/attend/admin/absences/_filter_form.html.erb +8 -0
- data/app/views/attend/admin/absences/_form.html.erb +5 -0
- data/app/views/attend/admin/absences/_index_tbody.html.erb +18 -0
- data/app/views/attend/admin/absences/_index_thead.html.erb +10 -0
- data/app/views/attend/admin/absences/_new_form.html.erb +3 -0
- data/app/views/attend/admin/absences/_show.html.erb +11 -0
- data/app/views/attend/admin/absences/index.html.erb +5 -0
- data/app/views/attend/admin/absences/my.html.erb +5 -0
- data/app/views/attend/admin/attendance_logs/_edit_form.html.erb +5 -0
- data/app/views/attend/admin/attendance_logs/_filter_form.html.erb +11 -0
- data/app/views/attend/admin/attendance_logs/_form.html.erb +6 -0
- data/app/views/attend/admin/attendance_logs/_index_thead.html.erb +19 -0
- data/app/views/attend/admin/attendance_logs/_list.html.erb +61 -0
- data/app/views/attend/admin/attendance_logs/_new_form.html.erb +3 -0
- data/app/views/attend/admin/attendance_logs/index.html.erb +5 -0
- data/app/views/attend/admin/attendance_logs/my.html.erb +5 -0
- data/app/views/attend/admin/attendance_settings/_button.html.erb +4 -0
- data/app/views/attend/admin/attendance_settings/_filter_form.html.erb +11 -0
- data/app/views/attend/admin/attendance_settings/_form.html.erb +7 -0
- data/app/views/attend/admin/attendance_settings/_index_tbody.html.erb +15 -0
- data/app/views/attend/admin/attendance_settings/_index_thead.html.erb +10 -0
- data/app/views/attend/admin/attendance_settings/_new_form.html.erb +8 -0
- data/app/views/attend/admin/attendance_settings/_show_table.html.erb +12 -0
- data/app/views/attend/admin/attendance_settings/index.html.erb +5 -0
- data/app/views/attend/admin/attendance_settings/my.html.erb +5 -0
- data/app/views/attend/admin/attendance_stats/_filter_form.html.erb +10 -0
- data/app/views/attend/admin/attendance_stats/_form.html.erb +6 -0
- data/app/views/attend/admin/attendance_stats/_index_thead.html.erb +10 -0
- data/app/views/attend/admin/attendance_stats/index.html.erb +44 -0
- data/app/views/attend/admin/attendances/_button.html.erb +2 -0
- data/app/views/attend/admin/attendances/_filter_form.html.erb +10 -0
- data/app/views/attend/admin/attendances/_form.html.erb +23 -0
- data/app/views/attend/admin/attendances/_index_tbody.html.erb +61 -0
- data/app/views/attend/admin/attendances/_index_thead.html.erb +22 -0
- data/app/views/attend/admin/attendances/_new_form.html.erb +4 -0
- data/app/views/attend/admin/attendances/index.html.erb +7 -0
- data/app/views/attend/admin/base/_financial_month_menu.html.erb +10 -0
- data/app/views/attend/admin/base/_nav.html.erb +3 -0
- data/app/views/attend/admin/base/_nav_attendances.html.erb +7 -0
- data/app/views/attend/admin/extra_days/_breadcrumb.html.erb +0 -0
- data/app/views/attend/admin/extra_days/_edit_form.html.erb +4 -0
- data/app/views/attend/admin/extra_days/_filter_form.html.erb +5 -0
- data/app/views/attend/admin/extra_days/_form.html.erb +4 -0
- data/app/views/attend/admin/extra_days/_index_tbody.html.erb +3 -0
- data/app/views/attend/admin/extra_days/_index_thead.html.erb +4 -0
- data/app/views/attend/admin/extra_days/_new_form.html.erb +4 -0
- data/app/views/attend/admin/extra_days/index.html.erb +7 -0
- data/app/views/attend/admin/financial_months/_breadcrumb.html.erb +0 -0
- data/app/views/attend/admin/financial_months/_edit_form.html.erb +4 -0
- data/app/views/attend/admin/financial_months/_filter_form.html.erb +9 -0
- data/app/views/attend/admin/financial_months/_form.html.erb +4 -0
- data/app/views/attend/admin/financial_months/_index_tbody.html.erb +9 -0
- data/app/views/attend/admin/financial_months/_index_thead.html.erb +6 -0
- data/app/views/attend/admin/financial_months/_new_form.html.erb +4 -0
- data/app/views/attend/admin/financial_months/events.json.jbuilder +9 -0
- data/app/views/attend/admin/financial_months/index.html.erb +7 -0
- data/app/views/attend/admin/financial_months/index.js +60 -0
- data/app/views/attend/admin/financial_months/show.html.erb +10 -0
- data/app/views/attend/admin/overtimes/_button.html.erb +0 -0
- data/app/views/attend/admin/overtimes/_edit_form.html.erb +4 -0
- data/app/views/attend/admin/overtimes/_filter_form.html.erb +8 -0
- data/app/views/attend/admin/overtimes/_form.html.erb +3 -0
- data/app/views/attend/admin/overtimes/_index_tbody.html.erb +22 -0
- data/app/views/attend/admin/overtimes/_index_thead.html.erb +9 -0
- data/app/views/attend/admin/overtimes/_new_form.html.erb +4 -0
- data/app/views/attend/admin/overtimes/index.html.erb +5 -0
- data/app/views/attend/admin/overtimes/my.html.erb +8 -0
- data/app/views/attend/me/absences/_absence.html.erb +34 -0
- data/app/views/attend/me/absences/_edit_form.html.erb +3 -0
- data/app/views/attend/me/absences/_filter_form.html.erb +11 -0
- data/app/views/attend/me/absences/_form.html.erb +33 -0
- data/app/views/attend/me/absences/_index_tbody.html.erb +24 -0
- data/app/views/attend/me/absences/_index_thead.html.erb +8 -0
- data/app/views/attend/me/absences/_new_form.html.erb +3 -0
- data/app/views/attend/me/absences/_redeeming_form.html.erb +5 -0
- data/app/views/attend/me/absences/_show.html.erb +11 -0
- data/app/views/attend/me/absences/dashboard.html.erb +44 -0
- data/app/views/attend/me/absences/index.html.erb +7 -0
- data/app/views/attend/me/absences/redeeming.js.erb +6 -0
- data/app/views/attend/me/absences/show.html.erb +1 -0
- data/app/views/attend/me/attendance_logs/_edit_form.html.erb +4 -0
- data/app/views/attend/me/attendance_logs/_filter_form.html.erb +11 -0
- data/app/views/attend/me/attendance_logs/_form.html.erb +11 -0
- data/app/views/attend/me/attendance_logs/_index_thead.html.erb +9 -0
- data/app/views/attend/me/attendance_logs/_new_form.html.erb +4 -0
- data/app/views/attend/me/attendance_logs/index.html.erb +42 -0
- data/app/views/attend/me/attendance_settings/_edit_form.html.erb +6 -0
- data/app/views/attend/me/attendance_settings/_index_tbody.html.erb +15 -0
- data/app/views/attend/me/attendance_settings/_index_thead.html.erb +12 -0
- data/app/views/attend/me/attendance_settings/_new_form.html.erb +8 -0
- data/app/views/attend/me/attendance_settings/index.html.erb +5 -0
- data/app/views/attend/me/attendance_stats/_form.html.erb +6 -0
- data/app/views/attend/me/attendance_stats/_search_form.html.erb +5 -0
- data/app/views/attend/me/attendance_stats/edit.html.erb +9 -0
- data/app/views/attend/me/attendance_stats/index.html.erb +49 -0
- data/app/views/attend/me/attendance_stats/new.html.erb +9 -0
- data/app/views/attend/me/attendance_stats/show.html.erb +28 -0
- data/app/views/attend/me/attendances/_button.html.erb +3 -0
- data/app/views/attend/me/attendances/_filter_form.html.erb +9 -0
- data/app/views/attend/me/attendances/_form.html.erb +22 -0
- data/app/views/attend/me/attendances/_index_tbody.html.erb +49 -0
- data/app/views/attend/me/attendances/_index_thead.html.erb +19 -0
- data/app/views/attend/me/attendances/index.html.erb +7 -0
- data/app/views/attend/me/base/_menu.html.erb +8 -0
- data/app/views/attend/me/base/_nav_absences.html.erb +9 -0
- data/app/views/attend/me/base/_nav_attendances.html.erb +10 -0
- data/app/views/attend/me/calendars/events.json.jbuilder +19 -0
- data/app/views/attend/me/calendars/show.html.erb +12 -0
- data/app/views/attend/me/overtimes/_edit_form.html.erb +4 -0
- data/app/views/attend/me/overtimes/_filter_form.html.erb +9 -0
- data/app/views/attend/me/overtimes/_form.html.erb +16 -0
- data/app/views/attend/me/overtimes/_index_tbody.html.erb +23 -0
- data/app/views/attend/me/overtimes/_index_thead.html.erb +6 -0
- data/app/views/attend/me/overtimes/_new_form.html.erb +4 -0
- data/app/views/attend/me/overtimes/index.html.erb +7 -0
- data/app/views/me/_attend_nav.html.erb +12 -0
- data/app/views/me/_nav_attendance_settings.html.erb +8 -0
- data/config/locales/en.attributes.yml +34 -0
- data/config/locales/en.controller.yml +18 -0
- data/config/locales/en.enum.yml +43 -0
- data/config/locales/en.notify.yml +38 -0
- data/config/locales/zh.attributes.yml +34 -0
- data/config/locales/zh.controller.yml +40 -0
- data/config/locales/zh.enum.yml +43 -0
- data/config/locales/zh.notify.yml +38 -0
- data/config/routes.rb +70 -0
- data/lib/rails_attend/config.rb +11 -0
- data/lib/rails_attend/engine.rb +25 -0
- data/lib/rails_attend.rb +2 -0
- metadata +269 -0
@@ -0,0 +1,93 @@
|
|
1
|
+
module Attend
|
2
|
+
module Model::Overtime
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
included do
|
6
|
+
attribute :start_at, :datetime
|
7
|
+
attribute :finish_at, :datetime
|
8
|
+
attribute :note, :string, limit: 1024
|
9
|
+
attribute :comment, :string, limit: 1024
|
10
|
+
attribute :hours, :float
|
11
|
+
|
12
|
+
enum state: {
|
13
|
+
init: 'init',
|
14
|
+
approved: 'approved',
|
15
|
+
denied: 'denied',
|
16
|
+
confirmed: 'confirmed'
|
17
|
+
}, _default: 'init'
|
18
|
+
|
19
|
+
belongs_to :member, class_name: 'Org::Member'
|
20
|
+
|
21
|
+
before_save :compute_hours
|
22
|
+
after_create_commit :send_notification
|
23
|
+
|
24
|
+
validates :start_at, presence: true
|
25
|
+
validates :finish_at, presence: true
|
26
|
+
validate :validate_same_date
|
27
|
+
|
28
|
+
delegate :name, to: :member, prefix: true
|
29
|
+
|
30
|
+
acts_as_notify(
|
31
|
+
:default,
|
32
|
+
only: [:hours, :start_at, :finish_at, :note],
|
33
|
+
methods: [:state_i18n]
|
34
|
+
)
|
35
|
+
acts_as_notify(
|
36
|
+
:request,
|
37
|
+
only: [:hours, :start_at, :finish_at, :note],
|
38
|
+
methods: [:member_name]
|
39
|
+
)
|
40
|
+
end
|
41
|
+
|
42
|
+
def do_trigger(params = {})
|
43
|
+
self.trigger_to state: params[:state]
|
44
|
+
|
45
|
+
self.class.transaction do
|
46
|
+
self.save!
|
47
|
+
to_notification(
|
48
|
+
member: self.member,
|
49
|
+
link: url_helpers.oa_overtimes_url(id: self.id),
|
50
|
+
verbose: true
|
51
|
+
)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def send_notification
|
56
|
+
to_notification(
|
57
|
+
member: self.member.parent,
|
58
|
+
cc_emails: [
|
59
|
+
self.member.office&.absence_email,
|
60
|
+
self.member.email,
|
61
|
+
*cc_emails
|
62
|
+
],
|
63
|
+
link: url_helpers.my_admin_overtimes_url(id: self.id),
|
64
|
+
code: :request,
|
65
|
+
verbose: true
|
66
|
+
)
|
67
|
+
end
|
68
|
+
|
69
|
+
def compute_hours
|
70
|
+
_hours = (self.finish_at - self.start_at).div(1800) / 2.0
|
71
|
+
|
72
|
+
if _hours > 0 && _hours <= 4
|
73
|
+
self.hours = _hours
|
74
|
+
elsif _hours > 4 && _hours <= 5
|
75
|
+
self.hours = 4
|
76
|
+
elsif _hours > 5 && _hours <= 9
|
77
|
+
self.hours = _hours - 1
|
78
|
+
elsif _hours > 9
|
79
|
+
self.hours = 8
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
def validate_same_date
|
84
|
+
if self.finish_at.to_date != self.start_at.to_date
|
85
|
+
self.errors.add :base, 'Start At and Finish At must be in same day!'
|
86
|
+
end
|
87
|
+
if self.finish_at < self.start_at
|
88
|
+
self.errors.add :base, 'Start At can not later than Finish At!'
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
end
|
93
|
+
end
|
@@ -0,0 +1,103 @@
|
|
1
|
+
class Absent
|
2
|
+
attr_reader :member
|
3
|
+
|
4
|
+
def initialize(member_id, type = nil)
|
5
|
+
@member_id = member_id
|
6
|
+
@type = type
|
7
|
+
|
8
|
+
@member = Member.find(member_id)
|
9
|
+
@absence_stat = AbsenceStat.find_by(member_id: member_id, year: Date.today.year)
|
10
|
+
end
|
11
|
+
|
12
|
+
def stat
|
13
|
+
@stat ||= @member.absences.current_range_stat(Date.today.beginning_of_year, Date.today.end_of_year)
|
14
|
+
end
|
15
|
+
|
16
|
+
def left_stat
|
17
|
+
|
18
|
+
end
|
19
|
+
|
20
|
+
def used_hours(type = @type)
|
21
|
+
stat[type.to_s].to_f
|
22
|
+
end
|
23
|
+
|
24
|
+
def total_hours(type = @type)
|
25
|
+
col = type.underscore.split('_')[0] + '_days'
|
26
|
+
begin
|
27
|
+
self.send(col).to_i * 8
|
28
|
+
rescue NoMethodError
|
29
|
+
nil
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def left_hours(type = @type)
|
34
|
+
return unless total_hours(type)
|
35
|
+
total_hours(type) - used_hours(type)
|
36
|
+
end
|
37
|
+
|
38
|
+
def annual_days
|
39
|
+
case member.office&.country
|
40
|
+
when 'China'
|
41
|
+
china_annual_days
|
42
|
+
when 'Switzerland'
|
43
|
+
switzerland_annual_days
|
44
|
+
when 'Serbia'
|
45
|
+
common_annual_days(20)
|
46
|
+
when 'Spain'
|
47
|
+
common_annual_days(24)
|
48
|
+
else
|
49
|
+
china_annual_days
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
# for china
|
54
|
+
def china_annual_days
|
55
|
+
dis = TimeHelper.exact_distance_time member.join_on, Date.today
|
56
|
+
total_years = dis[:year] + (dis[:month] + member.previous_months.to_i) / 12
|
57
|
+
if total_years >= 1 && total_years < 10
|
58
|
+
base = 5
|
59
|
+
elsif total_years >= 10 && total_years < 20
|
60
|
+
base = 10
|
61
|
+
elsif total_years >= 20
|
62
|
+
base = 20
|
63
|
+
else
|
64
|
+
base = 0
|
65
|
+
end
|
66
|
+
|
67
|
+
if member.join_on.year == Date.today.year
|
68
|
+
_base = (Date.today.end_of_year - member.join_on + 1) / 365.0 * base
|
69
|
+
real_base = _base.floor
|
70
|
+
else
|
71
|
+
real_base = base
|
72
|
+
end
|
73
|
+
real_base + dis[:year].to_i
|
74
|
+
end
|
75
|
+
|
76
|
+
def switzerland_annual_days
|
77
|
+
dis = TimeHelper.exact_distance_time member.join_on, Date.today
|
78
|
+
_years = Date.today.year - member.join_on.year
|
79
|
+
join_month = member.join_on.month
|
80
|
+
if _years == 0
|
81
|
+
base = (20 / 12.0 * dis[:year]).half_round
|
82
|
+
elsif __years == 1
|
83
|
+
base = (25 / 12.0 * (12 - join_month)).half_round + (20 / 12.0 * join_month).half_floor
|
84
|
+
else
|
85
|
+
base = 25
|
86
|
+
end
|
87
|
+
|
88
|
+
base
|
89
|
+
end
|
90
|
+
|
91
|
+
def common_annual_days(days = 20)
|
92
|
+
days
|
93
|
+
end
|
94
|
+
|
95
|
+
def marriage_days
|
96
|
+
0
|
97
|
+
end
|
98
|
+
|
99
|
+
def vacation_days
|
100
|
+
0
|
101
|
+
end
|
102
|
+
|
103
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<div class="<%= active_helper(modules: 'attend/admin', active: 'menu ex-accordion is-active', item: 'menu ex-accordion') %>" data-controller="menu">
|
2
|
+
<%= content_tag :div, class: 'menu-list' do %>
|
3
|
+
<%= link_to t('attend.admin.financial_months.index.title'), admin_financial_months_path, class: active_helper(controllers: ['financial_months', 'extra_days'], active: 'is-active') %>
|
4
|
+
<%= link_to t('attend.admin.attendances.index.title'), admin_attendances_path, class: active_helper(controllers: ['attendances', 'attendance_stats', 'attendance_logs'], active: 'is-active') %>
|
5
|
+
<%= link_to t('attend.admin.absences.index.title'), admin_absences_path, class: active_helper(controllers: 'absences', active: 'is-active') %>
|
6
|
+
<%= link_to t('attend.admin.absence_stats.index.title'), admin_absence_stats_path, class: active_helper(controllers: 'absence_stats', active: 'is-active') %>
|
7
|
+
<%= link_to t('attend.admin.overtimes.index.title'), admin_overtimes_path, class: active_helper(controllers: 'overtimes', active: 'is-active') %>
|
8
|
+
<%= link_to t('attend.admin.attendance_settings.index.title'), admin_attendance_settings_path, class: active_helper(controllers: 'attendance_settings', active: 'is-active') -%>
|
9
|
+
<% end %>
|
10
|
+
<a class="menu-label" data-action="menu#toggle">
|
11
|
+
<i class="fas fa-calendar-alt fa-fw"></i>
|
12
|
+
<span><%= t('attend.admin.title') %></span>
|
13
|
+
<i class="fas dropdown"></i>
|
14
|
+
</a>
|
15
|
+
</div>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<%= form_with model: [:admin, @absence_stat] do |f| %>
|
2
|
+
<%= render 'error_messages', target: @absence_stat %>
|
3
|
+
<%= f.select :member_id, options_for_select([[@absence_stat.member&.name, @absence_stat.member_id]], @absence_stat.member_id), { include_blank: true } %>
|
4
|
+
<div class="inline fields">
|
5
|
+
<%= f.label :year %>
|
6
|
+
<div class="two wide field">
|
7
|
+
<%= select_year Date.today, field_name: 'year', prefix: 'absence_stat' %>
|
8
|
+
</div>
|
9
|
+
</div>
|
10
|
+
<%= f.number_field :annual_days, step: 0.5 %>
|
11
|
+
<%= f.submit %>
|
12
|
+
<% end %>
|
@@ -0,0 +1,38 @@
|
|
1
|
+
<table class="ui very basic table">
|
2
|
+
<tbody>
|
3
|
+
<tr>
|
4
|
+
<td class="has-text-right"><%= Absence.human_attribute_name(:member) %></td>
|
5
|
+
<td><%= @absence.member.name %></td>
|
6
|
+
</tr>
|
7
|
+
<tr>
|
8
|
+
<td class="has-text-right"><%= Absence.human_attribute_name(:type) %></td>
|
9
|
+
<td><%= @absence.type_i18n %></td>
|
10
|
+
</tr>
|
11
|
+
<tr>
|
12
|
+
<td class="has-text-right"><%= Absence.human_attribute_name(:start_at) %></td>
|
13
|
+
<td><time><%= @absence.start_at.to_s(:rfc822) %></time></td>
|
14
|
+
</tr>
|
15
|
+
<tr>
|
16
|
+
<td class="has-text-right"><%= Absence.human_attribute_name(:finish_at) %></td>
|
17
|
+
<td><time><%= @absence.finish_at.to_s(:rfc822) %></time></td>
|
18
|
+
</tr>
|
19
|
+
<tr>
|
20
|
+
<td class="has-text-right"><%= Absence.human_attribute_name(:hours) %></td>
|
21
|
+
<td><%= @absence.hours %></td>
|
22
|
+
</tr>
|
23
|
+
<tr>
|
24
|
+
<td class="has-text-right"><%= Absence.human_attribute_name(:checks) %></td>
|
25
|
+
<td>
|
26
|
+
<table class="ui very basic table">
|
27
|
+
<% @absence.checks.each do |check| %>
|
28
|
+
<tr>
|
29
|
+
<td><%= Absence.enum_i18n(:state, check.state) %></td>
|
30
|
+
<td><%= check.comment %></td>
|
31
|
+
<td><%= check.member.name %></td>
|
32
|
+
</tr>
|
33
|
+
<% end %>
|
34
|
+
</table>
|
35
|
+
</td>
|
36
|
+
</tr>
|
37
|
+
</tbody>
|
38
|
+
</table>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<td><%= model.member.name %></td>
|
2
|
+
<td><%= model.type_i18n %></td>
|
3
|
+
<td>
|
4
|
+
<p><time data-controller="time" data-format="YYYY-MM-DD HH:mm"><%= model.start_at.to_s(:rfc822) %></time></p>
|
5
|
+
<p><time data-controller="time" data-format="YYYY-MM-DD HH:mm"><%= model.finish_at.to_s(:rfc822) %></time></p>
|
6
|
+
</td>
|
7
|
+
<td><%= model.hours %></td>
|
8
|
+
<td><%= model.comment %></td>
|
9
|
+
<td class="tags">
|
10
|
+
<label class="tag"><%= model.state_i18n %></label>
|
11
|
+
<% if model.init? %>
|
12
|
+
<div class="buttons are-small">
|
13
|
+
<%= link_to 'Approve', new_check_path('Absence', model.id, state: 'approved'), class: 'ui positive button' %>
|
14
|
+
<div class="or"></div>
|
15
|
+
<%= link_to 'Deny', new_check_path('Absence', model.id, state: 'denied'), class: 'ui negative button' %>
|
16
|
+
</div>
|
17
|
+
<% end %>
|
18
|
+
</td>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<th><%= Attend::Absence.human_attribute_name(:member) %></th>
|
2
|
+
<th><%= Attend::Absence.human_attribute_name(:type) %></th>
|
3
|
+
<th>
|
4
|
+
<p><%= Attend::Absence.human_attribute_name(:start_at) %></p>
|
5
|
+
<p><%= Attend::Absence.human_attribute_name(:finish_at) %></p>
|
6
|
+
</th>
|
7
|
+
<th><%= Attend::Absence.human_attribute_name(:hours) %></th>
|
8
|
+
<th><%= Attend::Absence.human_attribute_name(:comment) %></th>
|
9
|
+
<th><%= Attend::Absence.human_attribute_name(:state) %></th>
|
10
|
+
<th></th>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<th>
|
2
|
+
<%= AttendanceLog.human_attribute_name(:id) %>
|
3
|
+
<%= check_box_tag :attendance_log_all, 1, false, onclick: "toggleAll(this, 'attendance_log_id')", id: nil %>
|
4
|
+
</th>
|
5
|
+
<th>
|
6
|
+
<p><%= AttendanceLog.human_attribute_name(:name) %></p>
|
7
|
+
<p><%= AttendanceLog.human_attribute_name(:number) %></p>
|
8
|
+
</th>
|
9
|
+
<th>
|
10
|
+
<p><%= AttendanceLog.human_attribute_name(:record_at) %></p>
|
11
|
+
<p><%= AttendanceLog.human_attribute_name(:created_at) %></p>
|
12
|
+
</th>
|
13
|
+
<th><%= AttendanceLog.human_attribute_name(:kind) %></th>
|
14
|
+
<th>
|
15
|
+
<p><%= AttendanceLog.human_attribute_name(:processed) %></p>
|
16
|
+
<p><%= AttendanceLog.human_attribute_name(:source) %></p>
|
17
|
+
</th>
|
18
|
+
<th><%= AttendanceLog.human_attribute_name(:state) %></th>
|
19
|
+
<th></th>
|