mirror of
https://github.com/Sea-Haven-Industries/seahaven-ap.git
synced 2026-10-03 09:13:13 +00:00
37 lines
857 B
TypeScript
37 lines
857 B
TypeScript
|
|
import { useState } from "react";
|
||
|
|
import { Button, Snackbar } from "@mui/material";
|
||
|
|
|
||
|
|
type CreatePayRunButtonProps = {
|
||
|
|
selectedCount: number;
|
||
|
|
};
|
||
|
|
|
||
|
|
export function CreatePayRunButton({ selectedCount }: CreatePayRunButtonProps) {
|
||
|
|
const [open, setOpen] = useState(false);
|
||
|
|
const [message, setMessage] = useState("");
|
||
|
|
|
||
|
|
const handleClick = () => {
|
||
|
|
setMessage(`Pay run stub: ${selectedCount} invoice(s) selected`);
|
||
|
|
setOpen(true);
|
||
|
|
};
|
||
|
|
|
||
|
|
return (
|
||
|
|
<>
|
||
|
|
<Button
|
||
|
|
variant="contained"
|
||
|
|
disabled={selectedCount < 1}
|
||
|
|
onClick={handleClick}
|
||
|
|
data-testid="create-pay-run"
|
||
|
|
>
|
||
|
|
Create Pay Run
|
||
|
|
</Button>
|
||
|
|
<Snackbar
|
||
|
|
open={open}
|
||
|
|
autoHideDuration={4000}
|
||
|
|
onClose={() => setOpen(false)}
|
||
|
|
message={message}
|
||
|
|
data-testid="create-pay-run-snackbar"
|
||
|
|
/>
|
||
|
|
</>
|
||
|
|
);
|
||
|
|
}
|