File size: 18,126 Bytes
4cdb812
 
e400142
 
 
5fe1171
5b2221a
e400142
edb4daf
 
 
 
5fe1171
edb4daf
27ea40c
edb4daf
52cf91c
edb4daf
 
 
5b2221a
52cf91c
d310f43
c451747
5b2221a
 
edb4daf
27ea40c
d310f43
 
6a0cba9
27ea40c
 
 
 
edb4daf
27ea40c
 
c451747
27ea40c
 
 
 
1256ee0
27ea40c
edb4daf
27ea40c
 
d310f43
6a0cba9
d310f43
c451747
d310f43
6a0cba9
d310f43
 
1256ee0
27ea40c
 
 
d310f43
27ea40c
 
edb4daf
 
d310f43
 
c451747
27ea40c
5b2221a
d310f43
5b2221a
 
 
 
 
 
 
 
c451747
 
5f3fe0a
c451747
edb4daf
27ea40c
edb4daf
d310f43
27ea40c
edb4daf
27ea40c
d310f43
edb4daf
d310f43
 
 
 
27ea40c
d310f43
52cf91c
0179319
27ea40c
d310f43
5f3fe0a
d310f43
 
0179319
d310f43
edb4daf
27ea40c
edb4daf
 
c451747
5f3fe0a
edb4daf
d310f43
5f3fe0a
27ea40c
52cf91c
edb4daf
27ea40c
d310f43
536f521
d310f43
5b2221a
 
d310f43
 
 
27ea40c
 
 
 
5f3fe0a
 
d310f43
27ea40c
 
 
d310f43
 
 
5f3fe0a
 
6a0cba9
 
5f3fe0a
d310f43
 
536f521
d310f43
 
c451747
 
6a0cba9
d310f43
6a0cba9
 
d310f43
 
 
 
c451747
 
d310f43
 
 
 
36cd920
 
d310f43
 
 
 
 
 
36cd920
 
d310f43
 
 
 
 
36cd920
 
d310f43
 
5f3fe0a
 
d310f43
5f3fe0a
 
d310f43
5f3fe0a
d310f43
5f3fe0a
d310f43
5f3fe0a
 
 
d310f43
 
 
 
 
 
 
5f3fe0a
36cd920
d310f43
 
 
36cd920
5f3fe0a
d310f43
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e400142
 
4cdb812
5f3fe0a
 
 
d310f43
 
 
 
 
 
 
 
 
 
 
5f3fe0a
 
 
 
d310f43
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5f3fe0a
 
 
 
 
 
d310f43
 
 
 
 
 
5f3fe0a
d310f43
 
 
 
 
5f3fe0a
d310f43
 
 
 
