Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LIMS-101: Add dewar info to visits page #581

Merged
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
4 changes: 3 additions & 1 deletion api/src/Page/Shipment.php
Original file line number Diff line number Diff line change
Expand Up @@ -1335,13 +1335,15 @@ 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, s.deliveryagent_agentname, d.weight, d.deliveryagent_barcode, GROUP_CONCAT(c.code SEPARATOR ', ') as containers, s.sendinglabcontactid, s.returnlabcontactid
$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, s.deliveryagent_agentname, d.weight, d.deliveryagent_barcode, GROUP_CONCAT(c.code SEPARATOR ', ') as containers, s.sendinglabcontactid, s.returnlabcontactid, pe.givenname, pe.familyname
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 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
WHERE $where
GROUP BY CONCAT(p.proposalcode, p.proposalnumber, '-', se.visit_number), r.labcontactid, se.beamlineoperator, TO_CHAR(se.startdate, 'HH24:MI DD-MM-YYYY'), (case when se.visit_number > 0 then (CONCAT(p.proposalcode, p.proposalnumber, '-', se.visit_number)) else '' end),s.shippingid, s.shippingname, d.code, d.barcode, d.storagelocation, d.dewarstatus, d.dewarid, d.trackingnumbertosynchrotron, d.trackingnumberfromsynchrotron, d.facilitycode, d.firstexperimentid
ORDER BY $order", $args);
Expand Down
39 changes: 32 additions & 7 deletions client/src/js/modules/visits/views/visit_list.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,15 @@
v-model="visit.edited_comment"
v-on:keyup.enter="onEnter(visit)" />

<div data-testid="visit-table-dewars" v-if="value.key === 'DEWARS'">
<div v-for="(dewar) in dewars">
<span v-if="dewar.FIRSTEXPERIMENTID === visit.SESSIONID">
<a :href="'shipments/sid/'+dewar.SHIPPINGID">
{{dewar.FACILITYCODE || dewar.CODE}}
</a> - {{dewar.GIVENNAME}} {{dewar.FAMILYNAME}} - {{dewar.STORAGELOCATION || dewar.DEWARSTATUS}}
</span>
</div>
</div>
<a v-if="value.key == 'LINKS' && visit.DCCOUNT>0" class="button button-notext" title="View Statistics" id="STATS"><i class="fa fa-pie-chart"></i></a>
<a v-if="value.key == 'LINKS' && visit.DCCOUNT>0" class="button button-notext" title="Download PDF Report" id="PDF"><i class="fa fa-list"></i></a>
<a v-if="value.key == 'LINKS' && visit.DCCOUNT>0" class="button button-notext" title="Export Data Collections to CSV" id="CSV"><i class="fa fa-file-o"></i></a>
Expand Down Expand Up @@ -79,7 +88,7 @@

<script>
import VisitCollection from 'collections/visits'
import VisitModel from 'models/visit'
import DewarCollection from 'collections/dewars'

import Pagination from 'app/components/pagination.vue'
import CustomTableComponent from 'app/components/custom-table-component.vue'
Expand All @@ -106,6 +115,7 @@ export default {
isArchived: app.prop.includes("in") ? "deleted" : "archived",
visitCollection: [],
visits: [],
dewars: [],
searchVisit : '',
headers: [
{
Expand All @@ -125,7 +135,11 @@ export default {
title: 'Beamline'
},
{
key: "LC",
key: "DEWARS",
title: 'Dewar(s)'
},
{
key: "UNIQUELCS",
title: 'Local Contact'
},
{
Expand Down Expand Up @@ -159,17 +173,28 @@ export default {
// fetches visit data based on prop

this.visitCollection = new VisitCollection()
this.visitCollection.queryParams = { page: this.currentPage, per_page: this.pageSize };

this.visitCollection.queryParams.prop = this.proposal;
this.visitCollection.queryParams.s = this.searchVisit;
this.visitCollection.queryParams = {
page: this.currentPage,
per_page: this.pageSize,
prop: this.proposal,
s: this.searchVisit,
};

const results = await this.$store.dispatch('getCollection', this.visitCollection);
this.visits = results.toJSON().map((e) => {
return { ...e, clicked: false , edited_comment: e.COMMENTS};
return { ...e,
clicked: false,
edited_comment: e.COMMENTS,
// get a unique list of local contacts
UNIQUELCS: e.LC ? e.LC.split(", ").filter((x, i, a) => a.indexOf(x) == i).join(", ") : "",
};
});

this.totalRecords = results.state.totalRecords;
this.dewarCollection = new DewarCollection();
this.dewarCollection.queryParams = { prop: this.proposal, per_page: 9999 };
const dewarResults = await this.$store.dispatch('getCollection', this.dewarCollection);
this.dewars = dewarResults.toJSON();

},
handlePageChange(data) {
Expand Down
Loading