@@ -44,16 +44,22 @@ See COPYRIGHT and LICENSE files for more details.
4444 )
4545%>
4646
47+ <%= render(Primer::Beta::Subhead.new) do |subhead|
48+ subhead.with_heading(tag: :h3, size: :medium) { I18n.t(:label_start_and_finished) }
49+ subhead.with_description { I18n.t(:description_time_settings) }
50+ end %>
51+
4752<%=
48- settings_primer_form_with(scope: :settings, action: :update, method: :patch) do |time_form|
53+ settings_primer_form_with(
54+ scope: :settings,
55+ action: :update,
56+ method: :patch,
57+ data: {
58+ controller: "disable-when-checked",
59+ disable_when_checked_reversed_value: true
60+ }
61+ ) do |time_form|
4962 render_inline_settings_form(time_form) do |form|
50- form.html_content do
51- render(Primer::Beta::Subhead.new(hide_border: true)) do |subhead|
52- subhead.with_heading(tag: :h3, size: :medium) { I18n.t(:label_mandatory_fields) }
53- subhead.with_description { I18n.t(:description_time_settings) }
54- end
55- end
56-
5763 form.check_box(
5864 name: :allow_tracking_start_and_end_times,
5965 caption: I18n.t(:setting_allow_tracking_start_and_end_times_caption)
@@ -64,7 +70,82 @@ See COPYRIGHT and LICENSE files for more details.
6470 disabled: !EnterpriseToken.allows_to?(:time_entry_time_restrictions)
6571 )
6672
67- form.submit
73+ form.submit(name: :submit, label: I18n.t(:button_update_start_finish_times), scheme: :default)
74+ end
75+ end
76+ %>
77+
78+ <%= render(Primer::Beta::Subhead.new(mt: 3)) do |subhead|
79+ subhead.with_heading(tag: :h3, size: :medium) { I18n.t(:label_time_entry_restrictions) }
80+ subhead.with_description { I18n.t(:description_time_entry_restrictions) }
81+ end %>
82+
83+ <%=
84+ settings_primer_form_with(
85+ scope: :settings,
86+ action: :update,
87+ method: :patch,
88+ data: {
89+ controller: "disable-when-checked",
90+ disable_when_checked_reversed_value: true
91+ }
92+ ) do |time_form|
93+ render_inline_settings_form(time_form) do |form|
94+ form.text_field(
95+ name: :time_entries_max_hours_per_entry,
96+ type: :number,
97+ min: 0,
98+ input_width: :small,
99+ caption: I18n.t(:setting_time_entries_max_hours_per_entry_caption),
100+ disabled: !EnterpriseToken.allows_to?(:time_entry_time_restrictions)
101+ )
102+
103+ form.text_field(
104+ name: :time_entries_max_hours_per_day,
105+ type: :number,
106+ min: 0,
107+ input_width: :small,
108+ caption: I18n.t(:setting_time_entries_max_hours_per_day_caption),
109+ disabled: !EnterpriseToken.allows_to?(:time_entry_time_restrictions)
110+ )
111+
112+ form.check_box(
113+ name: :time_entries_prohibit_logging_on_non_working_days,
114+ caption: I18n.t(:setting_time_entries_prohibit_logging_on_non_working_days_caption),
115+ disabled: !EnterpriseToken.allows_to?(:time_entry_time_restrictions)
116+ )
117+
118+ form.check_box(
119+ name: :time_entries_limit_to_user_working_hours,
120+ caption: I18n.t(:setting_time_entries_limit_to_user_working_hours_caption),
121+ disabled: !EnterpriseToken.allows_to?(:time_entry_time_restrictions)
122+ )
123+
124+ form.check_box(
125+ name: :time_entries_prohibit_logging_for_past_months,
126+ caption: I18n.t(:setting_time_entries_prohibit_logging_for_past_months_caption),
127+ disabled: !EnterpriseToken.allows_to?(:time_entry_time_restrictions),
128+ data: {
129+ target_name: "time_entries_prohibit_logging_for_past_months",
130+ disable_when_checked_target: "cause"
131+ }
132+ )
133+
134+ form.text_field(
135+ name: :time_entries_past_month_grace_days,
136+ type: :number,
137+ min: 0,
138+ input_width: :small,
139+ caption: I18n.t(:setting_time_entries_past_month_grace_days_caption),
140+ disabled: !EnterpriseToken.allows_to?(:time_entry_time_restrictions) ||
141+ !Setting.time_entries_prohibit_logging_for_past_months?,
142+ data: {
143+ target_name: "time_entries_prohibit_logging_for_past_months",
144+ disable_when_checked_target: "effect"
145+ }
146+ )
147+
148+ form.submit(name: :submit, label: I18n.t(:button_update_limits), scheme: :default)
68149 end
69150 end
70151%>
0 commit comments