From fdbdd0b1dbcae7c3b86a9ab532cb3377a4fcfd90 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Fri, 11 Nov 2016 15:03:54 +0100 Subject: [PATCH] ActionBar: Verwendung in MassInvoiceCreatePrint-Controller (nur Rechnungsliste) --- SL/Controller/MassInvoiceCreatePrint.pm | 26 +++++++++++++++++++ js/kivi.MassInvoiceCreatePrint.js | 4 +++ .../_filter.html | 8 ++---- .../list_invoices.html | 26 ++++++++++--------- .../list_sales_delivery_orders.html | 2 +- 5 files changed, 47 insertions(+), 19 deletions(-) diff --git a/SL/Controller/MassInvoiceCreatePrint.pm b/SL/Controller/MassInvoiceCreatePrint.pm index ef5bfaf74..e5308d06b 100644 --- a/SL/Controller/MassInvoiceCreatePrint.pm +++ b/SL/Controller/MassInvoiceCreatePrint.pm @@ -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__ diff --git a/js/kivi.MassInvoiceCreatePrint.js b/js/kivi.MassInvoiceCreatePrint.js index d00e56ab9..0c188dcb2 100644 --- a/js/kivi.MassInvoiceCreatePrint.js +++ b/js/kivi.MassInvoiceCreatePrint.js @@ -115,6 +115,10 @@ namespace('kivi.MassInvoiceCreatePrint', function(ns) { return true; }; + + this.resetSearchForm = function() { + $("#filter_table input").val(""); + }; }); $(kivi.MassInvoiceCreatePrint.setup); diff --git a/templates/webpages/mass_invoice_create_print_from_do/_filter.html b/templates/webpages/mass_invoice_create_print_from_do/_filter.html index 1d906e138..a7b5d9364 100644 --- a/templates/webpages/mass_invoice_create_print_from_do/_filter.html +++ b/templates/webpages/mass_invoice_create_print_from_do/_filter.html @@ -1,6 +1,6 @@ [%- USE L %][%- USE LxERP %][%- USE HTML %]
-
+
[% LxERP.t8('Show Filter') %] [% SELF.filter_summary %] @@ -22,14 +22,10 @@ - [% 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'))%] - - [% LxERP.t8('Reset') %] -
diff --git a/templates/webpages/mass_invoice_create_print_from_do/list_invoices.html b/templates/webpages/mass_invoice_create_print_from_do/list_invoices.html index 8bec62a02..bc8896340 100644 --- a/templates/webpages/mass_invoice_create_print_from_do/list_invoices.html +++ b/templates/webpages/mass_invoice_create_print_from_do/list_invoices.html @@ -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 @@

[%- ELSE %] -
+ @@ -57,21 +57,23 @@ [% L.paginate_controls %] [% END %] -
+ [% L.hidden_tag("action", "MassInvoiceCreatePrint/dispatch") %] + [% L.hidden_tag("printer_id") %] + - [% IF SELF.printers.size %] + [% IF SELF.printers.size %] + + [% END %] [%- END %] [%- END %] diff --git a/templates/webpages/mass_invoice_create_print_from_do/list_sales_delivery_orders.html b/templates/webpages/mass_invoice_create_print_from_do/list_sales_delivery_orders.html index 7d2ac038b..61bcd5fcf 100644 --- a/templates/webpages/mass_invoice_create_print_from_do/list_sales_delivery_orders.html +++ b/templates/webpages/mass_invoice_create_print_from_do/list_sales_delivery_orders.html @@ -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 %] -- 2.20.1