diff --git a/src/components/ServiceProject/ServiceProjectBranch/ServiceBranch.jsx b/src/components/ServiceProject/ServiceProjectBranch/ServiceBranch.jsx
index 63bdb09c..61a4c011 100644
--- a/src/components/ServiceProject/ServiceProjectBranch/ServiceBranch.jsx
+++ b/src/components/ServiceProject/ServiceProjectBranch/ServiceBranch.jsx
@@ -8,6 +8,7 @@ import { useParams } from "react-router-dom";
import Pagination from "../../common/Pagination";
import ConfirmModal from "../../common/ConfirmModal";
import { SpinnerLoader } from "../../common/Loader";
+import ViewBranchDetails from "./ViewBranchDetails";
const ServiceBranch = () => {
const { projectId } = useParams();
@@ -19,6 +20,7 @@ const ServiceBranch = () => {
});
const { mutate: DeleteBranch, isPending } = useDeleteBranch();
const [deletingId, setDeletingId] = useState(null);
+ const [ViewRequest, setViewRequest] = useState({ requestId: null, view: false });
const [search, setSearch] = useState("");
const [currentPage, setCurrentPage] = useState(1);
@@ -84,7 +86,7 @@ const ServiceBranch = () => {
- Branchs
+ Branches
@@ -171,37 +173,67 @@ const ServiceBranch = () => {
!isError &&
data?.data?.length > 0 &&
data.data.map((branch) => (
-
+
{
+ if (!e.target.closest(".dropdown") && !e.target.closest(".bx-show")) {
+ setViewRequest({ branchId: branch.id, view: true });
+ }
+ }}
+ >
{columns.map((col) => (
|
{col.getValue(branch)}
|
))}
-
-
-
- {!showInactive ? (
- <>
- -
- setManageState({
- IsOpen: true,
- branchId: branch.id,
- })
- }
- >
-
-
- Modify
-
-
+
+ {/* View Icon */}
+
+ setViewRequest({ branchId: branch.id, view: true })
+ }
+ >
+
+
+
+
+ {!showInactive ? (
+ <>
+ -
+ setManageState({
+ IsOpen: true,
+ branchId: branch.id,
+ })
+ }
+ >
+
+
+ Modify
+
+
+ - {
+ setIsDeleteModalOpen(true);
+ setDeletingId(branch.id);
+ }}
+ >
+
+
+ Delete
+
+
+ >
+ ) : (
- {
setIsDeleteModalOpen(true);
@@ -209,25 +241,13 @@ const ServiceBranch = () => {
}}
>
-
- Delete
+
+ Restore
- >
- ) : (
- - {
- setIsDeleteModalOpen(true);
- setDeletingId(branch.id);
- }}
- >
-
-
- Restore
-
-
- )}
-
+ )}
+
+
|
@@ -277,6 +297,17 @@ const ServiceBranch = () => {
/>
)}
+ {ViewRequest.view && (
+ setViewRequest({ branchId: null, view: false })}
+ >
+
+
+
+ )}
>
diff --git a/src/components/ServiceProject/ServiceProjectBranch/ViewBranchDetails.jsx b/src/components/ServiceProject/ServiceProjectBranch/ViewBranchDetails.jsx
new file mode 100644
index 00000000..db67ea8b
--- /dev/null
+++ b/src/components/ServiceProject/ServiceProjectBranch/ViewBranchDetails.jsx
@@ -0,0 +1,142 @@
+import React from "react";
+import { useBranchDetails } from "../../../hooks/useServiceProject";
+import Avatar from "../../common/Avatar";
+import { formatUTCToLocalTime } from "../../../utils/dateUtils";
+
+const ViewBranchDetails = ({ BranchToEdit }) => {
+ const { data, isLoading, isError, error: requestError } = useBranchDetails(BranchToEdit);
+
+ console.log("branch details:", data);
+
+ if (isLoading) return Loading...
;
+ if (isError) return Error: {requestError?.message}
;
+
+ return (
+
+ );
+};
+
+export default ViewBranchDetails;