Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions api/src/Page.php
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,11 @@ function argOrNull($key)
return $this->has_arg($key) ? $this->arg($key) : null;
}

function argIfNotEmptyString($key)
{
return $this->has_arg($key) && $this->arg($key) !== '' ? $this->arg($key) : null;
}

# ------------------------------------------------------------------------
# Misc Helpers

Expand Down
10 changes: 7 additions & 3 deletions api/src/Page/Shipment.php
Original file line number Diff line number Diff line change
Expand Up @@ -2607,8 +2607,8 @@ function _add_container()
$tem = $this->has_arg('STORAGETEMPERATURE') ? $this->arg('STORAGETEMPERATURE') : null;

$crid = $this->has_arg('CONTAINERREGISTRYID') ? $this->arg('CONTAINERREGISTRYID') : null;
$pcid = $this->has_arg('PARENTCONTAINERID') ? $this->arg('PARENTCONTAINERID') : null;
$pcl = $this->has_arg('PARENTCONTAINERLOCATION') ? $this->arg('PARENTCONTAINERLOCATION') : null;
$pcid = $this->argIfNotEmptyString('PARENTCONTAINERID');
$pcl = $this->argIfNotEmptyString('PARENTCONTAINERLOCATION');

$pipeline = $this->has_arg('PROCESSINGPIPELINEID') ? $this->arg('PROCESSINGPIPELINEID') : null;
$source = $this->has_arg('SOURCE') ? $this->arg('SOURCE') : null;
Expand Down Expand Up @@ -2640,7 +2640,7 @@ function _add_container()
if ($e->getCode() == 1062) {
$this->_error('Barcode is not unique. Please enter a different barcode.', 409);
} else {
$this->_error('An unexpected error occurred.', 500);
$this->_error('An unexpected error occurred: ' . $e->getMessage(), 500);
}
}
}
Expand Down Expand Up @@ -3451,6 +3451,10 @@ function _create_awb()
&& in_array($this->arg('COUNTRY'), $facility_courier_countries)
&& Utils::getValueOrDefault($use_shipping_service_redirect_incoming_shipments)
) {
if ($ship['EXTERNALSHIPPINGIDTOSYNCHROTRON']) {
$this->_error("Shipping service error: Booking already exists");
return;
}
try {
$this->_create_shipment_shipment_request($ship, $dewars);
$this->_output(array('EXTERNAL' => "1"));
Expand Down
29 changes: 3 additions & 26 deletions client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,6 @@
"d3-scale": "^3.2.3",
"d3-scale-chromatic": "^2.0.0",
"d3-selection": "^2.0.0",
"date-fns": "^2.16.1",
"date-fns-tz": "^1.0.12",
"flot-axislabels": "^1.0.0",
"flot-pie": "^1.0.0",
"font-awesome": "^4.2.0",
Expand Down
10 changes: 9 additions & 1 deletion client/src/js/models/shipment.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,22 @@ define(['backbone'], function (Backbone) {
SHIPPINGNAME: {
required: true,
pattern: 'wwsdash',
msg: 'The Shipment Name is required',
},

'FCODES[]': {
required: false,
pattern: 'fcode',
},

SAFETYLEVEL: {
required: true,
msg: 'The Safety Level field is required',
},

DYNAMIC: {
required: true,
msg: 'The Scheduling field is required',
},

FIRSTEXPERIMENTID: {
Expand Down Expand Up @@ -50,10 +57,11 @@ define(['backbone'], function (Backbone) {

SENDINGLABCONTACTID: {
required: true,
msg: 'The Outgoing Lab Contact field is required',
},

RETURNLABCONTACTID: {
required: true,
required: false,
},

DELIVERYAGENT_AGENTCODE: {
Expand Down
4 changes: 2 additions & 2 deletions client/src/js/modules/imaging/views/imageviewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -1029,11 +1029,11 @@ define(['marionette',
if (options.o.get('DISPENSEX') && options.o.get('DISPENSEY')) {
var disx = parseInt(options.o.get('DISPENSEX'))
var disy = parseInt(options.o.get('DISPENSEY'))
this.ctx.strokeStyle = 'white'
this.ctx.strokeStyle = 'deeppink'
this.ctx.beginPath()
this.ctx.arc(disx, disy, 50, 0, 2*Math.PI)
this.ctx.stroke()
this.ctx.fillStyle = 'white'
this.ctx.fillStyle = 'deeppink'
this.ctx.fillText('D',disx-5*m, disy+5*m)
this.ctx.closePath()
}
Expand Down
5 changes: 2 additions & 3 deletions client/src/js/modules/shipment/views/container.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ define(['marionette',
'views/table',

'utils',
'formatDate',
'utils/editable',
'templates/shipment/container.html'], function(Marionette,
Backbone,
Expand All @@ -40,7 +39,7 @@ define(['marionette',

TableView,

utils, formatDate,
utils,
Editable, template){

return Marionette.LayoutView.extend({
Expand Down Expand Up @@ -186,7 +185,7 @@ define(['marionette',
app.alert({ message: 'Container Successfully Queued' })
self.model.set({
CONTAINERQUEUEID: resp.CONTAINERQUEUEID,
QUEUEDTIMESTAMP: formatDate.default(new Date(), 'dd-MM-yyyy HH:mm')
QUEUEDTIMESTAMP: new Date().toLocaleString()
})
self.updateAutoCollection()
self.sampletable.toggleAuto(true)
Expand Down
14 changes: 10 additions & 4 deletions client/src/js/modules/shipment/views/createawb.js
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,14 @@ define(['backbone',
return
}

const ss_url = app.options.get("shipping_service_app_url_incoming")
const externalid = this.shipment.get('EXTERNALSHIPPINGIDTOSYNCHROTRON')
if (externalid && ss_url) {
const link = ss_url+'/shipment-requests/'+externalid+'/incoming'
window.location.assign(link)
return
}

var prod = null
if (
(
Expand Down Expand Up @@ -510,7 +518,7 @@ define(['backbone',
},
success: function(resp) {
if (
app.options.get("shipping_service_app_url_incoming")
ss_url
&& (Number(self.terms.get('ACCEPTED')) === 1) // terms.ACCEPTED could be undefined, 1, or "1"
&& app.options.get("facility_courier_countries").includes(country)
) {
Expand All @@ -521,9 +529,7 @@ define(['backbone',
app.alert({message: "Error performing redirect: external shipping id is null"})
return;
}
window.location.assign(
`${app.options.get("shipping_service_app_url")}/shipment-requests/${external_id}/incoming`
)
window.location.assign(`${ss_url}/shipment-requests/${external_id}/incoming`)
})
} else {
app.message({ message: 'Air Waybill Successfully Created'})
Expand Down
5 changes: 2 additions & 3 deletions client/src/js/modules/shipment/views/dewarregistry.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@ define(['marionette', 'backgrid',
'views/form',
'views/filter',
'views/table', 'utils/table',
'formatDate',
'templates/shipment/dewarregistryadd.html',
'templates/shipment/dewarregistry.html'],
function(Marionette, Backgrid, DewarRegistry, DewarProposal,
Proposals, LabContacts,
FormView, FilterView,
TableView, table, formatDate, addtemplate, template) {
TableView, table, addtemplate, template) {

var ClickableRow = table.ClickableRow.extend({
event: 'rdewar:show',
Expand Down Expand Up @@ -49,7 +48,7 @@ define(['marionette', 'backgrid',
this.ui.fc.val('')
this.ui.date.val('')
this.ui.serial.val('')
this.model.set({ DEWARS: 0, REPORTS: 0, BLTIMESTAMP: formatDate.default(new Date(), 'yyyy-MM-dd HH:mm:ss') })
this.model.set({ DEWARS: 0, REPORTS: 0, BLTIMESTAMP: new Date().toLocaleString('sv-SE') })
this.trigger('model:saved', this.model)
this.setupValidation()
},
Expand Down
39 changes: 27 additions & 12 deletions client/src/js/modules/shipment/views/shipment.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ define(['marionette',
'click #add_dewar': 'addDewar',
'click a.send': 'sendShipment',
'click a.pdf': utils.signHandler,
'click a.labels': 'printLabels',
'click a.awb': 'createAWB',
'click a.cancel_pickup': 'cancelPickup',
'click a.ready': 'markAsReady',
},
Expand All @@ -61,7 +63,6 @@ define(['marionette',
sent: '.sent',
booking: '.booking',
dhlmessage: '.dhlmessage',
buttons: '.buttons',
},


Expand Down Expand Up @@ -102,13 +103,31 @@ define(['marionette',
})
},

printLabels: function(e) {
e.preventDefault()
const errors = this.model.validate(this.model.attributes)
if (errors) {
app.alert({ message: 'Cannot print labels: ' + Object.values(errors)[0] })
} else {
utils.signHandler(e)
}
},

createAWB: function(e) {
const errors = this.model.validate(this.model.attributes)
if (errors) {
e.preventDefault()
app.alert({ message: 'Cannot create air waybill: ' + Object.values(errors)[0] })
}
},

sendShipment: function(e) {
e.preventDefault()
var self = this
Backbone.ajax({
url: app.apiurl+'/shipment/send/'+this.model.get('SHIPPINGID'),
success: function() {
self.model.set({ SHIPPINGSTATUS: 'send to DLS' })
self.model.set({ SHIPPINGSTATUS: 'sent to facility' })
app.alert({ className: 'message notify', message: 'Shipment successfully marked as sent' })
self.render()
},
Expand Down Expand Up @@ -209,11 +228,6 @@ define(['marionette',
},

showButtons: function() {
if (this.model.get('LCOUT') && this.model.get('SAFETYLEVEL')) {
this.ui.buttons.show()
} else {
this.ui.buttons.hide()
}
const status = this.model.get('SHIPPINGSTATUS')
const proc = this.model.get('PROCESSING')
if ((status === 'opened' || status === 'awb created' || status === 'pickup booked') && proc == 0) {
Expand Down Expand Up @@ -242,7 +256,7 @@ define(['marionette',
this.ui.booking.html('<a class="button" href="#"><i class="fa fa-credit-card"></i> Create Air Waybill - Disabled</a>')
} else if (externalid && ss_url) {
const link = ss_url+'/shipment-requests/'+externalid+'/incoming'
this.ui.booking.html('<a class="button shipping-service" href="'+link+'"><i class="fa fa-print"></i> Manage shipment booking</a>')
this.ui.booking.html('<a class="button shipping-service" href="'+link+'"><i class="fa fa-print"></i> Manage Shipment Booking</a>')
} else {
this.ui.booking.html('<a class="button awb" href="/shipments/awb/sid/'+shippingid+'"><i class="fa fa-credit-card"></i> Create DHL Air Waybill</a>')
}
Expand All @@ -257,13 +271,12 @@ define(['marionette',
const safetylevel = this.model.get('SAFETYLEVEL')
const country = this.model.get('COUNTRY')
const courier = this.model.get('DELIVERYAGENT_AGENTNAME')
const lcout = this.model.get('LCOUT')
const fac_country_nde = app.options.get('facility_courier_countries_nde')
const fac_country_link = app.options.get('facility_courier_countries_link')
const fac_country = app.options.get('facility_courier_countries')
if (!lcout || !safetylevel) {
this.ui.dhlmessage.html('<p class="message notify">Set an Outgoing Lab Contact and Safety Level in order to manage shipping.</p>')
} else if (label == '1') {
const ss_url = app.options.get("shipping_service_app_url_incoming")
const externalid = this.model.get('EXTERNALSHIPPINGIDTOSYNCHROTRON')
if (label == '1') {
this.ui.dhlmessage.html('<p class="message notify">You can print your Air Waybill by clicking &quot;Print Air Waybill&quot; below.</p>')
} else if (safetylevel && safetylevel == "Red") {
this.ui.dhlmessage.html('<p class="message alert">Shipping of red samples is not available through this application.</p>')
Expand All @@ -273,6 +286,8 @@ define(['marionette',
this.ui.dhlmessage.html('<p class="message alert">International shipping is not available through this application. If you&apos;re arranging your own shipping, enter your tracking numbers below after booking and include printed return labels in the dewar case.</p>')
} else if (courier && courier.toLowerCase().trim() != 'dhl') {
this.ui.dhlmessage.html('<p class="message alert">Shipping through this application is only available using DHL.</p>')
} else if (externalid && ss_url) {
this.ui.dhlmessage.html('<p class="message notify">You can now manage your shipment with DHL using &quot;Manage Shipment Booking&quot; below.</p>')
} else {
this.ui.dhlmessage.html('<p class="message notify">You can now book your shipment with DHL using &quot;Create Air Waybill&quot; below.</p>')
}
Expand Down
7 changes: 3 additions & 4 deletions client/src/js/modules/stats/views/breakdown.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
define(['marionette', 'templates/stats/breakdown.html',
'utils',
'formatDate',
'jquery',
'jquery.flot',
'jquery.flot.time',
'jquery.flot.selection',
'jquery.flot.tooltip',
], function(Marionette, template, utils, formatDate, $) {
], function(Marionette, template, utils, $) {

return Marionette.ItemView.extend({
template: template,
Expand Down Expand Up @@ -101,8 +100,8 @@ define(['marionette', 'templates/stats/breakdown.html',
if (this.hideOverview) return
var opts = this.main.getOptions()

var from = formatDate.default(opts.xaxes[0].min, 'MMMM do yyyy')
var to = formatDate.default(opts.xaxes[0].max, 'MMMM do yyyy')
var from = new Date(opts.xaxes[0].min).toLocaleDateString();
var to = new Date(opts.xaxes[0].max).toLocaleDateString();

if (from != to) this.ui.span.text(from+' - '+to)
else this.ui.span.text(from)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -751,8 +751,8 @@ export default {
this.NAME = ''
this.BARCODE = ''
this.CONTAINERREGISTRYID = ''
this.PARENTCONTAINERID = ''
this.PARENTCONTAINERLOCATION = ''
this.PARENTCONTAINERID = null
this.PARENTCONTAINERLOCATION = null
// Trigger default setting of UDC fields if selected
this.selectQueueForUDC(this.AUTOMATED)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,6 @@
</template>

<script>
import formatDate from 'date-fns-tz/format'
import { ValidationObserver, ValidationProvider } from 'vee-validate'

import ContainerHistory from 'modules/shipment/collections/containerhistory'
Expand Down Expand Up @@ -546,7 +545,7 @@ export default {
const response = await this.toggleContainerQueue(true, this.containerId)
this.$emit('update-container-state', {
CONTAINERQUEUEID: response.get('CONTAINERQUEUEID'),
QUEUEDTIMESTAMP: formatDate(new Date(), 'dd-MM-yyyy HH:mm')
QUEUEDTIMESTAMP: new Date().toLocaleString()
})
this.$nextTick(() => {
this.loadContainerData()
Expand Down
Loading
Loading