diff --git a/app/owner/properties/page.js b/app/owner/properties/page.js index eb34b16..e9594f3 100644 --- a/app/owner/properties/page.js +++ b/app/owner/properties/page.js @@ -254,20 +254,28 @@ const PropertyViewModal = ({ isOpen, onClose, property }) => {

- {property.services && Object.keys(property.services).length > 0 && ( + {property.services && (Array.isArray(property.services) ? property.services.length > 0 : Object.keys(property.services).length > 0) && (

الخدمات المتوفرة

- {Object.entries(property.services).map(([key, value]) => { - if (!value) return null; - const detail = typeof value === 'object' && value.detail ? value.detail : null; - return ( - - {serviceLabels[key] || key} - {detail && · {detail}} + {Array.isArray(property.services) ? ( + property.services.map((svc, i) => ( + + {serviceLabels[svc] || svc} - ); - })} + )) + ) : ( + Object.entries(property.services).map(([key, value]) => { + if (!value) return null; + const detail = typeof value === 'object' && value.detail ? value.detail : null; + return ( + + {serviceLabels[key] || key} + {detail && · {detail}} + + ); + }) + )}
)} diff --git a/app/property/[id]/PropertyDetail.js b/app/property/[id]/PropertyDetail.js index 84e6573..97ba66c 100644 --- a/app/property/[id]/PropertyDetail.js +++ b/app/property/[id]/PropertyDetail.js @@ -483,20 +483,28 @@ export default function PropertyDetailsPage() { {/* Services with detail text */} - {Object.keys(property.services).length > 0 && ( + {property.services && (Array.isArray(property.services) ? property.services.length > 0 : Object.keys(property.services).length > 0) && (

الخدمات

- {Object.entries(property.services).map(([key, val]) => { - if (!val) return null; - const detail = typeof val === 'object' && val.detail ? val.detail : null; - return ( - - {serviceLabels[key] || key} - {detail && · {detail}} + {Array.isArray(property.services) ? ( + property.services.map((svc, i) => ( + + {serviceLabels[svc] || svc} - ); - })} + )) + ) : ( + Object.entries(property.services).map(([key, val]) => { + if (!val) return null; + const detail = typeof val === 'object' && val.detail ? val.detail : null; + return ( + + {serviceLabels[key] || key} + {detail && · {detail}} + + ); + }) + )}
)}