-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2026 from bcgov/re-unite-orphaned-RFI-files
Re unite orphaned rfi files
- Loading branch information
Showing
10 changed files
with
445 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
import { Button } from '@button-inc/bcgov-theme'; | ||
import { ISubmitEvent } from '@rjsf/core'; | ||
import { FormDiv } from 'components'; | ||
import { RfiTheme } from 'components/Analyst/RFI'; | ||
import { RfiFormStatus, FormBase } from 'components/Form'; | ||
import { rfiSchema } from 'formSchema/analyst'; | ||
import { rfiAnalystUiSchema } from 'formSchema/uiSchema/analyst/rfiUiSchema'; | ||
import { useRouter } from 'next/router'; | ||
import { useUpdateWithTrackingRfiMutation } from 'schema/mutations/application/updateWithTrackingRfiMutation'; | ||
import styled from 'styled-components'; | ||
|
||
const Flex = styled('header')` | ||
display: flex; | ||
justify-content: space-between; | ||
width: 100%; | ||
`; | ||
|
||
const RfiAnalystUpload = ({ rfiQuery }) => { | ||
// const query = usePreloadedQuery(rfiQuery, preloadedQuery); | ||
const { rfiDataByRowId, applicationByRowId } = rfiQuery; | ||
const [updateRfi] = useUpdateWithTrackingRfiMutation(); | ||
const router = useRouter(); | ||
|
||
const handleSubmit = (e: ISubmitEvent<any>) => { | ||
updateRfi({ | ||
variables: { | ||
input: { | ||
jsonData: e.formData, | ||
rfiRowId: rfiDataByRowId.rowId, | ||
}, | ||
}, | ||
onCompleted: () => { | ||
router.push(`/analyst/application/${router.query.applicationId}/rfi`); | ||
}, | ||
onError: (err) => { | ||
// eslint-disable-next-line no-console | ||
console.log('Error updating RFI', err); | ||
}, | ||
}); | ||
}; | ||
|
||
return ( | ||
<div> | ||
<Flex> | ||
<div> | ||
<h2>Upload new files</h2> | ||
{rfiDataByRowId?.jsonData.rfiDueBy && ( | ||
<p> | ||
Please upload the following files by{' '} | ||
{rfiDataByRowId?.jsonData.rfiDueBy} | ||
</p> | ||
)} | ||
</div> | ||
<RfiFormStatus application={applicationByRowId} isSaving={false} /> | ||
</Flex> | ||
<FormDiv> | ||
<FormBase | ||
theme={RfiTheme} | ||
schema={rfiSchema} | ||
uiSchema={rfiAnalystUiSchema} | ||
omitExtraData={false} | ||
formData={rfiDataByRowId?.jsonData} | ||
onSubmit={handleSubmit} | ||
noValidate | ||
> | ||
<Button>Save</Button> | ||
</FormBase> | ||
</FormDiv> | ||
</div> | ||
); | ||
}; | ||
|
||
export default RfiAnalystUpload; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.