diff --git a/src/components/ServiceProject/ServiceProjectBranch/BranchDetails.jsx b/src/components/ServiceProject/ServiceProjectBranch/BranchDetails.jsx
index 87d59b8c..b7c441d6 100644
--- a/src/components/ServiceProject/ServiceProjectBranch/BranchDetails.jsx
+++ b/src/components/ServiceProject/ServiceProjectBranch/BranchDetails.jsx
@@ -6,56 +6,81 @@ import { BranchDetailsSkeleton } from "../ServiceProjectSeketon";
const BranchDetails = ({ branch }) => {
const [copied, setCopied] = useState(false);
-
const { data, isLoading, isError, error } = useBranchDetails(branch);
+ if (isLoading) return ;
+ if (isError) return ;
+
+ let contactInfo = [];
+ try {
+ contactInfo = JSON.parse(data?.contactInformation || "[]");
+ } catch (e) {}
+
const googleMapUrl = data?.googleMapUrl || data?.locationLink;
const handleCopy = async () => {
if (!googleMapUrl) return;
-
await navigator.clipboard.writeText(googleMapUrl);
setCopied(true);
-
- setTimeout(() => setCopied(false), 3000);
+ setTimeout(() => setCopied(false), 2000);
};
- if (isLoading) return ;
- if (isError)
- return (
-
-
-
- );
+
return (
-<>
-
-
- Branch Details
-
-
+
+
+
+ Branch Details
+
-
-
Contact No:
-
{data?.contactInformation}
-
+
-
-
Type:
-
{data?.branchType}
-
+
-
-
Email:
-
{data?.email}
-
+
-
-
Address:
-
{data?.address}
-
->
+ {/* Contact persons */}
+ {contactInfo.map((person, index) => (
+
+
{person.contactPerson}
+
+
+
+
+ ))}
+ {/* Map Link */}
+ {googleMapUrl && (
+
+ )}
+
);
};
+const DetailRow = ({ label, value }) => (
+
+
+ {label}:
+
+
+ {value || "N/A"}
+
+
+);
+
export default BranchDetails;
diff --git a/src/components/ServiceProject/ServiceProjectBranch/ManageBranch.jsx b/src/components/ServiceProject/ServiceProjectBranch/ManageBranch.jsx
index 720fa08f..b78f8895 100644
--- a/src/components/ServiceProject/ServiceProjectBranch/ManageBranch.jsx
+++ b/src/components/ServiceProject/ServiceProjectBranch/ManageBranch.jsx
@@ -26,8 +26,8 @@ const ManageBranch = ({ closeModal, BranchToEdit = null }) => {
contactPerson: "",
designation: "",
contactEmails: [""],
- contactNumbers: [""]
- }
+ contactNumbers: [""],
+ },
]);
const { projectId } = useParams();
@@ -73,7 +73,6 @@ const ManageBranch = ({ closeModal, BranchToEdit = null }) => {
}
}, [data, reset]);
-
const { mutate: CreateServiceBranch, isPending: createPending } =
useCreateBranch(() => {
handleClose();
@@ -97,8 +96,6 @@ const ManageBranch = ({ closeModal, BranchToEdit = null }) => {
}
};
-
-
return (
@@ -138,8 +135,6 @@ const ManageBranch = ({ closeModal, BranchToEdit = null }) => {
-
-