Clicking on Contact Name in Notes Should Redirect to That Contact’s Detail Page in Directory (Web)

This commit is contained in:
Kartik Sharma 2025-11-26 12:35:21 +05:30
parent da13e40fd5
commit e8f6298f93

View File

@ -9,6 +9,7 @@ import ConfirmModal from "../common/ConfirmModal"; // Make sure path is correct
import "../common/TextEditor/Editor.css"; import "../common/TextEditor/Editor.css";
import GlobalModel from "../common/GlobalModel"; import GlobalModel from "../common/GlobalModel";
import { useActiveInActiveNote, useUpdateNote } from "../../hooks/useDirectory"; import { useActiveInActiveNote, useUpdateNote } from "../../hooks/useDirectory";
import { useDirectoryContext } from "../../pages/Directory/DirectoryPage";
const NoteCardDirectoryEditable = ({ const NoteCardDirectoryEditable = ({
noteItem, noteItem,
@ -22,14 +23,14 @@ const NoteCardDirectoryEditable = ({
const [isDeleting, setIsDeleting] = useState(false); const [isDeleting, setIsDeleting] = useState(false);
const [isRestoring, setIsRestoring] = useState(false); const [isRestoring, setIsRestoring] = useState(false);
const [isDeleteModalOpen, setIsDeleteModalOpen] = useState(false); const [isDeleteModalOpen, setIsDeleteModalOpen] = useState(false);
const [open_contact, setOpen_contact] = useState(null);
const [isOpenModalNote, setIsOpenModalNote] = useState(false);
const { mutate: UpdateNote, isPending: isUpatingNote } = useUpdateNote(() => const { mutate: UpdateNote, isPending: isUpatingNote } = useUpdateNote(() =>
setEditing(false) setEditing(false)
); );
const { mutate: ActiveInactive, isPending: isUpdatingStatus } = const { mutate: ActiveInactive, isPending: isUpdatingStatus } =
useActiveInActiveNote(() => setIsDeleteModalOpen(false)); useActiveInActiveNote(() => setIsDeleteModalOpen(false));
const { setContactOpen } = useDirectoryContext();
const handleUpdateNote = async () => { const handleUpdateNote = async () => {
const payload = { const payload = {
@ -45,12 +46,6 @@ const NoteCardDirectoryEditable = ({
ActiveInactive({ noteId: noteItem.id, noteStatus: !noteItem.isActive }); ActiveInactive({ noteId: noteItem.id, noteStatus: !noteItem.isActive });
}; };
const contactProfile = (contactId) => {
DirectoryRepository.GetContactProfile(contactId).then((res) => {
setOpen_contact(res?.data);
setIsOpenModalNote(true);
});
};
const handleRestore = async () => { const handleRestore = async () => {
try { try {
@ -88,7 +83,9 @@ const NoteCardDirectoryEditable = ({
<div> <div>
<div <div
className="d-flex ms-3 align-middle cursor-pointer" className="d-flex ms-3 align-middle cursor-pointer"
onClick={() => contactProfile(noteItem.contactId)} onClick={() =>
setContactOpen({ contact: { id: noteItem.contactId }, Open: true })
}
> >
<span> <span>
<span className="fw-bold "> {noteItem?.contactName} </span>{" "} <span className="fw-bold "> {noteItem?.contactName} </span>{" "}
@ -97,6 +94,7 @@ const NoteCardDirectoryEditable = ({
</span> </span>
</span> </span>
</div> </div>
<div className="d-flex ms-0 align-middle"></div> <div className="d-flex ms-0 align-middle"></div>
<div className="d-flex ms-3 mt-2"> <div className="d-flex ms-3 mt-2">
<span className="text-muted"> <span className="text-muted">