Telefonnotizen: in Berichten Angebot/Auftrag filtern können.
[kivitendo-erp.git] / js / kivi.File.js
index eeca325..55aa4ea 100644 (file)
@@ -99,7 +99,9 @@ namespace('kivi.File', function(ns) {
   }
 
   ns.allow_upload_submit = function() {
-      $('#upload_selected_button').prop('disabled',$('#upload_files').val() === '');
+      const disable = $('#upload_files').val() === '';
+      $('#upload_selected_button').prop('disabled', disable)
+                                  .toggleClass('disabled', disable);
   }
 
   ns.upload_status_dialog = function() {
@@ -391,4 +393,32 @@ 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);
+    });
+  };
+
+  ns.toggle_versions = function(file_id) {
+    if ($('#version_toggle_' + file_id).data('versions_expanded')) {
+      $('.version_row_'    + file_id).hide();
+      $('#version_toggle_' + file_id).data('versions_expanded', 0);
+      $('#version_toggle_' + file_id).html("⏷ ");
+    } else {
+      $('.version_row_'    + file_id).show();
+      $('#version_toggle_' + file_id).data('versions_expanded', 1);
+      $('#version_toggle_' + file_id).html("⏶ ");
+    }
+  };
+
 });