diff --git a/app/components/BottomNav.js b/app/components/BottomNav.js index aa09f8d..7729c25 100644 --- a/app/components/BottomNav.js +++ b/app/components/BottomNav.js @@ -1,7 +1,7 @@ "use client"; import Link from "next/link"; -import { Home, Building, Calendar, Heart, Bell, Settings } from "lucide-react"; +import { Home, Building, Calendar, Heart, Bell, Settings, CreditCard } from "lucide-react"; import React, { useEffect, useState } from "react"; import { useNotifications } from "@/app/contexts/NotificationsContext"; @@ -19,6 +19,7 @@ export default function BottomNav({ isOwner }) { { href: "/properties", label: "عقاراتنا", icon: Building }, { href: bookingsHref, label: "الحجوزات", icon: Calendar }, { href: "/favorites", label: "المفضلة", icon: Heart }, + { href: "/payments", label: "المدفوعات", icon: CreditCard }, { href: "/notifications", label: "الإشعارات", icon: Bell, badge: isMounted ? unreadCount : 0 }, { href: "/settings", label: "الإعدادات", icon: Settings }, ]; diff --git a/app/payments/page.js b/app/payments/page.js index 966efe7..8b6caba 100644 --- a/app/payments/page.js +++ b/app/payments/page.js @@ -154,8 +154,9 @@ import { useEffect, useState, useCallback } from 'react'; import { useRouter } from 'next/navigation'; +import Link from 'next/link'; import { motion } from 'framer-motion'; -import { CreditCard, Loader2, Home, Calendar, Check, X, Clock } from 'lucide-react'; +import { CreditCard, Loader2, Home, Calendar, Check, X, Clock, LogIn, Lock } from 'lucide-react'; import toast, { Toaster } from 'react-hot-toast'; import AuthService from '@/app/services/AuthService'; import { payDeposit } from '@/app/utils/api'; @@ -176,6 +177,7 @@ export default function PaymentsPage() { const [reservations, setReservations] = useState([]); const [loading, setLoading] = useState(true); const [payingId, setPayingId] = useState(null); + const [isGuest, setIsGuest] = useState(null); const getAuthToken = () => { if (typeof window === 'undefined') return ''; @@ -238,13 +240,14 @@ export default function PaymentsPage() { }, []); useEffect(() => { - // Admin check removed - // if (AuthService.isAdmin()) { - // router.push('/'); - // return; - // } + if (AuthService.isGuest()) { + setIsGuest(true); + setLoading(false); + return; + } + setIsGuest(false); loadReservations(); - }, [router, loadReservations]); + }, [loadReservations]); const handlePayDeposit = async (reservation) => { setPayingId(reservation.id); @@ -276,6 +279,33 @@ export default function PaymentsPage() { ); } + if (isGuest) { + return ( +
+ +
+ +
+

المدفوعات

+

+ دفعاتك مرتبطة بحاسبك لذلك يرجى تسجيل الدخول أولاً +

+ + + تسجيل الدخول + +
+
+ ); + } + const canPay = (status) => STATUS_MAP[status] === 'pending' || STATUS_MAP[status] === 'ownerConfirmed'; return (