Spaces:
Running
Running
Update reg.html
Browse files
reg.html
CHANGED
@@ -248,7 +248,11 @@
|
|
248 |
</div>
|
249 |
<div class="nav-link" data-section="precedents">
|
250 |
<i class="fas fa-gavel ml-3"></i>
|
251 |
-
<span>الأحكام
|
|
|
|
|
|
|
|
|
252 |
</div>
|
253 |
</nav>
|
254 |
</div>
|
@@ -265,14 +269,14 @@
|
|
265 |
<!-- قسم الرئيسية -->
|
266 |
<section id="home" class="section">
|
267 |
<h2 class="text-3xl font-bold text-gray-800 mb-8">الخدمات القانونية</h2>
|
|
|
268 |
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
|
269 |
-
<!-- بطاقات الخدمة -->
|
270 |
<div class="feature-card p-6">
|
271 |
<div class="text-center">
|
272 |
<i class="fas fa-balance-scale text-3xl mb-4 text-blue-600"></i>
|
273 |
<h3 class="text-xl font-bold text-gray-800 mb-3">التحليل القانوني</h3>
|
274 |
<p class="text-gray-600 mb-4">
|
275 |
-
تحليل متكامل للقضايا والمستندات القانونية باستخدام الذكاء
|
276 |
</p>
|
277 |
<button class="action-button" onclick="showSection('analysis')">ابدأ التحليل</button>
|
278 |
</div>
|
@@ -282,7 +286,7 @@
|
|
282 |
<i class="fas fa-project-diagram text-3xl mb-4 text-blue-600"></i>
|
283 |
<h3 class="text-xl font-bold text-gray-800 mb-3">خريطة التفكير</h3>
|
284 |
<p class="text-gray-600 mb-4">
|
285 |
-
نظم قضية بشكل
|
286 |
</p>
|
287 |
<button class="action-button" onclick="showSection('mindMap')">إنشاء خريطة التفكير</button>
|
288 |
</div>
|
@@ -292,7 +296,7 @@
|
|
292 |
<i class="fas fa-search text-3xl mb-4 text-blue-600"></i>
|
293 |
<h3 class="text-xl font-bold text-gray-800 mb-3">البحث القانوني</h3>
|
294 |
<p class="text-gray-600 mb-4">
|
295 |
-
ابحث عن معلومات قانونية مع برومبت ثابت يشمل منصات: منصة1، منصة2، منصة3
|
296 |
</p>
|
297 |
<button class="action-button" onclick="showSection('search')">ابدأ البحث</button>
|
298 |
</div>
|
@@ -302,7 +306,7 @@
|
|
302 |
<i class="fas fa-file-alt text-3xl mb-4 text-blue-600"></i>
|
303 |
<h3 class="text-xl font-bold text-gray-800 mb-3">المستندات</h3>
|
304 |
<p class="text-gray-600 mb-4">
|
305 |
-
|
306 |
</p>
|
307 |
<button class="action-button" onclick="showSection('documents')">إنشاء مستند</button>
|
308 |
</div>
|
@@ -312,7 +316,7 @@
|
|
312 |
<i class="fas fa-language text-3xl mb-4 text-blue-600"></i>
|
313 |
<h3 class="text-xl font-bold text-gray-800 mb-3">الترجمة القانونية</h3>
|
314 |
<p class="text-gray-600 mb-4">
|
315 |
-
ترجمة احترافية للوثائق القانونية مع إمكانية
|
316 |
</p>
|
317 |
<button class="action-button" onclick="showSection('translation')">ترجمة</button>
|
318 |
</div>
|
@@ -322,12 +326,45 @@
|
|
322 |
<i class="fas fa-comments text-3xl mb-4 text-blue-600"></i>
|
323 |
<h3 class="text-xl font-bold text-gray-800 mb-3">استشارة قانونية</h3>
|
324 |
<p class="text-gray-600 mb-4">
|
325 |
-
احصل على استشارة قانونية فورية من
|
326 |
</p>
|
327 |
<button class="action-button" onclick="showSection('consultation')">استشر الآن</button>
|
328 |
</div>
|
329 |
</div>
|
330 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
331 |
</section>
|
332 |
|
333 |
<!-- قسم التحليل القانوني -->
|
@@ -361,7 +398,7 @@
|
|
361 |
<section id="mindMap" class="section hidden">
|
362 |
<h2 class="text-3xl font-bold text-gray-800 mb-4">خريطة التفكير القانونية</h2>
|
363 |
<p class="mb-4 text-gray-700">
|
364 |
-
أدخل الأفكار والخيوط المتعددة لتنظيم القضية بطريقة إبداعية باستخدام منهجيات قوية مثل تحليل SWOT و5 خطوات لتحليل الأسباب الجذرية. ساعد نفسك
|
365 |
</p>
|
366 |
<div id="mindMapFields">
|
367 |
<div class="mb-4">
|
@@ -382,58 +419,25 @@
|
|
382 |
<div id="mindMapResult" class="mt-4 response-container mind-map-output"></div>
|
383 |
</section>
|
384 |
|
385 |
-
<!-- قسم
|
386 |
-
<section id="
|
387 |
-
<h2 class="text-3xl font-bold text-gray-800 mb-8"
|
388 |
<div class="input-group bg-white rounded p-6 shadow">
|
389 |
-
<textarea class="w-full p-3 border rounded" placeholder="
|
390 |
-
<
|
391 |
-
<
|
|
|
392 |
</div>
|
393 |
</section>
|
394 |
|
395 |
-
<!-- قسم
|
396 |
-
<section id="
|
397 |
-
<h2 class="text-3xl font-bold text-gray-800 mb-8"
|
398 |
<div class="input-group bg-white rounded p-6 shadow">
|
399 |
-
<
|
400 |
-
<
|
401 |
-
|
402 |
-
<div class="flex gap-4 my-4">
|
403 |
-
<select class="p-3 rounded border w-full" id="fromLang">
|
404 |
-
<option value="ar">العربية</option>
|
405 |
-
<option value="en">الإنجليزية</option>
|
406 |
-
<option value="de">الألمانية</option>
|
407 |
-
<option value="zh">الصينية</option>
|
408 |
-
<option value="fr">الفرنسية</option>
|
409 |
-
<option value="it">الإيطالية</option>
|
410 |
-
<option value="es">الإسبانية</option>
|
411 |
-
</select>
|
412 |
-
<select class="p-3 rounded border w-full" id="toLang">
|
413 |
-
<option value="en">الإنجليزية</option>
|
414 |
-
<option value="ar">العربية</option>
|
415 |
-
<option value="de">الألمانية</option>
|
416 |
-
<option value="zh">الصينية</option>
|
417 |
-
<option value="fr">الفرنسية</option>
|
418 |
-
<option value="it">الإيطالية</option>
|
419 |
-
<option value="es">الإسبانية</option>
|
420 |
-
</select>
|
421 |
</div>
|
422 |
-
<div class="flex gap-4">
|
423 |
-
<button class="action-button" onclick="handleSubmit('translation')">ترجمة</button>
|
424 |
-
<button id="downloadPDFButton" class="action-button">تنزيل الترجمة كملف PDF</button>
|
425 |
-
</div>
|
426 |
-
<div id="translationResult" class="mt-4 response-container"></div>
|
427 |
-
</div>
|
428 |
-
</section>
|
429 |
-
|
430 |
-
<!-- قسم الاستشارة القانونية -->
|
431 |
-
<section id="consultation" class="section hidden">
|
432 |
-
<h2 class="text-3xl font-bold text-gray-800 mb-8">استشارة قانونية</h2>
|
433 |
-
<div class="input-group bg-white rounded p-6 shadow">
|
434 |
-
<textarea class="w-full p-3 border rounded" placeholder="اكتب سؤالك القانوني هنا..."></textarea>
|
435 |
-
<button class="action-button mt-4" onclick="handleSubmit('consultation')">احصل على استشارة</button>
|
436 |
-
<div id="consultationResult" class="mt-4 response-container"></div>
|
437 |
</div>
|
438 |
</section>
|
439 |
|
@@ -530,7 +534,7 @@
|
|
530 |
// استخدام API كما كان سابقاً
|
531 |
const API_URL = 'https://g2mgow5tgbxsjy-7777.proxy.runpod.net/proxy/8000/chat';
|
532 |
|
533 |
-
// دالة الحصول على البادئة (prompt prefix) بناءً على القسم
|
534 |
function getPromptPrefix(section) {
|
535 |
switch(section) {
|
536 |
case 'analysis':
|
@@ -545,6 +549,9 @@
|
|
545 |
return 'قم بترجمة هذا النص القانوني: ';
|
546 |
case 'consultation':
|
547 |
return 'أحتاج استشارة قانونية في الموضوع التالي: ';
|
|
|
|
|
|
|
548 |
default:
|
549 |
return '';
|
550 |
}
|
@@ -557,7 +564,7 @@
|
|
557 |
const section = e.currentTarget.getAttribute("data-section");
|
558 |
if(section) {
|
559 |
showSection(section);
|
560 |
-
// إخفاء الشريط الجانبي على الأجهزة المحمولة
|
561 |
if(window.innerWidth < 768) {
|
562 |
document.querySelector(".sidebar").classList.remove("open");
|
563 |
}
|
@@ -601,17 +608,34 @@
|
|
601 |
// دالة إرسال الطلبات العامة لجميع الأقسام باستخدام API الموحد
|
602 |
async function handleSubmit(section) {
|
603 |
const container = document.getElementById(section);
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
610 |
}
|
611 |
-
|
612 |
-
message: getPromptPrefix(section) + text,
|
613 |
-
history: []
|
614 |
-
};
|
615 |
try {
|
616 |
resultDiv.innerHTML = '<div class="loading-spinner"></div>';
|
617 |
const response = await fetch(API_URL, {
|
@@ -619,7 +643,7 @@
|
|
619 |
headers: { "Content-Type": "application/json" },
|
620 |
body: JSON.stringify(payload)
|
621 |
});
|
622 |
-
if
|
623 |
throw new Error("Network response was not ok");
|
624 |
}
|
625 |
const data = await response.json();
|
@@ -657,7 +681,7 @@
|
|
657 |
document.querySelectorAll("#firstPartyID, #secondPartyID").forEach(input => {
|
658 |
input.addEventListener("input", function() {
|
659 |
this.value = this.value.replace(/[^0-9]/g, '');
|
660 |
-
if
|
661 |
this.value = this.value.slice(0, 14);
|
662 |
}
|
663 |
});
|
@@ -688,8 +712,6 @@
|
|
688 |
document.getElementById("generateButton").addEventListener("click", async function() {
|
689 |
const button = this;
|
690 |
const outputDiv = document.getElementById("contractOutput");
|
691 |
-
|
692 |
-
// جمع بيانات النموذج
|
693 |
const formData = {
|
694 |
contractTitle: document.getElementById("contractTitle").value.trim(),
|
695 |
contractDate: document.getElementById("contractDate").value,
|
@@ -706,12 +728,9 @@
|
|
706 |
contractPreamble: document.getElementById("contractPreamble").value.trim(),
|
707 |
contractTerms: document.getElementById("contractTerms").value.trim()
|
708 |
};
|
709 |
-
|
710 |
-
// التحقق من البيانات المطلوبة
|
711 |
const requiredFields = Object.keys(formData);
|
712 |
const missingFields = requiredFields.filter(field => !formData[field]);
|
713 |
-
|
714 |
-
if (missingFields.length > 0) {
|
715 |
outputDiv.innerHTML = `
|
716 |
<div class="text-red-500 font-bold mb-4">يرجى ملء جميع الحقول المطلوبة</div>
|
717 |
<ul class="list-disc list-inside text-red-500">
|
@@ -720,8 +739,6 @@
|
|
720 |
`;
|
721 |
return;
|
722 |
}
|
723 |
-
|
724 |
-
// تحديث واجهة المستخدم لحالة التحميل
|
725 |
button.textContent = 'جاري إنشاء العقد...';
|
726 |
button.disabled = true;
|
727 |
outputDiv.innerHTML = `
|
@@ -730,17 +747,13 @@
|
|
730 |
<span>جاري إنشاء العقد باستخدام الذكاء الاصطناعي...</span>
|
731 |
</div>
|
732 |
`;
|
733 |
-
|
734 |
try {
|
735 |
-
// تحويل التاريخ إلى التنسيق العربي
|
736 |
const dateObj = new Date(formData.contractDate);
|
737 |
const arabicDate = new Intl.DateTimeFormat('ar-EG', {
|
738 |
year: 'numeric',
|
739 |
month: 'long',
|
740 |
day: 'numeric'
|
741 |
}).format(dateObj);
|
742 |
-
|
743 |
-
// إنشاء نص الطلب
|
744 |
const prompt = `قم بإنشاء عقد قانوني مصري رسمي باللغة العربية يتضمن البيانات التالية:
|
745 |
|
746 |
عنوان العقد: ${formData.contractTitle}
|
@@ -771,27 +784,17 @@ ${formData.contractTerms}
|
|
771 |
2. بند حكم التمهيد يوضح أن التمهيد جزء لا يتجزأ من العقد
|
772 |
3. تنسيق قانوني رسمي
|
773 |
4. مكان للتوقيع في النهاية مع كتابة "طرف أول" و "طرف ثاني"`;
|
774 |
-
|
775 |
-
// إرسال الطلب إلى API الخاص بالعقود
|
776 |
const response = await fetch(API_URL, {
|
777 |
method: 'POST',
|
778 |
-
headers: {
|
779 |
-
|
780 |
-
},
|
781 |
-
body: JSON.stringify({
|
782 |
-
message: prompt,
|
783 |
-
history: []
|
784 |
-
})
|
785 |
});
|
786 |
-
|
787 |
-
if (!response.ok) {
|
788 |
throw new Error(`HTTP error! status: ${response.status}`);
|
789 |
}
|
790 |
-
|
791 |
const data = await response.json();
|
792 |
outputDiv.innerHTML = `<div dir="rtl" style="white-space: pre-wrap;">${data.response}</div>`;
|
793 |
-
|
794 |
-
} catch (error) {
|
795 |
outputDiv.innerHTML = `
|
796 |
<div class="text-red-600 font-bold">
|
797 |
عذراً، حدث خطأ في إنشاء العقد. يرجى المحاولة مرة أخرى.
|
@@ -804,14 +807,14 @@ ${formData.contractTerms}
|
|
804 |
button.textContent = 'إنشاء العقد';
|
805 |
button.disabled = false;
|
806 |
}
|
807 |
-
}
|
808 |
|
809 |
// وظيفة تنزيل الترجمة كملف PDF (باستخدام مكتبة jsPDF)
|
810 |
document.getElementById("downloadPDFButton").addEventListener("click", function() {
|
811 |
const { jsPDF } = window.jspdf;
|
812 |
const doc = new jsPDF({ orientation: "portrait", unit: "pt", format: "a4" });
|
813 |
const content = document.getElementById("translationResult").innerText;
|
814 |
-
if
|
815 |
alert("لا يوجد نص للترجمة لتنزيله");
|
816 |
return;
|
817 |
}
|
@@ -825,7 +828,7 @@ ${formData.contractTerms}
|
|
825 |
const { jsPDF } = window.jspdf;
|
826 |
const doc = new jsPDF({ orientation: "portrait", unit: "pt", format: "a4" });
|
827 |
const content = document.getElementById("analysisResult").innerText;
|
828 |
-
if
|
829 |
alert("لا يوجد نص للتحليل لتنزيله");
|
830 |
return;
|
831 |
}
|
@@ -854,7 +857,7 @@ ${formData.contractTerms}
|
|
854 |
collectedText += `الخيط ${index + 1}: ${value}\n`;
|
855 |
}
|
856 |
});
|
857 |
-
if
|
858 |
alert("الرجاء إدخال بعض الأفكار لإنشاء خريطة التفكير");
|
859 |
return;
|
860 |
}
|
@@ -877,6 +880,19 @@ ${formData.contractTerms}
|
|
877 |
});
|
878 |
}
|
879 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
880 |
// تهيئة الصفحة بالعرض الافتراضي للقسم "home"
|
881 |
document.addEventListener("DOMContentLoaded", () => {
|
882 |
showSection("home");
|
|
|
248 |
</div>
|
249 |
<div class="nav-link" data-section="precedents">
|
250 |
<i class="fas fa-gavel ml-3"></i>
|
251 |
+
<span>الأحكام والقوانين</span>
|
252 |
+
</div>
|
253 |
+
<div class="nav-link" data-section="latestUpdates">
|
254 |
+
<i class="fas fa-newspaper ml-3"></i>
|
255 |
+
<span>آخر التحديثات</span>
|
256 |
</div>
|
257 |
</nav>
|
258 |
</div>
|
|
|
269 |
<!-- قسم الرئيسية -->
|
270 |
<section id="home" class="section">
|
271 |
<h2 class="text-3xl font-bold text-gray-800 mb-8">الخدمات القانونية</h2>
|
272 |
+
<!-- أول مجموعة (الخدمات الأساسية) -->
|
273 |
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
|
|
|
274 |
<div class="feature-card p-6">
|
275 |
<div class="text-center">
|
276 |
<i class="fas fa-balance-scale text-3xl mb-4 text-blue-600"></i>
|
277 |
<h3 class="text-xl font-bold text-gray-800 mb-3">التحليل القانوني</h3>
|
278 |
<p class="text-gray-600 mb-4">
|
279 |
+
تحليل متكامل للقضايا والمستندات القانونية باستخدام الذكاء الاصطناعي.
|
280 |
</p>
|
281 |
<button class="action-button" onclick="showSection('analysis')">ابدأ التحليل</button>
|
282 |
</div>
|
|
|
286 |
<i class="fas fa-project-diagram text-3xl mb-4 text-blue-600"></i>
|
287 |
<h3 class="text-xl font-bold text-gray-800 mb-3">خريطة التفكير</h3>
|
288 |
<p class="text-gray-600 mb-4">
|
289 |
+
نظم قضية بشكل إبداعي باستخدام خطوات منهجية قوية.
|
290 |
</p>
|
291 |
<button class="action-button" onclick="showSection('mindMap')">إنشاء خريطة التفكير</button>
|
292 |
</div>
|
|
|
296 |
<i class="fas fa-search text-3xl mb-4 text-blue-600"></i>
|
297 |
<h3 class="text-xl font-bold text-gray-800 mb-3">البحث القانوني</h3>
|
298 |
<p class="text-gray-600 mb-4">
|
299 |
+
ابحث عن معلومات قانونية مع برومبت ثابت يشمل منصات: منصة1، منصة2، منصة3.
|
300 |
</p>
|
301 |
<button class="action-button" onclick="showSection('search')">ابدأ البحث</button>
|
302 |
</div>
|
|
|
306 |
<i class="fas fa-file-alt text-3xl mb-4 text-blue-600"></i>
|
307 |
<h3 class="text-xl font-bold text-gray-800 mb-3">المستندات</h3>
|
308 |
<p class="text-gray-600 mb-4">
|
309 |
+
أنشئ وحرر المستندات القانونية بسهولة.
|
310 |
</p>
|
311 |
<button class="action-button" onclick="showSection('documents')">إنشاء مستند</button>
|
312 |
</div>
|
|
|
316 |
<i class="fas fa-language text-3xl mb-4 text-blue-600"></i>
|
317 |
<h3 class="text-xl font-bold text-gray-800 mb-3">الترجمة القانونية</h3>
|
318 |
<p class="text-gray-600 mb-4">
|
319 |
+
ترجمة احترافية للوثائق القانونية مع إمكانية التنزيل كملف PDF.
|
320 |
</p>
|
321 |
<button class="action-button" onclick="showSection('translation')">ترجمة</button>
|
322 |
</div>
|
|
|
326 |
<i class="fas fa-comments text-3xl mb-4 text-blue-600"></i>
|
327 |
<h3 class="text-xl font-bold text-gray-800 mb-3">استشارة قانونية</h3>
|
328 |
<p class="text-gray-600 mb-4">
|
329 |
+
احصل على استشارة قانونية فورية من الخبراء.
|
330 |
</p>
|
331 |
<button class="action-button" onclick="showSection('consultation')">استشر الآن</button>
|
332 |
</div>
|
333 |
</div>
|
334 |
</div>
|
335 |
+
<!-- مجموعة الخدمات الإضافية -->
|
336 |
+
<div class="mt-8">
|
337 |
+
<h2 class="text-2xl font-bold text-gray-800 mb-4">خدمات إضافية</h2>
|
338 |
+
<div class="grid grid-cols-1 md:grid-cols-3 gap-6">
|
339 |
+
<!-- الأعمال الإدارية -->
|
340 |
+
<div class="feature-card p-6">
|
341 |
+
<div class="text-center">
|
342 |
+
<i class="fas fa-cogs text-3xl mb-4 text-blue-600"></i>
|
343 |
+
<h3 class="text-xl font-bold text-gray-800 mb-3">الأعمال الإدارية</h3>
|
344 |
+
<p class="text-gray-600 mb-4">الوصول إلى أدوات الإدارة المتقدمة.</p>
|
345 |
+
<button class="action-button" onclick="window.location.href='admin.html'">الأعمال الإدارية</button>
|
346 |
+
</div>
|
347 |
+
</div>
|
348 |
+
<!-- مقارنة النصوص القانونية -->
|
349 |
+
<div class="feature-card p-6">
|
350 |
+
<div class="text-center">
|
351 |
+
<i class="fas fa-exchange-alt text-3xl mb-4 text-blue-600"></i>
|
352 |
+
<h3 class="text-xl font-bold text-gray-800 mb-3">مقارنة النصوص القانونية</h3>
|
353 |
+
<p class="text-gray-600 mb-4">قارن بين نصين قانونيين بسهولة.</p>
|
354 |
+
<button class="action-button" onclick="showSection('precedents')">مقارنة النصوص</button>
|
355 |
+
</div>
|
356 |
+
</div>
|
357 |
+
<!-- آخر التحديثات القانونية -->
|
358 |
+
<div class="feature-card p-6">
|
359 |
+
<div class="text-center">
|
360 |
+
<i class="fas fa-newspaper text-3xl mb-4 text-blue-600"></i>
|
361 |
+
<h3 class="text-xl font-bold text-gray-800 mb-3">آخر التحديثات القانونية في مصر</h3>
|
362 |
+
<p class="text-gray-600 mb-4">تابع أحدث الأخبار القانونية.</p>
|
363 |
+
<button class="action-button" onclick="showSection('latestUpdates')">آخر التحديثات</button>
|
364 |
+
</div>
|
365 |
+
</div>
|
366 |
+
</div>
|
367 |
+
</div>
|
368 |
</section>
|
369 |
|
370 |
<!-- قسم التحليل القانوني -->
|
|
|
398 |
<section id="mindMap" class="section hidden">
|
399 |
<h2 class="text-3xl font-bold text-gray-800 mb-4">خريطة التفكير القانونية</h2>
|
400 |
<p class="mb-4 text-gray-700">
|
401 |
+
أدخل الأفكار والخيوط المتعددة لتنظيم القضية بطريقة إبداعية باستخدام منهجيات قوية مثل تحليل SWOT و5 خطوات لتحليل الأسباب الجذرية. ساعد نفسك على التفكير مع النموذج.
|
402 |
</p>
|
403 |
<div id="mindMapFields">
|
404 |
<div class="mb-4">
|
|
|
419 |
<div id="mindMapResult" class="mt-4 response-container mind-map-output"></div>
|
420 |
</section>
|
421 |
|
422 |
+
<!-- قسم مقارنة النصوص القانونية -->
|
423 |
+
<section id="precedents" class="section hidden">
|
424 |
+
<h2 class="text-3xl font-bold text-gray-800 mb-8">مقارنة النصوص القانونية</h2>
|
425 |
<div class="input-group bg-white rounded p-6 shadow">
|
426 |
+
<textarea class="w-full p-3 border rounded mb-4" placeholder="أدخل النص القانوني الأول للمقارنة..."></textarea>
|
427 |
+
<textarea class="w-full p-3 border rounded mb-4" placeholder="أدخل النص القانوني الثاني للمقارنة..."></textarea>
|
428 |
+
<button class="action-button" onclick="handleSubmit('precedents')">مقارنة النصوص القانونية</button>
|
429 |
+
<div id="precedentsResult" class="mt-4 response-container"></div>
|
430 |
</div>
|
431 |
</section>
|
432 |
|
433 |
+
<!-- قسم آخر التحديثات القانونية في مصر -->
|
434 |
+
<section id="latestUpdates" class="section hidden">
|
435 |
+
<h2 class="text-3xl font-bold text-gray-800 mb-8">آخر التحديثات القانونية في مصر</h2>
|
436 |
<div class="input-group bg-white rounded p-6 shadow">
|
437 |
+
<button class="action-button" onclick="fetchLatestUpdates()">عرض آخر التحديثات</button>
|
438 |
+
<div id="latestUpdatesResult" class="mt-4 response-container">
|
439 |
+
<!-- سيتم تعبئتها بأحدث الأخبار -->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
440 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
441 |
</div>
|
442 |
</section>
|
443 |
|
|
|
534 |
// استخدام API كما كان سابقاً
|
535 |
const API_URL = 'https://g2mgow5tgbxsjy-7777.proxy.runpod.net/proxy/8000/chat';
|
536 |
|
537 |
+
// دالة الحصول على البادئة (prompt prefix) بناءً على القسم
|
538 |
function getPromptPrefix(section) {
|
539 |
switch(section) {
|
540 |
case 'analysis':
|
|
|
549 |
return 'قم بترجمة هذا النص القانوني: ';
|
550 |
case 'consultation':
|
551 |
return 'أحتاج استشارة قانونية في الموضوع التالي: ';
|
552 |
+
case 'precedents':
|
553 |
+
// سيتم التعامل مع حالة المقارنة في handleSubmit
|
554 |
+
return '';
|
555 |
default:
|
556 |
return '';
|
557 |
}
|
|
|
564 |
const section = e.currentTarget.getAttribute("data-section");
|
565 |
if(section) {
|
566 |
showSection(section);
|
567 |
+
// إخفاء الشريط الجانبي على الأجهزة المحمولة
|
568 |
if(window.innerWidth < 768) {
|
569 |
document.querySelector(".sidebar").classList.remove("open");
|
570 |
}
|
|
|
608 |
// دالة إرسال الطلبات العامة لجميع الأقسام باستخدام API الموحد
|
609 |
async function handleSubmit(section) {
|
610 |
const container = document.getElementById(section);
|
611 |
+
let payload = { message: "", history: [] };
|
612 |
+
let resultDiv = container.querySelector(".response-container");
|
613 |
+
|
614 |
+
// حالة خاصة لقسم المقارنة (precedents)
|
615 |
+
if(section === "precedents") {
|
616 |
+
const textareas = container.querySelectorAll("textarea");
|
617 |
+
if(textareas.length < 2) {
|
618 |
+
alert("الرجاء إدخال كلا النصين للمقارنة");
|
619 |
+
return;
|
620 |
+
}
|
621 |
+
const text1 = textareas[0].value.trim();
|
622 |
+
const text2 = textareas[1].value.trim();
|
623 |
+
if(!text1 || !text2) {
|
624 |
+
alert("الرجاء إدخال كلا النصين للمقارنة");
|
625 |
+
return;
|
626 |
+
}
|
627 |
+
payload.message = "قم بمقارنة النصين القانونيين التاليين:\nالنص الأول: " + text1 + "\nالنص الثاني: " + text2;
|
628 |
+
} else {
|
629 |
+
// باقي الأقسام
|
630 |
+
const textarea = container.querySelector("textarea");
|
631 |
+
const text = textarea.value.trim();
|
632 |
+
if(!text) {
|
633 |
+
alert("الرجاء إدخال نص");
|
634 |
+
return;
|
635 |
+
}
|
636 |
+
payload.message = getPromptPrefix(section) + text;
|
637 |
}
|
638 |
+
|
|
|
|
|
|
|
639 |
try {
|
640 |
resultDiv.innerHTML = '<div class="loading-spinner"></div>';
|
641 |
const response = await fetch(API_URL, {
|
|
|
643 |
headers: { "Content-Type": "application/json" },
|
644 |
body: JSON.stringify(payload)
|
645 |
});
|
646 |
+
if(!response.ok) {
|
647 |
throw new Error("Network response was not ok");
|
648 |
}
|
649 |
const data = await response.json();
|
|
|
681 |
document.querySelectorAll("#firstPartyID, #secondPartyID").forEach(input => {
|
682 |
input.addEventListener("input", function() {
|
683 |
this.value = this.value.replace(/[^0-9]/g, '');
|
684 |
+
if(this.value.length > 14) {
|
685 |
this.value = this.value.slice(0, 14);
|
686 |
}
|
687 |
});
|
|
|
712 |
document.getElementById("generateButton").addEventListener("click", async function() {
|
713 |
const button = this;
|
714 |
const outputDiv = document.getElementById("contractOutput");
|
|
|
|
|
715 |
const formData = {
|
716 |
contractTitle: document.getElementById("contractTitle").value.trim(),
|
717 |
contractDate: document.getElementById("contractDate").value,
|
|
|
728 |
contractPreamble: document.getElementById("contractPreamble").value.trim(),
|
729 |
contractTerms: document.getElementById("contractTerms").value.trim()
|
730 |
};
|
|
|
|
|
731 |
const requiredFields = Object.keys(formData);
|
732 |
const missingFields = requiredFields.filter(field => !formData[field]);
|
733 |
+
if(missingFields.length > 0) {
|
|
|
734 |
outputDiv.innerHTML = `
|
735 |
<div class="text-red-500 font-bold mb-4">يرجى ملء جميع الحقول المطلوبة</div>
|
736 |
<ul class="list-disc list-inside text-red-500">
|
|
|
739 |
`;
|
740 |
return;
|
741 |
}
|
|
|
|
|
742 |
button.textContent = 'جاري إنشاء العقد...';
|
743 |
button.disabled = true;
|
744 |
outputDiv.innerHTML = `
|
|
|
747 |
<span>جاري إنشاء العقد باستخدام الذكاء الاصطناعي...</span>
|
748 |
</div>
|
749 |
`;
|
|
|
750 |
try {
|
|
|
751 |
const dateObj = new Date(formData.contractDate);
|
752 |
const arabicDate = new Intl.DateTimeFormat('ar-EG', {
|
753 |
year: 'numeric',
|
754 |
month: 'long',
|
755 |
day: 'numeric'
|
756 |
}).format(dateObj);
|
|
|
|
|
757 |
const prompt = `قم بإنشاء عقد قانوني مصري رسمي باللغة العربية يتضمن البيانات التالية:
|
758 |
|
759 |
عنوان العقد: ${formData.contractTitle}
|
|
|
784 |
2. بند حكم التمهيد يوضح أن التمهيد جزء لا يتجزأ من العقد
|
785 |
3. تنسيق قانوني رسمي
|
786 |
4. مكان للتوقيع في النهاية مع كتابة "طرف أول" و "طرف ثاني"`;
|
|
|
|
|
787 |
const response = await fetch(API_URL, {
|
788 |
method: 'POST',
|
789 |
+
headers: { 'Content-Type': 'application/json' },
|
790 |
+
body: JSON.stringify({ message: prompt, history: [] })
|
|
|
|
|
|
|
|
|
|
|
791 |
});
|
792 |
+
if(!response.ok) {
|
|
|
793 |
throw new Error(`HTTP error! status: ${response.status}`);
|
794 |
}
|
|
|
795 |
const data = await response.json();
|
796 |
outputDiv.innerHTML = `<div dir="rtl" style="white-space: pre-wrap;">${data.response}</div>`;
|
797 |
+
} catch(error) {
|
|
|
798 |
outputDiv.innerHTML = `
|
799 |
<div class="text-red-600 font-bold">
|
800 |
عذراً، حدث خطأ في إنشاء العقد. يرجى المحاولة مرة أخرى.
|
|
|
807 |
button.textContent = 'إنشاء العقد';
|
808 |
button.disabled = false;
|
809 |
}
|
810 |
+
}
|
811 |
|
812 |
// وظيفة تنزيل الترجمة كملف PDF (باستخدام مكتبة jsPDF)
|
813 |
document.getElementById("downloadPDFButton").addEventListener("click", function() {
|
814 |
const { jsPDF } = window.jspdf;
|
815 |
const doc = new jsPDF({ orientation: "portrait", unit: "pt", format: "a4" });
|
816 |
const content = document.getElementById("translationResult").innerText;
|
817 |
+
if(!content.trim()) {
|
818 |
alert("لا يوجد نص للترجمة لتنزيله");
|
819 |
return;
|
820 |
}
|
|
|
828 |
const { jsPDF } = window.jspdf;
|
829 |
const doc = new jsPDF({ orientation: "portrait", unit: "pt", format: "a4" });
|
830 |
const content = document.getElementById("analysisResult").innerText;
|
831 |
+
if(!content.trim()) {
|
832 |
alert("لا يوجد نص للتحليل لتنزيله");
|
833 |
return;
|
834 |
}
|
|
|
857 |
collectedText += `الخيط ${index + 1}: ${value}\n`;
|
858 |
}
|
859 |
});
|
860 |
+
if(!collectedText.trim()) {
|
861 |
alert("الرجاء إدخال بعض الأفكار لإنشاء خريطة التفكير");
|
862 |
return;
|
863 |
}
|
|
|
880 |
});
|
881 |
}
|
882 |
|
883 |
+
// وظيفة جلب آخر التحديثات القانونية (محاكاة)
|
884 |
+
function fetchLatestUpdates() {
|
885 |
+
const resultDiv = document.getElementById("latestUpdatesResult");
|
886 |
+
resultDiv.innerHTML = '<div class="loading-spinner"></div>';
|
887 |
+
setTimeout(() => {
|
888 |
+
resultDiv.innerHTML = `<p>آخر التحديثات القانونية في مصر:<br>
|
889 |
+
- تحديث 1: نص الخبر الأول.<br>
|
890 |
+
- تحديث 2: نص الخبر الثاني.<br>
|
891 |
+
- تحديث 3: نص الخبر الثالث.
|
892 |
+
</p>`;
|
893 |
+
}, 1000);
|
894 |
+
}
|
895 |
+
|
896 |
// تهيئة الصفحة بالعرض الافتراضي للقسم "home"
|
897 |
document.addEventListener("DOMContentLoaded", () => {
|
898 |
showSection("home");
|