CEC-2920 Aftersales certificates (#225)

* CEC-2920 aftersales certificates

* smells

* smells
This commit is contained in:
John Wu
2022-10-25 11:00:50 -07:00
committed by GitHub
parent 58890ea40e
commit aaf47f4cc7
7 changed files with 231 additions and 31 deletions

View File

@@ -1,4 +1,3 @@
import React, { useRef, useState } from "react";
import {
Button,
FormControlLabel,
@@ -7,13 +6,15 @@ import {
RadioGroup,
TextField,
} from "@material-ui/core";
import React, { useRef, useState } from "react";
import { CertTypeData, CertTypes } from "../../../utils/certificates";
import useStyles from "../../useStyles";
import { CertTypes } from "../../Contexts/CertificateContext";
const getCertTypeLabel = (certtype) => {
if (certtype === CertTypes.Aftersales) return "Service Tool ID";
return "VIN";
const item = CertTypeData.find((item) => certtype === item.value);
if (item !== null) return item.inputlabel;
return "ID";
};
const CreateForm = ({ onCreate, busy }) => {
@@ -60,21 +61,16 @@ const CreateForm = ({ onCreate, busy }) => {
onChange={onCertTypeChange}
margin="normal"
>
<FormControlLabel
value={CertTypes.TBOX}
control={<Radio />}
label="TBOX"
/>
<FormControlLabel
value={CertTypes.ICC}
control={<Radio />}
label="ICC"
/>
<FormControlLabel
value={CertTypes.Charging}
control={<Radio />}
label="Charging"
/>
{CertTypeData.map((item, i) => {
return (
<FormControlLabel
key={i}
value={item.value}
label={item.label}
control={<Radio />}
/>
);
})}
</RadioGroup>
<Button
type="submit"