Add enums, AuthService, and integrate backend registration endpoints
- Add separate enum files: BuildingType, PropertyStatus, BookingStatus, CommissionType, IdentityType, UserRole, City, LoginMethod, OwnerType, CustomerType
- Add AuthService (addToken/getToken/deleteToken)
- Update api.js: use AuthService, add Owner/Add and Customer/Add endpoints
- Update login page to use AuthService for token storage
- Rewrite owner register: 3-step flow with OwnerType dropdown, backend integration, OTP verification
- Rewrite tenant register: 2-step flow with CustomerType dropdown, backend integration, OTP verification
- Update homepage and property detail to use enums instead of hardcoded maps
- Update AddPropertyForm to import from enums directly
- Add console logs and status toasts linked to API response messages
2026-03-27 18:01:42 +00:00
|
|
|
/**
|
|
|
|
|
* City Enum
|
|
|
|
|
* Syrian cities used in property locations
|
|
|
|
|
* Used in: Property search filters, location display
|
|
|
|
|
*/
|
|
|
|
|
const City = Object.freeze({
|
|
|
|
|
DAMASCUS: 'دمشق',
|
|
|
|
|
ALEPPO: 'حلب',
|
|
|
|
|
HOMS: 'حمص',
|
|
|
|
|
LATAKIA: 'اللاذقية',
|
|
|
|
|
DARAA: 'درعا',
|
|
|
|
|
TARTOUS: 'طرطوس',
|
|
|
|
|
SUWEIDA: 'السويداء',
|
|
|
|
|
DEIR_EZZOR: 'دير الزور',
|
|
|
|
|
RAQQA: 'الرقة',
|
|
|
|
|
IDLIB: 'إدلب',
|
|
|
|
|
HASAKAH: 'الحسكة',
|
|
|
|
|
QAMISHLI: 'القامشلي',
|
|
|
|
|
RURAL_DAMASCUS: 'ريف دمشق',
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// All cities as a flat array
|
|
|
|
|
const CitiesList = Object.freeze(Object.values(City));
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Extract city name from a full address string
|
|
|
|
|
* @param {string} address
|
|
|
|
|
* @returns {string}
|
|
|
|
|
*/
|
|
|
|
|
function extractCity(address) {
|
|
|
|
|
if (!address) return '';
|
|
|
|
|
for (const city of CitiesList) {
|
|
|
|
|
if (address.includes(city)) return city;
|
|
|
|
|
}
|
|
|
|
|
return '';
|
|
|
|
|
}
|
|
|
|
|
|
2026-07-01 15:43:58 +03:00
|
|
|
const CityTranslationKeys = Object.freeze({
|
|
|
|
|
[City.DAMASCUS]: 'city.damascus',
|
|
|
|
|
[City.ALEPPO]: 'city.aleppo',
|
|
|
|
|
[City.HOMS]: 'city.homs',
|
|
|
|
|
[City.LATAKIA]: 'city.latakia',
|
|
|
|
|
[City.DARAA]: 'city.daraa',
|
|
|
|
|
[City.TARTOUS]: 'city.tartous',
|
|
|
|
|
[City.SUWEIDA]: 'city.suweida',
|
|
|
|
|
[City.DEIR_EZZOR]: 'city.deirEzzor',
|
|
|
|
|
[City.RAQQA]: 'city.raqqa',
|
|
|
|
|
[City.IDLIB]: 'city.idlib',
|
|
|
|
|
[City.HASAKAH]: 'city.hasakah',
|
|
|
|
|
[City.QAMISHLI]: 'city.qamishli',
|
|
|
|
|
[City.RURAL_DAMASCUS]: 'city.ruralDamascus',
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
export { City, CitiesList, extractCity, CityTranslationKeys };
|