Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Network Error Flow #285

Merged
merged 1 commit into from
Feb 14, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import "react-toastify/dist/ReactToastify.css";
import { FormIDApi } from "../../api/formIDApi";
import { Alert } from "react-bootstrap";
import Warning from "@mui/icons-material/Warning";
import { ArrowBack, Error } from "@mui/icons-material";
import { ArrowBack, Error, Refresh } from "@mui/icons-material";
import { useKeycloak } from "@react-keycloak/web";
const { v4: uuidv4 } = require("uuid");

Expand Down Expand Up @@ -296,7 +296,7 @@ export const CreateEvent = () => {
};

const onSubmit = async (values) => {
setIsSubmitting(true);
await setIsSubmitting(true);
if (values["VI"]) {
const element = document.getElementById("VI");
const base64_png = await toPng(element);
Expand Down Expand Up @@ -410,10 +410,11 @@ export const CreateEvent = () => {
<Button
variant="primary"
onClick={() => {
window.print();
onSubmit(values);
}}
>
Print Police Version for Manual Submission
<Refresh />
&nbsp; Retry Submission
</Button>
);
}
Expand Down Expand Up @@ -918,7 +919,7 @@ export const CreateEvent = () => {
<ToastContainer />
<Modal
id="spinner-modal"
show={isSubmitting && !eventCreationFailed}
show={isSubmitting}
aria-labelledby="contained-modal-title-vcenter"
centered
>
Expand Down Expand Up @@ -1144,6 +1145,7 @@ export const CreateEvent = () => {
<Modal
show={eventCreationFailedModalOpen}
backdrop="static"
size="lg"
centered
>
<Modal.Header
Expand All @@ -1159,36 +1161,55 @@ export const CreateEvent = () => {
marginBottom: "5px",
}}
/>
<h3 style={{ color: "white" }}>Unable to Save Form</h3>
<h3 style={{ color: "white" }}>Unable to Submit Form</h3>
</Modal.Header>
<Modal.Body>
<p>
Form could not be saved and submitted due to a fatal network
error. As such, this form will not appear in your list of
Completed forms. Please click "Print Police Version for
Manual Submission" below to print hard copies of the form(s)
and handle as per existing paper process.
<div>
The form could not be submitted or electronically
delivered to ICBC due to a fatal network error.
</div>
<div>
Options:
<ul>
<li>
Try moving this computer to an area with better
network reception; <i>or</i>
</li>
<li>
Abandon the Digital Forms process and re-serve the
document (including DRIVER and ILO copies) using a
handwritten paper form.
</li>
</ul>
</div>
<strong>
Important! ICBC is no longer accepting printed copies of
12-hour and 24-hour forms. The forms MUST be handwritten
to be submitted via the existing paper process.
</strong>
</p>
<Checkbox
name="acknowledgement_checkbox"
onClick={(event) => {
setMessageAcknowledged(event.target.checked);
}}
>
I will manually submit the printed form(s) and understand
that no form data could be saved to the server.
</Checkbox>
</Modal.Body>
<Modal.Footer>
<Button
variant="danger"
onClick={async () => {
await setisBlockerActive(false);
navigate("/");
}}
>
<Warning />
&nbsp; Abandon Document and Return to Dashboard
</Button>
<Button
variant="primary"
disabled={!messageAcknowledged}
onClick={async () => {
await setEventCreationFailedModalOpen(false);
window.print();
await onSubmit(values);
}}
>
Print Police Version for Manual Submission
<Refresh />
&nbsp; Retry Submission
</Button>
</Modal.Footer>
</Modal>
Expand Down
Loading