Skip to content

Commit

Permalink
Merge pull request #392 from antolinos/issue_391
Browse files Browse the repository at this point in the history
this fixes #391
  • Loading branch information
antolinos authored Apr 11, 2018
2 parents 04f3a94 + 85fce46 commit 517d8a7
Show file tree
Hide file tree
Showing 5 changed files with 204 additions and 118 deletions.
3 changes: 2 additions & 1 deletion js/core/view/shipping/parcelgrid.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
28 changes: 9 additions & 19 deletions js/core/view/shipping/shipmentform.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
});

Expand Down
6 changes: 1 addition & 5 deletions templates/core/parcel.grid.template.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,7 @@
<span class="glyphicon glyphicon-export"></span> Export PDF View
</button>
<br>
<span id="{id}-label2" style='font-size:12px;' >

</span>


<span id="{id}-label2" style='font-size:12px;' > </span>
</div>


Expand Down
276 changes: 185 additions & 91 deletions templates/core/shipping.form.information.template.js
Original file line number Diff line number Diff line change
@@ -1,101 +1,195 @@
<div class="form-group row" style="margin:0px">
<div class="col-md-2" style="padding:0px">
<table class="table small-padding-rows borderless" style="margin:0px">
<div class="col-md-2" style="padding:0px">
<table class="table">
<tr>
<td>Name</td>
<td class='column_parameter_value'>{shipment.shippingName}</td>
</tr>
<tr>
<td>Beamline</td>
<td class='column_parameter_value'>{beamlineName}</td>
</tr>
</table>
</div>
<div class="col-md-2" style="margin-left:10px">
<table class="table">
<tr>
<td>Date</td>
<td class='column_parameter_value'>{startDate}</td>
</tr>
<tr>
<td>Status</td>
<td class='column_parameter_value'><kbd style='background-color:#207a7a;'>{.shipment.shippingStatus}</kbd></td>
</tr>
</table>
</div>
<div class="col-md-5" style="margin-left:10px">
<div class="form-group row" style="margin:5px">
<label class="col-md-3 col-form-label " ><b>Comments:</b></label>
<textarea class="col-md-9" rows="2" disabled>{shipment.comments}</textarea >
</div>
</div>
<div class="col-md-1" style="padding:0px">
<div class="form-group row" style="margin:5px">
<button id="{id}-edit-button" class="btn btn-primary btn-md" style="margin-left:10px;height:40px;" disabled>Edit</button>
</div>
</div>
</div>

{@gt key=nbReimbDewars value=0}
<div class="alert alert-warning">
According to the A-form for this experiment, you are allowed to have <strong> {.nbReimbDewars} parcels reimbursed by the ESRF</strong>. Please use the Reimburse button to select/unselect the parcels to be reimbursed.
</div>
{/gt}


<div class="form-group row" style="margin:0px">
<div class="col-md-2" style="margin-left:10px">
<table class="table">
<tr>
<td>From</td>
<td class='column_parameter_value'>{.shipment.sendingLabContactVO.cardName}</td>
</tr>
<tr>
<td>Return address:s</td>
<td class='column_parameter_value'>
{?shipment.returnLabContactVO}
{shipment.returnLabContactVO.cardName}
{:else}
NO RETURN
{/shipment.returnLabContactVO}
</td>
</tr>
</table>
</div>

<div class="col-md-2" style="margin-left:10px">
<table class="table">
<tr>
<td>Courier company</td>
<td class='column_parameter_value'>{.shipment.returnLabContactVO.defaultCourrierCompany}</td>
</tr>
<tr>
<td>Billing Reference</td>
<td class='column_parameter_value'>{.shipment.returnLabContactVO.billingReference}</td>
</tr>
</table>
</div>

<div class="col-md-3" style="margin-left:10px">
<table class="table">
<tr>
<td>Allowed Reimb. parcels</td>
<td class='column_parameter_value'>{.nbReimbDewars}</td>
</tr>
<tr>
<td>Fedex Reference</td>
<td class='column_parameter_value'>
{?fedexCode}
<kbd style="background-color:#207a7a;">{.fedexCode}</kbd>
{/fedexCode}
</td>
</tr>
</table>
</div>


</div>


