From c342d50b6999ca85ce15201b6d79c79b7f669fa3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bernd=20Ble=C3=9Fmann?= Date: Wed, 7 Jul 2021 18:03:04 +0200 Subject: [PATCH] Dialogbuchung: Bei Verbleib in der Maske nach Buchen Dokumenten-Tab laden --- bin/mozilla/gl.pl | 2 +- js/kivi.File.js | 16 ++++++++++++++++ js/kivi.GL.js | 4 ++++ js/locale/de.js | 1 + js/locale/en.js | 1 + templates/webpages/gl/form_header.html | 9 +++++++-- 6 files changed, 30 insertions(+), 3 deletions(-) diff --git a/bin/mozilla/gl.pl b/bin/mozilla/gl.pl index dbaddc596..6f519428b 100644 --- a/bin/mozilla/gl.pl +++ b/bin/mozilla/gl.pl @@ -1402,7 +1402,7 @@ sub post_transaction { print $form->redirect_header($form->{callback}); $form->redirect($locale->text('GL transaction posted.') . ' ' . $locale->text('ID') . ': ' . $form->{id}); } elsif ($::instance_conf->get_gl_add_doc && $::instance_conf->get_doc_storage) { - my $add_doc_url = build_std_url("script=gl.pl", 'action=edit', 'id=' . E($form->{id})); + my $add_doc_url = build_std_url("script=gl.pl", 'action=edit', 'id=' . E($form->{id}), 'fragment=ui-tabs-docs'); print $form->redirect_header($add_doc_url); $form->redirect($locale->text('GL transaction posted.') . ' ' . $locale->text('ID') . ': ' . $form->{id}); } diff --git a/js/kivi.File.js b/js/kivi.File.js index bdd7acd36..63a85346c 100644 --- a/js/kivi.File.js +++ b/js/kivi.File.js @@ -393,4 +393,20 @@ namespace('kivi.File', function(ns) { $('.overlay_div img').on('click', ns.download); }; + ns.doc_tab_init = function(tabs_id, doc_tab_id, id, object_type) { + var url = 'controller.pl?action=File/list&file_type=document&object_type=' + object_type + '&object_id=' + $('#id').val(); + + $('#' + tabs_id).on('tabsbeforeactivate', function(e, ui) { + if (ui.newPanel.attr('id') !== doc_tab_id) return; + $('#' + doc_tab_id).html(kivi.t8('Loading...')); + $('#' + doc_tab_id).load(url); + }); + + $('#' + tabs_id).on('tabscreate', function(e, ui) { + if (ui.panel.attr('id') !== doc_tab_id) return; + $('#' + doc_tab_id).html(kivi.t8('Loading...')); + $('#' + doc_tab_id).load(url); + }); + }; + }); diff --git a/js/kivi.GL.js b/js/kivi.GL.js index 374113c54..dc17ff38f 100644 --- a/js/kivi.GL.js +++ b/js/kivi.GL.js @@ -29,3 +29,7 @@ namespace('kivi.GL', function(ns) { }); }; }); + +$(function() { + kivi.File.doc_tab_init('gl_tabs', 'ui-tabs-docs', $('#id').val(), 'gl_transaction'); +}); diff --git a/js/locale/de.js b/js/locale/de.js index 7e9a60b42..e36f8829e 100644 --- a/js/locale/de.js +++ b/js/locale/de.js @@ -89,6 +89,7 @@ namespace("kivi").setupLocale({ "July":"Juli", "Jun":"Jun", "June":"Juni", +"Loading...":"Wird geladen...", "Map":"Karte", "Mar":"März", "March":"März", diff --git a/js/locale/en.js b/js/locale/en.js index 81da3f9f5..b03ddb34b 100644 --- a/js/locale/en.js +++ b/js/locale/en.js @@ -89,6 +89,7 @@ namespace("kivi").setupLocale({ "July":"", "Jun":"", "June":"", +"Loading...":"", "Map":"", "Mar":"", "March":"", diff --git a/templates/webpages/gl/form_header.html b/templates/webpages/gl/form_header.html index cbfaddbe7..dad0d69cf 100644 --- a/templates/webpages/gl/form_header.html +++ b/templates/webpages/gl/form_header.html @@ -31,7 +31,7 @@ -
+
+ +[%- IF INSTANCE_CONF.get_doc_storage %] +
+[%- END %] +
-- 2.20.1