fixed the details
All checks were successful
Build frontend / build (push) Successful in 43s

This commit is contained in:
mouazkh
2026-05-26 00:20:20 +03:00
parent 085c60ec33
commit 9f6492cf41
4 changed files with 115 additions and 8 deletions

View File

@ -46,6 +46,11 @@ import {
Star,
Ban,
Check,
School,
Hospital,
Store,
GraduationCap,
TreePine,
} from "lucide-react";
import toast, { Toaster } from "react-hot-toast";
import AuthService from "../../services/AuthService";
@ -153,6 +158,21 @@ const termLabels = {
OnlyMales: "ذكور فقط",
};
const proximityLabels = {
School: "مدرسة",
Hospital: "مستشفى",
Restaurant: "مطعم",
University: "جامعة",
Park: "حديقة",
Mall: "مركز تسوق",
Supermarket: "سوبر ماركت",
Pharmacy: "صيدلية",
Mosque: "مسجد",
Bank: "بنك",
Airport: "مطار",
BusStation: "موقف باص",
};
const PropertyViewModal = ({ isOpen, onClose, property }) => {
if (!isOpen || !property) return null;
@ -220,6 +240,30 @@ const PropertyViewModal = ({ isOpen, onClose, property }) => {
{property.propertyTypeLabel || "عقار"}
</span>
</p>
<p className="text-sm">
<span className="text-gray-500">نوع العرض:</span>
<span className="font-medium text-gray-900 mr-2">
{property.displayType === "Daily rent"
? "إيجار يومي"
: property.displayType === "Monthly rent"
? "إيجار شهري"
: property.displayType === "Both"
? "يومي وشهري"
: property.displayType === "For sale"
? "للبيع"
: property.rentType === "daily"
? "إيجار يومي"
: property.rentType === "monthly"
? "إيجار شهري"
: (property.dailyPrice > 0 && property.monthlyPrice > 0)
? "يومي وشهري"
: property.monthlyPrice > 0
? "إيجار شهري"
: property.dailyPrice > 0
? "إيجار يومي"
: property.purpose === "sale" ? "للبيع" : "عرض"}
</span>
</p>
{property.purpose === "rent" && (
<p className="text-sm">
<span className="text-gray-500">حالة التأثيث:</span>
@ -355,9 +399,39 @@ const PropertyViewModal = ({ isOpen, onClose, property }) => {
</span>
);
})}
</div>
</div>
)}
</div>
)}
{property.proximity && Object.keys(property.proximity).length > 0 && (
<div className="bg-gray-50 p-4 rounded-xl mb-6">
<h4 className="font-bold text-gray-700 mb-3">القرب من الخدمات</h4>
<div className="grid grid-cols-2 md:grid-cols-3 gap-2">
{Object.entries(property.proximity).map(([key, val]) => {
if (!val) return null;
const dist = typeof val === "object" ? val.distance : val;
return (
<div
key={key}
className="flex items-center gap-2 p-2 bg-white rounded-lg"
>
{key === "School" && <School className="w-4 h-4 text-amber-500" />}
{key === "Hospital" && <Hospital className="w-4 h-4 text-amber-500" />}
{key === "Restaurant" && <Store className="w-4 h-4 text-amber-500" />}
{key === "University" && <GraduationCap className="w-4 h-4 text-amber-500" />}
{key === "Park" && <TreePine className="w-4 h-4 text-amber-500" />}
{key === "Mall" && <Building className="w-4 h-4 text-amber-500" />}
{!["School","Hospital","Restaurant","University","Park","Mall"].includes(key) && <MapPin className="w-4 h-4 text-amber-500" />}
<div>
<span className="text-sm text-gray-700">{proximityLabels[key] || key}</span>
<span className="text-xs text-gray-500 mr-1">{dist} {typeof dist === "number" ? "كم" : ""}</span>
</div>
</div>
);
})}
</div>
</div>
)}
{property.terms && Object.keys(property.terms).length > 0 && (
<div className="bg-gray-50 p-4 rounded-xl mb-6">
@ -956,7 +1030,7 @@ export default function OwnerPropertiesPage() {
const mappedRent = rentList.map((item) => {
const info = item.propertyInformation || {};
const details = (() => {
const details = typeof info.detailsJSON === 'object' && info.detailsJSON ? info.detailsJSON : (() => {
try {
return JSON.parse(info.detailsJSON || "{}");
} catch {
@ -1037,6 +1111,7 @@ export default function OwnerPropertiesPage() {
: ["/property-placeholder.jpg"],
createdAt: item.createdAt || new Date().toISOString(),
furnished: details.furnished || false,
displayType: details.displayType || (item.dailyRent && item.monthlyRent ? 'Both' : item.monthlyRent ? 'Monthly rent' : item.dailyRent ? 'Daily rent' : 'Both'),
description: info.description || "",
address: info.address || "",
city: "",
@ -1052,7 +1127,7 @@ export default function OwnerPropertiesPage() {
const mappedSale = saleList.map((item) => {
const info = item.propertyInformation || {};
const details = (() => {
const details = typeof info.detailsJSON === 'object' && info.detailsJSON ? info.detailsJSON : (() => {
try {
return JSON.parse(info.detailsJSON || "{}");
} catch {
@ -1125,6 +1200,7 @@ export default function OwnerPropertiesPage() {
: ["/property-placeholder.jpg"],
createdAt: item.createdAt || new Date().toISOString(),
furnished: details.furnished || false,
displayType: details.displayType || 'For sale',
description: info.description || "",
address: info.address || "",
city: "",