File size: 47,712 Bytes
2d875ad
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
<!DOCTYPE html>
<html lang="ar" dir="rtl">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>نظام المحاسبة المتكامل</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
    <style>
        @import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700&display=swap');
        
        body {
            font-family: 'Tajawal', sans-serif;
        }
        
        .sidebar {
            transition: all 0.3s ease;
        }
        
        .sidebar.collapsed {
            width: 70px;
        }
        
        .sidebar.collapsed .sidebar-text {
            display: none;
        }
        
        .sidebar.collapsed .logo-text {
            display: none;
        }
        
        .sidebar.collapsed .menu-item {
            justify-content: center;
        }
        
        .content-area {
            transition: all 0.3s ease;
        }
        
        .content-area.expanded {
            margin-right: 70px;
        }
        
        .rtl-dir {
            direction: rtl;
        }
        
        .ltr-dir {
            direction: ltr;
        }
        
        .invoice-table th {
            background-color: #f3f4f6;
            font-weight: 600;
        }
        
        .invoice-table tr:nth-child(even) {
            background-color: #f9fafb;
        }
        
        .language-switcher {
            transition: all 0.3s ease;
        }
        
        .language-switcher:hover {
            transform: scale(1.1);
        }
        
        .dashboard-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
        }
        
        .print-only {
            display: none;
        }
        
        @media print {
            .no-print {
                display: none;
            }
            .print-only {
                display: block;
            }
        }

        /* Login Page Styles */
        .login-container {
            background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
        }
        
        .login-card {
            backdrop-filter: blur(10px);
            background: rgba(255, 255, 255, 0.1);
            border: 1px solid rgba(255, 255, 255, 0.2);
        }
        
        .input-group {
            position: relative;
        }
        
        .input-group input {
            padding-right: 40px;
        }
        
        .input-group i {
            position: absolute;
            right: 15px;
            top: 50%;
            transform: translateY(-50%);
            color: #6b7280;
        }
        
        .auth-divider {
            display: flex;
            align-items: center;
            margin: 20px 0;
        }
        
        .auth-divider::before, .auth-divider::after {
            content: "";
            flex: 1;
            border-bottom: 1px solid #e5e7eb;
        }
        
        .auth-divider span {
            padding: 0 10px;
            color: #6b7280;
            font-size: 14px;
        }
    </style>
