From 748e70a86633c8bb3ba57a5136ed55bbaebe9c4c Mon Sep 17 00:00:00 2001
From: MikunoNaka <bokuwakanojogahoshii@yahoo.com>
Date: Fri, 2 Jul 2021 20:00:14 +0530
Subject: added reset buttons to the form

---
 src/components/Form/Document/DocumentInfoForm.tsx | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

(limited to 'src/components/Form/Document/DocumentInfoForm.tsx')

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>
-- 
cgit v1.2.3

