bookyt_salary 0.8.0 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- data/app/controllers/salary_templates_controller.rb +15 -0
- data/app/models/salary.rb +8 -2
- data/app/models/salary_item.rb +4 -0
- data/app/models/salary_template.rb +4 -1
- data/app/views/salary_items/_form.html.haml +7 -0
- data/app/views/salary_items/_line_item.html.haml +6 -0
- data/app/views/salary_items/_list_form.html.haml +7 -0
- data/app/views/salary_items/_list_header.html.haml +6 -0
- data/app/views/salary_templates/_form.html.haml +3 -3
- data/app/views/salary_templates/_salary_item_form.html.haml +3 -0
- data/app/views/salary_templates/new_salary_item.js.erb +2 -0
- data/config/locales/bookyt_salary.de.yml +7 -0
- data/config/routes.rb +5 -1
- data/db/migrate/20120118121223_create_salary_items.rb +15 -0
- data/lib/bookyt_salary/version.rb +1 -1
- metadata +11 -3
@@ -8,4 +8,19 @@ class SalaryTemplatesController < AuthorizedController
|
|
8
8
|
|
9
9
|
render 'edit'
|
10
10
|
end
|
11
|
+
|
12
|
+
# has_many :salary_items
|
13
|
+
def new_salary_item
|
14
|
+
if salary_template_id = params[:id]
|
15
|
+
@salary_template = resource_class.find(salary_template_id)
|
16
|
+
else
|
17
|
+
@salary_template = resource_class.new
|
18
|
+
end
|
19
|
+
|
20
|
+
@salary_item = @salary_template.salary_items.build(
|
21
|
+
:times => 1
|
22
|
+
)
|
23
|
+
|
24
|
+
respond_with @salary_item
|
25
|
+
end
|
11
26
|
end
|
data/app/models/salary.rb
CHANGED
@@ -89,9 +89,15 @@ class Salary < Invoice
|
|
89
89
|
|
90
90
|
# Line Items
|
91
91
|
def build_line_items
|
92
|
-
salary_template.
|
92
|
+
salary_template.salary_items.each do |salary_item|
|
93
93
|
line_item = line_items.build(:date => self.value_date)
|
94
|
-
|
94
|
+
|
95
|
+
# Defaults from booking_template
|
96
|
+
line_item.set_booking_template(salary_item.salary_booking_template)
|
97
|
+
|
98
|
+
# Overrides from salary_item
|
99
|
+
line_item.times = salary_item.times if salary_item.times.present?
|
100
|
+
line_item.price = salary_item.price if salary_item.price.present?
|
95
101
|
end
|
96
102
|
end
|
97
103
|
|
@@ -0,0 +1,7 @@
|
|
1
|
+
%tr.salary_item.nested-form-item
|
2
|
+
%td= salary_item.select :salary_booking_template_id, SalaryBookingTemplate.all.map{|template| [template.title, template.id]}, :required => true, :style => 'width: 30em'
|
3
|
+
%td= salary_item.text_field :times, :required => true, :style => 'width: 3em', :autocomplete => "off"
|
4
|
+
%td= salary_item.text_field :price, :required => true, :style => 'width: 5em', :autocomplete => "off"
|
5
|
+
%td.action_links
|
6
|
+
= salary_item.hidden_field :_destroy
|
7
|
+
= link_to t_action(:delete), '#', :class => 'icon-delete-text delete-nested-form-item'
|
@@ -0,0 +1,6 @@
|
|
1
|
+
%tr
|
2
|
+
%th{:style => 'padding: 2px'}= t_attr(:salary_booking_template, SalaryItem)
|
3
|
+
%th{:style => 'padding: 2px; width: 3em'}= t_attr(:times, SalaryItem)
|
4
|
+
%th{:style => 'padding: 2px; width: 3em'}= t_attr(:price, SalaryItem)
|
5
|
+
%th
|
6
|
+
%th.action_links= link_to t_action(:more), [:new_salary_item, resource.persisted? ? resource : resource.class.name.underscore.pluralize.to_sym], :remote => true, :class => 'icon-add-text'
|
@@ -3,11 +3,11 @@
|
|
3
3
|
= f.inputs do
|
4
4
|
.row
|
5
5
|
.span8= f.input :title, :input_html => {"data-autofocus" => true}
|
6
|
-
.span8= f.input :person
|
7
|
-
.row
|
8
|
-
.span16= f.input :salary_booking_templates, :input_html => {:class => 'span12'}
|
6
|
+
.span8= f.input :person, :collection => Employee.all
|
9
7
|
.row
|
10
8
|
.span16= f.input :remarks, :input_html => {:rows => 2, :class => 'span12'}
|
11
9
|
|
10
|
+
= render 'salary_items/list_form', :f => f
|
11
|
+
|
12
12
|
= f.buttons do
|
13
13
|
= f.commit_button
|
@@ -27,6 +27,10 @@ de:
|
|
27
27
|
salary_booking_templates: Lohnarten
|
28
28
|
title: Titel
|
29
29
|
remarks: Bemerkungen
|
30
|
+
salary_item:
|
31
|
+
salary_booking_template: Lohnart
|
32
|
+
times: Anzahl
|
33
|
+
price: Betrag
|
30
34
|
|
31
35
|
salaries:
|
32
36
|
select_employee:
|
@@ -37,3 +41,6 @@ de:
|
|
37
41
|
salary_templates:
|
38
42
|
index:
|
39
43
|
title: Lohnvorlagen
|
44
|
+
salary_items:
|
45
|
+
list:
|
46
|
+
title: Lohnarten
|
data/config/routes.rb
CHANGED
@@ -0,0 +1,15 @@
|
|
1
|
+
class CreateSalaryItems < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :salary_items do |t|
|
4
|
+
t.integer :salary_booking_template_id
|
5
|
+
t.integer :salary_template_id
|
6
|
+
t.decimal :times, :precision => 10, :scale => 2
|
7
|
+
t.decimal :price, :precision => 10, :scale => 2
|
8
|
+
|
9
|
+
t.timestamps
|
10
|
+
end
|
11
|
+
|
12
|
+
add_index :salary_items, :salary_booking_template_id
|
13
|
+
add_index :salary_items, :salary_template_id
|
14
|
+
end
|
15
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bookyt_salary
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 59
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
8
|
+
- 9
|
9
9
|
- 0
|
10
|
-
version: 0.
|
10
|
+
version: 0.9.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- "Simon H\xC3\xBCrlimann (CyT)"
|
@@ -105,6 +105,7 @@ files:
|
|
105
105
|
- app/helpers/salary_booking_template_helper.rb
|
106
106
|
- app/models/salary.rb
|
107
107
|
- app/models/salary_booking_template.rb
|
108
|
+
- app/models/salary_item.rb
|
108
109
|
- app/models/salary_template.rb
|
109
110
|
- app/views/salaries/_form.html.haml
|
110
111
|
- app/views/salaries/_list.html.haml
|
@@ -119,9 +120,15 @@ files:
|
|
119
120
|
- app/views/salary_booking_templates/_form.html.haml
|
120
121
|
- app/views/salary_booking_templates/_list.html.haml
|
121
122
|
- app/views/salary_booking_templates/_salary_booking_template.html.haml
|
123
|
+
- app/views/salary_items/_form.html.haml
|
124
|
+
- app/views/salary_items/_line_item.html.haml
|
125
|
+
- app/views/salary_items/_list_form.html.haml
|
126
|
+
- app/views/salary_items/_list_header.html.haml
|
122
127
|
- app/views/salary_templates/_form.html.haml
|
123
128
|
- app/views/salary_templates/_list.html.haml
|
129
|
+
- app/views/salary_templates/_salary_item_form.html.haml
|
124
130
|
- app/views/salary_templates/_salary_template.html.haml
|
131
|
+
- app/views/salary_templates/new_salary_item.js.erb
|
125
132
|
- config/application.rb
|
126
133
|
- config/boot.rb
|
127
134
|
- config/locales/bookyt_salary.de.yml
|
@@ -132,6 +139,7 @@ files:
|
|
132
139
|
- db/migrate/20120117113315_create_salary_template_habtm_table.rb
|
133
140
|
- db/migrate/20120117120044_rename_salary_booking_template_habtm_table.rb
|
134
141
|
- db/migrate/20120117122025_add_title_and_remarks_to_salary_templates.rb
|
142
|
+
- db/migrate/20120118121223_create_salary_items.rb
|
135
143
|
- db/seeds.rb
|
136
144
|
- lib/bookyt_salary.rb
|
137
145
|
- lib/bookyt_salary/navigation.rb
|