diff options
author | MikunoNaka <bokuwakanojogahoshii@yahoo.com> | 2021-07-02 20:00:14 +0530 |
---|---|---|
committer | MikunoNaka <bokuwakanojogahoshii@yahoo.com> | 2021-07-02 20:00:14 +0530 |
commit | 748e70a86633c8bb3ba57a5136ed55bbaebe9c4c (patch) | |
tree | 009f13c46f9e15012db379451ada548f91b5ec37 /src/components/Form/Document/DocumentInfoForm.tsx | |
parent | e946f0e51cbe72cec6bdf599c8ee9c1be1f64e0b (diff) |
added reset buttons to the form
Diffstat (limited to 'src/components/Form/Document/DocumentInfoForm.tsx')
-rw-r--r-- | src/components/Form/Document/DocumentInfoForm.tsx | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/components/Form/Document/DocumentInfoForm.tsx b/src/components/Form/Document/DocumentInfoForm.tsx index 6193233..18d0be5 100644 --- a/src/components/Form/Document/DocumentInfoForm.tsx +++ b/src/components/Form/Document/DocumentInfoForm.tsx @@ -8,10 +8,13 @@ import React, { useState } from "react"; import { Person } from "./../../../interfaces"; +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' +import { faSync } from '@fortawesome/free-solid-svg-icons' import "./../Form.scss"; import SelectClientForm from "./../People/SelectClientForm"; + interface Props { savedPeople: Person[] invoiceNumber: number @@ -29,9 +32,19 @@ const DocumentInfoForm: React.FC<Props> = (props) => { <div className={"documentInfoChild"}> <label> Invoice Number: - <input className={"smallInputBox"} type="number" step="0.0" value={invoiceNumber} onInput={ - (event: React.FormEvent<HTMLInputElement>) => setInvoiceNumber(parseInt(event.currentTarget.value)) - } required /> + <span className={"buttonInput"}> + {invoiceNumber === props.invoiceNumber || + <FontAwesomeIcon icon={faSync} className={"icon"} onClick={ + (event) => { + event.preventDefault(); // don't select the input box + setInvoiceNumber(props.invoiceNumber); + } + }/> + } + <input className={"smallInputBox"} type="number" step="0.0" value={invoiceNumber} + onInput={(event: React.FormEvent<HTMLInputElement>) => setInvoiceNumber(parseInt(event.currentTarget.value))} + required /> + </span> </label> <label> |