diff --git a/app/enums/DocumentType.js b/app/enums/DocumentType.js new file mode 100644 index 0000000..e36c906 --- /dev/null +++ b/app/enums/DocumentType.js @@ -0,0 +1,19 @@ +/** + * Document type enum for owner property submission. + * Values are intentionally English keys so the UI can store normalized identifiers. + */ +const DocumentType = Object.freeze({ + PASSPORT: 'Passport', + IDCARD: 'IDCard', + BOTH: 'Both', +}); + +const DocumentTypeLabels = Object.freeze({ + [DocumentType.PASSPORT]: 'جواز سفر', + [DocumentType.IDCARD]: 'بطاقة شخصية', + [DocumentType.BOTH]: 'كلاهما', +}); + +const DocumentTypeList = Object.freeze(Object.values(DocumentType)); + +export { DocumentType, DocumentTypeLabels, DocumentTypeList }; diff --git a/app/enums/Governorate.js b/app/enums/Governorate.js new file mode 100644 index 0000000..3ef51f7 --- /dev/null +++ b/app/enums/Governorate.js @@ -0,0 +1,39 @@ +/** + * Syrian governorates enum using English normalized values. + * Labels are provided separately for Arabic display. + */ +const Governorate = Object.freeze({ + DAMASCUS: 'Damascus', + ALEPPO: 'Aleppo', + LATAKIA: 'Latakia', + HAMA: 'Hama', + TARTOUS: 'Tartous', + DEIR_EZZOR: 'DeirEzzor', + RAQQA: 'Raqqa', + IDLIB: 'Idlib', + DRAA: 'Daraa', + SUWEIDA: 'Suweida', + HASAKAH: 'Hasakah', + QUNEITRA: 'Quneitra', + RURAL_DAMASCUS: 'RuralDamascus', +}); + +const GovernorateLabels = Object.freeze({ + [Governorate.DAMASCUS]: 'دمشق', + [Governorate.ALEPPO]: 'حلب', + [Governorate.LATAKIA]: 'اللاذقية', + [Governorate.HAMA]: 'حماة', + [Governorate.TARTOUS]: 'طرطوس', + [Governorate.DEIR_EZZOR]: 'دير الزور', + [Governorate.RAQQA]: 'الرقة', + [Governorate.IDLIB]: 'إدلب', + [Governorate.DRAA]: 'درعا', + [Governorate.SUWEIDA]: 'السويداء', + [Governorate.HASAKAH]: 'الحسكة', + [Governorate.QUNEITRA]: 'القنيطرة', + [Governorate.RURAL_DAMASCUS]: 'ريف دمشق', +}); + +const GovernorateList = Object.freeze(Object.values(Governorate)); + +export { Governorate, GovernorateLabels, GovernorateList }; diff --git a/app/enums/index.js b/app/enums/index.js index 4a81a61..2cb3d3a 100644 --- a/app/enums/index.js +++ b/app/enums/index.js @@ -18,6 +18,8 @@ export { RentPropertyType, RentPropertyTypeLabels } from './RentPropertyType'; export { RentType, RentTypeLabels } from './RentType'; export { PropertyService, PropertyServiceLabels, PropertyServicesList } from './PropertyService'; export { PropertyTerm, PropertyTermLabels, PropertyTermsList } from './PropertyTerm'; +export { DocumentType, DocumentTypeLabels, DocumentTypeList } from './DocumentType'; +export { Governorate, GovernorateLabels, GovernorateList } from './Governorate'; export { Currency, CurrencyLabels, CurrencySymbols } from './Currency'; export { DeviceType } from './DeviceType'; export { SalePropertiesStatus, SalePropertiesStatusLabels } from './SalePropertiesStatus'; diff --git a/app/i18n/config.js b/app/i18n/config.js index 977da54..574607e 100644 --- a/app/i18n/config.js +++ b/app/i18n/config.js @@ -1149,6 +1149,11 @@ const resources = { "addProperty.furnishedStatus": "Property Condition", "addProperty.furnished": "Furnished", "addProperty.unfurnished": "Unfurnished", + "addProperty.documentTypeLabel": "Document Type", + "addProperty.cityLabel": "Governorate", + "documentType.passport": "Passport", + "documentType.idCard": "ID Card", + "documentType.both": "Both", "addProperty.additionalDescription": "Additional Description (optional)", "addProperty.servicesLabel": "Available Services", "addProperty.serviceDetailPlaceholder": "Service details (e.g., in all rooms)...", @@ -2786,6 +2791,11 @@ const resources = { "addProperty.furnishedStatus": "حالة العقار", "addProperty.furnished": "مفروش", "addProperty.unfurnished": "غير مفروش", + "addProperty.documentTypeLabel": "نوع الوثيقة", + "addProperty.cityLabel": "المحافظة", + "documentType.passport": "جواز سفر", + "documentType.idCard": "بطاقة شخصية", + "documentType.both": "كلاهما", "addProperty.additionalDescription": "وصف إضافي (اختياري)", "addProperty.servicesLabel": "الخدمات المتوفرة", "addProperty.serviceDetailPlaceholder": "تفاصيل الخدمة (مثال: في جميع الغرف)...", diff --git a/app/owner/properties/add/page.js b/app/owner/properties/add/page.js index 32d8e3b..f440ec5 100644 --- a/app/owner/properties/add/page.js +++ b/app/owner/properties/add/page.js @@ -64,6 +64,11 @@ import { PropertyTerm, PropertyTermLabels, PropertyTermsList, + DocumentType, + DocumentTypeList, + Governorate, + GovernorateLabels, + GovernorateList, Currency, CurrencyLabels } from '../../../enums'; @@ -84,6 +89,7 @@ export default function AddPropertyPage() { propertyType: 'apartment', furnished: false, + documentType: DocumentType.PASSPORT, bedrooms: 1, bathrooms: 1, @@ -118,7 +124,7 @@ export default function AddPropertyPage() { deposit: '', allowedPaymentPeriod: '', - city: '', + city: Governorate.DAMASCUS, district: '', address: '', lat: null, @@ -206,6 +212,19 @@ export default function AddPropertyPage() { { id: 'both', label: t('addProperty.dailyAndMonthly'), icon: Calendar }, ].filter(Boolean); + const getDocumentTypeLabel = (type) => { + switch (type) { + case DocumentType.PASSPORT: + return t('documentType.passport'); + case DocumentType.IDCARD: + return t('documentType.idCard'); + case DocumentType.BOTH: + return t('documentType.both'); + default: + return type; + } + }; + useEffect(() => { // Fetch available currencies getCurrencies().then((data) => { @@ -662,6 +681,8 @@ const handleMarkerDragEnd = async (lat, lng) => { buildingType: buildingTypeMap[formData.propertyType] ?? BuildingType.APARTMENT, status: 0, propertyType: formData.furnished ? RentPropertyCondition.WITH_FURNITURE : RentPropertyCondition.WITHOUT_FURNITURE, + documentType: formData.documentType, + governorate: formData.city, }; try { @@ -822,6 +843,23 @@ const handleMarkerDragEnd = async (lat, lng) => { +
+ + +
+
-
-

{t('addProperty.selectLocationTitle')}

- -
-
- setSearchQuery(e.target.value)} - onKeyPress={(e) => e.key === 'Enter' && handleSearch()} - placeholder={t('addProperty.searchAddress')} - className="w-full px-4 py-3 border border-gray-300 rounded-xl focus:outline-none focus:ring-2 focus:ring-amber-500 pr-12" - /> - +
+
+
+
+ + {t('addProperty.selectLocationTitle')} +
+

{t('addProperty.clickMapHint')}

+
+
+ + {t('addProperty.cityLabel')}
-
-
- - {t('addProperty.searchHint')} -
- - {t('addProperty.clickMapHint')} +
+
+ + +

{t('addProperty.searchHint')}

+
+ +
+ +
+
+ setSearchQuery(e.target.value)} + onKeyPress={(e) => e.key === 'Enter' && handleSearch()} + placeholder={t('addProperty.searchAddress')} + className="w-full px-4 py-3 border border-gray-300 rounded-xl focus:outline-none focus:ring-2 focus:ring-amber-500 pr-10" + /> + +
+ +
+
+ + {t('addProperty.clickMapHint')} +
+
-
+
{ onMarkerDragEnd={handleMarkerDragEnd} />
- - {selectedLocation && !formData.lat && ( - - )} - {formData.lat && ( -
-
- - {t('addProperty.locationConfirmed')}: +
+ {selectedLocation && !formData.lat ? ( + + ) : ( +
+ + {t('addProperty.clickMapHint')}
-

{formData.address}

-
- )} + )} + + {formData.lat && ( +
+
+ + {t('addProperty.locationConfirmed')}: +
+

{formData.address}

+
+ )} +
{errors.location && ( -

{errors.location}

+

{errors.location}

)}