Skip to content

Commit

Permalink
LIMS-1066: Autofill UDC visit on dispatch form
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Williams committed Dec 13, 2024
1 parent 0904d6d commit 4ec31e1
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
24 changes: 18 additions & 6 deletions api/src/Page/Shipment.php
Original file line number Diff line number Diff line change
Expand Up @@ -1626,12 +1626,24 @@ function _get_dewars()
$order = $cols[$this->arg('sort_by')] . ' ' . $dir;
}

$dewars = $this->db->paginate("SELECT CONCAT(p.proposalcode, p.proposalnumber) as prop, CONCAT(p.proposalcode, p.proposalnumber, '-', se.visit_number) as firstexperiment, r.labcontactid, se.beamlineoperator as localcontact, se.beamlinename, TO_CHAR(se.startdate, 'HH24:MI DD-MM-YYYY') as firstexperimentst, d.firstexperimentid, s.shippingid, s.shippingname, d.facilitycode, count(c.containerid) as ccount, (case when se.visit_number > 0 then (CONCAT(p.proposalcode, p.proposalnumber, '-', se.visit_number)) else '' end) as exp, d.code, d.barcode, d.storagelocation, d.dewarstatus, d.dewarid, d.trackingnumbertosynchrotron, d.trackingnumberfromsynchrotron, d.externalShippingIdFromSynchrotron, s.deliveryagent_agentname, d.weight, d.deliveryagent_barcode, GROUP_CONCAT(c.code SEPARATOR ', ') as containers, s.sendinglabcontactid, s.returnlabcontactid, pe.givenname, pe.familyname, s.safetylevel as shippingsafetylevel
FROM dewar d
LEFT OUTER JOIN container c ON c.dewarid = d.dewarid
INNER JOIN shipping s ON d.shippingid = s.shippingid
INNER JOIN proposal p ON p.proposalid = s.proposalid
LEFT OUTER JOIN blsession se ON d.firstexperimentid = se.sessionid
$dewars = $this->db->paginate("SELECT
CONCAT(p.proposalcode, p.proposalnumber) as prop,
CONCAT(p.proposalcode, p.proposalnumber, '-', se.visit_number) as firstexperiment,
CONCAT(p.proposalcode, p.proposalnumber, '-', se2.visit_number) as udcfirstexperiment,
r.labcontactid, se.beamlineoperator as localcontact, se.beamlinename,
TO_CHAR(se.startdate, 'HH24:MI DD-MM-YYYY') as firstexperimentst, d.firstexperimentid,
s.shippingid, s.shippingname, d.facilitycode, count(c.containerid) as ccount,
(case when se.visit_number > 0 then (CONCAT(p.proposalcode, p.proposalnumber, '-', se.visit_number)) else '' end) as exp,
d.code, d.barcode, d.storagelocation, d.dewarstatus, d.dewarid,
d.trackingnumbertosynchrotron, d.trackingnumberfromsynchrotron, d.externalShippingIdFromSynchrotron,
s.deliveryagent_agentname, d.weight, d.deliveryagent_barcode, GROUP_CONCAT(c.code SEPARATOR ', ') as containers,
s.sendinglabcontactid, s.returnlabcontactid, pe.givenname, pe.familyname, s.safetylevel as shippingsafetylevel
FROM dewar d
LEFT OUTER JOIN container c ON c.dewarid = d.dewarid
INNER JOIN shipping s ON d.shippingid = s.shippingid
INNER JOIN proposal p ON p.proposalid = s.proposalid
LEFT OUTER JOIN blsession se ON d.firstexperimentid = se.sessionid
LEFT OUTER JOIN blsession se2 ON c.sessionid = se2.sessionid
LEFT OUTER JOIN dewarregistry r ON r.facilitycode = d.facilitycode
LEFT OUTER JOIN labcontact lc ON s.sendinglabcontactid = lc.labcontactid
LEFT OUTER JOIN person pe ON lc.personid = pe.personid
Expand Down
4 changes: 3 additions & 1 deletion client/src/js/modules/shipment/views/dispatch.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ define(['marionette', 'views/form',
DEWARID: this.getOption('dewar').get('DEWARID'),
LABCONTACTID: this.getOption('dewar').get('LABCONTACTID'),
VISIT: this.getOption('dewar').get('FIRSTEXPERIMENT'),
UDCVISIT: this.getOption('dewar').get('UDCFIRSTEXPERIMENT'),
// If no agent specified on inbound, default to diamond dhl
DELIVERYAGENT_AGENTNAME: this.getOption('shipping').get('DELIVERYAGENT_AGENTNAME') || 'DHL'
})
Expand Down Expand Up @@ -174,7 +175,8 @@ define(['marionette', 'views/form',
},

doOnRender: function() {
this.ui.exp.html(this.visits.opts()).val(this.model.get('VISIT'))
let visit = this.model.get('VISIT') || this.model.get('UDCVISIT')
this.ui.exp.html(this.visits.opts()).val(visit)
this.updateLC()
this.populateCountries()
this.stripPostCode()
Expand Down

0 comments on commit 4ec31e1

Please sign in to comment.