From a3cd2cefd024ea59e3dc5128dc31c6444f01eee0 Mon Sep 17 00:00:00 2001 From: npcdazai Date: Fri, 4 Oct 2024 19:34:35 +0530 Subject: [PATCH] Drawer Vouvher --- .../SelectDepartment.jsx | 41 ++++++++++--------- .../OptiFiiGifsAndVouchers/SelectEmployee.jsx | 17 ++++---- 2 files changed, 29 insertions(+), 29 deletions(-) diff --git a/src/Pages/OptiFiiGifsAndVouchers/SelectDepartment.jsx b/src/Pages/OptiFiiGifsAndVouchers/SelectDepartment.jsx index e67fb75..076764e 100644 --- a/src/Pages/OptiFiiGifsAndVouchers/SelectDepartment.jsx +++ b/src/Pages/OptiFiiGifsAndVouchers/SelectDepartment.jsx @@ -57,9 +57,18 @@ const Employees = () => { const [searchTerm, setSearchTerm] = useState(""); const { isOpen, onOpen, onClose } = useDisclosure(); const [users, setusers] = useState(50); + const [selectedRadio, setSelectedRadio] = useState([]); const navigate = useNavigate(); const btnRef = useRef(); + useEffect(() => { + if (selectedRadio.length > 0) { + onOpen(); + } else { + onClose(); + } + }, [selectedRadio, onOpen, onClose]); + // ===============================[ Table Header ] const tableHeadRow = ["Sr No", "Department", "Employees"]; @@ -67,11 +76,9 @@ const Employees = () => { const extractedArray = employees.map((item, index) => ({ "Sr No": ( - - - {item?.id} - - + + {item?.id} + ), Name: ( @@ -115,7 +122,7 @@ const Employees = () => { boxShadow="md" justifyContent={"center"} > - + +{users} @@ -187,7 +194,7 @@ const Employees = () => { } - fontSize={"xs"} + fontSize={"small"} fontWeight={500} color={"#4D4D4D"} > @@ -195,7 +202,7 @@ const Employees = () => { } - fontSize={"xs"} + fontSize={"small"} fontWeight={500} color={"#4D4D4D"} > @@ -213,7 +220,7 @@ const Employees = () => { as={Button} leftIcon={} rightIcon={} - fontSize={"xs"} + fontSize={"small"} color={"gray.700"} variant="outline" size={"sm"} @@ -271,17 +278,11 @@ const Employees = () => { tableHeadRow={tableHeadRow} data={extractedArray} isLoading={isLoading} + showRadioButton={true} + setSelectedRadio={setSelectedRadio} + selectedRadio={selectedRadio} /> - - + { boxShadow="md" ml={"-10px"} > - + +200 diff --git a/src/Pages/OptiFiiGifsAndVouchers/SelectEmployee.jsx b/src/Pages/OptiFiiGifsAndVouchers/SelectEmployee.jsx index 8605e7c..5f3a910 100644 --- a/src/Pages/OptiFiiGifsAndVouchers/SelectEmployee.jsx +++ b/src/Pages/OptiFiiGifsAndVouchers/SelectEmployee.jsx @@ -94,6 +94,14 @@ const Employees = () => { return () => clearTimeout(timer); }, []); + useEffect(() => { + if (selectedRadio.length > 0) { + onOpen(); + } else { + onClose(); + } + }, [selectedRadio, onOpen, onClose]); + const tableHeadRow = [ "Emp ID", "Name", @@ -251,15 +259,6 @@ const Employees = () => { selectedRadio={selectedRadio} /> -