From a4b209195c9690ccdbb46d6b07dfa0f57f2dc423 Mon Sep 17 00:00:00 2001 From: Alejandro De Maria Antolinos Date: Tue, 10 Apr 2018 14:36:55 +0200 Subject: [PATCH] This ugly bug was introduced when refactoring. It fixes #388 --- Gruntfile.js | 2 +- js/core/view/shipping/parcelgrid.js | 57 ++++++++++++++++------------- js/core/widget/parcelpanel.js | 22 +++++------ mx/dev.html | 7 +--- saxs/dev.html | 3 +- test/dev.html | 3 +- tracking/dev.html | 3 +- 7 files changed, 47 insertions(+), 50 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 454fa211b..5812141a0 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -24,7 +24,7 @@ module.exports = function(grunt) { concat : { prod : { files : { - 'min/ispyb-client.js' : [ "js/ispyb-client/**/*js", "js/core/**/*js" ], + 'min/ispyb-client.js' : [ "js/ispyb-client/**/*js" ], 'min/exi.js' : [ "js/dust/**/*js", "js/core/**/*js" ], 'min/exi.mx.js' : [ "js/mx/**/*js" ], 'min/exi.saxs.js' : [ "js/saxs/**/*js" ], diff --git a/js/core/view/shipping/parcelgrid.js b/js/core/view/shipping/parcelgrid.js index 44babf9bf..f8a59338a 100644 --- a/js/core/view/shipping/parcelgrid.js +++ b/js/core/view/shipping/parcelgrid.js @@ -132,28 +132,27 @@ ParcelGrid.prototype.load = function(shipment,hasExportedData,samples,withoutCol this.dewars.sort(function(a, b) { return a.dewarId - b.dewarId; }); - - /** Button Export PDF view */ + + $("#" + this.id + "-label").html("Content (" + this.dewars.length + " Parcels - " + nSamples + " Samples - " + nMeasured + " Measured)"); + $("#" + this.id + "-add-button").removeClass("disabled"); + $("#" + this.id + "-add-button").unbind('click').click(function(sender){ + _this.edit(); + }); if (nSamples > 0) { - this.disableExportButton(); + $("#" + this.id + "-export").removeClass("disabled"); + $("#" + this.id + "-export").unbind('click').click(function(sender){ + var exportForm = new ExportPDFForm(); + exportForm.load(_this.shipment); + exportForm.show(); + }); } + this.fillTab("content", this.dewars); - var html = ""; - dust.render("parcel.grid.template",{id : this.id, shippingId: _this.shipment.shippingId},function (err,out){ - $('#' + _this.id).html(out); - _this.fillTab("content", _this.dewars); - _this.attachCallBackAfterRender(); - /** Button Add Parcel */ - - _this.displayContentLabel(_this.dewars, nSamples, nMeasured, _this.currentReimbursedDewars, _this.maxReimbursedDewars); - /** Add Pacel button */ - $("#" + _this.id + "-add-button").removeClass("disabled"); - $("#" + _this.id + "-add-button").unbind('click').click(function(sender){ - _this.edit(); - }); - /** Disable import from csv button */ + this.attachCallBackAfterRender(); + + /** Disable import from csv button */ if (_this.shipment){ if (_this.shipment.shippingStatus){ if (_this.shipment.shippingStatus == "processing"){ @@ -164,9 +163,7 @@ ParcelGrid.prototype.load = function(shipment,hasExportedData,samples,withoutCol } } } - }) - - + }; ParcelGrid.prototype.fillTab = function (tabName, dewars) { @@ -254,14 +251,24 @@ ParcelGrid.prototype.edit = function(dewar) { window.show(); }; -ParcelGrid.prototype.getPanel = function() { +ParcelGrid.prototype.getPanel = function() { + + var html = ""; + + dust.render("parcel.grid.template",{id : this.id},function (err,out){ + html = out; + }) + this.panel = Ext.create('Ext.panel.Panel', { - layout : 'fit', + layout : 'fit', + // cls : 'overflowed', items : { - - html : '
', + // cls : 'border-grid', + html : '
' + html + '
', + // width : this.width, autoScroll:false, - autoHeight :true, + autoHeight :true, + // maxHeight: this.height, padding : this.padding } }); diff --git a/js/core/widget/parcelpanel.js b/js/core/widget/parcelpanel.js index 36144c4fd..b17e0590a 100644 --- a/js/core/widget/parcelpanel.js +++ b/js/core/widget/parcelpanel.js @@ -58,8 +58,7 @@ function ParcelPanel(args) { ParcelPanel.prototype.load = function(dewar, shipment, samples, withoutCollection) { var _this = this; - this.dewar = dewar; - this.oldDewar = dewar; + this.dewar = dewar; this.dewar.index = this.index; this.shipment = shipment; @@ -74,12 +73,12 @@ ParcelPanel.prototype.load = function(dewar, shipment, samples, withoutCollectio /** Loading the template **/ var html = ""; - dust.render("parcel.panel.template", {id : this.id, dewar : this.dewar}, function(err, out){ + dust.render("parcel.panel.template", {id : this.id, dewar : this.dewar}, function(err, out){ html = out; }); - /** Setting click listeners **/ - $('#' + this.id).html(html); + /** Setting click listeners **/ + $('#' + this.id).hide().html(html).fadeIn("fast"); this.panel.doLayout(); if (this.shippingStatus != "processing"){ @@ -92,7 +91,7 @@ ParcelPanel.prototype.load = function(dewar, shipment, samples, withoutCollectio $("#" + this.id + "-edit-button").click(function () { _this.showCaseForm(); }); - //debugger + if (this.maxReimb > 0 || this.dewar.isReimbursed) { $("#" + this.id + "-euro-button").removeClass("disabled"); $("#" + this.id + "-euro-button").click(function () { @@ -110,6 +109,7 @@ ParcelPanel.prototype.load = function(dewar, shipment, samples, withoutCollectio return; }); + this.containersPanel = Ext.create('Ext.panel.Panel', { id : this.id + "-containers-panel", // layout : 'fit', @@ -299,7 +299,7 @@ ParcelPanel.prototype.addContainerToDewar = function(containerVO) { EXI.getDataAdapter({onSuccess : onSuccess}).saxs.stockSolution.saveStockSolution(stockSolution); } else { - var onSuccess = function(sender, container){ + var onSuccess = function(sender, container){ container.code = containerVO.code; container.containerStatus = _this.dewar.dewarStatus; container.sampleChangerLocation = _this.dewar.storageLocation; @@ -317,8 +317,7 @@ ParcelPanel.prototype.addContainerToDewar = function(containerVO) { var onError = function(sender,error) { EXI.setError(error.responseText); _this.renderPucks(_this.dewar); - }; - + }; EXI.getDataAdapter({onSuccess : onSaveSuccess, onError : onError}).proposal.shipping.saveContainer(_this.shippingId, _this.dewar.dewarId, container.containerId, container); }; @@ -432,7 +431,7 @@ ParcelPanel.prototype.showAddContainerForm = function() { /** Opens a window with the cas form **/ var addContainerForm = new AddContainerForm(); - addContainerForm.onSave.attach(function(sender,container){ + addContainerForm.onSave.attach(function(sender,container){ _this.addContainerToDewar(container); window.close(); }) @@ -463,8 +462,7 @@ ParcelPanel.prototype.getPanel = function() { items : [{ html : '
', autoScroll : false, - padding : this.padding, - // width : this.width, + padding : this.padding, layout : 'fit', }] }); diff --git a/mx/dev.html b/mx/dev.html index 53d395bab..6af4fdd12 100644 --- a/mx/dev.html +++ b/mx/dev.html @@ -32,8 +32,8 @@ - + @@ -49,7 +49,6 @@ - @@ -67,11 +66,7 @@ -<<<<<<< HEAD -======= - ->>>>>>> d0a71ca005f4a954e736b05f15b1c427e603ba8f diff --git a/saxs/dev.html b/saxs/dev.html index 168a07f2f..ec65bdd97 100644 --- a/saxs/dev.html +++ b/saxs/dev.html @@ -35,8 +35,8 @@ - + @@ -52,7 +52,6 @@ - diff --git a/test/dev.html b/test/dev.html index 36594a486..7f3256296 100644 --- a/test/dev.html +++ b/test/dev.html @@ -35,8 +35,8 @@ - + @@ -52,7 +52,6 @@ - diff --git a/tracking/dev.html b/tracking/dev.html index ba296d128..692cdc52c 100644 --- a/tracking/dev.html +++ b/tracking/dev.html @@ -32,8 +32,8 @@ - + @@ -49,7 +49,6 @@ -