This commit is contained in:
Sibunnayak 2024-04-30 17:15:58 +05:30
commit a6ed64eaba
3 changed files with 132 additions and 0 deletions

View File

@ -145,6 +145,7 @@ import EmailCms from "./views/CustomerSupport/EmailCMS/EmailCms";
import RegistrationEmail from "./views/CustomerSupport/EmailCMS/RegistrationEmail"; import RegistrationEmail from "./views/CustomerSupport/EmailCMS/RegistrationEmail";
import Employee from "./views/EmployeeAccess/Employee"; import Employee from "./views/EmployeeAccess/Employee";
import AddEmployee from "./views/EmployeeAccess/addEmployee"; import AddEmployee from "./views/EmployeeAccess/addEmployee";
import EditEmployee from "./views/EmployeeAccess/editEmployee";
const routes = [ const routes = [
{ path: "/", exact: true, name: "Home" }, { path: "/", exact: true, name: "Home" },
{ {
@ -596,6 +597,11 @@ const routes = [
name: "Employee", name: "Employee",
element: AddEmployee, element: AddEmployee,
}, },
{
path: "edit-employee/:id",
name: "Employee",
element: EditEmployee,
},
//Charts //Charts
{ {
path: "/new-user-day-wise", path: "/new-user-day-wise",

View File

@ -333,6 +333,9 @@ const Employee = () => {
<th>Orders</th> */} <th>Orders</th> */}
<th> <th>
<button <button
onClick={() =>
navigate("/edit-employee/44234234")
}
style={{ style={{
color: "white", color: "white",
marginRight: "1rem", marginRight: "1rem",

View File

@ -0,0 +1,123 @@
import { Box, Button, Typography } from "@mui/material";
import React, { useState } from "react";
import FormGroup from "@mui/material/FormGroup";
import FormControlLabel from "@mui/material/FormControlLabel";
import Checkbox from "@mui/material/Checkbox";
import { useNavigate } from "react-router-dom";
import _nav from "src/_nav";
const EditEmployee = () => {
const [employeeName, setEmployeeName] = useState("");
// const [email, setEmail] = useState("");
const navigate = useNavigate();
const [checkedItems, setCheckedItems] = useState({});
const filteredNav = _nav.filter((item) => item.name !== "Employee");
const handleCheckboxChange = (name) => (event) => {
setCheckedItems({
...checkedItems,
[name]: event.target.checked,
});
};
console.log(checkedItems);
return (
<div>
<Box style={{ background: "#FFFFFF", color: "black", padding: "1rem" }}>
{/* <TextField
type="text"
value={title}
onChange={(e) => setTitle(e.target.value)}
variant="outlined"
size="small"
fullWidth
/> */}
<Typography
style={{ margin: "0.5rem 0rem", fontWeight: "bold" }}
variant="h6"
>
{" "}
Add Employee:{" "}
</Typography>
<div className="mb-3">
<label htmlFor="title" className="form-label">
Employee Name*
</label>
<input
type="text"
className="form-control"
id="title"
placeholder="Eg: Roshan Garg"
value={employeeName}
onChange={(e) => setEmployeeName(e.target.value)}
/>
</div>
{/* <div className="mb-3">
<label htmlFor="welcomeMsgforDes" className="form-label">
Email*
</label>
<input
type="email"
className="form-control"
// style={{ width: "300px" }}
id="welcomeMsgforDes"
placeholder="Eg: rosham@gmailcom "
value={email}
onChange={(e) => setEmail(e.target.value)}
/>
</div> */}
<Box>
<label htmlFor="welcomeMsgforDes" className="form-label">
Access to*
</label>
<div>
{filteredNav.map((item, index) => (
<div key={index}>
<Checkbox
checked={checkedItems[item.name] || false}
onChange={handleCheckboxChange(item.name)}
inputProps={{ "aria-label": "controlled" }}
/>
{item.name}
</div>
))}
</div>
</Box>
<div style={{ display: "flex" }}>
<Button
variant="contained"
color="primary"
// onClick={handleSaveClick}
style={{
fontWeight: "bold",
marginBottom: "1rem",
textTransform: "capitalize",
marginRight: "5px",
}}
>
Update Employee
</Button>
<Button
variant="contained"
color="primary"
// onClick={handleCancelClick}
onClick={() => navigate("/employee")}
style={{
fontWeight: "bold",
marginBottom: "1rem",
textTransform: "capitalize",
marginRight: "5px",
}}
>
Cancel
</Button>
</div>
</Box>
</div>
);
};
export default EditEmployee;