Skip to content

Commit e05db51

Browse files
authored
feat: allow pdf to be downloaded for draft proposals (#1454)
1 parent a9873e7 commit e05db51

3 files changed

Lines changed: 9 additions & 24 deletions

File tree

apps/backend/src/factory/pdf/proposal.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import { getTopicActiveAnswers } from '../../models/ProposalModelFunctions';
2121
import { Answer, QuestionaryStep } from '../../models/Questionary';
2222
import { isRejection } from '../../models/Rejection';
2323
import { Review } from '../../models/Review';
24-
import { Roles } from '../../models/Role';
2524
import { Sample } from '../../models/Sample';
2625
import {
2726
TechnicalReview,
@@ -260,9 +259,6 @@ export const collectProposalPDFData = async (
260259
if (proposal === null) {
261260
throw new Error('Proposal not found');
262261
}
263-
if (!proposal.submitted && user.currentRole?.shortCode == Roles.USER) {
264-
throw new Error('PDF cannot be downloaded pre submission ');
265-
}
266262

267263
const call = await baseContext.queries.call.get(user, proposal.callId);
268264

apps/frontend/src/components/proposal/ProposalSummary.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ function ProposalReview({ confirm }: ProposalSummaryProps) {
3535

3636
const { api } = useDataApiWithFeedback();
3737
const isUserOfficer = useCheckAccess([UserRole.USER_OFFICER]);
38-
const isUser = useCheckAccess([UserRole.USER]);
3938
const { isInternalUser } = useContext(UserContext);
4039
const callHasEnded = isCallEnded(
4140
state.proposal.call?.startCall,
@@ -193,9 +192,7 @@ function ProposalReview({ confirm }: ProposalSummaryProps) {
193192
onClick={() =>
194193
downloadPDFProposal([proposal.primaryKey], proposal.title)
195194
}
196-
disabled={
197-
!allStepsComplete || isSubmitting || (!proposal.submitted && isUser)
198-
}
195+
disabled={!allStepsComplete || isSubmitting}
199196
color="secondary"
200197
>
201198
Download PDF

apps/frontend/src/components/proposal/ProposalTable.tsx

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -288,22 +288,14 @@ const ProposalTable = ({
288288
},
289289
};
290290
},
291-
(rowData) => {
292-
const isSubmitted = rowData.submitted;
293-
294-
return {
295-
icon: GetAppIcon,
296-
tooltip: !isSubmitted
297-
? 'Only submitted proposals can be downloaded'
298-
: 'Download Proposal',
299-
disabled: !isSubmitted,
300-
301-
onClick: (event, rowData) =>
302-
downloadPDFProposal(
303-
[(rowData as PartialProposalsDataType).primaryKey],
304-
(rowData as PartialProposalsDataType).title
305-
),
306-
};
291+
{
292+
icon: GetAppIcon,
293+
tooltip: 'Download proposal',
294+
onClick: (event, rowData) =>
295+
downloadPDFProposal(
296+
[(rowData as PartialProposalsDataType).primaryKey],
297+
(rowData as PartialProposalsDataType).title
298+
),
307299
},
308300
(rowData) => {
309301
const isPI = rowData.proposerId === userContext.user.id;

0 commit comments

Comments
 (0)