-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Merge pull request #490 from bcgov/bf-revert-5.5-2"
- Loading branch information
Showing
13 changed files
with
435 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
import React, { useEffect } from "react"; | ||
import { useForm } from "react-hook-form"; | ||
import { useSelector, useDispatch } from "react-redux"; | ||
import { Row, Col, Form, Button } from "react-bootstrap"; | ||
|
||
import DocGenDownloadBar from "../../components/DocGenDownloadBar"; | ||
|
||
import { | ||
generateReport, | ||
fetchReportJob, | ||
selectReportsJob, | ||
completeReportJob, | ||
startLicenceCommentsJob, | ||
} from "./reportsSlice"; | ||
|
||
import { REPORTS } from "../../utilities/constants"; | ||
|
||
export default function ReportLicenceComments() { | ||
const dispatch = useDispatch(); | ||
|
||
const job = useSelector(selectReportsJob); | ||
const { pendingDocuments } = job; | ||
|
||
const form = useForm({ | ||
reValidateMode: "onBlur", | ||
}); | ||
const { register, watch } = form; | ||
|
||
const watchLicenceNumber = watch("licenceNumber", null); | ||
|
||
useEffect(() => { | ||
if (job.id && job.type === REPORTS.LICENCE_COMMENTS) { | ||
dispatch(fetchReportJob()); | ||
|
||
if (pendingDocuments?.length > 0) { | ||
dispatch(generateReport(pendingDocuments[0].documentId)); | ||
} else { | ||
dispatch(completeReportJob(job.id)); | ||
} | ||
} | ||
}, [pendingDocuments]); // eslint-disable-line react-hooks/exhaustive-deps | ||
|
||
const onGenerateReport = () => { | ||
dispatch( | ||
startLicenceCommentsJob({ | ||
licenceNumber: watchLicenceNumber, | ||
}) | ||
); | ||
}; | ||
|
||
return ( | ||
<> | ||
<Row> | ||
<Col lg={3}> | ||
<Form.Label>Licence Number</Form.Label> | ||
<Form.Control | ||
id="licenceNumber" | ||
type="text" | ||
name="licenceNumber" | ||
defaultValue={null} | ||
{...register("licenceNumber")} | ||
/> | ||
</Col> | ||
<Col sm={2}> | ||
<Form.Label> </Form.Label> | ||
<Button | ||
variant="primary" | ||
type="button" | ||
onClick={() => onGenerateReport()} | ||
block | ||
> | ||
Generate Report | ||
</Button> | ||
</Col> | ||
</Row> | ||
<div className="mt-3"> | ||
<DocGenDownloadBar job={job} /> | ||
</div> | ||
</> | ||
); | ||
} | ||
|
||
ReportLicenceComments.propTypes = {}; |
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
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
Binary file not shown.
Binary file modified
BIN
+528 Bytes
(100%)
app/server/static/templates/certificates/Purchase-Live-Poultry.docx
Binary file not shown.
Binary file modified
BIN
+123 Bytes
(100%)
app/server/static/templates/reports/Dairy_Test_Threshold_Template.xlsx
Binary file not shown.
Binary file not shown.
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
Oops, something went wrong.