This commit is contained in:
@ -648,19 +648,19 @@ const handleMapClick = async (coords) => {
|
|||||||
const detailsJSON = JSON.stringify(details);
|
const detailsJSON = JSON.stringify(details);
|
||||||
|
|
||||||
const propInfo = {
|
const propInfo = {
|
||||||
CordsX: formData.lat ? String(formData.lat) : '',
|
cordsX: formData.lat ? String(formData.lat) : '',
|
||||||
CordsY: formData.lng ? String(formData.lng) : '',
|
cordsY: formData.lng ? String(formData.lng) : '',
|
||||||
Images: uploadedImagePaths,
|
images: uploadedImagePaths,
|
||||||
Address: `${formData.city} - ${formData.district} - ${formData.address}`.trim(),
|
address: `${formData.city} - ${formData.district} - ${formData.address}`.trim(),
|
||||||
Description: formData.description || '',
|
description: formData.description || '',
|
||||||
NumberOfBathRooms: formData.bathrooms || 0,
|
numberOfBathRooms: formData.bathrooms || 0,
|
||||||
NumberOfRooms: formData.bedrooms || 0,
|
numberOfRooms: formData.bedrooms || 0,
|
||||||
NumberOfBedRooms: formData.bedrooms || 0,
|
numberOfBedRooms: formData.bedrooms || 0,
|
||||||
Space: parseFloat(formData.space) || 0,
|
space: parseFloat(formData.space) || 0,
|
||||||
DetailsJSON: detailsJSON,
|
detailsJSON,
|
||||||
BuildingType: buildingTypeMap[formData.propertyType] ?? BuildingType.APARTMENT,
|
buildingType: buildingTypeMap[formData.propertyType] ?? BuildingType.APARTMENT,
|
||||||
Status: 0,
|
status: 0,
|
||||||
PropertyType: formData.furnished ? RentPropertyCondition.WITH_FURNITURE : RentPropertyCondition.WITHOUT_FURNITURE,
|
propertyType: formData.furnished ? RentPropertyCondition.WITH_FURNITURE : RentPropertyCondition.WITHOUT_FURNITURE,
|
||||||
};
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -676,18 +676,20 @@ const handleMapClick = async (coords) => {
|
|||||||
toast.success('تم إضافة عقار للبيع بنجاح!');
|
toast.success('تم إضافة عقار للبيع بنجاح!');
|
||||||
} else {
|
} else {
|
||||||
const rentTypeMap = { daily: RentType.DAILY, monthly: RentType.MONTHLY, both: RentType.MONTHLY };
|
const rentTypeMap = { daily: RentType.DAILY, monthly: RentType.MONTHLY, both: RentType.MONTHLY };
|
||||||
const rentBody = {
|
const payload = {
|
||||||
PropertyInformation: propInfo,
|
propertyInformation: propInfo,
|
||||||
Deposit: parseFloat(formData.deposit) || 0,
|
deposit: parseFloat(formData.deposit) || 0,
|
||||||
MonthlyRent: parseFloat(formData.monthlyPrice) || 0,
|
monthlyRent: parseFloat(formData.monthlyPrice) || 0,
|
||||||
DailyRent: parseFloat(formData.dailyPrice) || 0,
|
dailyRent: parseFloat(formData.dailyPrice) || 0,
|
||||||
Rating: 1,
|
rating: 1,
|
||||||
CurrencyId: selectedCurrencyId,
|
currencyId: selectedCurrencyId,
|
||||||
RentType: rentTypeMap[formData.offerType] ?? RentType.MONTHLY,
|
rentType: rentTypeMap[formData.offerType] ?? RentType.MONTHLY,
|
||||||
Type: formData.furnished ? RentPropertyType.FURNISHED : RentPropertyType.UNFURNISHED,
|
type: formData.furnished ? RentPropertyType.FURNISHED : RentPropertyType.UNFURNISHED,
|
||||||
AllowedPaymentPeriod: '01:00:00:00',
|
allowedPaymentPeriod: '',
|
||||||
|
isSmokeAllow: null,
|
||||||
|
specializedFor: null,
|
||||||
|
isVisitorAllow: null,
|
||||||
};
|
};
|
||||||
const payload = { rentPropertyDto: rentBody };
|
|
||||||
console.log('[AddProperty] Rent payload:', JSON.stringify(payload, null, 2));
|
console.log('[AddProperty] Rent payload:', JSON.stringify(payload, null, 2));
|
||||||
const res = await addRentProperty(payload);
|
const res = await addRentProperty(payload);
|
||||||
console.log('[AddProperty] Rent API response:', res);
|
console.log('[AddProperty] Rent API response:', res);
|
||||||
|
|||||||
@ -1270,47 +1270,49 @@ export default function OwnerPropertiesPage() {
|
|||||||
};
|
};
|
||||||
const detailsJSON = JSON.stringify(details);
|
const detailsJSON = JSON.stringify(details);
|
||||||
|
|
||||||
const editBody = {
|
const payload = {
|
||||||
PropertyInformation: {
|
propertyInformation: {
|
||||||
CordsX: raw.propertyInformation?.cordsX || "",
|
cordsX: raw.propertyInformation?.cordsX || "",
|
||||||
CordsY: raw.propertyInformation?.cordsY || "",
|
cordsY: raw.propertyInformation?.cordsY || "",
|
||||||
Address:
|
address:
|
||||||
updatedProperty.address || raw.propertyInformation?.address || "",
|
updatedProperty.address || raw.propertyInformation?.address || "",
|
||||||
Description:
|
description:
|
||||||
updatedProperty.description ||
|
updatedProperty.description ||
|
||||||
raw.propertyInformation?.description ||
|
raw.propertyInformation?.description ||
|
||||||
"",
|
"",
|
||||||
NumberOfBathRooms:
|
numberOfBathRooms:
|
||||||
updatedProperty.bathrooms ||
|
updatedProperty.bathrooms ||
|
||||||
raw.propertyInformation?.numberOfBathRooms ||
|
raw.propertyInformation?.numberOfBathRooms ||
|
||||||
0,
|
0,
|
||||||
NumberOfRooms: updatedProperty.bedrooms || 0,
|
numberOfRooms: updatedProperty.bedrooms || 0,
|
||||||
NumberOfBedRooms:
|
numberOfBedRooms:
|
||||||
updatedProperty.bedrooms ||
|
updatedProperty.bedrooms ||
|
||||||
raw.propertyInformation?.numberOfBedRooms ||
|
raw.propertyInformation?.numberOfBedRooms ||
|
||||||
0,
|
0,
|
||||||
Space:
|
space:
|
||||||
parseFloat(updatedProperty.area) ||
|
parseFloat(updatedProperty.area) ||
|
||||||
raw.propertyInformation?.space ||
|
raw.propertyInformation?.space ||
|
||||||
0,
|
0,
|
||||||
DetailsJSON: detailsJSON,
|
detailsJSON,
|
||||||
BuildingType: buildingTypeMap[updatedProperty.propertyType] ?? 0,
|
buildingType: buildingTypeMap[updatedProperty.propertyType] ?? 0,
|
||||||
Status: updatedProperty.status === "available" ? 0 : 1,
|
status: updatedProperty.status === "available" ? 0 : 1,
|
||||||
PropertyType: updatedProperty.furnished ? 0 : 1,
|
propertyType: updatedProperty.furnished ? 0 : 1,
|
||||||
Images: raw.propertyInformation?.images || [],
|
images: raw.propertyInformation?.images || [],
|
||||||
},
|
},
|
||||||
Deposit: parseFloat(updatedProperty.deposit) || raw.deposit || 0,
|
deposit: parseFloat(updatedProperty.deposit) || raw.deposit || 0,
|
||||||
MonthlyRent:
|
monthlyRent:
|
||||||
parseFloat(updatedProperty.monthlyPrice) || raw.monthlyRent || 0,
|
parseFloat(updatedProperty.monthlyPrice) || raw.monthlyRent || 0,
|
||||||
DailyRent:
|
dailyRent:
|
||||||
parseFloat(updatedProperty.dailyPrice) || raw.dailyRent || 0,
|
parseFloat(updatedProperty.dailyPrice) || raw.dailyRent || 0,
|
||||||
Rating: 1,
|
rating: 1,
|
||||||
CurrencyId: updatedProperty.currencyId || raw.currencyId || 1,
|
currencyId: updatedProperty.currencyId || raw.currencyId || 1,
|
||||||
RentType: rentTypeMap[updatedProperty.rentType] ?? 0,
|
rentType: rentTypeMap[updatedProperty.rentType] ?? 0,
|
||||||
Type: updatedProperty.furnished ? 0 : 1,
|
type: updatedProperty.furnished ? 0 : 1,
|
||||||
AllowedPaymentPeriod: "01:00:00:00",
|
allowedPaymentPeriod: "",
|
||||||
|
isSmokeAllow: null,
|
||||||
|
specializedFor: null,
|
||||||
|
isVisitorAllow: null,
|
||||||
};
|
};
|
||||||
const payload = { rentPropertyDto: editBody };
|
|
||||||
|
|
||||||
await editRentProperty(updatedProperty.id, payload);
|
await editRentProperty(updatedProperty.id, payload);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user