</head>
<body class="bg-gray-50">
    <!-- Login Page (Initially visible) -->
    <div id="login-page" class="min-h-screen flex items-center justify-center login-container p-4">
        <div class="w-full max-w-md">
            <div class="login-card rounded-xl shadow-xl overflow-hidden p-8">
                <div class="text-center mb-8">
                    <div class="w-20 h-20 bg-white rounded-full flex items-center justify-center mx-auto mb-4">
                        <i class="fas fa-calculator text-blue-600 text-3xl"></i>
                    </div>
                    <h1 class="text-2xl font-bold text-white">نظام المحاسبة المتكامل</h1>
                    <p class="text-blue-100 mt-2">سجل الدخول للوصول إلى لوحة التحكم</p>
                </div>
                
                <form id="login-form" class="space-y-6">
                    <div class="input-group">
                        <label for="username" class="block text-sm font-medium text-white">اسم المستخدم</label>
                        <div class="mt-1 relative rounded-md shadow-sm">
                            <input type="text" id="username" name="username" required class="py-3 px-4 block w-full rounded-md border-gray-300 focus:border-blue-500 focus:ring-blue-500" placeholder="أدخل اسم المستخدم">
                            <i class="fas fa-user"></i>
                        </div>
                    </div>
                    
                    <div class="input-group">
                        <label for="password" class="block text-sm font-medium text-white">كلمة المرور</label>
                        <div class="mt-1 relative rounded-md shadow-sm">
                            <input type="password" id="password" name="password" required class="py-3 px-4 block w-full rounded-md border-gray-300 focus:border-blue-500 focus:ring-blue-500" placeholder="أدخل كلمة المرور">
                            <i class="fas fa-lock"></i>
                        </div>
                    </div>
                    
                    <div class="flex items-center justify-between">
                        <div class="flex items-center">
                            <input id="remember-me" name="remember-me" type="checkbox" class="h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300 rounded">
                            <label for="remember-me" class="mr-2 block text-sm text-white">تذكرني</label>
                        </div>
                        
                        <div class="text-sm">
                            <a href="#" id="forgot-password" class="font-medium text-blue-200 hover:text-white">نسيت كلمة المرور؟</a>
                        </div>
                    </div>
                    
                    <div>
                        <button type="submit" class="w-full flex justify-center py-3 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500">
                            تسجيل الدخول
                        </button>
                    </div>
                </form>
                
                <div class="auth-divider">
                    <span>أو</span>
                </div>
                
                <div class="text-center text-sm text-white">
                    ليس لديك حساب؟ <a href="#" id="show-signup" class="font-medium text-blue-200 hover:text-white">إنشاء حساب جديد</a>
                </div>
            </div>
        </div>
    </div>
    
    <!-- Signup Page (Initially hidden) -->
    <div id="signup-page" class="min-h-screen flex items-center justify-center login-container p-4 hidden">
        <div class="w-full max-w-md">
            <div class="login-card rounded-xl shadow-xl overflow-hidden p-8">
                <div class="text-center mb-8">
                    <div class="w-20 h-20 bg-white rounded-full flex items-center justify-center mx-auto mb-4">
                        <i class="fas fa-user-plus text-blue-600 text-3xl"></i>
                    </div>
                    <h1 class="text-2xl font-bold text-white">إنشاء حساب جديد</h1>
                    <p class="text-blue-100 mt-2">املأ النموذج للتسجيل في النظام</p>
                </div>
                
                <form id="signup-form" class="space-y-6">
                    <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
                        <div class="input-group">
                            <label for="first-name" class="block text-sm font-medium text-white">الاسم الأول</label>
                            <div class="mt-1 relative rounded-md shadow-sm">
                                <input type="text" id="first-name" name="first-name" required class="py-3 px-4 block w-full rounded-md border-gray-300 focus:border-blue-500 focus:ring-blue-500" placeholder="الاسم الأول">
                                <i class="fas fa-user"></i>
                            </div>
                        </div>
                        
                        <div class="input-group">
                            <label for="last-name" class="block text-sm font-medium text-white">الاسم الأخير</label>
                            <div class="mt-1 relative rounded-md shadow-sm">
                                <input type="text" id="last-name" name="last-name" required class="py-3 px-4 block w-full rounded-md border-gray-300 focus:border-blue-500 focus:ring-blue-500" placeholder="الاسم الأخير">
                                <i class="fas fa-user"></i>
                            </div>
                        </div>
                    </div>
                    
                    <div class="input-group">
                        <label for="signup-username" class="block text-sm font-medium text-white">اسم المستخدم</label>
                        <div class="mt-1 relative rounded-md shadow-sm">
                            <input type="text" id="signup-username" name="signup-username" required class="py-3 px-4 block w-full rounded-md border-gray-300 focus:border-blue-500 focus:ring-blue-500" placeholder="اختر اسم مستخدم">
                            <i class="fas fa-at"></i>
                        </div>
                    </div>
                    
                    <div class="input-group">
                        <label for="signup-email" class="block text-sm font-medium text-white">البريد الإلكتروني</label>
                        <div class="mt-1 relative rounded-md shadow-sm">
                            <input type="email" id="signup-email" name="signup-email" required class="py-3 px-4 block w-full rounded-md border-gray-300 focus:border-blue-500 focus:ring-blue-500" placeholder="أدخل بريدك الإلكتروني">
                            <i class="fas fa-envelope"></i>
                        </div>
                    </div>
                    
                    <div class="input-group">
                        <label for="signup-password" class="block text-sm font-medium text-white">كلمة المرور</label>
                        <div class="mt-1 relative rounded-md shadow-sm">
                            <input type="password" id="signup-password" name="signup-password" required class="py-3 px-4 block w-full rounded-md border-gray-300 focus:border-blue-500 focus:ring-blue-500" placeholder="كلمة المرور (8 أحرف على الأقل)">
                            <i class="fas fa-lock"></i>
                        </div>
                    </div>
                    
                    <div class="input-group">
                        <label for="confirm-password" class="block text-sm font-medium text-white">تأكيد كلمة المرور</label>
                        <div class="mt-1 relative rounded-md shadow-sm">
                            <input type="password" id="confirm-password" name="confirm-password" required class="py-3 px-4 block w-full rounded-md border-gray-300 focus:border-blue-500 focus:ring-blue-500" placeholder="أعد إدخال كلمة المرور">
                            <i class="fas fa-lock"></i>
                        </div>
                    </div>
                    
                    <div class="input-group">
                        <label for="user-role" class="block text-sm font-medium text-white">الدور</label>
                        <div class="mt-1">
                            <select id="user-role" name="user-role" class="py-3 px-4 block w-full rounded-md border-gray-300 focus:border-blue-500 focus:ring-blue-500">
                                <option value="viewer">مشاهد فقط</option>
                                <option value="accountant">محاسب</option>
                                <option value="admin">مدير</option>
                            </select>
                        </div>
                    </div>
                    
                    <div class="flex items-center">
                        <input id="terms" name="terms" type="checkbox" class="h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300 rounded">
                        <label for="terms" class="mr-2 block text-sm text-white">أوافق على <a href="#" class="text-blue-200 hover:text-white">الشروط والأحكام</a></label>
                    </div>
                    
                    <div>
                        <button type="submit" class="w-full flex justify-center py-3 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500">
                            إنشاء الحساب
                        </button>
                    </div>
                </form>
                
                <div class="text-center mt-6 text-sm text-white">
                    لديك حساب بالفعل؟ <a href="#" id="show-login" class="font-medium text-blue-200 hover:text-white">سجل الدخول هنا</a>
                </div>
            </div>
        </div>
    </div>
    
    <!-- Forgot Password Page (Initially hidden) -->
    <div id="forgot-password-page" class="min-h-screen flex items-center justify-center login-container p-4 hidden">
        <div class="w-full max-w-md">
            <div class="login-card rounded-xl shadow-xl overflow-hidden p-8">
                <div class="text-center mb-8">
                    <div class="w-20 h-20 bg-white rounded-full flex items-center justify-center mx-auto mb-4">
                        <i class="fas fa-key text-blue-600 text-3xl"></i>
                    </div>
                    <h1 class="text-2xl font-bold text-white">إعادة تعيين كلمة المرور</h1>
                    <p class="text-blue-100 mt-2">أدخل بريدك الإلكتروني لإرسال رابط إعادة التعيين</p>
                </div>
                
                <form id="forgot-password-form" class="space-y-6">
                    <div class="input-group">
                        <label for="reset-email" class="block text-sm font-medium text-white">البريد الإلكتروني</label>
                        <div class="mt-1 relative rounded-md shadow-sm">
                            <input type="email" id="reset-email" name="reset-email" required class="py-3 px-4 block w-full rounded-md border-gray-300 focus:border-blue-500 focus:ring-blue-500" placeholder="أدخل بريدك الإلكتروني">
                            <i class="fas fa-envelope"></i>
                        </div>
                    </div>
                    
                    <div>
                        <button type="submit" class="w-full flex justify-center py-3 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500">
                            إرسال رابط التعيين
                        </button>
                    </div>
                </form>
                
                <div class="text-center mt-6 text-sm text-white">
                    تذكرت كلمة المرور؟ <a href="#" id="show-login-from-forgot" class="font-medium text-blue-200 hover:text-white">سجل الدخول هنا</a>
                </div>
            </div>
        </div>
    </div>
    
    <!-- Main App (Initially hidden) -->
    <div id="app-container" class="hidden">
        <!-- Main Container -->
        <div class="flex h-screen overflow-hidden">
            <!-- Sidebar -->
            <div class="sidebar bg-blue-800 text-white w-64 flex flex-col" id="sidebar">
                <!-- Logo -->
                <div class="p-4 flex items-center border-b border-blue-700">
                    <div class="bg-white p-2 rounded-lg">
                        <i class="fas fa-calculator text-blue-800 text-xl"></i>
                    </div>
                    <span class="logo-text mr-3 text-xl font-bold">نظام المحاسبة</span>
                </div>
                
                <!-- User Profile -->
                <div class="p-4 flex items-center border-b border-blue-700">
                    <div class="h-10 w-10 rounded-full bg-blue-600 flex items-center justify-center">
                        <i class="fas fa-user"></i>
                    </div>
                    <div class="mr-3 sidebar-text">
                        <div class="font-medium" id="current-user-name">أحمد محمد</div>
                        <div class="text-xs text-blue-200" id="current-user-role">مدير النظام</div>
                    </div>
                </div>
                
                <!-- Main Menu -->
                <div class="flex-1 overflow-y-auto">
                    <div class="p-2">
                        <div class="menu-item mb-1">
                            <a href="#" class="flex items-center p-3 rounded-lg hover:bg-blue-700 w-full" id="dashboard-link">
                                <i class="fas fa-tachometer-alt"></i>
                                <span class="sidebar-text mr-3">لوحة التحكم</span>
                            </a>
                        </div>
                        
                        <!-- Accounting Menu -->
                        <div class="mb-1">
                            <div class="menu-item">
                                <a href="#" class="flex items-center p-3 rounded-lg hover:bg-blue-700 w-full" id="accounting-toggle">
                                    <i class="fas fa-book"></i>
                                    <span class="sidebar-text mr-3">الحسابات</span>
                                    <i class="fas fa-chevron-down sidebar-text mr-auto text-xs"></i>
                                </a>
                            </div>
                            <div class="accounting-submenu hidden pl-4 mt-1">
                                <div class="menu-item mb-1">
                                    <a href="#" class="flex items-center p-2 rounded-lg hover:bg-blue-700 w-full" id="journal-link">
                                        <i class="fas fa-file-invoice"></i>
                                        <span class="sidebar-text mr-2">دفتر اليومية</span>
                                    </a>
                                </div>
                                <div class="menu-item mb-1">
                                    <a href="#" class="flex items-center p-2 rounded-lg hover:bg-blue-700 w-full" id="ledger-link">
                                        <i class="fas fa-book-open"></i>
                                        <span class="sidebar-text mr-2">دفتر الأستاذ</span>
                                    </a>
                                </div>
                                <div class="menu-item mb-1">
                                    <a href="#" class="flex items-center p-2 rounded-lg hover:bg-blue-700 w-full" id="trial-balance-link">
                                        <i class="fas fa-balance-scale"></i>
                                        <span class="sidebar-text mr-2">ميزان المراجعة</span>
                                    </a>
                                </div>
                            </div>
                        </div>
                        
                        <!-- Customers -->
                        <div class="menu-item mb-1">
                            <a href="#" class="flex items-center p-3 rounded-lg hover:bg-blue-700 w-full" id="customers-link">
                                <i class="fas fa-users"></i>
                                <span class="sidebar-text mr-3">العملاء</span>
                            </a>
                        </div>
                        
                        <!-- Suppliers -->
                        <div class="menu-item mb-1">
                            <a href="#" class="flex items-center p-3 rounded-lg hover:bg-blue-700 w-full" id="suppliers-link">
                                <i class="fas fa-truck"></i>
                                <span class="sidebar-text mr-3">الموردين</span>
                            </a>
                        </div>
                        
                        <!-- Invoices -->
                        <div class="mb-1">
                            <div class="menu-item">
                                <a href="#" class="flex items-center p-3 rounded-lg hover:bg-blue-700 w-full" id="invoices-toggle">
                                    <i class="fas fa-file-invoice-dollar"></i>
                                    <span class="sidebar-text mr-3">الفواتير</span>
                                    <i class="fas fa-chevron-down sidebar-text mr-auto text-xs"></i>
                                </a>
                            </div>
                            <div class="invoices-submenu hidden pl-4 mt-1">
                                <div class="menu-item mb-1">
                                    <a href="#" class="flex items-center p-2 rounded-lg hover:bg-blue-700 w-full" id="sales-invoices-link">
                                        <i class="fas fa-file-export"></i>
                                        <span class="sidebar-text mr-2">فواتير البيع</span>
                                    </a>
                                </div>
                                <div class="menu-item mb-1">
                                    <a href="#" class="flex items-center p-2 rounded-lg hover:bg-blue-700 w-full" id="purchase-invoices-link">
                                        <i class="fas fa-file-import"></i>
                                        <span class="sidebar-text mr-2">فواتير الشراء</span>
                                    </a>
                                </div>
                            </div>
                        </div>
                        
                        <!-- Payments -->
                        <div class="mb-1">
                            <div class="menu-item">
                                <a href="#" class="flex items-center p-3 rounded-lg hover:bg-blue-700 w-full" id="payments-toggle">
                                    <i class="fas fa-money-bill-wave"></i>
                                    <span class="sidebar-text mr-3">المدفوعات</span>
                                    <i class="fas fa-chevron-down sidebar-text mr-auto text-xs"></i>
                                </a>
                            </div>
                            <div class="payments-submenu hidden pl-4 mt-1">
                                <div class="menu-item mb-1">
                                    <a href="#" class="flex items-center p-2 rounded-lg hover:bg-blue-700 w-full" id="receivables-link">
                                        <i class="fas fa-hand-holding-usd"></i>
                                        <span class="sidebar-text mr-2">المقبوضات</span>
                                    </a>
                                </div>
                                <div class="menu-item mb-1">
                                    <a href="#" class="flex items-center p-2 rounded-lg hover:bg-blue-700 w-full" id="payables-link">
                                        <i class="fas fa-money-check-alt"></i>
                                        <span class="sidebar-text mr-2">المدفوعات</span>
                                    </a>
                                </div>
                            </div>
                        </div>
                        
                        <!-- Expenses -->
                        <div class="menu-item mb-1">
                            <a href="#" class="flex items-center p-3 rounded-lg hover:bg-blue-700 w-full" id="expenses-link">
                                <i class="fas fa-wallet"></i>
                                <span class="sidebar-text mr-3">المصاريف</span>
                            </a>
                        </div>
                        
                        <!-- Reports -->
                        <div class="mb-1">
                            <div class="menu-item">
                                <a href="#" class="flex items-center p-3 rounded-lg hover:bg-blue-700 w-full" id="reports-toggle">
                                    <i class="fas fa-chart-bar"></i>
                                    <span class="sidebar-text mr-3">التقارير</span>
                                    <i class="fas fa-chevron-down sidebar-text mr-auto text-xs"></i>
                                </a>
                            </div>
                            <div class="reports-submenu hidden pl-4 mt-1">
                                <div class="menu-item mb-1">
                                    <a href="#" class="flex items-center p-2 rounded-lg hover:bg-blue-700 w-full" id="balance-sheet-link">
                                        <i class="fas fa-file-alt"></i>
                                        <span class="sidebar-text mr-2">الميزانية</span>
                                    </a>
                                </div>
                                <div class="menu-item mb-1">
                                    <a href="#" class="flex items-center p-2 rounded-lg hover:bg-blue-700 w-full" id="profit-loss-link">
                                        <i class="fas fa-chart-line"></i>
                                        <span class="sidebar-text mr-2">قائمة الدخل</span>
                                    </a>
                                </div>
                                <div class="menu-item mb-1">
                                    <a href="#" class="flex items-center p-2 rounded-lg hover:bg-blue-700 w-full" id="cash-flow-link">
                                        <i class="fas fa-money-bill-alt"></i>
                                        <span class="sidebar-text mr-2">التدفق النقدي</span>
                                    </a>
                                </div>
                            </div>
                        </div>
                        
                        <!-- User Management (Admin only) -->
                        <div class="menu-item mb-1 admin-only hidden">
                            <a href="#" class="flex items-center p-3 rounded-lg hover:bg-blue-700 w-full" id="users-link">
                                <i class="fas fa-users-cog"></i>
                                <span class="sidebar-text mr-3">إدارة المستخدمين</span>
                            </a>
                        </div>
                        
                        <!-- Settings -->
                        <div class="menu-item mb-1">
                            <a href="#" class="flex items-center p-3 rounded-lg hover:bg-blue-700 w-full" id="settings-link">
                                <i class="fas fa-cog"></i>
                                <span class="sidebar-text mr-3">الإعدادات</span>
                            </a>
                        </div>
                    </div>
                </div>
                
                <!-- Collapse Button -->
                <div class="p-3 border-t border-blue-700">
                    <button class="flex items-center justify-center w-full p-2 rounded-lg hover:bg-blue-700" id="collapse-btn">
                        <i class="fas fa-chevron-right"></i>
                        <span class="sidebar-text mr-2">تصغير</span>
                    </button>
                </div>
            </div>
            
            <!-- Main Content Area -->
            <div class="content-area flex-1 flex flex-col overflow-hidden" id="content-area">
                <!-- Top Navigation -->
                <header class="bg-white shadow-sm py-3 px-6 flex items-center justify-between">
                    <div class="flex items-center">
                        <button class="mr-4 text-gray-600 hover:text-gray-900" id="mobile-menu-btn">
                            <i class="fas fa-bars"></i>
                        </button>
                        <h1 class="text-xl font-semibold text-gray-800" id="page-title">لوحة التحكم</h1>
                    </div>
                    
                    <div class="flex items-center space-x-4 rtl:space-x-reverse">
                        <!-- Language Switcher -->
                        <div class="language-switcher">
                            <button id="language-btn" class="flex items-center p-2 rounded-full hover:bg-gray-100">
                                <span class="font-medium" id="current-language">العربية</span>
                                <i class="fas fa-globe mr-2 ml-2"></i>
                            </button>
                        </div>
                        
                        <!-- Notifications -->
                        <div class="relative">
                            <button class="p-2 rounded-full hover:bg-gray-100 relative" id="notifications-btn">
                                <i class="fas fa-bell"></i>
                                <span class="absolute top-0 right-0 h-2 w-2 rounded-full bg-red-500"></span>
                            </button>
                            <div class="absolute hidden right-0 mt-2 w-80 bg-white rounded-md shadow-lg py-1 z-50" id="notifications-dropdown">
                                <div class="px-4 py-2 border-b">
                                    <h3 class="font-medium">الإشعارات</h3>
                                </div>
                                <div class="max-h-60 overflow-y-auto">
                                    <a href="#" class="block px-4 py-2 hover:bg-gray-100 border-b">
                                        <div class="flex items-start">
                                            <div class="bg-blue-100 p-2 rounded-full mr-2">
                                                <i class="fas fa-file-invoice text-blue-600"></i>
                                            </div>
                                            <div>
                                                <p class="font-medium">فاتورة جديدة #1254</p>
                                                <p class="text-sm text-gray-500">من عميل: شركة التقنية</p>
                                                <p class="text-xs text-gray-400">منذ ساعتين</p>
                                            </div>
                                        </div>
                                    </a>
                                    <a href="#" class="block px-4 py-2 hover:bg-gray-100 border-b">
                                        <div class="flex items-start">
                                            <div class="bg-green-100 p-2 rounded-full mr-2">
                                                <i class="fas fa-money-bill-wave text-green-600"></i>
                                            </div>
                                            <div>
                                                <p class="font-medium">دفعة مستلمة #458</p>
                                                <p class="text-sm text-gray-500">من عميل: مؤسسة النور</p>
                                                <p class="text-xs text-gray-400">منذ 5 ساعات</p>
                                            </div>
                                        </div>
                                    </a>
                                    <a href="#" class="block px-4 py-2 hover:bg-gray-100">
                                        <div class="flex items-start">
                                            <div class="bg-yellow-100 p-2 rounded-full mr-2">
                                                <i class="fas fa-exclamation-triangle text-yellow-600"></i>
                                            </div>
                                            <div>
                                                <p class="font-medium">فاتورة متأخرة #1123</p>
                                                <p class="text-sm text-gray-500">من عميل: شركة الأصيل</p>
                                                <p class="text-xs text-gray-400">منذ يوم</p>
                                            </div>
                                        </div>
                                    </a>
                                </div>
                                <div class="px-4 py-2 border-t text-center">
                                    <a href="#" class="text-blue-600 text-sm font-medium">عرض جميع الإشعارات</a>
                                </div>
                            </div>
                        </div>
                        
                        <!-- User Dropdown -->
                        <div class="relative">
                            <button class="flex items-center space-x-2 rtl:space-x-reverse focus:outline-none" id="user-menu-btn">
                                <div class="h-8 w-8 rounded-full bg-blue-600 flex items-center justify-center text-white">
                                    <i class="fas fa-user"></i>
                                </div>
                                <span class="hidden md:inline-block font-medium" id="top-user-name">أحمد محمد</span>
                                <i class="fas fa-chevron-down text-xs"></i>
                            </button>
                            <div class="absolute hidden right-0 mt-2 w-48 bg-white rounded-md shadow-lg py-1 z-50" id="user-dropdown">
                                <a href="#" class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100" id="profile-link">الملف الشخصي</a>
                                <a href="#" class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100" id="settings-link-top">الإعدادات</a>
                                <div class="border-t"></div>
                                <a href="#" class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100" id="logout-link">تسجيل الخروج</a>
                            </div>
                        </div>
                    </div>
                </header>
                
                <!-- Main Content -->
                <main class="flex-1 overflow-y-auto p-6 bg-gray-50" id="main-content">
                    <!-- Dashboard Content -->
                    <div id="dashboard-content">
                        <!-- Stats Cards -->
                        <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-6">
                            <div class="dashboard-card bg-white p-6 rounded-lg shadow-sm border-l-4 border-blue-500 transition duration-300">
                                <div class="flex items-center justify-between">
                                    <div>
                                        <p class="text-gray-500">إجمالي الإيرادات</p>
                                        <h3 class="text-2xl font-bold mt-1">25,840 <span class="text-sm">ر.س</span></h3>
                                    </div>
                                    <div class="bg-blue-100 p-3 rounded-full">
                                        <i class="fas fa-money-bill-wave text-blue-600 text-xl"></i>
                                    </div>
                                </div>
                                <div class="mt-4">
                                    <span class="text-green-500 text-sm font-medium"><i class="fas fa-arrow-up"></i> 12% عن الشهر الماضي</span>
                                </div>
                            </div>
                            
                            <div class="dashboard-card bg-white p-6 rounded-lg shadow-sm border-l-4 border-green-500 transition duration-300">
                                <div class="flex items-center justify-between">
                                    <div>
                                        <p class="text-gray-500">إجمالي المصروفات</p>
                                        <h3 class="text-2xl font-bold mt-1">18,450 <span class="text-sm">ر.س</span></h3>
                                    </div>
                                    <div class="bg-green-100 p-3 rounded-full">
                                        <i class="fas fa-wallet text-green-600 text-xl"></i>
                                    </div>
                                </div>
                                <div class="mt-4">
                                    <span class="text-red-500 text-sm font-medium"><i class="fas fa-arrow-down"></i> 5% عن الشهر الماضي</span>
                                </div>
                            </div>
                            
                            <div class="dashboard-card bg-white p-6 rounded-lg shadow-sm border-l-4 border-purple-500 transition duration-300">
                                <div class="flex items-center justify-between">
                                    <div>
                                        <p class="text-gray-500">إجمالي الفواتير</p>
                                        <h3 class="text-2xl font-bold mt-1">124</h3>
                                    </div>
                                    <div class="bg-purple-100 p-3 rounded-full">
                                        <i class="fas fa-file-invoice text-purple-600 text-xl"></i>
                                    </div>
                                </div>
                                <div class="mt-4">
                                    <span class="text-green-500 text-sm font-medium"><i class="fas fa-arrow-up"></i> 8% عن الشهر الماضي</span>
                                </div>
                            </div>
                            
                            <div class="dashboard-card bg-white p-6 rounded-lg shadow-sm border-l-4 border-yellow-500 transition duration-300">
                                <div class="flex items-center justify-between">
                                    <div>
                                        <p class="text-gray-500">العملاء النشطين</p>
                                        <h3 class="text-2xl font-bold mt-1">42</h3>
                                    </div>
                                    <div class="bg-yellow-100 p-3 rounded-full">
                                        <i class="fas fa-users text-yellow-600 text-xl"></i>
                                    </div>
                                </div>
                                <div class="mt-4">
                                    <span class="text-green-500 text-sm font-medium"><i class="fas fa-arrow-up"></i> 15% عن الشهر الماضي</span>
                                </div>
                            </div>
                        </div>
                        
                        <!-- Charts Row -->
                        <div class="grid grid-cols-1 lg:grid-cols-2 gap-6 mb-6">
                            <!-- Revenue Chart -->
                            <div class="bg-white p-6 rounded-lg shadow-sm">
                                <div class="flex items-center justify-between mb-4">
                                    <h2 class="text-lg font-semibold">الإيرادات والمصروفات</h2>
                                    <div class="flex space-x-2 rtl:space-x-reverse">
                                        <button class="px-3 py-1 text-sm bg-blue-100 text-blue-700 rounded-md">شهري</button>
                                        <button class="px-3 py-1 text-sm bg-gray-100 text-gray-700 rounded-md">سنوي</button>
                                    </div>
                                </div>
                                <div class="h-64">
                                    <canvas id="revenue-chart"></canvas>
                                </div>
                            </div>
                            
                            <!-- Invoice Status Chart -->
                            <div class="bg-white p-6 rounded-lg shadow-sm">
                                <div class="flex items-center justify-between mb-4">
                                    <h2 class="text-lg font-semibold">حالة الفواتير</h2>
                                    <div class="flex space-x-2 rtl:space-x-reverse">
                                        <button class="px-3 py-1 text-sm bg-blue-100 text-blue-700 rounded-md">هذا الشهر</button>
                                        <button class="px-3 py-1 text-sm bg-gray-100 text-gray-700 rounded-md">الكل</button>
                                    </div>
                                </div>
                                <div class="h-64">
                                    <canvas id="invoice-status-chart"></canvas>
                                </div>
                            </div>
                        </div>
                        
                        <!-- Recent Transactions -->
                        <div class="bg-white p-6 rounded-lg shadow-sm mb-6">
                            <div class="flex items-center justify-between mb-4">
                                <h2 class="text-lg font-semibold">آخر العمليات</h2>
                                <a href="#" class="text-blue-600 text-sm font-medium">عرض الكل</a>
                            </div>
                            <div class="overflow-x-auto">
                                <table class="min-w-full divide-y divide-gray-200">
                                    <thead class="bg-gray-50">
                                        <tr>
                                            <th class="px-6 py-3 text-right text-xs font-medium text-gray-500 uppercase tracking-wider">رقم العملية</th>
                                            <th class="px-6 py-3 text-right text-xs font-medium text-gray-500 uppercase tracking-wider">التاريخ</th>
                                            <th class="px-6 py-3 text-right text-xs font-medium text-gray-500 uppercase tracking-wider">الوصف</th>
                                            <th class="px-6 py-3 text-right text-xs font-medium text-gray-500 uppercase tracking-wider">المبلغ</th>
                                            <th class="px-6 py-3 text-right text-xs font-medium text-gray-500 uppercase tracking-wider">الحالة</th>
                                            <th class="px-6 py-3 text-right text-xs font-medium text-gray-500 uppercase tracking-wider">الإجراءات</th>
                                        </tr>
                                    </thead>
                                    <tbody class="bg-white divide-y divide-gray-200">
                                        <tr>
                                            <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">#1254</td>
                                            <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">2023-06-15</td>
                                            <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">فاتورة بيع لشركة التقنية</td>
                                            <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">5,250 ر.س</td>
                                            <td class="px-6 py-4 whitespace-nowrap">
                                                <span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-green-100 text-green-800">مدفوعة</span>
                                            </td>
                                            <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
                                                <button class="text-blue-600 hover:text-blue-900 mr-2"><i class="fas fa-eye"></i></button>
                                                <button class="text-gray-600 hover:text-gray-900"><i class="fas fa-print"></i></button>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">#1253</td>
                                            <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">2023-06-14</td>
                                            <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">فاتورة شراء من مورد الأجهزة</td>
                                            <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">8,700 ر.س</td>
                                            <td class="px-6 py-4 whitespace-nowrap">
                                                <span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-yellow-100 text-yellow-800">قيد الانتظار</span>
                                            </td>
                                            <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
                                                <button class="text-blue-600 hover:text-blue-900 mr-2"><i class="fas fa-eye"></i></button>
                                                <button class="text-gray-600 hover:text-gray-900"><i class="fas fa-print"></i></button>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">#1252</td>
                                            <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">2023-06-13</td>
                                            <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">دفعة من عميل مؤسسة النور</td>
                                            <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">3,500 ر.س</td>
                                            <td class="px-6 py-4 whitespace-nowrap">
                                                <span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-green-100 text-green-800">مكتملة</span>
                                            </td>
                                            <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
                                                <button class="text-blue-600 hover:text-blue-900 mr-2"><i class="fas fa-eye"></i></button>
                                                <button class="text-gray-6
</html>