From a69a43c85c3afa1d90fe9faffdbb5ad921b4dbe0 Mon Sep 17 00:00:00 2001 From: delageniere Date: Wed, 7 Feb 2018 09:53:05 +0100 Subject: [PATCH 01/18] cosmetic --- js/saxs/widget/framesgrid.js | 12 ++++++------ js/tracking/menu/trackingmainmenu.js | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/js/saxs/widget/framesgrid.js b/js/saxs/widget/framesgrid.js index c132dd452..a053020f7 100644 --- a/js/saxs/widget/framesgrid.js +++ b/js/saxs/widget/framesgrid.js @@ -9,7 +9,7 @@ FramesGrid.prototype.getPanel = function () { return { html : '
', autoScroll : true - } + }; }; FramesGrid.prototype.load = function (frames) { @@ -64,23 +64,23 @@ FramesGrid.prototype.setClickListeners = function () { } _this.onSelectionChange.notify(_this.parseSelected()); }); -} +}; FramesGrid.prototype.select = function (domId) { this.selectedFrames.push(this.getFrameByDomId(domId)); $("#" + domId).addClass('x-grid-item-selected'); -} +}; FramesGrid.prototype.deselect = function (domId) { var _this = this; _.remove(this.selectedFrames,function(o) {return o.domId == domId}); $("#" + domId).removeClass('x-grid-item-selected'); -} +}; FramesGrid.prototype.deselectAll = function () { this.selectedFrames = []; $(".frame-cell-element").removeClass("x-grid-item-selected"); -} +}; // FramesGrid.prototype.getFileName = function (filePath) { // var withExtension = filePath.substring(filePath.lastIndexOf('/')+1); @@ -118,4 +118,4 @@ FramesGrid.prototype.parseSelected = function () { } } return parsed; -} \ No newline at end of file +}; \ No newline at end of file diff --git a/js/tracking/menu/trackingmainmenu.js b/js/tracking/menu/trackingmainmenu.js index 09e1383d5..acbe3dc73 100644 --- a/js/tracking/menu/trackingmainmenu.js +++ b/js/tracking/menu/trackingmainmenu.js @@ -51,7 +51,7 @@ TrackingMainMenu.prototype.getShipmentItem = function() { cls : 'ExiSAXSMenuToolBar', icon : '../images/icon/ic_email_black_24dp.png', handler : function(){ - location.hash = "/proposal/shipping/nav" + location.hash = "/proposal/shipping/nav"; } }; }; From fcd07b8e997f1102a9dd3b03b7fd630197f9a6e4 Mon Sep 17 00:00:00 2001 From: delageniere Date: Wed, 7 Feb 2018 10:34:43 +0100 Subject: [PATCH 02/18] cosmetic --- .../widget/network/vertexgraphformatter.js | 107 ++++++++---------- mx/dev.html | 1 - saxs/dev.html | 1 - test/dev.html | 1 - tracking/dev.html | 1 - 5 files changed, 47 insertions(+), 64 deletions(-) diff --git a/js/saxs/widget/network/vertexgraphformatter.js b/js/saxs/widget/network/vertexgraphformatter.js index 7cab4d959..12874f4a7 100644 --- a/js/saxs/widget/network/vertexgraphformatter.js +++ b/js/saxs/widget/network/vertexgraphformatter.js @@ -1,3 +1,7 @@ +function VertexGraphFormatter(defaultFormat, selectedFormat, overFormat, draggingFormat){ + ItemGraphFormatter.prototype.constructor.call(this, defaultFormat, selectedFormat, overFormat, draggingFormat); +} + VertexGraphFormatter.prototype.getDefault = ItemGraphFormatter.prototype.getDefault; VertexGraphFormatter.prototype.getSelected = ItemGraphFormatter.prototype.getSelected; VertexGraphFormatter.prototype.getOver = ItemGraphFormatter.prototype.getOver; @@ -7,11 +11,33 @@ VertexGraphFormatter.prototype.toJSON = ItemGraphFormatter.prototype.toJSON; VertexGraphFormatter.prototype.loadFromJSON = ItemGraphFormatter.prototype.loadFromJSON; VertexGraphFormatter.prototype._setEvents = ItemGraphFormatter.prototype._setEvents; - -function VertexGraphFormatter(defaultFormat, selectedFormat, overFormat, draggingFormat){ - ItemGraphFormatter.prototype.constructor.call(this, defaultFormat, selectedFormat, overFormat, draggingFormat); -}; - +function CircleVertexGraphFormatter(id, defaultFormat, selectedFormat, overFormat, draggingFormat){ + VertexGraphFormatter.prototype.constructor.call(this, id, defaultFormat, selectedFormat, overFormat, draggingFormat); + this.args.type = "CircleVertexGraphFormatter"; + if (defaultFormat != null){ + if (defaultFormat.radius != null){ + this.defaultFormat.args.radius = defaultFormat.radius; + } + } + + if (selectedFormat != null){ + if (selectedFormat.radius != null){ + this.selected.args.radius = selectedFormat.radius; + } + } + + if (overFormat != null){ + if (overFormat.radius != null){ + this.over.args.radius = overFormat.radius; + } + } + + if (draggingFormat != null){ + if (draggingFormat.radius != null){ + this.dragging.args.draggingFormat = draggingFormat.radius; + } + } +} CircleVertexGraphFormatter.prototype.getDefault = VertexGraphFormatter.prototype.getDefault; CircleVertexGraphFormatter.prototype.getSelected = VertexGraphFormatter.prototype.getSelected; @@ -22,9 +48,9 @@ CircleVertexGraphFormatter.prototype.toJSON = VertexGraphFormatter.prototype.toJ CircleVertexGraphFormatter.prototype.loadFromJSON = VertexGraphFormatter.prototype.loadFromJSON; CircleVertexGraphFormatter.prototype._setEvents = VertexGraphFormatter.prototype._setEvents; -function CircleVertexGraphFormatter(id, defaultFormat, selectedFormat, overFormat, draggingFormat){ +function SquareVertexGraphFormatter(id, defaultFormat, selectedFormat, overFormat, draggingFormat){ VertexGraphFormatter.prototype.constructor.call(this, id, defaultFormat, selectedFormat, overFormat, draggingFormat); - this.args.type = "CircleVertexGraphFormatter"; + this.args.type = "SquareVertexGraphFormatter"; if (defaultFormat != null){ if (defaultFormat.radius != null){ this.defaultFormat.args.radius = defaultFormat.radius; @@ -48,9 +74,7 @@ function CircleVertexGraphFormatter(id, defaultFormat, selectedFormat, overForma this.dragging.args.draggingFormat = draggingFormat.radius; } } -}; - - +} SquareVertexGraphFormatter.prototype.getDefault = VertexGraphFormatter.prototype.getDefault; SquareVertexGraphFormatter.prototype.getSelected = VertexGraphFormatter.prototype.getSelected; @@ -61,9 +85,9 @@ SquareVertexGraphFormatter.prototype.toJSON = VertexGraphFormatter.prototype.toJ SquareVertexGraphFormatter.prototype.loadFromJSON = VertexGraphFormatter.prototype.loadFromJSON; SquareVertexGraphFormatter.prototype._setEvents = VertexGraphFormatter.prototype._setEvents; -function SquareVertexGraphFormatter(id, defaultFormat, selectedFormat, overFormat, draggingFormat){ +function EllipseVertexGraphFormatter(id, defaultFormat, selectedFormat, overFormat, draggingFormat){ VertexGraphFormatter.prototype.constructor.call(this, id, defaultFormat, selectedFormat, overFormat, draggingFormat); - this.args.type = "SquareVertexGraphFormatter"; + this.args.type = "EllipseVertexGraphFormatter"; if (defaultFormat != null){ if (defaultFormat.radius != null){ this.defaultFormat.args.radius = defaultFormat.radius; @@ -87,9 +111,7 @@ function SquareVertexGraphFormatter(id, defaultFormat, selectedFormat, overForma this.dragging.args.draggingFormat = draggingFormat.radius; } } -}; - - +} EllipseVertexGraphFormatter.prototype.getDefault = VertexGraphFormatter.prototype.getDefault; EllipseVertexGraphFormatter.prototype.getSelected = VertexGraphFormatter.prototype.getSelected; EllipseVertexGraphFormatter.prototype.getOver = VertexGraphFormatter.prototype.getOver; @@ -99,9 +121,9 @@ EllipseVertexGraphFormatter.prototype.toJSON = VertexGraphFormatter.prototype.to EllipseVertexGraphFormatter.prototype.loadFromJSON = VertexGraphFormatter.prototype.loadFromJSON; EllipseVertexGraphFormatter.prototype._setEvents = VertexGraphFormatter.prototype._setEvents; -function EllipseVertexGraphFormatter(id, defaultFormat, selectedFormat, overFormat, draggingFormat){ +function RectangleVertexGraphFormatter(id, defaultFormat, selectedFormat, overFormat, draggingFormat){ VertexGraphFormatter.prototype.constructor.call(this, id, defaultFormat, selectedFormat, overFormat, draggingFormat); - this.args.type = "EllipseVertexGraphFormatter"; + this.args.type = "RectangleVertexGraphFormatter"; if (defaultFormat != null){ if (defaultFormat.radius != null){ this.defaultFormat.args.radius = defaultFormat.radius; @@ -125,9 +147,7 @@ function EllipseVertexGraphFormatter(id, defaultFormat, selectedFormat, overForm this.dragging.args.draggingFormat = draggingFormat.radius; } } -}; - - +} RectangleVertexGraphFormatter.prototype.getDefault = ItemGraphFormatter.prototype.getDefault; RectangleVertexGraphFormatter.prototype.getSelected = ItemGraphFormatter.prototype.getSelected; @@ -138,9 +158,9 @@ RectangleVertexGraphFormatter.prototype.toJSON = ItemGraphFormatter.prototype.to RectangleVertexGraphFormatter.prototype.loadFromJSON = ItemGraphFormatter.prototype.loadFromJSON; RectangleVertexGraphFormatter.prototype._setEvents = ItemGraphFormatter.prototype._setEvents; -function RectangleVertexGraphFormatter(id, defaultFormat, selectedFormat, overFormat, draggingFormat){ +function RoundedVertexGraphFormatter(id, defaultFormat, selectedFormat, overFormat, draggingFormat){ VertexGraphFormatter.prototype.constructor.call(this, id, defaultFormat, selectedFormat, overFormat, draggingFormat); - this.args.type = "RectangleVertexGraphFormatter"; + this.args.type = "RoundedVertexGraphFormatter"; if (defaultFormat != null){ if (defaultFormat.radius != null){ this.defaultFormat.args.radius = defaultFormat.radius; @@ -164,9 +184,7 @@ function RectangleVertexGraphFormatter(id, defaultFormat, selectedFormat, overFo this.dragging.args.draggingFormat = draggingFormat.radius; } } -}; - - +} RoundedVertexGraphFormatter.prototype.getDefault = ItemGraphFormatter.prototype.getDefault; RoundedVertexGraphFormatter.prototype.getSelected = ItemGraphFormatter.prototype.getSelected; @@ -177,9 +195,9 @@ RoundedVertexGraphFormatter.prototype.toJSON = ItemGraphFormatter.prototype.toJS RoundedVertexGraphFormatter.prototype.loadFromJSON = ItemGraphFormatter.prototype.loadFromJSON; RoundedVertexGraphFormatter.prototype._setEvents = ItemGraphFormatter.prototype._setEvents; -function RoundedVertexGraphFormatter(id, defaultFormat, selectedFormat, overFormat, draggingFormat){ +function OctagonVertexGraphFormatter(id, defaultFormat, selectedFormat, overFormat, draggingFormat){ VertexGraphFormatter.prototype.constructor.call(this, id, defaultFormat, selectedFormat, overFormat, draggingFormat); - this.args.type = "RoundedVertexGraphFormatter"; + this.args.type = "OctagonVertexGraphFormatter"; if (defaultFormat != null){ if (defaultFormat.radius != null){ this.defaultFormat.args.radius = defaultFormat.radius; @@ -203,9 +221,7 @@ function RoundedVertexGraphFormatter(id, defaultFormat, selectedFormat, overForm this.dragging.args.draggingFormat = draggingFormat.radius; } } -}; - - +} OctagonVertexGraphFormatter.prototype.getDefault = ItemGraphFormatter.prototype.getDefault; OctagonVertexGraphFormatter.prototype.getSelected = ItemGraphFormatter.prototype.getSelected; @@ -214,33 +230,4 @@ OctagonVertexGraphFormatter.prototype.getDragging = ItemGraphFormatter.prototype OctagonVertexGraphFormatter.prototype.getId = ItemGraphFormatter.prototype.getId; OctagonVertexGraphFormatter.prototype.toJSON = ItemGraphFormatter.prototype.toJSON; OctagonVertexGraphFormatter.prototype.loadFromJSON = ItemGraphFormatter.prototype.loadFromJSON; -OctagonVertexGraphFormatter.prototype._setEvents = ItemGraphFormatter.prototype._setEvents; - -function OctagonVertexGraphFormatter(id, defaultFormat, selectedFormat, overFormat, draggingFormat){ - VertexGraphFormatter.prototype.constructor.call(this, id, defaultFormat, selectedFormat, overFormat, draggingFormat); - this.args.type = "OctagonVertexGraphFormatter"; - if (defaultFormat != null){ - if (defaultFormat.radius != null){ - this.defaultFormat.args.radius = defaultFormat.radius; - } - } - - if (selectedFormat != null){ - if (selectedFormat.radius != null){ - this.selected.args.radius = selectedFormat.radius; - } - } - - if (overFormat != null){ - if (overFormat.radius != null){ - this.over.args.radius = overFormat.radius; - } - } - - if (draggingFormat != null){ - if (draggingFormat.radius != null){ - this.dragging.args.draggingFormat = draggingFormat.radius; - } - } -}; - +OctagonVertexGraphFormatter.prototype._setEvents = ItemGraphFormatter.prototype._setEvents; \ No newline at end of file diff --git a/mx/dev.html b/mx/dev.html index 142e33362..0cd8cb0a7 100644 --- a/mx/dev.html +++ b/mx/dev.html @@ -46,7 +46,6 @@ - diff --git a/saxs/dev.html b/saxs/dev.html index 17f0a15ce..1c3a02548 100644 --- a/saxs/dev.html +++ b/saxs/dev.html @@ -49,7 +49,6 @@ - diff --git a/test/dev.html b/test/dev.html index f2952cdca..f4b180962 100644 --- a/test/dev.html +++ b/test/dev.html @@ -49,7 +49,6 @@ - diff --git a/tracking/dev.html b/tracking/dev.html index 1fd1a7eb3..b44a7ca4e 100644 --- a/tracking/dev.html +++ b/tracking/dev.html @@ -46,7 +46,6 @@ - From c42e6af77aab41c3f30b65a9f3560cebd5c3a95e Mon Sep 17 00:00:00 2001 From: delageniere Date: Tue, 20 Feb 2018 15:36:35 +0100 Subject: [PATCH 03/18] Display/enter reimbursed parcels --- js/core/view/shipping/caseform.js | 67 ++++++++++++------- js/core/view/shipping/shipmentform.js | 3 +- js/core/widget/parcelpanel.js | 8 ++- mx/config.js | 50 ++++++++++++++ .../parcel.panel.parameter.table.template.js | 2 +- .../shipping.form.information.template.js | 4 ++ 6 files changed, 107 insertions(+), 27 deletions(-) diff --git a/js/core/view/shipping/caseform.js b/js/core/view/shipping/caseform.js index b992bf810..ea4bebdcb 100644 --- a/js/core/view/shipping/caseform.js +++ b/js/core/view/shipping/caseform.js @@ -40,7 +40,7 @@ CaseForm.prototype.getDewar = function() { this.dewar.code = Ext.getCmp(this.id + "dewar_code").getValue(); this.dewar.comments = Ext.getCmp(this.id + "dewar_comments").getValue(); this.dewar.transportValue = Ext.getCmp(this.id + "dewar_transportValue").getValue(); -// this.dewar.storageLocation = Ext.getCmp("dewar_storageLocation").getValue(); + this.dewar.isReimbursed = Ext.getCmp(this.id + "dewar_isReimbursed").getValue(); this.dewar.storageLocation = this.storageLocationComboBox.getValue(); //this.dewar.firstExperimentId = this.sessionsCombo.getValue(); return this.dewar; @@ -54,13 +54,14 @@ CaseForm.prototype.setDewar = function(dewar) { this.dewar["code"] = ""; this.dewar["transportValue"] = ""; this.dewar["storageLocation"] = ""; + this.dewar["isReimbursed"] = ""; this.dewar["comments"] = ""; } Ext.getCmp(this.id + "dewar_code").setValue(this.dewar.code); Ext.getCmp(this.id + "dewar_comments").setValue(this.dewar.comments); Ext.getCmp(this.id + "dewar_transportValue").setValue(this.dewar.transportValue); -// Ext.getCmp("dewar_storageLocation").setValue(this.dewar.storageLocation); + Ext.getCmp(this.id + "dewar_isReimbursed").setValue(this.dewar.isReimbursed); this.storageLocationComboBox.setValue(this.dewar.storageLocation); /*if (this.dewar.sessionVO != null) { this.sessionsCombo.setValue(this.dewar.sessionVO.sessionId); @@ -106,30 +107,48 @@ CaseForm.prototype.getPanel = function(dewar) { id : this.id + 'dewar_code', labelWidth : 200, width : 500 + }, + { + xtype : 'textfield', + fieldLabel : 'isReimbursed', + allowBlank : true, + name : 'isReimbursed', + id : this.id + 'dewar_isReimbursed', + labelWidth : 200, + width : 500 } ] - }, - this.getStorageLocationCombo(), - { - xtype : 'numberfield', - width : 500, - labelWidth : 200, - margin : '10 0 0 0', - fieldLabel : 'Transport Value', - id : this.id + 'dewar_transportValue' - }, - { - xtype : 'textareafield', - name : 'comments', - fieldLabel : 'Comments', - labelWidth : 200, - width : 500, - margin : '10 0 0 0', - height : 100, - id : this.id + 'dewar_comments' - } ] - } ] + }, + this.getStorageLocationCombo(), + { + xtype : 'numberfield', + width : 500, + labelWidth : 200, + margin : '10 0 0 0', + fieldLabel : 'Transport Value', + id : this.id + 'dewar_transportValue' + }, + { + xtype : 'textareafield', + name : 'comments', + fieldLabel : 'Comments', + labelWidth : 200, + width : 500, + margin : '10 0 0 0', + height : 100, + id : this.id + 'dewar_comments' + }, + //{ + // xtype: 'checkbox', + // boxLabel : 'isReimbursed', + // name : 'isReimbursed', + // id : this.id + 'dewar_isReimbursed' + + //} + + ]}] + }); this.refresh(dewar); return this.panel; -}; +}; \ No newline at end of file diff --git a/js/core/view/shipping/shipmentform.js b/js/core/view/shipping/shipmentform.js index da8065a4a..b3d45ff1b 100644 --- a/js/core/view/shipping/shipmentform.js +++ b/js/core/view/shipping/shipmentform.js @@ -42,11 +42,12 @@ ShipmentForm.prototype.load = function(shipment,hasExportedData) { if (shipment){ if (shipment.sessions.length > 0){ beamlineName = shipment.sessions[0].beamlineName; + nbReimbDewars = shipment.sessions[0].nbReimbDewars; startDate = moment(shipment.sessions[0].startDate).format("DD/MM/YYYY"); } } - dust.render("shipping.form.template", {id : this.id, to : toData, from : fromData, beamlineName : beamlineName, startDate : startDate, shipment : shipment}, function(err, out){ + dust.render("shipping.form.template", {id : this.id, to : toData, from : fromData, beamlineName : beamlineName, startDate : startDate, shipment : shipment, nbReimbDewars : nbReimbDewars}, function(err, out){ html = out; }); diff --git a/js/core/widget/parcelpanel.js b/js/core/widget/parcelpanel.js index 8bfc04ea0..58a4fda95 100644 --- a/js/core/widget/parcelpanel.js +++ b/js/core/widget/parcelpanel.js @@ -58,6 +58,12 @@ ParcelPanel.prototype.load = function(dewar, shipment, samples, withoutCollectio this.dewar = dewar; this.dewar.index = this.index; this.shipment = shipment; + + if (dewar.isReimbursed){ + this.isSelectedForReimb = " (R)"; + } else { + this.isSelectedForReimb = ""; + } if (shipment){ if (shipment.sessions.length > 0){ this.dewar.beamlineName = shipment.sessions[0].beamlineName; @@ -121,7 +127,7 @@ ParcelPanel.prototype.load = function(dewar, shipment, samples, withoutCollectio ParcelPanel.prototype.renderDewarParameters = function (dewar) { var html = ""; - dust.render("parcel.panel.parameter.table.template", {id : this.id, dewar : dewar, height : this.height}, function(err, out){ + dust.render("parcel.panel.parameter.table.template", {id : this.id, dewar : dewar, height : this.height, isSelectedForReimb : this.isSelectedForReimb}, function(err, out){ html = out; }); $('#' + this.id + "-parameters-div").hide().html(html).fadeIn("fast"); diff --git a/mx/config.js b/mx/config.js index 43a9bca77..d1d2f9464 100644 --- a/mx/config.js +++ b/mx/config.js @@ -206,6 +206,56 @@ var ExtISPyB ={ sampleChangerType : 'FlexHCD' }, + { + name : "ID23-2", + sampleChangerType : 'SC3' + }, + { + name : "ID29", + sampleChangerType : 'FlexHCD' + }, + { + name : "ID30A-1", + sampleChangerType : 'RoboDiff' + }, + { + name : "ID30A-2", + sampleChangerType : 'SC3' + }, + { + name : "ID30A-3", + sampleChangerType : 'SC3' + }, + { + name : "ID30B", + sampleChangerType : 'FlexHCD' + }, + { + name : "BM14U", + sampleChangerType : 'FlexHCD' + }, + { + name : "BM30A", + sampleChangerType : 'FlexHCD' + } + ] + } + }, + { + name:'ESRF localhost', + url:'http://localhost:8080/ispyb/ispyb-ws/rest', + icon : '../images/site/dev.esrf.png', + exiUrl:'http://localhost:8080/ispyb/ispyb-ws/rest', + beamlines:{ + SAXS:[ + + + ], + MX:[ + { + name : "ID23-1", + sampleChangerType : 'FlexHCD' + }, { name : "ID23-2", sampleChangerType : 'SC3' diff --git a/templates/core/parcel.panel.parameter.table.template.js b/templates/core/parcel.panel.parameter.table.template.js index c88bf9569..e99a3b1a8 100644 --- a/templates/core/parcel.panel.parameter.table.template.js +++ b/templates/core/parcel.panel.parameter.table.template.js @@ -1,7 +1,7 @@ - + diff --git a/templates/core/shipping.form.information.template.js b/templates/core/shipping.form.information.template.js index f22820e9b..e194f63b5 100644 --- a/templates/core/shipping.form.information.template.js +++ b/templates/core/shipping.form.information.template.js @@ -16,6 +16,10 @@ + + + +
Name: {dewar.code}{dewar.code}{isSelectedForReimb}
Status:
Status: {shipment.shippingStatus}
Reimb. parcels:{.nbReimbDewars}
From 317db9315efb8afcd8971d97c3ed4c34ddcfdb7d Mon Sep 17 00:00:00 2001 From: delageniere Date: Tue, 20 Feb 2018 17:53:10 +0100 Subject: [PATCH 04/18] Display/enter reimbursed parcels --- js/core/view/shipping/caseform.js | 39 +++++++++++++------------- js/core/view/shipping/parcelgrid.js | 22 +++++++++++++-- js/core/widget/parcelpanel.js | 1 + templates/core/parcel.grid.template.js | 5 +++- 4 files changed, 45 insertions(+), 22 deletions(-) diff --git a/js/core/view/shipping/caseform.js b/js/core/view/shipping/caseform.js index ea4bebdcb..f74f2f57e 100644 --- a/js/core/view/shipping/caseform.js +++ b/js/core/view/shipping/caseform.js @@ -43,6 +43,7 @@ CaseForm.prototype.getDewar = function() { this.dewar.isReimbursed = Ext.getCmp(this.id + "dewar_isReimbursed").getValue(); this.dewar.storageLocation = this.storageLocationComboBox.getValue(); //this.dewar.firstExperimentId = this.sessionsCombo.getValue(); + return this.dewar; }; @@ -66,6 +67,13 @@ CaseForm.prototype.setDewar = function(dewar) { /*if (this.dewar.sessionVO != null) { this.sessionsCombo.setValue(this.dewar.sessionVO.sessionId); }*/ + + if (dewar.isReimbursed){ + this.isSelectedForReimb = " (R)"; + } else { + this.isSelectedForReimb = ""; + } + }; /* @@ -108,15 +116,6 @@ CaseForm.prototype.getPanel = function(dewar) { labelWidth : 200, width : 500 }, - { - xtype : 'textfield', - fieldLabel : 'isReimbursed', - allowBlank : true, - name : 'isReimbursed', - id : this.id + 'dewar_isReimbursed', - labelWidth : 200, - width : 500 - } ] }, this.getStorageLocationCombo(), @@ -138,17 +137,19 @@ CaseForm.prototype.getPanel = function(dewar) { height : 100, id : this.id + 'dewar_comments' }, - //{ - // xtype: 'checkbox', - // boxLabel : 'isReimbursed', - // name : 'isReimbursed', - // id : this.id + 'dewar_isReimbursed' - - //} - - ]}] - + { + xtype: 'checkbox', + fieldLabel : 'By setting this dewar to reimbursed, the labels that will be generated for the sending will contain the fedex account that you should use to send your dewars.Please note that you MUST NOT use this account to ship more than the allowed number of dewars.In case of abuse, your proposal will no more be able to benefit from the dewar reimbursement. Click on the following checkbox if you agree with these conditions and you want to have this dewar automatically reimbursed.', + labelWidth : 500, + name : 'isReimbursed', + id : this.id + 'dewar_isReimbursed', + trueText: 'true', + falseText: 'false' , + hidden : false //'{4 < 3}' + }, + ]}] }); + this.refresh(dewar); return this.panel; }; \ No newline at end of file diff --git a/js/core/view/shipping/parcelgrid.js b/js/core/view/shipping/parcelgrid.js index a677994bf..3ff099bed 100644 --- a/js/core/view/shipping/parcelgrid.js +++ b/js/core/view/shipping/parcelgrid.js @@ -50,13 +50,26 @@ ParcelGrid.prototype.load = function(shipment,hasExportedData,samples,withoutCol this.hasExportedData = hasExportedData; nSamples = 0; nMeasured = 0; + maxReimbursedDewars = 0; + currentReimbursedDewars = 0; if (samples) { nSamples = samples.length; nMeasured = nSamples - withoutCollection.length; this.samples = _.groupBy(samples,"Dewar_dewarId"); this.withoutCollection = _.groupBy(withoutCollection,"Dewar_dewarId"); - } - + }; + if (shipment){ + if (shipment.sessions.length > 0){ + maxReimbursedDewars = shipment.sessions[0].nbReimbDewars; + } + }; + + for (var i =0; i < this.dewars.length; i++){ + if (this.dewars[i].isReimbursed ) { + currentReimbursedDewars++; + } + } + this.dewars.sort(function(a, b) { return a.dewarId - b.dewarId; }); @@ -66,6 +79,7 @@ ParcelGrid.prototype.load = function(shipment,hasExportedData,samples,withoutCol $("#" + this.id + "-add-button").unbind('click').click(function(sender){ _this.edit(); }); + if (nSamples > 0) { $("#" + this.id + "-export").removeClass("disabled"); $("#" + this.id + "-export").unbind('click').click(function(sender){ @@ -74,6 +88,10 @@ ParcelGrid.prototype.load = function(shipment,hasExportedData,samples,withoutCol exportForm.show(); }); } + + if (nbReimbDewars > 0) { + $("#" + this.id + "-reimbursed").html("Max nb of reimbursed parcels: " + maxReimbursedDewars + " " ); + }; this.fillTab("content", this.dewars); diff --git a/js/core/widget/parcelpanel.js b/js/core/widget/parcelpanel.js index 58a4fda95..129e92cb3 100644 --- a/js/core/widget/parcelpanel.js +++ b/js/core/widget/parcelpanel.js @@ -67,6 +67,7 @@ ParcelPanel.prototype.load = function(dewar, shipment, samples, withoutCollectio if (shipment){ if (shipment.sessions.length > 0){ this.dewar.beamlineName = shipment.sessions[0].beamlineName; + this.dewar.nbReimbDewars = shipment.sessions[0].nbReimbDewars; } } this.samples = samples; diff --git a/templates/core/parcel.grid.template.js b/templates/core/parcel.grid.template.js index f8e801e3e..3a3046470 100644 --- a/templates/core/parcel.grid.template.js +++ b/templates/core/parcel.grid.template.js @@ -8,9 +8,12 @@ - + + Reimbursed (0 Parcels) +
From 76d248428d047263fe4b25695ce5e9e3de824020 Mon Sep 17 00:00:00 2001 From: delageniere Date: Thu, 22 Feb 2018 11:44:10 +0100 Subject: [PATCH 05/18] new reimbursement form for parcels --- js/core/view/shipping/caseform.js | 10 +-- js/core/view/shipping/parcelgrid.js | 11 ++-- js/core/widget/parcelpanel.js | 66 +++++++++++++++++-- mx/dev.html | 1 + saxs/dev.html | 1 + .../parcel.panel.parameter.table.template.js | 2 +- templates/core/parcel.panel.template.js | 7 ++ test/dev.html | 1 + tracking/dev.html | 1 + 9 files changed, 81 insertions(+), 19 deletions(-) diff --git a/js/core/view/shipping/caseform.js b/js/core/view/shipping/caseform.js index f74f2f57e..a43337bbd 100644 --- a/js/core/view/shipping/caseform.js +++ b/js/core/view/shipping/caseform.js @@ -68,12 +68,6 @@ CaseForm.prototype.setDewar = function(dewar) { this.sessionsCombo.setValue(this.dewar.sessionVO.sessionId); }*/ - if (dewar.isReimbursed){ - this.isSelectedForReimb = " (R)"; - } else { - this.isSelectedForReimb = ""; - } - }; /* @@ -139,7 +133,9 @@ CaseForm.prototype.getPanel = function(dewar) { }, { xtype: 'checkbox', - fieldLabel : 'By setting this dewar to reimbursed, the labels that will be generated for the sending will contain the fedex account that you should use to send your dewars.Please note that you MUST NOT use this account to ship more than the allowed number of dewars.In case of abuse, your proposal will no more be able to benefit from the dewar reimbursement. Click on the following checkbox if you agree with these conditions and you want to have this dewar automatically reimbursed.', + fieldLabel : ' ', + boxLabel : 'By setting this dewar to reimbursed, the labels that will be generated for the sending will contain the fedex account that you should use to send your dewars.
Please note that you MUST NOT use this account to ship more than the allowed number of dewars.
In case of abuse, your proposal will no more be able to benefit from the dewar reimbursement.
Click if you agree with these conditions and you want to have this dewar automatically reimbursed.', + hideLabel:true, labelWidth : 500, name : 'isReimbursed', id : this.id + 'dewar_isReimbursed', diff --git a/js/core/view/shipping/parcelgrid.js b/js/core/view/shipping/parcelgrid.js index 3ff099bed..d76f146b4 100644 --- a/js/core/view/shipping/parcelgrid.js +++ b/js/core/view/shipping/parcelgrid.js @@ -51,7 +51,7 @@ ParcelGrid.prototype.load = function(shipment,hasExportedData,samples,withoutCol nSamples = 0; nMeasured = 0; maxReimbursedDewars = 0; - currentReimbursedDewars = 0; + this.currentReimbursedDewars = 0; if (samples) { nSamples = samples.length; nMeasured = nSamples - withoutCollection.length; @@ -66,7 +66,7 @@ ParcelGrid.prototype.load = function(shipment,hasExportedData,samples,withoutCol for (var i =0; i < this.dewars.length; i++){ if (this.dewars[i].isReimbursed ) { - currentReimbursedDewars++; + this.currentReimbursedDewars++; } } @@ -90,7 +90,7 @@ ParcelGrid.prototype.load = function(shipment,hasExportedData,samples,withoutCol } if (nbReimbDewars > 0) { - $("#" + this.id + "-reimbursed").html("Max nb of reimbursed parcels: " + maxReimbursedDewars + " " ); + $("#" + this.id + "-reimbursed").html(this.currentReimbursedDewars + " parcels reimbursed out of max : " + maxReimbursedDewars + " authorized" ); }; this.fillTab("content", this.dewars); @@ -125,11 +125,12 @@ ParcelGrid.prototype.fillTab = function (tabName, dewars) { for ( var i in dewars) { var parcelPanel = new ParcelPanel({ height : 90, - width : this.panel.getWidth()*0.9, + width : this.panel.getWidth()*0.9, shippingId : this.shipment.shippingId, shippingStatus : this.shipment.shippingStatus, index : Number(i)+1, - currentTab : tabName + currentTab : tabName, + currentReimbursedDewars : this.currentReimbursedDewars }); this.parcelPanels[tabName].insert(parcelPanel.getPanel()); parcelPanel.load(this.dewars[i],this.shipment,this.samples[this.dewars[i].dewarId],this.withoutCollection[this.dewars[i].dewarId]); diff --git a/js/core/widget/parcelpanel.js b/js/core/widget/parcelpanel.js index 129e92cb3..fdde1dd5d 100644 --- a/js/core/widget/parcelpanel.js +++ b/js/core/widget/parcelpanel.js @@ -47,6 +47,9 @@ function ParcelPanel(args) { if (args.currentTab != null) { this.currentTab = args.currentTab; } + if (args.currentReimbursedDewars != null) { + this.currentReimbursedDewars = args.currentReimbursedDewars; + } } this.onSavedClick = new Event(this); @@ -59,11 +62,6 @@ ParcelPanel.prototype.load = function(dewar, shipment, samples, withoutCollectio this.dewar.index = this.index; this.shipment = shipment; - if (dewar.isReimbursed){ - this.isSelectedForReimb = " (R)"; - } else { - this.isSelectedForReimb = ""; - } if (shipment){ if (shipment.sessions.length > 0){ this.dewar.beamlineName = shipment.sessions[0].beamlineName; @@ -93,8 +91,15 @@ ParcelPanel.prototype.load = function(dewar, shipment, samples, withoutCollectio $("#" + this.id + "-edit-button").click(function () { _this.showCaseForm(); }); + + if (this.currentReimbursedDewars < this.dewar.nbReimbDewars || this.dewar.isReimbursed) { + $("#" + this.id + "-euro-button").removeClass("disabled"); + $("#" + this.id + "-euro-button").click(function () { + _this.showReimbForm(); + }); + } } - + $("#" + this.id + "-print-button").click(function () { var dewarId = _this.dewar.dewarId; var url = EXI.getDataAdapter().proposal.shipping.getDewarLabelURL(dewarId, dewarId); @@ -102,6 +107,10 @@ ParcelPanel.prototype.load = function(dewar, shipment, samples, withoutCollectio return; }); + $("#" + this.id + "-euro-button").click(function () { + _this.showReimbForm(); + }); + this.containersPanel = Ext.create('Ext.panel.Panel', { id : this.id + "-containers-panel", // layout : 'fit', @@ -128,6 +137,11 @@ ParcelPanel.prototype.load = function(dewar, shipment, samples, withoutCollectio ParcelPanel.prototype.renderDewarParameters = function (dewar) { var html = ""; + if (dewar.isReimbursed){ + this.isSelectedForReimb = " (R)"; + } else { + this.isSelectedForReimb = ""; + } dust.render("parcel.panel.parameter.table.template", {id : this.id, dewar : dewar, height : this.height, isSelectedForReimb : this.isSelectedForReimb}, function(err, out){ html = out; }); @@ -355,6 +369,46 @@ ParcelPanel.prototype.showCaseForm = function() { window.show(); }; +/** +* It displays a window with the reimbursement form +* +* @method showReimbForm +*/ +ParcelPanel.prototype.showReimbForm = function() { + var _this = this; + /** Opens a window with the cas form **/ + var reimbForm = new ReimbForm(); + var window = Ext.create('Ext.window.Window', { + title: 'Reimburse Parcel', + height: 450, + width: 600, + modal : true, + layout: 'fit', + items: [ + reimbForm.getPanel(_this.dewar) + ], + buttons : [ { + text : 'Save', + handler : function() { + _this.onSavedClick.notify(reimbForm.getDewar()); + window.close(); + if (_this.currentTab == "content") { + _this.renderDewarParameters(_this.dewar); + } + _this.renderDewarComments(_this.dewar); + _this.panel.doLayout(); + } + }, + { + text : 'Cancel', + handler : function() { + window.close(); + } + } ] + }); + window.show(); +}; + /** * It displays a window with an adding container form * diff --git a/mx/dev.html b/mx/dev.html index 0cd8cb0a7..71bc6e30a 100644 --- a/mx/dev.html +++ b/mx/dev.html @@ -301,6 +301,7 @@ + diff --git a/saxs/dev.html b/saxs/dev.html index 1c3a02548..377d6823b 100644 --- a/saxs/dev.html +++ b/saxs/dev.html @@ -293,6 +293,7 @@ + diff --git a/templates/core/parcel.panel.parameter.table.template.js b/templates/core/parcel.panel.parameter.table.template.js index e99a3b1a8..ca143666f 100644 --- a/templates/core/parcel.panel.parameter.table.template.js +++ b/templates/core/parcel.panel.parameter.table.template.js @@ -1,7 +1,7 @@ - + diff --git a/templates/core/parcel.panel.template.js b/templates/core/parcel.panel.template.js index f9cdfa8bc..f8fff7b25 100644 --- a/templates/core/parcel.panel.template.js +++ b/templates/core/parcel.panel.template.js @@ -30,6 +30,13 @@ + + +
Name: {dewar.code}{isSelectedForReimb}{dewar.code}{isSelectedForReimb}{dewar.isReimbursed}
Status:
+ + Reimburse + +
diff --git a/test/dev.html b/test/dev.html index f4b180962..e3ea5df74 100644 --- a/test/dev.html +++ b/test/dev.html @@ -296,6 +296,7 @@ + diff --git a/tracking/dev.html b/tracking/dev.html index b44a7ca4e..9b637b27d 100644 --- a/tracking/dev.html +++ b/tracking/dev.html @@ -243,6 +243,7 @@ + From ab702c2e39088a0fd491449fdf464f89faaed355 Mon Sep 17 00:00:00 2001 From: delageniere Date: Thu, 22 Feb 2018 11:44:24 +0100 Subject: [PATCH 06/18] new reimbursement form for parcels --- js/core/view/shipping/reimbursementform.js | 86 ++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 js/core/view/shipping/reimbursementform.js diff --git a/js/core/view/shipping/reimbursementform.js b/js/core/view/shipping/reimbursementform.js new file mode 100644 index 000000000..49741a0af --- /dev/null +++ b/js/core/view/shipping/reimbursementform.js @@ -0,0 +1,86 @@ +/** + * @showTitle + * + * #onSaved + * #onAddPlates + * #onRemovePlates + **/ +function ReimbForm(args) { + this.id = BUI.id(); + this.width = 600; + this.showTitle = true; + if (args != null) { + if (args.showTitle != null) { + this.showTitle = args.showTitle; + } + } + this.onSaved = new Event(this); +} + +ReimbForm.prototype.fillStores = function() { + var _this = this; + this.panel.setLoading("Loading Labcontacts from database"); + + var proposal = BUI.getProposal(); + proposal.onDataRetrieved.attach(function(sender, data) { + _this.labContactForSendingStore.loadData(data, false); + _this.labContactForReturnStore.loadData(data, false); + _this.panel.setLoading(false); + }); + proposal.getLabContactsByProposalId(); + +}; + +ReimbForm.prototype.refresh = function(dewar) { + this.setDewar(dewar); +}; + +ReimbForm.prototype.getDewar = function() { + this.dewar.isReimbursed = Ext.getCmp(this.id + "dewar_isReimbursed").getValue(); + return this.dewar; +}; + +ReimbForm.prototype.setDewar = function(dewar) { + this.dewar = dewar; + + if (this.dewar == null){ + this.dewar={}; + this.dewar["isReimbursed"] = ""; + } + + Ext.getCmp(this.id + "dewar_isReimbursed").setValue(this.dewar.isReimbursed); + +}; + +ReimbForm.prototype.getPanel = function(dewar) { + this.panel = Ext.create('Ext.form.Panel', { + width : this.width - 10, +// cls : 'border-grid', +// margin : 10, + padding : 10, + height : 320, + items : [ { + xtype : 'container', + margin : "2 2 2 2", + collapsible : false, + defaultType : 'textfield', + layout : 'anchor', + items : [ + { + xtype: 'checkbox', + fieldLabel : ' ', + boxLabel : 'By setting this dewar to reimbursed, the labels that will be generated for the sending will contain the fedex account that you should use to send your dewars.
Please note that you MUST NOT use this account to ship more than the allowed number of dewars.
In case of abuse, your proposal will no more be able to benefit from the dewar reimbursement.
Click if you agree with these conditions and you want to have this dewar automatically reimbursed.', + hideLabel:true, + labelWidth : 500, + name : 'isReimbursed', + id : this.id + 'dewar_isReimbursed', + trueText: 'true', + falseText: 'false' , + hidden : false //'{4 < 3}' + }, + ]}] + }); + + this.refresh(dewar); + return this.panel; +}; \ No newline at end of file From 3a842e85e594a392efdcae17f1e0ad872c478db6 Mon Sep 17 00:00:00 2001 From: delageniere Date: Wed, 7 Mar 2018 10:57:21 +0100 Subject: [PATCH 07/18] dev version --- mx/dev.html | 3 +-- saxs/dev.html | 3 +-- test/dev.html | 3 +-- tracking/dev.html | 3 +-- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/mx/dev.html b/mx/dev.html index d7278905b..572139eae 100644 --- a/mx/dev.html +++ b/mx/dev.html @@ -32,8 +32,8 @@ + - @@ -91,7 +91,6 @@ - diff --git a/saxs/dev.html b/saxs/dev.html index 706b13850..f6d320b71 100644 --- a/saxs/dev.html +++ b/saxs/dev.html @@ -35,8 +35,8 @@ + - @@ -94,7 +94,6 @@ - diff --git a/test/dev.html b/test/dev.html index 5c701683f..16e1e851a 100644 --- a/test/dev.html +++ b/test/dev.html @@ -35,8 +35,8 @@ + - @@ -94,7 +94,6 @@ - view-source:http://lindemaria:8082/EXI/test/dev.html#/welcome diff --git a/tracking/dev.html b/tracking/dev.html index 9fdf805be..375ef6264 100644 --- a/tracking/dev.html +++ b/tracking/dev.html @@ -32,8 +32,8 @@ + - @@ -91,7 +91,6 @@ - From 243564653c8f698bbd815d88f8e2b9fb4b1d7d30 Mon Sep 17 00:00:00 2001 From: delageniere Date: Fri, 9 Mar 2018 15:11:42 +0100 Subject: [PATCH 08/18] work on issue350 --- js/core/view/shipping/parcelgrid.js | 3 ++- js/core/view/shipping/reimbursementform.js | 15 ++++++++++++++- js/core/widget/parcelpanel.js | 7 +++---- templates/core/parcel.grid.template.js | 2 +- 4 files changed, 20 insertions(+), 7 deletions(-) diff --git a/js/core/view/shipping/parcelgrid.js b/js/core/view/shipping/parcelgrid.js index d76f146b4..0998953ba 100644 --- a/js/core/view/shipping/parcelgrid.js +++ b/js/core/view/shipping/parcelgrid.js @@ -36,6 +36,7 @@ function ParcelGrid(args) { this.parcelPanels = {}; this.samples = []; this.withoutCollection = []; + this.nbReimbDewars=0; /** Events **/ this.onSuccess = new Event(this); @@ -89,7 +90,7 @@ ParcelGrid.prototype.load = function(shipment,hasExportedData,samples,withoutCol }); } - if (nbReimbDewars > 0) { + if (nbReimbDewars != null && nbReimbDewars > -1) { $("#" + this.id + "-reimbursed").html(this.currentReimbursedDewars + " parcels reimbursed out of max : " + maxReimbursedDewars + " authorized" ); }; diff --git a/js/core/view/shipping/reimbursementform.js b/js/core/view/shipping/reimbursementform.js index 49741a0af..39569203c 100644 --- a/js/core/view/shipping/reimbursementform.js +++ b/js/core/view/shipping/reimbursementform.js @@ -37,6 +37,7 @@ ReimbForm.prototype.refresh = function(dewar) { ReimbForm.prototype.getDewar = function() { this.dewar.isReimbursed = Ext.getCmp(this.id + "dewar_isReimbursed").getValue(); + this.dewar.comments = Ext.getCmp(this.id + "dewar_comments").getValue(); return this.dewar; }; @@ -46,10 +47,11 @@ ReimbForm.prototype.setDewar = function(dewar) { if (this.dewar == null){ this.dewar={}; this.dewar["isReimbursed"] = ""; + this.dewar["comments"] = ""; } Ext.getCmp(this.id + "dewar_isReimbursed").setValue(this.dewar.isReimbursed); - + Ext.getCmp(this.id + "dewar_comments").setValue(this.dewar.comments); }; ReimbForm.prototype.getPanel = function(dewar) { @@ -78,6 +80,17 @@ ReimbForm.prototype.getPanel = function(dewar) { falseText: 'false' , hidden : false //'{4 < 3}' }, + { + xtype : 'textareafield', + name : 'comments', + fieldLabel : 'Comments', + labelWidth : 200, + width : 500, + margin : '10 0 0 0', + height : 100, + id : this.id + 'dewar_comments' + }, + ]}] }); diff --git a/js/core/widget/parcelpanel.js b/js/core/widget/parcelpanel.js index fdde1dd5d..632b40dd4 100644 --- a/js/core/widget/parcelpanel.js +++ b/js/core/widget/parcelpanel.js @@ -21,6 +21,7 @@ function ParcelPanel(args) { this.shippingStatus = ""; this.containersPanel = null; this.currentTab = "content"; + this.currentReimbursedDewars = 0; this.isSaveButtonHidden = false; this.isHidden = false; @@ -97,6 +98,8 @@ ParcelPanel.prototype.load = function(dewar, shipment, samples, withoutCollectio $("#" + this.id + "-euro-button").click(function () { _this.showReimbForm(); }); + } else { + $("#" + this.id + "-euro-button").hide(); } } @@ -107,10 +110,6 @@ ParcelPanel.prototype.load = function(dewar, shipment, samples, withoutCollectio return; }); - $("#" + this.id + "-euro-button").click(function () { - _this.showReimbForm(); - }); - this.containersPanel = Ext.create('Ext.panel.Panel', { id : this.id + "-containers-panel", // layout : 'fit', diff --git a/templates/core/parcel.grid.template.js b/templates/core/parcel.grid.template.js index 3a3046470..5f163e1cf 100644 --- a/templates/core/parcel.grid.template.js +++ b/templates/core/parcel.grid.template.js @@ -12,7 +12,7 @@ Export PDF View - Reimbursed (0 Parcels) + From d607785e3a37181fb55b49e9932e2a919fb6482a Mon Sep 17 00:00:00 2001 From: delageniere Date: Fri, 9 Mar 2018 18:02:09 +0100 Subject: [PATCH 09/18] work on issue350 --- js/core/view/shipping/caseform.js | 7 ++++--- js/core/view/shipping/parcelgrid.js | 14 +++++++------- js/core/widget/parcelpanel.js | 13 ++++++++++++- 3 files changed, 23 insertions(+), 11 deletions(-) diff --git a/js/core/view/shipping/caseform.js b/js/core/view/shipping/caseform.js index a43337bbd..ae98097b0 100644 --- a/js/core/view/shipping/caseform.js +++ b/js/core/view/shipping/caseform.js @@ -85,7 +85,8 @@ CaseForm.prototype.getStorageLocationCombo = function() { return this.storageLocationComboBox; }; -CaseForm.prototype.getPanel = function(dewar) { +CaseForm.prototype.getPanel = function(dewar, hideReimb) { + this.panel = Ext.create('Ext.form.Panel', { width : this.width - 10, // cls : 'border-grid', @@ -141,10 +142,10 @@ CaseForm.prototype.getPanel = function(dewar) { id : this.id + 'dewar_isReimbursed', trueText: 'true', falseText: 'false' , - hidden : false //'{4 < 3}' + hidden : hideReimb }, ]}] - }); + }); this.refresh(dewar); return this.panel; diff --git a/js/core/view/shipping/parcelgrid.js b/js/core/view/shipping/parcelgrid.js index 0998953ba..161d8828e 100644 --- a/js/core/view/shipping/parcelgrid.js +++ b/js/core/view/shipping/parcelgrid.js @@ -36,7 +36,6 @@ function ParcelGrid(args) { this.parcelPanels = {}; this.samples = []; this.withoutCollection = []; - this.nbReimbDewars=0; /** Events **/ this.onSuccess = new Event(this); @@ -51,7 +50,7 @@ ParcelGrid.prototype.load = function(shipment,hasExportedData,samples,withoutCol this.hasExportedData = hasExportedData; nSamples = 0; nMeasured = 0; - maxReimbursedDewars = 0; + this.maxReimbursedDewars = 0; this.currentReimbursedDewars = 0; if (samples) { nSamples = samples.length; @@ -61,7 +60,7 @@ ParcelGrid.prototype.load = function(shipment,hasExportedData,samples,withoutCol }; if (shipment){ if (shipment.sessions.length > 0){ - maxReimbursedDewars = shipment.sessions[0].nbReimbDewars; + this.maxReimbursedDewars = shipment.sessions[0].nbReimbDewars; } }; @@ -91,7 +90,7 @@ ParcelGrid.prototype.load = function(shipment,hasExportedData,samples,withoutCol } if (nbReimbDewars != null && nbReimbDewars > -1) { - $("#" + this.id + "-reimbursed").html(this.currentReimbursedDewars + " parcels reimbursed out of max : " + maxReimbursedDewars + " authorized" ); + $("#" + this.id + "-reimbursed").html(this.currentReimbursedDewars + " parcels reimbursed out of max : " + this.maxReimbursedDewars + " authorized" ); }; this.fillTab("content", this.dewars); @@ -125,13 +124,14 @@ ParcelGrid.prototype.fillTab = function (tabName, dewars) { for ( var i in dewars) { var parcelPanel = new ParcelPanel({ - height : 90, + height : 110, width : this.panel.getWidth()*0.9, shippingId : this.shipment.shippingId, shippingStatus : this.shipment.shippingStatus, index : Number(i)+1, currentTab : tabName, - currentReimbursedDewars : this.currentReimbursedDewars + currentReimbursedDewars : this.currentReimbursedDewars, + maxReimbursedDewars : this.maxReimbursedDewars }); this.parcelPanels[tabName].insert(parcelPanel.getPanel()); parcelPanel.load(this.dewars[i],this.shipment,this.samples[this.dewars[i].dewarId],this.withoutCollection[this.dewars[i].dewarId]); @@ -150,7 +150,7 @@ ParcelGrid.prototype.edit = function(dewar) { width : 600, modal : true, layout : 'fit', - items : [ caseForm.getPanel(dewar) ], + items : [ caseForm.getPanel(dewar, true) ], listeners : { afterrender : function(component, eOpts) { if (_this.puck != null) { diff --git a/js/core/widget/parcelpanel.js b/js/core/widget/parcelpanel.js index 632b40dd4..5d03e644c 100644 --- a/js/core/widget/parcelpanel.js +++ b/js/core/widget/parcelpanel.js @@ -22,6 +22,7 @@ function ParcelPanel(args) { this.containersPanel = null; this.currentTab = "content"; this.currentReimbursedDewars = 0; + this.maxReimbursedDewars = 0; this.isSaveButtonHidden = false; this.isHidden = false; @@ -50,6 +51,9 @@ function ParcelPanel(args) { } if (args.currentReimbursedDewars != null) { this.currentReimbursedDewars = args.currentReimbursedDewars; + } + if (args.maxReimbursedDewars != null) { + this.maxReimbursedDewars = args.maxReimbursedDewars; } } @@ -336,6 +340,13 @@ ParcelPanel.prototype.addContainerToDewar = function(containerVO) { */ ParcelPanel.prototype.showCaseForm = function() { var _this = this; + var hideReimb = true; + if (this.dewar.isReimbursed) { + hideReimb = false; + } + if (this.maxReimbursedDewars > this.currentReimbursedDewars) { + hideReimb = false; + } /** Opens a window with the cas form **/ var caseForm = new CaseForm(); var window = Ext.create('Ext.window.Window', { @@ -345,7 +356,7 @@ ParcelPanel.prototype.showCaseForm = function() { modal : true, layout: 'fit', items: [ - caseForm.getPanel(_this.dewar) + caseForm.getPanel(_this.dewar, hideReimb) ], buttons : [ { text : 'Save', From 46a6d01818f3c8f935f96e39df20524c6d78dd83 Mon Sep 17 00:00:00 2001 From: delageniere Date: Tue, 13 Mar 2018 11:49:06 +0100 Subject: [PATCH 10/18] work on issue350 --- js/core/view/shipping/parcelgrid.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/core/view/shipping/parcelgrid.js b/js/core/view/shipping/parcelgrid.js index 161d8828e..9a831bd97 100644 --- a/js/core/view/shipping/parcelgrid.js +++ b/js/core/view/shipping/parcelgrid.js @@ -89,7 +89,7 @@ ParcelGrid.prototype.load = function(shipment,hasExportedData,samples,withoutCol }); } - if (nbReimbDewars != null && nbReimbDewars > -1) { + if (this.maxReimbursedDewars != null && this.maxReimbursedDewars > 0) { $("#" + this.id + "-reimbursed").html(this.currentReimbursedDewars + " parcels reimbursed out of max : " + this.maxReimbursedDewars + " authorized" ); }; From 9516ca515c810c314b44be080375ae9d1e156567 Mon Sep 17 00:00:00 2001 From: delageniere Date: Tue, 13 Mar 2018 12:09:45 +0100 Subject: [PATCH 11/18] work on issue350 --- js/core/view/shipping/reimbursementform.js | 14 -------------- js/core/widget/parcelpanel.js | 1 + 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/js/core/view/shipping/reimbursementform.js b/js/core/view/shipping/reimbursementform.js index 39569203c..5c2a161de 100644 --- a/js/core/view/shipping/reimbursementform.js +++ b/js/core/view/shipping/reimbursementform.js @@ -37,7 +37,6 @@ ReimbForm.prototype.refresh = function(dewar) { ReimbForm.prototype.getDewar = function() { this.dewar.isReimbursed = Ext.getCmp(this.id + "dewar_isReimbursed").getValue(); - this.dewar.comments = Ext.getCmp(this.id + "dewar_comments").getValue(); return this.dewar; }; @@ -47,11 +46,9 @@ ReimbForm.prototype.setDewar = function(dewar) { if (this.dewar == null){ this.dewar={}; this.dewar["isReimbursed"] = ""; - this.dewar["comments"] = ""; } Ext.getCmp(this.id + "dewar_isReimbursed").setValue(this.dewar.isReimbursed); - Ext.getCmp(this.id + "dewar_comments").setValue(this.dewar.comments); }; ReimbForm.prototype.getPanel = function(dewar) { @@ -80,17 +77,6 @@ ReimbForm.prototype.getPanel = function(dewar) { falseText: 'false' , hidden : false //'{4 < 3}' }, - { - xtype : 'textareafield', - name : 'comments', - fieldLabel : 'Comments', - labelWidth : 200, - width : 500, - margin : '10 0 0 0', - height : 100, - id : this.id + 'dewar_comments' - }, - ]}] }); diff --git a/js/core/widget/parcelpanel.js b/js/core/widget/parcelpanel.js index 5d03e644c..2b886ec09 100644 --- a/js/core/widget/parcelpanel.js +++ b/js/core/widget/parcelpanel.js @@ -407,6 +407,7 @@ ParcelPanel.prototype.showReimbForm = function() { } _this.renderDewarComments(_this.dewar); _this.panel.doLayout(); + } }, { From b498f1c01d12874074ce4bf540e098d0903be730 Mon Sep 17 00:00:00 2001 From: delageniere Date: Tue, 13 Mar 2018 18:07:57 +0100 Subject: [PATCH 12/18] work on issue350 --- js/core/view/shipping/parcelgrid.js | 67 ++++++++++++++----- js/core/widget/parcelpanel.js | 2 +- templates/core/parcel.grid.template.js | 4 +- .../parcel.panel.parameter.table.template.js | 2 +- 4 files changed, 54 insertions(+), 21 deletions(-) diff --git a/js/core/view/shipping/parcelgrid.js b/js/core/view/shipping/parcelgrid.js index 9a831bd97..d4186ea8b 100644 --- a/js/core/view/shipping/parcelgrid.js +++ b/js/core/view/shipping/parcelgrid.js @@ -13,6 +13,9 @@ function ParcelGrid(args) { this.btnEditVisible = true; this.btnRemoveVisible = true; + this.reimbursementId = this.id+ "_reimbursement_panel"; + + if (args != null) { if (args.height != null) { this.height = args.height; @@ -43,6 +46,40 @@ function ParcelGrid(args) { this.onRemove = new Event(this); } +ParcelGrid.prototype.getReimbursementContentHTML = function(currentReimbursedDewars, maxReimbursedDewars ) { + return "("+ currentReimbursedDewars +" reimbursed out of " + maxReimbursedDewars +" allowed)"; +}; +ParcelGrid.prototype.getReimbursementHTML = function(currentReimbursedDewars, maxReimbursedDewars ) { + if (maxReimbursedDewars){ + if (maxReimbursedDewars > 0){ + return "" + this.getReimbursementContentHTML(currentReimbursedDewars, maxReimbursedDewars)+ "" + } + } + return ""; +}; + +ParcelGrid.prototype.refreshReimbursementContentHTML = function(currentReimbursedDewars, maxReimbursedDewars ) { + $("#" + this.reumbursementId).html(this.getReimbursementContentHTML(currentReimbursedDewars, maxReimbursedDewars)); +}; + +ParcelGrid.prototype.displayContentLabel = function(dewars,nSamples,nMeasured, currentReimbursedDewars, maxReimbursedDewars ) { + + $("#" + this.id + "-label").html("Content (" + dewars.length + " Parcels " + this.getReimbursementHTML(currentReimbursedDewars, maxReimbursedDewars) + " - " + nSamples + " Samples - " + nMeasured + " Measured )"); +}; + +ParcelGrid.prototype.getAuthorizedReimbursedDewars = function(sessions) { + if (sessions){ + if (sessions.length > 0){ + return sessions[0].nbReimbDewars; + } + }; + return 0; +}; + +ParcelGrid.prototype.getCurrentReimbursedDewars = function(dewars) { + return _.filter(dewars, function(o){ return o.isReimbursed == true}).length; +}; + ParcelGrid.prototype.load = function(shipment,hasExportedData,samples,withoutCollection) { var _this = this; this.shipment = shipment; @@ -58,23 +95,17 @@ ParcelGrid.prototype.load = function(shipment,hasExportedData,samples,withoutCol this.samples = _.groupBy(samples,"Dewar_dewarId"); this.withoutCollection = _.groupBy(withoutCollection,"Dewar_dewarId"); }; - if (shipment){ - if (shipment.sessions.length > 0){ - this.maxReimbursedDewars = shipment.sessions[0].nbReimbDewars; - } - }; - for (var i =0; i < this.dewars.length; i++){ - if (this.dewars[i].isReimbursed ) { - this.currentReimbursedDewars++; - } - } + if (shipment){ + this.maxReimbursedDewars = this.getAuthorizedReimbursedDewars(this.shipment.sessions); + this.currentReimbursedDewars = this.getCurrentReimbursedDewars(this.dewars); + } this.dewars.sort(function(a, b) { return a.dewarId - b.dewarId; }); - $("#" + this.id + "-label").html("Content (" + this.dewars.length + " Parcels - " + nSamples + " Samples - " + nMeasured + " Measured)"); + this.displayContentLabel(this.dewars, nSamples, nMeasured, this.currentReimbursedDewars, this.maxReimbursedDewars); $("#" + this.id + "-add-button").removeClass("disabled"); $("#" + this.id + "-add-button").unbind('click').click(function(sender){ _this.edit(); @@ -89,9 +120,9 @@ ParcelGrid.prototype.load = function(shipment,hasExportedData,samples,withoutCol }); } - if (this.maxReimbursedDewars != null && this.maxReimbursedDewars > 0) { + /*if (this.maxReimbursedDewars != null && this.maxReimbursedDewars > 0) { $("#" + this.id + "-reimbursed").html(this.currentReimbursedDewars + " parcels reimbursed out of max : " + this.maxReimbursedDewars + " authorized" ); - }; + };*/ this.fillTab("content", this.dewars); @@ -99,7 +130,8 @@ ParcelGrid.prototype.load = function(shipment,hasExportedData,samples,withoutCol }; ParcelGrid.prototype.fillTab = function (tabName, dewars) { - var _this = this; + var _this = this; + $("#" + tabName + "-" + this.id).html(""); this.parcelPanels[tabName] = Ext.create('Ext.panel.Panel', { // cls : 'border-grid', @@ -117,7 +149,8 @@ ParcelGrid.prototype.fillTab = function (tabName, dewars) { var onSuccess = function(sender, shipment) { _this.panel.setLoading(false); - _this.panel.doLayout(); + _this.panel.doLayout(); + _this.refreshReimbursementContentHTML( _this.getCurrentReimbursedDewars(shipment.dewarVOs), _this.getAuthorizedReimbursedDewars(shipment.sessions)); }; EXI.getDataAdapter({onSuccess : onSuccess}).proposal.dewar.saveDewar(_this.shipment.shippingId, dewar); } @@ -130,8 +163,8 @@ ParcelGrid.prototype.fillTab = function (tabName, dewars) { shippingStatus : this.shipment.shippingStatus, index : Number(i)+1, currentTab : tabName, - currentReimbursedDewars : this.currentReimbursedDewars, - maxReimbursedDewars : this.maxReimbursedDewars + currentReimbursedDewars : _this.currentReimbursedDewars, + maxReimbursedDewars : _this.maxReimbursedDewars }); this.parcelPanels[tabName].insert(parcelPanel.getPanel()); parcelPanel.load(this.dewars[i],this.shipment,this.samples[this.dewars[i].dewarId],this.withoutCollection[this.dewars[i].dewarId]); diff --git a/js/core/widget/parcelpanel.js b/js/core/widget/parcelpanel.js index 2b886ec09..5b775b502 100644 --- a/js/core/widget/parcelpanel.js +++ b/js/core/widget/parcelpanel.js @@ -96,7 +96,7 @@ ParcelPanel.prototype.load = function(dewar, shipment, samples, withoutCollectio $("#" + this.id + "-edit-button").click(function () { _this.showCaseForm(); }); - + //debugger if (this.currentReimbursedDewars < this.dewar.nbReimbDewars || this.dewar.isReimbursed) { $("#" + this.id + "-euro-button").removeClass("disabled"); $("#" + this.id + "-euro-button").click(function () { diff --git a/templates/core/parcel.grid.template.js b/templates/core/parcel.grid.template.js index 5f163e1cf..0c1f6a221 100644 --- a/templates/core/parcel.grid.template.js +++ b/templates/core/parcel.grid.template.js @@ -11,9 +11,9 @@ - + - +
diff --git a/templates/core/parcel.panel.parameter.table.template.js b/templates/core/parcel.panel.parameter.table.template.js index ca143666f..e99a3b1a8 100644 --- a/templates/core/parcel.panel.parameter.table.template.js +++ b/templates/core/parcel.panel.parameter.table.template.js @@ -1,7 +1,7 @@ - + From abdafe884905a722d3bd4965e8ecaa73b53a082f Mon Sep 17 00:00:00 2001 From: delageniere Date: Wed, 14 Mar 2018 09:39:38 +0100 Subject: [PATCH 13/18] work on issue350 --- js/core/view/shipping/parcelgrid.js | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/js/core/view/shipping/parcelgrid.js b/js/core/view/shipping/parcelgrid.js index d4186ea8b..c8398d1f3 100644 --- a/js/core/view/shipping/parcelgrid.js +++ b/js/core/view/shipping/parcelgrid.js @@ -13,9 +13,8 @@ function ParcelGrid(args) { this.btnEditVisible = true; this.btnRemoveVisible = true; - this.reimbursementId = this.id+ "_reimbursement_panel"; - - + this.reimbursementId = this.id + "_reimbursement_panel"; + if (args != null) { if (args.height != null) { this.height = args.height; @@ -59,7 +58,7 @@ ParcelGrid.prototype.getReimbursementHTML = function(currentReimbursedDewars, ma }; ParcelGrid.prototype.refreshReimbursementContentHTML = function(currentReimbursedDewars, maxReimbursedDewars ) { - $("#" + this.reumbursementId).html(this.getReimbursementContentHTML(currentReimbursedDewars, maxReimbursedDewars)); + $("#" + this.reimbursementId).html(this.getReimbursementContentHTML(currentReimbursedDewars, maxReimbursedDewars)); }; ParcelGrid.prototype.displayContentLabel = function(dewars,nSamples,nMeasured, currentReimbursedDewars, maxReimbursedDewars ) { @@ -120,10 +119,6 @@ ParcelGrid.prototype.load = function(shipment,hasExportedData,samples,withoutCol }); } - /*if (this.maxReimbursedDewars != null && this.maxReimbursedDewars > 0) { - $("#" + this.id + "-reimbursed").html(this.currentReimbursedDewars + " parcels reimbursed out of max : " + this.maxReimbursedDewars + " authorized" ); - };*/ - this.fillTab("content", this.dewars); this.attachCallBackAfterRender(); From 921e711cddd428717cd3c9608f1e3e3e35edd3fa Mon Sep 17 00:00:00 2001 From: delageniere Date: Wed, 14 Mar 2018 11:48:34 +0100 Subject: [PATCH 14/18] work on issue350 --- js/core/view/shipping/parcelgrid.js | 14 ++++++++++++-- js/core/widget/parcelpanel.js | 24 +++++++++++++++--------- 2 files changed, 27 insertions(+), 11 deletions(-) diff --git a/js/core/view/shipping/parcelgrid.js b/js/core/view/shipping/parcelgrid.js index c8398d1f3..01ce331ca 100644 --- a/js/core/view/shipping/parcelgrid.js +++ b/js/core/view/shipping/parcelgrid.js @@ -79,6 +79,16 @@ ParcelGrid.prototype.getCurrentReimbursedDewars = function(dewars) { return _.filter(dewars, function(o){ return o.isReimbursed == true}).length; }; +ParcelGrid.prototype.getDisplayReimbursementButton = function(dewar, currentReimb, maxReimb) { + if (dewar.isReimbursed) { + return true; + } + if (currentReimb < maxReimb) { + return true; + } + return false; +}; + ParcelGrid.prototype.load = function(shipment,hasExportedData,samples,withoutCollection) { var _this = this; this.shipment = shipment; @@ -146,6 +156,7 @@ ParcelGrid.prototype.fillTab = function (tabName, dewars) { _this.panel.setLoading(false); _this.panel.doLayout(); _this.refreshReimbursementContentHTML( _this.getCurrentReimbursedDewars(shipment.dewarVOs), _this.getAuthorizedReimbursedDewars(shipment.sessions)); + _this.currentReimbursedDewars = _this.getCurrentReimbursedDewars(shipment.dewarVOs); }; EXI.getDataAdapter({onSuccess : onSuccess}).proposal.dewar.saveDewar(_this.shipment.shippingId, dewar); } @@ -158,8 +169,7 @@ ParcelGrid.prototype.fillTab = function (tabName, dewars) { shippingStatus : this.shipment.shippingStatus, index : Number(i)+1, currentTab : tabName, - currentReimbursedDewars : _this.currentReimbursedDewars, - maxReimbursedDewars : _this.maxReimbursedDewars + displayReimbButton : _this.getDisplayReimbursementButton(this.dewars[i], _this.currentReimbursedDewars, _this.maxReimbursedDewars) }); this.parcelPanels[tabName].insert(parcelPanel.getPanel()); parcelPanel.load(this.dewars[i],this.shipment,this.samples[this.dewars[i].dewarId],this.withoutCollection[this.dewars[i].dewarId]); diff --git a/js/core/widget/parcelpanel.js b/js/core/widget/parcelpanel.js index 5b775b502..e3d442066 100644 --- a/js/core/widget/parcelpanel.js +++ b/js/core/widget/parcelpanel.js @@ -21,8 +21,8 @@ function ParcelPanel(args) { this.shippingStatus = ""; this.containersPanel = null; this.currentTab = "content"; - this.currentReimbursedDewars = 0; - this.maxReimbursedDewars = 0; + + this.displayReimbButton = false; this.isSaveButtonHidden = false; this.isHidden = false; @@ -49,11 +49,8 @@ function ParcelPanel(args) { if (args.currentTab != null) { this.currentTab = args.currentTab; } - if (args.currentReimbursedDewars != null) { - this.currentReimbursedDewars = args.currentReimbursedDewars; - } - if (args.maxReimbursedDewars != null) { - this.maxReimbursedDewars = args.maxReimbursedDewars; + if (args.displayReimbButton != null) { + this.displayReimbButton = args.displayReimbButton; } } @@ -61,6 +58,16 @@ function ParcelPanel(args) { } +ParcelPanel.prototype.getDisplayReimb = function(dewar, currentReimb, maxReimb) { + if (dewar.isReimbursed) { + return true; + } + if (currentReimb < maxReimb) { + return true; + } + return false; +}; + ParcelPanel.prototype.load = function(dewar, shipment, samples, withoutCollection) { var _this = this; this.dewar = dewar; @@ -70,7 +77,6 @@ ParcelPanel.prototype.load = function(dewar, shipment, samples, withoutCollectio if (shipment){ if (shipment.sessions.length > 0){ this.dewar.beamlineName = shipment.sessions[0].beamlineName; - this.dewar.nbReimbDewars = shipment.sessions[0].nbReimbDewars; } } this.samples = samples; @@ -97,7 +103,7 @@ ParcelPanel.prototype.load = function(dewar, shipment, samples, withoutCollectio _this.showCaseForm(); }); //debugger - if (this.currentReimbursedDewars < this.dewar.nbReimbDewars || this.dewar.isReimbursed) { + if (this.displayReimbButton) { $("#" + this.id + "-euro-button").removeClass("disabled"); $("#" + this.id + "-euro-button").click(function () { _this.showReimbForm(); From bdc7e18a1b3a4ff3ffd1fe9d2377212fe8320468 Mon Sep 17 00:00:00 2001 From: delageniere Date: Thu, 15 Mar 2018 17:23:41 +0100 Subject: [PATCH 15/18] work on --- js/core/view/shipping/parcelgrid.js | 4 ++-- js/core/view/shipping/reimbursementform.js | 19 +++++++++++++++++-- js/core/widget/parcelpanel.js | 13 ++----------- 3 files changed, 21 insertions(+), 15 deletions(-) diff --git a/js/core/view/shipping/parcelgrid.js b/js/core/view/shipping/parcelgrid.js index 01ce331ca..a0cb51170 100644 --- a/js/core/view/shipping/parcelgrid.js +++ b/js/core/view/shipping/parcelgrid.js @@ -153,10 +153,10 @@ ParcelGrid.prototype.fillTab = function (tabName, dewars) { dewar["shippingId"] = _this.shipment.shippingId; var onSuccess = function(sender, shipment) { - _this.panel.setLoading(false); - _this.panel.doLayout(); + _this.panel.setLoading(false); _this.refreshReimbursementContentHTML( _this.getCurrentReimbursedDewars(shipment.dewarVOs), _this.getAuthorizedReimbursedDewars(shipment.sessions)); _this.currentReimbursedDewars = _this.getCurrentReimbursedDewars(shipment.dewarVOs); + _this.panel.doLayout(); }; EXI.getDataAdapter({onSuccess : onSuccess}).proposal.dewar.saveDewar(_this.shipment.shippingId, dewar); } diff --git a/js/core/view/shipping/reimbursementform.js b/js/core/view/shipping/reimbursementform.js index 5c2a161de..4cc9dd396 100644 --- a/js/core/view/shipping/reimbursementform.js +++ b/js/core/view/shipping/reimbursementform.js @@ -51,7 +51,21 @@ ReimbForm.prototype.setDewar = function(dewar) { Ext.getCmp(this.id + "dewar_isReimbursed").setValue(this.dewar.isReimbursed); }; -ReimbForm.prototype.getPanel = function(dewar) { +ReimbForm.prototype.getCurrentReimbursedDewars = function(dewars) { + return _.filter(dewars, function(o){ return o.isReimbursed == true}).length; +}; + +ReimbForm.prototype.hideReimbursedButton = function(shipment, dewar){ + var nbmax=3;// TODO replace + if (dewar.isReimbursed) + return false; + if (this.getCurrentReimbursedDewars(shipment.dewarVOs) < nbmax){ + return false; + } + return true; +} + +ReimbForm.prototype.getPanel = function(dewar, shipment) { this.panel = Ext.create('Ext.form.Panel', { width : this.width - 10, // cls : 'border-grid', @@ -75,8 +89,9 @@ ReimbForm.prototype.getPanel = function(dewar) { id : this.id + 'dewar_isReimbursed', trueText: 'true', falseText: 'false' , - hidden : false //'{4 < 3}' + hidden : this.hideReimbursedButton(shipment, dewar) //false //'{4 < 3}' }, + ]}] }); diff --git a/js/core/widget/parcelpanel.js b/js/core/widget/parcelpanel.js index e3d442066..422eeab1f 100644 --- a/js/core/widget/parcelpanel.js +++ b/js/core/widget/parcelpanel.js @@ -58,19 +58,10 @@ function ParcelPanel(args) { } -ParcelPanel.prototype.getDisplayReimb = function(dewar, currentReimb, maxReimb) { - if (dewar.isReimbursed) { - return true; - } - if (currentReimb < maxReimb) { - return true; - } - return false; -}; - ParcelPanel.prototype.load = function(dewar, shipment, samples, withoutCollection) { var _this = this; this.dewar = dewar; + this.oldDewar = dewar; this.dewar.index = this.index; this.shipment = shipment; @@ -401,7 +392,7 @@ ParcelPanel.prototype.showReimbForm = function() { modal : true, layout: 'fit', items: [ - reimbForm.getPanel(_this.dewar) + reimbForm.getPanel(_this.dewar, _this.shipment) ], buttons : [ { text : 'Save', From 53d3e4d9c607d327a3883e384234852a54581daf Mon Sep 17 00:00:00 2001 From: delageniere Date: Fri, 16 Mar 2018 10:16:12 +0100 Subject: [PATCH 16/18] work on issue350 --- js/core/view/shipping/caseform.js | 29 ---------------------- js/core/view/shipping/parcelgrid.js | 11 -------- js/core/view/shipping/reimbursementform.js | 22 +++++++++++++--- js/core/widget/parcelpanel.js | 8 +++--- 4 files changed, 22 insertions(+), 48 deletions(-) diff --git a/js/core/view/shipping/caseform.js b/js/core/view/shipping/caseform.js index ae98097b0..a9077f9d7 100644 --- a/js/core/view/shipping/caseform.js +++ b/js/core/view/shipping/caseform.js @@ -14,7 +14,6 @@ function CaseForm(args) { this.showTitle = args.showTitle; } } - this.onSaved = new Event(this); } @@ -40,7 +39,6 @@ CaseForm.prototype.getDewar = function() { this.dewar.code = Ext.getCmp(this.id + "dewar_code").getValue(); this.dewar.comments = Ext.getCmp(this.id + "dewar_comments").getValue(); this.dewar.transportValue = Ext.getCmp(this.id + "dewar_transportValue").getValue(); - this.dewar.isReimbursed = Ext.getCmp(this.id + "dewar_isReimbursed").getValue(); this.dewar.storageLocation = this.storageLocationComboBox.getValue(); //this.dewar.firstExperimentId = this.sessionsCombo.getValue(); @@ -55,31 +53,16 @@ CaseForm.prototype.setDewar = function(dewar) { this.dewar["code"] = ""; this.dewar["transportValue"] = ""; this.dewar["storageLocation"] = ""; - this.dewar["isReimbursed"] = ""; this.dewar["comments"] = ""; } Ext.getCmp(this.id + "dewar_code").setValue(this.dewar.code); Ext.getCmp(this.id + "dewar_comments").setValue(this.dewar.comments); Ext.getCmp(this.id + "dewar_transportValue").setValue(this.dewar.transportValue); - Ext.getCmp(this.id + "dewar_isReimbursed").setValue(this.dewar.isReimbursed); this.storageLocationComboBox.setValue(this.dewar.storageLocation); - /*if (this.dewar.sessionVO != null) { - this.sessionsCombo.setValue(this.dewar.sessionVO.sessionId); - }*/ }; -/* -CaseForm.prototype.getSessionCombo = function() { - this.sessionsCombo = BIOSAXS_COMBOMANAGER.getComboSessions(EXI.proposalManager.getFutureSessions(), { - labelWidth : 200, - margin : '5 0 00 0', - width : 500 - }); - return this.sessionsCombo; -};*/ - CaseForm.prototype.getStorageLocationCombo = function() { this.storageLocationComboBox = BIOSAXS_COMBOMANAGER.getComboStorageTemperature(); return this.storageLocationComboBox; @@ -132,18 +115,6 @@ CaseForm.prototype.getPanel = function(dewar, hideReimb) { height : 100, id : this.id + 'dewar_comments' }, - { - xtype: 'checkbox', - fieldLabel : ' ', - boxLabel : 'By setting this dewar to reimbursed, the labels that will be generated for the sending will contain the fedex account that you should use to send your dewars.
Please note that you MUST NOT use this account to ship more than the allowed number of dewars.
In case of abuse, your proposal will no more be able to benefit from the dewar reimbursement.
Click if you agree with these conditions and you want to have this dewar automatically reimbursed.', - hideLabel:true, - labelWidth : 500, - name : 'isReimbursed', - id : this.id + 'dewar_isReimbursed', - trueText: 'true', - falseText: 'false' , - hidden : hideReimb - }, ]}] }); diff --git a/js/core/view/shipping/parcelgrid.js b/js/core/view/shipping/parcelgrid.js index a0cb51170..c29c01eaf 100644 --- a/js/core/view/shipping/parcelgrid.js +++ b/js/core/view/shipping/parcelgrid.js @@ -79,16 +79,6 @@ ParcelGrid.prototype.getCurrentReimbursedDewars = function(dewars) { return _.filter(dewars, function(o){ return o.isReimbursed == true}).length; }; -ParcelGrid.prototype.getDisplayReimbursementButton = function(dewar, currentReimb, maxReimb) { - if (dewar.isReimbursed) { - return true; - } - if (currentReimb < maxReimb) { - return true; - } - return false; -}; - ParcelGrid.prototype.load = function(shipment,hasExportedData,samples,withoutCollection) { var _this = this; this.shipment = shipment; @@ -169,7 +159,6 @@ ParcelGrid.prototype.fillTab = function (tabName, dewars) { shippingStatus : this.shipment.shippingStatus, index : Number(i)+1, currentTab : tabName, - displayReimbButton : _this.getDisplayReimbursementButton(this.dewars[i], _this.currentReimbursedDewars, _this.maxReimbursedDewars) }); this.parcelPanels[tabName].insert(parcelPanel.getPanel()); parcelPanel.load(this.dewars[i],this.shipment,this.samples[this.dewars[i].dewarId],this.withoutCollection[this.dewars[i].dewarId]); diff --git a/js/core/view/shipping/reimbursementform.js b/js/core/view/shipping/reimbursementform.js index 4cc9dd396..15cd9e1e3 100644 --- a/js/core/view/shipping/reimbursementform.js +++ b/js/core/view/shipping/reimbursementform.js @@ -56,18 +56,34 @@ ReimbForm.prototype.getCurrentReimbursedDewars = function(dewars) { }; ReimbForm.prototype.hideReimbursedButton = function(shipment, dewar){ - var nbmax=3;// TODO replace + this.maxReimb = 0; + debugger; + if (shipment) { + if (shipment.sessions.length > 0){ + this.maxReimb = shipment.sessions[0].nbReimbDewars; + } + } if (dewar.isReimbursed) return false; - if (this.getCurrentReimbursedDewars(shipment.dewarVOs) < nbmax){ + if (this.getCurrentReimbursedDewars(shipment.dewarVOs) < this.maxReimb){ return false; } return true; } +ReimbForm.prototype.getBoxLabelText = function(shipment, dewar){ + + boxLabel = 'By setting this parcel to reimbursed, the labels printed for the sending
will contain the fedex account that you should use to send your dewars.
Please note that you MUST NOT use this account to ship more
than the allowed number of dewars.
In case of abuse, your proposal will no more benefit
from parcel reimbursement.'; + if (this.hideReimbursedButton(shipment, dewar) == true){ + boxLabel = "You are not authorized to select another parcel to be reimbursed"; + } + return boxLabel; +} + ReimbForm.prototype.getPanel = function(dewar, shipment) { this.panel = Ext.create('Ext.form.Panel', { width : this.width - 10, + title : this.getBoxLabelText(shipment, dewar), // cls : 'border-grid', // margin : 10, padding : 10, @@ -82,7 +98,7 @@ ReimbForm.prototype.getPanel = function(dewar, shipment) { { xtype: 'checkbox', fieldLabel : ' ', - boxLabel : 'By setting this dewar to reimbursed, the labels that will be generated for the sending will contain the fedex account that you should use to send your dewars.
Please note that you MUST NOT use this account to ship more than the allowed number of dewars.
In case of abuse, your proposal will no more be able to benefit from the dewar reimbursement.
Click if you agree with these conditions and you want to have this dewar automatically reimbursed.', + boxLabel : 'Click if you agree with these conditions and you want to have this parcel automatically reimbursed.', hideLabel:true, labelWidth : 500, name : 'isReimbursed', diff --git a/js/core/widget/parcelpanel.js b/js/core/widget/parcelpanel.js index 422eeab1f..8792cb115 100644 --- a/js/core/widget/parcelpanel.js +++ b/js/core/widget/parcelpanel.js @@ -22,7 +22,7 @@ function ParcelPanel(args) { this.containersPanel = null; this.currentTab = "content"; - this.displayReimbButton = false; + this.maxReimb = 0; this.isSaveButtonHidden = false; this.isHidden = false; @@ -49,9 +49,6 @@ function ParcelPanel(args) { if (args.currentTab != null) { this.currentTab = args.currentTab; } - if (args.displayReimbButton != null) { - this.displayReimbButton = args.displayReimbButton; - } } this.onSavedClick = new Event(this); @@ -68,6 +65,7 @@ ParcelPanel.prototype.load = function(dewar, shipment, samples, withoutCollectio if (shipment){ if (shipment.sessions.length > 0){ this.dewar.beamlineName = shipment.sessions[0].beamlineName; + this.maxReimb = shipment.sessions[0].nbReimbDewars; } } this.samples = samples; @@ -94,7 +92,7 @@ ParcelPanel.prototype.load = function(dewar, shipment, samples, withoutCollectio _this.showCaseForm(); }); //debugger - if (this.displayReimbButton) { + if (this.maxReimb > 0) { $("#" + this.id + "-euro-button").removeClass("disabled"); $("#" + this.id + "-euro-button").click(function () { _this.showReimbForm(); From 2e7e075537e9b721f8914a051ef74bc0efcc8b2e Mon Sep 17 00:00:00 2001 From: Olof Svensson Date: Tue, 20 Mar 2018 13:55:56 +0100 Subject: [PATCH 17/18] Issue #373 : Fix for missing H3 and H32 space groups and wrong order --- mx/config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mx/config.js b/mx/config.js index 0c1a435e8..052bfdbd5 100644 --- a/mx/config.js +++ b/mx/config.js @@ -2,7 +2,7 @@ var ExtISPyB ={ version : 'alpha-u3', release_date : '2017/03/01', - spaceGroups : ["P1", "P2", "P21", "C2", "P222", "P2221", "P21212", "P212121", "C222", "C2221", "F222", "I222", "I212121", "P4", "P41", "P42", "P43", "P422", "P4212", "P4122", "P41212", "P4222", "P42212", "P4322", "P43212", "I4", "I41", "I422", "I4122", "P3", "P31", "P32", "P31", "P321", "P3112", "P3121", "P3212", "P3221", "P6", "P61", "P65", "P62", "P64", "P63", "P622", "P6122", "P6522", "P6222", "P6422", "P6322", "R3", "R32", "P23", "P213", "P432", "P4232", "P4332", "P4132", "F23", "F432", "F4132", "I23", "I213", "I432", "I4132"], + spaceGroups : ["P1", "P2", "P21", "C2", "P222", "P2221", "P21212", "P212121", "C2221", "C222", "F222", "I222", "I212121", "P4", "P41", "P42", "P43", "I4", "I41", "P422", "P4212", "P4122", "P41212", "P4222", "P42212", "P4322", "P43212", "I422", "I4122", "P3", "P31", "P32", "H3", "R3", "P312", "P321", "P3112", "P3121", "P3212", "P3221", "H32", "R32", "P6", "P61", "P65", "P62", "P64", "P63", "P622", "P6122", "P6522", "P6222", "P6422", "P6322", "P23", "F23", "I23", "P213", "I213", "P432", "P4232", "F432", "F4132", "I432", "P4332", "P4132", "I4132"], sites:[ From 315a564a6ae339abdda5b1deeabe7ec480483e8b Mon Sep 17 00:00:00 2001 From: Olof Svensson Date: Thu, 22 Mar 2018 16:56:22 +0100 Subject: [PATCH 18/18] Issue #375 : Changed all dropdown lists to be 'autocomplete' and use filter --- js/core/view/shipping/containerspreadsheet.js | 14 +++++++++----- js/core/view/shipping/csvcontainerspreadsheet.js | 12 ++++++++---- .../view/shipping/genericcontainerspreadsheet.js | 3 ++- .../containerspreparepreadsheet.js | 3 ++- 4 files changed, 21 insertions(+), 11 deletions(-) diff --git a/js/core/view/shipping/containerspreadsheet.js b/js/core/view/shipping/containerspreadsheet.js index 25abf790d..99deaab65 100644 --- a/js/core/view/shipping/containerspreadsheet.js +++ b/js/core/view/shipping/containerspreadsheet.js @@ -221,14 +221,16 @@ ContainerSpreadSheet.prototype.getHeader = function() { { text : '#', id: 'position', column : {width : 20}}, { text :'Protein
Acronym', id :'Protein Acronym', column : { width : 80, - type: 'dropdown', + type: 'autocomplete', + filter: 'true', source: this.getAcronyms() } }, { text :'Sample
Name', id :'Sample Name', column : {width : 120}}, { text :'Crystal Form', id : 'Crystal Form',column : { width : 230, - type: 'dropdown', + type: 'autocomplete', + filter: 'true', source: function(query, process) { var colIndex = _this.getColumnIndex("Protein Acronym"); var protein = EXI.proposalManager.getProteinByAcronym(this.instance.getDataAtCell(this.row,colIndex)); @@ -243,7 +245,8 @@ ContainerSpreadSheet.prototype.getHeader = function() { }, { text :'Exp.
Type', id : 'Experiment Type', column : { width : 100, - type: 'dropdown', + type: 'autocomplete', + filter: 'true', source: [ "Default", "MXPressE", "MXPressO", "MXPressI", "MXPressE_SAD", "MXScore", "MXPressM", "MXPressP", "MXPressP_SAD" ] } }, @@ -257,9 +260,10 @@ ContainerSpreadSheet.prototype.getHeader = function() { { text :'Required
multiplicity', id :'Required multiplicity', column : {width : 60}}, { text :'Required
Completeness', id :'Required Completeness', column : {width : 80}}, - { text :'Forced
Space G.', id : 'Space Group', column : { + { text :'Forced
Space G.', id : 'Space Group', column : { width : 55, - type: 'dropdown', + type: 'autocomplete', + filter: 'true', source: _.concat([""], ExtISPyB.spaceGroups) } }, diff --git a/js/core/view/shipping/csvcontainerspreadsheet.js b/js/core/view/shipping/csvcontainerspreadsheet.js index 02bf60232..e2c61a952 100644 --- a/js/core/view/shipping/csvcontainerspreadsheet.js +++ b/js/core/view/shipping/csvcontainerspreadsheet.js @@ -585,7 +585,8 @@ CSVContainerSpreadSheet.prototype.getHeader = function() { { text : '#', id: 'position', column : {width : 20, renderer: samplePositionParameterRenderer}}, { text :'Protein
Acronym', id :'Protein Acronym', column : { width : 80, - type: 'dropdown', + type: 'autocomplete', + filter: 'true', renderer: proteinParameterRenderer, source: this.getAcronyms() } @@ -599,7 +600,8 @@ CSVContainerSpreadSheet.prototype.getHeader = function() { { text :'Exp.
Type', id : 'experimentKind', column : { width : 100, - type: 'dropdown', + type: 'autocomplete', + filter: 'true', renderer: mandatoryParameterRenderer, source: [ "Default", "MXPressE", "MXPressO", "MXPressI", "MXPressE_SAD", "MXScore", "MXPressM", "MXPressP", "MXPressP_SAD" ] } @@ -607,7 +609,8 @@ CSVContainerSpreadSheet.prototype.getHeader = function() { { text :'Space
group', id : 'Space Group', column : { width : 70, - type: 'dropdown', + type: 'autocomplete', + filter: 'true', renderer: mandatoryParameterRenderer, source: _.concat([""], ExtISPyB.spaceGroups) }}, @@ -625,7 +628,8 @@ CSVContainerSpreadSheet.prototype.getHeader = function() { { text :'Required
Completeness', id :'Required Completeness', column : {width : 80}}, { text :'Forced
SPG', id :'forced', column : { width : 70, - type: 'dropdown', + type: 'autocomplete', + filter: 'true', source: _.concat([""], ExtISPyB.spaceGroups) }}, diff --git a/js/core/view/shipping/genericcontainerspreadsheet.js b/js/core/view/shipping/genericcontainerspreadsheet.js index 96534c271..5c55478ed 100644 --- a/js/core/view/shipping/genericcontainerspreadsheet.js +++ b/js/core/view/shipping/genericcontainerspreadsheet.js @@ -105,7 +105,8 @@ GenericContainerSpreadSheet.prototype.getHeader = function() { header = [{ text : '#', id: 'position', column : {width : 20}}, { text :'Samplesheet
Acronym', id :'Protein Acronym', column : { width : 100, - type: 'dropdown', + type: 'autocomplete', + filter: 'true', source: this.getAcronyms() } }, diff --git a/js/mx/view/prepareexperiment/containerspreparepreadsheet.js b/js/mx/view/prepareexperiment/containerspreparepreadsheet.js index fa766051f..0b18fa912 100644 --- a/js/mx/view/prepareexperiment/containerspreparepreadsheet.js +++ b/js/mx/view/prepareexperiment/containerspreparepreadsheet.js @@ -163,7 +163,8 @@ ContainerPrepareSpreadSheet.prototype.getPanel = function() { header : 'Beamline', dataIndex: 'beamlineName', hidden : true, - type: 'dropdown', + type: 'autocomplete', + filter: 'true', flex: 1, source: EXI.credentialManager.getBeamlineNames() },
Name: {dewar.code}{isSelectedForReimb}{dewar.isReimbursed}{dewar.code}{isSelectedForReimb}
Status: