Revision 8631a825
Von Moritz Bunkus vor fast 8 Jahren hinzugefügt
SL/Controller/Taxzones.pm | ||
---|---|---|
27 | 27 |
|
28 | 28 |
my $taxzones = SL::DB::Manager::TaxZone->get_all_sorted(); |
29 | 29 |
|
30 |
$self->setup_list_action_bar; |
|
30 | 31 |
$self->render('taxzones/list', |
31 | 32 |
title => t8('List of tax zones'), |
32 | 33 |
TAXZONES => $taxzones); |
... | ... | |
42 | 43 |
sub show_form { |
43 | 44 |
my ($self, %params) = @_; |
44 | 45 |
|
46 |
$self->setup_show_form_action_bar; |
|
45 | 47 |
$self->render('taxzones/form', %params, |
46 | 48 |
BUCHUNGSGRUPPEN => SL::DB::Manager::Buchungsgruppe->get_all_sorted); |
47 | 49 |
} |
... | ... | |
179 | 181 |
|
180 | 182 |
sub init_defaults { SL::DB::Default->get }; |
181 | 183 |
|
184 |
# |
|
185 |
# helpers |
|
186 |
# |
|
187 |
|
|
188 |
sub setup_show_form_action_bar { |
|
189 |
my ($self) = @_; |
|
190 |
|
|
191 |
my $is_new = !$self->config->id; |
|
192 |
|
|
193 |
for my $bar ($::request->layout->get('actionbar')) { |
|
194 |
$bar->add( |
|
195 |
action => [ |
|
196 |
t8('Save'), |
|
197 |
submit => [ '#form', { action => 'Taxzones/' . ($is_new ? 'create' : 'update') } ], |
|
198 |
checks => [ 'kivi.validate_form' ], |
|
199 |
accesskey => 'enter', |
|
200 |
], |
|
201 |
|
|
202 |
action => [ |
|
203 |
t8('Delete'), |
|
204 |
submit => [ '#form', { action => 'Taxzones/delete' } ], |
|
205 |
confirm => t8('Do you really want to delete this object?'), |
|
206 |
disabled => $is_new ? t8('This object has not been saved yet.') |
|
207 |
: !$self->config->orphaned ? t8('The object is in use and cannot be deleted.') |
|
208 |
: undef, |
|
209 |
], |
|
210 |
|
|
211 |
link => [ |
|
212 |
t8('Abort'), |
|
213 |
link => $self->url_for(action => 'list'), |
|
214 |
], |
|
215 |
); |
|
216 |
} |
|
217 |
} |
|
218 |
|
|
219 |
sub setup_list_action_bar { |
|
220 |
my ($self) = @_; |
|
221 |
|
|
222 |
for my $bar ($::request->layout->get('actionbar')) { |
|
223 |
$bar->add( |
|
224 |
link => [ |
|
225 |
t8('Add'), |
|
226 |
link => $self->url_for(action => 'new'), |
|
227 |
], |
|
228 |
); |
|
229 |
} |
|
230 |
} |
|
231 |
|
|
182 | 232 |
1; |
templates/webpages/taxzones/form.html | ||
---|---|---|
1 | 1 |
[%- USE HTML -%][%- USE LxERP -%][%- USE L -%][%- USE T8 -%]<h1>[% HTML.escape(title) %]</h1> |
2 | 2 |
[% SET style="width: 400px" %] |
3 | 3 |
|
4 |
<form action="controller.pl" method="post"> |
|
4 |
<form action="controller.pl" method="post" id="form">
|
|
5 | 5 |
[%- L.hidden_tag("id", SELF.config.id) %] |
6 | 6 |
|
7 | 7 |
<table> |
8 | 8 |
<tr> |
9 | 9 |
<th align="right">[% 'Description' | $T8 %]</th> |
10 |
<td>[%- L.input_tag("config.description", SELF.config.description) %]</td> |
|
10 |
<td>[%- L.input_tag("config.description", SELF.config.description, "data-validate"="required", "data-title"=LxERP.t8("Description")) %]</td>
|
|
11 | 11 |
</tr> |
12 | 12 |
[%- FOREACH bg = BUCHUNGSGRUPPEN %] |
13 | 13 |
<tr> |
... | ... | |
34 | 34 |
</table> |
35 | 35 |
|
36 | 36 |
[% LxERP.t8('Obsolete') %]: [% L.checkbox_tag('config.obsolete', checked = SELF.config.obsolete, for_submit=1) %] |
37 |
|
|
38 |
<p> |
|
39 |
[% L.hidden_tag("action", "Taxzones/dispatch") %] |
|
40 |
[% L.submit_tag("action_" _ (SELF.config.id ? "update" : "create"), LxERP.t8('Save'), onclick="return check_prerequisites();") %] |
|
41 |
[%- IF SELF.config.id AND SELF.config.orphaned %] |
|
42 |
[% L.submit_tag("action_delete", LxERP.t8('Delete'), confirm=LxERP.t8('Are you sure?')) %] |
|
43 |
[%- END %] |
|
44 |
<a href="[% SELF.url_for(action='list') %]">[%- LxERP.t8("Cancel") %]</a> |
|
45 |
</p> |
|
46 |
|
|
47 |
<hr> |
|
48 |
|
|
49 |
<script type="text/javascript"> |
|
50 |
<!-- |
|
51 |
function check_prerequisites() { |
|
52 |
if ($('#config_description').val() === "") { |
|
53 |
alert(kivi.t8('The description is missing.')); |
|
54 |
return false; |
|
55 |
} |
|
56 |
|
|
57 |
return true; |
|
58 |
} |
|
59 |
--> |
|
60 |
</script> |
|
61 | 37 |
</form> |
templates/webpages/taxzones/list.html | ||
---|---|---|
22 | 22 |
</table> |
23 | 23 |
</p> |
24 | 24 |
|
25 |
<hr height="3"> |
|
26 |
|
|
27 | 25 |
[% L.sortable_element('#taxzone_list tbody', url=SELF.url_for(action='reorder'), with='tzone_id') %] |
28 |
|
|
29 |
<p> |
|
30 |
<a href="[% SELF.url_for(action='new') %]">[%- 'Add' | $T8 %]</a> |
|
31 |
</p> |
|
32 |
|
Auch abrufbar als: Unified diff
ActionBar: Verwendung bei »Steuerzonen«