diff --git a/cypress/integration/calls.ts b/cypress/integration/calls.ts index ff591eebb..83d19fe2c 100644 --- a/cypress/integration/calls.ts +++ b/cypress/integration/calls.ts @@ -5,6 +5,7 @@ import { AllocationTimeUnits, CreateInstrumentMutationVariables, TemplateGroupId, + UpdateCallInput, } from '../../src/generated/sdk'; import initialDBData from '../support/initialDBData'; @@ -480,6 +481,48 @@ context('Calls tests', () => { ); }); + it('A user-officer should be able to deactivate/activate a call', () => { + cy.contains('Calls').click(); + + cy.contains(newCall.shortCode) + .parent() + .find('[aria-label="Deactivate call"]') + .click(); + + cy.get('[data-cy="confirm-ok"]').click(); + cy.notification({ variant: 'success', text: 'successfully' }); + + cy.get('[data-cy="calls-table"]').should( + 'not.contain', + newCall.shortCode + ); + + cy.get('[data-cy="call-status-filter"]').click(); + cy.get('[role="listbox"]').contains('Inactive').click(); + + cy.finishedLoading(); + + cy.contains(newCall.shortCode) + .parent() + .find('[aria-label="Activate call"]') + .click(); + + cy.get('[data-cy="confirm-ok"]').click(); + cy.notification({ variant: 'success', text: 'successfully' }); + + cy.get('[data-cy="calls-table"]').should( + 'not.contain', + newCall.shortCode + ); + + cy.get('[data-cy="call-status-filter"]').click(); + cy.get('[role="listbox"]').contains('Active').click(); + + cy.finishedLoading(); + + cy.get('[data-cy="calls-table"]').should('contain', newCall.shortCode); + }); + it('A user-officer should not be able to set negative availability time on instrument per call', () => { cy.assignInstrumentToCall({ callId: createdCallId, @@ -592,6 +635,13 @@ context('Calls tests', () => { ...newInactiveCall, esiTemplateId: esiTemplateId, proposalWorkflowId: workflowId, + }).then((result) => { + if (result.createCall.call?.id) { + cy.updateCall({ + ...result.createCall.call, + isActive: false, + } as UpdateCallInput); + } }); cy.contains('Calls').click(); diff --git a/cypress/integration/proposals.ts b/cypress/integration/proposals.ts index 1c76c944d..b386f7f41 100644 --- a/cypress/integration/proposals.ts +++ b/cypress/integration/proposals.ts @@ -472,7 +472,7 @@ context('Proposal tests', () => { cy.contains(newProposalTitle).should('not.exist'); }); - it('User should not be able to create and submit proposal with inactive call', () => { + it('User should not be able to create and submit proposal on a call that is ended', () => { createTopicAndQuestionToExistingTemplate(); cy.login('user'); cy.visit('/'); diff --git a/src/components/DashBoard.tsx b/src/components/DashBoard.tsx index 5900a931b..118da4587 100644 --- a/src/components/DashBoard.tsx +++ b/src/components/DashBoard.tsx @@ -190,7 +190,7 @@ const Dashboard: React.FC = () => { )?.isEnabled; const { currentRole } = useContext(UserContext); - const { calls } = useCallsData({ isActive: true }); + const { calls } = useCallsData({ isActive: true, isEnded: false }); useEffect(() => { if (isTabletOrMobile) { diff --git a/src/components/call/CallsTable.tsx b/src/components/call/CallsTable.tsx index 1ac81f57e..fb133db75 100644 --- a/src/components/call/CallsTable.tsx +++ b/src/components/call/CallsTable.tsx @@ -1,3 +1,5 @@ +import Archive from '@mui/icons-material/Archive'; +import Unarchive from '@mui/icons-material/Unarchive'; import { Typography } from '@mui/material'; import React, { useState } from 'react'; import { useQueryParams } from 'use-query-params'; @@ -9,12 +11,18 @@ import SuperMaterialTable, { DefaultQueryParams, UrlQueryParamsType, } from 'components/common/SuperMaterialTable'; -import { Call, InstrumentWithAvailabilityTime, UserRole } from 'generated/sdk'; +import { + Call, + InstrumentWithAvailabilityTime, + UserRole, + UpdateCallInput, +} from 'generated/sdk'; import { useFormattedDateTime } from 'hooks/admin/useFormattedDateTime'; import { useCallsData } from 'hooks/call/useCallsData'; import { tableIcons } from 'utils/materialIcons'; import useDataApiWithFeedback from 'utils/useDataApiWithFeedback'; import { FunctionType } from 'utils/utilTypes'; +import withConfirm, { WithConfirmProps } from 'utils/withConfirm'; import AssignedInstrumentsTable from './AssignedInstrumentsTable'; import AssignInstrumentsToCall from './AssignInstrumentsToCall'; @@ -30,7 +38,7 @@ const getFilterStatus = (callStatus: string | CallStatus) => ? undefined // if set to ALL we don't filter by status : callStatus === CallStatus.ACTIVE; -const CallsTable: React.FC = () => { +const CallsTable: React.FC = ({ confirm }) => { const { api } = useDataApiWithFeedback(); const { timezone, toFormattedDateTime } = useFormattedDateTime({ shouldUseTimeZone: true, @@ -125,6 +133,35 @@ const CallsTable: React.FC = () => { } }; + const changeCallActiveStatus = (call: Call) => { + const shouldActivateCall = !call.isActive; + confirm( + async () => { + const data = await api({ + toastSuccessMessage: `Call ${ + shouldActivateCall ? 'activated' : 'deactivated' + } successfully`, + }).updateCall({ + ...call, + isActive: shouldActivateCall, + } as UpdateCallInput); + + if (!data.updateCall.rejection) { + const newCallsArray = calls.filter( + (objectItem) => objectItem.id !== call.id + ); + setCalls(newCallsArray); + } + }, + { + title: `${shouldActivateCall ? 'Activate' : 'Deactivate'} call`, + description: `Are you sure you want to ${ + shouldActivateCall ? 'activate' : 'deactivate' + } this call?`, + } + )(); + }; + const deleteCall = async (id: number | string) => { return await api({ toastSuccessMessage: 'Call deleted successfully' }) .deleteCall({ @@ -252,7 +289,8 @@ const CallsTable: React.FC = () => { setData={setCalls} delete={deleteCall} hasAccess={{ - create: isUserOfficer, + create: + isUserOfficer && urlQueryParams.callStatus !== CallStatus.INACTIVE, update: isUserOfficer, remove: isUserOfficer, }} @@ -282,6 +320,12 @@ const CallsTable: React.FC = () => { setAssigningInstrumentsCallId((rowData as Call).id), position: 'row', }, + (rowData) => ({ + icon: rowData.isActive ? Archive : Unarchive, + tooltip: `${rowData.isActive ? 'Deactivate' : 'Activate'} call`, + onClick: (): void => changeCallActiveStatus(rowData as Call), + position: 'row', + }), ]} urlQueryParams={urlQueryParams} setUrlQueryParams={setUrlQueryParams} @@ -290,4 +334,4 @@ const CallsTable: React.FC = () => { ); }; -export default CallsTable; +export default withConfirm(CallsTable); diff --git a/src/components/proposal/ProposalSummary.tsx b/src/components/proposal/ProposalSummary.tsx index 75a57051b..17fd9a8f0 100644 --- a/src/components/proposal/ProposalSummary.tsx +++ b/src/components/proposal/ProposalSummary.tsx @@ -11,8 +11,9 @@ import { } from 'components/questionary/QuestionaryContext'; import ProposalQuestionaryReview from 'components/review/ProposalQuestionaryReview'; import { UserRole } from 'generated/sdk'; -import { useDataApi } from 'hooks/common/useDataApi'; import { useDownloadPDFProposal } from 'hooks/proposal/useDownloadPDFProposal'; +import { isCallEnded } from 'utils/helperFunctions'; +import useDataApiWithFeedback from 'utils/useDataApiWithFeedback'; import withConfirm, { WithConfirmType } from 'utils/withConfirm'; import { ProposalContextType } from './ProposalContainer'; @@ -30,9 +31,13 @@ function ProposalReview({ confirm }: ProposalSummaryProps) { throw new Error(createMissingContextErrorMessage()); } - const api = useDataApi(); + const { api } = useDataApiWithFeedback(); const isUserOfficer = useCheckAccess([UserRole.USER_OFFICER]); - const isCallActive = state.proposal?.call?.isActive ?? true; + + const callHasEnded = isCallEnded( + state.proposal.call?.startCall, + state.proposal.call?.endCall + ); const [loadingSubmitMessage, setLoadingSubmitMessage] = useState(true); @@ -50,7 +55,7 @@ function ProposalReview({ confirm }: ProposalSummaryProps) { proposal.questionary.steps.every((step) => step.isCompleted); const submitDisabled = - (!isUserOfficer && !isCallActive) || // disallow submit for non user officers if the call ended + (!isUserOfficer && callHasEnded) || // disallow submit for non user officers if the call ended !allStepsComplete || proposal.submitted; @@ -126,7 +131,9 @@ function ProposalReview({ confirm }: ProposalSummaryProps) { confirm( async () => { setIsSubmitting(true); - const result = await api().submitProposal({ + const result = await api({ + toastSuccessMessage: 'Proposal submitted successfully', + }).submitProposal({ proposalPk: state.proposal.primaryKey, }); if (!result.submitProposal.proposal) { diff --git a/src/components/proposal/ProposalTable.tsx b/src/components/proposal/ProposalTable.tsx index 5beb963e2..ea7125672 100644 --- a/src/components/proposal/ProposalTable.tsx +++ b/src/components/proposal/ProposalTable.tsx @@ -15,6 +15,7 @@ import { UserContext } from 'context/UserContextProvider'; import { Call } from 'generated/sdk'; import { useDownloadPDFProposal } from 'hooks/proposal/useDownloadPDFProposal'; import { ProposalData } from 'hooks/proposal/useProposalData'; +import { isCallEnded } from 'utils/helperFunctions'; import { tableIcons } from 'utils/materialIcons'; import { tableLocalization } from 'utils/materialLocalization'; import { timeAgo } from 'utils/Time'; @@ -177,9 +178,13 @@ const ProposalTable = ({ }} actions={[ (rowData) => { - const isCallActive = rowData.call?.isActive ?? true; + const callHasEnded = isCallEnded( + rowData.call?.startCall, + rowData.call?.endCall + ); + const readOnly = - !isCallActive || + callHasEnded || (rowData.submitted && rowData.status?.shortCode !== 'EDITABLE_SUBMITTED'); diff --git a/src/components/questionary/questionaries/proposal/ProposalQuestionaryWizardStep.ts b/src/components/questionary/questionaries/proposal/ProposalQuestionaryWizardStep.ts index 6864be5a2..c394e1a63 100644 --- a/src/components/questionary/questionaries/proposal/ProposalQuestionaryWizardStep.ts +++ b/src/components/questionary/questionaries/proposal/ProposalQuestionaryWizardStep.ts @@ -1,6 +1,7 @@ import { ProposalSubmissionState } from 'models/questionary/proposal/ProposalSubmissionState'; import { ProposalWithQuestionary } from 'models/questionary/proposal/ProposalWithQuestionary'; import { QuestionarySubmissionState } from 'models/questionary/QuestionarySubmissionState'; +import { isCallEnded } from 'utils/helperFunctions'; import { QuestionaryWizardStep } from '../../DefaultWizardStepFactory'; @@ -8,17 +9,20 @@ export class ProposalQuestionaryWizardStep extends QuestionaryWizardStep { isItemWithQuestionaryEditable(state: QuestionarySubmissionState) { const { proposal } = state as ProposalSubmissionState; - const isCallActive = proposal.call?.isActive ?? true; + const callHasEnded = isCallEnded( + proposal.call?.startCall, + proposal.call?.endCall + ); const proposalStatus = this.getProposalStatus(proposal); if (proposalStatus === 'EDITABLE_SUBMITTED') { return true; } - if (isCallActive) { - return proposalStatus === 'DRAFT'; - } else { + if (callHasEnded) { return false; + } else { + return proposalStatus === 'DRAFT'; } } diff --git a/src/generated/sdk.ts b/src/generated/sdk.ts index 9a70687a6..780f639a6 100644 --- a/src/generated/sdk.ts +++ b/src/generated/sdk.ts @@ -3097,6 +3097,7 @@ export type UpdateCallInput = { endSEPReview?: InputMaybe; esiTemplateId?: InputMaybe; id: Scalars['Int']; + isActive?: InputMaybe; proposalSequence?: InputMaybe; proposalWorkflowId: Scalars['Int']; referenceNumberFormat?: InputMaybe; @@ -3614,7 +3615,7 @@ export type CreateCallMutationVariables = Exact<{ }>; -export type CreateCallMutation = { createCall: { rejection: { reason: string, context: string | null, exception: string | null } | null, call: { id: number, shortCode: string, startCall: any, endCall: any, startReview: any, endReview: any, startSEPReview: any | null, endSEPReview: any | null, startNotify: any, endNotify: any, startCycle: any, endCycle: any, cycleComment: string, surveyComment: string, referenceNumberFormat: string | null, proposalWorkflowId: number | null, templateId: number, esiTemplateId: number | null, allocationTimeUnit: AllocationTimeUnits, proposalCount: number, title: string | null, description: string | null, submissionMessage: string | null, instruments: Array<{ id: number, name: string, shortCode: string, description: string, availabilityTime: number | null, submitted: boolean | null, scientists: Array<{ id: number, firstname: string, lastname: string, preferredname: string | null, organisation: string, organizationId: number, position: string, created: any | null, placeholder: boolean | null, email: string | null }> }>, seps: Array<{ id: number, code: string }> | null, proposalWorkflow: { id: number, name: string, description: string } | null, template: { templateId: number, name: string, isArchived: boolean } } | null } }; +export type CreateCallMutation = { createCall: { rejection: { reason: string, context: string | null, exception: string | null } | null, call: { id: number, shortCode: string, startCall: any, endCall: any, startReview: any, endReview: any, startSEPReview: any | null, endSEPReview: any | null, startNotify: any, endNotify: any, startCycle: any, endCycle: any, cycleComment: string, surveyComment: string, referenceNumberFormat: string | null, proposalWorkflowId: number | null, templateId: number, esiTemplateId: number | null, allocationTimeUnit: AllocationTimeUnits, proposalCount: number, title: string | null, description: string | null, submissionMessage: string | null, isActive: boolean, instruments: Array<{ id: number, name: string, shortCode: string, description: string, availabilityTime: number | null, submitted: boolean | null, scientists: Array<{ id: number, firstname: string, lastname: string, preferredname: string | null, organisation: string, organizationId: number, position: string, created: any | null, placeholder: boolean | null, email: string | null }> }>, seps: Array<{ id: number, code: string }> | null, proposalWorkflow: { id: number, name: string, description: string } | null, template: { templateId: number, name: string, isArchived: boolean } } | null } }; export type DeleteCallMutationVariables = Exact<{ id: Scalars['Int']; @@ -3623,28 +3624,28 @@ export type DeleteCallMutationVariables = Exact<{ export type DeleteCallMutation = { deleteCall: { rejection: { reason: string, context: string | null, exception: string | null } | null, call: { id: number } | null } }; -export type CallFragment = { id: number, shortCode: string, startCall: any, endCall: any, startReview: any, endReview: any, startSEPReview: any | null, endSEPReview: any | null, startNotify: any, endNotify: any, startCycle: any, endCycle: any, cycleComment: string, surveyComment: string, referenceNumberFormat: string | null, proposalWorkflowId: number | null, templateId: number, esiTemplateId: number | null, allocationTimeUnit: AllocationTimeUnits, proposalCount: number, title: string | null, description: string | null, submissionMessage: string | null, instruments: Array<{ id: number, name: string, shortCode: string, description: string, availabilityTime: number | null, submitted: boolean | null, scientists: Array<{ id: number, firstname: string, lastname: string, preferredname: string | null, organisation: string, organizationId: number, position: string, created: any | null, placeholder: boolean | null, email: string | null }> }>, seps: Array<{ id: number, code: string }> | null, proposalWorkflow: { id: number, name: string, description: string } | null, template: { templateId: number, name: string, isArchived: boolean } }; +export type CallFragment = { id: number, shortCode: string, startCall: any, endCall: any, startReview: any, endReview: any, startSEPReview: any | null, endSEPReview: any | null, startNotify: any, endNotify: any, startCycle: any, endCycle: any, cycleComment: string, surveyComment: string, referenceNumberFormat: string | null, proposalWorkflowId: number | null, templateId: number, esiTemplateId: number | null, allocationTimeUnit: AllocationTimeUnits, proposalCount: number, title: string | null, description: string | null, submissionMessage: string | null, isActive: boolean, instruments: Array<{ id: number, name: string, shortCode: string, description: string, availabilityTime: number | null, submitted: boolean | null, scientists: Array<{ id: number, firstname: string, lastname: string, preferredname: string | null, organisation: string, organizationId: number, position: string, created: any | null, placeholder: boolean | null, email: string | null }> }>, seps: Array<{ id: number, code: string }> | null, proposalWorkflow: { id: number, name: string, description: string } | null, template: { templateId: number, name: string, isArchived: boolean } }; export type GetCallQueryVariables = Exact<{ id: Scalars['Int']; }>; -export type GetCallQuery = { call: { id: number, shortCode: string, startCall: any, endCall: any, startReview: any, endReview: any, startSEPReview: any | null, endSEPReview: any | null, startNotify: any, endNotify: any, startCycle: any, endCycle: any, cycleComment: string, surveyComment: string, referenceNumberFormat: string | null, proposalWorkflowId: number | null, templateId: number, esiTemplateId: number | null, allocationTimeUnit: AllocationTimeUnits, proposalCount: number, title: string | null, description: string | null, submissionMessage: string | null, instruments: Array<{ id: number, name: string, shortCode: string, description: string, availabilityTime: number | null, submitted: boolean | null, scientists: Array<{ id: number, firstname: string, lastname: string, preferredname: string | null, organisation: string, organizationId: number, position: string, created: any | null, placeholder: boolean | null, email: string | null }> }>, seps: Array<{ id: number, code: string }> | null, proposalWorkflow: { id: number, name: string, description: string } | null, template: { templateId: number, name: string, isArchived: boolean } } | null }; +export type GetCallQuery = { call: { id: number, shortCode: string, startCall: any, endCall: any, startReview: any, endReview: any, startSEPReview: any | null, endSEPReview: any | null, startNotify: any, endNotify: any, startCycle: any, endCycle: any, cycleComment: string, surveyComment: string, referenceNumberFormat: string | null, proposalWorkflowId: number | null, templateId: number, esiTemplateId: number | null, allocationTimeUnit: AllocationTimeUnits, proposalCount: number, title: string | null, description: string | null, submissionMessage: string | null, isActive: boolean, instruments: Array<{ id: number, name: string, shortCode: string, description: string, availabilityTime: number | null, submitted: boolean | null, scientists: Array<{ id: number, firstname: string, lastname: string, preferredname: string | null, organisation: string, organizationId: number, position: string, created: any | null, placeholder: boolean | null, email: string | null }> }>, seps: Array<{ id: number, code: string }> | null, proposalWorkflow: { id: number, name: string, description: string } | null, template: { templateId: number, name: string, isArchived: boolean } } | null }; export type GetCallsQueryVariables = Exact<{ filter?: InputMaybe; }>; -export type GetCallsQuery = { calls: Array<{ id: number, shortCode: string, startCall: any, endCall: any, startReview: any, endReview: any, startSEPReview: any | null, endSEPReview: any | null, startNotify: any, endNotify: any, startCycle: any, endCycle: any, cycleComment: string, surveyComment: string, referenceNumberFormat: string | null, proposalWorkflowId: number | null, templateId: number, esiTemplateId: number | null, allocationTimeUnit: AllocationTimeUnits, proposalCount: number, title: string | null, description: string | null, submissionMessage: string | null, instruments: Array<{ id: number, name: string, shortCode: string, description: string, availabilityTime: number | null, submitted: boolean | null, scientists: Array<{ id: number, firstname: string, lastname: string, preferredname: string | null, organisation: string, organizationId: number, position: string, created: any | null, placeholder: boolean | null, email: string | null }> }>, seps: Array<{ id: number, code: string }> | null, proposalWorkflow: { id: number, name: string, description: string } | null, template: { templateId: number, name: string, isArchived: boolean } }> | null }; +export type GetCallsQuery = { calls: Array<{ id: number, shortCode: string, startCall: any, endCall: any, startReview: any, endReview: any, startSEPReview: any | null, endSEPReview: any | null, startNotify: any, endNotify: any, startCycle: any, endCycle: any, cycleComment: string, surveyComment: string, referenceNumberFormat: string | null, proposalWorkflowId: number | null, templateId: number, esiTemplateId: number | null, allocationTimeUnit: AllocationTimeUnits, proposalCount: number, title: string | null, description: string | null, submissionMessage: string | null, isActive: boolean, instruments: Array<{ id: number, name: string, shortCode: string, description: string, availabilityTime: number | null, submitted: boolean | null, scientists: Array<{ id: number, firstname: string, lastname: string, preferredname: string | null, organisation: string, organizationId: number, position: string, created: any | null, placeholder: boolean | null, email: string | null }> }>, seps: Array<{ id: number, code: string }> | null, proposalWorkflow: { id: number, name: string, description: string } | null, template: { templateId: number, name: string, isArchived: boolean } }> | null }; export type GetCallsByInstrumentScientistQueryVariables = Exact<{ scientistId: Scalars['Int']; }>; -export type GetCallsByInstrumentScientistQuery = { callsByInstrumentScientist: Array<{ id: number, shortCode: string, startCall: any, endCall: any, startReview: any, endReview: any, startSEPReview: any | null, endSEPReview: any | null, startNotify: any, endNotify: any, startCycle: any, endCycle: any, cycleComment: string, surveyComment: string, referenceNumberFormat: string | null, proposalWorkflowId: number | null, templateId: number, esiTemplateId: number | null, allocationTimeUnit: AllocationTimeUnits, proposalCount: number, title: string | null, description: string | null, submissionMessage: string | null, instruments: Array<{ id: number, name: string, shortCode: string, description: string, availabilityTime: number | null, submitted: boolean | null, scientists: Array<{ id: number, firstname: string, lastname: string, preferredname: string | null, organisation: string, organizationId: number, position: string, created: any | null, placeholder: boolean | null, email: string | null }> }>, seps: Array<{ id: number, code: string }> | null, proposalWorkflow: { id: number, name: string, description: string } | null, template: { templateId: number, name: string, isArchived: boolean } }> | null }; +export type GetCallsByInstrumentScientistQuery = { callsByInstrumentScientist: Array<{ id: number, shortCode: string, startCall: any, endCall: any, startReview: any, endReview: any, startSEPReview: any | null, endSEPReview: any | null, startNotify: any, endNotify: any, startCycle: any, endCycle: any, cycleComment: string, surveyComment: string, referenceNumberFormat: string | null, proposalWorkflowId: number | null, templateId: number, esiTemplateId: number | null, allocationTimeUnit: AllocationTimeUnits, proposalCount: number, title: string | null, description: string | null, submissionMessage: string | null, isActive: boolean, instruments: Array<{ id: number, name: string, shortCode: string, description: string, availabilityTime: number | null, submitted: boolean | null, scientists: Array<{ id: number, firstname: string, lastname: string, preferredname: string | null, organisation: string, organizationId: number, position: string, created: any | null, placeholder: boolean | null, email: string | null }> }>, seps: Array<{ id: number, code: string }> | null, proposalWorkflow: { id: number, name: string, description: string } | null, template: { templateId: number, name: string, isArchived: boolean } }> | null }; export type RemoveAssignedInstrumentFromCallMutationVariables = Exact<{ instrumentId: Scalars['Int']; @@ -3677,11 +3678,12 @@ export type UpdateCallMutationVariables = Exact<{ esiTemplateId?: InputMaybe; title?: InputMaybe; description?: InputMaybe; + isActive?: InputMaybe; seps?: InputMaybe | Scalars['Int']>; }>; -export type UpdateCallMutation = { updateCall: { rejection: { reason: string, context: string | null, exception: string | null } | null, call: { id: number, shortCode: string, startCall: any, endCall: any, startReview: any, endReview: any, startSEPReview: any | null, endSEPReview: any | null, startNotify: any, endNotify: any, startCycle: any, endCycle: any, cycleComment: string, surveyComment: string, referenceNumberFormat: string | null, proposalWorkflowId: number | null, templateId: number, esiTemplateId: number | null, allocationTimeUnit: AllocationTimeUnits, proposalCount: number, title: string | null, description: string | null, submissionMessage: string | null, instruments: Array<{ id: number, name: string, shortCode: string, description: string, availabilityTime: number | null, submitted: boolean | null, scientists: Array<{ id: number, firstname: string, lastname: string, preferredname: string | null, organisation: string, organizationId: number, position: string, created: any | null, placeholder: boolean | null, email: string | null }> }>, seps: Array<{ id: number, code: string }> | null, proposalWorkflow: { id: number, name: string, description: string } | null, template: { templateId: number, name: string, isArchived: boolean } } | null } }; +export type UpdateCallMutation = { updateCall: { rejection: { reason: string, context: string | null, exception: string | null } | null, call: { id: number, shortCode: string, startCall: any, endCall: any, startReview: any, endReview: any, startSEPReview: any | null, endSEPReview: any | null, startNotify: any, endNotify: any, startCycle: any, endCycle: any, cycleComment: string, surveyComment: string, referenceNumberFormat: string | null, proposalWorkflowId: number | null, templateId: number, esiTemplateId: number | null, allocationTimeUnit: AllocationTimeUnits, proposalCount: number, title: string | null, description: string | null, submissionMessage: string | null, isActive: boolean, instruments: Array<{ id: number, name: string, shortCode: string, description: string, availabilityTime: number | null, submitted: boolean | null, scientists: Array<{ id: number, firstname: string, lastname: string, preferredname: string | null, organisation: string, organizationId: number, position: string, created: any | null, placeholder: boolean | null, email: string | null }> }>, seps: Array<{ id: number, code: string }> | null, proposalWorkflow: { id: number, name: string, description: string } | null, template: { templateId: number, name: string, isArchived: boolean } } | null } }; export type CreateEsiMutationVariables = Exact<{ scheduledEventId: Scalars['Int']; @@ -3913,7 +3915,7 @@ export type CloneProposalsMutationVariables = Exact<{ }>; -export type CloneProposalsMutation = { cloneProposals: { proposals: Array<{ primaryKey: number, title: string, abstract: string, statusId: number, publicStatus: ProposalPublicStatus, proposalId: string, finalStatus: ProposalEndStatus | null, commentForUser: string | null, commentForManagement: string | null, created: any, updated: any, callId: number, questionaryId: number, notified: boolean, submitted: boolean, managementTimeAllocation: number | null, managementDecisionSubmitted: boolean, proposer: { id: number, firstname: string, lastname: string, preferredname: string | null, organisation: string, organizationId: number, position: string, created: any | null, placeholder: boolean | null, email: string | null } | null, users: Array<{ id: number, firstname: string, lastname: string, preferredname: string | null, organisation: string, organizationId: number, position: string, created: any | null, placeholder: boolean | null, email: string | null }>, questionary: { isCompleted: boolean, questionaryId: number, templateId: number, created: any, steps: Array<{ isCompleted: boolean, topic: { title: string, id: number, templateId: number, sortOrder: number, isEnabled: boolean }, fields: Array<{ answerId: number | null, sortOrder: number, topicId: number, dependenciesOperator: DependenciesLogicOperator | null, value: any | null, question: { id: string, question: string, naturalKey: string, dataType: DataType, categoryId: TemplateCategoryId, config: { small_label: string, required: boolean, tooltip: string } | { small_label: string, required: boolean, tooltip: string, minDate: string | null, maxDate: string | null, defaultDate: string | null, includeTime: boolean } | { html: string, plain: string, omitFromPdf: boolean } | { small_label: string, required: boolean, tooltip: string } | { file_type: Array, max_files: number, pdf_page_limit: number, small_label: string, required: boolean, tooltip: string } | { titlePlaceholder: string, questionLabel: string } | { small_label: string, required: boolean, tooltip: string, units: Array<{ id: string, unit: string, quantity: string, symbol: string, siConversionFormula: string }> } | { numberValueConstraint: NumberValueConstraint | null, small_label: string, required: boolean, tooltip: string, units: Array<{ id: string, unit: string, quantity: string, symbol: string, siConversionFormula: string }> } | { tooltip: string } | { tooltip: string } | { small_label: string, required: boolean, tooltip: string, max: number | null } | { titlePlaceholder: string } | { addEntryButtonLabel: string, minEntries: number | null, maxEntries: number | null, templateId: number | null, esiTemplateId: number | null, templateCategory: string, required: boolean, small_label: string } | { tooltip: string } | { variant: string, options: Array, isMultipleSelect: boolean, small_label: string, required: boolean, tooltip: string } | { small_label: string, required: boolean, tooltip: string } | { addEntryButtonLabel: string, minEntries: number | null, maxEntries: number | null, templateId: number | null, templateCategory: string, required: boolean, small_label: string } | { min: number | null, max: number | null, multiline: boolean, placeholder: string, small_label: string, required: boolean, tooltip: string, htmlQuestion: string | null, isHtmlQuestion: boolean, isCounterHidden: boolean } | { small_label: string, required: boolean, tooltip: string } }, config: { small_label: string, required: boolean, tooltip: string } | { small_label: string, required: boolean, tooltip: string, minDate: string | null, maxDate: string | null, defaultDate: string | null, includeTime: boolean } | { html: string, plain: string, omitFromPdf: boolean } | { small_label: string, required: boolean, tooltip: string } | { file_type: Array, max_files: number, pdf_page_limit: number, small_label: string, required: boolean, tooltip: string } | { titlePlaceholder: string, questionLabel: string } | { small_label: string, required: boolean, tooltip: string, units: Array<{ id: string, unit: string, quantity: string, symbol: string, siConversionFormula: string }> } | { numberValueConstraint: NumberValueConstraint | null, small_label: string, required: boolean, tooltip: string, units: Array<{ id: string, unit: string, quantity: string, symbol: string, siConversionFormula: string }> } | { tooltip: string } | { tooltip: string } | { small_label: string, required: boolean, tooltip: string, max: number | null } | { titlePlaceholder: string } | { addEntryButtonLabel: string, minEntries: number | null, maxEntries: number | null, templateId: number | null, esiTemplateId: number | null, templateCategory: string, required: boolean, small_label: string } | { tooltip: string } | { variant: string, options: Array, isMultipleSelect: boolean, small_label: string, required: boolean, tooltip: string } | { small_label: string, required: boolean, tooltip: string } | { addEntryButtonLabel: string, minEntries: number | null, maxEntries: number | null, templateId: number | null, templateCategory: string, required: boolean, small_label: string } | { min: number | null, max: number | null, multiline: boolean, placeholder: string, small_label: string, required: boolean, tooltip: string, htmlQuestion: string | null, isHtmlQuestion: boolean, isCounterHidden: boolean } | { small_label: string, required: boolean, tooltip: string }, dependencies: Array<{ questionId: string, dependencyId: string, dependencyNaturalKey: string, condition: { condition: EvaluatorOperator, params: any } }> }> }> }, technicalReview: { id: number, comment: string | null, publicComment: string | null, timeAllocation: number | null, status: TechnicalReviewStatus | null, proposalPk: number, submitted: boolean, files: string | null, technicalReviewAssigneeId: number | null, technicalReviewAssignee: { id: number, firstname: string, lastname: string } | null } | null, reviews: Array<{ id: number, grade: number | null, comment: string | null, status: ReviewStatus, userID: number, sepID: number, reviewer: { firstname: string, lastname: string, id: number } | null }> | null, instrument: { id: number, name: string, shortCode: string } | null, call: { id: number, shortCode: string, isActive: boolean, referenceNumberFormat: string | null } | null, status: { id: number, shortCode: string, name: string, description: string, isDefault: boolean } | null, sepMeetingDecision: { proposalPk: number, recommendation: ProposalEndStatus | null, commentForUser: string | null, commentForManagement: string | null, rankOrder: number | null, submitted: boolean, submittedBy: number | null } | null }> | null, rejection: { reason: string, context: string | null, exception: string | null } | null } }; +export type CloneProposalsMutation = { cloneProposals: { proposals: Array<{ primaryKey: number, title: string, abstract: string, statusId: number, publicStatus: ProposalPublicStatus, proposalId: string, finalStatus: ProposalEndStatus | null, commentForUser: string | null, commentForManagement: string | null, created: any, updated: any, callId: number, questionaryId: number, notified: boolean, submitted: boolean, managementTimeAllocation: number | null, managementDecisionSubmitted: boolean, proposer: { id: number, firstname: string, lastname: string, preferredname: string | null, organisation: string, organizationId: number, position: string, created: any | null, placeholder: boolean | null, email: string | null } | null, users: Array<{ id: number, firstname: string, lastname: string, preferredname: string | null, organisation: string, organizationId: number, position: string, created: any | null, placeholder: boolean | null, email: string | null }>, questionary: { isCompleted: boolean, questionaryId: number, templateId: number, created: any, steps: Array<{ isCompleted: boolean, topic: { title: string, id: number, templateId: number, sortOrder: number, isEnabled: boolean }, fields: Array<{ answerId: number | null, sortOrder: number, topicId: number, dependenciesOperator: DependenciesLogicOperator | null, value: any | null, question: { id: string, question: string, naturalKey: string, dataType: DataType, categoryId: TemplateCategoryId, config: { small_label: string, required: boolean, tooltip: string } | { small_label: string, required: boolean, tooltip: string, minDate: string | null, maxDate: string | null, defaultDate: string | null, includeTime: boolean } | { html: string, plain: string, omitFromPdf: boolean } | { small_label: string, required: boolean, tooltip: string } | { file_type: Array, max_files: number, pdf_page_limit: number, small_label: string, required: boolean, tooltip: string } | { titlePlaceholder: string, questionLabel: string } | { small_label: string, required: boolean, tooltip: string, units: Array<{ id: string, unit: string, quantity: string, symbol: string, siConversionFormula: string }> } | { numberValueConstraint: NumberValueConstraint | null, small_label: string, required: boolean, tooltip: string, units: Array<{ id: string, unit: string, quantity: string, symbol: string, siConversionFormula: string }> } | { tooltip: string } | { tooltip: string } | { small_label: string, required: boolean, tooltip: string, max: number | null } | { titlePlaceholder: string } | { addEntryButtonLabel: string, minEntries: number | null, maxEntries: number | null, templateId: number | null, esiTemplateId: number | null, templateCategory: string, required: boolean, small_label: string } | { tooltip: string } | { variant: string, options: Array, isMultipleSelect: boolean, small_label: string, required: boolean, tooltip: string } | { small_label: string, required: boolean, tooltip: string } | { addEntryButtonLabel: string, minEntries: number | null, maxEntries: number | null, templateId: number | null, templateCategory: string, required: boolean, small_label: string } | { min: number | null, max: number | null, multiline: boolean, placeholder: string, small_label: string, required: boolean, tooltip: string, htmlQuestion: string | null, isHtmlQuestion: boolean, isCounterHidden: boolean } | { small_label: string, required: boolean, tooltip: string } }, config: { small_label: string, required: boolean, tooltip: string } | { small_label: string, required: boolean, tooltip: string, minDate: string | null, maxDate: string | null, defaultDate: string | null, includeTime: boolean } | { html: string, plain: string, omitFromPdf: boolean } | { small_label: string, required: boolean, tooltip: string } | { file_type: Array, max_files: number, pdf_page_limit: number, small_label: string, required: boolean, tooltip: string } | { titlePlaceholder: string, questionLabel: string } | { small_label: string, required: boolean, tooltip: string, units: Array<{ id: string, unit: string, quantity: string, symbol: string, siConversionFormula: string }> } | { numberValueConstraint: NumberValueConstraint | null, small_label: string, required: boolean, tooltip: string, units: Array<{ id: string, unit: string, quantity: string, symbol: string, siConversionFormula: string }> } | { tooltip: string } | { tooltip: string } | { small_label: string, required: boolean, tooltip: string, max: number | null } | { titlePlaceholder: string } | { addEntryButtonLabel: string, minEntries: number | null, maxEntries: number | null, templateId: number | null, esiTemplateId: number | null, templateCategory: string, required: boolean, small_label: string } | { tooltip: string } | { variant: string, options: Array, isMultipleSelect: boolean, small_label: string, required: boolean, tooltip: string } | { small_label: string, required: boolean, tooltip: string } | { addEntryButtonLabel: string, minEntries: number | null, maxEntries: number | null, templateId: number | null, templateCategory: string, required: boolean, small_label: string } | { min: number | null, max: number | null, multiline: boolean, placeholder: string, small_label: string, required: boolean, tooltip: string, htmlQuestion: string | null, isHtmlQuestion: boolean, isCounterHidden: boolean } | { small_label: string, required: boolean, tooltip: string }, dependencies: Array<{ questionId: string, dependencyId: string, dependencyNaturalKey: string, condition: { condition: EvaluatorOperator, params: any } }> }> }> }, technicalReview: { id: number, comment: string | null, publicComment: string | null, timeAllocation: number | null, status: TechnicalReviewStatus | null, proposalPk: number, submitted: boolean, files: string | null, technicalReviewAssigneeId: number | null, technicalReviewAssignee: { id: number, firstname: string, lastname: string } | null } | null, reviews: Array<{ id: number, grade: number | null, comment: string | null, status: ReviewStatus, userID: number, sepID: number, reviewer: { firstname: string, lastname: string, id: number } | null }> | null, instrument: { id: number, name: string, shortCode: string } | null, call: { id: number, shortCode: string, isActive: boolean, referenceNumberFormat: string | null, startCall: any, endCall: any } | null, status: { id: number, shortCode: string, name: string, description: string, isDefault: boolean } | null, sepMeetingDecision: { proposalPk: number, recommendation: ProposalEndStatus | null, commentForUser: string | null, commentForManagement: string | null, rankOrder: number | null, submitted: boolean, submittedBy: number | null } | null }> | null, rejection: { reason: string, context: string | null, exception: string | null } | null } }; export type CreateProposalMutationVariables = Exact<{ callId: Scalars['Int']; @@ -3954,7 +3956,7 @@ export type GetProposalQueryVariables = Exact<{ }>; -export type GetProposalQuery = { proposal: { primaryKey: number, title: string, abstract: string, statusId: number, publicStatus: ProposalPublicStatus, proposalId: string, finalStatus: ProposalEndStatus | null, commentForUser: string | null, commentForManagement: string | null, created: any, updated: any, callId: number, questionaryId: number, notified: boolean, submitted: boolean, managementTimeAllocation: number | null, managementDecisionSubmitted: boolean, proposer: { id: number, firstname: string, lastname: string, preferredname: string | null, organisation: string, organizationId: number, position: string, created: any | null, placeholder: boolean | null, email: string | null } | null, users: Array<{ id: number, firstname: string, lastname: string, preferredname: string | null, organisation: string, organizationId: number, position: string, created: any | null, placeholder: boolean | null, email: string | null }>, questionary: { isCompleted: boolean, questionaryId: number, templateId: number, created: any, steps: Array<{ isCompleted: boolean, topic: { title: string, id: number, templateId: number, sortOrder: number, isEnabled: boolean }, fields: Array<{ answerId: number | null, sortOrder: number, topicId: number, dependenciesOperator: DependenciesLogicOperator | null, value: any | null, question: { id: string, question: string, naturalKey: string, dataType: DataType, categoryId: TemplateCategoryId, config: { small_label: string, required: boolean, tooltip: string } | { small_label: string, required: boolean, tooltip: string, minDate: string | null, maxDate: string | null, defaultDate: string | null, includeTime: boolean } | { html: string, plain: string, omitFromPdf: boolean } | { small_label: string, required: boolean, tooltip: string } | { file_type: Array, max_files: number, pdf_page_limit: number, small_label: string, required: boolean, tooltip: string } | { titlePlaceholder: string, questionLabel: string } | { small_label: string, required: boolean, tooltip: string, units: Array<{ id: string, unit: string, quantity: string, symbol: string, siConversionFormula: string }> } | { numberValueConstraint: NumberValueConstraint | null, small_label: string, required: boolean, tooltip: string, units: Array<{ id: string, unit: string, quantity: string, symbol: string, siConversionFormula: string }> } | { tooltip: string } | { tooltip: string } | { small_label: string, required: boolean, tooltip: string, max: number | null } | { titlePlaceholder: string } | { addEntryButtonLabel: string, minEntries: number | null, maxEntries: number | null, templateId: number | null, esiTemplateId: number | null, templateCategory: string, required: boolean, small_label: string } | { tooltip: string } | { variant: string, options: Array, isMultipleSelect: boolean, small_label: string, required: boolean, tooltip: string } | { small_label: string, required: boolean, tooltip: string } | { addEntryButtonLabel: string, minEntries: number | null, maxEntries: number | null, templateId: number | null, templateCategory: string, required: boolean, small_label: string } | { min: number | null, max: number | null, multiline: boolean, placeholder: string, small_label: string, required: boolean, tooltip: string, htmlQuestion: string | null, isHtmlQuestion: boolean, isCounterHidden: boolean } | { small_label: string, required: boolean, tooltip: string } }, config: { small_label: string, required: boolean, tooltip: string } | { small_label: string, required: boolean, tooltip: string, minDate: string | null, maxDate: string | null, defaultDate: string | null, includeTime: boolean } | { html: string, plain: string, omitFromPdf: boolean } | { small_label: string, required: boolean, tooltip: string } | { file_type: Array, max_files: number, pdf_page_limit: number, small_label: string, required: boolean, tooltip: string } | { titlePlaceholder: string, questionLabel: string } | { small_label: string, required: boolean, tooltip: string, units: Array<{ id: string, unit: string, quantity: string, symbol: string, siConversionFormula: string }> } | { numberValueConstraint: NumberValueConstraint | null, small_label: string, required: boolean, tooltip: string, units: Array<{ id: string, unit: string, quantity: string, symbol: string, siConversionFormula: string }> } | { tooltip: string } | { tooltip: string } | { small_label: string, required: boolean, tooltip: string, max: number | null } | { titlePlaceholder: string } | { addEntryButtonLabel: string, minEntries: number | null, maxEntries: number | null, templateId: number | null, esiTemplateId: number | null, templateCategory: string, required: boolean, small_label: string } | { tooltip: string } | { variant: string, options: Array, isMultipleSelect: boolean, small_label: string, required: boolean, tooltip: string } | { small_label: string, required: boolean, tooltip: string } | { addEntryButtonLabel: string, minEntries: number | null, maxEntries: number | null, templateId: number | null, templateCategory: string, required: boolean, small_label: string } | { min: number | null, max: number | null, multiline: boolean, placeholder: string, small_label: string, required: boolean, tooltip: string, htmlQuestion: string | null, isHtmlQuestion: boolean, isCounterHidden: boolean } | { small_label: string, required: boolean, tooltip: string }, dependencies: Array<{ questionId: string, dependencyId: string, dependencyNaturalKey: string, condition: { condition: EvaluatorOperator, params: any } }> }> }> }, technicalReview: { id: number, comment: string | null, publicComment: string | null, timeAllocation: number | null, status: TechnicalReviewStatus | null, proposalPk: number, submitted: boolean, files: string | null, technicalReviewAssigneeId: number | null, reviewer: { id: number, firstname: string, lastname: string, preferredname: string | null, organisation: string, organizationId: number, position: string, created: any | null, placeholder: boolean | null, email: string | null } | null, technicalReviewAssignee: { id: number, firstname: string, lastname: string } | null } | null, reviews: Array<{ id: number, grade: number | null, comment: string | null, status: ReviewStatus, userID: number, sepID: number, reviewer: { firstname: string, lastname: string, id: number } | null }> | null, instrument: { id: number, name: string, shortCode: string, beamlineManager: { id: number, firstname: string, lastname: string } | null, scientists: Array<{ id: number, firstname: string, lastname: string }> } | null, call: { id: number, shortCode: string, isActive: boolean, allocationTimeUnit: AllocationTimeUnits, referenceNumberFormat: string | null } | null, sep: { id: number, code: string } | null, samples: Array<{ id: number, title: string, creatorId: number, questionaryId: number, safetyStatus: SampleStatus, safetyComment: string, isPostProposalSubmission: boolean, created: any, proposalPk: number, questionId: string, questionary: { isCompleted: boolean } }> | null, genericTemplates: Array<{ id: number, title: string, creatorId: number, questionaryId: number, created: any, proposalPk: number, questionId: string, questionary: { isCompleted: boolean } }> | null, status: { id: number, shortCode: string, name: string, description: string, isDefault: boolean } | null, sepMeetingDecision: { proposalPk: number, recommendation: ProposalEndStatus | null, commentForUser: string | null, commentForManagement: string | null, rankOrder: number | null, submitted: boolean, submittedBy: number | null } | null } | null }; +export type GetProposalQuery = { proposal: { primaryKey: number, title: string, abstract: string, statusId: number, publicStatus: ProposalPublicStatus, proposalId: string, finalStatus: ProposalEndStatus | null, commentForUser: string | null, commentForManagement: string | null, created: any, updated: any, callId: number, questionaryId: number, notified: boolean, submitted: boolean, managementTimeAllocation: number | null, managementDecisionSubmitted: boolean, proposer: { id: number, firstname: string, lastname: string, preferredname: string | null, organisation: string, organizationId: number, position: string, created: any | null, placeholder: boolean | null, email: string | null } | null, users: Array<{ id: number, firstname: string, lastname: string, preferredname: string | null, organisation: string, organizationId: number, position: string, created: any | null, placeholder: boolean | null, email: string | null }>, questionary: { isCompleted: boolean, questionaryId: number, templateId: number, created: any, steps: Array<{ isCompleted: boolean, topic: { title: string, id: number, templateId: number, sortOrder: number, isEnabled: boolean }, fields: Array<{ answerId: number | null, sortOrder: number, topicId: number, dependenciesOperator: DependenciesLogicOperator | null, value: any | null, question: { id: string, question: string, naturalKey: string, dataType: DataType, categoryId: TemplateCategoryId, config: { small_label: string, required: boolean, tooltip: string } | { small_label: string, required: boolean, tooltip: string, minDate: string | null, maxDate: string | null, defaultDate: string | null, includeTime: boolean } | { html: string, plain: string, omitFromPdf: boolean } | { small_label: string, required: boolean, tooltip: string } | { file_type: Array, max_files: number, pdf_page_limit: number, small_label: string, required: boolean, tooltip: string } | { titlePlaceholder: string, questionLabel: string } | { small_label: string, required: boolean, tooltip: string, units: Array<{ id: string, unit: string, quantity: string, symbol: string, siConversionFormula: string }> } | { numberValueConstraint: NumberValueConstraint | null, small_label: string, required: boolean, tooltip: string, units: Array<{ id: string, unit: string, quantity: string, symbol: string, siConversionFormula: string }> } | { tooltip: string } | { tooltip: string } | { small_label: string, required: boolean, tooltip: string, max: number | null } | { titlePlaceholder: string } | { addEntryButtonLabel: string, minEntries: number | null, maxEntries: number | null, templateId: number | null, esiTemplateId: number | null, templateCategory: string, required: boolean, small_label: string } | { tooltip: string } | { variant: string, options: Array, isMultipleSelect: boolean, small_label: string, required: boolean, tooltip: string } | { small_label: string, required: boolean, tooltip: string } | { addEntryButtonLabel: string, minEntries: number | null, maxEntries: number | null, templateId: number | null, templateCategory: string, required: boolean, small_label: string } | { min: number | null, max: number | null, multiline: boolean, placeholder: string, small_label: string, required: boolean, tooltip: string, htmlQuestion: string | null, isHtmlQuestion: boolean, isCounterHidden: boolean } | { small_label: string, required: boolean, tooltip: string } }, config: { small_label: string, required: boolean, tooltip: string } | { small_label: string, required: boolean, tooltip: string, minDate: string | null, maxDate: string | null, defaultDate: string | null, includeTime: boolean } | { html: string, plain: string, omitFromPdf: boolean } | { small_label: string, required: boolean, tooltip: string } | { file_type: Array, max_files: number, pdf_page_limit: number, small_label: string, required: boolean, tooltip: string } | { titlePlaceholder: string, questionLabel: string } | { small_label: string, required: boolean, tooltip: string, units: Array<{ id: string, unit: string, quantity: string, symbol: string, siConversionFormula: string }> } | { numberValueConstraint: NumberValueConstraint | null, small_label: string, required: boolean, tooltip: string, units: Array<{ id: string, unit: string, quantity: string, symbol: string, siConversionFormula: string }> } | { tooltip: string } | { tooltip: string } | { small_label: string, required: boolean, tooltip: string, max: number | null } | { titlePlaceholder: string } | { addEntryButtonLabel: string, minEntries: number | null, maxEntries: number | null, templateId: number | null, esiTemplateId: number | null, templateCategory: string, required: boolean, small_label: string } | { tooltip: string } | { variant: string, options: Array, isMultipleSelect: boolean, small_label: string, required: boolean, tooltip: string } | { small_label: string, required: boolean, tooltip: string } | { addEntryButtonLabel: string, minEntries: number | null, maxEntries: number | null, templateId: number | null, templateCategory: string, required: boolean, small_label: string } | { min: number | null, max: number | null, multiline: boolean, placeholder: string, small_label: string, required: boolean, tooltip: string, htmlQuestion: string | null, isHtmlQuestion: boolean, isCounterHidden: boolean } | { small_label: string, required: boolean, tooltip: string }, dependencies: Array<{ questionId: string, dependencyId: string, dependencyNaturalKey: string, condition: { condition: EvaluatorOperator, params: any } }> }> }> }, technicalReview: { id: number, comment: string | null, publicComment: string | null, timeAllocation: number | null, status: TechnicalReviewStatus | null, proposalPk: number, submitted: boolean, files: string | null, technicalReviewAssigneeId: number | null, reviewer: { id: number, firstname: string, lastname: string, preferredname: string | null, organisation: string, organizationId: number, position: string, created: any | null, placeholder: boolean | null, email: string | null } | null, technicalReviewAssignee: { id: number, firstname: string, lastname: string } | null } | null, reviews: Array<{ id: number, grade: number | null, comment: string | null, status: ReviewStatus, userID: number, sepID: number, reviewer: { firstname: string, lastname: string, id: number } | null }> | null, instrument: { id: number, name: string, shortCode: string, beamlineManager: { id: number, firstname: string, lastname: string } | null, scientists: Array<{ id: number, firstname: string, lastname: string }> } | null, call: { id: number, shortCode: string, isActive: boolean, allocationTimeUnit: AllocationTimeUnits, referenceNumberFormat: string | null, startCall: any, endCall: any } | null, sep: { id: number, code: string } | null, samples: Array<{ id: number, title: string, creatorId: number, questionaryId: number, safetyStatus: SampleStatus, safetyComment: string, isPostProposalSubmission: boolean, created: any, proposalPk: number, questionId: string, questionary: { isCompleted: boolean } }> | null, genericTemplates: Array<{ id: number, title: string, creatorId: number, questionaryId: number, created: any, proposalPk: number, questionId: string, questionary: { isCompleted: boolean } }> | null, status: { id: number, shortCode: string, name: string, description: string, isDefault: boolean } | null, sepMeetingDecision: { proposalPk: number, recommendation: ProposalEndStatus | null, commentForUser: string | null, commentForManagement: string | null, rankOrder: number | null, submitted: boolean, submittedBy: number | null } | null } | null }; export type GetProposalsQueryVariables = Exact<{ filter?: InputMaybe; @@ -4908,7 +4910,7 @@ export type GetUserMeQuery = { me: { user_title: string, username: string, first export type GetUserProposalsQueryVariables = Exact<{ [key: string]: never; }>; -export type GetUserProposalsQuery = { me: { proposals: Array<{ primaryKey: number, proposalId: string, title: string, publicStatus: ProposalPublicStatus, statusId: number, created: any, finalStatus: ProposalEndStatus | null, notified: boolean, submitted: boolean, status: { id: number, shortCode: string, name: string, description: string, isDefault: boolean } | null, proposer: { id: number } | null, call: { id: number, shortCode: string, isActive: boolean, referenceNumberFormat: string | null } | null }> } | null }; +export type GetUserProposalsQuery = { me: { proposals: Array<{ primaryKey: number, proposalId: string, title: string, publicStatus: ProposalPublicStatus, statusId: number, created: any, finalStatus: ProposalEndStatus | null, notified: boolean, submitted: boolean, status: { id: number, shortCode: string, name: string, description: string, isDefault: boolean } | null, proposer: { id: number } | null, call: { id: number, shortCode: string, isActive: boolean, referenceNumberFormat: string | null, startCall: any, endCall: any } | null }> } | null }; export type GetUserWithRolesQueryVariables = Exact<{ id: Scalars['Int']; @@ -5192,6 +5194,7 @@ export const CallFragmentDoc = gql` title description submissionMessage + isActive } ${BasicUserDetailsFragmentDoc}`; export const EsiFragmentDoc = gql` @@ -6404,9 +6407,9 @@ export const RemoveAssignedInstrumentFromCallDocument = gql` } ${RejectionFragmentDoc}`; export const UpdateCallDocument = gql` - mutation updateCall($id: Int!, $shortCode: String!, $startCall: DateTime!, $endCall: DateTime!, $startReview: DateTime!, $endReview: DateTime!, $startSEPReview: DateTime, $endSEPReview: DateTime, $startNotify: DateTime!, $endNotify: DateTime!, $startCycle: DateTime!, $endCycle: DateTime!, $cycleComment: String!, $submissionMessage: String, $surveyComment: String!, $allocationTimeUnit: AllocationTimeUnits!, $referenceNumberFormat: String, $proposalWorkflowId: Int!, $templateId: Int!, $esiTemplateId: Int, $title: String, $description: String, $seps: [Int!]) { + mutation updateCall($id: Int!, $shortCode: String!, $startCall: DateTime!, $endCall: DateTime!, $startReview: DateTime!, $endReview: DateTime!, $startSEPReview: DateTime, $endSEPReview: DateTime, $startNotify: DateTime!, $endNotify: DateTime!, $startCycle: DateTime!, $endCycle: DateTime!, $cycleComment: String!, $submissionMessage: String, $surveyComment: String!, $allocationTimeUnit: AllocationTimeUnits!, $referenceNumberFormat: String, $proposalWorkflowId: Int!, $templateId: Int!, $esiTemplateId: Int, $title: String, $description: String, $isActive: Boolean, $seps: [Int!]) { updateCall( - updateCallInput: {id: $id, shortCode: $shortCode, startCall: $startCall, endCall: $endCall, startReview: $startReview, endReview: $endReview, startSEPReview: $startSEPReview, endSEPReview: $endSEPReview, startNotify: $startNotify, endNotify: $endNotify, startCycle: $startCycle, endCycle: $endCycle, cycleComment: $cycleComment, submissionMessage: $submissionMessage, surveyComment: $surveyComment, allocationTimeUnit: $allocationTimeUnit, referenceNumberFormat: $referenceNumberFormat, proposalWorkflowId: $proposalWorkflowId, templateId: $templateId, esiTemplateId: $esiTemplateId, title: $title, description: $description, seps: $seps} + updateCallInput: {id: $id, shortCode: $shortCode, startCall: $startCall, endCall: $endCall, startReview: $startReview, endReview: $endReview, startSEPReview: $startSEPReview, endSEPReview: $endSEPReview, startNotify: $startNotify, endNotify: $endNotify, startCycle: $startCycle, endCycle: $endCycle, cycleComment: $cycleComment, submissionMessage: $submissionMessage, surveyComment: $surveyComment, allocationTimeUnit: $allocationTimeUnit, referenceNumberFormat: $referenceNumberFormat, proposalWorkflowId: $proposalWorkflowId, templateId: $templateId, esiTemplateId: $esiTemplateId, title: $title, description: $description, isActive: $isActive, seps: $seps} ) { rejection { ...rejection @@ -6896,6 +6899,8 @@ export const CloneProposalsDocument = gql` shortCode isActive referenceNumberFormat + startCall + endCall } } rejection { @@ -7054,6 +7059,8 @@ export const GetProposalDocument = gql` isActive allocationTimeUnit referenceNumberFormat + startCall + endCall } sep { id @@ -8829,6 +8836,8 @@ export const GetUserProposalsDocument = gql` shortCode isActive referenceNumberFormat + startCall + endCall } } } diff --git a/src/graphql/call/fragment.call.graphql b/src/graphql/call/fragment.call.graphql index e60899685..6cbdec02f 100644 --- a/src/graphql/call/fragment.call.graphql +++ b/src/graphql/call/fragment.call.graphql @@ -17,7 +17,7 @@ fragment call on Call { proposalWorkflowId templateId esiTemplateId - allocationTimeUnit + allocationTimeUnit instruments { id name @@ -47,4 +47,5 @@ fragment call on Call { title description submissionMessage + isActive } diff --git a/src/graphql/call/updateCall.graphql b/src/graphql/call/updateCall.graphql index d35395ba9..f32b075e3 100644 --- a/src/graphql/call/updateCall.graphql +++ b/src/graphql/call/updateCall.graphql @@ -21,6 +21,7 @@ mutation updateCall( $esiTemplateId: Int $title: String $description: String + $isActive: Boolean $seps: [Int!] ) { updateCall( @@ -47,6 +48,7 @@ mutation updateCall( esiTemplateId: $esiTemplateId title: $title description: $description + isActive: $isActive seps: $seps } ) { diff --git a/src/graphql/proposal/cloneProposals.graphql b/src/graphql/proposal/cloneProposals.graphql index f275e99a7..dd0d3e58a 100644 --- a/src/graphql/proposal/cloneProposals.graphql +++ b/src/graphql/proposal/cloneProposals.graphql @@ -43,6 +43,8 @@ mutation cloneProposals($proposalsToClonePk: [Int!]!, $callId: Int!) { shortCode isActive referenceNumberFormat + startCall + endCall } } rejection { diff --git a/src/graphql/proposal/getProposal.graphql b/src/graphql/proposal/getProposal.graphql index 7797e682b..769f9a6a4 100644 --- a/src/graphql/proposal/getProposal.graphql +++ b/src/graphql/proposal/getProposal.graphql @@ -51,6 +51,8 @@ query getProposal($primaryKey: Int!) { isActive allocationTimeUnit referenceNumberFormat + startCall + endCall } sep { id diff --git a/src/graphql/user/getUserProposals.graphql b/src/graphql/user/getUserProposals.graphql index 4e6b12724..3682dafb8 100644 --- a/src/graphql/user/getUserProposals.graphql +++ b/src/graphql/user/getUserProposals.graphql @@ -21,6 +21,8 @@ query getUserProposals { shortCode isActive referenceNumberFormat + startCall + endCall } } } diff --git a/src/models/questionary/proposal/ProposalWithQuestionary.ts b/src/models/questionary/proposal/ProposalWithQuestionary.ts index 9d87ef9c2..d016786af 100644 --- a/src/models/questionary/proposal/ProposalWithQuestionary.ts +++ b/src/models/questionary/proposal/ProposalWithQuestionary.ts @@ -20,7 +20,11 @@ export type ProposalWithQuestionary = Pick< | 'callId' | 'questionaryId' | 'submitted' -> & { call?: Maybe> } & { +> & { + call?: Maybe< + Pick + >; +} & { samples: Maybe< (SampleFragment & { questionary: Pick })[] >; diff --git a/src/utils/helperFunctions.ts b/src/utils/helperFunctions.ts index f9f68470f..aa6b5f42a 100644 --- a/src/utils/helperFunctions.ts +++ b/src/utils/helperFunctions.ts @@ -5,7 +5,12 @@ import { } from '@user-office-software/duo-localisation'; import { SortDirectionType } from 'components/common/SuperMaterialTable'; -import { Proposal, ProposalEndStatus, ProposalStatus } from 'generated/sdk'; +import { + Proposal, + ProposalEndStatus, + ProposalStatus, + Scalars, +} from 'generated/sdk'; import { ProposalViewData } from 'hooks/proposal/useProposalsCoreData'; import { @@ -120,3 +125,14 @@ export const removeColumns = ( } }); }; + +export const isCallEnded = ( + startDate: Scalars['DateTime'], + endDate: Scalars['DateTime'] +) => { + const now = new Date(); + const startCall = new Date(startDate); + const endCall = new Date(endDate); + + return startCall >= now || endCall <= now; +};