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
4 changes: 3 additions & 1 deletion api/src/Page/Proposal.php
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,9 @@ function _get_proposals($id = null)
$order = $cols[$this->arg('sort_by')] . ' ' . $dir;
}

$rows = $this->db->paginate("SELECT CONCAT(p.proposalcode,p.proposalnumber) as proposal, p.title, TO_CHAR(p.bltimestamp, 'DD-MM-YYYY') as st, p.proposalcode, p.proposalnumber, count(distinct s.sessionid) as vcount, p.proposalid, CONCAT(pe.givenname, ' ', pe.familyname) as fullname, pe.personid, p.state, IF(p.state = 'Open', 1, 0) as active, CONCAT(p.proposalcode,p.proposalnumber) as prop, s.beamlinename
$rows = $this->db->paginate("SELECT CONCAT(p.proposalcode,p.proposalnumber) as proposal, p.title, TO_CHAR(p.bltimestamp, 'DD-MM-YYYY') as st, p.proposalcode, p.proposalnumber, count(distinct s.sessionid) as vcount, p.proposalid, CONCAT(pe.givenname, ' ', pe.familyname) as fullname, pe.personid, p.state,
IF(p.state = 'Open' AND (p.endDate IS NULL OR p.endDate >= NOW()), 1, 0) as active,
CONCAT(p.proposalcode,p.proposalnumber) as prop, s.beamlinename
FROM proposal p
LEFT OUTER JOIN blsession s ON p.proposalid = s.proposalid
LEFT OUTER JOIN person pe ON pe.personid = p.personid
Expand Down
10 changes: 5 additions & 5 deletions client/src/js/app/components/navbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
>
<p class="tw-text-xs">
<i
v-show="isProposalClosed"
v-show="!isProposalActive"
class="fa fa-warning tw-text-red-500"
>&nbsp;</i> {{ proposal ? proposal : 'No Proposal' }} <i
v-show="proposal"
Expand All @@ -42,14 +42,14 @@
class="tw-border tw-border-gray-400 tw-divide-y tw-divide-gray-400"
>
<li
v-if="isProposalClosed"
v-if="!isProposalActive"
class="tw-w-full tw-bg-sidebar-grad-end"
>
<router-link
to=""
class="tw-block tw-text-gray-900 tw-py-4 tw-px-2"
>
<p>This proposal is closed. You cannot create shipments, proteins or contacts.</p>
<p>This proposal has ended. You cannot create shipments, proteins or contacts.</p>
<span v-if="getClosedProposalLink"><a @click="onWrapperClick" :href="getClosedProposalLink">Click here for more info.</a></span>
</router-link>
</li>
Expand Down Expand Up @@ -160,8 +160,8 @@ export default {
proposal: function() {
return this.$store.getters['proposal/currentProposal']
},
isProposalClosed: function() {
return this.$store.getters['proposal/currentProposalState'] === 'Closed'
isProposalActive: function() {
return this.$store.getters['proposal/currentProposalActive']
},
isLoggedIn: function() {
return this.$store.getters['auth/isLoggedIn']
Expand Down
12 changes: 6 additions & 6 deletions client/src/js/app/components/sidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
>
<p class="">
<i
v-show="isProposalClosed"
v-show="!isProposalActive"
class="fa fa-warning tw-text-red-500"
>&nbsp;</i>{{ proposal ? proposal : 'No Proposal' }} <i
v-show="proposal"
Expand All @@ -33,11 +33,11 @@

<div>
<router-link
v-show="isProposalClosed"
v-show="!isProposalActive"
to=""
class="tw-w-full tw-border-t tw-border-gray-400 tw-bg-sidebar-mobile-background hover:tw-bg-gray-100 tw-block tw-text-white tw-py-3 tw-px-4"
>
<p>This proposal is closed.</p><p>You cannot create shipments, proteins or contacts.</p>
<p>This proposal has ended.</p><p>You cannot create shipments, proteins or contacts.</p>
</router-link>
<router-link
v-for="(item, index) in proposalMenu"
Expand Down Expand Up @@ -119,8 +119,8 @@ export default {
proposal: function() {
return this.$store.getters['proposal/currentProposal']
},
isProposalClosed: function() {
return this.$store.getters['proposal/currentProposalState'] == 'Closed'
isProposalActive: function() {
return this.$store.getters['proposal/currentProposalActive']
},
isLoggedIn: function() {
return this.$store.getters['auth/isLoggedIn']
Expand Down Expand Up @@ -149,4 +149,4 @@ export default {
@apply tw-top-0;
@apply tw-left-0;
}
</style>
</style>
2 changes: 1 addition & 1 deletion client/src/js/app/store/modules/store.proposal.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ const proposalModule = {
return state.proposal
},
currentProposalType: state => state.proposalType,
currentProposalState: state => state.proposalModel ? state.proposalModel.get('STATE'): null,
currentProposalActive: state => state.proposalModel ? Number(state.proposalModel.get('ACTIVE')) === 1 : false,
getProposalId: state => state.proposalModel ? state.proposalModel.get('PROPOSALID'): null,
currentVisit: state => state.visit,
currentProposalModel: state => state.proposalModel
Expand Down
14 changes: 7 additions & 7 deletions client/tests/unit/js/components/sidebar.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,20 @@ describe("Sidebar", () => {
expect(wrapper.vm.isLoggedIn).toBe(false);
});

it("isProposalClosed returns true if proposal is Closed", () => {
localVue.prototype.$store.getters["proposal/currentProposalState"] = "Closed";
it("isProposalActive returns true if proposal is active", () => {
localVue.prototype.$store.getters["proposal/currentProposalActive"] = true;
const wrapper = shallowMount(Sidebar, {
localVue,
});
expect(wrapper.vm.isProposalClosed).toBe(true);
expect(wrapper.vm.isProposalActive).toBe(true);
});

it("isProposalClosed returns false if proposal is not Closed", () => {
localVue.prototype.$store.getters["proposal/currentProposalState"] = "anything else";
it("isProposalActive returns false if proposal is not active", () => {
localVue.prototype.$store.getters["proposal/currentProposalActive"] = false;
const wrapper = shallowMount(Sidebar, {
localVue,
});
expect(wrapper.vm.isProposalClosed).toBe(false);
expect(wrapper.vm.isProposalActive).toBe(false);
});

it("extras initially empty without proposal", () => {
Expand Down Expand Up @@ -75,4 +75,4 @@ describe("Sidebar", () => {
});
expect(wrapper.vm.extras).toBe(extras);
});
});
});
Loading