Merge branch 'Feature_Task_Management' of https://git.marcoaiot.com/admin/marco.pms.web into Feature_Task_Management
This commit is contained in:
commit
9c0f98dbaf
@ -29,7 +29,7 @@ const InfraPlanning = () =>
|
|||||||
useEffect( () =>
|
useEffect( () =>
|
||||||
{
|
{
|
||||||
dispatch(setProjectId(projects[0]?.id))
|
dispatch(setProjectId(projects[0]?.id))
|
||||||
})
|
},[projects])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="col-md-12 col-lg-12 col-xl-12 order-0 mb-4">
|
<div className="col-md-12 col-lg-12 col-xl-12 order-0 mb-4">
|
||||||
@ -49,7 +49,7 @@ const InfraPlanning = () =>
|
|||||||
|
|
||||||
{!project_listLoader && projects?.filter(project =>
|
{!project_listLoader && projects?.filter(project =>
|
||||||
LoggedUser?.projects?.map(Number).includes(project.id)).map((project)=>(
|
LoggedUser?.projects?.map(Number).includes(project.id)).map((project)=>(
|
||||||
<option value={project.id}>{project.name}</option>
|
<option key={project.id} value={project.id}>{project.name}</option>
|
||||||
))}
|
))}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
@ -26,7 +26,7 @@ const TaskModel = ({
|
|||||||
activities,
|
activities,
|
||||||
onSubmit,
|
onSubmit,
|
||||||
clearTrigger,
|
clearTrigger,
|
||||||
onClearComplete,
|
onClearComplete,onClose
|
||||||
}) => {
|
}) => {
|
||||||
const [formData, setFormData] = useState(defaultModel);
|
const [formData, setFormData] = useState(defaultModel);
|
||||||
const [selectedBuilding, setSelectedBuilding] = useState(null);
|
const [selectedBuilding, setSelectedBuilding] = useState(null);
|
||||||
@ -124,12 +124,7 @@ const TaskModel = ({
|
|||||||
<div className="modal-content">
|
<div className="modal-content">
|
||||||
<div className="modal-body">
|
<div className="modal-body">
|
||||||
<div className="row">
|
<div className="row">
|
||||||
<button
|
<button type="button" className="btn-close" aria-label="Close" onClick={onClose}/>
|
||||||
type="button"
|
|
||||||
className="btn-close"
|
|
||||||
data-bs-dismiss="modal"
|
|
||||||
aria-label="Close"
|
|
||||||
></button>
|
|
||||||
<div className="text-center mb-1">
|
<div className="text-center mb-1">
|
||||||
<h5 className="mb-1">Manage Task</h5>
|
<h5 className="mb-1">Manage Task</h5>
|
||||||
</div>
|
</div>
|
||||||
@ -290,10 +285,9 @@ const TaskModel = ({
|
|||||||
{formData.id !== "0" && formData.id !== "" ? "Edit Task" : "Add Task"}
|
{formData.id !== "0" && formData.id !== "" ? "Edit Task" : "Add Task"}
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
type="reset"
|
type="button"
|
||||||
className="btn btn-sm btn-label-secondary"
|
className="btn btn-sm btn-label-secondary"
|
||||||
data-bs-dismiss="modal"
|
onClick={onClose}
|
||||||
aria-label="Close"
|
|
||||||
>
|
>
|
||||||
Cancel
|
Cancel
|
||||||
</button>
|
</button>
|
||||||
|
@ -19,7 +19,7 @@ const defaultModel = {
|
|||||||
floorId: "0",
|
floorId: "0",
|
||||||
};
|
};
|
||||||
|
|
||||||
const WorkAreaModel = ({ project, onSubmit, clearTrigger, onClearComplete }) => {
|
const WorkAreaModel = ({ project, onSubmit, clearTrigger, onClearComplete, onClose }) => {
|
||||||
const [selectedBuilding, setSelectedBuilding] = useState(null);
|
const [selectedBuilding, setSelectedBuilding] = useState(null);
|
||||||
const [ selectedFloor, setSelectedFloor ] = useState( null );
|
const [ selectedFloor, setSelectedFloor ] = useState( null );
|
||||||
const [selectdWorkArea,setWorkArea] = useState()
|
const [selectdWorkArea,setWorkArea] = useState()
|
||||||
@ -111,7 +111,7 @@ const WorkAreaModel = ({ project, onSubmit, clearTrigger, onClearComplete }) =>
|
|||||||
<div className="modal-content">
|
<div className="modal-content">
|
||||||
<div className="modal-body">
|
<div className="modal-body">
|
||||||
<div className="row">
|
<div className="row">
|
||||||
<button type="button" className="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
<button type="button" className="btn-close" aria-label="Close" onClick={onClose}/>
|
||||||
<div className="text-center mb-1">
|
<div className="text-center mb-1">
|
||||||
<h5 className="mb-1">Manage Work Area</h5>
|
<h5 className="mb-1">Manage Work Area</h5>
|
||||||
</div>
|
</div>
|
||||||
|
@ -383,10 +383,12 @@ const ProjectInfra = ({ data, activityMaster, onDataChange,eachSiteEngineer }) =
|
|||||||
|
|
||||||
{isWorkAreaModelOpen && (
|
{isWorkAreaModelOpen && (
|
||||||
<div
|
<div
|
||||||
className={`modal fade `}
|
className="modal fade show"
|
||||||
id="work-area-model"
|
id="work-area-model"
|
||||||
tabIndex="-1"
|
tabIndex="-1"
|
||||||
aria-hidden="true"
|
role="dialog"
|
||||||
|
style={{ display: 'block' }}
|
||||||
|
aria-hidden="false"
|
||||||
>
|
>
|
||||||
<WorkAreaModel
|
<WorkAreaModel
|
||||||
project={data}
|
project={data}
|
||||||
@ -395,16 +397,18 @@ const ProjectInfra = ({ data, activityMaster, onDataChange,eachSiteEngineer }) =
|
|||||||
onSubmit={handleWorkAreaModelFormSubmit}
|
onSubmit={handleWorkAreaModelFormSubmit}
|
||||||
clearTrigger={clearFormTrigger}
|
clearTrigger={clearFormTrigger}
|
||||||
onClearComplete={() => setClearFormTrigger(false)}
|
onClearComplete={() => setClearFormTrigger(false)}
|
||||||
></WorkAreaModel>
|
/>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{isTaskModelOpen && (
|
{isTaskModelOpen && (
|
||||||
<div
|
<div
|
||||||
className={`modal fade `}
|
className="modal fade show"
|
||||||
id="task-model"
|
id="task-model"
|
||||||
tabIndex="-1"
|
tabIndex="-1"
|
||||||
aria-hidden="true"
|
role="dialog"
|
||||||
|
style={{ display: 'block' }}
|
||||||
|
aria-hidden="false"
|
||||||
>
|
>
|
||||||
<TaskModel
|
<TaskModel
|
||||||
project={data}
|
project={data}
|
||||||
@ -413,7 +417,7 @@ const ProjectInfra = ({ data, activityMaster, onDataChange,eachSiteEngineer }) =
|
|||||||
onSubmit={handleTaskModelFormSubmit}
|
onSubmit={handleTaskModelFormSubmit}
|
||||||
clearTrigger={clearFormTrigger}
|
clearTrigger={clearFormTrigger}
|
||||||
onClearComplete={() => setClearFormTrigger(false)}
|
onClearComplete={() => setClearFormTrigger(false)}
|
||||||
></TaskModel>
|
/>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
@ -450,9 +454,7 @@ const ProjectInfra = ({ data, activityMaster, onDataChange,eachSiteEngineer }) =
|
|||||||
|
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
data-bs-toggle="modal"
|
|
||||||
className="link-button m-1"
|
className="link-button m-1"
|
||||||
data-bs-target="#work-area-model"
|
|
||||||
onClick={() => openWorkAreaModel()}
|
onClick={() => openWorkAreaModel()}
|
||||||
>
|
>
|
||||||
<i className="bx bx-plus-circle me-2"></i>
|
<i className="bx bx-plus-circle me-2"></i>
|
||||||
@ -460,9 +462,7 @@ const ProjectInfra = ({ data, activityMaster, onDataChange,eachSiteEngineer }) =
|
|||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
data-bs-toggle="modal"
|
|
||||||
className="link-button m-1"
|
className="link-button m-1"
|
||||||
data-bs-target="#task-model"
|
|
||||||
onClick={() => openTaskModel()}
|
onClick={() => openTaskModel()}
|
||||||
>
|
>
|
||||||
<i className="bx bx-plus-circle me-2"></i>
|
<i className="bx bx-plus-circle me-2"></i>
|
||||||
|
@ -4,6 +4,7 @@ import {
|
|||||||
getCachedData,
|
getCachedData,
|
||||||
} from "../slices/apiDataManager"
|
} from "../slices/apiDataManager"
|
||||||
import ProjectRepository from "../repositories/ProjectRepository";
|
import ProjectRepository from "../repositories/ProjectRepository";
|
||||||
|
import { useProfile } from "./useProfile";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -84,7 +85,7 @@ export const useEmployeesByProjectAllocated = ( selectedProject ) =>
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const useProjectDetails =(projectId)=>{
|
export const useProjectDetails =(projectId)=>{
|
||||||
|
const {profile} = useProfile();
|
||||||
const [projects_Details, setProject_Details] = useState(null);
|
const [projects_Details, setProject_Details] = useState(null);
|
||||||
const [loading, setLoading] = useState(true);
|
const [loading, setLoading] = useState(true);
|
||||||
const [error, setError] = useState("");
|
const [error, setError] = useState("");
|
||||||
@ -113,11 +114,11 @@ export const useProjectDetails =(projectId)=>{
|
|||||||
};
|
};
|
||||||
|
|
||||||
useEffect(()=>{
|
useEffect(()=>{
|
||||||
if ( projectId )
|
if ( profile && (projectId != undefined) )
|
||||||
{
|
{
|
||||||
fetchData()
|
fetchData()
|
||||||
}
|
}
|
||||||
},[projectId])
|
},[projectId,profile])
|
||||||
|
|
||||||
return { projects_Details,loading,error,refetch:fetchData}
|
return { projects_Details,loading,error,refetch:fetchData}
|
||||||
|
|
||||||
|
@ -6,10 +6,19 @@ import ProjectRepository from "../../repositories/ProjectRepository";
|
|||||||
import Breadcrumb from "../../components/common/Breadcrumb";
|
import Breadcrumb from "../../components/common/Breadcrumb";
|
||||||
import InfraPlanning from "../../components/Activities/InfraPlanning";
|
import InfraPlanning from "../../components/Activities/InfraPlanning";
|
||||||
import { cacheData, getCachedData } from "../../slices/apiDataManager";
|
import { cacheData, getCachedData } from "../../slices/apiDataManager";
|
||||||
|
import { useProfile } from "../../hooks/useProfile";
|
||||||
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
|
import { useProjectDetails, useProjects } from "../../hooks/useProjects";
|
||||||
|
import { setProjectId } from "../../slices/localVariablesSlice";
|
||||||
|
|
||||||
var projectId;
|
var projectId;
|
||||||
const TaskPlannng = () => {
|
const TaskPlannng = () => {
|
||||||
|
|
||||||
|
const {profile} = useProfile();
|
||||||
|
const {projects,loading:project_listLoader,error:projects_error} = useProjects();
|
||||||
|
const dispatch = useDispatch();
|
||||||
|
const selectedProject = useSelector((store)=>store.localVariables.projectId);
|
||||||
|
|
||||||
|
|
||||||
const [project, setProject] = useState(null);
|
const [project, setProject] = useState(null);
|
||||||
const [projectDetails, setProjectDetails] = useState(null);
|
const [projectDetails, setProjectDetails] = useState(null);
|
||||||
@ -17,6 +26,10 @@ const TaskPlannng = () => {
|
|||||||
|
|
||||||
const [loading, setLoading] = useState(true);
|
const [loading, setLoading] = useState(true);
|
||||||
const [error, setError] = useState("");
|
const [error, setError] = useState("");
|
||||||
|
useEffect( () =>
|
||||||
|
{
|
||||||
|
dispatch(setProjectId(projects[0]?.id))
|
||||||
|
},[projects])
|
||||||
|
|
||||||
const fetchActivities = async () => {
|
const fetchActivities = async () => {
|
||||||
try {
|
try {
|
||||||
@ -43,9 +56,9 @@ const TaskPlannng = () => {
|
|||||||
|
|
||||||
const fetchData = async () => {
|
const fetchData = async () => {
|
||||||
try {
|
try {
|
||||||
const project_cache = getCachedData(`projectinfo-${1}`);
|
const project_cache = getCachedData(`projectinfo-${selectedProject}`);
|
||||||
if (!project_cache) {
|
if (!project_cache) {
|
||||||
ProjectRepository.getProjectByprojectId(1)
|
ProjectRepository.getProjectByprojectId(selectedProject)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
setProjectDetails(response);
|
setProjectDetails(response);
|
||||||
setProject(response);
|
setProject(response);
|
||||||
@ -73,14 +86,16 @@ const TaskPlannng = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleDataChange = (data) => {
|
const handleDataChange = (data) => {
|
||||||
|
console.log("datachange")
|
||||||
fetchData();
|
fetchData();
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
projectId =1
|
if((projects.length != 0)){
|
||||||
fetchData();
|
fetchData();
|
||||||
fetchActivities();
|
fetchActivities();
|
||||||
}, []);
|
}
|
||||||
|
}, [selectedProject]);
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -325,7 +325,7 @@ const EmployeeList = () =>
|
|||||||
<p>Loading...</p>
|
<p>Loading...</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>}
|
</tr>}
|
||||||
{( !loading && employeeList?.length === 0 ) && <td colSpan={8}>Not Data Found </td>}
|
{!loading && employeeList?.length === 0 && (<td colSpan={8} style={{ paddingTop: '20px', textAlign: 'center' }}>No Data Found</td> )}
|
||||||
{( !loading && employeeList && currentItems.length === 0 && employeeList.length !==0 ) && <td colSpan={8}><small className="muted">'{searchText}' employee not found</small> </td>}
|
{( !loading && employeeList && currentItems.length === 0 && employeeList.length !==0 ) && <td colSpan={8}><small className="muted">'{searchText}' employee not found</small> </td>}
|
||||||
|
|
||||||
{(currentItems && !loading) && currentItems.sort((a, b) => b.id - a.id).map((item) => (
|
{(currentItems && !loading) && currentItems.sort((a, b) => b.id - a.id).map((item) => (
|
||||||
@ -372,49 +372,33 @@ const EmployeeList = () =>
|
|||||||
Active
|
Active
|
||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
<td className={`d-flex justify-content-end justify-content-sm-center ${!ManageEmployee && 'd-none'} `}>
|
{ManageEmployee && (
|
||||||
<div className="d-flex align-items-center ">
|
<td className="text-end">
|
||||||
<a
|
<div className="dropdown">
|
||||||
className={`btn btn-icon dropdown-toggle hide-arrow`}
|
<button className="btn btn-icon dropdown-toggle hide-arrow" data-bs-toggle="dropdown">
|
||||||
data-bs-toggle="dropdown"
|
|
||||||
>
|
|
||||||
<i className="bx bx-dots-vertical-rounded bx-md"></i>
|
<i className="bx bx-dots-vertical-rounded bx-md"></i>
|
||||||
</a>
|
</button>
|
||||||
|
<div className="dropdown-menu dropdown-menu-end">
|
||||||
<div className="dropdown-menu dropdown-menu-end m-0">
|
<button onClick={() => navigate(`/employee/${item.id}`)} className="dropdown-item">
|
||||||
{" "}
|
|
||||||
<a
|
|
||||||
|
|
||||||
onClick={()=> navigate(`/employee/${item.id}`)}
|
|
||||||
className="dropdown-item"
|
|
||||||
>
|
|
||||||
View
|
View
|
||||||
</a>
|
</button>
|
||||||
|
<Link to={`/employee/manage/${item.id}`} className="dropdown-item">
|
||||||
<Link
|
|
||||||
className={`dropdown-item `}
|
|
||||||
to={`/employee/manage/${item.id}`}
|
|
||||||
>
|
|
||||||
Edit
|
Edit
|
||||||
</Link>
|
</Link>
|
||||||
|
<button className="dropdown-item">Suspend</button>
|
||||||
<a className="dropdown-item">
|
<button
|
||||||
Suspend
|
|
||||||
</a>
|
|
||||||
<a
|
|
||||||
className="dropdown-item"
|
className="dropdown-item"
|
||||||
type="button"
|
type="button"
|
||||||
data-bs-toggle="modal"
|
data-bs-toggle="modal"
|
||||||
data-bs-target="#managerole-modal"
|
data-bs-target="#managerole-modal"
|
||||||
onClick={() => {
|
onClick={() => handleConfigData(item.id)}
|
||||||
handleConfigData(item.id);
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
Manage Role
|
Manage Role
|
||||||
</a>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
|
)}
|
||||||
</tr>
|
</tr>
|
||||||
) )}
|
) )}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user