diff --git a/app/ClientLayout.js b/app/ClientLayout.js index aaa4a11..262d9a4 100644 --- a/app/ClientLayout.js +++ b/app/ClientLayout.js @@ -25,7 +25,6 @@ import { Mail, MapPin, Camera, - Shield, Bell, Home, ChevronDown, @@ -34,7 +33,6 @@ import { TrendingUp, CalendarDays, Clock, - Users, DollarSign, Star, FileText, @@ -80,9 +78,7 @@ export default function ClientLayout({ children }) { name: authUser.name || authUser.email, email: authUser.email, phone: authUser.phone, - role: AuthService.isAdmin() ? UserRole.ADMIN - : AuthService.isOwner() ? UserRole.OWNER - : UserRole.CUSTOMER, + role: AuthService.isOwner() ? UserRole.OWNER : UserRole.CUSTOMER, }); } else { setUser(null); @@ -138,7 +134,6 @@ export default function ClientLayout({ children }) { const isProfilePage = pathname === "/profile"; const isOwner = user?.role === UserRole.OWNER; - const isAdmin = user?.role === UserRole.ADMIN; const isCustomer = user?.role === UserRole.CUSTOMER; const isAuthenticated = !!user; @@ -234,14 +229,6 @@ export default function ClientLayout({ children }) { الرئيسية عقاراتنا - {isAdmin && ( - - - - الإدارة - - - )} {isOwner && ( <> @@ -500,82 +487,6 @@ export default function ClientLayout({ children }) { )} - {isAdmin && ( - <> -
- - setShowUserMenu(false)} - > - -
-

لوحة التحكم

-

- إدارة المنصة -

-
- - - setShowUserMenu(false)} - > - -
-

المستخدمين

-

- إدارة المستخدمين -

-
- - - setShowUserMenu(false)} - > - -
-

العقارات

-

- إدارة جميع العقارات -

-
- - - setShowUserMenu(false)} - > - -
-

الحجوزات

-

- إدارة الحجوزات -

-
- - - setShowUserMenu(false)} - > - -
-

دفتر الحسابات

-

- إدارة المعاملات المالية -

-
- - - )} - {isCustomer && ( <>
@@ -730,15 +641,6 @@ export default function ClientLayout({ children }) {
- {isAdmin && ( - - - - الإدارة - - - )} - {isOwner && ( <> - {isAdmin && ( -
  • - - الإدارة - -
  • - )}
    diff --git a/app/admin/add-admin/page.js b/app/admin/add-admin/page.js deleted file mode 100644 index 3a7dce9..0000000 --- a/app/admin/add-admin/page.js +++ /dev/null @@ -1,113 +0,0 @@ -'use client'; - -import { useEffect, useState } from 'react'; -import AuthService from '@/app/services/AuthService'; -import Link from 'next/link'; - -export default function AddAdminPage() { - const [isAdmin, setIsAdmin] = useState(false); - const [checked, setChecked] = useState(false); - const [formState, setFormState] = useState({ fullName: '', email: '', password: '' }); - const [saved, setSaved] = useState(false); - - useEffect(() => { - setIsAdmin(AuthService.isAuthenticated() && AuthService.isAdmin()); - setChecked(true); - }, []); - - const handleChange = (field) => (event) => { - setFormState((prev) => ({ ...prev, [field]: event.target.value })); - }; - - const handleSubmit = (event) => { - event.preventDefault(); - setSaved(true); - console.log('Add admin payload', formState); - }; - - if (!checked) { - return ( -
    -
    -
    - ); - } - - if (!isAdmin) { - return ( -
    -
    - - العودة للرئيسية - -
    -
    - ); - } - - return ( -
    -
    -
    -
    -

    لوحة المدير

    -

    إضافة مدير جديد

    -

    انشئ حساب مسؤول جديد مع صلاحيات الإدارة.

    -
    -
    - -
    -
    -

    بيانات المدير

    -
    - - - - - - - -
    - {saved && ( -
    - تم حفظ بيانات المدير بنجاح -
    - )} -
    -
    -
    -
    - ); -} diff --git a/app/admin/error.js b/app/admin/error.js deleted file mode 100644 index a88abe0..0000000 --- a/app/admin/error.js +++ /dev/null @@ -1,27 +0,0 @@ -'use client'; - -import { motion } from 'framer-motion'; -import { AlertTriangle, RefreshCw, Home } from 'lucide-react'; -import Link from 'next/link'; - -export default function Error({ error, reset }) { - return ( -
    - -
    - -
    -

    حدث خطأ

    -

    نعتذر، حدث خطأ أثناء تحميل الصفحة

    -
    - - - الرئيسية - -
    -
    -
    - ); -} diff --git a/app/admin/loading.js b/app/admin/loading.js deleted file mode 100644 index 0c01106..0000000 --- a/app/admin/loading.js +++ /dev/null @@ -1,14 +0,0 @@ -'use client'; - -import { motion } from 'framer-motion'; - -export default function Loading() { - return ( -
    - -
    -

    جاري التحميل...

    - -
    - ); -} diff --git a/app/admin/page.js b/app/admin/page.js deleted file mode 100644 index 007988d..0000000 --- a/app/admin/page.js +++ /dev/null @@ -1,230 +0,0 @@ -'use client'; - -import { motion } from 'framer-motion'; -import { useState, useEffect } from 'react'; -import { useTranslation } from 'react-i18next'; -import Link from 'next/link'; -import { - Home, - Calendar, - Users, - DollarSign, - TrendingUp, - Bell, - Frown -} from 'lucide-react'; -import DashboardStats from '../components/admin/DashboardStats'; -import PropertiesTable from '../components/admin/PropertiesTable'; -import BookingRequests from '../components/admin/BookingRequests'; -import UsersList from '../components/admin/UsersList'; -import LedgerBook from '../components/admin/LedgerBook'; -import AddPropertyForm from '../components/admin/AddPropertyForm'; -import { PropertyProvider } from '../contexts/PropertyContext'; -import AuthService from '../services/AuthService'; -import '../i18n/config'; - -export default function AdminPage() { - const { t, i18n } = useTranslation(); - const [activeTab, setActiveTab] = useState('dashboard'); - const [showAddProperty, setShowAddProperty] = useState(false); - const [notifications, setNotifications] = useState(3); - const [isAdmin, setIsAdmin] = useState(false); - const [checked, setChecked] = useState(false); - - useEffect(() => { - setIsAdmin(AuthService.isAuthenticated() && AuthService.isAdmin()); - setChecked(true); - }, []); - - // ─── 404 for non-admins ─── - if (checked && !isAdmin) { - return ( -
    - -
    - - - - - - عذراً! - الصفحة غير موجودة - -
    -

    404 - الصفحة غير موجودة

    -

    عذراً، لا يمكنك الوصول إلى هذه الصفحة

    - - - العودة للرئيسية - -
    -
    - ); - } - - if (!checked) { - return ( -
    -
    -
    - ); - } - - const tabs = [ - { id: 'dashboard', label: 'لوحة التحكم', icon: Home }, - { id: 'properties', label: 'العقارات', icon: Home }, - { id: 'bookings', label: 'طلبات الحجز', icon: Calendar, badge: notifications }, - { id: 'users', label: 'المستخدمين', icon: Users }, - { id: 'ledger', label: 'دفتر الحسابات', icon: DollarSign }, - // { id: 'reports', label: 'التقارير', icon: TrendingUp } - ]; - - return ( - -
    - -
    -
    -

    - {t('adminDashboard')} -

    -

    - إدارة العقارات، الحجوزات، والحسابات المالية -

    -
    - - -
    -
    - -
    -
    - {tabs.map((tab) => { - const Icon = tab.icon; - return ( - - ); - })} -
    -
    - -
    - {activeTab === 'dashboard' && ( - - - - )} - - {activeTab === 'properties' && ( - -
    -
    -

    إدارة العقارات

    -

    إضافة وتعديل العقارات مع تحديد نسب الأرباح

    -
    - -
    - -
    - )} - - {activeTab === 'bookings' && ( - - - - )} - - {activeTab === 'users' && ( - - - - )} - - {activeTab === 'ledger' && ( - - - - )} - - {activeTab === 'reports' && ( - -
    - قريباً... تقارير متقدمة -
    -
    - )} -
    - - {showAddProperty && ( - setShowAddProperty(false)} - onSuccess={() => { - setShowAddProperty(false); - }} - /> - )} -
    -
    - ); -} \ No newline at end of file diff --git a/app/admin/privacy/page.js b/app/admin/privacy/page.js deleted file mode 100644 index 35bdb5d..0000000 --- a/app/admin/privacy/page.js +++ /dev/null @@ -1,85 +0,0 @@ -'use client'; - -import { useEffect, useState } from 'react'; -import AuthService from '@/app/services/AuthService'; -import Link from 'next/link'; - -const initialPolicy = `1. نحترم خصوصيتك ونلتزم بحماية بياناتك الشخصية. -2. يتم استخدام المعلومات لتحسين تجربة المستخدم وتأمين الخدمة. -3. لا نشارك البيانات مع أطراف خارجية بدون موافقتك. -4. يمكنك طلب حذف بياناتك من النظام في أي وقت.`; - -export default function PrivacyPolicyAdminPage() { - const [isAdmin, setIsAdmin] = useState(false); - const [checked, setChecked] = useState(false); - const [policyText, setPolicyText] = useState(initialPolicy); - const [saved, setSaved] = useState(false); - - useEffect(() => { - setIsAdmin(AuthService.isAuthenticated() && AuthService.isAdmin()); - setChecked(true); - }, []); - - const handleSave = (event) => { - event.preventDefault(); - setSaved(true); - console.log('Privacy policy updated:', policyText); - }; - - if (!checked) { - return ( -
    -
    -
    - ); - } - - if (!isAdmin) { - return ( -
    -
    -

    هذه الصفحة لتحرير سياسة الخصوصية ولا يمكن الوصول إليها إلا للمدير.

    - - العودة للرئيسية - -
    -
    - ); - } - return ( -
    -
    -
    -
    -
    -

    لوحة المدير

    -

    قم بتحديث نص سياسة الخصوصية

    -
    -
    -
    - -
    -
    - -