@@ -1684,196 +2018,233 @@ export default function OwnerPropertiesPage() {
initial="initial"
animate="animate"
transition={{ delay: index * 0.1 }}
- className="bg-white rounded-2xl shadow-sm hover:shadow-md transition-all overflow-hidden border border-gray-200"
+ className="bg-white rounded-2xl shadow-sm hover:shadow-md transition-all overflow-hidden border border-gray-200 flex flex-col justify-between"
>
-
-
-
{property.title}
- {property.rating > 0 && (
-
-
-
{Number(property.rating).toFixed(1)}
+
+
+ {property.images && property.images.length > 0 ? (
+

+ ) : (
+
+
)}
-
-
-
-
- {property.address || property.location || t("locationUnknown")}
-
-
- {property.description &&
{property.description}
}
-
-
- {property.bedrooms > 0 && (
-
-
- {property.bedrooms}
-
- )}
- {property.bathrooms > 0 && (
-
-
- {property.bathrooms}
-
- )}
- {property.area > 0 && (
-
-
-
- {property.area}
- {t("sqm")}
-
-
- )}
- {property.floor > 0 && (
-
-
-
- {t("floor")} {property.floor}
-
-
- )}
- {property.salons > 0 && (
-
-
- {property.salons}
-
- )}
- {property.balconies > 0 && (
-
-
- {property.balconies}
-
- )}
-
-
-
-
- {property.purpose === "rent" ? (
-
- {property.monthlyPrice > 0 && (
-
- {Number(property.monthlyPrice).toLocaleString()}
- {t("perMonth")}
-
- )}
- {property.dailyPrice > 0 && !property.monthlyPrice && (
-
- {Number(property.dailyPrice).toLocaleString()}
- {t("perDay")}
-
- )}
- {property.deposit > 0 &&
{t("depositAmount", { amount: Number(property.deposit).toLocaleString() })}
}
-
- ) : (
-
- {Number(property.salePrice).toLocaleString()} {t("syp")}
-
- )}
-
-
-
- {property.status === "notAvailable" ? (
-
- ) : (
-
- )}
-
+
+
+
+
{property.title}
+ {property.rating > 0 && (
+
+
+ {Number(property.rating).toFixed(1)}
+
+ )}
+
+
+
+
+ {property.address || property.location || t("locationUnknown")}
+
+
+ {property.description &&
{property.description}
}
+
+
+ {property.bedrooms > 0 && (
+
+
+ {property.bedrooms}
+
+ )}
+ {property.bathrooms > 0 && (
+
+
+ {property.bathrooms}
+
+ )}
+ {property.area > 0 && (
+
+
+
+ {property.area}
+ {t("sqm")}
+
+
+ )}
+ {property.floor > 0 && (
+
+
+
+ {t("floor")} {property.floor}
+
+
+ )}
+ {property.salons > 0 && (
+
+
+ {property.salons}
+
+ )}
+ {property.balconies > 0 && (
+
+
+ {property.balconies}
+
+ )}
+
+
+
+
+ {property.purpose === "rent" ? (
+
+ {property.monthlyPrice > 0 && (
+
+ {Number(property.monthlyPrice).toLocaleString()}
+ {t("perMonth")}
+
+ )}
+ {property.dailyPrice > 0 && !property.monthlyPrice && (
+
+ {Number(property.dailyPrice).toLocaleString()}
+ {t("perDay")}
+
+ )}
+ {property.deposit > 0 &&
{t("depositAmount", { amount: Number(property.deposit).toLocaleString() })}
}
+
+ ) : (
+
+ {Number(property.salePrice).toLocaleString()} {t("syp")}
+
+ )}
+
+
+
+ {property.status === "notAvailable" ? (
+
+ setDeactivateModal({
+ isOpen: true,
+ property,
+ isActivating: true,
+ })
+ }
+ className="p-1.5 hover:bg-green-50 rounded-lg transition-colors group"
+ title={t("activateProperty")}
+ >
+
+
+ ) : (
+
+ setDeactivateModal({
+ isOpen: true,
+ property,
+ isActivating: false,
+ })
+ }
+ className="p-1.5 hover:bg-red-50 rounded-lg transition-colors group"
+ title={t("deactivateProperty")}
+ >
+
+
+ )}
+ setViewModal({ isOpen: true, property })}
+ className="px-3 py-1.5 bg-gray-50 hover:bg-blue-50 border border-gray-200 hover:border-blue-200 rounded-lg transition-all group flex items-center gap-1.5"
+ title={t("viewDetails")}
+ >
+
+ {t("view")}
+
+ setEditModal({ isOpen: true, property })} className="p-1.5 hover:bg-amber-50 rounded-lg transition-colors group" title={t("editProperty")}>
+
+
+ setDeleteModal({ isOpen: true, property })} className="p-1.5 hover:bg-red-50 rounded-lg transition-colors group" title={t("deleteProperty")}>
+
+
+
+
+ {property.purpose === "sale" && Number(property.status2) === 0 && (
+
openCommissionPayment(property)}
+ className="w-full h-10 bg-amber-600 hover:bg-amber-700 text-white flex items-center justify-center gap-2 font-medium transition-colors"
+ >
+
+ دفع الكمسيون
+
+ )}
+ {property.purpose === "sale" && Number(property.status2) === 1 && (
+
قيد الانتظار
+ )}
+
+ {property.purpose === "sale" && Number(property.status2) === 2 &&
تم التأكيد
}
))}
)}
+
+ setCommissionPayment({
+ open: false,
+ property: null,
+ })
+ }
+ selectedPayment={selectedCommissionPayment}
+ onSelectPayment={setSelectedCommissionPayment}
+ onConfirmPay={handleCommissionPayment}
+ payingId={commissionPayingId}
+ paymentMethods={commissionPaymentMethods}
+ loadingPaymentMethods={loadingCommissionPaymentMethods}
+ receiptImage={commissionReceiptImage}
+ onSetReceiptImage={setCommissionReceiptImage}
+ commissionDetails={commissionDetails}
+ setCommissionDetails={setCommissionDetails}
+ />
);
}
diff --git a/app/properties/page.js b/app/properties/page.js
index 68e960a..6fee86f 100644
--- a/app/properties/page.js
+++ b/app/properties/page.js
@@ -692,7 +692,7 @@ export default function PropertiesPage() {
const filteredProperties = properties
// العقارات يلي 0 ما تنعرض
.filter((p) => p.purpose === purposeTab)
- .filter((p) => p.purpose === "rent" || p.status === 1)
+ // .filter((p) => p.purpose === "rent" || p.status === 1)
.filter((property) => {
if (filters.search && !property.title.includes(filters.search) && !property.description.includes(filters.search)) {
return false;
@@ -788,9 +788,9 @@ export default function PropertiesPage() {
{/* شرط مشان ينعرض او لا */}
{filteredProperties.map((property) =>
- property.purpose === "rent" || property.status === 1 ? (
+ // property.purpose === "rent" || property.status === 1 ? (
setShowLoginDialog(true)} />
- ) : null,
+ // ) : null,
)}
diff --git a/app/property/[id]/PropertyDetail.js b/app/property/[id]/PropertyDetail.js
index 484d222..01325c0 100644
--- a/app/property/[id]/PropertyDetail.js
+++ b/app/property/[id]/PropertyDetail.js
@@ -433,11 +433,15 @@ export default function PropertyDetailsPage({ type }) {
const propInfoId = property._raw?.propertyInformationId || property.id;
const startDate = new Date(selectedStart + "T00:00:00.000").toISOString();
const endDate = new Date(selectedEnd + "T00:00:00.000").toISOString();
- await bookReservation(propInfoId, startDate, endDate);
+ await bookReservation(propInfoId, startDate, endDate);
+
setBookingSuccess(true);
toast.success(t("bookingSentSuccess"));
} catch (err) {
- setBookingError(err.message || t("bookingFailed"));
+ if (err.message=="API 400: Cannot book a reservation for an inactive property."){
+ setBookingError("لا يمكنك حجز هذا العقار لانه غير نشط" || t("bookingFailed"));
+ }
+
} finally {
setBookingLoading(false);
}
diff --git a/app/reservations/page.js b/app/reservations/page.js
index 959580e..d5396f4 100644
--- a/app/reservations/page.js
+++ b/app/reservations/page.js
@@ -1,393 +1,3 @@
-// 'use client';
-
-// import { useState, useEffect, useCallback } from 'react';
-// import { motion } from 'framer-motion';
-// import { useRouter } from 'next/navigation';
-// import {
-// Calendar, Clock, CheckCircle, XCircle, Eye, Loader2, Search,
-// MapPin, DollarSign, Home, ArrowLeft, CreditCard, Timer, Star,
-// } from 'lucide-react';
-// import toast, { Toaster } from 'react-hot-toast';
-// import AuthService from '../services/AuthService';
-// import { getRentProperties, getUserReservations, payDeposit } from '../utils/api';
-// import { addPropertyRating } from '../utils/ratings';
-
-// const API_BASE = process.env.NEXT_PUBLIC_API_URL || 'https://45.93.137.91.nip.io/api';
-
-// const STATUS_MAP = ['pending','ownerConfirmed','depositPaid','depositConfirmed','completed','cancelled'];
-
-// const STATUS_UI = {
-// pending: { label: 'قيد الانتظار', color: 'bg-yellow-100 text-yellow-800', icon: Clock },
-// ownerConfirmed: { label: 'مؤكد من المالك', color: 'bg-blue-100 text-blue-800', icon: CheckCircle },
-// depositPaid: { label: 'تم دفع السلفة', color: 'bg-indigo-100 text-indigo-800', icon: DollarSign },
-// depositConfirmed: { label: 'مؤكد', color: 'bg-green-100 text-green-800', icon: CheckCircle },
-// completed: { label: 'منتهي', color: 'bg-green-100 text-green-800', icon: CheckCircle },
-// cancelled: { label: 'ملغي', color: 'bg-gray-100 text-gray-800', icon: XCircle },
-// };
-
-// function statusLabel(code) { return STATUS_UI[STATUS_MAP[code]]?.label ?? String(code); }
-// function statusColor(code) { return STATUS_UI[STATUS_MAP[code]]?.color ?? 'bg-gray-100 text-gray-700'; }
-// function statusIcon(code) { return STATUS_UI[STATUS_MAP[code]]?.icon ?? Clock; }
-
-// function StatusBadge({ code }) {
-// const Icon = statusIcon(code);
-// return (
-//
-// {statusLabel(code)}
-//
-// );
-// }
-
-// const propAddr = (p, r) => p?.address ?? r?.propertyAddress ?? '';
-// const propImages = (p, r) => {
-// if (p?.images && Array.isArray(p.images)) return p.images;
-// if (r?.property?.images && Array.isArray(r.property.images)) return r.property.images;
-// return [];
-// };
-// const propBeds = (p, r) => p?.numberOfBedRooms ?? r?.property?.numberOfBedRooms ?? 0;
-// const propBaths = (p, r) => p?.numberOfBathRooms ?? r?.property?.numberOfBathRooms ?? 0;
-
-// function parseTimeSpan(str) {
-// if (!str) return 0;
-// const clean = str.replace(/-/g, '');
-// const dotIdx = clean.indexOf('.');
-// let days = 0, timePart = clean;
-// if (dotIdx !== -1) {
-// days = parseInt(clean.substring(0, dotIdx), 10) || 0;
-// timePart = clean.substring(dotIdx + 1);
-// }
-// const parts = timePart.split(':');
-// if (parts.length < 2) return days * 86400000;
-// const hh = parseInt(parts[0], 10) || 0;
-// const mm = parseInt(parts[1], 10) || 0;
-// const ss = parts.length > 2 ? (parseInt(parts[2], 10) || 0) : 0;
-// return ((days * 86400) + (hh * 3600) + (mm * 60) + ss) * 1000;
-// }
-
-// function formatWindowDuration(str) {
-// if (!str) return '';
-// const clean = str.replace(/-/g, '');
-// const dotIdx = clean.indexOf('.');
-// let totalHours = 0, timePart = clean;
-// if (dotIdx !== -1) {
-// const days = parseInt(clean.substring(0, dotIdx), 10) || 0;
-// totalHours += days * 24;
-// timePart = clean.substring(dotIdx + 1);
-// }
-// const parts = timePart.split(':');
-// if (parts.length >= 2) {
-// totalHours += parseInt(parts[0], 10) || 0;
-// }
-// if (totalHours > 0) return `${String(totalHours).padStart(2, '0')}:00:00`;
-// return timePart.substring(0, 8);
-// }
-
-// function CountdownTimer({ deadline }) {
-// const [remaining, setRemaining] = useState(deadline ? Math.max(0, deadline - Date.now()) : 0);
-// useEffect(() => {
-// if (!deadline) return;
-// const tick = () => setRemaining(Math.max(0, deadline - Date.now()));
-// tick();
-// const id = setInterval(tick, 1000);
-// return () => clearInterval(id);
-// }, [deadline]);
-// if (remaining <= 0) return
انتهت المهلة;
-// const h = Math.floor(remaining / 3600000);
-// const m = Math.floor((remaining % 3600000) / 60000);
-// const s = Math.floor((remaining % 60000) / 1000);
-// const pad = (n) => String(n).padStart(2, '0');
-// return
{pad(h)}:{pad(m)}:{pad(s)};
-// }
-
-// function ReservationCard({ r, onViewDetails, onPay, payingId }) {
-// const p = r._prop;
-// const imgs = propImages(p, r);
-// const img = imgs.length > 0 ? `${API_BASE}${imgs[0]}` : null;
-// const addr = propAddr(p, r);
-// const beds = propBeds(p, r);
-// const baths = propBaths(p, r);
-// const isOwnerConfirmed = STATUS_MAP[r.status] === 'ownerConfirmed';
-// const canRate = STATUS_MAP[r.status] === 'depositPaid' || STATUS_MAP[r.status] === 'completed';
-// const hasTimeWindow = r.ownerApprovalDate && p?.allowedPaymentPeriod;
-// const deadline = hasTimeWindow
-// ? new Date(r.ownerApprovalDate).getTime() + parseTimeSpan(p.allowedPaymentPeriod)
-// : null;
-// const isExpired = deadline ? Date.now() > deadline : false;
-// const isPaying = payingId === r.id;
-// const [showRating, setShowRating] = useState(false);
-// const [ratings, setRatings] = useState({ clean: 0, services: 0, ownerBehavior: 0, experience: 0 });
-// const [ratingComment, setRatingComment] = useState('');
-// const [submittingRating, setSubmittingRating] = useState(false);
-
-// return (
-//
-//
-// {img &&
}
-//
-//
-//
-// {addr &&
{addr}
}
-//
-//
-//
{r.totalPrice?.toLocaleString() ?? '—'}
-//
السعر الإجمالي
-//
-//
-// {(beds||baths) &&
{beds>0&&{beds} غرف}{baths>0&&{baths} حمامات}
}
-//
-//
-//
من
-//
{new Date(r.startDate).toLocaleDateString('ar')}
-//
-//
-//
إلى
-//
{new Date(r.endDate).toLocaleDateString('ar')}
-//
-//
-// {isOwnerConfirmed && hasTimeWindow &&
-//
-// متبقي للدفع:
-//
-//
-//
مدة الدفع: {formatWindowDuration(p.allowedPaymentPeriod)}
-//
}
-//
-// onViewDetails(r)}
-// className="flex-1 bg-gray-100 text-gray-700 py-2 rounded-xl text-sm font-medium hover:bg-gray-200 transition-colors flex items-center justify-center gap-2">
-// التفاصيل
-//
-// {isOwnerConfirmed && !isExpired && onPay(r)} disabled={isPaying}
-// className={`flex-1 py-2 rounded-xl text-sm font-medium transition-colors flex items-center justify-center gap-2 ${isPaying ? 'bg-gray-300 text-gray-500 cursor-not-allowed' : 'bg-amber-500 text-white hover:bg-amber-600'}`}>
-// {isPaying ? : } {isPaying ? 'جاري الدفع...' : 'ادفع الآن'}
-// }
-//
-// {canRate && !showRating &&
setShowRating(true)}
-// className="w-full mt-3 bg-amber-50 text-amber-700 py-2 rounded-xl text-sm font-medium hover:bg-amber-100 transition-colors flex items-center justify-center gap-2">
-// قيّم هذا العقار
-// }
-// {canRate && showRating &&
-//
-// {[
-// { key: 'clean', label: 'النظافة' },
-// { key: 'services', label: 'الخدمات' },
-// { key: 'ownerBehavior', label: 'تعامل المالك' },
-// { key: 'experience', label: 'التجربة العامة' },
-// ].map(cat =>
-//
{cat.label}
-//
-// {[1,2,3,4,5].map(n => (
-// setRatings(p => ({...p, [cat.key]: n}))}
-// className={`p-0.5 rounded-full transition-colors ${n <= ratings[cat.key] ? 'text-amber-500' : 'text-gray-300'}`}>
-//
-//
-// ))}
-//
-//
)}
-//
-//
}
-//
-//
-// );
-// }
-
-// function DetailsModal({ r, isOpen, onClose, onPay, payingId }) {
-// if (!isOpen || !r) return null;
-// const p = r._prop;
-// const isOwnerConfirmed = STATUS_MAP[r.status] === 'ownerConfirmed';
-// const hasTimeWindow = r.ownerApprovalDate && p?.allowedPaymentPeriod;
-// const deadline = hasTimeWindow
-// ? new Date(r.ownerApprovalDate).getTime() + parseTimeSpan(p.allowedPaymentPeriod)
-// : null;
-// const isExpired = deadline ? Date.now() > deadline : false;
-// const isPaying = payingId === r.id;
-
-// return (
-//
-// e.stopPropagation()}>
-//
-//
-//
تفاصيل الحجز
-//
-//
-//
رقم الحجز: #{r.id}
-//
-//
-// {p &&
-//
معلومات العقار
-//
العنوان: {propAddr(p, r)||'—'}
-// {(propBeds(p, r)||propBaths(p, r)) &&
-// {propBeds(p, r)>0&&{propBeds(p, r)} غرف}
-// {propBaths(p, r)>0&&{propBaths(p, r)} حمامات}
-//
}
-//
}
-//
-//
تفاصيل الحجز
-//
-//
تاريخ البداية
{new Date(r.startDate).toLocaleDateString('ar')}
-//
تاريخ النهاية
{new Date(r.endDate).toLocaleDateString('ar')}
-//
-//
تاريخ الإنشاء
{new Date(r.createdAt).toLocaleDateString('ar')}
-//
-//
-//
-//
المعلومات المالية
-//
الإجمالي{r.totalPrice?.toLocaleString()??'—'}
-//
-// {isOwnerConfirmed && hasTimeWindow &&
-//
-// متبقي للدفع:
-//
-//
-//
مدة الدفع: {formatWindowDuration(p.allowedPaymentPeriod)}
-// {!isExpired &&
{ onPay(r); onClose(); }} disabled={isPaying}
-// className={`w-full py-2 rounded-xl font-medium transition-colors flex items-center justify-center gap-2 ${isPaying ? 'bg-gray-300 text-gray-500 cursor-not-allowed' : 'bg-amber-500 text-white hover:bg-amber-600'}`}>
-// {isPaying ? : } {isPaying ? 'جاري الدفع...' : 'ادفع الآن'}
-// }
-//
}
-//
-//
-//
-// );
-// }
-
-// export default function UserReservationsPage() {
-// const router = useRouter();
-// const [reservations, setReservations] = useState([]);
-// const [filtered, setFiltered] = useState([]);
-// const [loading, setLoading] = useState(true);
-// const [selected, setSelected] = useState(null);
-// const [filterStatus, setFilterStatus] = useState('all');
-// const [searchTerm, setSearchTerm] = useState('');
-// const [payingId, setPayingId] = useState(null);
-
-// useEffect(() => { if (!AuthService.getUser()) { router.push('/login'); return; } loadReservations(); }, [router]);
-
-// const loadReservations = useCallback(async () => {
-// try {
-// const [data, rentProps] = await Promise.all([
-// getUserReservations(),
-// getRentProperties().catch(() => []),
-// ]);
-// const list = Array.isArray(data) ? data : [];
-// const propsList = Array.isArray(rentProps) ? rentProps : [];
-// const propMap = {};
-// propsList.forEach(rp => {
-// const info = rp?.propertyInformation ?? {};
-// if (rp?.allowedPaymentPeriod) info.allowedPaymentPeriod = rp.allowedPaymentPeriod;
-// propMap[rp.propertyInformationId] = info;
-// propMap[rp.propertyInformation?.id] = info;
-// });
-// const enriched = list.map(r => {
-// if (r.propertyId && propMap[r.propertyId]) r._prop = propMap[r.propertyId];
-// return r;
-// });
-// setReservations(enriched);
-// setFiltered(enriched);
-// } catch (err) {
-// console.error(err);
-// toast.error('فشل تحميل الحجوزات');
-// setReservations([]);
-// setFiltered([]);
-// }
-// setLoading(false);
-// }, []);
-
-// useEffect(() => {
-// let r = reservations;
-// if (filterStatus !== 'all') r = r.filter(x => STATUS_MAP[x.status] === filterStatus);
-// if (searchTerm) { const q = searchTerm.toLowerCase(); r = r.filter(x => propAddr(x._prop, x).toLowerCase().includes(q) || String(x.id).includes(q)); }
-// setFiltered(r);
-// }, [reservations, filterStatus, searchTerm]);
-
-// const allStatuses = [...new Set(reservations.map(r => STATUS_MAP[r.status]))];
-// const counts = { all: reservations.length, ...Object.fromEntries(allStatuses.map(s => [s, reservations.filter(r => STATUS_MAP[r.status] === s).length])) };
-
-// const handlePay = async (r) => {
-// setPayingId(r.id);
-// try {
-// await payDeposit({
-// reservationId: r.id,
-// paymentTypeId: 1,
-// transactionType: 1,
-// comment: null,
-// });
-// toast.success('تم دفع السلفة بنجاح!');
-// loadReservations();
-// } catch (err) {
-// toast.error(err?.message || 'فشل عملية الدفع');
-// } finally {
-// setPayingId(null);
-// }
-// };
-
-// if (loading) return
;
-
-// return (
-//
-//
-//
setSelected(null)} onPay={handlePay} payingId={payingId} />
-//
-//
-// router.back()} className="flex items-center gap-2 text-gray-600 hover:text-amber-600 mb-4"> الرجوع
-// حجوزاتي
-// لديك {reservations.length} حجز
-//
-//
-// {Object.entries(counts).map(([s, c]) => (
-//
setFilterStatus(s)}>
-// {c}
-// {s==='all'?'الكل':(STATUS_UI[s]?.label||s)}
-//
-// ))}
-//
-//
-//
-// setSearchTerm(e.target.value)}
-// className="w-full pl-10 pr-4 py-3 border border-gray-300 rounded-xl focus:outline-none focus:ring-2 focus:ring-amber-500"/>
-//
-// {filtered.length === 0 ? (
-//
-//
-//
لا توجد حجوزات
-//
لم تقم بأي حجز حتى الآن
-//
-// ) : (
-//
-// {filtered.map(r => )}
-//
-// )}
-//
-//
-// );
-// }
-
"use client";
import { useState, useEffect, useCallback } from "react";
@@ -421,29 +31,19 @@ import {
Phone,
Wallet,
ImageIcon,
+ User,
} from "lucide-react";
import toast, { Toaster } from "react-hot-toast";
import AuthService from "../services/AuthService";
-import {
- getPaymentTypes,
- getRentProperties,
- getUserReservations,
- payDeposit,
-} from "../utils/api";
+import { getPaymentTypes, getRentProperties, getUserReservations, payDeposit } from "../utils/api";
import { addPropertyRating } from "../utils/ratings";
import Loading from "../loading";
-const API_BASE =
- process.env.NEXT_PUBLIC_API_URL || "https://45.93.137.91.nip.io/api";
+const API_BASE = process.env.NEXT_PUBLIC_API_URL || "https://45.93.137.91.nip.io/api";
-const STATUS_MAP = [
- "pending",
- "ownerConfirmed",
- "depositPaid",
- "depositConfirmed",
- "completed",
- "cancelled",
-];
+const GOVERNORATES = ["دمشق", "ريف دمشق", "حلب", "حمص", "حماة", "اللاذقية", "طرطوس", "إدلب", "درعا", "السويداء", "القنيطرة", "دير الزور", "الرقة", "الحسكة"];
+
+const STATUS_MAP = ["pending", "ownerConfirmed", "depositPaid", "depositConfirmed", "completed", "cancelled"];
const STATUS_UI = {
pending: { color: "bg-yellow-100 text-yellow-800", icon: Clock },
@@ -477,9 +77,7 @@ function StatusBadge({ code }) {
const Icon = statusIcon(code);
const key = STATUS_MAP[code] || "pending";
return (
-
+
{t(`bookingStatus.${key}`)}
);
@@ -488,22 +86,15 @@ function StatusBadge({ code }) {
const propAddr = (p, r) => p?.address ?? r?.propertyAddress ?? "";
const propImages = (p, r) => {
if (p?.images && Array.isArray(p.images)) return p.images;
- if (r?.property?.images && Array.isArray(r.property.images))
- return r.property.images;
+ if (r?.property?.images && Array.isArray(r.property.images)) return r.property.images;
return [];
};
-const propBeds = (p, r) =>
- p?.numberOfBedRooms ?? r?.property?.numberOfBedRooms ?? 0;
-const propBaths = (p, r) =>
- p?.numberOfBathRooms ?? r?.property?.numberOfBathRooms ?? 0;
+const propBeds = (p, r) => p?.numberOfBedRooms ?? r?.property?.numberOfBedRooms ?? 0;
+const propBaths = (p, r) => p?.numberOfBathRooms ?? r?.property?.numberOfBathRooms ?? 0;
const getAuthToken = () => {
if (typeof window === "undefined") return "";
- return (
- AuthService.getToken?.() ||
- AuthService.getAccessToken?.() ||
- ""
- );
+ return AuthService.getToken?.() || AuthService.getAccessToken?.() || "";
};
const readStoredUser = () => {
@@ -529,16 +120,7 @@ const extractNumericUserId = (value) => {
return Number.isInteger(n) ? n : null;
}
if (typeof value === "object") {
- const candidates = [
- value.id,
- value.userId,
- value.userID,
- value.user?.id,
- value.user?.userId,
- value.profile?.id,
- value.profile?.userId,
- value.data?.id,
- ];
+ const candidates = [value.id, value.userId, value.userID, value.user?.id, value.user?.userId, value.profile?.id, value.profile?.userId, value.data?.id];
for (const candidate of candidates) {
const id = extractNumericUserId(candidate);
if (id !== null) return id;
@@ -633,9 +215,7 @@ function formatWindowDuration(str) {
function CountdownTimer({ deadline }) {
const { t } = useTranslation();
- const [remaining, setRemaining] = useState(
- deadline ? Math.max(0, deadline - Date.now()) : 0,
- );
+ const [remaining, setRemaining] = useState(deadline ? Math.max(0, deadline - Date.now()) : 0);
useEffect(() => {
if (!deadline) return;
const tick = () => setRemaining(Math.max(0, deadline - Date.now()));
@@ -643,12 +223,7 @@ function CountdownTimer({ deadline }) {
const id = setInterval(tick, 1000);
return () => clearInterval(id);
}, [deadline]);
- if (remaining <= 0)
- return (
-
- {t("timeExpired")}
-
- );
+ if (remaining <= 0) return {t("timeExpired")};
const h = Math.floor(remaining / 3600000);
const m = Math.floor((remaining % 3600000) / 60000);
const s = Math.floor((remaining % 60000) / 1000);
@@ -660,7 +235,6 @@ function CountdownTimer({ deadline }) {
);
}
-//
function PaymentDialog({
isOpen,
reservation,
@@ -673,6 +247,8 @@ function PaymentDialog({
loadingPaymentMethods,
receiptImage,
onSetReceiptImage,
+ haramDetails,
+ onSetHaramDetails,
}) {
const { t } = useTranslation();
const [showCashDialog, setShowCashDialog] = useState(false);
@@ -685,23 +261,21 @@ function PaymentDialog({
const amount = reservation.depositAmount || reservation.totalPrice || 0;
const currencySign = reservation.currencySign || t("sypSymbol");
- const selectedMethod = paymentMethods?.find(
- (m) => String(m?.id ?? m?.name) === String(selectedPayment)
- );
+ const selectedMethod = paymentMethods?.find((m) => String(m?.id ?? m?.name) === String(selectedPayment));
const isHaram = selectedMethod?.name?.toLowerCase?.() === "haram";
const hasSelectedMethod = !!selectedMethod;
- const canPay = payingId !== reservation.id && hasSelectedMethod && (!isHaram || !!receiptImage);
+
+ const isHaramFormValid = !isHaram || (haramDetails.fullName.trim() !== "" && haramDetails.governorate !== "" && haramDetails.phone.trim() !== "");
+
+ const canPay = payingId !== reservation.id && hasSelectedMethod && (!isHaram || (!!receiptImage && isHaramFormValid));
return (
<>
-
+
e.stopPropagation()}
>
@@ -710,15 +284,11 @@ function PaymentDialog({
-
- {reservation.propertyName}
-
+
{reservation.propertyName}
{(reservation.propertyAddress || reservation.propertyCity) && (
- {[reservation.propertyCity, reservation.propertyAddress]
- .filter(Boolean)
- .join(" - ")}
+ {[reservation.propertyCity, reservation.propertyAddress].filter(Boolean).join(" - ")}
)}
@@ -727,12 +297,10 @@ function PaymentDialog({
- {formatDate(reservation.startDate)} -{" "}
- {formatDate(reservation.endDate)}
+ {formatDate(reservation.startDate)} - {formatDate(reservation.endDate)}
- #
- {reservation.reservationId || reservation.id}
+ #{reservation.reservationId || reservation.id}
@@ -740,36 +308,20 @@ function PaymentDialog({
{t("depositAmount")}
-
- {formatCurrency(amount, currencySign)}
-
-
- {t("depositPaidToPlatform")}
-
+
{formatCurrency(amount, currencySign)}
+
{t("depositPaidToPlatform")}
- {/* this disabled becuase if all of them not active or active there is no manual*/}
- {/*
-
-
-
- {t('cashOnlyNotice')}
-
-
-
*/}
-
- {t("paymentMethod")}
-
+
{t("paymentMethod")}
{loadingPaymentMethods ? (
{t("loadingPaymentMethods", {
defaultValue: "جاري تحميل طرق الدفع...",
})}
- ) : !Array.isArray(paymentMethods) ||
- paymentMethods.length === 0 ? (
+ ) : !Array.isArray(paymentMethods) || paymentMethods.length === 0 ? (
{t("noPaymentMethodsAvailable", {
defaultValue: "لا توجد طرق دفع متاحة حالياً.",
@@ -778,13 +330,9 @@ function PaymentDialog({
) : (
{paymentMethods.map((method, index) => {
- const isActive =
- method?.isActive === true || method?.active === true;
- const optionId =
- method?.id ?? method?.name ?? `payment-method-${index}`;
- const label =
- method?.name ||
- t("paymentMethod", { defaultValue: "طريقة الدفع" });
+ const isActive = method?.isActive === true || method?.active === true;
+ const optionId = method?.id ?? method?.name ?? `payment-method-${index}`;
+ const label = method?.name || t("paymentMethod", { defaultValue: "طريقة الدفع" });
const isSelected = selectedPayment === optionId;
return (
@@ -801,25 +349,11 @@ function PaymentDialog({
: "border-gray-200 bg-white hover:border-amber-300 cursor-pointer"
}`}
>
-
- {isActive ? (
-
- ) : (
-
- )}
+
+ {isActive ? : }
-
- {label}
-
+
{label}
{isActive
? t("paymentMethodAvailable", {
@@ -829,16 +363,8 @@ function PaymentDialog({
defaultValue: "غير متاحة حالياً",
})}
-
- {isActive
- ? t("active", { defaultValue: "نشطة ✅" })
- : t("inactive", { defaultValue: "غير نشطة ❌" })}
+
+ {isActive ? t("active", { defaultValue: "نشطة ✅" }) : t("inactive", { defaultValue: "غير نشطة ❌" })}
{isSelected && (
@@ -854,71 +380,79 @@ function PaymentDialog({
{isHaram && (
-
-
-
- {t("uploadReceipt", { defaultValue: "إيصال الدفع" })}
-
- {receiptImage ? (
-
-
})
-
onSetReceiptImage(null)}
- className="absolute top-2 left-2 w-8 h-8 bg-red-500 text-white rounded-full flex items-center justify-center hover:bg-red-600 transition-colors shadow-md"
- >
-
-
-
-
- {receiptImage.name}
-
-
+ <>
+
+
+
+ بيانات حوالة الهرم
+
+
+
+ {haramDetails.split("\n").map((line, idx) => (
+
{line}
+ ))}
- ) : (
-
- )}
-
+
+
+
+
+
+
+
+ {t("uploadReceipt", { defaultValue: "إيصال الدفع" })}
+
+ {receiptImage ? (
+
+
})
+
onSetReceiptImage(null)}
+ className="absolute top-2 left-2 w-8 h-8 bg-red-500 text-white rounded-full flex items-center justify-center hover:bg-red-600 transition-colors shadow-md"
+ >
+
+
+
+
+ ) : (
+
+ )}
+
+ >
)}
onConfirmPay(reservation)}
- disabled={!canPay}
+
whileHover={{ scale: 1.01 }}
whileTap={{ scale: 0.99 }}
className="w-full bg-amber-500 hover:bg-amber-600 disabled:bg-amber-300 text-white font-bold py-4 px-6 rounded-2xl text-lg transition-all shadow-lg hover:shadow-xl flex items-center justify-center gap-3"
@@ -938,44 +472,9 @@ function PaymentDialog({
)}
-{/* // */}
- {/* Pay Cash button - commented out */}
- {/*
- setShowCashDialog(true)}
- className="w-full bg-white border-2 border-amber-200 hover:border-amber-400 text-amber-700 font-bold py-3 px-6 rounded-2xl text-base transition-all flex items-center justify-center gap-2"
- >
-
- {t("payCash")}
-
-
*/}
-
- {/* Cash payment location - commented out */}
- {/*
-
-
-
-
- {t("cashPaymentLocation")}
-
-
- {t("platformOfficeAddress")}
-
-
-
- +963567823411
-
-
-
-
*/}
-
+
{t("close")}
@@ -984,31 +483,16 @@ function PaymentDialog({
{showCashDialog && (
-
+
-
- {t("cashPaymentPending")}
-
-
- {t("cashPaymentInstructions")}
-
+ {t("cashPaymentPending")}
+ {t("cashPaymentInstructions")}
-
- {t("platformLocation")}
-
-
- {t("platformOfficeAddress")}
-
-
+
{t("platformLocation")}
+
{t("platformOfficeAddress")}
+
+963567823411
@@ -1021,10 +505,7 @@ function PaymentDialog({
>
{t("close")}
-
+
{t("myBookings")}
@@ -1064,23 +545,16 @@ function ReportDialog({ isOpen, reservation, onClose, onSubmit, submitting }) {
{t("reportReservation")}
-
- {t("reservationNumber", { id: reservation.id })}
-
+
{t("reservationNumber", { id: reservation.id })}
-
+
-
- {t("reportDescription")}
-
+
{t("reportDescription")}
{isOwnerConfirmed && hasTimeWindow && (
@@ -1245,12 +691,7 @@ function ReservationCard({
disabled={isPaying}
className={`flex-1 py-2 rounded-xl text-sm font-medium transition-colors flex items-center justify-center gap-2 ${isPaying ? "bg-gray-300 text-gray-500 cursor-not-allowed" : "bg-amber-500 text-white hover:bg-amber-600"}`}
>
- {isPaying ? (
-
- ) : (
-
- )}{" "}
- {isPaying ? t("processingPayment") : t("payNow")}
+ {isPaying ?
:
} {isPaying ? t("processingPayment") : t("payNow")}
)}
@@ -1259,12 +700,7 @@ function ReservationCard({
disabled={isReporting}
className={`w-full mt-3 py-2 rounded-xl text-sm font-medium transition-colors flex items-center justify-center gap-2 ${isReporting ? "bg-gray-300 text-gray-500 cursor-not-allowed" : "bg-red-50 text-red-700 hover:bg-red-100"}`}
>
- {isReporting ? (
-
- ) : (
-
- )}{" "}
- {isReporting ? t("reportingAction") : t("report")}
+ {isReporting ?
:
} {isReporting ? t("reportingAction") : t("report")}
{canRate && !showRating && (
(
-
+
{t(cat.label)}
{[1, 2, 3, 4, 5].map((n) => (
- setRatings((p) => ({ ...p, [cat.key]: n }))
- }
+ onClick={() => setRatings((p) => ({ ...p, [cat.key]: n }))}
className={`p-0.5 rounded-full transition-colors ${n <= ratings[cat.key] ? "text-amber-500" : "text-gray-300"}`}
>
-
+
))}
@@ -1316,13 +745,7 @@ function ReservationCard({
{
- if (
- !ratings.clean ||
- !ratings.services ||
- !ratings.ownerBehavior ||
- !ratings.experience
- )
- return toast.error(t("rateAllCategories"));
+ if (!ratings.clean || !ratings.services || !ratings.ownerBehavior || !ratings.experience) return toast.error(t("rateAllCategories"));
setSubmittingRating(true);
try {
await addPropertyRating({
@@ -1376,24 +799,13 @@ function ReservationCard({
);
}
-function DetailsModal({
- r,
- isOpen,
- onClose,
- onPay,
- onReport,
- payingId,
- reportingId,
-}) {
+function DetailsModal({ r, isOpen, onClose, onPay, onReport, payingId, reportingId }) {
const { t } = useTranslation();
if (!isOpen || !r) return null;
const p = r._prop;
const isOwnerConfirmed = STATUS_MAP[r.status] === "ownerConfirmed";
const hasTimeWindow = r.ownerApprovalDate && p?.allowedPaymentPeriod;
- const deadline = hasTimeWindow
- ? new Date(r.ownerApprovalDate).getTime() +
- parseTimeSpan(p.allowedPaymentPeriod)
- : null;
+ const deadline = hasTimeWindow ? new Date(r.ownerApprovalDate).getTime() + parseTimeSpan(p.allowedPaymentPeriod) : null;
const isExpired = deadline ? Date.now() > deadline : false;
const isPaying = payingId === r.id;
const isReporting = reportingId === r.id;
@@ -1416,16 +828,11 @@ function DetailsModal({
{t("bookingDetails")}
-
+
-
- {t("reservationNumber", { id: r.id })}
-
+
{t("reservationNumber", { id: r.id })}
{p && (
@@ -1434,8 +841,7 @@ function DetailsModal({
{t("propertyInfo")}
- {t("addressLabel")}{" "}
- {propAddr(p, r) || "—"}
+ {t("addressLabel")} {propAddr(p, r) || "—"}
{(propBeds(p, r) || propBaths(p, r)) && (
@@ -1455,21 +861,16 @@ function DetailsModal({
)}
- {" "}
- {t("bookingDetails")}
+ {t("bookingDetails")}
{t("startDateLabel")}
-
- {new Date(r.startDate).toLocaleDateString("ar")}
-
+
{new Date(r.startDate).toLocaleDateString("ar")}
{t("endDateLabel")}
-
- {new Date(r.endDate).toLocaleDateString("ar")}
-
+
{new Date(r.endDate).toLocaleDateString("ar")}
{t("statusLabel")}
@@ -1477,9 +878,7 @@ function DetailsModal({
{t("createdAtLabel")}
-
- {new Date(r.createdAt).toLocaleDateString("ar")}
-
+
{new Date(r.createdAt).toLocaleDateString("ar")}
@@ -1489,9 +888,7 @@ function DetailsModal({
{t("total")}
-
- {r.totalPrice?.toLocaleString() ?? "—"}
-
+ {r.totalPrice?.toLocaleString() ?? "—"}
{isOwnerConfirmed && hasTimeWindow && (
@@ -1516,12 +913,7 @@ function DetailsModal({
disabled={isPaying}
className={`w-full py-2 rounded-xl font-medium transition-colors flex items-center justify-center gap-2 ${isPaying ? "bg-gray-300 text-gray-500 cursor-not-allowed" : "bg-amber-500 text-white hover:bg-amber-600"}`}
>
- {isPaying ? (
-
- ) : (
-
- )}{" "}
- {isPaying ? t("processingPayment") : t("payNow")}
+ {isPaying ?
:
} {isPaying ? t("processingPayment") : t("payNow")}
)}
@@ -1534,12 +926,7 @@ function DetailsModal({
disabled={isReporting}
className={`w-full py-2 rounded-xl font-medium transition-colors flex items-center justify-center gap-2 ${isReporting ? "bg-gray-300 text-gray-500 cursor-not-allowed" : "bg-red-50 text-red-700 hover:bg-red-100"}`}
>
- {isReporting ? (
-
- ) : (
-
- )}{" "}
- {isReporting ? t("reportingAction") : t("report")}
+ {isReporting ? : } {isReporting ? t("reportingAction") : t("report")}
@@ -1564,6 +951,7 @@ export default function UserReservationsPage() {
const [reportingId, setReportingId] = useState(null);
const [selectedPayment, setSelectedPayment] = useState("cash");
const [receiptImage, setReceiptImage] = useState(null);
+ const [haramDetails, setHaramDetails] = useState();
const [paymentDialog, setPaymentDialog] = useState({
open: false,
reservation: null,
@@ -1573,23 +961,18 @@ export default function UserReservationsPage() {
const loadReservations = useCallback(async () => {
try {
- const [data, rentProps] = await Promise.all([
- getUserReservations(),
- getRentProperties().catch(() => []),
- ]);
+ const [data, rentProps] = await Promise.all([getUserReservations(), getRentProperties().catch(() => [])]);
const list = Array.isArray(data) ? data : [];
const propsList = Array.isArray(rentProps) ? rentProps : [];
const propMap = {};
propsList.forEach((rp) => {
const info = rp?.propertyInformation ?? {};
- if (rp?.allowedPaymentPeriod)
- info.allowedPaymentPeriod = rp.allowedPaymentPeriod;
+ if (rp?.allowedPaymentPeriod) info.allowedPaymentPeriod = rp.allowedPaymentPeriod;
propMap[rp.propertyInformationId] = info;
propMap[rp.propertyInformation?.id] = info;
});
const enriched = list.map((r) => {
- if (r.propertyId && propMap[r.propertyId])
- r._prop = propMap[r.propertyId];
+ if (r.propertyId && propMap[r.propertyId]) r._prop = propMap[r.propertyId];
return r;
});
setReservations(enriched);
@@ -1616,6 +999,7 @@ export default function UserReservationsPage() {
try {
const data = await getPaymentTypes();
setPaymentMethods(Array.isArray(data) ? data : []);
+ setHaramDetails(data[0].details)
} catch (err) {
console.error(err);
setPaymentMethods([]);
@@ -1630,50 +1014,45 @@ export default function UserReservationsPage() {
useEffect(() => {
let r = reservations;
- if (filterStatus !== "all")
- r = r.filter((x) => STATUS_MAP[x.status] === filterStatus);
+ if (filterStatus !== "all") r = r.filter((x) => STATUS_MAP[x.status] === filterStatus);
if (searchTerm) {
const q = searchTerm.toLowerCase();
- r = r.filter(
- (x) =>
- propAddr(x._prop, x).toLowerCase().includes(q) ||
- String(x.id).includes(q),
- );
+ r = r.filter((x) => propAddr(x._prop, x).toLowerCase().includes(q) || String(x.id).includes(q));
}
setFiltered(r);
}, [reservations, filterStatus, searchTerm]);
- const allStatuses = [
- ...new Set(reservations.map((r) => STATUS_MAP[r.status])),
- ];
+ const allStatuses = [...new Set(reservations.map((r) => STATUS_MAP[r.status]))];
const counts = {
all: reservations.length,
- ...Object.fromEntries(
- allStatuses.map((s) => [
- s,
- reservations.filter((r) => STATUS_MAP[r.status] === s).length,
- ]),
- ),
+ ...Object.fromEntries(allStatuses.map((s) => [s, reservations.filter((r) => STATUS_MAP[r.status] === s).length])),
};
const openPaymentDialog = (r) => {
setPaymentDialog({ open: true, reservation: r });
setReceiptImage(null);
+ setHaramDetails({ fullName: "", governorate: "", phone: "" });
};
const closePaymentDialog = () => {
setPaymentDialog({ open: false, reservation: null });
setReceiptImage(null);
+ setHaramDetails({ fullName: "", governorate: "", phone: "" });
};
const handleConfirmPay = async (r) => {
setPayingId(r.id);
+ const selectedMethod = paymentMethods?.find((m) => String(m?.id ?? m?.name) === String(selectedPayment));
+ const isHaram = selectedMethod?.name?.toLowerCase?.() === "haram";
+ const detailsJson = isHaram ? JSON.stringify(haramDetails) : null;
+
try {
await payDeposit({
reservationId: r.id,
paymentTypeId: selectedPayment,
transactionType: 1,
- comment: null,
+ comment: detailsJson,
+ details: detailsJson,
paymentImage: receiptImage || null,
});
toast.success(t("depositPaidSuccess"));
@@ -1699,10 +1078,7 @@ export default function UserReservationsPage() {
setReportingId(reportDialog.reservation.id);
try {
- await reportReservation(
- reportDialog.reservation.id,
- message.trim() || null,
- );
+ await reportReservation(reportDialog.reservation.id, message.trim() || null);
toast.success(t("reportSubmittedSuccess"));
closeReportDialog();
} catch (err) {
@@ -1712,31 +1088,15 @@ export default function UserReservationsPage() {
}
};
-if (loading) {
- return (
-
- );
+ if (loading) {
+ return
;
}
return (
-
setSelected(null)}
- onPay={openPaymentDialog}
- onReport={openReportDialog}
- payingId={payingId}
- reportingId={reportingId}
- />
-
+ setSelected(null)} onPay={openPaymentDialog} onReport={openReportDialog} payingId={payingId} reportingId={reportingId} />
+
-
- router.back()}
- className="flex items-center gap-2 text-gray-600 hover:text-amber-600 mb-4"
- >
+
+ router.back()} className="flex items-center gap-2 text-gray-600 hover:text-amber-600 mb-4">
{t("back")}
-
- {t("myBookings")}
-
-
- {t("youHaveBookings", { count: reservations.length })}
-
+ {t("myBookings")}
+ {t("youHaveBookings", { count: reservations.length })}
{Object.entries(counts).map(([s, c]) => (
@@ -1779,9 +1130,7 @@ if (loading) {
onClick={() => setFilterStatus(s)}
>
{c}
-
- {s === "all" ? t("all") : t(`bookingStatus.${s}`)}
-
+
{s === "all" ? t("all") : t(`bookingStatus.${s}`)}
))}
@@ -1798,23 +1147,13 @@ if (loading) {
{filtered.length === 0 ? (
-
- {t("noBookings")}
-
+
{t("noBookings")}
{t("noReservationsDesc")}
) : (
{filtered.map((r) => (
-
+
))}
)}
diff --git a/app/utils/api.js b/app/utils/api.js
index 152770f..61d81b6 100644
--- a/app/utils/api.js
+++ b/app/utils/api.js
@@ -1,4 +1,6 @@
+import { body } from "framer-motion/client";
import AuthService from "../services/AuthService";
+import { frameData } from "framer-motion";
const API_BASE = process.env.NEXT_PUBLIC_API_URL || "https://45.93.137.91.nip.io/api";
const REPORT_API_BASE = process.env.NEXT_PUBLIC_REPORT_API_URL || "http://45.93.137.91/api";
@@ -364,16 +366,38 @@ export async function getSalePropertyById(id) {
}
export async function updateRentPropertyStatus(id, status) {
- return apiFetch(`/RentProperties/UpdateStatus/${id}`, {
+ return apiFetch(`/RentProperties/ChangeActivityStatus/${id}`, {
method: "PUT",
- body: { status },
+ body: status ,
});
}
export async function updateSalePropertyStatus(id, status) {
- return apiFetch(`/SaleProperties/UpdateStatus/${id}`, {
+ return apiFetch(`/SaleProperties/ChangeActivityStatus/${id}`, {
method: "PUT",
- body: { status },
+ body: status ,
+ });
+}
+
+export async function OwnerPaymentForSaleProperite(
+ salePropertyId,
+ PaymentTypeId,
+ TransactionType,
+ paymentImage
+) {
+ const formData = new FormData();
+
+ formData.append("salePropertyId", String(salePropertyId));
+ formData.append("PaymentTypeId", String(PaymentTypeId));
+ formData.append("TransactionType", String(TransactionType));
+
+ if (paymentImage instanceof File) {
+ formData.append("paymentImage", paymentImage);
+ }
+
+ return apiFetch("/SaleProperties/PaySaleFee", {
+ method: "POST",
+ body: formData,
});
}
diff --git a/app/utils/firebase.js b/app/utils/firebase.js
index 31b6af1..cd47684 100644
--- a/app/utils/firebase.js
+++ b/app/utils/firebase.js
@@ -1,5 +1,6 @@
import { initializeApp, getApps } from "firebase/app";
import { getMessaging, getToken, onMessage } from "firebase/messaging";
+import { Cookies } from 'js-cookie';
const firebaseConfig = {
apiKey: "AIzaSyBZV7KBLRJSTApahfrO8lBesmIM3zNRSaY",
@@ -45,8 +46,7 @@ export async function requestNotificationPermission() {
// Send token to backend
if (token) {
try {
- const authToken = localStorage.getItem("auth_token");
-
+ const authToken = Cookies.get(auth_token);
if (authToken) {
const apiBase =
process.env.NEXT_PUBLIC_API_URL ||
@@ -66,7 +66,6 @@ export async function requestNotificationPermission() {
}
} catch (err) {}
}
-
return token;
} catch (err) {
return null;
diff --git a/public/firebase-messaging-sw.js b/public/firebase-messaging-sw.js
index 85a672b..910512d 100644
--- a/public/firebase-messaging-sw.js
+++ b/public/firebase-messaging-sw.js
@@ -17,7 +17,6 @@ firebase.initializeApp({
//ننشئ رسالة
const messaging = firebase.messaging();
-
// Handle background messages
messaging.onBackgroundMessage((payload) => {
("[FCM SW] Background message:", payload);