@@ -49,6 +49,8 @@ define(['marionette',
4949 'click #add_dewar' : 'addDewar' ,
5050 'click a.send' : 'sendShipment' ,
5151 'click a.pdf' : utils . signHandler ,
52+ 'click a.labels' : 'printLabels' ,
53+ 'click a.awb' : 'createAWB' ,
5254 'click a.cancel_pickup' : 'cancelPickup' ,
5355 'click a.ready' : 'markAsReady' ,
5456 } ,
@@ -61,7 +63,6 @@ define(['marionette',
6163 sent : '.sent' ,
6264 booking : '.booking' ,
6365 dhlmessage : '.dhlmessage' ,
64- buttons : '.buttons' ,
6566 } ,
6667
6768
@@ -102,13 +103,31 @@ define(['marionette',
102103 } )
103104 } ,
104105
106+ printLabels : function ( e ) {
107+ e . preventDefault ( )
108+ const errors = this . model . validate ( this . model . attributes )
109+ if ( errors ) {
110+ app . alert ( { message : 'Cannot print labels: ' + Object . values ( errors ) [ 0 ] } )
111+ } else {
112+ utils . signHandler ( e )
113+ }
114+ } ,
115+
116+ createAWB : function ( e ) {
117+ const errors = this . model . validate ( this . model . attributes )
118+ if ( errors ) {
119+ e . preventDefault ( )
120+ app . alert ( { message : 'Cannot create air waybill: ' + Object . values ( errors ) [ 0 ] } )
121+ }
122+ } ,
123+
105124 sendShipment : function ( e ) {
106125 e . preventDefault ( )
107126 var self = this
108127 Backbone . ajax ( {
109128 url : app . apiurl + '/shipment/send/' + this . model . get ( 'SHIPPINGID' ) ,
110129 success : function ( ) {
111- self . model . set ( { SHIPPINGSTATUS : 'send to DLS ' } )
130+ self . model . set ( { SHIPPINGSTATUS : 'sent to facility ' } )
112131 app . alert ( { className : 'message notify' , message : 'Shipment successfully marked as sent' } )
113132 self . render ( )
114133 } ,
@@ -209,11 +228,6 @@ define(['marionette',
209228 } ,
210229
211230 showButtons : function ( ) {
212- if ( this . model . get ( 'LCOUT' ) && this . model . get ( 'SAFETYLEVEL' ) ) {
213- this . ui . buttons . show ( )
214- } else {
215- this . ui . buttons . hide ( )
216- }
217231 const status = this . model . get ( 'SHIPPINGSTATUS' )
218232 const proc = this . model . get ( 'PROCESSING' )
219233 if ( ( status === 'opened' || status === 'awb created' || status === 'pickup booked' ) && proc == 0 ) {
@@ -242,7 +256,7 @@ define(['marionette',
242256 this . ui . booking . html ( '<a class="button" href="#"><i class="fa fa-credit-card"></i> Create Air Waybill - Disabled</a>' )
243257 } else if ( externalid && ss_url ) {
244258 const link = ss_url + '/shipment-requests/' + externalid + '/incoming'
245- this . ui . booking . html ( '<a class="button shipping-service" href="' + link + '"><i class="fa fa-print"></i> Manage shipment booking </a>' )
259+ this . ui . booking . html ( '<a class="button shipping-service" href="' + link + '"><i class="fa fa-print"></i> Manage Shipment Booking </a>' )
246260 } else {
247261 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>' )
248262 }
@@ -257,13 +271,12 @@ define(['marionette',
257271 const safetylevel = this . model . get ( 'SAFETYLEVEL' )
258272 const country = this . model . get ( 'COUNTRY' )
259273 const courier = this . model . get ( 'DELIVERYAGENT_AGENTNAME' )
260- const lcout = this . model . get ( 'LCOUT' )
261274 const fac_country_nde = app . options . get ( 'facility_courier_countries_nde' )
262275 const fac_country_link = app . options . get ( 'facility_courier_countries_link' )
263276 const fac_country = app . options . get ( 'facility_courier_countries' )
264- if ( ! lcout || ! safetylevel ) {
265- this . ui . dhlmessage . html ( '<p class="message notify">Set an Outgoing Lab Contact and Safety Level in order to manage shipping.</p> ')
266- } else if ( label == '1' ) {
277+ const ss_url = app . options . get ( "shipping_service_app_url_incoming" )
278+ const externalid = this . model . get ( 'EXTERNALSHIPPINGIDTOSYNCHROTRON ')
279+ if ( label == '1' ) {
267280 this . ui . dhlmessage . html ( '<p class="message notify">You can print your Air Waybill by clicking "Print Air Waybill" below.</p>' )
268281 } else if ( safetylevel && safetylevel == "Red" ) {
269282 this . ui . dhlmessage . html ( '<p class="message alert">Shipping of red samples is not available through this application.</p>' )
@@ -273,6 +286,8 @@ define(['marionette',
273286 this . ui . dhlmessage . html ( '<p class="message alert">International shipping is not available through this application. If you're arranging your own shipping, enter your tracking numbers below after booking and include printed return labels in the dewar case.</p>' )
274287 } else if ( courier && courier . toLowerCase ( ) . trim ( ) != 'dhl' ) {
275288 this . ui . dhlmessage . html ( '<p class="message alert">Shipping through this application is only available using DHL.</p>' )
289+ } else if ( externalid && ss_url ) {
290+ this . ui . dhlmessage . html ( '<p class="message notify">You can now manage your shipment with DHL using "Manage Shipment Booking" below.</p>' )
276291 } else {
277292 this . ui . dhlmessage . html ( '<p class="message notify">You can now book your shipment with DHL using "Create Air Waybill" below.</p>' )
278293 }
0 commit comments