joermd commited on
Commit
454e2e1
·
verified ·
1 Parent(s): 3961909

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +737 -487
index.html CHANGED
@@ -1,511 +1,761 @@
1
  <!DOCTYPE html>
2
  <html dir="rtl" lang="ar">
3
  <head>
4
- <meta charset="UTF-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>المنصة القانونية المتكاملة</title>
7
- <link href="https://cdnjs.cloudflare.com/ajax/libs/tailwindcss/2.2.19/tailwind.min.css" rel="stylesheet">
8
- <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
9
- <style>
10
- @import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700&display=swap');
11
-
12
- body {
13
- font-family: 'Tajawal', sans-serif;
14
- background: linear-gradient(135deg, #f0f2f5 0%, #e5e7eb 100%);
15
- }
16
-
17
- .premium-gradient {
18
- background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
19
- }
20
-
21
- .gold-accent {
22
- color: #fbbf24;
23
- }
24
-
25
- .feature-card {
26
- transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
27
- border: 1px solid rgba(229, 231, 235, 0.5);
28
- background: rgba(255, 255, 255, 0.9);
29
- backdrop-filter: blur(10px);
30
- }
31
-
32
- .feature-card:hover {
33
- transform: translateY(-5px);
34
- box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
35
- border-color: #fbbf24;
36
- }
37
-
38
- .premium-button {
39
- background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
40
- transition: all 0.3s ease;
41
- }
42
-
43
- .premium-button:hover {
44
- transform: translateY(-2px);
45
- box-shadow: 0 5px 15px rgba(251, 191, 36, 0.4);
46
- }
47
-
48
- .custom-scroll::-webkit-scrollbar {
49
- width: 6px;
50
- }
51
-
52
- .custom-scroll::-webkit-scrollbar-track {
53
- background: #f1f1f1;
54
- border-radius: 3px;
55
- }
56
-
57
- .custom-scroll::-webkit-scrollbar-thumb {
58
- background: #fbbf24;
59
- border-radius: 3px;
60
- }
61
-
62
- .search-container {
63
- background: rgba(255, 255, 255, 0.95);
64
- backdrop-filter: blur(10px);
65
- }
66
-
67
- .logo-img {
68
- max-height: 60px;
69
- width: auto;
70
- filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
71
- }
72
-
73
- .modal-container {
74
- backdrop-filter: blur(5px);
75
- }
76
-
77
- .modal-content {
78
- background: rgba(255, 255, 255, 0.98);
79
- }
80
- </style>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
81
  </head>
82
- <body class="min-h-screen">
83
- <!-- الهيدر -->
84
- <header class="premium-gradient text-white shadow-lg">
85
- <div class="container mx-auto px-6 py-4">
86
- <nav class="flex justify-between items-center">
87
- <div class="flex items-center gap-4">
88
- <img src="https://ufastpro.com/wp-content/uploads/2025/01/مستشارك__3_-removebg-preview.png" alt="شعار المنصة" class="logo-img">
89
- <div>
90
- <h1 class="text-2xl font-bold"></h1>
91
- <p class="text-sm text-gray-300"></p>
92
- </div>
93
- </div>
94
- <div class="flex gap-6 items-center">
95
- <a href="https://ufastpro.com/speedy-chat/" class="text-white hover:text-yellow-300 transition-colors">اتكلم مع سبيدي</a>
96
- <button onclick="showLegalChat()" class="premium-button text-gray-900 px-6 py-2 rounded-lg font-bold hover:shadow-xl">
97
- اسأل سؤال قانوني
98
- </button>
99
- </div>
100
- </nav>
101
- </div>
102
- </header>
103
-
104
- <main class="container mx-auto px-6 py-12">
105
- <!-- قسم البحث الرئيسي -->
106
- <div class="search-container rounded-3xl shadow-2xl p-8 mb-12 border-t-4 border-yellow-400">
107
- <div class="max-w-3xl mx-auto">
108
- <h2 class="text-3xl font-bold text-center mb-8 text-gray-800">البحث في التشريعات والأحكام القضائية</h2>
109
- <div class="flex gap-4">
110
- <div class="flex-grow relative">
111
- <i class="fas fa-search absolute right-4 top-4 text-gray-400"></i>
112
- <input type="text"
113
- id="searchInput"
114
- class="w-full p-4 pr-12 border-2 border-gray-200 rounded-xl focus:border-yellow-400 focus:ring-2 focus:ring-yellow-400 focus:ring-opacity-50 outline-none transition-all"
115
- placeholder="ابحث في القوانين، الأحكام، والمواد القانونية...">
116
- </div>
117
- <button onclick="handleSearch()" class="premium-button px-8 py-3 rounded-xl font-bold flex items-center gap-2">
118
- <i class="fas fa-search"></i>
119
- بحث
120
- </button>
121
- </div>
122
- <div id="searchResults" class="mt-4 custom-scroll max-h-96"></div>
123
- </div>
124
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
125
 
126
- <!-- الخدمات الرئيسية -->
127
- <div class="grid md:grid-cols-2 lg:grid-cols-3 gap-8">
128
- <!-- تحليل القضايا -->
129
- <div class="feature-card rounded-2xl p-8">
130
- <div class="flex items-center gap-4 mb-6">
131
- <div class="w-12 h-12 rounded-full premium-gradient flex items-center justify-center">
132
- <i class="fas fa-gavel gold-accent text-xl"></i>
133
- </div>
134
- <h3 class="text-xl font-bold">تحليل القضايا</h3>
135
- </div>
136
- <p class="text-gray-600 mb-6 leading-relaxed">تحليل متقدم للقضايا باستخدام أحدث التقنيات والذكاء الاصطناعي مع مراعاة القوانين المصرية</p>
137
- <button onclick="showCaseAnalysis()" class="w-full premium-button py-3 rounded-xl font-bold text-gray-900">
138
- تحليل قضية جديدة
139
- </button>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
140
  </div>
141
-
142
- <!-- اسأل الموضوع -->
143
- <div class="feature-card rounded-2xl p-8">
144
- <div class="flex items-center gap-4 mb-6">
145
- <div class="w-12 h-12 rounded-full premium-gradient flex items-center justify-center">
146
- <i class="fas fa-comments gold-accent text-xl"></i>
147
- </div>
148
- <h3 class="text-xl font-bold">اسأل الموضوع</h3>
149
- </div>
150
- <p class="text-gray-600 mb-6 leading-relaxed">اطرح سؤالك حول أي موضوع قانوني وسنقوم بتحليله والإجابة عليه بدقة</p>
151
- <button onclick="showAskTopic()" class="w-full premium-button py-3 rounded-xl font-bold text-gray-900">
152
- اطرح سؤالك
153
- </button>
154
  </div>
155
-
156
- <!-- كتابة العقود -->
157
- <div class="feature-card rounded-2xl p-8">
158
- <div class="flex items-center gap-4 mb-6">
159
- <div class="w-12 h-12 rounded-full premium-gradient flex items-center justify-center">
160
- <i class="fas fa-file-contract gold-accent text-xl"></i>
161
- </div>
162
- <h3 class="text-xl font-bold">كتابة العقود والوثائق</h3>
163
- </div>
164
- <p class="text-gray-600 mb-6 leading-relaxed">كتابة العقود والمواثيق والاوراق الهامة اصبح سهل الان مع سبيدي</p>
165
- <a href="https://ufastpro.com/okod/" class="block w-full premium-button py-3 rounded-xl font-bold text-center text-gray-900">
166
- خلي سبيدي يكتبلك وثيقتك او عقدك
167
- </a>
168
  </div>
169
- </div>
170
- </main>
171
-
172
- <!-- نافذة الدردشة القانونية -->
173
- <div id="legalChatModal" class="hidden fixed inset-0 bg-black bg-opacity-30 modal-container flex items-center justify-center z-50">
174
- <div class="modal-content rounded-2xl p-8 w-full max-w-2xl mx-4">
175
- <div class="flex justify-between items-center mb-6">
176
- <h3 class="text-2xl font-bold text-gray-800">اسأل سؤال قانوني</h3>
177
- <button onclick="hideLegalChat()" class="text-gray-500 hover:text-gray-700">
178
- <i class="fas fa-times text-xl"></i>
179
- </button>
180
  </div>
181
- <div class="h-96 overflow-y-auto mb-4 p-4 border-2 rounded-xl custom-scroll" id="chatMessages">
182
- <!-- الرسائل ستظهر هنا -->
 
183
  </div>
184
- <div class="flex gap-2">
185
- <input type="text"
186
- id="chatInput"
187
- class="flex-grow p-3 border-2 rounded-xl focus:border-yellow-400 focus:ring-2 focus:ring-yellow-400 focus:ring-opacity-50 outline-none"
188
- placeholder="اكتب سؤالك هنا...">
189
- <button onclick="sendMessage()" class="premium-button px-6 py-2 rounded-xl font-bold">
190
- إرسال
191
- </button>
192
  </div>
193
- </div>
194
- </div>
195
-
196
- <!-- نافذة تحليل القضايا -->
197
- <div id="caseAnalysisModal" class="hidden fixed inset-0 bg-black bg-opacity-30 modal-container flex items-center justify-center z-50">
198
- <div class="modal-content rounded-2xl p-8 w-full max-w-2xl mx-4">
199
- <div class="flex justify-between items-center mb-6">
200
- <h3 class="text-2xl font-bold text-gray-800">تحليل قضية جديدة</h3>
201
- <button onclick="hideCaseAnalysis()" class="text-gray-500 hover:text-gray-700">
202
- <i class="fas fa-times text-xl"></i>
203
- </button>
204
  </div>
205
- <div class="modal-body">
206
- <textarea
207
- class="w-full p-4 border-2 rounded-xl mb-6 h-48 focus:border-yellow-400 focus:ring-2 focus:ring-yellow-400 focus:ring-opacity-50 outline-none transition-all custom-scroll"
208
- placeholder="اكتب تفاصيل القضية هنا..."
209
- ></textarea>
210
- <div id="analysisResult" class="mt-4 p-4 bg-gray-50 rounded-xl hidden"></div>
211
- <div class="flex justify-end gap-4 mt-4">
212
- <button onclick="hideCaseAnalysis()" class="px-6 py-3 border-2 rounded-xl hover:bg-gray-50 font-bold">
213
- إلغاء
214
- </button>
215
- <button onclick="handleCaseAnalysis()" class="premium-button px-6 py-3 rounded-xl font-bold">
216
- تحليل القضية
217
- </button>
218
- </div>
219
  </div>
220
- </div>
221
- </div>
222
-
223
- <!-- نافذة اسأل الموضوع -->
224
- <div id="askTopicModal" class="hidden fixed inset-0 bg-black bg-opacity-30 modal-container flex items-center justify-center z-50">
225
- <div class="modal-content rounded-2xl p-8 w-full max-w-2xl mx-4 max-h-[90vh] overflow-y-auto">
226
- <div class="flex justify-between items-center mb-6">
227
- <h3 class="text-2xl font-bold text-gray-800">اسأل الموضوع</h3>
228
- <button onclick="hideAskTopic()" class="text-gray-500 hover:text-gray-700">
229
- <i class="fas fa-times text-xl"></i>
230
- </button>
 
 
 
 
231
  </div>
232
- <div class="modal-body space-y-6">
233
- <div>
234
- <label class="block text-gray-700 font-bold mb-2">النص القانوني</label>
235
- <textarea
236
- id="legalText"
237
- class="w-full p-4 border-2 rounded-xl h-48 focus:border-yellow-400 focus:ring-2 focus:ring-yellow-400 focus:ring-opacity-50 outline-none transition-all custom-scroll"
238
- placeholder="أدخل النص القانوني هنا..."
239
- ></textarea>
240
- </div>
241
- <div>
242
- <label class="block text-gray-700 font-bold mb-2">سؤالك حول النص</label>
243
- <textarea
244
- id="userQuestion"
245
- class="w-full p-4 border-2 rounded-xl h-24 focus:border-yellow-400 focus:ring-2 focus:ring-yellow-400 focus:ring-opacity-50 outline-none transition-all custom-scroll"
246
- placeholder="اكتب سؤالك هنا..."
247
- ></textarea>
248
- </div>
249
- <div id="topicResult" class="mt-4 p-4 bg-gray-50 rounded-xl hidden"></div>
250
- <div class="flex justify-end gap-4">
251
- <button onclick="hideAskTopic()" class="px-6 py-3 border-2 rounded-xl hover:bg-gray-50 font-bold">
252
- إلغاء
253
- </button>
254
- <button onclick="handleAskTopic()" class="premium-button px-6 py-3 rounded-xl font-bold">
255
- إرسال السؤال
256
- </button>
257
- </div>
258
  </div>
 
 
 
 
 
 
 
 
259
  </div>
260
- </div>
261
-
262
- <script>
263
- // تكوين عنوان API
264
- const API_URL = 'https://j8fp9mu44k547j-7777.proxy.runpod.net/proxy/9000/chat';
265
- const LEGAL_PROMPT = 'أريد منك أن تتصرف كمحامٍ خبير في القانون المصري. قم بتحليل الموضوعات القانونية التي سأطرحها عليك، مستندًا إلى القوانين المصرية الحديثة والمبادئ القانونية الراسخة. يجب أن تكون إجاباتك دقيقة ومحددة، وتقدم النصائح بناءً على القوانين واللوائح المصرية المعمول بها. إذا كان الموضوع يتطلب تفصيلاً قانونياً أكثر عمقًا، فأرجو أن تسألني عن المزيد من التفاصيل. الآن، إليك القضية التي أحتاج لتحليلها: ';
266
-
267
- // دوال التحكم في النوافذ المنبثقة
268
- function showLegalChat() {
269
- document.getElementById('legalChatModal').classList.remove('hidden');
270
- document.body.style.overflow = 'hidden';
271
- }
272
-
273
- function hideLegalChat() {
274
- document.getElementById('legalChatModal').classList.add('hidden');
275
- document.body.style.overflow = 'auto';
276
- document.getElementById('chatInput').value = '';
277
- }
278
-
279
- function showCaseAnalysis() {
280
- document.getElementById('caseAnalysisModal').classList.remove('hidden');
281
- document.body.style.overflow = 'hidden';
282
- }
283
-
284
- function hideCaseAnalysis() {
285
- document.getElementById('caseAnalysisModal').classList.add('hidden');
286
- document.body.style.overflow = 'auto';
287
- document.querySelector('#caseAnalysisModal textarea').value = '';
288
- document.getElementById('analysisResult').classList.add('hidden');
289
- }
290
-
291
- function showAskTopic() {
292
- document.getElementById('askTopicModal').classList.remove('hidden');
293
- document.body.style.overflow = 'hidden';
294
- }
295
-
296
- function hideAskTopic() {
297
- document.getElementById('askTopicModal').classList.add('hidden');
298
- document.body.style.overflow = 'auto';
299
- document.getElementById('legalText').value = '';
300
- document.getElementById('userQuestion').value = '';
301
- document.getElementById('topicResult').classList.add('hidden');
302
- }
303
-
304
- // دوال معالجة الطلبات
305
- async function sendMessage() {
306
- const input = document.getElementById('chatInput');
307
- const messagesDiv = document.getElementById('chatMessages');
308
- const message = input.value.trim();
309
-
310
- if (!message) return;
311
-
312
- // إضافة رسالة المستخدم
313
- messagesDiv.innerHTML += `
314
- <div class="flex justify-end mb-4">
315
- <div class="bg-blue-100 rounded-lg p-3 max-w-[80%]">
316
- ${message}
317
- </div>
318
- </div>
319
- `;
320
-
321
- input.value = '';
322
- messagesDiv.scrollTop = messagesDiv.scrollHeight;
323
-
324
- try {
325
- const response = await fetch(API_URL, {
326
- method: 'POST',
327
- headers: {
328
- 'Content-Type': 'application/json'
329
- },
330
- body: JSON.stringify({ message: LEGAL_PROMPT + message })
331
- });
332
-
333
- if (!response.ok) throw new Error('Network response was not ok');
334
-
335
- const data = await response.json();
336
-
337
- // إضافة رد النظام
338
- messagesDiv.innerHTML += `
339
- <div class="flex justify-start mb-4">
340
- <div class="bg-gray-100 rounded-lg p-3 max-w-[80%]">
341
- ${data.response}
342
- </div>
343
- </div>
344
- `;
345
-
346
- messagesDiv.scrollTop = messagesDiv.scrollHeight;
347
- } catch (error) {
348
- console.error('Error:', error);
349
- messagesDiv.innerHTML += `
350
- <div class="flex justify-start mb-4">
351
- <div class="bg-red-100 rounded-lg p-3 max-w-[80%]">
352
- عذراً، حدث خطأ في معالجة طلبك. يرجى المحاولة مرة أخرى.
353
- </div>
354
- </div>
355
- `;
356
- }
357
- }
358
-
359
- async function handleSearch() {
360
- const searchInput = document.getElementById('searchInput');
361
- const searchResults = document.getElementById('searchResults');
362
- const query = searchInput.value.trim();
363
-
364
- if (!query) {
365
- alert('الرجاء إدخال نص للبحث');
366
- return;
367
- }
368
-
369
- searchResults.innerHTML = '<div class="text-center p-4">جاري البحث...</div>';
370
-
371
- try {
372
- const response = await fetch(API_URL, {
373
- method: 'POST',
374
- headers: {
375
- 'Content-Type': 'application/json'
376
- },
377
- body: JSON.stringify({
378
- message: LEGAL_PROMPT + "ابحث عن: " + query
379
- })
380
- });
381
-
382
- if (!response.ok) throw new Error('Network response was not ok');
383
-
384
- const data = await response.json();
385
- searchResults.innerHTML = `
386
- <div class="bg-white p-6 rounded-xl shadow-md">
387
- ${data.response}
388
- </div>
389
- `;
390
- } catch (error) {
391
- console.error('Error:', error);
392
- searchResults.innerHTML = `
393
- <div class="bg-red-100 p-4 rounded-xl text-red-700">
394
- حدث خطأ في البحث. يرجى المحاولة مرة أخرى.
395
- </div>
396
- `;
397
- }
398
  }
399
-
400
- async function handleCaseAnalysis() {
401
- const caseText = document.querySelector('#caseAnalysisModal textarea').value.trim();
402
- const resultDiv = document.getElementById('analysisResult');
403
-
404
- if (!caseText) {
405
- alert('الرجاء إدخال تفاصيل القضية');
406
- return;
407
- }
408
-
409
- const submitButton = document.querySelector('#caseAnalysisModal .premium-button');
410
- const originalButtonText = submitButton.innerHTML;
411
- submitButton.innerHTML = 'جاري التحليل...';
412
- submitButton.disabled = true;
413
-
414
- try {
415
- const response = await fetch(API_URL, {
416
- method: 'POST',
417
- headers: {
418
- 'Content-Type': 'application/json'
419
- },
420
- body: JSON.stringify({
421
- message: LEGAL_PROMPT + caseText
422
- })
423
- });
424
-
425
- if (!response.ok) throw new Error('Network response was not ok');
426
-
427
- const data = await response.json();
428
- resultDiv.innerHTML = data.response;
429
- resultDiv.classList.remove('hidden');
430
- } catch (error) {
431
- console.error('Error:', error);
432
- resultDiv.innerHTML = 'حدث خطأ في تحليل القضية. يرجى المحاولة مرة أخرى.';
433
- resultDiv.classList.remove('hidden');
434
- } finally {
435
- submitButton.innerHTML = originalButtonText;
436
- submitButton.disabled = false;
437
- }
 
 
 
 
 
 
 
 
 
 
 
438
  }
439
-
440
- async function handleAskTopic() {
441
- const legalText = document.getElementById('legalText').value.trim();
442
- const userQuestion = document.getElementById('userQuestion').value.trim();
443
- const resultDiv = document.getElementById('topicResult');
444
-
445
- if (!legalText || !userQuestion) {
446
- alert('الرجاء إدخال النص القانوني والسؤال');
447
- return;
448
- }
449
-
450
- const submitButton = document.querySelector('#askTopicModal .premium-button');
451
- const originalButtonText = submitButton.innerHTML;
452
- submitButton.innerHTML = 'جاري المعالجة...';
453
- submitButton.disabled = true;
454
-
455
- try {
456
- const response = await fetch(API_URL, {
457
- method: 'POST',
458
- headers: {
459
- 'Content-Type': 'application/json'
460
- },
461
- body: JSON.stringify({
462
- message: LEGAL_PROMPT + `النص القانوني: ${legalText}\n\nالسؤال: ${userQuestion}`
463
- })
464
- });
465
-
466
- if (!response.ok) throw new Error('Network response was not ok');
467
-
468
- const data = await response.json();
469
- resultDiv.innerHTML = data.response;
470
- resultDiv.classList.remove('hidden');
471
- } catch (error) {
472
- console.error('Error:', error);
473
- resultDiv.innerHTML = 'حدث خطأ في معالجة السؤال. يرجى المحاولة مرة أخرى.';
474
- resultDiv.classList.remove('hidden');
475
- } finally {
476
- submitButton.innerHTML = originalButtonText;
477
- submitButton.disabled = false;
478
- }
 
 
 
479
  }
480
-
481
- // إضافة مستمعي الأحداث
482
- document.getElementById('searchInput').addEventListener('keypress', function(e) {
483
- if (e.key === 'Enter') {
484
- handleSearch();
485
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
486
  });
487
 
488
- document.getElementById('chatInput').addEventListener('keypress', function(e) {
489
- if (e.key === 'Enter') {
490
- sendMessage();
491
- }
492
- });
493
 
494
- // إغلاق النوافذ المنبثقة عند النقر خارجها
495
- window.onclick = function(event) {
496
- const modals = {
497
- 'legalChatModal': hideLegalChat,
498
- 'caseAnalysisModal': hideCaseAnalysis,
499
- 'askTopicModal': hideAskTopic
500
- };
501
-
502
- Object.entries(modals).forEach(([modalId, hideFunction]) => {
503
- const modal = document.getElementById(modalId);
504
- if (event.target === modal) {
505
- hideFunction();
506
- }
507
- });
508
- };
509
- </script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
510
  </body>
511
- </html>
 
1
  <!DOCTYPE html>
2
  <html dir="rtl" lang="ar">
3
  <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>المنصة القانونية الذكية - وإنشاء العقود</title>
7
+ <!-- ربط مكتبات Tailwind وFont Awesome -->
8
+ <link href="https://cdnjs.cloudflare.com/ajax/libs/tailwindcss/2.2.19/tailwind.min.css" rel="stylesheet" />
9
+ <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet" />
10
+ <!-- ربط مكتبة jsPDF لتحويل النص إلى PDF -->
11
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js"></script>
12
+ <style>
13
+ @import url("https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700&display=swap");
14
+
15
+ :root {
16
+ --primary-color: #2563eb;
17
+ --primary-hover: #1d4ed8;
18
+ --background-light: #f8fafc;
19
+ --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
20
+ }
21
+
22
+ body {
23
+ font-family: "Tajawal", sans-serif;
24
+ background: var(--background-light);
25
+ }
26
+
27
+ /* الشريط الجانبي */
28
+ .sidebar {
29
+ background: white;
30
+ width: 280px;
31
+ position: fixed;
32
+ right: 0;
33
+ top: 0;
34
+ height: 100vh;
35
+ z-index: 40;
36
+ transition: transform 0.3s ease;
37
+ box-shadow: var(--card-shadow);
38
+ }
39
+ .main-content {
40
+ margin-right: 280px;
41
+ transition: margin 0.3s ease;
42
+ min-height: 100vh;
43
+ padding: 2rem;
44
+ background: var(--background-light);
45
+ }
46
+ .nav-link {
47
+ display: flex;
48
+ align-items: center;
49
+ padding: 1rem 1.5rem;
50
+ color: #374151;
51
+ transition: all 0.3s ease;
52
+ border-radius: 0.5rem;
53
+ margin: 0.25rem 0.5rem;
54
+ }
55
+ .nav-link:hover {
56
+ background: #f3f4f6;
57
+ color: var(--primary-color);
58
+ }
59
+ .nav-link.active {
60
+ background: var(--primary-color);
61
+ color: white;
62
+ }
63
+ .feature-card {
64
+ background: white;
65
+ border-radius: 1rem;
66
+ box-shadow: var(--card-shadow);
67
+ transition: all 0.3s ease;
68
+ overflow: hidden;
69
+ height: 100%;
70
+ }
71
+ .feature-card:hover {
72
+ transform: translateY(-4px);
73
+ box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
74
+ }
75
+ .action-button {
76
+ background: var(--primary-color);
77
+ color: white;
78
+ padding: 0.75rem 1.5rem;
79
+ border-radius: 0.5rem;
80
+ transition: all 0.3s ease;
81
+ border: none;
82
+ font-weight: 500;
83
+ width: 100%;
84
+ text-align: center;
85
+ }
86
+ .action-button:hover {
87
+ background: var(--primary-hover);
88
+ transform: translateY(-1px);
89
+ }
90
+ .input-group {
91
+ position: relative;
92
+ }
93
+ .input-group.focused input,
94
+ .input-group.focused textarea {
95
+ border-color: var(--primary-color);
96
+ transform: translateY(-2px);
97
+ }
98
+ .loading-spinner {
99
+ border: 3px solid #f3f3f3;
100
+ border-radius: 50%;
101
+ border-top: 3px solid var(--primary-color);
102
+ width: 24px;
103
+ height: 24px;
104
+ animation: spin 1s linear infinite;
105
+ margin: 0 auto;
106
+ }
107
+ @keyframes spin {
108
+ 0% { transform: rotate(0deg); }
109
+ 100% { transform: rotate(360deg); }
110
+ }
111
+ .response-container {
112
+ white-space: pre-wrap;
113
+ font-family: "Tajawal", sans-serif;
114
+ line-height: 1.6;
115
+ max-height: 400px;
116
+ overflow-y: auto;
117
+ }
118
+ /* تنسيق قسم إنشاء العقود */
119
+ .split-screen {
120
+ display: grid;
121
+ grid-template-columns: 1fr 1fr;
122
+ gap: 2rem;
123
+ margin-top: 1rem;
124
+ }
125
+ .contract-card {
126
+ background: white;
127
+ border-radius: 1.5rem;
128
+ box-shadow: var(--card-shadow);
129
+ padding: 2rem;
130
+ border: 1px solid #f3f4f6;
131
+ }
132
+ .contract-output {
133
+ background: #fafafa;
134
+ border-radius: 1rem;
135
+ padding: 2rem;
136
+ min-height: 300px;
137
+ line-height: 1.8;
138
+ font-size: 1.1rem;
139
+ border: 1px solid #f3f4f6;
140
+ white-space: pre-wrap;
141
+ }
142
+ .copy-btn {
143
+ position: absolute;
144
+ top: 1rem;
145
+ left: 1rem;
146
+ padding: 0.5rem 1rem;
147
+ background: #f3f4f6;
148
+ border-radius: 0.75rem;
149
+ cursor: pointer;
150
+ transition: all 0.3s ease;
151
+ display: flex;
152
+ align-items: center;
153
+ gap: 0.5rem;
154
+ font-size: 0.9rem;
155
+ color: #4b5563;
156
+ }
157
+ .copy-btn:hover {
158
+ background: #e5e7eb;
159
+ }
160
+ .success-message {
161
+ position: fixed;
162
+ bottom: 2rem;
163
+ right: 2rem;
164
+ background: #10b981;
165
+ color: white;
166
+ padding: 1rem 2rem;
167
+ border-radius: 1rem;
168
+ animation: slideIn 0.3s ease;
169
+ }
170
+ @keyframes slideIn {
171
+ from { transform: translateX(100%); opacity: 0; }
172
+ to { transform: translateX(0); opacity: 1; }
173
+ }
174
+ .section-title {
175
+ font-size: 1.25rem;
176
+ color: #1f2937;
177
+ margin-bottom: 1.5rem;
178
+ padding-bottom: 0.75rem;
179
+ border-bottom: 2px solid #e5e7eb;
180
+ font-weight: 600;
181
+ }
182
+ /* تحسين التنسيق على الأجهزة المحمولة */
183
+ @media (max-width: 768px) {
184
+ .sidebar { transform: translateX(100%); }
185
+ .sidebar.open { transform: translateX(0); }
186
+ .main-content { margin-right: 0; }
187
+ .split-screen { grid-template-columns: 1fr; }
188
+ }
189
+ </style>
190
  </head>
191
+ <body>
192
+ <!-- زر إظهار/إخفاء الشريط الجانبي -->
193
+ <button id="sidebarToggle" class="fixed top-4 right-4 z-50 p-2 rounded-lg bg-white shadow-lg md:hidden">
194
+ <i class="fas fa-bars text-xl"></i>
195
+ </button>
196
+
197
+ <!-- الشريط الجانبي -->
198
+ <aside class="sidebar">
199
+ <div class="p-6">
200
+ <div class="flex items-center gap-4 mb-8">
201
+ <!-- استخدام الصورة المطلوبة كشعار -->
202
+ <img src="https://ufastpro.com/wp-content/uploads/2025/02/تصميم-بدون-عنوان.png" alt="شعار المنصة" class="w-12 h-12 rounded-full" />
203
+ <div>
204
+ <h1 class="text-xl font-bold text-gray-800">المنصة القانونية</h1>
205
+ <p class="text-sm text-gray-500">خدمات قانونية ذكية</p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
206
  </div>
207
+ </div>
208
+ <nav class="space-y-1">
209
+ <a href="#" class="nav-link active" data-section="home">
210
+ <i class="fas fa-home ml-3"></i>
211
+ <span>الرئيسية</span>
212
+ </a>
213
+ <a href="#" class="nav-link" data-section="analysis">
214
+ <i class="fas fa-balance-scale ml-3"></i>
215
+ <span>التحليل القانوني</span>
216
+ </a>
217
+ <a href="#" class="nav-link" data-section="mindMap">
218
+ <i class="fas fa-project-diagram ml-3"></i>
219
+ <span>خريطة التفكير</span>
220
+ </a>
221
+ <a href="#" class="nav-link" data-section="search">
222
+ <i class="fas fa-search ml-3"></i>
223
+ <span>البحث القانوني</span>
224
+ </a>
225
+ <a href="#" class="nav-link" data-section="documents">
226
+ <i class="fas fa-file-alt ml-3"></i>
227
+ <span>المستندات</span>
228
+ </a>
229
+ <a href="#" class="nav-link" data-section="translation">
230
+ <i class="fas fa-language ml-3"></i>
231
+ <span>الترجمة القانونية</span>
232
+ </a>
233
+ <a href="#" class="nav-link" data-section="consultation">
234
+ <i class="fas fa-comments ml-3"></i>
235
+ <span>استشارة قانونية</span>
236
+ </a>
237
+ <!-- رابط قسم إنشاء العقود -->
238
+ <a href="#" class="nav-link" data-section="contracts">
239
+ <i class="fas fa-file-contract ml-3"></i>
240
+ <span>العقود</span>
241
+ </a>
242
+ <a href="#" class="nav-link" data-section="precedents">
243
+ <i class="fas fa-gavel ml-3"></i>
244
+ <span>الأحكام والسوابق</span>
245
+ </a>
246
+ </nav>
247
+ </div>
248
+ </aside>
249
+
250
+ <!-- المحتوى الرئيسي -->
251
+ <main class="main-content">
252
+ <!-- بحث عالمي -->
253
+ <div class="search-container mb-6">
254
+ <input type="text" class="search-input w-full p-3 rounded border" placeholder="ابحث في المنصة..." id="globalSearch" />
255
+ <i class="fas fa-search absolute top-1/2 right-4 transform -translate-y-1/2 text-gray-400"></i>
256
+ </div>
257
 
258
+ <!-- قسم الرئيسية -->
259
+ <section id="home" class="section">
260
+ <h2 class="text-3xl font-bold text-gray-800 mb-8">الخدمات القانونية</h2>
261
+ <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
262
+ <!-- بطاقات الخدمة (نفس الشكل كما سابقاً) -->
263
+ <div class="feature-card p-6">
264
+ <div class="text-center">
265
+ <i class="fas fa-balance-scale text-3xl mb-4 text-blue-600"></i>
266
+ <h3 class="text-xl font-bold text-gray-800 mb-3">التحليل القانوني</h3>
267
+ <p class="text-gray-600 mb-4">
268
+ تحليل متكامل للقضايا والمستندات القانونية باستخدام الذكاء الاصطناعي
269
+ </p>
270
+ <button class="action-button" onclick="showSection('analysis')">ابدأ التحليل</button>
271
+ </div>
272
+ </div>
273
+ <div class="feature-card p-6">
274
+ <div class="text-center">
275
+ <i class="fas fa-project-diagram text-3xl mb-4 text-blue-600"></i>
276
+ <h3 class="text-xl font-bold text-gray-800 mb-3">خريطة التفكير</h3>
277
+ <p class="text-gray-600 mb-4">
278
+ إنشاء خرائط ذهنية للقضايا القانونية وتحليل العلاقات
279
+ </p>
280
+ <button class="action-button" onclick="showSection('mindMap')">إنشاء خريطة</button>
281
+ </div>
282
+ </div>
283
+ <div class="feature-card p-6">
284
+ <div class="text-center">
285
+ <i class="fas fa-search text-3xl mb-4 text-blue-600"></i>
286
+ <h3 class="text-xl font-bold text-gray-800 mb-3">البحث القانوني</h3>
287
+ <p class="text-gray-600 mb-4">
288
+ بحث متقدم في السوابق والقضايا المشابهة
289
+ </p>
290
+ <button class="action-button" onclick="showSection('search')">ابدأ البحث</button>
291
+ </div>
292
+ </div>
293
+ <div class="feature-card p-6">
294
+ <div class="text-center">
295
+ <i class="fas fa-file-alt text-3xl mb-4 text-blue-600"></i>
296
+ <h3 class="text-xl font-bold text-gray-800 mb-3">المستندات</h3>
297
+ <p class="text-gray-600 mb-4">
298
+ إنشاء وتحرير المستندات القانونية بمساعدة الذكاء الاصطناعي
299
+ </p>
300
+ <button class="action-button" onclick="showSection('documents')">إنشاء مستند</button>
301
+ </div>
302
+ </div>
303
+ <div class="feature-card p-6">
304
+ <div class="text-center">
305
+ <i class="fas fa-language text-3xl mb-4 text-blue-600"></i>
306
+ <h3 class="text-xl font-bold text-gray-800 mb-3">الترجمة القانونية</h3>
307
+ <p class="text-gray-600 mb-4">
308
+ ترجمة احترافية للوثائق القانونية بدقة عالية مع إمكانية تنزيلها كملف PDF
309
+ </p>
310
+ <button class="action-button" onclick="showSection('translation')">ترجم الآن</button>
311
+ </div>
312
+ </div>
313
+ <div class="feature-card p-6">
314
+ <div class="text-center">
315
+ <i class="fas fa-comments text-3xl mb-4 text-blue-600"></i>
316
+ <h3 class="text-xl font-bold text-gray-800 mb-3">استشارة قانونية</h3>
317
+ <p class="text-gray-600 mb-4">
318
+ احصل على استشارة قانونية فورية من خبرائنا
319
+ </p>
320
+ <button class="action-button" onclick="showSection('consultation')">استشر الآن</button>
321
+ </div>
322
+ </div>
323
+ </div>
324
+ </section>
325
+
326
+ <!-- الأقسام الأخرى (التحليل، المستندات، خريطة التفكير، البحث، الترجمة، الاستشارة) -->
327
+ <section id="analysis" class="section hidden">
328
+ <h2 class="text-3xl font-bold text-gray-800 mb-8">التحليل القانوني</h2>
329
+ <div class="input-group bg-white rounded p-6 shadow">
330
+ <textarea class="w-full p-3 border rounded" placeholder="اكتب وصف القضية أو المستند الذي تريد تحليله..."></textarea>
331
+ <button class="action-button mt-4" onclick="handleSubmit('analysis', 'قم بتحليل هذه القضية: ')">تحليل</button>
332
+ <div id="analysisResult" class="mt-4 response-container"></div>
333
+ </div>
334
+ </section>
335
+
336
+ <section id="documents" class="section hidden">
337
+ <h2 class="text-3xl font-bold text-gray-800 mb-8">إنشاء مستند قانوني</h2>
338
+ <div class="input-group bg-white rounded p-6 shadow">
339
+ <textarea class="w-full p-3 border rounded" placeholder="اكتب وصف المستند المطلوب إنشاؤه..."></textarea>
340
+ <button class="action-button mt-4" onclick="handleSubmit('documents', 'قم بإنشاء مستند قانوني بناءً على الوصف التالي: ')">إنشاء المستند</button>
341
+ <div id="documentsResult" class="mt-4 response-container"></div>
342
+ </div>
343
+ </section>
344
+
345
+ <section id="mindMap" class="section hidden">
346
+ <h2 class="text-3xl font-bold text-gray-800 mb-8">خريطة التفكير القانونية</h2>
347
+ <div class="input-group bg-white rounded p-6 shadow">
348
+ <textarea class="w-full p-3 border rounded" placeholder="اكتب وصف الموضوع الذي تريد إنشاء خريطة ذهنية له..."></textarea>
349
+ <button class="action-button mt-4" onclick="handleSubmit('mindMap', 'قم بإنشاء خريطة ذهنية قانونية للموضوع التالي: ')">إنشاء خريطة التفكير</button>
350
+ <div id="mindMapResult" class="mt-4 response-container"></div>
351
+ </div>
352
+ </section>
353
+
354
+ <section id="search" class="section hidden">
355
+ <h2 class="text-3xl font-bold text-gray-800 mb-8">ال��حث القانوني</h2>
356
+ <div class="input-group bg-white rounded p-6 shadow">
357
+ <textarea class="w-full p-3 border rounded" placeholder="اكتب استعلام البحث القانوني..."></textarea>
358
+ <button class="action-button mt-4" onclick="handleSubmit('search', 'ابحث عن معلومات قانونية حول: ')">بحث</button>
359
+ <div id="searchResult" class="mt-4 response-container"></div>
360
+ </div>
361
+ </section>
362
+
363
+ <!-- قسم الترجمة القانونية مع إضافة زر تنزيل PDF -->
364
+ <section id="translation" class="section hidden">
365
+ <h2 class="text-3xl font-bold text-gray-800 mb-8">الترجمة القانونية</h2>
366
+ <div class="input-group bg-white rounded p-6 shadow">
367
+ <textarea class="w-full p-3 border rounded" placeholder="اكتب النص المراد ترجمته..."></textarea>
368
+ <div class="flex gap-4 my-4">
369
+ <select class="p-3 rounded border w-full" id="fromLang">
370
+ <option value="ar">العربية</option>
371
+ <option value="en">الإنجليزية</option>
372
+ </select>
373
+ <select class="p-3 rounded border w-full" id="toLang">
374
+ <option value="en">الإنجليزية</option>
375
+ <option value="ar">العربية</option>
376
+ </select>
377
+ </div>
378
+ <button class="action-button" onclick="handleSubmit('translation', 'قم بترجمة هذا النص القانوني: ')">ترجمة</button>
379
+ <div id="translationResult" class="mt-4 response-container"></div>
380
+ <button id="downloadPDFButton" class="action-button mt-4">تنزيل الترجمة كملف PDF</button>
381
+ </div>
382
+ </section>
383
+
384
+ <section id="consultation" class="section hidden">
385
+ <h2 class="text-3xl font-bold text-gray-800 mb-8">استشارة قانونية</h2>
386
+ <div class="input-group bg-white rounded p-6 shadow">
387
+ <textarea class="w-full p-3 border rounded" placeholder="اكتب سؤالك القانوني هنا..."></textarea>
388
+ <button class="action-button mt-4" onclick="handleSubmit('consultation', 'أحتاج استشارة قانونية في الموضوع التالي: ')">احصل على استشارة</button>
389
+ <div id="consultationResult" class="mt-4 response-container"></div>
390
+ </div>
391
+ </section>
392
+
393
+ <!-- قسم إنشاء العقود -->
394
+ <section id="contracts" class="section hidden">
395
+ <h2 class="text-3xl font-bold text-gray-800 mb-8">منشئ العقود المصري الذكي</h2>
396
+ <div class="split-screen">
397
+ <!-- نموذج بيانات العقد -->
398
+ <div class="contract-card">
399
+ <div class="space-y-6">
400
+ <div class="mb-4 input-group">
401
+ <label class="block text-gray-700 font-bold mb-2">عنوان العقد:</label>
402
+ <input type="text" id="contractTitle" placeholder="عنوان العقد" class="w-full p-2 border rounded" />
403
  </div>
404
+ <div class="mb-4 input-group">
405
+ <label class="block text-gray-700 font-bold mb-2">تاريخ تحرير العقد:</label>
406
+ <input type="date" id="contractDate" class="w-full p-2 border rounded" />
 
 
 
 
 
 
 
 
 
 
407
  </div>
408
+ <h3 class="section-title">بيانات الطرف الأول</h3>
409
+ <div class="mb-4 input-group">
410
+ <label class="block text-gray-700 font-bold mb-2">اسم الطرف الأول:</label>
411
+ <input type="text" id="firstPartyName" placeholder="الاسم الكامل" class="w-full p-2 border rounded" />
 
 
 
 
 
 
 
 
 
412
  </div>
413
+ <div class="mb-4 input-group">
414
+ <label class="block text-gray-700 font-bold mb-2">الرقم القومي للطرف الأول:</label>
415
+ <input type="text" id="firstPartyID" placeholder="14 رقم" maxlength="14" class="w-full p-2 border rounded" />
 
 
 
 
 
 
 
 
416
  </div>
417
+ <div class="mb-4 input-group">
418
+ <label class="block text-gray-700 font-bold mb-2">الصفة:</label>
419
+ <input type="text" id="firstPartyTitle" placeholder="مثال: مالك، مدير شركة" class="w-full p-2 border rounded" />
420
  </div>
421
+ <div class="mb-4 input-group">
422
+ <label class="block text-gray-700 font-bold mb-2">جنسية الطرف الأول:</label>
423
+ <input type="text" id="firstPartyNationality" placeholder="الجنسية" value="مصري" class="w-full p-2 border rounded" />
 
 
 
 
 
424
  </div>
425
+ <div class="mb-4 input-group">
426
+ <label class="block text-gray-700 font-bold mb-2">عنوان الطرف الأول:</label>
427
+ <input type="text" id="firstPartyAddress" placeholder="العنوان التفصيلي" class="w-full p-2 border rounded" />
 
 
 
 
 
 
 
 
428
  </div>
429
+ <h3 class="section-title">بيانات الطرف الثاني</h3>
430
+ <div class="mb-4 input-group">
431
+ <label class="block text-gray-700 font-bold mb-2">اسم الطرف الثاني:</label>
432
+ <input type="text" id="secondPartyName" placeholder="الاسم الكامل" class="w-full p-2 border rounded" />
 
 
 
 
 
 
 
 
 
 
433
  </div>
434
+ <div class="mb-4 input-group">
435
+ <label class="block text-gray-700 font-bold mb-2">الرقم القومي للطرف الثاني:</label>
436
+ <input type="text" id="secondPartyID" placeholder="14 رقم" maxlength="14" class="w-full p-2 border rounded" />
437
+ </div>
438
+ <div class="mb-4 input-group">
439
+ <label class="block text-gray-700 font-bold mb-2">الصفة:</label>
440
+ <input type="text" id="secondPartyTitle" placeholder="مثال: مستأجر، مشتري" class="w-full p-2 border rounded" />
441
+ </div>
442
+ <div class="mb-4 input-group">
443
+ <label class="block text-gray-700 font-bold mb-2">جنسية الطرف الثاني:</label>
444
+ <input type="text" id="secondPartyNationality" placeholder="الجنسية" value="مصري" class="w-full p-2 border rounded" />
445
+ </div>
446
+ <div class="mb-4 input-group">
447
+ <label class="block text-gray-700 font-bold mb-2">عنوان الطرف الثاني:</label>
448
+ <input type="text" id="secondPartyAddress" placeholder="العنوان التفصيلي" class="w-full p-2 border rounded" />
449
  </div>
450
+ <h3 class="section-title">تفاصيل العقد</h3>
451
+ <div class="mb-4 input-group">
452
+ <label class="block text-gray-700 font-bold mb-2">البند التمهيدي:</label>
453
+ <textarea id="contractPreamble" placeholder="اكتب مضمون العقد والغرض منه" class="w-full p-2 border rounded h-24"></textarea>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
454
  </div>
455
+ <div class="mb-4 input-group">
456
+ <label class="block text-gray-700 font-bold mb-2">بنود العقد:</label>
457
+ <textarea id="contractTerms" placeholder="اكتب بنود العقد الأساسية" class="w-full p-2 border rounded h-48"></textarea>
458
+ </div>
459
+ </div>
460
+ <div class="mt-4 text-center">
461
+ <button id="generateButton" class="action-button">إنشاء العقد</button>
462
+ </div>
463
  </div>
464
+ <!-- عرض العقد المنشأ مع إمكانية النسخ -->
465
+ <div class="contract-card relative">
466
+ <h3 class="text-2xl font-bold text-gray-800 mb-4">العقد المنشأ</h3>
467
+ <button class="copy-btn" id="copyButton">
468
+ <i class="fas fa-copy"></i> نسخ العقد
469
+ </button>
470
+ <div id="contractOutput" class="contract-output"></div>
471
+ </div>
472
+ </div>
473
+ </section>
474
+ </main>
475
+
476
+ <!-- سكربتات الموقع -->
477
+ <script>
478
+ // تعريف رابط API الخاص بنا
479
+ const API_URL = 'https://g2mgow5tgbxsjy-7777.proxy.runpod.net/proxy/8000/chat';
480
+
481
+ // تفعيل التنقل بين الأقسام
482
+ document.querySelectorAll(".nav-link").forEach(link => {
483
+ link.addEventListener("click", (e) => {
484
+ e.preventDefault();
485
+ const section = e.currentTarget.getAttribute("data-section");
486
+ showSection(section);
487
+ });
488
+ });
489
+
490
+ function showSection(sectionId) {
491
+ document.querySelectorAll(".section").forEach(section => {
492
+ section.classList.add("hidden");
493
+ });
494
+ document.getElementById(sectionId).classList.remove("hidden");
495
+ document.querySelectorAll(".nav-link").forEach(link => {
496
+ link.classList.remove("active");
497
+ if (link.getAttribute("data-section") === sectionId) {
498
+ link.classList.add("active");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
499
  }
500
+ });
501
+ }
502
+
503
+ // زر القائمة على الهاتف
504
+ document.getElementById("sidebarToggle").addEventListener("click", () => {
505
+ document.querySelector(".sidebar").classList.toggle("open");
506
+ });
507
+
508
+ // إضافة مستمعي الأحداث لحقول الإدخال لتحسين التأثير عند التركيز
509
+ document.querySelectorAll("input, textarea").forEach(element => {
510
+ element.addEventListener("focus", function() {
511
+ const group = this.closest(".input-group");
512
+ if(group) group.classList.add("focused");
513
+ this.style.transform = 'translateY(-2px)';
514
+ });
515
+
516
+ element.addEventListener("blur", function() {
517
+ const group = this.closest(".input-group");
518
+ if(group) group.classList.remove("focused");
519
+ this.style.transform = 'translateY(0)';
520
+ });
521
+ });
522
+
523
+ // دالة إرسال الطلبات العامة (تحليل، مستند، خريطة، بحث، ترجمة، استشارة)
524
+ async function handleSubmit(section, promptPrefix) {
525
+ // الحصول على textarea والنتيجة
526
+ const textarea = document.querySelector(`#${section} textarea`);
527
+ const resultDiv = document.getElementById(`${section}Result`) || document.getElementById(`${section}Result`);
528
+ const text = textarea.value.trim();
529
+ if (!text) {
530
+ alert("الرجاء إدخال نص");
531
+ return;
532
+ }
533
+ const payload = {
534
+ message: promptPrefix + text,
535
+ history: []
536
+ };
537
+ try {
538
+ // عرض مؤشر التحميل
539
+ if(document.getElementById(`${section}Result`))
540
+ document.getElementById(`${section}Result`).innerHTML = '<div class="loading-spinner"></div>';
541
+ else if(resultDiv)
542
+ resultDiv.innerHTML = '<div class="loading-spinner"></div>';
543
+ const response = await fetch(API_URL, {
544
+ method: "POST",
545
+ headers: { "Content-Type": "application/json" },
546
+ body: JSON.stringify(payload)
547
+ });
548
+ if (!response.ok) {
549
+ throw new Error("Network response was not ok");
550
  }
551
+ const data = await response.json();
552
+ if(document.getElementById(`${section}Result`))
553
+ document.getElementById(`${section}Result`).innerHTML = data.response || "";
554
+ else if(resultDiv)
555
+ resultDiv.innerHTML = data.response || "";
556
+ } catch (error) {
557
+ console.error("Error:", error);
558
+ if(document.getElementById(`${section}Result`))
559
+ document.getElementById(`${section}Result`).innerHTML = '<div class="text-red-500">حدث خطأ. يرجى المحاولة مرة أخرى.</div>';
560
+ else if(resultDiv)
561
+ resultDiv.innerHTML = '<div class="text-red-500">حدث خطأ. يرجى المحاولة مرة أخرى.</div>';
562
+ }
563
+ }
564
+
565
+ // وظيفة زر النسخ في قسم إنشاء العقود
566
+ document.getElementById("copyButton").addEventListener("click", async function() {
567
+ const contractText = document.getElementById("contractOutput").innerText;
568
+ try {
569
+ await navigator.clipboard.writeText(contractText);
570
+ showSuccessMessage("تم نسخ العقد بنجاح!");
571
+ } catch (err) {
572
+ console.error("فشل نسخ النص:", err);
573
+ }
574
+ });
575
+
576
+ // وظيفة إظهار رسالة النجاح عند النسخ
577
+ function showSuccessMessage(message) {
578
+ const successMessage = document.createElement("div");
579
+ successMessage.className = "success-message animate__animated animate__fadeIn";
580
+ successMessage.textContent = message;
581
+ document.body.appendChild(successMessage);
582
+ setTimeout(() => {
583
+ successMessage.classList.add("animate__fadeOut");
584
+ setTimeout(() => successMessage.remove(), 300);
585
+ }, 2000);
586
+ }
587
+
588
+ // التحقق من صحة الرقم القومي للطرف الأول والثاني
589
+ document.querySelectorAll("#firstPartyID, #secondPartyID").forEach(input => {
590
+ input.addEventListener("input", function() {
591
+ this.value = this.value.replace(/[^0-9]/g, '');
592
+ if (this.value.length > 14) {
593
+ this.value = this.value.slice(0, 14);
594
  }
595
+ });
596
+ });
597
+
598
+ // دالة الحصول على تسمية الحقل لعرضها في رسائل الخطأ
599
+ function getFieldLabel(field) {
600
+ const labels = {
601
+ contractTitle: 'عنوان العقد',
602
+ contractDate: 'تاريخ العقد',
603
+ firstPartyName: 'اسم الطرف الأول',
604
+ firstPartyID: 'الرقم القومي للطرف الأول',
605
+ firstPartyTitle: 'صفة الطرف الأول',
606
+ firstPartyNationality: 'جنسية الطرف الأول',
607
+ firstPartyAddress: 'عنوان الطرف الأول',
608
+ secondPartyName: 'اسم الطرف الثاني',
609
+ secondPartyID: 'الرقم القومي للطرف الثاني',
610
+ secondPartyTitle: 'صفة الطرف الثاني',
611
+ secondPartyNationality: 'جنسية الطرف الثاني',
612
+ secondPartyAddress: 'عنوان الطرف الثاني',
613
+ contractPreamble: 'البند التمهيدي',
614
+ contractTerms: 'بنود العقد'
615
+ };
616
+ return labels[field] || field;
617
+ }
618
+
619
+ // وظيفة زر إنشاء العقد
620
+ document.getElementById("generateButton").addEventListener("click", async function() {
621
+ const button = this;
622
+ const outputDiv = document.getElementById("contractOutput");
623
+
624
+ // جمع بيانات النموذج
625
+ const formData = {
626
+ contractTitle: document.getElementById("contractTitle").value.trim(),
627
+ contractDate: document.getElementById("contractDate").value,
628
+ firstPartyName: document.getElementById("firstPartyName").value.trim(),
629
+ firstPartyID: document.getElementById("firstPartyID").value.trim(),
630
+ firstPartyTitle: document.getElementById("firstPartyTitle").value.trim(),
631
+ firstPartyNationality: document.getElementById("firstPartyNationality").value.trim(),
632
+ firstPartyAddress: document.getElementById("firstPartyAddress").value.trim(),
633
+ secondPartyName: document.getElementById("secondPartyName").value.trim(),
634
+ secondPartyID: document.getElementById("secondPartyID").value.trim(),
635
+ secondPartyTitle: document.getElementById("secondPartyTitle").value.trim(),
636
+ secondPartyNationality: document.getElementById("secondPartyNationality").value.trim(),
637
+ secondPartyAddress: document.getElementById("secondPartyAddress").value.trim(),
638
+ contractPreamble: document.getElementById("contractPreamble").value.trim(),
639
+ contractTerms: document.getElementById("contractTerms").value.trim()
640
+ };
641
+
642
+ // التحقق من البيانات المطلوبة
643
+ const requiredFields = Object.keys(formData);
644
+ const missingFields = requiredFields.filter(field => !formData[field]);
645
+
646
+ if (missingFields.length > 0) {
647
+ outputDiv.innerHTML = `
648
+ <div class="text-red-500 font-bold mb-4">يرجى ملء جميع الحقول المطلوبة</div>
649
+ <ul class="list-disc list-inside text-red-500">
650
+ ${missingFields.map(field => `<li>${getFieldLabel(field)}</li>`).join('')}
651
+ </ul>
652
+ `;
653
+ return;
654
+ }
655
+
656
+ // تحديث واجهة المستخدم لحالة التحميل
657
+ button.textContent = 'جاري إنشاء العقد...';
658
+ button.disabled = true;
659
+ outputDiv.innerHTML = `
660
+ <div class="flex items-center justify-center space-x-4 text-gray-600">
661
+ <div class="animate-spin rounded-full h-8 w-8 border-b-2 border-blue-600"></div>
662
+ <span>جاري إنشاء العقد باستخدام الذكاء الاصطناعي...</span>
663
+ </div>
664
+ `;
665
+
666
+ try {
667
+ // تحويل التاريخ إلى التنسيق العربي
668
+ const dateObj = new Date(formData.contractDate);
669
+ const arabicDate = new Intl.DateTimeFormat('ar-EG', {
670
+ year: 'numeric',
671
+ month: 'long',
672
+ day: 'numeric'
673
+ }).format(dateObj);
674
+
675
+ // إنشاء نص الطلب
676
+ const prompt = `قم بإنشاء عقد قانوني مصري رسمي باللغة العربية يتضمن البيانات التالية:
677
+
678
+ عنوان العقد: ${formData.contractTitle}
679
+ تاريخ العقد: ${arabicDate}
680
+
681
+ الطرف الأول:
682
+ - الاسم: ${formData.firstPartyName}
683
+ - الرقم القومي: ${formData.firstPartyID}
684
+ - الصفة: ${formData.firstPartyTitle}
685
+ - الجنسية: ${formData.firstPartyNationality}
686
+ - العنوان: ${formData.firstPartyAddress}
687
+
688
+ الطرف الثاني:
689
+ - الاسم: ${formData.secondPartyName}
690
+ - الرقم القومي: ${formData.secondPartyID}
691
+ - الصفة: ${formData.secondPartyTitle}
692
+ - الجنسية: ${formData.secondPartyNationality}
693
+ - العنوان: ${formData.secondPartyAddress}
694
+
695
+ التمهيد:
696
+ ${formData.contractPreamble}
697
+
698
+ بنود العقد:
699
+ ${formData.contractTerms}
700
+
701
+ يجب أن يتضمن العقد:
702
+ 1. النص القانوني: "وبعد أن أقر طرفي هذا العقد بكامل أهليتهما المعتبرة قانوناً وشرعاً وبخلو إرادتهما من أي عيب من عيوب الإرادة وبأنهما غير ممنوعين من التصرف وغير محجور عليهما لأي سبب من الأسباب وعدم خضوعهم لقانون الحراسات أو الكسب غير المشروع وبخلوهما من كافة الموانع القانونية والشرعية اللازمة للتعاقد اتفقوا على الآتي"
703
+ 2. بند حكم التمهيد يوضح أن التمهيد جزء لا يتجزأ من العقد
704
+ 3. تنسيق قانوني رسمي
705
+ 4. مكان للتوقيع في النهاية مع كتابة "طرف أول" و "طرف ثاني"`;
706
+
707
+ // إرسال الطلب إلى API
708
+ const response = await fetch(API_URL, {
709
+ method: 'POST',
710
+ headers: {
711
+ 'Content-Type': 'application/json'
712
+ },
713
+ body: JSON.stringify({
714
+ message: prompt,
715
+ history: []
716
+ })
717
  });
718
 
719
+ if (!response.ok) {
720
+ throw new Error(`HTTP error! status: ${response.status}`);
721
+ }
 
 
722
 
723
+ const data = await response.json();
724
+ outputDiv.innerHTML = `<div dir="rtl" style="white-space: pre-wrap;">${data.response}</div>`;
725
+
726
+ } catch (error) {
727
+ outputDiv.innerHTML = `
728
+ <div class="text-red-600 font-bold">
729
+ عذراً، حدث خطأ في إنشاء العقد. يرجى المحاولة مرة أخرى.
730
+ <br>
731
+ تفاصيل الخطأ: ${error.message}
732
+ </div>
733
+ `;
734
+ console.error('Error:', error);
735
+ } finally {
736
+ button.textContent = 'إنشاء العقد';
737
+ button.disabled = false;
738
+ }
739
+ });
740
+
741
+ // وظيفة تنزيل الترجمة كملف PDF (باستخدام مكتبة jsPDF)
742
+ document.getElementById("downloadPDFButton").addEventListener("click", function() {
743
+ const { jsPDF } = window.jspdf;
744
+ const doc = new jsPDF({ orientation: "portrait", unit: "pt", format: "a4" });
745
+ const content = document.getElementById("translationResult").innerText;
746
+ if (!content.trim()) {
747
+ alert("لا يوجد نص للترجمة لتنزيله");
748
+ return;
749
+ }
750
+ doc.setFont("Tajawal", "normal");
751
+ doc.text(content, 40, 60, { maxWidth: 515 });
752
+ doc.save("translation.pdf");
753
+ });
754
+
755
+ // تهيئة الصفحة بالعرض الافتراضي للقسم "home"
756
+ document.addEventListener("DOMContentLoaded", () => {
757
+ showSection("home");
758
+ });
759
+ </script>
760
  </body>
761
+ </html>