ActionBar: Verwendung in MassInvoiceCreatePrint-Controller (nur Rechnungsliste)
authorMoritz Bunkus <m.bunkus@linet-services.de>
Fri, 11 Nov 2016 14:03:54 +0000 (15:03 +0100)
committerMoritz Bunkus <m.bunkus@linet-services.de>
Tue, 28 Feb 2017 09:43:58 +0000 (10:43 +0100)
SL/Controller/MassInvoiceCreatePrint.pm
js/kivi.MassInvoiceCreatePrint.js
templates/webpages/mass_invoice_create_print_from_do/_filter.html
templates/webpages/mass_invoice_create_print_from_do/list_invoices.html
templates/webpages/mass_invoice_create_print_from_do/list_sales_delivery_orders.html

index ef5bfaf..e5308d0 100644 (file)
@@ -95,6 +95,8 @@ sub action_list_invoices {
 
   $::form->{printer_id} ||= $self->default_printer_id;
 
+  $self->setup_list_invoices_action_bar(num_rows => scalar(@{ $self->invoice_models->get }));
+
   $self->render('mass_invoice_create_print_from_do/list_invoices',
                 title        => $::locale->text('Open invoice'),
                 noshow       => $show,
@@ -332,6 +334,30 @@ sub make_filter_summary {
 
   $self->{filter_summary} = join ', ', @filter_strings;
 }
+
+sub setup_list_invoices_action_bar {
+  my ($self, %params) = @_;
+
+  for my $bar ($::request->layout->get('actionbar')) {
+    $bar->add(
+      action => [
+        t8('Search'),
+        submit    => [ '#search_form', { action => 'MassInvoiceCreatePrint/list_invoices' } ],
+        accesskey => 'enter',
+      ],
+      action => [
+        t8('Reset'),
+        call => [ 'kivi.Project.reset_search_form' ],
+      ],
+      action => [
+        $::locale->text('Print'),
+        call     => [ 'kivi.MassInvoiceCreatePrint.showMassPrintOptionsOrDownloadDirectly' ],
+        disabled => !$params{num_rows} ? $::locale->text('The report doesn\'t contain entries.') : undef,
+      ],
+    );
+  }
+}
+
 1;
 
 __END__
index d00e56a..0c188dc 100644 (file)
@@ -115,6 +115,10 @@ namespace('kivi.MassInvoiceCreatePrint', function(ns) {
 
     return true;
   };
+
+  this.resetSearchForm = function() {
+    $("#filter_table input").val("");
+  };
 });
 
 $(kivi.MassInvoiceCreatePrint.setup);
index 1d906e1..a7b5d93 100644 (file)
@@ -1,6 +1,6 @@
 [%- USE L %][%- USE LxERP %][%- USE HTML %]
 <div>
- <form action="controller.pl" method="post">
+ <form action="controller.pl" method="post" id="search_form">
   <div class="filter_toggle" [% IF noshow == 0 %]style="display:none"[% END %]>
    <a href="#" onClick="javascript:$('.filter_toggle').toggle()">[% LxERP.t8('Show Filter') %]</a>
       [% SELF.filter_summary %]
     </tr>
   </table>
 
-   [% L.hidden_tag('action', 'MassInvoiceCreatePrint/dispatch') %]
+   [% L.hidden_tag('action', 'MassInvoiceCreatePrint/' _ LIST_ACTION, id='filter_action') %]
    [% L.hidden_tag('sort_by', FORM.sort_by) %]
    [% L.hidden_tag('sort_dir', FORM.sort_dir) %]
    [% L.hidden_tag('page', FORM.page) %]
-   [% L.submit_tag(LIST_ACTION, LxERP.t8('Continue'))%]
-
-   <a href="#" onClick="javascript:$('#filter_table input,#filter_table select').val('');">[% LxERP.t8('Reset') %]</a>
-
   </div>
 
  </form>
index 8bec62a..bc88963 100644 (file)
@@ -4,8 +4,8 @@
 
 [%- INCLUDE "common/flash.html" %]
 
-[% LIST_ACTION     = 'action_list_invoices' %]
-[%- PROCESS 'mass_invoice_create_print_from_do/_filter.html' filter=SELF.filter %]
+[% LIST_ACTION     = 'list_invoices' %]
+[%- PROCESS 'mass_invoice_create_print_from_do/_filter.html' filter=SELF.invoice_models.filtered.laundered %]
 
 [% IF noshow == 1 %]
 [% invoices = SELF.invoice_models.get;
@@ -16,7 +16,7 @@
  </p>
 [%- ELSE %]
 
- <form method="post" action="controller.pl">
+ <form method="post" action="controller.pl" id="report_form">
   <table width="100%">
    <thead>
     <tr class="listheading">
    [% L.paginate_controls %]
   [% END %]
 
-  <hr size="3" noshade>
+  [% L.hidden_tag("action", "MassInvoiceCreatePrint/dispatch") %]
+  [% L.hidden_tag("printer_id") %]
+ </form>
 
-  [% IF SELF.printers.size %]
+ [% IF SELF.printers.size %]
+  <div id="print_options" class="hidden">
    <p>
     [% LxERP.t8("Print destination") %]:
     [% SET  printers = [ { description=LxERP.t8("Download PDF, do not print") } ] ;
        CALL printers.import(SELF.printers);
-       L.select_tag("printer_id", printers, title_key="description", default=FORM.printer_id) %]
+       L.select_tag("", printers, id="print_options_printer_id", title_key="description", default=FORM.printer_id) %]
    </p>
-  [% END %]
 
-  <p>
-   [% L.hidden_tag("action", "MassInvoiceCreatePrint/dispatch") %]
-   [% L.submit_tag("action_print", LxERP.t8("Print")) %]
-  </p>
- </form>
+   <p>
+    [% L.button_tag("kivi.MassInvoiceCreatePrint.massPrint()", LxERP.t8('Print')) %]
+   </p>
+  </div>
+ [% END %]
 [%- END %]
 [%- END %]
index 7d2ac03..61bcd5f 100644 (file)
@@ -5,7 +5,7 @@
 
 [%- INCLUDE "common/flash.html" %]
 
-[% LIST_ACTION  = 'action_list_sales_delivery_orders' %]
+[% LIST_ACTION  = 'list_sales_delivery_orders' %]
 [% SET MODELS = SELF.sales_delivery_order_models;
        dummy  = MODELS.finalize %]