Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 5e8c9df6

Von Moritz Bunkus vor fast 8 Jahren hinzugefügt

  • ID 5e8c9df6674e4174d3e9701a1ae1021ada07dac0
  • Vorgänger 9cd9a517
  • Nachfolger 8631a825

ActionBar: Verwendung bei Buchungsgruppen

Unterschiede anzeigen:

SL/Controller/Buchungsgruppen.pm
33 33
      $chartlist{ $gruppe->id } = SL::DB::TaxzoneChart->get_all_accounts_by_buchungsgruppen_id($gruppe->id);
34 34
  }
35 35

  
36
  $self->setup_list_action_bar;
36 37
  $::form->header;
37 38
  $self->render('buchungsgruppen/list',
38 39
                title           => t8('Booking groups'),
......
51 52
sub show_form {
52 53
  my ($self, %params) = @_;
53 54

  
55
  $self->setup_show_form_action_bar;
54 56
  $self->render('buchungsgruppen/form', %params,
55 57
                 TAXZONES       => SL::DB::Manager::TaxZone->get_all_sorted());
56 58
}
......
188 190

  
189 191
sub init_defaults        { SL::DB::Default->get }
190 192

  
193
#
194
# helpers
195
#
196

  
197
sub setup_show_form_action_bar {
198
  my ($self) = @_;
199

  
200
  my $is_new = !$self->config->id;
201

  
202
  for my $bar ($::request->layout->get('actionbar')) {
203
    $bar->add(
204
      action => [
205
        t8('Save'),
206
        submit    => [ '#form', { action => 'Buchungsgruppen/' . ($is_new ? 'create' : 'update') } ],
207
        checks    => [ 'kivi.validate_form' ],
208
        accesskey => 'enter',
209
      ],
210

  
211
      action => [
212
        t8('Delete'),
213
        submit   => [ '#form', { action => 'Buchungsgruppen/delete' } ],
214
        confirm  => t8('Do you really want to delete this object?'),
215
        disabled => $is_new                  ? t8('This object has not been saved yet.')
216
                  : !$self->config->orphaned ? t8('The object is in use and cannot be deleted.')
217
                  :                            undef,
218
      ],
219

  
220
      link => [
221
        t8('Abort'),
222
        link => $self->url_for(action => 'list'),
223
      ],
224
    );
225
  }
226
}
227

  
228
sub setup_list_action_bar {
229
  my ($self) = @_;
230

  
231
  for my $bar ($::request->layout->get('actionbar')) {
232
    $bar->add(
233
      link => [
234
        t8('Add'),
235
        link => $self->url_for(action => 'new'),
236
      ],
237
    );
238
  }
239
}
240

  
191 241
1;
templates/webpages/buchungsgruppen/form.html
3 3

  
4 4
<h1>[% HTML.escape(title) %]</h1>
5 5

  
6
<form action="controller.pl" method="post">
6
<form action="controller.pl" method="post" id="form">
7 7
[%- L.hidden_tag("id", SELF.config.id) %]
8 8

  
9 9
<table>
10 10
  <tr>
11 11
    <th align="right">[% 'Description' | $T8 %]</th>
12
    <td>[%- L.input_tag("config.description", SELF.config.description) %]</td>
12
    <td>[%- L.input_tag("config.description", SELF.config.description, "data-validate"="required", "data-title"=LxERP.t8("Description")) %]</td>
13 13
  </tr>
14 14
  <tr>
15 15
    <th align="right">[% 'Inventory Account' | $T8 %]</th>
......
44 44
  </tr>
45 45
[%- END %]
46 46
</table>
47

  
48
 <p>
49
  [% L.hidden_tag("action", "Buchungsgruppen/dispatch") %]
50
  [% L.submit_tag("action_" _  (SELF.config.id ? "update" : "create"), LxERP.t8('Save'), onclick="return check_prerequisites();") %]
51
  [%- IF SELF.config.id AND SELF.config.orphaned %]
52
    [% L.submit_tag("action_delete", LxERP.t8('Delete'), confirm=LxERP.t8('Are you sure?')) %]
53
  [%- END %]
54
 </p>
55

  
56
 <hr>
57

  
58
<script type="text/javascript">
59
<!--
60
function check_prerequisites() {
61
  if ($('#config_description').val() === "") {
62
    alert(kivi.t8('The description is missing.'));
63
    return false;
64
  }
65

  
66
  return true;
67
}
68
-->
69
</script>
70 47
</form>
templates/webpages/buchungsgruppen/list.html
31 31
 </table>
32 32
</p>
33 33

  
34
<hr height="3">
35

  
36 34
[% L.sortable_element('#buchungsgruppen_list tbody', url=SELF.url_for(action='reorder'), with='bg_id') %]
37

  
38
<p>
39
 <a href="[% SELF.url_for(action='new') %]">[%- 'Add' | $T8 %]</a>
40
</p>
41

  

Auch abrufbar als: Unified diff