{!

<table class="table small-padding-rows borderless" style="margin:0px">
<tr>
<td class='column_parameter_value'>Name:</td>
<td>{shipment.shippingName}</td>
</tr>
<tr>
<td class='column_parameter_value'>Beamline:</td>
<td>{.beamlineName}</td>
</tr>
<tr>
<td class='column_parameter_value'>Date:</td>
<td>{.startDate}</td>
</tr>
<tr>
<td class='column_parameter_value'>Status:</td>
<td><kbd style='background-color:#207a7a;'>{.shipment.shippingStatus}</kbd></td>
</tr>
<tr>
<td class='column_parameter_value'>Reimb. parcels:</td>
<td>{.nbReimbDewars}</td>
</tr>
</table>
</div>
<div class="col-md-2" style="padding:0px">
<div class="form-group row" style="margin:5px">
<a id="{id}-send-button" class="btn btn-md enabled">
<span class="glyphicon glyphicon-plane"></span> Send shipment to ESRF
</a>
</div>

</div>
<div class="col-md-3" style="padding:0px">
<div class="form-group row" style="margin:5px">
<label class="col-md-3 col-form-label " ><b>Comments:</b></label>
<textarea class="col-md-9" rows="4" disabled>{shipment.comments}</textarea >
</div>
</div>
<div class="col-md-1 pull-right" style="padding:0px">
<button id="{id}-edit-button" class="btn btn-primary btn-lg" style="margin-left:10px;height:90px;" disabled>Edit</button>
</div>
</div>
<div class="panel panel-default">
<div class="panel-body">
<div class="col-md-2" style="padding:0px">
<div class="form-group row" style="margin:5px">
<label class="col-md-3 col-form-label" ><b>From:</b></label>
<label class="col-md-9" style="font-weight: normal">{shipment.sendingLabContactVO.cardName}</label>
</div>
<div class="form-group row" style="margin:5px">
<label class="col-md-3 col-form-label" ><b>Return address:</b></label>
<label class="col-md-9" style="font-weight: normal">
{?shipment.returnLabContactVO}
{shipment.returnLabContactVO.cardName}
{:else}
NO RETURN
{/shipment.returnLabContactVO}
</label>
</div>
</div>
<div class="col-md-2" style="padding:0px">
{?shipment.returnLabContactVO}
<table class="table small-padding-rows borderless" style="margin:0px">
<tr>
<td class='column_parameter_value'>Name:</td>
<td>{shipment.shippingName}</td>
<td colspan="2" class='column_parameter_value'>Return details</td>
</tr>
<tr>
<td class='column_parameter_value'>Beamline:</td>
<td>{.beamlineName}</td>
<td class='column_parameter_value'>Courier company:</td>
<td>{shipment.returnLabContactVO.defaultCourrierCompany}</td>
</tr>
<tr>
<td class='column_parameter_value'>Date:</td>
<td>{.startDate}</td>
<td class='column_parameter_value'>Courier account:</td>
<td>{shipment.returnLabContactVO.courierAccount}</td>
</tr>
<tr>
<td class='column_parameter_value'>Status:</td>
<td><kbd style='background-color:#207a7a;'>{.shipment.shippingStatus}</kbd></td>
</tr>
<tr>
<td class='column_parameter_value'>Reimb. parcels:</td>
<td>{.nbReimbDewars}</td>
<td class='column_parameter_value'>Billing reference:</td>
<td>{shipment.returnLabContactVO.billingReference}</td>
</tr>
</table>
</div>

<div class="col-md-2" style="padding:0px">
<div class="form-group row" style="margin:5px">
<label class="col-md-3 col-form-label" ><b>From:</b></label>
<label class="col-md-9" style="font-weight: normal">{shipment.sendingLabContactVO.cardName}</label>
</div>
<div class="form-group row" style="margin:5px">
<label class="col-md-3 col-form-label" ><b>Return address:</b></label>
<label class="col-md-9" style="font-weight: normal">{?shipment.returnLabContactVO}
{shipment.returnLabContactVO.cardName}
{:else}
NO RETURN
{/shipment.returnLabContactVO}
</label>
</div>
</div>

<div class="col-md-2" style="padding:0px">
{?shipment.returnLabContactVO}
<table class="table small-padding-rows borderless" style="margin:0px">
<tr>
<td colspan="2" class='column_parameter_value'>Return details</td>
</tr>
<tr>
<td class='column_parameter_value'>Courier company:</td>
<td>{shipment.returnLabContactVO.defaultCourrierCompany}</td>
</tr>
<tr>
<td class='column_parameter_value'>Courier account:</td>
<td>{shipment.returnLabContactVO.courierAccount}</td>
</tr>
<tr>
<td class='column_parameter_value'>Billing reference:</td>
<td>{shipment.returnLabContactVO.billingReference}</td>
</tr>
</table>
{/shipment.returnLabContactVO}
</div>

<div class="col-md-2" style="padding:0px">
<div class="form-group row" style="margin:5px">
<a id="{id}-send-button" class="btn btn-md enabled">
<span class="glyphicon glyphicon-plane"></span> Send shipment to ESRF
</a>
</div>
{!<div class="form-group row" style="margin:5px">
<a id="{id}-remove-button" class="btn btn-md disabled">
<span class="glyphicon glyphicon-remove" style="color:red"></span> Remove shipment
</a>
</div>
!}
</div>

<div class="col-md-3" style="padding:0px">
<div class="form-group row" style="margin:5px">
<label class="col-md-3 col-form-label " ><b>Comments:</b></label>
<textarea class="col-md-9" rows="4" disabled>{shipment.comments}</textarea >
</div>
</div>

<div class="col-md-1 pull-right" style="padding:0px">
<button id="{id}-edit-button" class="btn btn-primary btn-lg" style="margin-left:10px;height:90px;" disabled>Edit</button>
</div>
</div>
<br>
<div class="form-group row" style="margin:0px">
<span style='font-size:12px; color:red' >
{.reimbText}
</span >
</div>
<div class="form-group row" style="margin:0px">
<span style='font-size:12px; color:black' >
{.fedexCode}
</span >

</table>
{/shipment.returnLabContactVO}
</div>
<div class="form-group row" style="margin:0px">
<span style='font-size:12px; color:red' >
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.
</span >
</div>
<div class="form-group row" style="margin:0px">
<span style='font-size:12px; color:black' >
Your FedEx Reference for this shipment: <kbd style="background-color:#207a7a;">{.fedexCode}</kbd>
</span >
</div>
</div>
</div>

!}
9 changes: 7 additions & 2 deletions templates/core/shipping.form.template.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

<div class="container-fluid" style="padding-left: 0px;padding-right: 0px;">
<div class="panel with-nav-tabs panel-default" style="margin-bottom: 0px;">
<div class="panel-heading clearfix">
Expand All @@ -10,10 +11,14 @@
</div>
<div class="tab-content">
<div id="information-{id}" class="tab-pane fade in active" style="padding:10px;">
{>"shipping.form.information.template" /}
<div class="container-fluid">
{>"shipping.form.information.template" /}

</div>
</div>
<div id="transport-history-{id}" class="tab-pane fade" style="padding:10px;">
</div>
</div>
</div>
</div>
</div>

0 comments on commit 517d8a7

Please sign in to comment.