diff --git a/src/components/profiledetail/MatrimonyProfile.jsx b/src/components/profiledetail/MatrimonyProfile.jsx index bfea8fb..fb4c557 100644 --- a/src/components/profiledetail/MatrimonyProfile.jsx +++ b/src/components/profiledetail/MatrimonyProfile.jsx @@ -543,7 +543,14 @@ const MatrimonyProfile = ({ data, onRefresh }) => { {/* Action Buttons */}
- {profile.is_send_interest_received && profile.statusReceived?.toLowerCase() === 'pending' ? ( + {profile.is_blocked ? ( + + ) : profile.is_send_interest_received && profile.statusReceived?.toLowerCase() === 'pending' ? ( <>
@@ -208,7 +212,7 @@ const InterestSendPage = () => { ); }; -const ProfileCard = ({ profile, tabIndex, onStatusUpdate }) => { +const ProfileCard = ({ profile, tabIndex, onStatusUpdate, onRefresh }) => { const navigate = useNavigate(); const [isUpgradeModalOpen, setIsUpgradeModalOpen] = useState(false); const [isViewContactModalOpen, setIsViewContactModalOpen] = useState(false); @@ -218,6 +222,10 @@ const ProfileCard = ({ profile, tabIndex, onStatusUpdate }) => { const [isInterestRejectedModalOpen, setIsInterestRejectedModalOpen] = useState(false); const [unlockedMobile, setUnlockedMobile] = useState(null); const [isCreatingChat, setIsCreatingChat] = useState(false); + const [showMenu, setShowMenu] = useState(false); + const [reportModalOpen, setReportModalOpen] = useState(false); + const [reportActionType, setReportActionType] = useState("report"); + // New state for Accept/Reject confirmation const [statusConfirm, setStatusConfirm] = useState({ open: false, status: null }); @@ -324,9 +332,47 @@ const ProfileCard = ({ profile, tabIndex, onStatusUpdate }) => { } }; + const openReportModal = (type) => { + setReportActionType(type); + setReportModalOpen(true); + setShowMenu(false); + }; + + const handleReportAction = async (reason) => { + try { + if (reportActionType === 'report') { + const res = await reportProfile(profile.id, reason); + toast.success(res?.message || "Profile Reported successfully"); + } else { + const res = await blockProfile(profile.id, reason); + toast.success(res?.message || "Profile Blocked successfully"); + } + if (onRefresh) onRefresh(false); + } catch (error) { + toast.error(error?.message || `Failed to ${reportActionType === 'report' ? 'Report' : 'Block'}`); + } + }; + + const handleUnblock = async () => { + try { + // Calling the same blockProfile API without a model/reason to trigger unblocking + const res = await blockProfile(profile.id, ""); + toast.success(res?.message || "Profile Unblocked successfully"); + if (onRefresh) onRefresh(false); + } catch (error) { + toast.error(error?.message || "Failed to Unblock"); + } + }; + return ( <> + setReportModalOpen(false)} + onSubmit={handleReportAction} + actionType={reportActionType} + />
navigate(`/profile-details/${profile.id}`)} className="bg-white rounded-xl shadow-sm border border-gray-200 overflow-hidden hover:shadow-md transition-shadow cursor-pointer p-4" @@ -351,9 +397,54 @@ const ProfileCard = ({ profile, tabIndex, onStatusUpdate }) => {

{profile.name}

- + */} +
+ + {showMenu && ( +
e.stopPropagation()}> + + +
+ )} +
@@ -392,7 +483,14 @@ const ProfileCard = ({ profile, tabIndex, onStatusUpdate }) => { {/* Action Buttons based on Tab */}
- {tabIndex === 0 && profile.statusReceived === 'pending' ? ( + {profile.is_blocked ? ( + + ) : tabIndex === 0 && profile.statusReceived === 'pending' ? ( <>