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,27 @@
|
|
1
|
+
module Attend
|
2
|
+
class Me::AttendanceStatsController < Me::BaseController
|
3
|
+
before_action :set_attendance_stat, only: [:show]
|
4
|
+
|
5
|
+
def index
|
6
|
+
q_params = {}
|
7
|
+
q_params.merge! params.permit(:financial_month_id)
|
8
|
+
@attendance_stats = current_member.attendance_stats.default_where(q_params).page(params[:page])
|
9
|
+
end
|
10
|
+
|
11
|
+
def show
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
def set_attendance_stat
|
16
|
+
@attendance_stat = AttendanceStat.find(params[:id])
|
17
|
+
end
|
18
|
+
|
19
|
+
def attendance_stat_params
|
20
|
+
params.fetch(:attendance_stat, {}).permit(
|
21
|
+
:member_id,
|
22
|
+
:financial_month_id
|
23
|
+
)
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module Attend
|
2
|
+
class Me::AttendancesController < Me::BaseController
|
3
|
+
before_action :set_attendance, only: [:show, :edit, :update, :destroy]
|
4
|
+
|
5
|
+
def index
|
6
|
+
q_params = {}
|
7
|
+
q_params.merge! params.permit(:id)
|
8
|
+
|
9
|
+
@attendances = current_member.attendances.default_where(q_params).order(attend_on: :desc).page(params[:page])
|
10
|
+
end
|
11
|
+
|
12
|
+
def show
|
13
|
+
end
|
14
|
+
|
15
|
+
def edit
|
16
|
+
end
|
17
|
+
|
18
|
+
def update
|
19
|
+
if @attendance.update(attendance_params)
|
20
|
+
redirect_to admin_attendances_url
|
21
|
+
else
|
22
|
+
render :edit
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def destroy
|
27
|
+
@attendance.destroy
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
def set_attendance
|
32
|
+
@attendance = Attendance.find(params[:id])
|
33
|
+
end
|
34
|
+
|
35
|
+
def attendance_params
|
36
|
+
params.fetch(:attendance, {}).permit(
|
37
|
+
:start_at,
|
38
|
+
:finish_at
|
39
|
+
)
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module Attend
|
2
|
+
class Me::CalendarsController < Me::BaseController
|
3
|
+
|
4
|
+
def show
|
5
|
+
q_params = {
|
6
|
+
department_id: current_member.department_id
|
7
|
+
}
|
8
|
+
q_params.merge! Department.extract_multi_attributes q_params
|
9
|
+
|
10
|
+
@department = Department.find @query_params[:department_id]
|
11
|
+
end
|
12
|
+
|
13
|
+
def events
|
14
|
+
@financial_months = FinancialMonth.default_where('end_date-gte': params[:start], 'begin_date-lte': params[:end])
|
15
|
+
department = Department.find params[:department_id] if params[:department_id]
|
16
|
+
department ||= current_member.department
|
17
|
+
department_ids = department.self_and_descendant_ids
|
18
|
+
@absence_events = Absence.current_range_events(params[:start], params[:end], department_ids)
|
19
|
+
|
20
|
+
if @financial_months
|
21
|
+
render 'events'
|
22
|
+
else
|
23
|
+
render json: { events: [] }
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
def calendar_params
|
29
|
+
params.fetch(:calendar, {}).permit()
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
module Attend
|
2
|
+
class Me::OvertimesController < Me::BaseController
|
3
|
+
before_action :set_overtime, only: [:show, :edit, :update, :destroy]
|
4
|
+
|
5
|
+
def index
|
6
|
+
q_params = {}
|
7
|
+
q_params.merge! params.permit(:start_at)
|
8
|
+
|
9
|
+
@overtimes = current_member.overtimes.default_where(q_params).page(params[:page])
|
10
|
+
end
|
11
|
+
|
12
|
+
def new
|
13
|
+
@overtime = current_member.overtimes.build
|
14
|
+
end
|
15
|
+
|
16
|
+
def create
|
17
|
+
@overtime = current_member.overtimes.build(overtime_params)
|
18
|
+
|
19
|
+
if @overtime.save
|
20
|
+
redirect_to me_overtimes_url
|
21
|
+
else
|
22
|
+
render :new
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def show
|
27
|
+
end
|
28
|
+
|
29
|
+
def edit
|
30
|
+
end
|
31
|
+
|
32
|
+
def update
|
33
|
+
@overtime.assign_attributes(overtime_params)
|
34
|
+
@overtime.state = 'init' if @overtime.changed?
|
35
|
+
|
36
|
+
if @overtime.save
|
37
|
+
redirect_to me_overtimes_url
|
38
|
+
else
|
39
|
+
render :edit
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def destroy
|
44
|
+
@overtime.destroy
|
45
|
+
redirect_to me_overtimes_url
|
46
|
+
end
|
47
|
+
|
48
|
+
private
|
49
|
+
def set_overtime
|
50
|
+
@overtime = Overtime.find(params[:id])
|
51
|
+
end
|
52
|
+
|
53
|
+
def overtime_params
|
54
|
+
q = params.fetch(:overtime, {}).permit(
|
55
|
+
:start_at,
|
56
|
+
:finish_at,
|
57
|
+
:note,
|
58
|
+
:cc_emails
|
59
|
+
)
|
60
|
+
q[:cc_emails] = q[:cc_emails].to_s.split(/[,,]\s*/)
|
61
|
+
q
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
import './my'
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import 'stimulus_com/checkbox'
|
2
|
+
|
3
|
+
|
4
|
+
listenCheckedIds('attendance_log_id');
|
5
|
+
|
6
|
+
$('input[name=attendance_log_id]').change(function(){
|
7
|
+
var remind_link = new URL($('#checked_attendance_log')[0].href);
|
8
|
+
$('#checked_attendance_log').attr('href', remind_link.pathname + '?add_ids=' + getAddIds('attendance_log_id'))
|
9
|
+
});
|
10
|
+
|
11
|
+
$('input[name=attendance_log_all]').change(function(){
|
12
|
+
var remind_link = new URL($('#checked_attendance_log')[0].href);
|
13
|
+
$('#checked_attendance_log').attr('href', remind_link.pathname + '?add_ids=' + getAddIds('attendance_log_id'))
|
14
|
+
});
|
@@ -0,0 +1 @@
|
|
1
|
+
import './new'
|
@@ -0,0 +1 @@
|
|
1
|
+
import './my'
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import 'stimulus_com/checkbox'
|
2
|
+
|
3
|
+
listenCheckedIds('attendance_setting_id');
|
4
|
+
|
5
|
+
$('input[name=attendance_setting_id]').change(function(){
|
6
|
+
var remind_link = new URL($('#checked_attendance_setting')[0].href);
|
7
|
+
$('#checked_attendance_setting').attr('href', remind_link.pathname + '?add_ids=' + getAddIds('attendance_setting_id'))
|
8
|
+
});
|
9
|
+
|
10
|
+
$('input[name=attendance_setting_all]').change(function(){
|
11
|
+
var remind_link = new URL($('#checked_attendance_setting')[0].href);
|
12
|
+
$('#checked_attendance_setting').attr('href', remind_link.pathname + '?add_ids=' + getAddIds('attendance_setting_id'))
|
13
|
+
});
|
@@ -0,0 +1,11 @@
|
|
1
|
+
$('#attendance_setting_member_id').dropdown({
|
2
|
+
apiSettings: {
|
3
|
+
url: '/my/member/search?q={query}'
|
4
|
+
},
|
5
|
+
fields: {
|
6
|
+
name: 'name',
|
7
|
+
value: 'id'
|
8
|
+
}
|
9
|
+
});
|
10
|
+
$('#attendance_setting_financial_month_id').dropdown();
|
11
|
+
$('#attendance_setting_on_time').dropdown();
|
@@ -0,0 +1,16 @@
|
|
1
|
+
$('#absence_compensatory').dropdown();
|
2
|
+
$('#absence_start_at_4i').dropdown();
|
3
|
+
$('#absence_start_at_5i').dropdown();
|
4
|
+
$('#absence_finish_at_4i').dropdown();
|
5
|
+
$('#absence_finish_at_5i').dropdown();
|
6
|
+
$('#absence_redeeming_days').dropdown();
|
7
|
+
|
8
|
+
$('#absence_type').dropdown({
|
9
|
+
onChange: function (value, text, $selectedItem) {
|
10
|
+
var search_url = new URL(window.location.origin);
|
11
|
+
search_url.pathname = 'oa/absences/redeeming';
|
12
|
+
search_url.search = $.param({type: value});
|
13
|
+
|
14
|
+
fetch_xhr_script(search_url);
|
15
|
+
}
|
16
|
+
});
|
@@ -0,0 +1 @@
|
|
1
|
+
import './new'
|
@@ -0,0 +1 @@
|
|
1
|
+
$('#attendance_setting_on_time').dropdown();
|
@@ -0,0 +1,48 @@
|
|
1
|
+
$(document).ready(function() {
|
2
|
+
|
3
|
+
$('#calendar').fullCalendar({
|
4
|
+
header: {
|
5
|
+
left: 'prev,next today',
|
6
|
+
center: 'title',
|
7
|
+
right: 'month,agendaWeek,agendaDay'
|
8
|
+
},
|
9
|
+
aspectRatio: 3,
|
10
|
+
height: 'auto',
|
11
|
+
firstDay: 1,
|
12
|
+
fixedWeekCount: false,
|
13
|
+
eventSources: [
|
14
|
+
{
|
15
|
+
url: '/oa/calendar/events',
|
16
|
+
data: {
|
17
|
+
department_id: $('#calendar').data("department-id")
|
18
|
+
},
|
19
|
+
error: function() {
|
20
|
+
alert('there was an error while fetching events!');
|
21
|
+
}
|
22
|
+
}
|
23
|
+
],
|
24
|
+
displayEventTime: false,
|
25
|
+
eventMouseover: function(event, jsEvent, view) {
|
26
|
+
$(this).popup({
|
27
|
+
content: event.start.format('Do h:mm a') + '-' + event.end.format('Do h:mm a'),
|
28
|
+
position: 'top center',
|
29
|
+
distanceAway: -4,
|
30
|
+
className: {
|
31
|
+
popup: 'ui inverted small popup',
|
32
|
+
}
|
33
|
+
}).popup('toggle');
|
34
|
+
}
|
35
|
+
})
|
36
|
+
|
37
|
+
});
|
38
|
+
|
39
|
+
document.addEventListener('turbolinks:before-cache', function() {
|
40
|
+
$('#calendar').fullCalendar('delete');
|
41
|
+
$('#calendar').html('');
|
42
|
+
$('.ui.popup').remove();
|
43
|
+
})
|
44
|
+
|
45
|
+
function reloadCalendar(source, newSource) {
|
46
|
+
$('#calendar').fullCalendar('removeEventSource', source)
|
47
|
+
.fullCalendar('addEventSource', newSource)
|
48
|
+
}
|