This commit is contained in:
@ -123,6 +123,7 @@ export default function AddPropertyPage() {
|
||||
dailyPrice: "",
|
||||
monthlyPrice: "",
|
||||
deposit: "",
|
||||
commission: "",
|
||||
allowedPaymentPeriod: "",
|
||||
|
||||
city: Governorate.DAMASCUS,
|
||||
@ -562,6 +563,7 @@ export default function AddPropertyPage() {
|
||||
} else if (formData.offerType === "both") {
|
||||
if (!formData.dailyPrice) newErrors.dailyPrice = t("addProperty.dailyPriceRequired");
|
||||
if (!formData.monthlyPrice) newErrors.monthlyPrice = t("addProperty.monthlyPriceRequired");
|
||||
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -681,6 +683,7 @@ export default function AddPropertyPage() {
|
||||
const isRent = purpose === "rent";
|
||||
const details = {
|
||||
description: formData.description || "",
|
||||
commission: parseFloat(formData.commission) || 0,
|
||||
services: selectedServices,
|
||||
serviceDetails: selectedServices.reduce((acc, s) => ({ ...acc, [s]: formData.serviceDetails[s] || "in general" }), {}),
|
||||
propertyCondition: formData.furnished ? "WithFurniture" : "WithoutFurniture",
|
||||
@ -753,9 +756,9 @@ export default function AddPropertyPage() {
|
||||
price: parseFloat(formData.salePrice),
|
||||
deposit: parseFloat(formData.deposit) || 0,
|
||||
};
|
||||
console.log("ff", payload);
|
||||
|
||||
const res = await addSaleProperty(payload);
|
||||
console.log(res);
|
||||
|
||||
toast.success(t("toast.salePropertySuccess"));
|
||||
} else {
|
||||
const rentTypeMap = { daily: RentType.DAILY, monthly: RentType.MONTHLY, both: RentType.MONTHLY };
|
||||
@ -773,7 +776,9 @@ export default function AddPropertyPage() {
|
||||
type: formData.furnished ? RentPropertyType.FURNISHED : RentPropertyType.UNFURNISHED,
|
||||
allowedPaymentPeriod: formData.allowedPaymentPeriod || "1.00:00:00",
|
||||
});
|
||||
|
||||
const res = await addRentProperty(payload);
|
||||
|
||||
toast.success(t("toast.rentPropertySuccess"));
|
||||
}
|
||||
setTimeout(() => {
|
||||
@ -1221,7 +1226,7 @@ export default function AddPropertyPage() {
|
||||
{step === 3 && purpose === "sale" && (
|
||||
<motion.div variants={fadeInUp} className="space-y-8">
|
||||
<div className="text-center mb-6">
|
||||
<div className="w-20 h-20 bg-amber-500 rounded-2xl flex items-center justify-center mx-auto mb-4">
|
||||
<div className="w-20 h-20 bg-amber-400 rounded-2xl flex items-center justify-center mx-auto mb-4">
|
||||
<DollarSign className="w-10 h-10 text-amber-600" />
|
||||
</div>
|
||||
<h2 className="text-2xl font-bold text-gray-900 mb-2">{t("addProperty.salePriceTitle")}</h2>
|
||||
@ -1251,6 +1256,33 @@ export default function AddPropertyPage() {
|
||||
placeholder={t("addProperty.salePricePlaceholder")}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="mt-3">
|
||||
<label className="block text-sm font-medium text-gray-700 mb-2">
|
||||
{t("commission")} ({currencySymbol})
|
||||
</label>
|
||||
<div className="relative ">
|
||||
<span className="absolute right-3 top-1/2 transform -translate-y-1/2 w-5 h-5 text-gray-400 font-bold text-sm flex items-center justify-center">{currencySymbol}</span>
|
||||
<input
|
||||
type="number"
|
||||
min="0"
|
||||
value={formData.commission || ""}
|
||||
onChange={(e) => {
|
||||
const val = e.target.value;
|
||||
|
||||
if (val === "" || parseFloat(val) >= 0) {
|
||||
setFormData({ ...formData, commission: val });
|
||||
}
|
||||
(formData.commission);
|
||||
}}
|
||||
onKeyDown={(e) => {
|
||||
if (["-", "e", "E", "+"].includes(e.key)) e.preventDefault();
|
||||
}}
|
||||
className="w-full pr-12 pl-4 py-3 border border-gray-300 rounded-xl focus:outline-none focus:ring-2 focus:ring-amber-500"
|
||||
placeholder={t("addProperty.depositPlaceholder")}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
{errors.salePrice && <p className="text-red-500 text-sm mt-1">{errors.salePrice}</p>}
|
||||
</div>
|
||||
|
||||
@ -1378,6 +1410,33 @@ export default function AddPropertyPage() {
|
||||
placeholder={t("addProperty.depositPlaceholder")}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* كمسيون */}
|
||||
<div className="mt-3">
|
||||
<label className="block text-sm font-medium text-gray-700 mb-2">
|
||||
{t("commission")} ({currencySymbol})
|
||||
</label>
|
||||
<div className="relative ">
|
||||
<span className="absolute right-3 top-1/2 transform -translate-y-1/2 w-5 h-5 text-gray-400 font-bold text-sm flex items-center justify-center">{currencySymbol}</span>
|
||||
<input
|
||||
type="number"
|
||||
min="0"
|
||||
value={formData.commission || ""}
|
||||
onChange={(e) => {
|
||||
const val = e.target.value;
|
||||
if (val === "" || parseFloat(val) >= 0) {
|
||||
setFormData({ ...formData, commission: val });
|
||||
}
|
||||
|
||||
}}
|
||||
onKeyDown={(e) => {
|
||||
if (["-", "e", "E", "+"].includes(e.key)) e.preventDefault();
|
||||
}}
|
||||
className="w-full pr-12 pl-4 py-3 border border-gray-300 rounded-xl focus:outline-none focus:ring-2 focus:ring-amber-500"
|
||||
placeholder={t("addProperty.depositPlaceholder")}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</motion.div>
|
||||
)}
|
||||
@ -1433,6 +1492,30 @@ export default function AddPropertyPage() {
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div className="mt-3">
|
||||
<label className="block text-sm font-medium text-gray-700 mb-2">
|
||||
{t("commission")} ({currencySymbol})
|
||||
</label>
|
||||
<div className="relative ">
|
||||
<span className="absolute right-3 top-1/2 transform -translate-y-1/2 w-5 h-5 text-gray-400 font-bold text-sm flex items-center justify-center">{currencySymbol}</span>
|
||||
<input
|
||||
type="number"
|
||||
min="0"
|
||||
value={formData.commission || ""}
|
||||
onChange={(e) => {
|
||||
const val = e.target.value;
|
||||
if (val === "" || parseFloat(val) >= 0) {
|
||||
setFormData({ ...formData, commission: val });
|
||||
}
|
||||
}}
|
||||
onKeyDown={(e) => {
|
||||
if (["-", "e", "E", "+"].includes(e.key)) e.preventDefault();
|
||||
}}
|
||||
className="w-full pr-12 pl-4 py-3 border border-gray-300 rounded-xl focus:outline-none focus:ring-2 focus:ring-amber-500"
|
||||
placeholder={t("addProperty.depositPlaceholder")}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</motion.div>
|
||||
)}
|
||||
|
||||
@ -1512,6 +1595,30 @@ export default function AddPropertyPage() {
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div className="mt-3">
|
||||
<label className="block text-sm font-medium text-gray-700 mb-2">
|
||||
{t("commission")} ({currencySymbol})
|
||||
</label>
|
||||
<div className="relative ">
|
||||
<span className="absolute right-3 top-1/2 transform -translate-y-1/2 w-5 h-5 text-gray-400 font-bold text-sm flex items-center justify-center">{currencySymbol}</span>
|
||||
<input
|
||||
type="number"
|
||||
min="0"
|
||||
value={formData.commission || ""}
|
||||
onChange={(e) => {
|
||||
const val = e.target.value;
|
||||
if (val === "" || parseFloat(val) >= 0) {
|
||||
setFormData({ ...formData, commission: val });
|
||||
}
|
||||
}}
|
||||
onKeyDown={(e) => {
|
||||
if (["-", "e", "E", "+"].includes(e.key)) e.preventDefault();
|
||||
}}
|
||||
className="w-full pr-12 pl-4 py-3 border border-gray-300 rounded-xl focus:outline-none focus:ring-2 focus:ring-amber-500"
|
||||
placeholder={t("addProperty.depositPlaceholder")}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</motion.div>
|
||||
)}
|
||||
</AnimatePresence>
|
||||
|
||||
Reference in New Issue
Block a user