Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | 1x 13x 13x 13x 13x 13x 13x 13x 24x 13x 13x 13x 1x 1x 1x 1x 13x 2x 24x 24x | import { useState } from "react"; import { Form, Button, Container, Row, Col } from "react-bootstrap"; import { quarterRange } from "main/utils/quarterUtilities"; import { useSystemInfo } from "main/utils/systemInfo"; import SingleQuarterDropdown from "../Quarters/SingleQuarterDropdown"; import { useBackend } from "main/utils/useBackend"; import { yyyyqToQyy } from "main/utils/quarterUtilities"; const GEAreaSearchForm = ({ fetchJSON }) => { const { data: systemInfo } = useSystemInfo(); const quarters = quarterRange( systemInfo.startQtrYYYYQ, systemInfo.endQtrYYYYQ, ); const quarterKey = "GEAreaSearch.Quarter"; const areaKey = "GEAreaSearch.Area"; const localQuarter = localStorage.getItem(quarterKey); const localArea = localStorage.getItem(areaKey); const { data: areas, _error, _status, } = useBackend( ["/api/public/generalEducationInfo"], { method: "GET", url: "/api/public/generalEducationInfo" }, [], ); const areaCodes = areas.map((r) => r.requirementCode); const [quarter, setQuarter] = useState(localQuarter || quarters[0].yyyyq); const [area, setArea] = useState(localArea || "ALL"); const handleSubmit = (event) => { event.preventDefault(); localStorage.setItem(quarterKey, quarter); localStorage.setItem(areaKey, area); fetchJSON(event, { quarter, area }); }; return ( <Form onSubmit={handleSubmit}> <Container> <Row> <Col md="auto"> <SingleQuarterDropdown quarters={quarters} quarter={quarter} setQuarter={setQuarter} controlId={quarterKey} /> <Form.Group controlId={areaKey}> <Form.Label>General Education Area</Form.Label> <Form.Control as="select" value={area} onChange={(e) => setArea(e.target.value)} > <option data-testid="GEAreaSearch.Area-option-all" value="ALL"> ALL </option> {areaCodes.map((code) => { const testid = `GEAreaSearch.Area-option-${code}`; return ( <option key={code} data-testid={testid} value={code}> {code} </option> ); })} </Form.Control> </Form.Group> </Col> </Row> <Row className="my-2" data-testid="GEAreaSearch.ButtonRow"> <Col md="auto"> <Button variant="primary" type="submit"> Submit </Button> </Col> <Col> <p data-testid="GEAreaSearch.Status"> Searching for {area} in {yyyyqToQyy(quarter)} </p> </Col> </Row> </Container> </Form> ); }; export default GEAreaSearchForm; |