diff --git a/app/owner/properties/add/page.js b/app/owner/properties/add/page.js index dd2b516..285e487 100644 --- a/app/owner/properties/add/page.js +++ b/app/owner/properties/add/page.js @@ -51,7 +51,7 @@ import { Move } from 'lucide-react'; import toast, { Toaster } from 'react-hot-toast'; -import { addRentProperty } from '../../../utils/api'; +import { addRentProperty, getCurrencies, uploadPicture } from '../../../utils/api'; import { BuildingType, RentPropertyCondition, @@ -140,6 +140,7 @@ export default function AddPropertyPage() { const [mapZoom, setMapZoom] = useState(13); const [searchQuery, setSearchQuery] = useState(''); const [mapLoaded, setMapLoaded] = useState(false); + const [currencies, setCurrencies] = useState([]); const [selectedCurrencyId, setSelectedCurrencyId] = useState(Currency.SYP); const [errors, setErrors] = useState({}); @@ -188,6 +189,16 @@ export default function AddPropertyPage() { }); } setMapLoaded(true); + + // Fetch available currencies + getCurrencies().then((data) => { + if (Array.isArray(data) && data.length > 0) { + setCurrencies(data); + console.log('[AddProperty] Currencies loaded:', data); + } + }).catch((err) => { + console.warn('[AddProperty] Failed to load currencies:', err); + }); }, []); const handleSearch = async () => { @@ -331,6 +342,7 @@ const handleMapClick = async (coords) => { const handleImageUpload = async (files) => { const newImages = Array.from(files); + console.log('[AddProperty] handleImageUpload called with', newImages.length, 'files'); if (formData.images.length + newImages.length > 10) { toast.error('يمكنك رفع 10 صور كحد أقصى');