|
|
@ -6,6 +6,7 @@ import { Receipt } from "../types" |
|
|
|
import { AppContext } from "../AppContext" |
|
|
|
import { AppContext } from "../AppContext" |
|
|
|
import { SubmitButton } from "../components" |
|
|
|
import { SubmitButton } from "../components" |
|
|
|
import { Navigate } from "react-router-dom" |
|
|
|
import { Navigate } from "react-router-dom" |
|
|
|
|
|
|
|
import { Button } from "react-bootstrap" |
|
|
|
|
|
|
|
|
|
|
|
interface FormValues { |
|
|
|
interface FormValues { |
|
|
|
receiptGuid: string |
|
|
|
receiptGuid: string |
|
|
@ -47,7 +48,7 @@ export const ReceiptsView: React.FC = () => { |
|
|
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<AppContext.Consumer> |
|
|
|
<AppContext.Consumer> |
|
|
|
{({ apiKey, clientInstance, receipts }) => { |
|
|
|
{({ apiKey, clientInstance, receipts, setReceipts }) => { |
|
|
|
if (!apiKey && clientInstance && clientInstance.call) clientInstance.call('notification' as any, 'toast', 'Please add API key to continue') |
|
|
|
if (!apiKey && clientInstance && clientInstance.call) clientInstance.call('notification' as any, 'toast', 'Please add API key to continue') |
|
|
|
return !apiKey ? ( |
|
|
|
return !apiKey ? ( |
|
|
|
<Navigate |
|
|
|
<Navigate |
|
|
@ -108,6 +109,7 @@ export const ReceiptsView: React.FC = () => { |
|
|
|
/> |
|
|
|
/> |
|
|
|
|
|
|
|
|
|
|
|
<ReceiptsTable receipts={receipts} /> |
|
|
|
<ReceiptsTable receipts={receipts} /> |
|
|
|
|
|
|
|
<Button title="Clear the list of receipt" onClick={() => { setReceipts([]) }} >Clear</Button> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
) |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|