Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision b52b09d8

Von Moritz Bunkus vor fast 8 Jahren hinzugefügt

  • ID b52b09d864eb75703562a5fdd8d2b09c66669927
  • Vorgänger 0c23c415
  • Nachfolger 36c8af52

ActionBar: Verwendung bei Preisregeln

Unterschiede anzeigen:

SL/Controller/PriceRule.pm
34 34

  
35 35
  my $price_rules = $self->models->get;
36 36

  
37
  $self->setup_search_action_bar;
38

  
37 39
  $self->prepare_report;
38 40

  
39
  $self->report_generator_list_objects(report => $self->{report}, objects => $price_rules, $::form->{inline} ? (layout => 0, header => 0) : ());
41
  $self->report_generator_list_objects(report => $self->{report}, objects => $price_rules, $::form->{inline} ? (layout => 0, header => 0) : (action_bar => 1));
40 42
}
41 43

  
42 44
sub action_new {
......
109 111
  my ($self, %params) = @_;
110 112
  my $is_new  = !$self->price_rule->id;
111 113
  my $title   = $self->form_title(($is_new ? 'create' : 'edit'), $self->price_rule->type);
114
  $self->setup_form_action_bar;
112 115
  $self->render('price_rule/form',
113 116
    title => $title,
114 117
    %params
......
300 303
  );
301 304
}
302 305

  
306
sub setup_search_action_bar {
307
  my ($self, %params) = @_;
308

  
309
  return if $::form->{inline};
310

  
311
  for my $bar ($::request->layout->get('actionbar')) {
312
    $bar->add(
313
      action => [
314
        t8('Search'),
315
        submit    => [ '#search_form', { action => 'PriceRule/list' } ],
316
        accesskey => 'enter',
317
      ],
318
      action => [
319
        t8('Reset'),
320
        call => [ 'kivi.PriceRule.reset_search_form' ],
321
      ],
322

  
323
      combobox => [
324
        action => [
325
          t8('Add'),
326
        ],
327
        link => [
328
          t8('New Sales Price Rule'),
329
          link => $self->url_for(action => 'new', 'price_rule.type' => 'customer', callback => $self->models->get_callback),
330
        ],
331
        link => [
332
          t8('New Purchase Price Rule'),
333
          link => $self->url_for(action => 'new', 'price_rule.type' => 'vendor', callback => $self->models->get_callback),
334
        ],
335
      ], # end of combobox "Add"
336
    );
337
  }
338
}
339

  
340
sub setup_form_action_bar {
341
  my ($self) = @_;
342

  
343
  my $is_new = !$self->price_rule->id;
344

  
345
  for my $bar ($::request->layout->get('actionbar')) {
346
    $bar->add(
347
      combobox => [
348
        action => [
349
          $is_new ? t8('Create') : t8('Save'),
350
          submit    => [ '#form', { action => 'PriceRule/' . ($is_new ? 'create' : 'update') } ],
351
          accesskey => 'enter',
352
        ],
353
        action => [
354
          t8('Use as new'),
355
          submit   => [ '#form', { action => 'PriceRule/create' } ],
356
          disabled => $is_new ? t8('The object has not been saved yet.') : undef,
357
        ],
358
      ], # end of combobox "Save"
359

  
360
      action => [
361
        t8('Delete'),
362
        submit   => [ '#form', { action => 'PriceRule/destroy' } ],
363
        confirm  => t8('Do you really want to delete this object?'),
364
        disabled => $is_new                   ? t8('The object has not been saved yet.')
365
                  : $self->price_rule->in_use ? t8('This object has already been used.')
366
                  :                             undef,
367
      ],
368

  
369
      link => [
370
        t8('Abort'),
371
        link => $self->url_for(action => 'list', 'filter.type' => $self->price_rule->type),
372
      ],
373
    );
374
  }
375
}
376

  
303 377
1;
templates/webpages/price_rule/_filter.html
2 2
[%- USE L %]
3 3
[%- USE LxERP %]
4 4
[%- USE HTML %]
5
<form action='controller.pl' method='post'>
5
<form action='controller.pl' method='post' id='search_form'>
6 6
<div class='filter_toggle'>
7 7
<a href='#' onClick='javascript:$(".filter_toggle").toggle()'>[% 'Show Filter' | $T8 %]</a>
8 8
  [% SELF.filter_summary | html %]
......
86 86

  
87 87
 </table>
88 88

  
89
[% L.hidden_tag('action', 'PriceRule/dispatch') %]
90 89
[% L.hidden_tag('sort_by', FORM.sort_by) %]
91 90
[% L.hidden_tag('sort_dir', FORM.sort_dir) %]
92 91
[% L.hidden_tag('page', FORM.page) %]
93
[% L.input_tag('action_list', LxERP.t8('Continue'), type = 'submit', class='submit') %]
94

  
95
<a class='interact cursor-pointer' onClick='javascript:$("#filter_table input").val("");$("#filter_table input[type=checkbox]").prop("checked", 0);$("#filter_table select").val("")'>[% 'Reset' | $T8 %]</a>
96 92

  
97 93
</div>
98 94

  
templates/webpages/price_rule/form.html
6 6

  
7 7
[%- INCLUDE 'common/flash.html' %]
8 8

  
9
 <form method="post" action="controller.pl">
9
 <form method="post" action="controller.pl" id="form">
10 10
  [% L.hidden_tag("price_rule.id",   SELF.price_rule.id) %]
11 11
  [% L.hidden_tag("price_rule.type", SELF.price_rule.type) %]
12 12

  
......
42 42
<h3>[% 'Then' | $T8 %]:</h3>
43 43
<div>[% 'Set (set to)' | $T8 %] [% L.select_tag('price_rule.price_type', SELF.all_price_types, default=SELF.price_rule.price_type) %] [% 'to (set to)' | $T8 %] [% L.input_tag('price_rule.price_or_discount_as_number', SELF.price_rule.price_or_discount_as_number) %] <a id='price_rule_price_type_help' class='interact cursor-help' title='[% 'Price type explanation' | $T8 %]'>[?]</a>
44 44
</div>
45

  
46
  <p>
47
   [% L.hidden_tag("action", "PriceRule/dispatch") %]
48
   [% L.hidden_tag("callback", FORM.callback) %]
49
   [% L.submit_tag("action_" _  (SELF.price_rule.id ? "update" : "create"), LxERP.t8('Save')) %]
50
   [%- IF SELF.price_rule.id %]
51
    [% L.submit_tag("action_create", LxERP.t8('Save as new')) %]
52
    [% L.submit_tag("action_destroy", LxERP.t8('Delete'), confirm=LxERP.t8('Do you really want to delete this object?')) IF !SELF.price_rule.in_use %]
53
   [%- END %]
54
   <a href="[% SELF.url_for(action='list', 'filter.type'=SELF.price_rule.type) %]">[%- LxERP.t8('Abort') %]</a>
55
  </p>
56 45
 </form>
templates/webpages/price_rule/report_bottom.html
2 2
[% USE T8 %]
3 3
[% USE HTML %]
4 4
[%- L.paginate_controls(models=SELF.models) %]
5

  
6
[%- UNLESS FORM.inline %]
7
<a href="[% SELF.url_for(action='new', 'price_rule.type'='customer', callback=SELF.models.get_callback) | html %]">[% 'New Sales Price Rule' | $T8 %]</a>
8
<a href="[% SELF.url_for(action='new', 'price_rule.type'='vendor', callback=SELF.models.get_callback) | html %]">[% 'New Purchase Price Rule' | $T8 %]</a>
9
[%- END %]

Auch abrufbar als: Unified diff