From 85fce4662580fc0728ce2f987bb7278639fdae4a Mon Sep 17 00:00:00 2001 From: Alejandro De Maria Antolinos Date: Wed, 11 Apr 2018 10:50:27 +0200 Subject: [PATCH] this fixes #391 --- js/core/view/shipping/parcelgrid.js | 3 +- js/core/view/shipping/shipmentform.js | 28 +- templates/core/parcel.grid.template.js | 6 +- .../shipping.form.information.template.js | 276 ++++++++++++------ templates/core/shipping.form.template.js | 9 +- 5 files changed, 204 insertions(+), 118 deletions(-) diff --git a/js/core/view/shipping/parcelgrid.js b/js/core/view/shipping/parcelgrid.js index f8a59338a..092697d59 100644 --- a/js/core/view/shipping/parcelgrid.js +++ b/js/core/view/shipping/parcelgrid.js @@ -133,7 +133,8 @@ ParcelGrid.prototype.load = function(shipment,hasExportedData,samples,withoutCol 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 + "-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(); diff --git a/js/core/view/shipping/shipmentform.js b/js/core/view/shipping/shipmentform.js index 93cb2ee5d..1cadf5859 100644 --- a/js/core/view/shipping/shipmentform.js +++ b/js/core/view/shipping/shipmentform.js @@ -31,20 +31,7 @@ function ShipmentForm(args) { this.refresh = new Event(this); } -ShipmentForm.prototype.getReimbursementContentHTML = function(nbReimbDewars) { - return "According to the A-form for this experiment, you are allowed to have " + nbReimbDewars - + " parcels reimbursed by the ESRF. Please use the Reimburse button to select/unselect the parcels to be reimbursed."; -}; -/* -ShipmentForm.prototype.getReimbursementHTML = function(nbReimbDewars) { - if (nbReimbDewars){ - if (nbReimbDewars > 0){ - return this.getReimbursementContentHTML(currentReimbursedDewars, maxReimbursedDewars); - } - } - return ""; -};*/ ShipmentForm.prototype.load = function(shipment,hasExportedData) { var _this = this; @@ -58,19 +45,22 @@ ShipmentForm.prototype.load = function(shipment,hasExportedData) { var startDate = ""; var reimbText = ""; var fedexCode = ""; - var nbReimbDewars = 0; - + var nbReimbDewars = 0; 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"); - reimbText = this.getReimbursementContentHTML(nbReimbDewars); //"reimbtext"; //this.getReimbursementHTML(nbReimbDewars); - fedexCode = "Your FedEx Reference for this shipment: " + shipment.sessions[0].proposalVO.code + "-" + shipment.sessions[0].proposalVO.number + "/" + beamlineName+ "/" + startDate; + startDate = moment(shipment.sessions[0].startDate).format("DD-MM-YYYY"); + fedexCode = shipment.sessions[0].proposalVO.code + "-" + shipment.sessions[0].proposalVO.number + "/" + beamlineName+ "/" + startDate; } } - dust.render("shipping.form.template", {id : this.id, to : toData, from : fromData, beamlineName : beamlineName, startDate : startDate, shipment : shipment, nbReimbDewars : nbReimbDewars, reimbText : reimbText, fedexCode : fedexCode}, function(err, out){ + dust.render("shipping.form.template", {id : this.id, to : toData, + from : fromData, beamlineName : beamlineName, + startDate : startDate, shipment : shipment, + nbReimbDewars : nbReimbDewars, + reimbText : reimbText, + fedexCode : fedexCode}, function(err, out){ html = out; }); diff --git a/templates/core/parcel.grid.template.js b/templates/core/parcel.grid.template.js index c30443551..63131a635 100644 --- a/templates/core/parcel.grid.template.js +++ b/templates/core/parcel.grid.template.js @@ -18,11 +18,7 @@ Export PDF View
- - - - - + diff --git a/templates/core/shipping.form.information.template.js b/templates/core/shipping.form.information.template.js index d71533344..4f448f0f6 100644 --- a/templates/core/shipping.form.information.template.js +++ b/templates/core/shipping.form.information.template.js @@ -1,101 +1,195 @@
-
- +
+
+ + + + + + + + +
Name{shipment.shippingName}
Beamline{beamlineName}
+
+
+ + + + + + + + + +
Date{startDate}
Status{.shipment.shippingStatus}
+
+
+
+ + +
+
+
+
+ +
+
+
+ +{@gt key=nbReimbDewars value=0} +
+ According to the A-form for this experiment, you are allowed to have {.nbReimbDewars} parcels reimbursed by the ESRF. Please use the Reimburse button to select/unselect the parcels to be reimbursed. +
+ {/gt} + + +
+
+ + + + + + + + + +
From{.shipment.sendingLabContactVO.cardName}
Return address:s + {?shipment.returnLabContactVO} + {shipment.returnLabContactVO.cardName} + {:else} + NO RETURN + {/shipment.returnLabContactVO} +
+
+ +
+ + + + + + + + + +
Courier company{.shipment.returnLabContactVO.defaultCourrierCompany}
Billing Reference{.shipment.returnLabContactVO.billingReference}
+
+ +
+ + + + + + + + + +
Allowed Reimb. parcels{.nbReimbDewars}
Fedex Reference + {?fedexCode} + {.fedexCode} + {/fedexCode} +
+
+ + +
+ + +{! + + + + + + + + + + + + + + + + + + + + + + +
Name:{shipment.shippingName}
Beamline:{.beamlineName}
Date:{.startDate}
Status:{.shipment.shippingStatus}
Reimb. parcels:{.nbReimbDewars}
+ +
+ + +
+
+
+ + +
+
+
+ +
+ +
+
+
+
+ + +
+
+ + +
+
+
+ {?shipment.returnLabContactVO} + - - + - - + + - - + + - - - - - - + + -
Name:{shipment.shippingName}Return details
Beamline:{.beamlineName}Courier company:{shipment.returnLabContactVO.defaultCourrierCompany}
Date:{.startDate}Courier account:{shipment.returnLabContactVO.courierAccount}
Status:{.shipment.shippingStatus}
Reimb. parcels:{.nbReimbDewars}Billing reference:{shipment.returnLabContactVO.billingReference}
-
- -
-
- - -
-
- - -
-
- -
- {?shipment.returnLabContactVO} - - - - - - - - - - - - - - - - -
Return details
Courier company:{shipment.returnLabContactVO.defaultCourrierCompany}
Courier account:{shipment.returnLabContactVO.courierAccount}
Billing reference:{shipment.returnLabContactVO.billingReference}
- {/shipment.returnLabContactVO} -
- - - -
-
- - -
-
- -
- -
-
-
-
- - {.reimbText} - -
-
- - {.fedexCode} - - + + {/shipment.returnLabContactVO} +
+
+ + According to the A-form for this experiment, you are allowed to have {.nbReimbDewars} parcels reimbursed by the ESRF. Please use the Reimburse button to select/unselect the parcels to be reimbursed. + +
+
+ + Your FedEx Reference for this shipment: {.fedexCode} + +
+
+ +!} \ No newline at end of file diff --git a/templates/core/shipping.form.template.js b/templates/core/shipping.form.template.js index 60bf65e9d..d20c1accd 100644 --- a/templates/core/shipping.form.template.js +++ b/templates/core/shipping.form.template.js @@ -1,3 +1,4 @@ +
@@ -10,10 +11,14 @@
- {>"shipping.form.information.template" /} +
+ {>"shipping.form.information.template" /} + +
-
\ No newline at end of file + +