From 0f323a75941f0554aca6c523102541d15f980ffc Mon Sep 17 00:00:00 2001 From: Pramod Mahajan Date: Thu, 29 May 2025 00:32:05 +0530 Subject: [PATCH 1/4] removed eaxtra gap between avatra and name --- src/components/Directory/ListViewDirectory.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Directory/ListViewDirectory.jsx b/src/components/Directory/ListViewDirectory.jsx index 2258fb5b..20636c2e 100644 --- a/src/components/Directory/ListViewDirectory.jsx +++ b/src/components/Directory/ListViewDirectory.jsx @@ -12,7 +12,7 @@ const ListViewDirectory = ({IsActive, contact,setSelectedContact,setIsOpenModal, setOpen_contact(contact); } }}> -
+
Date: Thu, 29 May 2025 00:33:01 +0530 Subject: [PATCH 2/4] added manager permission for directory --- src/components/Directory/EmployeeList.jsx | 37 ++++++++++++++--------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/src/components/Directory/EmployeeList.jsx b/src/components/Directory/EmployeeList.jsx index fb644374..f2d4f7c1 100644 --- a/src/components/Directory/EmployeeList.jsx +++ b/src/components/Directory/EmployeeList.jsx @@ -1,25 +1,24 @@ -import React,{useState,useEffect} from 'react' -import {useSortableData} from '../../hooks/useSortableData'; -const EmployeeList = ( {employees, onChange, assignedEmployee = []} ) => -{ +import React, { useState, useEffect } from "react"; +import { useSortableData } from "../../hooks/useSortableData"; +import Avatar from "../common/Avatar"; +const EmployeeList = ({ employees, onChange, bucket }) => { const [employeefiltered, setEmployeeFilter] = useState([]); const [employeeStatusList, setEmployeeStatusList] = useState([]); const [searchTerm, setSearchTerm] = useState(""); - // Populate filtered list on load useEffect(() => { setEmployeeFilter(employees?.filter((emp) => emp.email != null) || []); }, [employees]); // Initialize checked employees based on assignedEmployee prop useEffect(() => { - if (Array.isArray(assignedEmployee)) { - const initialStatus = assignedEmployee.map((id) => ({ + if (Array.isArray(bucket?.employeeIds)) { + const initialStatus = bucket?.employeeIds?.map((id) => ({ employeeId: id, isActive: true, })); setEmployeeStatusList(initialStatus); } - }, [assignedEmployee]); + }, [bucket]); // Send updated list to parent useEffect(() => { @@ -66,7 +65,8 @@ const EmployeeList = ( {employees, onChange, assignedEmployee = []} ) => }; const filteredEmployees = sortedEmployees?.filter((employee) => { - const fullName = `${employee?.firstName} ${employee?.lastName}`?.toLowerCase(); + const fullName = + `${employee?.firstName} ${employee?.lastName}`?.toLowerCase(); return fullName.includes(searchTerm.toLowerCase()); }); return ( @@ -121,18 +121,25 @@ const EmployeeList = ( {employees, onChange, assignedEmployee = []} ) => filteredEmployees?.map((employee) => ( -
+
handleCheckboxChange(employee.id)} + disabled={bucket.createdBy.id === employee.id} /> -
-

- {`${employee.firstName} ${employee.lastName}`} -

-
+ + + {`${employee.firstName} ${employee.lastName}`}
-- 2.43.0 From 2a5e075db5ee00647b9530fb9d5b8ae6d923bc24 Mon Sep 17 00:00:00 2001 From: Pramod Mahajan Date: Thu, 29 May 2025 00:33:44 +0530 Subject: [PATCH 3/4] added directory permission Ids --- src/utils/constants.jsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/utils/constants.jsx b/src/utils/constants.jsx index dfbea3c3..2acf4e15 100644 --- a/src/utils/constants.jsx +++ b/src/utils/constants.jsx @@ -25,4 +25,10 @@ export const MANAGE_TASK = "08752f33-3b29-4816-b76b-ea8a968ed3c5" export const VIEW_TASK = "9fcc5f87-25e3-4846-90ac-67a71ab92e3c" -export const ASSIGN_REPORT_TASK = "6a32379b-8b3f-49a6-8c48-4b7ac1b55dc2" \ No newline at end of file +export const ASSIGN_REPORT_TASK = "6a32379b-8b3f-49a6-8c48-4b7ac1b55dc2" + +export const DIRECTORY_ADMIN = "4286a13b-bb40-4879-8c6d-18e9e393beda" + +export const DIRECTORY_MANAGER = "62668630-13ce-4f52-a0f0-db38af2230c5" + +export const DIRECTORY_USER = "0f919170-92d4-4337-abd3-49b66fc871bb" \ No newline at end of file -- 2.43.0 From 8c66a9a08317f797e7cea8e51f9f8ab8ab7dc108 Mon Sep 17 00:00:00 2001 From: Pramod Mahajan Date: Thu, 29 May 2025 00:46:58 +0530 Subject: [PATCH 4/4] Prevent error by safely accessing bucket creator with optional chaining --- src/components/Directory/EmployeeList.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/Directory/EmployeeList.jsx b/src/components/Directory/EmployeeList.jsx index f2d4f7c1..1374ba38 100644 --- a/src/components/Directory/EmployeeList.jsx +++ b/src/components/Directory/EmployeeList.jsx @@ -126,8 +126,8 @@ const EmployeeList = ({ employees, onChange, bucket }) => { className="form-check-input me-3 mt-1" type="checkbox" checked={isChecked(employee.id)} - onChange={() => handleCheckboxChange(employee.id)} - disabled={bucket.createdBy.id === employee.id} + onChange={() => handleCheckboxChange(employee?.id)} + disabled={bucket?.createdBy?.id === employee?.id} />