added back button,master-header
This commit is contained in:
parent
fba9a8fc06
commit
79a1a08620
@ -7,7 +7,7 @@ import { z } from "zod";
|
||||
import useMaster from "../../hooks/masterHook/useMaster";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { changeMaster } from "../../slices/localVariablesSlice";
|
||||
import { useNavigate, useParams } from "react-router-dom";
|
||||
import { Link, useNavigate, useParams } from "react-router-dom";
|
||||
import { formatDate } from "../../utils/dateUtils";
|
||||
import { useEmployeeProfile } from "../../hooks/useEmployees";
|
||||
import { clearCacheKey, getCachedData } from "../../slices/apiDataManager";
|
||||
@ -17,6 +17,7 @@ const mobileNumberRegex = /^(?:\d{10}|\d{3}[-\s]?\d{3}[-\s]?\d{4})$/;
|
||||
|
||||
const ManageEmployee = () => {
|
||||
const dispatch = useDispatch();
|
||||
|
||||
const { employeeId } = useParams();
|
||||
const {
|
||||
employee,
|
||||
@ -29,7 +30,7 @@ const ManageEmployee = () => {
|
||||
const [isloading, setLoading] = useState(false);
|
||||
const navigation = useNavigate();
|
||||
const [currentEmployee, setCurrentEmployee] = useState();
|
||||
console.log(currentEmployee);
|
||||
|
||||
|
||||
const userSchema = z
|
||||
.object({
|
||||
@ -50,7 +51,9 @@ const ManageEmployee = () => {
|
||||
EmergencyContactPerson: z
|
||||
.string()
|
||||
.min(1, { message: "Emergency Contact Person is required" }),
|
||||
AadharNumber: z.string().optional(),
|
||||
AadharNumber: z.string()
|
||||
.regex(/^\d{12}$/, "Aadhar card must be exactly 12 digits long") // Regex to ensure only 12 digits
|
||||
.nonempty("Aadhar card is required"),
|
||||
Gender: z
|
||||
.string()
|
||||
.min(1, { message: "Gender is required" })
|
||||
@ -223,8 +226,6 @@ const ManageEmployee = () => {
|
||||
// if(currentEmployee && currentEmployee.email) setDisabledEmail(true)
|
||||
}, [currentEmployee, reset]);
|
||||
|
||||
console.log(currentEmployee);
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="row">
|
||||
@ -232,9 +233,14 @@ const ManageEmployee = () => {
|
||||
<div className="card mb-4">
|
||||
<div className="card-header d-flex align-items-center justify-content-between">
|
||||
<h6 className="mb-0">
|
||||
{" "}
|
||||
{employee ? "Update Employee" : "Create Employee"}
|
||||
</h6>
|
||||
{/* <h6 className="cursor-pointer" onClick={() => navigation( "/employees" )}><i class='bx bx-arrow-back'></i>Back</h6> */}
|
||||
|
||||
<button className="btn btn-sm btn-secondary btn-prev" onClick={() => navigation( "/employees" )} >
|
||||
<i className="icon-base bx bx-left-arrow-alt me-sm-2 me-0 scaleX-n1-rtl"></i>
|
||||
<span className="align-middle d-sm-inline-block d-none">Back</span>
|
||||
</button>
|
||||
</div>
|
||||
<div className="card-body">
|
||||
{!currentEmployee && empLoading && (
|
||||
@ -479,7 +485,7 @@ const ManageEmployee = () => {
|
||||
Select Role
|
||||
</option>
|
||||
{job_role?.map((item) => (
|
||||
<option value={item?.id}>{item?.name} </option>
|
||||
<option value={item?.id} key={item.id}>{item?.name} </option>
|
||||
))}
|
||||
</select>
|
||||
</div>
|
||||
@ -562,10 +568,10 @@ const ManageEmployee = () => {
|
||||
/>
|
||||
{/* {errors.PanNumber && <div className="danger-text text-start" style={{fontSize:"12px"}}>{errors.PanNumber.message}</div>} */}
|
||||
</div>
|
||||
{(errors.PanNumber || errors.AadharNumber) && (
|
||||
{(errors.AadharNumber || errors.PanNumber ) && (
|
||||
<div className="danger-text text-start">
|
||||
{errors.PanNumber?.message ||
|
||||
errors.AadharNumber?.message}
|
||||
{errors.AadharNumber?.message ||errors.PanNumber?.message
|
||||
}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
@ -27,7 +27,7 @@ const ManageProjectInfo = ( {project,handleSubmitForm, onClose} ) =>
|
||||
...(project?.id ? { id: z.number().optional() } : {}),
|
||||
name: z.string().min( 1, {message: "Project Name is required"} ),
|
||||
contactPerson: z.string().min( 1, {message: "Contact Person Name is required"} ),
|
||||
projectAddress: z.string().min( 1, {message: "Address is required"} ),
|
||||
projectAddress: z.string().min( 1, {message: "Address is required"} ).max(150, 'Address must not exceed 150 characters'),
|
||||
startDate: z.string().min( 1, {message: "Start Date is required"} ).default(currentDate),
|
||||
endDate: z.string().min( 1, {message: "End Date is required"} ).default(currentDate),
|
||||
projectStatusId: z
|
||||
|
@ -134,12 +134,12 @@ const allocationEmployeesData = employeesList
|
||||
</ul>
|
||||
</div>
|
||||
<div className="modal-footer">
|
||||
<button className="btn btn-success" onClick={handleSubmit}>
|
||||
<button className="btn btn-sm btn-success" onClick={handleSubmit}>
|
||||
Assign to Project
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-secondary"
|
||||
className="btn btn-sm btn-secondary"
|
||||
data-dismiss="modal"
|
||||
aria-label="Close"
|
||||
onClick={onClose}
|
||||
|
@ -79,8 +79,8 @@ const Teams = ( {project} ) =>
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
submitAllocations(items)
|
||||
console.log(item)
|
||||
// submitAllocations(items)
|
||||
};
|
||||
|
||||
const getRole = ( jobRoleId ) =>
|
||||
|
@ -1,4 +1,4 @@
|
||||
export const mastersList = [{id:1, name: "Role"},{id:2, name: "Job Role"}, {id:3, name: "Status"},{id:4,name:"Module"}]
|
||||
export const mastersList = [{id:1, name: "Role"},{id:2, name: "Job Role"}]
|
||||
|
||||
export const dailyTask = [
|
||||
{
|
||||
|
@ -17,7 +17,6 @@ const AttendancePage = () =>
|
||||
{
|
||||
const loginUser = getCachedProfileData()
|
||||
var selectedProject = useSelector( ( store ) => store.localVariables.projectId )
|
||||
selectedProject = 5;
|
||||
const {projects,loading:projectLoading} = useProjects()
|
||||
const {attendance,loading:attLoading} = useAttendace(selectedProject)
|
||||
const[attendances,setAttendances] = useState()
|
||||
|
@ -13,7 +13,6 @@ import {useHasUserPermission} from "../../hooks/useHasUserPermission";
|
||||
|
||||
const EmployeeList = () =>
|
||||
{
|
||||
|
||||
const {profile:loginUser}= useProfile()
|
||||
const [selectedProject, setSelectedProject] = useState("");
|
||||
const {projects, loading: projectLoading} = useProjects()
|
||||
@ -100,8 +99,6 @@ const EmployeeList = () =>
|
||||
}, [ modelConfig, isCreateModalOpen ] );
|
||||
|
||||
|
||||
console.log("employeManage : ", ManageEmployee)
|
||||
|
||||
return (
|
||||
<>
|
||||
{isCreateModalOpen && (
|
||||
@ -297,7 +294,6 @@ const EmployeeList = () =>
|
||||
aria-controls="DataTables_Table_0"
|
||||
rowSpan="1"
|
||||
colSpan="1"
|
||||
// style={{ width: "107px" }}
|
||||
aria-label="Plan: activate to sort column ascending"
|
||||
>
|
||||
Joining Date
|
||||
@ -312,9 +308,8 @@ const EmployeeList = () =>
|
||||
>
|
||||
Status
|
||||
</th>
|
||||
|
||||
<th
|
||||
className={`sorting_disabled d-none ${!ManageEmployee && 'd-none'}`}
|
||||
className={`sorting_disabled ${!ManageEmployee && 'd-none'}`}
|
||||
rowSpan="1"
|
||||
colSpan="1"
|
||||
style={{ width: "50px" }}
|
||||
@ -332,8 +327,7 @@ const EmployeeList = () =>
|
||||
</tr>}
|
||||
{( !loading && employeeList?.length === 0 ) && <td colSpan={8}>Not Data Found </td>}
|
||||
{( !loading && employeeList && currentItems.length === 0 && employeeList.length !==0 ) && <td colSpan={8}><small className="muted">'{searchText}' employee not found</small> </td>}
|
||||
|
||||
|
||||
|
||||
{(currentItems && !loading) && currentItems.map((item) => (
|
||||
<tr className="odd" key={item.id}>
|
||||
<td className="sorting_1" colSpan={2}>
|
||||
@ -399,7 +393,6 @@ const EmployeeList = () =>
|
||||
|
||||
<Link
|
||||
className={`dropdown-item `}
|
||||
// ${hasUserPermission("81ab8a87-8ccd-4015-a917-0627cee6a100")?"":"d-none"}
|
||||
to={`/employee/manage/${item.id}`}
|
||||
>
|
||||
Edit
|
||||
|
@ -46,8 +46,8 @@ const MasterTable = ( {data, columns, loading, handleModalData} ) =>
|
||||
<tr>
|
||||
|
||||
<th></th>
|
||||
<th>Name</th>
|
||||
<th>Description</th>
|
||||
<th>{ selectedMaster} Name</th>
|
||||
<th>{selectedMaster } Description</th>
|
||||
<th className={` ${!hasMasterPermission && 'd-none'}`}>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
@ -5,7 +5,7 @@ const localVariablesSlice = createSlice({
|
||||
initialState: {
|
||||
selectedMaster:"Role",
|
||||
regularizationCount:0,
|
||||
projectId:1,
|
||||
projectId:5,
|
||||
|
||||
},
|
||||
reducers: {
|
||||
|
Loading…
x
Reference in New Issue
Block a user