bookyt_projects 0.9.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/app/controllers/timesheets_controller.rb +9 -0
- data/app/models/bookyt_projects/employee.rb +9 -0
- data/app/models/work_day.rb +25 -0
- data/app/views/projects/_show.html.haml +1 -1
- data/app/views/timesheets/index.html.haml +21 -0
- data/config/routes.rb +1 -1
- data/lib/bookyt_projects/railtie.rb +4 -2
- data/lib/bookyt_projects/version.rb +1 -1
- metadata +8 -5
- data/app/views/activities/new.js.erb +0 -10
@@ -0,0 +1,9 @@
|
|
1
|
+
class TimesheetsController < ApplicationController
|
2
|
+
def index
|
3
|
+
@employee = Employee.find(params[:employee_id])
|
4
|
+
@employment = @employee.employments.current
|
5
|
+
|
6
|
+
days = (Date.today.beginning_of_month..Date.today.end_of_month).to_a
|
7
|
+
@work_days = days.map{|day| WorkDay.new(day, @employment)}
|
8
|
+
end
|
9
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
class WorkDay
|
2
|
+
attr_accessor :date, :employment
|
3
|
+
|
4
|
+
def initialize(date, employment)
|
5
|
+
@date = date
|
6
|
+
@employment = employment
|
7
|
+
end
|
8
|
+
|
9
|
+
def hours_due
|
10
|
+
case date.wday
|
11
|
+
when 6, 0
|
12
|
+
0.0
|
13
|
+
else
|
14
|
+
employment.daily_workload
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def hours_worked
|
19
|
+
employment.employee.activities.where(:when => date).to_a.sum(&:duration)
|
20
|
+
end
|
21
|
+
|
22
|
+
def overtime
|
23
|
+
hours_worked - hours_due
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
%h1= t_title
|
2
|
+
|
3
|
+
%table.list
|
4
|
+
%tr
|
5
|
+
%th Datum
|
6
|
+
%th Wochentag
|
7
|
+
%th Soll-Stunden
|
8
|
+
%th Stunden
|
9
|
+
%th Über-/Unterzeit
|
10
|
+
%th Saldo
|
11
|
+
|
12
|
+
- overall_overtime = 0
|
13
|
+
- @work_days.each do |day|
|
14
|
+
- overall_overtime += day.overtime
|
15
|
+
%tr
|
16
|
+
%td= day.date
|
17
|
+
%td= l(day.date, :format => '%A')
|
18
|
+
%td= day.hours_due
|
19
|
+
%td= day.hours_worked
|
20
|
+
%td= day.overtime
|
21
|
+
%td= overall_overtime
|
data/config/routes.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bookyt_projects
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 55
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
8
|
+
- 10
|
9
9
|
- 0
|
10
|
-
version: 0.
|
10
|
+
version: 0.10.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Roman Simecek (CyT)
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2011-10-
|
19
|
+
date: 2011-10-25 00:00:00 +02:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
@@ -107,16 +107,19 @@ files:
|
|
107
107
|
- app/controllers/activities_controller.rb
|
108
108
|
- app/controllers/project_states_controller.rb
|
109
109
|
- app/controllers/projects_controller.rb
|
110
|
+
- app/controllers/timesheets_controller.rb
|
110
111
|
- app/models/activity.rb
|
112
|
+
- app/models/bookyt_projects/employee.rb
|
111
113
|
- app/models/project.rb
|
112
114
|
- app/models/project_state.rb
|
115
|
+
- app/models/work_day.rb
|
113
116
|
- app/views/activities/_form.html.haml
|
114
117
|
- app/views/activities/_list.html.haml
|
115
|
-
- app/views/activities/new.js.erb
|
116
118
|
- app/views/project_states/_form.html.haml
|
117
119
|
- app/views/projects/_form.html.haml
|
118
120
|
- app/views/projects/_list.html.haml
|
119
121
|
- app/views/projects/_show.html.haml
|
122
|
+
- app/views/timesheets/index.html.haml
|
120
123
|
- config/application.rb
|
121
124
|
- config/boot.rb
|
122
125
|
- config/locales/de.yml
|
@@ -1,10 +0,0 @@
|
|
1
|
-
$('#new_<%= resource.class.name.underscore %>').remove();
|
2
|
-
var form = '<div id="new_activity_dialog"><%=j render "form" %></div>';
|
3
|
-
$('#<%= resource.class.name.tableize %>_list').before(form);
|
4
|
-
$('#new_activity_dialog').dialog({
|
5
|
-
modal: true,
|
6
|
-
minWidth: 580,
|
7
|
-
title: '<%=j t_title :edit, Activity %>'
|
8
|
-
});
|
9
|
-
|
10
|
-
initializeBehaviours();
|