Issues_Aug_1W #355
@ -19,7 +19,7 @@ import { useProfile } from "../../hooks/useProfile";
|
|||||||
const ManageBucket = () => {
|
const ManageBucket = () => {
|
||||||
const { profile } = useProfile();
|
const { profile } = useProfile();
|
||||||
const [bucketList, setBucketList] = useState([]);
|
const [bucketList, setBucketList] = useState([]);
|
||||||
const {employeesList} = useAllEmployees( false );
|
const { employeesList } = useAllEmployees(false);
|
||||||
const [selectedEmployee, setSelectEmployee] = useState([]);
|
const [selectedEmployee, setSelectEmployee] = useState([]);
|
||||||
const { buckets, loading, refetch } = useBuckets();
|
const { buckets, loading, refetch } = useBuckets();
|
||||||
const [action_bucket, setAction_bucket] = useState(false);
|
const [action_bucket, setAction_bucket] = useState(false);
|
||||||
@ -237,9 +237,8 @@ const ManageBucket = () => {
|
|||||||
onChange={(e) => setSearchTerm(e.target.value)}
|
onChange={(e) => setSearchTerm(e.target.value)}
|
||||||
/>
|
/>
|
||||||
<i
|
<i
|
||||||
className={`bx bx-refresh cursor-pointer fs-4 ${
|
className={`bx bx-refresh cursor-pointer fs-4 ${loading ? "spin" : ""
|
||||||
loading ? "spin" : ""
|
}`}
|
||||||
}`}
|
|
||||||
title="Refresh"
|
title="Refresh"
|
||||||
onClick={() => refetch()}
|
onClick={() => refetch()}
|
||||||
/>
|
/>
|
||||||
@ -248,9 +247,8 @@ const ManageBucket = () => {
|
|||||||
|
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className={`btn btn-sm btn-primary ms-auto ${
|
className={`btn btn-sm btn-primary ms-auto ${action_bucket ? "d-none" : ""
|
||||||
action_bucket ? "d-none" : ""
|
}`}
|
||||||
}`}
|
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setAction_bucket(true);
|
setAction_bucket(true);
|
||||||
select_bucket(null);
|
select_bucket(null);
|
||||||
@ -267,22 +265,33 @@ const ManageBucket = () => {
|
|||||||
<div className="row row-cols-1 row-cols-md-2 row-cols-lg-3 g-3 pt-3 px-2 px-sm-0">
|
<div className="row row-cols-1 row-cols-md-2 row-cols-lg-3 g-3 pt-3 px-2 px-sm-0">
|
||||||
{loading && (
|
{loading && (
|
||||||
<div className="col-12">
|
<div className="col-12">
|
||||||
<div className="d-flex justify-content-center align-items-center py-5">
|
<div
|
||||||
|
className="d-flex justify-content-center align-items-center py-5 w-100"
|
||||||
|
style={{ marginLeft: "250px" }}
|
||||||
|
>
|
||||||
Loading...
|
Loading...
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{!loading && buckets.length === 0 && (
|
|
||||||
|
{!loading && buckets.length === 0 && searchTerm.trim() === "" && (
|
||||||
<div className="col-12">
|
<div className="col-12">
|
||||||
<div className="d-flex justify-content-center align-items-center py-5">
|
<div
|
||||||
No Buckets Available.
|
className="d-flex justify-content-center align-items-center py-5 w-100"
|
||||||
|
style={{ marginLeft: "250px" }}
|
||||||
|
>
|
||||||
|
No buckets available.
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{!loading && sortedBucktesList.length === 0 && (
|
|
||||||
|
{!loading && buckets.length > 0 && sortedBucktesList.length === 0 && (
|
||||||
<div className="col-12">
|
<div className="col-12">
|
||||||
<div className="d-flex justify-content-center align-items-center py-5">
|
<div
|
||||||
No Matching Bucket Found.
|
className="d-flex justify-content-center align-items-center py-5 w-100"
|
||||||
|
style={{ marginLeft: "250px" }}
|
||||||
|
>
|
||||||
|
No matching buckets found.
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
@ -296,29 +305,29 @@ const ManageBucket = () => {
|
|||||||
{(DirManager ||
|
{(DirManager ||
|
||||||
DirAdmin ||
|
DirAdmin ||
|
||||||
bucket?.createdBy?.id ===
|
bucket?.createdBy?.id ===
|
||||||
profile?.employeeInfo?.id) && (
|
profile?.employeeInfo?.id) && (
|
||||||
<div className="d-flex gap-2">
|
<div className="d-flex gap-2">
|
||||||
<i
|
<i
|
||||||
className="bx bx-edit bx-sm text-primary cursor-pointer"
|
className="bx bx-edit bx-sm text-primary cursor-pointer"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
select_bucket(bucket);
|
select_bucket(bucket);
|
||||||
setAction_bucket(true);
|
setAction_bucket(true);
|
||||||
const initialSelectedEmployees = employeesList
|
const initialSelectedEmployees = employeesList
|
||||||
.filter((emp) =>
|
.filter((emp) =>
|
||||||
bucket.employeeIds?.includes(
|
bucket.employeeIds?.includes(
|
||||||
emp.employeeId
|
emp.employeeId
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
.map((emp) => ({ ...emp, isActive: true }));
|
||||||
.map((emp) => ({ ...emp, isActive: true }));
|
setSelectEmployee(initialSelectedEmployees);
|
||||||
setSelectEmployee(initialSelectedEmployees);
|
}}
|
||||||
}}
|
></i>
|
||||||
></i>
|
<i
|
||||||
<i
|
className="bx bx-trash bx-sm text-danger cursor-pointer ms-0"
|
||||||
className="bx bx-trash bx-sm text-danger cursor-pointer ms-0"
|
onClick={() => setDeleteBucket(bucket?.id)}
|
||||||
onClick={() => setDeleteBucket(bucket?.id)}
|
></i>
|
||||||
></i>
|
</div>
|
||||||
</div>
|
)}
|
||||||
)}
|
|
||||||
</h6>
|
</h6>
|
||||||
<h6 className="card-subtitle mb-2 text-muted text-start">
|
<h6 className="card-subtitle mb-2 text-muted text-start">
|
||||||
Contacts:{" "}
|
Contacts:{" "}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user