703fa51
d310f43
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
703fa51
36cd920
d310f43
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36cd920
d310f43
 
 
5f3fe0a
d310f43
 
 
 
 
 
 
5f3fe0a
d310f43
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9041272
 
 
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
<!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>
    <link href="https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700&family=Tajawal:wght@400;500;700&display=swap" rel="stylesheet">
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Cairo', 'Tajawal', sans-serif;
        }

        body {
            min-height: 100vh;
            display: flex;
            align-items: center;
            justify-content: center;
            position: relative;
            padding: 20px;
            background: linear-gradient(135deg, #f6f8fc 0%, #e9ecef 100%);
            color: #333;
        }

        .container {
            position: relative;
            width: 420px;
            min-height: 480px;
            perspective: 1000px;
        }

        .forms-container {
            position: relative;
            width: 100%;
            height: 100%;
            transform-style: preserve-3d;
            transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
        }

        .forms-container.flipped {
            transform: rotateY(180deg);
        }

        .form-box {
            position: absolute;
            width: 100%;
            height: 100%;
            padding: 40px;
            background: rgba(255, 255, 255, 0.98);
            border-radius: 24px;
            box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
            backface-visibility: hidden;
            border: 1px solid rgba(200, 200, 200, 0.3);
            backdrop-filter: blur(10px);
        }

        .register-form {
            transform: rotateY(180deg);
            height: auto;
        }

        h2 {
            text-align: center;
            color: #1a1a1a;
            margin-bottom: 35px;
            font-size: 32px;
            font-weight: 700;
            position: relative;
            padding-bottom: 18px;
        }

        h2::after {
            content: '';
            position: absolute;
            bottom: 0;
            left: 50%;
            transform: translateX(-50%);
            width: 80px;
            height: 4px;
            background: linear-gradient(90deg, #DAA520, #FFD700);
            border-radius: 4px;
        }

        .input-group {
            margin-bottom: 24px;
            position: relative;
        }

        input {
            width: 100%;
            padding: 16px 22px;
            border: 2px solid rgba(218, 165, 32, 0.25);
            border-radius: 16px;
            font-size: 16px;
            transition: all 0.3s ease;
            background: rgba(255, 255, 255, 0.9);
            color: #333;
        }

        input:focus {
            border-color: #DAA520;
            background: white;
            box-shadow: 0 0 25px rgba(218, 165, 32, 0.2);
            outline: none;
            transform: translateY(-2px);
        }

        button {
            width: 100%;
            padding: 16px;
            background: linear-gradient(135deg, #DAA520 0%, #FFD700 100%);
            border: none;
            border-radius: 16px;
            color: #000;
            font-size: 18px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s ease;
            margin-bottom: 22px;
            position: relative;
            overflow: hidden;
        }

        button:hover {
            transform: translateY(-3px);
            box-shadow: 0 8px 25px rgba(218, 165, 32, 0.3);
        }

        .toggle-btn {
            background: transparent;
            color: #DAA520;
            border: 2px solid #DAA520;
            font-weight: 500;
        }

        .toggle-btn:hover {
            background: rgba(218, 165, 32, 0.1);
            color: #DAA520;
            transform: translateY(-2px);
        }

        .message {
            margin-top: 15px;
            text-align: center;
            padding: 14px;
            border-radius: 14px;
            font-size: 14px;
            opacity: 0;
            transition: opacity 0.3s ease;
        }

        .message.show {
            opacity: 1;
        }

        .error {
            color: #D32F2F;
            background-color: rgba(255, 235, 238, 0.95);
            border: 1px solid #FFCDD2;
        }

        .success {
            color: #388E3C;
            background-color: rgba(232, 245, 233, 0.95);
            border: 1px solid #C8E6C9;
        }

        .terms {
            text-align: center;
            font-size: 14px;
            margin-top: 20px;
            color: #666;
            line-height: 1.6;
        }

        .terms a {
            color: #DAA520;
            text-decoration: none;
            font-weight: 500;
            transition: color 0.3s ease;
        }

        .terms a:hover {
            color: #FFD700;
        }

        @media (max-width: 480px) {
            .container {
                width: 100%;
                max-width: 380px;
            }

            .form-box {
                padding: 30px 25px;
            }

            h2 {
                font-size: 28px;
                margin-bottom: 25px;
            }

            input {
                padding: 14px 20px;
                font-size: 15px;
            }

            button {
                padding: 14px;
                font-size: 16px;
            }
        }

        /* إضافة تأثيرات حركية */
        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(20px); }
            to { opacity: 1; transform: translateY(0); }
        }

        .form-box {
            animation: fadeIn 0.6s ease-out;
        }

        input::placeholder {
            color: #999;
            transition: color 0.3s ease;
        }

        input:focus::placeholder {
            color: #DAA520;
        }

        /* تحسين تأثيرات التحميل */
        button.loading {
            position: relative;
            pointer-events: none;
        }

        button.loading::after {
            content: '';
            position: absolute;
            width: 20px;
            height: 20px;
            top: 50%;
            left: 50%;
            margin: -10px 0 0 -10px;
            border: 2px solid rgba(0, 0, 0, 0.1);
            border-left-color: #000;
            border-radius: 50%;
            animation: spin 1s linear infinite;
        }

        @keyframes spin {
            to { transform: rotate(360deg); }
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="forms-container">
            <div class="form-box login-form">
                <h2>مرحباً بعودتك</h2>
                <div class="input-group">
                    <input type="text" id="loginUsername" placeholder="البريد الإلكتروني">
                </div>
                <div class="input-group">
                    <input type="password" id="loginPassword" placeholder="كلمة المرور">
                </div>
                <button onclick="login()">تسجيل الدخول</button>
                <div id="loginMessage" class="message"></div>
                <div class="toggle-form">
                    <button class="toggle-btn" onclick="toggleForm()">إنشاء حساب جديد</button>
                </div>
            </div>

            <div class="form-box register-form">
                <h2>حساب جديد</h2>
                <div class="input-group">
                    <input type="text" id="registerLawFirm" placeholder="اسم المكتب">
                </div>
                <div class="input-group">
                    <input type="text" id="registerLawyerName" placeholder="اسم المحامي">
                </div>
                <div class="input-group">
                    <input type="text" id="registerPosition" placeholder="المرتبة في المكتب">
                </div>
                <div class="input-group">
                    <input type="tel" id="registerPhone" placeholder="رقم الهاتف">
                </div>
                <div class="input-group">
                    <input type="text" id="registerUsername" placeholder="البريد الإلكتروني">
                </div>
                <div class="input-group">
                    <input type="password" id="registerPassword" placeholder="كلمة المرور">
                </div>
                <button onclick="register()">إنشاء الحساب</button>
                <div id="registerMessage" class="message"></div>
                <div class="toggle-form">
                    <button class="toggle-btn" onclick="toggleForm()">العودة لتسجيل الدخول</button>
                </div>
                <div class="terms">
                    بالتسجيل، أنت توافق على <a href="https://ufastpro.com/%d8%b3%d9%8a%d8%a7%d8%b3%d8%a9-%d8%a7%d9%84%d8%a7%d8%b3%d8%aa%d8%ae%d8%af%d8%a7%d9%85/" target="_blank">سياسة الاستخدام</a> و<a href="https://ufastpro.com/%d8%b3%d9%8a%d8%a7%d8%b3%d8%a9-%d8%a7%d9%84%d8%ae%d8%b5%d9%88%d8%b5%d9%8a%d8%a9/" target="_blank">سياسة الخصوصية</a>
                </div>
            </div>
        </div>
    </div>

    <script>
        const API_URL = 'https://j8fp9mu44k547j-7777.proxy.runpod.net/proxy/6500/api';
        
        function toggleForm() {
            document.querySelector('.forms-container').classList.toggle('flipped');
            clearMessages();
        }

        function clearMessages() {
            document.querySelectorAll('.message').forEach(msg => {
                msg.className = 'message';
            });
        }

        function showMessage(elementId, message, isError = false) {
            const element = document.getElementById(elementId);
            element.textContent = message;
            element.className = `message ${isError ? 'error' : 'success'} show`;
            setTimeout(() => {
                element.className = 'message';
            }, 3000);
        }

        async function login() {
            const username = document.getElementById('loginUsername').value;
            const password = document.getElementById('loginPassword').value;
            
            if (!username || !password) {
                showMessage('loginMessage', 'الرجاء إدخال جميع البيانات المطلوبة', true);
                return;
            }

            if (!isValidEmail(username)) {
                showMessage('loginMessage', 'الرجاء إدخال بريد إلكتروني صحيح', true);
                return;
            }

            try {
                const response = await fetch(`${API_URL}/login`, {
                    method: 'POST',
                    headers: {
                        'Content-Type': 'application/json'
                    },
                    body: JSON.stringify({ username, password })
                });
                
                const data = await response.json();
                
                if (response.ok) {
                    showMessage('loginMessage', 'تم تسجيل الدخول بنجاح');
                    setTimeout(() => {
                        window.location.href = data.redirect_url;
                    }, 1000);
                } else {
                    showMessage('loginMessage', data.detail, true);
                }
            } catch (error) {
                showMessage('loginMessage', 'حدث خطأ في الاتصال', true);
            }
        }

        async function register() {
            const lawFirm = document.getElementById('registerLawFirm').value;
            const lawyerName = document.getElementById('registerLawyerName').value;
            const position = document.getElementById('registerPosition').value;
            const phone = document.getElementById('registerPhone').value;
            const username = document.getElementById('registerUsername').value;
            const password = document.getElementById('registerPassword').value;
            
            if (!lawFirm || !lawyerName || !position || !phone || !username || !password) {
                showMessage('registerMessage', 'الرجاء إدخال جميع البيانات المطلوبة', true);
                return;
            }

            if (!isValidEmail(username)) {
                showMessage('registerMessage', 'الرجاء إدخال بريد إلكتروني صحيح', true);
                return;
            }

            if (!isValidPhone(phone)) {
                showMessage('registerMessage', 'الرجاء إدخال رقم هاتف صحيح', true);
                return;
            }

            if (password.length < 8) {
                showMessage('registerMessage', 'كلمة المرور يجب أن تكون 8 أحرف على الأقل', true);
                return;
            }

            try {
                const response = await fetch(`${API_URL}/register`, {
                    method: 'POST',
                    headers: {
                        'Content-Type': 'application/json'
                    },
                    body: JSON.stringify({ 
                        username, 
                        password,
                        law_firm: lawFirm,
                        lawyer_name: lawyerName,
                        position: position,
                        phone: phone
                    })
                });
                
                const data = await response.json();
                
                if (response.ok) {
                    showMessage('registerMessage', 'تم إنشاء الحساب بنجاح');
                    document.getElementById('registerLawFirm').value = '';
                    document.getElementById('registerLawyerName').value = '';
                    document.getElementById('registerPosition').value = '';
                    document.getElementById('registerPhone').value = '';
                    document.getElementById('registerUsername').value = '';
                    document.getElementById('registerPassword').value = '';
                    setTimeout(() => {
                        toggleForm();
                    }, 1500);
                } else {
                    showMessage('registerMessage', data.detail, true);
                }
            } catch (error) {
                showMessage('registerMessage', 'حدث خطأ في الاتصال', true);
            }
        }

        function isValidEmail(email) {
            return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email);
        }

        function isValidPhone(phone) {
            return /^(\+966|05)\d{8,9}$/.test(phone);
        }

        // تحسين تجربة المستخدم مع استجابة زر Enter
        document.querySelectorAll('input').forEach(input => {
            input.addEventListener('keypress', (e) => {
                if (e.key === 'Enter') {
                    const form = input.closest('.form-box');
                    if (form.classList.contains('login-form')) {
                        login();
                    } else {
                        register();
                    }
                }
            });
        });

        // تأثيرات تحميل الأزرار
        document.querySelectorAll('button:not(.toggle-btn)').forEach(button => {
            button.addEventListener('click', function() {
                if (this.classList.contains('loading')) return;
                
                this.classList.add('loading');
                const originalText = this.textContent;
                this.textContent = '...جاري التنفيذ';
                
                setTimeout(() => {
                    this.textContent = originalText;
                    this.classList.remove('loading');
                }, 2000);
            });
        });

        // التحقق من صحة رقم الهاتف المصري
        function isValidPhone(phone) {
            const egyptianPattern = /^(010|011|012|015)\d{8}$/;
            return egyptianPattern.test(phone);
        }

        // تنسيق رقم الهاتف تلقائيًا
        document.getElementById('registerPhone').addEventListener('input', function (e) {
            let value = e.target.value.replace(/\D/g, ''); // إزالة أي أحرف غير رقمية
            
            if (value.startsWith('20')) {
                // إذا بدأ بـ 20، نضيف +20
                value = '+' + value;
            } else if (value.startsWith('1')) {
                // إذا بدأ بـ 1، نضيف 0
                value = '0' + value;
            }
            
            e.target.value = value;
        });

        // تفعيل تأثيرات الظهور التدريجي
        document.addEventListener('DOMContentLoaded', function () {
            document.body.style.opacity = '0';
            requestAnimationFrame(() => {
                document.body.style.opacity = '1';
            });
        });

        // تحسين تجربة المستخدم في حقول الإدخال
        document.querySelectorAll('input').forEach(input => {
            input.addEventListener('focus', () => {
                input.parentElement.classList.add('focused'); // إضافة تأثير عند التركيز
            });

            input.addEventListener('blur', () => {
                if (!input.value) {
                    input.parentElement.classList.remove('focused'); // إزالة التأثير إذا كان الحقل فارغًا
                }
            });
        });

        // منع الأحداث الافتراضية غير المرغوب فيها على الأزرار
        document.querySelectorAll('button').forEach(button => {
            button.addEventListener('mousedown', (e) => e.preventDefault());
        });
    </script>
</body>
</html>