1
|
<script type="text/javascript">
|
2
|
attendanceAlertMsg = "<%= l(:text_are_you_sure) %>";
|
3
|
selectListAlertMsg = "<%=l(:actionview_instancetag_blank_option) %>";
|
4
|
issueExistsAlertMsg = "<%=l(:label_wk_leave_exists) %>";
|
5
|
issueUrl="<%= "#{url_for(:controller => 'wkattendance', :action => 'getIssuesByProject')}" %>";
|
6
|
projectUrl="<%= "#{url_for(:controller => 'wkattendance', :action => 'getProjectByIssue')}" %>";
|
7
|
lblInvalid= " <%= (CGI.unescapeHTML l('activerecord.errors.messages.invalid')).html_safe %>";
|
8
|
lblDaysPerMonth = "<%=l(:label_hours_per_month) %>";
|
9
|
lblAccrual = "<%=l(:label_wk_leave_accrual) %>";
|
10
|
lblAccrualAfter = "<%=l(:label_wk_leave_accrual_after) %>";
|
11
|
lblLeaveIssue = "<%=l(:label_wk_leave_issue) %>";
|
12
|
lblYear = "<%=l(:label_year) %>";
|
13
|
</script>
|
14
|
<fieldset style="display: inline-block; vertical-align: top;">
|
15
|
<legend><%= l(:label_wk_attendance) %></legend>
|
16
|
<p style="margin-left: -110px;">
|
17
|
<%= check_box_tag('settings[wktime_enable_attendance_module]', 1, @settings['wktime_enable_attendance_module'].to_i == 1) %> <label><%= l(:label_enable_attendance_module) %></label>
|
18
|
</p>
|
19
|
<p style="margin-left: -110px;">
|
20
|
<%= check_box_tag('settings[wktime_enable_clock_in_out]', 1, @settings['wktime_enable_clock_in_out'].to_i == 1) %> <label><%= l(:label_wk_enable_clock_in_out) %></label>
|
21
|
</p>
|
22
|
<p style="margin-left: -110px;">
|
23
|
<%= check_box_tag('settings[wktime_work_time_header]', 1, @settings['wktime_work_time_header'].to_i == 1) %> <label><%= l(:label_wk_work_time_header) %></label>
|
24
|
</p>
|
25
|
<p style="margin-left: -110px;">
|
26
|
<%
|
27
|
breakTime = []
|
28
|
if(@settings['wktime_break_time'].blank?)
|
29
|
breakTime = ''
|
30
|
else
|
31
|
@settings['wktime_break_time'].each do |element|
|
32
|
listboxArr = element.split('|')
|
33
|
fromHr = listboxArr[0].to_i>9 ? listboxArr[0].strip : "0"+listboxArr[0].strip
|
34
|
fromMin = listboxArr[1].to_i>9 ? listboxArr[1].strip : "0"+listboxArr[1].strip
|
35
|
toHr = listboxArr[2].to_i>9 ? listboxArr[2].strip : "0"+listboxArr[2].strip
|
36
|
toMin = listboxArr[3].to_i>9 ? listboxArr[3].strip : "0"+listboxArr[3].strip
|
37
|
optionText = fromHr + ":" + fromMin + " - " + toHr + ":" + toMin
|
38
|
breakTime << [optionText,element]
|
39
|
end
|
40
|
end
|
41
|
%>
|
42
|
<label><%= l(:label_wk_break_time) %></label>
|
43
|
<%= select_tag('settings[wktime_break_time]',
|
44
|
options_for_select(breakTime, :selected => 'settings[wktime_break_time]'), :multiple=> true, :style => "width:200px; height:100px;")%>
|
45
|
|
46
|
</p>
|
47
|
<p style="margin-left: -110px;">
|
48
|
<%= link_to "Add", "javascript:showBreakTimeDialog('Add');", :class => "button"%> |
|
49
|
<%= link_to "Edit", "javascript:showBreakTimeDialog('Edit');", :class => "button"%> |
|
50
|
<%= link_to "Delete", "javascript:removeSelectedValue('settings_wktime_break_time');", :class => "button" %>
|
51
|
</p>
|
52
|
|
53
|
<div id="breaktime-dlg" title="<%= l(:label_wk_break_time) %>">
|
54
|
<p>
|
55
|
<label><%= l(:label_date_from) %></label><span style="margin-left:0.5em;"></span>
|
56
|
<%
|
57
|
hr = []
|
58
|
min = []
|
59
|
for i in 0..23
|
60
|
if i < 10
|
61
|
hr << ['0' + i.to_s,i]
|
62
|
else
|
63
|
hr << [i,i]
|
64
|
end
|
65
|
end
|
66
|
i = 0
|
67
|
num = 5
|
68
|
|
69
|
until i > 55 do
|
70
|
if i < 10
|
71
|
min << ['0' + i.to_s,i]
|
72
|
else
|
73
|
min << [i,i]
|
74
|
end
|
75
|
|
76
|
i +=5;
|
77
|
end
|
78
|
%>
|
79
|
<%= select_tag('break_from_hr', options_for_select(hr))%> <%= l(:field_hours) %>
|
80
|
<%= select_tag('break_from_min', options_for_select(min))%> <%= l(:label_wk_minutes) %>
|
81
|
</p>
|
82
|
<p>
|
83
|
<span style="margin-left:1.1em;"></span><label><%= l(:label_date_to) %></label><span style="margin-left:0.5em;"></span>
|
84
|
<%= select_tag('break_to_hr', options_for_select(hr))%> <%= l(:field_hours) %>
|
85
|
<%= select_tag('break_to_min', options_for_select(min))%> <%= l(:label_wk_minutes) %>
|
86
|
</p>
|
87
|
<p>
|
88
|
<%= hidden_field_tag :hdnAction, "" %>
|
89
|
</p>
|
90
|
<p><%= l(:label_hours_note) %></p>
|
91
|
</div>
|
92
|
|
93
|
<p style="margin-left: -110px;">
|
94
|
<%
|
95
|
leave = []
|
96
|
issue_list = Issue.order('subject')
|
97
|
unless issue_list.blank?
|
98
|
issueslist = issue_list.collect {|issue| [issue.subject, issue.id] }
|
99
|
issuehash = Hash[issue_list.map { |u| [u.id, u.subject] }]
|
100
|
else
|
101
|
issueslist = Array.new
|
102
|
issueslist << [ "", 0]
|
103
|
end
|
104
|
projects = Project.where("#{Project.table_name}.status not in(#{Project::STATUS_CLOSED},#{Project::STATUS_ARCHIVED})").order('name')
|
105
|
wktime_helper = Object.new.extend(WktimeHelper)
|
106
|
projArr = wktime_helper.options_for_wktime_project(projects,false)
|
107
|
|
108
|
if(@settings['wktime_leave'].blank?)
|
109
|
leave = ''
|
110
|
else
|
111
|
@settings['wktime_leave'].each do |element|
|
112
|
listboxArr = element.split('|')
|
113
|
issueId = listboxArr[0]
|
114
|
issueName = issuehash[issueId.to_i].blank? ? issueId : issuehash[issueId.to_i]
|
115
|
leaveAccrual = listboxArr[1].blank? ? "" : listboxArr[1]
|
116
|
accrualAfter = listboxArr[2].blank? ? "" : listboxArr[2]
|
117
|
optionText = leaveAccrual.blank? ? issueName : issueName + " : " + leaveAccrual + " " + l(:label_hours_per_month) + " " + l(:label_wk_leave_accrual_after) + " " + accrualAfter + " " + l(:label_year)
|
118
|
leave << [optionText,element]
|
119
|
end
|
120
|
end
|
121
|
%>
|
122
|
<label><%= l(:label_wk_leave) %></label>
|
123
|
<%= select_tag('settings[wktime_leave]',
|
124
|
options_for_select(leave, :selected => 'settings[wktime_leave]'), :multiple=> true, :style => "min-width:200px; height:100px;")%>
|
125
|
|
126
|
</p>
|
127
|
<p style="margin-left: -110px;">
|
128
|
<%= link_to "Add", "javascript:showLeaveDialog('Add');", :class => "button"%> |
|
129
|
<%= link_to "Edit", "javascript:showLeaveDialog('Edit');", :class => "button"%> |
|
130
|
<%= link_to "Delete", "javascript:removeSelectedValue('settings_wktime_leave');", :class => "button" %>
|
131
|
</p>
|
132
|
|
133
|
<div id="leave-dlg" title="<%= l(:label_wk_leave) %>">
|
134
|
<table>
|
135
|
<tr>
|
136
|
<th align="left"><label><%= l(:label_project) %></label></th>
|
137
|
<td class="project" align="left"><%=h select_tag('leave_project', options_for_select(projArr),:onchange => "projectChanged(this,-1);") %></td>
|
138
|
</tr>
|
139
|
<tr>
|
140
|
<th align="left"><label><%= l(:label_wk_leave_issue) %></label><span style="margin-left:0.8em;"></span></th>
|
141
|
<td class="issue" align="left"><%=h select_tag('leave_issue', options_for_select(issueslist)) %></td>
|
142
|
</tr>
|
143
|
<tr>
|
144
|
<th align="left"><label><%= l(:label_wk_leave_short_name) %></label></th>
|
145
|
<td><%= text_field_tag 'wk_leave_short_name','', :size => 4, :maxlength => 4 %></td>
|
146
|
</tr>
|
147
|
<tr>
|
148
|
<th align="left"><label><%= l(:label_wk_leave_accrual) %></label></th>
|
149
|
<td><%= text_field_tag('leave_accrual','', :size => 2.5, :maxlength => 3) %> <%= l(:label_hours_per_month) %></td>
|
150
|
</tr>
|
151
|
<tr>
|
152
|
<th align="left"><label><%= l(:label_wk_leave_accrual_after) %></label></th>
|
153
|
<td><%= text_field_tag 'leave_accrual_after','', :size => 2.5, :maxlength => 3 %> <%= l(:label_year) %></td>
|
154
|
</tr>
|
155
|
<tr>
|
156
|
<th align="left"><label><%= l(:button_reset) %> <%= l(:label_month) %></label></th>
|
157
|
<td><%=h select_tag('wk_attn_leave_reset_month', options_for_select(l('date.month_names').collect.with_index.to_a)) %></td>
|
158
|
</tr>
|
159
|
<tr>
|
160
|
<%= hidden_field_tag :hdnAction, "" %>
|
161
|
</tr>
|
162
|
</table>
|
163
|
</div>
|
164
|
<%
|
165
|
custom_fields = UserCustomField.order('name')
|
166
|
allFields = Hash.new()
|
167
|
fldInFiles = Hash.new()
|
168
|
allFields = {"user_id" => "#{l(:label_user_id)}", "start_time" => "#{l(:label_start_time)}", "end_time" => "#{l(:label_end_time)}", "hours" => "#{l(:label_hours)}" }
|
169
|
unless custom_fields.blank?
|
170
|
cfdate = custom_fields.select {|cf| cf.field_format == 'date'}
|
171
|
cfids = custom_fields.select {|cf| cf.field_format == 'string' || cf.field_format == 'int' }
|
172
|
unless cfdate.blank?
|
173
|
cfd = cfdate.collect {|cf| [cf.name, cf.id] }
|
174
|
cfd.unshift(["",0])
|
175
|
else
|
176
|
cfd = Array.new
|
177
|
cfd << [ "", 0]
|
178
|
end
|
179
|
|
180
|
unless cfids.blank?
|
181
|
cfids.collect {|cf|
|
182
|
allFields.store("#{cf.id}", cf.name)}
|
183
|
end
|
184
|
|
185
|
cfs = custom_fields.collect {|cf| [cf.name, cf.id] }
|
186
|
cfs.unshift(["",0])
|
187
|
else
|
188
|
cfd = Array.new
|
189
|
cfd << [ "", 0]
|
190
|
cfs = Array.new
|
191
|
cfs << [ "", 0]
|
192
|
end
|
193
|
available_fields = allFields
|
194
|
selectedfld = Setting.plugin_redmine_wktime['wktime_fields_in_file']
|
195
|
if !selectedfld.blank?
|
196
|
selectedfld.each do |field|
|
197
|
fldInFiles[field] = allFields[field]
|
198
|
end
|
199
|
available_fields = allFields.select {|key,value| !selectedfld.include? key.to_s}
|
200
|
end
|
201
|
%>
|
202
|
<p style="margin-left: -110px;">
|
203
|
<label><%= l(:label_wk_attn_join_date) %> </label><%=h select_tag('settings[wktime_attn_join_date_cf]',
|
204
|
options_for_select(cfd, :selected => @settings['wktime_attn_join_date_cf'])) %>
|
205
|
</p>
|
206
|
<p style="margin-left: -110px;">
|
207
|
<label><%= l(:label_wk_attn_termination_date) %> </label><%=h select_tag('settings[wktime_attn_terminate_date_cf]',
|
208
|
options_for_select(cfd, :selected => @settings['wktime_attn_terminate_date_cf'])) %>
|
209
|
</p>
|
210
|
<p style="margin-left: -110px;">
|
211
|
<label><%= l(:label_wk_attn_user_dob) %> </label><%=h select_tag('settings[wktime_attn_user_dob_cf]',
|
212
|
options_for_select(cfd, :selected => @settings['wktime_attn_user_dob_cf'])) %>
|
213
|
</p>
|
214
|
<p style="margin-left: -110px;">
|
215
|
<label><%= l(:label_wk_designation) %> </label><%=h select_tag('settings[wktime_attn_designation_cf]',
|
216
|
options_for_select(cfs, :selected => @settings['wktime_attn_designation_cf'])) %>
|
217
|
</p>
|
218
|
<p style="margin-left: -110px;">
|
219
|
<label><%= l(:label_employee_id) %> </label><%=h select_tag('settings[wktime_attn_employee_id_cf]',
|
220
|
options_for_select(cfs, :selected => @settings['wktime_attn_employee_id_cf'])) %>
|
221
|
</p>
|
222
|
</fieldset>
|
223
|
|
224
|
<fieldset style="display: inline-block; vertical-align: top;">
|
225
|
<legend><%= l(:button_import) %></legend>
|
226
|
<%= l(:label_redmine_restart_warning) %>
|
227
|
<p style="margin-left: -180px;">
|
228
|
<%= check_box_tag('settings[wktime_auto_import]', 1, @settings['wktime_auto_import'].to_i == 1) %> <label><%= l(:label_auto_import) %></label>
|
229
|
</p>
|
230
|
<p style="margin-left: -180px;">
|
231
|
<label><%= l(:label_auto_import_time) %></label>
|
232
|
<%
|
233
|
hr = []
|
234
|
for i in 0..23
|
235
|
if i < 10
|
236
|
hr << ['0' + i.to_s,i]
|
237
|
else
|
238
|
hr << [i,i]
|
239
|
end
|
240
|
end
|
241
|
%>
|
242
|
<%= l(:field_hours) %> <%= select_tag('settings[wktime_auto_import_time_hr]', options_for_select(hr,
|
243
|
:selected => @settings['wktime_auto_import_time_hr'].blank? ? 23 : @settings['wktime_auto_import_time_hr']))%>
|
244
|
<%= l(:label_wk_minutes) %> <%= select_tag('settings[wktime_auto_import_time_min]', options_for_select([['00',0],
|
245
|
[15, 15],
|
246
|
[30, 30],
|
247
|
[45, 45]], :selected => @settings['wktime_auto_import_time_min'].blank? ? 0 : @settings['wktime_auto_import_time_min']))%>
|
248
|
</p>
|
249
|
<p style="margin-left: -180px;">
|
250
|
<label><%= l(:label_path) %></label><%= text_field_tag 'settings[wktime_file_to_import]', @settings['wktime_file_to_import'], :size => 40 %>
|
251
|
</p>
|
252
|
<p style="margin-left: -180px;">
|
253
|
<%= check_box_tag('settings[wktime_import_file_headers]', 1, @settings['wktime_import_file_headers'].to_i == 1) %> <label><%= l(:label_import_file_headers) %></label>
|
254
|
</p>
|
255
|
<p style="margin-left: -180px;">
|
256
|
<label><%= l(:label_fields_separator) %></label>
|
257
|
<%= select_tag 'settings[wktime_field_separator]',
|
258
|
options_for_select([[l(:label_comma_char), ','], [l(:label_semi_colon_char), ';']], :selected => @settings['wktime_field_separator'].blank? ? 0 : @settings['wktime_field_separator']) %>
|
259
|
</p>
|
260
|
<p style="margin-left: -180px;">
|
261
|
<label><%= l(:label_fields_wrapper) %></label>
|
262
|
<%= select_tag 'settings[wktime_field_wrapper]',
|
263
|
options_for_select([[l(:label_quote_char), "'"], [l(:label_double_quote_char), '"']], :selected => @settings['wktime_field_wrapper'].blank? ? 0 : @settings['wktime_field_wrapper']) %>
|
264
|
</p>
|
265
|
<p style="margin-left: -180px;">
|
266
|
<label><%= l(:label_encoding) %></label>
|
267
|
<%= select_tag 'settings[wktime_field_encoding]', options_for_select(Setting::ENCODINGS, :selected => @settings['wktime_field_encoding'].blank? ? 0 : @settings['wktime_field_encoding']) %>
|
268
|
</p>
|
269
|
<p style="margin-left: -180px;">
|
270
|
<label><%= l(:setting_date_format) %></label>
|
271
|
<% wktime_helper = Object.new.extend(WktimeHelper) %>
|
272
|
<%= select_tag 'settings[wktime_field_datetime]', options_for_select(wktime_helper.date_format_options, :selected => @settings['wktime_field_datetime'].blank? ? 0 : @settings['wktime_field_datetime'] ) %>
|
273
|
</p>
|
274
|
<table>
|
275
|
<thead>
|
276
|
<tr>
|
277
|
<td></td>
|
278
|
<td><p style="margin-left: -190px;"><label><%= l(:label_available_fields) %></label></p></td>
|
279
|
<td></td>
|
280
|
<td><p style="margin-left: -200px;"><label><%= l(:label_fields_in_file) %></p></label></td>
|
281
|
</tr>
|
282
|
</thead>
|
283
|
<tbody>
|
284
|
<tr valign="top">
|
285
|
<td> </td>
|
286
|
<td>
|
287
|
<%= select_tag('settings[wktime_avialable_fields]', options_for_select(available_fields.invert), :multiple => true, :size=> 10, :style => "min-width:100px; ") %>
|
288
|
</td>
|
289
|
<td valign="center">
|
290
|
<button type="button" onclick="listbox_moveacross('settings_wktime_avialable_fields', 'settings_wktime_fields_in_file')" id="rightmove" style="position:relative; top:40px;">>></button>
|
291
|
<br>
|
292
|
<button type="button" onclick="listbox_moveacross('settings_wktime_fields_in_file', 'settings_wktime_avialable_fields')" id="rightmove" style="position:relative; top:50px;"><<</button>
|
293
|
</td>
|
294
|
<td>
|
295
|
<%= select_tag('settings[wktime_fields_in_file]', options_for_select(fldInFiles.invert, :selected => @settings['wktime_fields_in_file'] ), multiple: true, size: 10, :style => "min-width:100px; ") %>
|
296
|
</td>
|
297
|
</tr>
|
298
|
</tbody>
|
299
|
</table>
|
300
|
</fieldset>
|
301
|
<% if !projArr.blank? %>
|
302
|
<div style = "display:none">
|
303
|
<%=h select_tag('template_projDD', options_for_select(projArr))%>
|
304
|
</div>
|
305
|
<% end %>
|