SITE ENTIÈREMENT FICTIF — USAGE RÔLEPLAY UNIQUEMENT
Ce site est une création fictive à des fins récréatives dans le cadre d'un serveur de rôleplay. Il ne représente AUCUNE institution gouvernementale réelle. « San Andreas » est un État fictif.
SITE FICTIF — ROLEPLAY UNIQUEMENT — Document fictif sans valeur juridique réelle
DOJ
San Andreas — Département de Justice
Justice
AccueilCalendrier Judiciaire
DOJ
Cour de Justice Fédérale — San Andreas

Calendrier des Audiences

Planning officiel des procès, audiences préliminaires et délibérations

Accès administrateur :
Chargement...

Lun
Mar
Mer
Jeu
Ven
Sam
Dim
"; return html; } function downloadReport(a) { var html = buildReportHTML(a); var blob = new Blob([html], {type:"text/html;charset=utf-8"}); var link = document.createElement("a"); link.href = URL.createObjectURL(blob); link.download = "ordre_sécurité_" + (a.affaire||"audience").replace(/[^a-zA-Z0-9]/g,"_") + "_" + (a.date||"").replace(/-/g,"") + ".html"; link.click(); } // ===== DOWNLOAD MODAL ===== function closeDlModal() { document.getElementById("dlModalOverlay").classList.remove("open"); window._pendingReport = null; } function triggerDl(fmt) { var a = window._pendingReport; if (!a) return; if (fmt === "html" || fmt === "both") { downloadReport(a); } if (fmt === "png" || fmt === "both") { var btn = document.getElementById("pngBtn"); if (btn) { btn.textContent = "Génération PNG..."; btn.disabled = true; } generatePNG(a, function() { if (btn) { btn.innerHTML = "PNGImage prête à partager"; btn.disabled = false; } if (fmt === "png") closeDlModal(); }); if (fmt === "both") setTimeout(closeDlModal, 2000); } else if (fmt === "html") { setTimeout(closeDlModal, 800); } } function generatePNG(a, callback) { // Build the report HTML and inject it into hidden div var hiddenDiv = document.getElementById("reportHidden"); // Get the report HTML content (reuse downloadReport logic but return HTML string) var html = buildReportHTML(a); hiddenDiv.innerHTML = html; hiddenDiv.style.left = "-9999px"; hiddenDiv.style.display = "block"; // Give browser time to render setTimeout(function() { html2canvas(hiddenDiv, { scale: 2, useCORS: true, allowTaint: false, backgroundColor: "#ffffff", width: 960, windowWidth: 960, logging: false }).then(function(canvas) { canvas.toBlob(function(blob) { var link = document.createElement("a"); link.href = URL.createObjectURL(blob); link.download = "rapport_" + (a.affaire||"audience").replace(/[^a-zA-Z0-9]/g,"_") + "_" + (a.date||"").replace(/-/g,"") + ".png"; link.click(); hiddenDiv.innerHTML = ""; hiddenDiv.style.display = "none"; if (callback) callback(); }, "image/png"); }).catch(function(err) { hiddenDiv.innerHTML = ""; hiddenDiv.style.display = "none"; alert("Erreur PNG : " + err.message + "\nTéléchargement HTML à la place."); downloadReport(a); if (callback) callback(); }); }, 300); } // ===== RENDER LIST ===== function renderList() { var q = (document.getElementById("searchInp").value || "").toLowerCase(); var tf = document.getElementById("typeFilter").value; var sf = document.getElementById("statusFilter").value; var sorted = sortedAudiences(); var filtered = sorted.filter(function(a) { var matchQ = !q || [a.affaire,a.accuse,a.juge,a.proc,a.avo,a.salle,a.notes].join(" ").toLowerCase().includes(q); var matchT = !tf || a.type === tf; var matchS = !sf || a.statut === sf; return matchQ && matchT && matchS; }); var el = document.getElementById("listContainer"); if (filtered.length === 0) { el.innerHTML = '
Aucune audience trouvee.
'; return; } var html = ""; filtered.forEach(function(a) { var dp = a.date ? a.date.split("-") : ["","",""]; var mo = parseInt(dp[1]) > 0 ? MONTHS_FR[parseInt(dp[1])-1].substring(0,3).toUpperCase() : ""; var tc = typeClass(a.type); var sc = statusClass(a.statut); var cardCls = "audience-card " + tc; html += '
'; html += '
' + (dp[2]||"—") + '
' + mo + '
' + (a.heure||"") + '
'; html += '
'; html += '
' + (a.type||"—") + '
'; html += '
' + (a.affaire ? "Affaire " + a.affaire : "Audience") + (a.accuse ? " — " + a.accuse : "") + '
'; html += '
'; if (a.juge) html += 'Juge : ' + a.juge + ''; if (a.proc) html += 'Proc. : ' + a.proc + ''; if (a.avo) html += 'Défense : ' + a.avo + ''; if (a.salle) html += 'Salle : ' + a.salle + ''; if (a.secResponsable) html += 'Securite : ' + a.secResponsable + ''; if (a.nbRenforts && a.nbRenforts !== "0") html += 'Renforts : ' + a.nbRenforts + ' pers. — ' + (a.agencesRenfort||"—") + ''; html += '
'; if (a.notes) html += '
' + a.notes + '
'; html += '
'; html += '' + (a.statut||"—") + ''; if (isAdmin) { html += '
'; html += ''; html += ''; html += ''; html += '
'; } html += '
'; }); el.innerHTML = html; } // ===== RENDER CALENDAR ===== function renderCalendar() { document.getElementById("monthTitle").textContent = MONTHS_FR[currentMonth] + " " + currentYear; var grid = document.getElementById("calGrid"); // Remove old day cells var existing = grid.querySelectorAll(".cal-day"); existing.forEach(function(el) { el.remove(); }); var firstDay = new Date(currentYear, currentMonth, 1).getDay(); firstDay = firstDay === 0 ? 6 : firstDay - 1; var daysInMonth = new Date(currentYear, currentMonth + 1, 0).getDate(); var daysInPrev = new Date(currentYear, currentMonth, 0).getDate(); var today = new Date(); // Events indexed by date string var evMap = {}; audiences.forEach(function(a) { if (!a.date) return; evMap[a.date] = evMap[a.date] || []; evMap[a.date].push(a); }); // Prev month days for (var i = firstDay - 1; i >= 0; i--) { var d = daysInPrev - i; var cell = document.createElement("div"); cell.className = "cal-day other-month"; cell.innerHTML = '
' + d + '
'; grid.appendChild(cell); } // Current month days for (var d = 1; d <= daysInMonth; d++) { var cell = document.createElement("div"); var dateStr = currentYear + "-" + String(currentMonth+1).padStart(2,"0") + "-" + String(d).padStart(2,"0"); var isToday = today.getFullYear() === currentYear && today.getMonth() === currentMonth && today.getDate() === d; cell.className = "cal-day" + (isToday ? " today" : ""); var html = '
' + d + '
'; var evs = evMap[dateStr] || []; var shown = 0; evs.forEach(function(ev) { if (shown >= 3) return; html += '
' + (ev.heure ? ev.heure + ' ' : '') + (ev.type||"") + '
'; shown++; }); if (evs.length > 3) html += '
+' + (evs.length-3) + ' autre(s)
'; cell.innerHTML = html; grid.appendChild(cell); } // Next month days var total = firstDay + daysInMonth; var remaining = total % 7 === 0 ? 0 : 7 - (total % 7); for (var i = 1; i <= remaining; i++) { var cell = document.createElement("div"); cell.className = "cal-day other-month"; cell.innerHTML = '
' + i + '
'; grid.appendChild(cell); } } function changeMonth(dir) { currentMonth += dir; if (currentMonth > 11) { currentMonth = 0; currentYear++; } if (currentMonth < 0) { currentMonth = 11; currentYear--; } renderCalendar(); } // ===== SIDEBAR ===== function renderSidebar() { var today = new Date().toISOString().split("T")[0]; var upcoming = sortedAudiences().filter(function(a) { return a.date >= today && a.statut !== "Annulé"; }).slice(0,5); var ul = document.getElementById("upcomingList"); if (upcoming.length === 0) { ul.innerHTML = '
Aucune audience à venir
'; } else { ul.innerHTML = upcoming.map(function(a) { var tc = typeClass(a.type); return '
' + fmtDate(a.date) + ' ' + (a.heure||"") + '
' + (a.affaire||a.type||"Audience") + '
'; }).join(""); } document.getElementById("statTotal").textContent = audiences.length; document.getElementById("statProces").textContent = audiences.filter(function(a) { return a.type === "Procès"; }).length; document.getElementById("statConfirme").textContent = audiences.filter(function(a) { return a.statut === "Confirmé"; }).length; document.getElementById("statAttente").textContent = audiences.filter(function(a) { return a.statut === "En attente"; }).length; document.getElementById("statReporte").textContent = audiences.filter(function(a) { return a.statut === "Reporté"; }).length; } function renderAll() { renderList(); renderCalendar(); renderSidebar(); } // ===== TABS ===== function switchTab(tab) { document.querySelectorAll(".tab").forEach(function(t) { t.classList.remove("active"); }); document.querySelectorAll(".tab-panel").forEach(function(p) { p.classList.remove("active"); }); event.target.classList.add("active"); document.getElementById("tab-" + tab).classList.add("active"); } // ===== MODAL ===== function openModal(id) { editId = id || null; document.getElementById("modalTitle").textContent = id ? "Modifier l'Audience" : "Nouvelle Audience"; var a = id ? audiences.find(function(x) { return x.id === id; }) : null; document.getElementById("mDate").value = a ? (a.date||"") : ""; document.getElementById("mHeure").value = a ? (a.heure||"10:00") : "10:00"; document.getElementById("mType").value = a ? (a.type||"Procès") : "Procès"; document.getElementById("mStatut").value = a ? (a.statut||"Confirmé") : "Confirmé"; document.getElementById("mAffaire").value = a ? (a.affaire||"") : ""; document.getElementById("mAccuse").value = a ? (a.accuse||"") : ""; document.getElementById("mSalle").value = a ? (a.salle||"") : ""; document.getElementById("mJuge").value = a ? (a.juge||"") : ""; document.getElementById("mProc").value = a ? (a.proc||"") : ""; document.getElementById("mAvo").value = a ? (a.avo||"") : ""; document.getElementById("mSecResponsable").value = a ? (a.secResponsable||"") : ""; document.getElementById("mNbRenforts").value = a ? (a.nbRenforts||"2") : "2"; document.getElementById("mRenforts").value = a ? (a.renforts||"") : ""; document.getElementById("mNotes").value = a ? (a.notes||"") : ""; // Reset checkboxes ["rLSPD","rBCSO","rFBI","rDEA","rATF","rUSM"].forEach(function(id){ var el=document.getElementById(id); if(el){ var agencies = a ? (a.agencesRenfort||"") : ""; el.checked = agencies.includes(el.value); } }); document.getElementById("modalOverlay").classList.add("open"); } function closeModal() { document.getElementById("modalOverlay").classList.remove("open"); editId = null; } function getCheckedAgencies() { var ids = ["rLSPD","rBCSO","rFBI","rDEA","rATF","rUSM"]; var checked = []; ids.forEach(function(id) { var el=document.getElementById(id); if(el&&el.checked) checked.push(el.value); }); return checked.join(", "); } function saveAudience() { var d = document.getElementById("mDate").value; if (!d) { alert("Veuillez indiquer une date."); return; } var secResp = document.getElementById("mSecResponsable").value.trim(); if (!secResp) { if (!confirm("Aucun responsable sécurité renseigné. Continuer quand même ?")) return; } var a = { id: editId || String(Date.now()), date: d, heure: document.getElementById("mHeure").value, type: document.getElementById("mType").value, statut: document.getElementById("mStatut").value, affaire: document.getElementById("mAffaire").value, accuse: document.getElementById("mAccuse").value, salle: document.getElementById("mSalle").value, juge: document.getElementById("mJuge").value, proc: document.getElementById("mProc").value, avo: document.getElementById("mAvo").value, secResponsable: secResp, nbRenforts: document.getElementById("mNbRenforts").value || "0", agencesRenfort: getCheckedAgencies(), renforts: document.getElementById("mRenforts").value, notes: document.getElementById("mNotes").value }; if (editId) { var idx = audiences.findIndex(function(x) { return x.id === editId; }); if (idx >= 0) audiences[idx] = a; } else { audiences.push(a); } closeModal(); renderAll(); // Show download choice modal window._pendingReport = a; document.getElementById("dlModalOverlay").classList.add("open"); saveData(); } function editAudience(id) { openModal(id); } function deleteAudience(id) { if (!confirm("Supprimer cette audience ?")) return; audiences = audiences.filter(function(a) { return a.id !== id; }); renderAll(); } // ===== INIT ===== loadData();