From 71ce933c6ace07a2810bcad471f4261bb513b1fa Mon Sep 17 00:00:00 2001 From: mouazkh Date: Tue, 26 May 2026 03:22:14 +0300 Subject: [PATCH] fixed the details --- app/owner/properties/add/page.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/owner/properties/add/page.js b/app/owner/properties/add/page.js index cf714b1..44ccfcb 100644 --- a/app/owner/properties/add/page.js +++ b/app/owner/properties/add/page.js @@ -605,12 +605,11 @@ const handleMapClick = async (coords) => { const allTerms = [...new Set([...selectedTerms, ...customTerms])]; + const isRent = purpose === 'rent'; const details = { description: formData.description || '', services: selectedServices, serviceDetails: selectedServices.reduce((acc, s) => ({ ...acc, [s]: formData.serviceDetails[s] || 'in general' }), {}), - terms: allTerms.reduce((acc, k) => ({ ...acc, [k]: true }), {}), - displayType: formData.offerType === 'both' ? 'Both' : formData.offerType === 'daily' ? 'Daily' : 'Monthly', propertyCondition: formData.furnished ? 'WithFurniture' : 'WithoutFurniture', floorNumber: parseInt(formData.floorNumber) || 0, numberOfSalons: parseInt(formData.salons) || 0, @@ -625,7 +624,12 @@ const handleMapClick = async (coords) => { }, }; - if (formData.propertyType === 'room') { + if (isRent) { + details.terms = allTerms.reduce((acc, k) => ({ ...acc, [k]: true }), {}); + details.displayType = formData.offerType === 'both' ? 'Both' : formData.offerType === 'daily' ? 'Daily' : 'Monthly'; + } + + if (isRent && formData.propertyType === 'room') { details.room = { areaType: formData.roomAreaType || 'Private room', peopleAllowed: formData.roomPeopleAllowed || String(formData.bedrooms),