S/H/ShippedQty Berechnung nur über verlinkte Positionen
[kivitendo-erp.git] / js / kivi.File.js
index 6b4ea46..bdd7acd 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() {
@@ -332,6 +334,20 @@ namespace('kivi.File', function(ns) {
     $('.thumbnail').on('mouseover', ns.add_enlarged_thumbnail);
   };
 
+  ns.download = function(e) {
+    var file_id        = $(e.target).data('file-id');
+    var file_version   = $(e.target).data('file-version');
+
+    var data = {
+      action:  'File/download',
+      id:      file_id,
+      version: file_version,
+    };
+
+    $.post("controller.pl", data, kivi.eval_json_result);
+
+  };
+
   ns.init = function() {
     // Preventing page from redirecting
     $("#" + ns.list_div_id).on("dragover", function(e) {
@@ -373,8 +389,8 @@ namespace('kivi.File', function(ns) {
     });
 
     $('.thumbnail').on('mouseover', ns.add_enlarged_thumbnail);
-    $('.overlay_img').on('click', ns.remove_enlarged_thumbnail);
     $('.overlay_img').on('mouseout', ns.remove_enlarged_thumbnail);
+    $('.overlay_div img').on('click', ns.download);
   };
 
 });