added ascending order list , user-rights,
This commit is contained in:
parent
79a1a08620
commit
f4af7ccf1c
@ -30,7 +30,14 @@ const Attendance = ( {attendance, getRole, handleModalData} ) =>
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody className="table-border-bottom-0">
|
<tbody className="table-border-bottom-0">
|
||||||
{currentItems &&
|
{currentItems &&
|
||||||
currentItems.map((item) => (
|
currentItems
|
||||||
|
.sort((a, b) => {
|
||||||
|
// If checkInTime exists, compare it, otherwise, treat null as earlier than a date
|
||||||
|
const checkInA = a.checkInTime ? new Date(a.checkInTime) : new Date(0);
|
||||||
|
const checkInB = b.checkInTime ? new Date(b.checkInTime) : new Date(0);
|
||||||
|
return checkInB - checkInA; // Sort in descending order of checkInTime
|
||||||
|
})
|
||||||
|
.map( ( item ) => (
|
||||||
<tr key={item.id}>
|
<tr key={item.id}>
|
||||||
<td colSpan={2}>
|
<td colSpan={2}>
|
||||||
<div className="d-flex justify-content-start align-items-center">
|
<div className="d-flex justify-content-start align-items-center">
|
||||||
|
@ -8,7 +8,7 @@ import TaskModel from "./TaskModel";
|
|||||||
import ProjectRepository from "../../repositories/ProjectRepository";
|
import ProjectRepository from "../../repositories/ProjectRepository";
|
||||||
import ProjectModal from "./ProjectModal";
|
import ProjectModal from "./ProjectModal";
|
||||||
import {useHasUserPermission} from "../../hooks/useHasUserPermission";
|
import {useHasUserPermission} from "../../hooks/useHasUserPermission";
|
||||||
import {MANAGE_INFRA} from "../../utils/constants";
|
import {MANAGE_PROJECT_INFRA} from "../../utils/constants";
|
||||||
// import AssignRoleModel from "./AssignRoleModel";
|
// import AssignRoleModel from "./AssignRoleModel";
|
||||||
|
|
||||||
const ProjectInfra = ({ data, activityMaster, onDataChange,eachSiteEngineer }) => {
|
const ProjectInfra = ({ data, activityMaster, onDataChange,eachSiteEngineer }) => {
|
||||||
@ -17,7 +17,7 @@ const ProjectInfra = ({ data, activityMaster, onDataChange,eachSiteEngineer }) =
|
|||||||
const [project, setProject] = useState(data);
|
const [project, setProject] = useState(data);
|
||||||
const[modalConfig,setModalConfig] = useState({type:null,data:null});
|
const[modalConfig,setModalConfig] = useState({type:null,data:null});
|
||||||
const [ isModalOpen, setIsModalOpen ] = useState( false )
|
const [ isModalOpen, setIsModalOpen ] = useState( false )
|
||||||
const ManageInfra = useHasUserPermission(MANAGE_INFRA)
|
const ManageInfra = useHasUserPermission(MANAGE_PROJECT_INFRA)
|
||||||
|
|
||||||
const [buildings, setBuildings] = useState(data.buildings);
|
const [buildings, setBuildings] = useState(data.buildings);
|
||||||
const [isBuildingModalOpen, setIsBuildingModalOpen] = useState(false);
|
const [isBuildingModalOpen, setIsBuildingModalOpen] = useState(false);
|
||||||
@ -517,11 +517,11 @@ const ProjectInfra = ({ data, activityMaster, onDataChange,eachSiteEngineer }) =
|
|||||||
|
|
||||||
<div className="card-body" style={{ padding: "0.5rem" }}>
|
<div className="card-body" style={{ padding: "0.5rem" }}>
|
||||||
<div className="align-items-center">
|
<div className="align-items-center">
|
||||||
<div className="row">
|
<div className="row ">
|
||||||
<div className="col-12 text-end mb-1" >
|
<div className={`col-12 text-end mb-1 ${!ManageInfra && 'd-none'} `} >
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className="link-button link-button-sm m-1"
|
className="link-button link-button-sm m-1 "
|
||||||
data-bs-toggle="modal"
|
data-bs-toggle="modal"
|
||||||
data-bs-target="#building-model"
|
data-bs-target="#building-model"
|
||||||
onClick={() => openBuildingModel()}
|
onClick={() => openBuildingModel()}
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import {hasUserPermission} from "../../utils/authUtils";
|
import {hasUserPermission} from "../../utils/authUtils";
|
||||||
import {useHasUserPermission} from "../../hooks/useHasUserPermission";
|
import {useHasUserPermission} from "../../hooks/useHasUserPermission";
|
||||||
import {INFRASTRUCTURE} from "../../utils/constants";
|
import { VIEW_PROJECT_INFRA} from "../../utils/constants";
|
||||||
|
|
||||||
const ProjectNav = ( {onPillClick, activePill} ) =>
|
const ProjectNav = ( {onPillClick, activePill} ) =>
|
||||||
{
|
{
|
||||||
const HasInfraStructure = useHasUserPermission( INFRASTRUCTURE )
|
const HasViewInfraStructure = useHasUserPermission( VIEW_PROJECT_INFRA )
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="col-md-12">
|
<div className="col-md-12">
|
||||||
@ -35,7 +35,7 @@ const ProjectNav = ( {onPillClick, activePill} ) =>
|
|||||||
<i className="bx bx-group bx-sm me-1_5"></i> Teams
|
<i className="bx bx-group bx-sm me-1_5"></i> Teams
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li className={`nav-item ${HasInfraStructure ? "":"d-none"} `}>
|
<li className={`nav-item ${HasViewInfraStructure ? "":"d-none"} `}>
|
||||||
<a
|
<a
|
||||||
className={`nav-link ${activePill === "infra" ? "active" : ""}`}
|
className={`nav-link ${activePill === "infra" ? "active" : ""}`}
|
||||||
href="#"
|
href="#"
|
||||||
|
@ -9,7 +9,7 @@ import {useDispatch} from "react-redux";
|
|||||||
import {changeMaster} from "../../slices/localVariablesSlice";
|
import {changeMaster} from "../../slices/localVariablesSlice";
|
||||||
import useMaster from "../../hooks/masterHook/useMaster"
|
import useMaster from "../../hooks/masterHook/useMaster"
|
||||||
import {useHasUserPermission} from "../../hooks/useHasUserPermission"
|
import {useHasUserPermission} from "../../hooks/useHasUserPermission"
|
||||||
import {ASSIGN_USER_TO_PROJECT} from "../../utils/constants";
|
import {ASSIGN_TO_PROJECT} from "../../utils/constants";
|
||||||
|
|
||||||
|
|
||||||
const Teams = ( {project} ) =>
|
const Teams = ( {project} ) =>
|
||||||
@ -24,7 +24,7 @@ const Teams = ( {project} ) =>
|
|||||||
const [employees, setEmployees] = useState([]);
|
const [employees, setEmployees] = useState([]);
|
||||||
const [ filteredEmployees, setFilteredEmployees ] = useState( [] );
|
const [ filteredEmployees, setFilteredEmployees ] = useState( [] );
|
||||||
|
|
||||||
const HasAssignUserPermission = useHasUserPermission( ASSIGN_USER_TO_PROJECT )
|
const HasAssignUserPermission = useHasUserPermission( ASSIGN_TO_PROJECT )
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -79,8 +79,8 @@ const Teams = ( {project} ) =>
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log(item)
|
|
||||||
// submitAllocations(items)
|
submitAllocations(items)
|
||||||
};
|
};
|
||||||
|
|
||||||
const getRole = ( jobRoleId ) =>
|
const getRole = ( jobRoleId ) =>
|
||||||
|
@ -328,7 +328,7 @@ const EmployeeList = () =>
|
|||||||
{( !loading && employeeList?.length === 0 ) && <td colSpan={8}>Not Data Found </td>}
|
{( !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>}
|
{( !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) => (
|
{(currentItems && !loading) && currentItems.sort((a, b) => b.id - a.id).map((item) => (
|
||||||
<tr className="odd" key={item.id}>
|
<tr className="odd" key={item.id}>
|
||||||
<td className="sorting_1" colSpan={2}>
|
<td className="sorting_1" colSpan={2}>
|
||||||
<div className="d-flex justify-content-start align-items-center user-name">
|
<div className="d-flex justify-content-start align-items-center user-name">
|
||||||
|
@ -8,7 +8,7 @@ import useMaster from "../../hooks/masterHook/useMaster"
|
|||||||
import MasterTable from "./MasterTable";
|
import MasterTable from "./MasterTable";
|
||||||
import { getCachedData } from "../../slices/apiDataManager";
|
import { getCachedData } from "../../slices/apiDataManager";
|
||||||
import {useHasUserPermission} from "../../hooks/useHasUserPermission";
|
import {useHasUserPermission} from "../../hooks/useHasUserPermission";
|
||||||
import { MASTER_MANAGE } from "../../utils/constants";
|
import { MANAGE_MASTER } from "../../utils/constants";
|
||||||
|
|
||||||
|
|
||||||
const MasterPage = () => {
|
const MasterPage = () => {
|
||||||
@ -16,7 +16,7 @@ const MasterPage = () => {
|
|||||||
const [modalConfig, setmodalConfig] = useState({modalType: "", item: null, masterType:null });
|
const [modalConfig, setmodalConfig] = useState({modalType: "", item: null, masterType:null });
|
||||||
const [searchTerm, setSearchTerm] = useState('');
|
const [searchTerm, setSearchTerm] = useState('');
|
||||||
const [ filteredResults, setFilteredResults ] = useState( [] );
|
const [ filteredResults, setFilteredResults ] = useState( [] );
|
||||||
const hasMasterPermission = useHasUserPermission( MASTER_MANAGE )
|
const hasMasterPermission = useHasUserPermission( MANAGE_MASTER )
|
||||||
console.log(hasMasterPermission)
|
console.log(hasMasterPermission)
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
const selectedMaster = useSelector((store)=>store.localVariables.selectedMaster)
|
const selectedMaster = useSelector((store)=>store.localVariables.selectedMaster)
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
import React, { useEffect,useState } from "react";
|
import React, { useEffect,useState } from "react";
|
||||||
import { useSelector } from "react-redux";
|
import { useSelector } from "react-redux";
|
||||||
import { useHasUserPermission } from "../../hooks/useHasUserPermission";
|
import { useHasUserPermission } from "../../hooks/useHasUserPermission";
|
||||||
import {MASTER_MANAGE} from "../../utils/constants";
|
import {MANAGE_MASTER} from "../../utils/constants";
|
||||||
|
|
||||||
const MasterTable = ( {data, columns, loading, handleModalData} ) =>
|
const MasterTable = ( {data, columns, loading, handleModalData} ) =>
|
||||||
{
|
{
|
||||||
const hasMasterPermission = useHasUserPermission(MASTER_MANAGE) // for master manage permission id
|
const hasMasterPermission = useHasUserPermission(MANAGE_MASTER)
|
||||||
const selectedMaster = useSelector((store)=>store.localVariables.selectedMaster)
|
const selectedMaster = useSelector((store)=>store.localVariables.selectedMaster)
|
||||||
const hiddenColumns = ["id", "featurePermission","tenant","tenantId"];
|
const hiddenColumns = ["id", "featurePermission","tenant","tenantId"];
|
||||||
|
|
||||||
|
@ -155,7 +155,7 @@ const ProjectList = () =>
|
|||||||
<div className="row">
|
<div className="row">
|
||||||
{loading && <p className="text-center">Loading...</p>}
|
{loading && <p className="text-center">Loading...</p>}
|
||||||
{currentItems &&
|
{currentItems &&
|
||||||
currentItems?.map((item) => (
|
currentItems.sort((a, b) => b.id - a.id).map((item) => (
|
||||||
<ProjectCard projectData={item} key={item.id}></ProjectCard>
|
<ProjectCard projectData={item} key={item.id}></ProjectCard>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,14 +1,21 @@
|
|||||||
export const THRESH_HOLD = 12; // hours
|
export const THRESH_HOLD = 12; // hours
|
||||||
export const DURATION_TIME = 10; // minutes
|
export const DURATION_TIME = 10; // minutes
|
||||||
|
|
||||||
export const MASTER_MANAGE = "660131a4-788c-4739-a082-cbbf7879cbf2";
|
export const MANAGE_MASTER = "588a8824-f924-4955-82d8-fc51956cf323";
|
||||||
|
|
||||||
export const ASSIGN_USER_TO_PROJECT = "81ab8a87-8ccd-4015-a917-0627cee6a100";
|
export const MANAGE_PROJECT = "172fc9b6-755b-4f62-ab26-55c34a330614"
|
||||||
|
|
||||||
|
export const MANAGE_EMPLOYEES = "a97d366a-c2bb-448d-be93-402bd2324566"
|
||||||
|
|
||||||
|
export const MANAGE_PROJECT_INFRA = "f2aee20a-b754-4537-8166-f9507b44585b"
|
||||||
|
|
||||||
|
export const VIEW_PROJECT_INFRA = "c7b68e33-72f0-474f-bd96-77636427ecc8"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
export const ASSIGN_TO_PROJECT = "fbd213e0-0250-46f1-9f5f-4b2a1e6e76a3";
|
||||||
|
|
||||||
export const INFRASTRUCTURE = "9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c";
|
export const INFRASTRUCTURE = "9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c";
|
||||||
|
|
||||||
export const MANAGE_PROJECT = "53176ebf-c75d-42e5-839f-4508ffac3def"
|
|
||||||
|
|
||||||
export const MANAGE_EMPLOYEES = "81ab8a87-8ccd-4015-a917-0627cee6a100"
|
|
||||||
|
|
||||||
export const MANAGE_INFRA = "9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"
|
|
Loading…
x
Reference in New Issue
Block a user