• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

baltimorecounty / react-transient-tax / 4329464609

pending completion
4329464609

push

github

GitHub
Bump minimist, mkdirp and loader-fs-cache

61 of 445 branches covered (13.71%)

Branch coverage included in aggregate %.

291 of 802 relevant lines covered (36.28%)

1.06 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

4.17
/src/components/forms/ReviewFormPanel.jsx
1
import React, { useState } from "react";
2

3
import { GetReturnSummaryValues } from "../../data/TaxReturnMapper";
4
import { Labels } from "../../common/Constants";
5
import { MapResponseDataForTaxReturn } from "../../data/TaxReturnMapper";
6
import ReturnSummary from "../ReturnSummary";
7
import { SaveReturn } from "../../services/ApiService";
8

9
const ReviewFormPanel = props => {
1✔
10
  const [isSubmitting, setIsSubmitting] = useState(false);
×
11
  const { submitButton, prevButton, history, formik } = props;
×
12

13
  const { values } = formik;
×
14
  const {
15
    returnStatus: { dueDate } = {},
×
16
    paymentInterval
17
  } = values.monthsToReport;
×
18

19
  /** Fix for crypto in IE11 : https://stackoverflow.com/questions/44042816/what-is-wrong-with-crypto-getrandomvalues-in-internet-explorer-11 */
20
  var crypto = window.crypto || window.msCrypto;
×
21
  /** Helper to generate a unique id for confirmation number */
22
  const generateConfirmationNumberId = () => {
×
23
    return ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, c =>
×
24
      (
×
25
        c ^
26
        (crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (c / 4)))
27
      ).toString(16)
28
    );
29
  };
30

31
  const handleSubmit = () => {
×
32
    setIsSubmitting(true);
×
33
    SaveReturn(values).then(({ ConfirmationNumber = 0 }) => {
×
34
      history.push(
×
35
        `/confirmation/${generateConfirmationNumberId()}-${ConfirmationNumber}`
36
      );
37
    });
38
  };
39

40
  const mappedValues = MapResponseDataForTaxReturn(values);
×
41
  const taxReturnValues = GetReturnSummaryValues(mappedValues);
×
42
  return (
×
43
    <form onSubmit={handleSubmit}>
44
      <ReturnSummary
45
        header={"Transient Occupancy Tax Return Details:"}
46
        values={taxReturnValues}
47
        dueDate={dueDate}
48
        paymentInterval={paymentInterval}
49
      />
50
      <label>{Labels.LegalNote}</label>
51
      {!isSubmitting && (
×
52
        <div className="tt_form-controls">
53
          {prevButton}
54
          {submitButton}
55
        </div>
56
      )}
57
      {isSubmitting && (
×
58
        <p>
59
          Submitting your return. You will be redirected to a confirmation page
60
          shortly...
61
        </p>
62
      )}
63
    </form>
64
  );
65
};
66

67
export default ReviewFormPanel;
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc