How Senior Advocates Analyze a Criminal Case File | EduLaw Advocate Playbook
EduLaw EditorialAdvocate PlaybookA practical step-by-step playbook on how senior advocates analyze a criminal case file — FIR, chargesheet, witness statements, contradictions, bail grounds, evidence gaps and trial strategy under BNSS. For lawyers, law students and legal researchers.
Home › Advocate Playbook › Analyzing a Criminal Case File EduLaw Advocate Playbook · Criminal Litigation How Senior Advocates Analyze a Criminal Case File: The Complete Criminal Litigation Playbook From FIR to chargesheet, witness statements, contradictions, bail grounds, evidence gaps and trial strategy — this is how a criminal case file is actually broken down. At a Glance Best For Young advocates, law students, legal interns and litigation teams Time Required 45 to 90 minutes for a first structured reading Core Documents FIR, complaint, arrest memo, remand papers, chargesheet, statements, seizure panchanama, medical and forensic reports, orders Output Case theory, contradiction chart, bail grounds, evidence gaps and trial issues On This Page Quick Summary Table The Senior Advocate Mindset Start With the FIR Build a Chronology Identify the Prosecution Theory Make a Document Index Read Witnesses Like a Cross-Examiner Separate Facts From Evidence Find Contradictions Arrest and Remand Papers Recovery and Seizure Medical and Forensic Evidence Digital Evidence Find Bail Grounds Create the Defence Theory Prepare Court Notes One-Page Strategy Sheet Example Case Study Common Mistakes Final Checklist FAQ Most files are lost before a single word is spoken in court — not because the law was against the accused, but because nobody read the file properly. A senior advocate reads a criminal case file the way an engineer reads a faulty machine: methodically, looking for the joint that will give way under pressure. This is that method, set out step by step, grounded in current Indian criminal procedure under the Bharatiya Nagarik Suraksha Sanhita, 2023 (BNSS) and the Bharatiya Sakshya Adhiniyam, 2023 (BSA) , both in force since 1 July 2024. Quick Summary Table Use this as a one-screen map of the whole file. Each component carries its own questions, its own purpose, and its own red flags. File Component What to Check Why It Matters Red Flags FIR Date/time of incident vs registration, place, named accused, sections, role attribution Sets the prosecution version and fixes it on record Unexplained delay, vague roles, "all accused" omnibus allegations Arrest Memo Grounds of arrest, time, witnesses, intimation to family, medical exam Tests legality of detention under Sec 35 & 47 BNSS No grounds furnished, no independent witness, no intimation Remand Application Reasons for custody, what is to be recovered, magistrate's order Shows whether custody was reasoned or mechanical Copy-paste reasons, no application of mind in order Chargesheet Final report under Sec 193 BNSS, evidence list, sections charged The actual case the prosecution must prove Charges beyond evidence, missing documents, late filing Witness Statements Sec 180 BNSS statements; what is seen, when recorded, relationship Backbone of oral evidence at trial Delayed recording, interested witnesses, parroted versions Medical Evidence Injury/PM report, nature of injuries, weapon compatibility, timing Can confirm or destroy oral testimony Injuries inconsistent with alleged assault or weapon CDR / CCTV / Digital Source, hash value, Sec 63 BSA certificate, continuity Often the most objective evidence in the file No certificate, clipped footage, broken chain of custody Recovery / Seizure Panch witnesses, place, description, link to accused Connects accused to weapon or stolen property Open place, stock panch witnesses, vague description Forensic Reports FSL, DNA, ballistics, fingerprints, toxicology Scientific link between accused, victim and scene No match, "result inconclusive", late dispatch of samples Previous Orders Bail orders, remand orders, co-accused orders Reveals parity and what courts have already noted Co-accused on identical facts already on bail The Senior Advocate Mindset A senior advocate does not read a criminal file like a story. They read it like a system — a structure that can be tested, stressed and broken. Where a junior reads to learn "what happened", a senior reads to discover what can be made to fall apart in court. Seven questions run silently through the whole reading: What is alleged? — The bare prosecution claim. What is proved? — The claim minus everything unsupported by admissible material. What is missing? — The evidence that should exist if the allegation were true. What is exaggerated? — Where the narrative outruns the documents. What is legally inadmissible? — Confessions to police, uncertified electronic records, hearsay. What creates reasonable doubt? — Every gap, contradiction and impossibility. What helps bail and what damages the prosecution? — The leverage points. Never ask only: "What happened?" Ask: "What can be proved in court?" Step 1 Start With the FIR — But Do Not Trust It Blindly The FIR (recorded under Section 173 BNSS for a cognizable offence) is the starting point of the prosecution version, not its proof. It is the first opportunity for the prosecution to commit to a story, and the first opportunity for the defence to lock that story down before it is improved. Read it for the following, in this order: Date and time of the incident versus the date and time the FIR was registered — the gap between them is the single most powerful early test. Delay in registration and whether any explanation appears on the face of the FIR. Place of occurrence — is it precise, and is it consistent with later documents? Named accused versus unknown accused — was the informant able to name the accused at the first instance, or did names appear later? Exact allegations and sections invoked — and whether the sections match the facts narrated. Role attribution — is each accused given a specific act, or is everyone bundled together? Improvements later — compare the FIR to the Section 180 BNSS statements to catch additions. Worked Example If the FIR says "all accused assaulted the complainant" but the chargesheet later assigns specific overt acts only to two of five accused, that difference is a defence point for the remaining three — there is no specific role, only an omnibus allegation that the investigation itself could not sustain. FIR Delay Calculator Calculate the gap between the alleged incident and FIR registration. Delay by itself is not fatal, but unexplained delay is a recognised ground of suspicion. Date & time of incident Date & time of FIR registration Calculate Delay Step 2 Build a Chronology Before Building Arguments Senior advocates make a timeline before they make a single submission. A chronology turns scattered dates across hundreds of pages into a straight line on which gaps and impossibilities become visible. A medical record timed before the alleged incident, or a recovery shown weeks after arrest, only becomes obvious on a timeline. A typical criminal chronology runs: incident alleged → FIR registered → accused arrested → police custody sought → recovery shown → witness statements recorded → medical / forensic report received → chargesheet filed → bail rejected or allowed. Timeline Builder Add each event with its date. The page will arrange them into a clean visual timeline you can screenshot for your file note. + Add Event Build Timeline Step 3 Identify the Prosecution Theory Every criminal case has a story the prosecution intends to tell. The job is to extract that exact story, reduce it to its load-bearing elements, and then test each element against the record. If you cannot state the prosecution theory in three sentences, you have not finished reading. Break it into nine components and ask, for each, whether it is supported by independent material or only by suspicion: Motive Why would the accused do this? Presence Was the accused at the scene? Role What specific act is attributed? Weapon / Method How was it allegedly done? Injury / Loss What harm resulted? Witness Support Who claims to have seen it? Recovery What was seized and from whom? Digital Support CCTV, CDR, location data? Forensic Support DNA, FSL, ballistics? Worked Example In a murder case, if the prosecution says the accused was present at the scene, check whether presence is established by an independent eyewitness, CDR location, CCTV or recovery — or whether "presence" rests only on the suspicion of an interested witness. The strength of the theory is the strength of its weakest supported pillar. Step 4 Make a Document Index Never read a chargesheet randomly. The first physical act on receiving the file is to build a document index — a single page that tells you what exists, where it sits, who authored it, and which side it helps. Every later submission then carries a page reference, which is what separates an advocate from a storyteller. Document Name Page No. Date Author Supports Prosecution? Helps Defence? Notes FIR 1–3 — Informant / IO Yes Delay point Check time gap Arrest Memo — — IO Neutral Legality Grounds furnished? Statement of PW-1 — — IO (Sec 180) Yes Contradicts medical? Interested witness? Seizure Memo — — IO Yes Open place Panch witnesses? FSL Report — — FSL ? If no match Sample dispatch date In-Page Document Index Checklist Tick each document as you locate it in the file. The bar tracks how complete your index is. FIR located and paginated Complaint / written report Arrest memo and grounds of arrest Remand application and orders All Section 180 BNSS witness statements Seizure / recovery panchanamas Medical and post-mortem reports Forensic / FSL / DNA reports Digital evidence and Sec 63 BSA certificates Previous bail and co-accused orders 0 of 10 indexed Step 5 Read Witness Statements Like a Cross-Examiner Do not only read what a witness says. Read what they could not have seen, when their statement was recorded, and whether the account grows with each telling. Statements recorded under Section 180 BNSS are not substantive evidence, but they are the raw material for contradiction — and contradiction is where cross-examination lives. For each witness, ask: what did they see, what did they fail to see, when was the statement recorded, are they related or interested, does the statement improve upon the FIR, and does it contradict the medical or forensic record? Witness Reliability Scorecard Tick every red flag that applies to this witness. Each tick is flagged as a potential cross-examination area. Delay in recording the statement Interested or related witness Indirect / hearsay witness Statement improves upon the FIR Contradicts another witness Contradicts medical evidence Prior enmity with the accused Unnatural conduct at the scene Generate Cross-Examination Areas Step 6 Separate Facts From Evidence Facts alleged are not the same as facts proved. An allegation in the FIR is a claim; it becomes a fact only when admissible evidence supports it. The discipline of putting each allegation beside its supporting and missing evidence is what converts a vague sense of weakness into a precise argument. Allegation Supporting Evidence Missing Evidence Defence Use Accused used a knife Recovery panchanama Fingerprints, blood match, independent witness Recovery may be challenged as unlinked to the accused Accused present at scene Statement of related witness CCTV, CDR, independent eyewitness Presence rests only on interested testimony Accused fled after the act Police narrative Any witness to the flight Unsupported embellishment Step 7 Find Contradictions Contradictions are the currency of criminal defence. They fall into recognisable types: FIR versus statement, statement versus statement, statement versus medical evidence, statement versus CCTV or CDR, police version versus seizure document, timeline contradictions, and role contradictions. Each one should be captured with both sources cited so it can be put to the witness in the box. Source 1 Source 2 Contradiction Legal Use Bail / Trial Relevance FIR — assault at 9:00 PM Hospital record — patient admitted 7:45 PM Injury recorded before the alleged incident Timeline impossibility Strong at both bail and trial PW-1 — three blows with knife Medical report — one simple injury Severity does not match injuries Exaggeration of the offence Reduces gravity for bail PW-2 — accused alone FIR — four accused together Number of assailants differs Role / presence doubt Parity and identity at trial Sample Contradiction The FIR records the assault at 9:00 PM. The medical record shows the injured reached hospital at 7:45 PM. A person cannot be treated for an injury before it occurs — this single timeline inconsistency can unsettle the entire prosecution version. Step 8 Analyze Arrest and Remand Papers Senior advocates check whether the arrest was necessary and legally justified, not merely whether it happened. Under the BNSS, an arrested person must be informed of the grounds of arrest under Section 47, and Section 35 governs when arrest is even permissible — for offences punishable up to seven years, arrest is the exception, not the rule. The Supreme Court has reinforced that grounds of arrest must be furnished in writing and that custody cannot be mechanical. Read the arrest and remand papers for the arrest memo, the grounds of arrest, the time of arrest, intimation to the family, the medical examination at arrest, the remand application, the stated reasons for police custody, the magistrate's order, and overall compliance with procedural and constitutional safeguards (Articles 21 and 22). A remand order that merely copies the prosecution's request, without recording any application of mind, is itself a point. Quiet Test Ask of every remand: What was to be recovered or discovered that justified custody — and was it in fact done within that custody? If custody was sought "for recovery" and nothing was recovered, the later custody loses its justification. Step 9 Examine Recovery and Seizure Recovery evidence connects the accused to the weapon or property, which is why it is also the most frequently challenged part of a file. The recurring red flags are: no independent panch witness, recovery after a long and unexplained delay, recovery from a common or open place accessible to anyone, no forensic link tying the item to the offence, the same police witnesses appearing in case after case, a seizure memo with a vague description, and gaps in the chain of custody. Recovered Item Place Panch Witness Link to Accused Forensic Link Defence Issue Knife Open roadside bush None independent Disclosure statement only No blood match Open place, no independent panch, no forensic link Mobile phone Accused's house Two stock witnesses Claimed ownership Not sent to FSL Stock witnesses; ownership disputed Step 10 Medical and Forensic Evidence Medical evidence can support, weaken, or destroy oral evidence. It is the most stubborn part of a file because the doctor has no stake in the outcome — and so it becomes a fixed yardstick against which every witness account is measured. Read the injury report, the post-mortem report, the cause of death, the nature of injuries, weapon compatibility, time since injury or death, and the available forensic reports: DNA, FSL, ballistics, toxicology and fingerprints. Worked Example If the eyewitness speaks of repeated knife blows but the medical report shows a single simple injury, the oral version stands contradicted by science. Either the witness is exaggerating, or did not see what they claim — and either way the gravity of the offence, and therefore the bail equation, shifts. Step 11 Digital Evidence Digital evidence — CCTV, CDR, WhatsApp chats, location data, emails, social media posts, call recordings and seized devices — is often the most objective material in the file, but it is also the most procedurally fragile. Under Section 63 of the Bharatiya Sakshya Adhiniyam, 2023 , electronic records require a proper certificate to be admissible, and the absence of that certificate, or a broken chain of custody, can render even compelling footage inadmissible. Digital Evidence Checklist Run every piece of electronic evidence through these seven gates before relying on or conceding it. Source device seized and recorded? Hash value mentioned and matched? Section 63 BSA certificate present? Time stamp reliable and consistent? Original device available, not just a copy? Footage complete — not edited or clipped? Continuity / chain of custody maintained? 0 of 7 verified Step 12 Find Bail Grounds From the File Bail grounds are not invented; they are extracted from the file. The strongest applications read the record back to the court. Common grounds include: no specific role attributed to the accused, delay in the FIR, contradictory witness statements, no recovery from the accused, investigation complete and chargesheet filed, custody already long, no criminal antecedents, co-accused granted bail on parity, medical grounds, weak forensic link, a case resting on documentary evidence, witnesses who are all official witnesses, no flight risk and no risk of tampering. Where the chargesheet is not filed within the BNSS timelines — generally 60 days for offences punishable up to ten years and 90 days for graver offences under Section 187 BNSS — the accused becomes entitled to default bail , an indefeasible right that must be claimed before the chargesheet is filed. Bail Grounds Generator Tick the grounds that the file supports. The tool assembles them into an argument framework you can adapt. Chargesheet filed No recovery from accused No direct eyewitness Delay in FIR Co-accused on bail Long custody No antecedents Documentary evidence based Generate Bail Argument Framework This is an educational tool, not legal advice. Every bail application must be tailored to the facts, the offence, the stage and the governing law, and settled by a qualified advocate. Step 13 Create the Defence Theory A defence theory must be simple, believable and anchored to the record. A jury of one judge will not remember six arguments; they will remember one coherent story that explains the gaps. Build it from the file using a fixed scaffold: the prosecution version is doubtful because…, the timeline does not match because…, the witnesses are unreliable because…, the medical evidence does not support…, the recovery is weak because…, and the digital evidence is incomplete because… Sample Defence Theory "The accused has been falsely implicated owing to a prior dispute. There is no independent witness to the occurrence, no forensic link connecting the accused to the weapon, an unexplained delay in the FIR, and the alleged recovery is from an open place accessible to all — together raising serious and reasonable doubt." Step 14 Prepare Court Notes A court note is the advocate's working brief — dense, factual and reference-led. This is the format senior chambers use, which you can copy and fill in. Copy COURT NOTE — CRIMINAL MATTER Case Title : State v. _____________ FIR No. : _______ | P.S. : __________ | Dist. : __________ Sections : __________ (BNS / special law) Court / Stage : __________ (bail / framing / trial / arguments) Custody Period : From __________ ; total ____ days Main Allegations: 1. 2. Prosecution Evidence (with page nos.): - Ocular : - Medical : - Forensic : - Recovery : - Digital : Defence Points (with page nos.): 1. 2. Contradictions: - Source 1 vs Source 2 → Bail Grounds: 1. 2. Relief Sought: Case Law (placeholders): - [Citation 1] — - [Citation 2] — Step 15 Make a One-Page Case Strategy Sheet Everything above collapses into a single page you can hold in court. If you cannot fit the strategy on one page, you have not yet found the case. Copy ONE-PAGE CASE STRATEGY SHEET Facts Admitted : Facts Disputed : Strong Prosecution Points : Weak Prosecution Points : Defence Strengths : Defence Risks : Immediate Application Needed : Documents to Obtain : Cross-Examination Themes : 1. 2. Bail Strategy : Trial Strategy : A Realistic Worked Example: State v. A The following is a fictional teaching example. All names are invented and any resemblance to a real case is coincidental. The offence is a grievous-hurt / attempt-to-murder type fact pattern. FIR Extract "On 12.03.2026 at about 9:00 PM, while I was returning home, the accused A along with three others suddenly attacked me and gave repeated knife blows. All of them assaulted me. I somehow escaped and reached home." (FIR registered 13.03.2026, 11:30 AM.) Witness Statement Extract (PW-2) "I saw accused A standing near the spot. It was dark. I do not know who exactly gave the blows, but A was there." Medical Report Extract "One incised wound, 3 cm, over the left forearm. Simple in nature. Patient registered at hospital on 12.03.2026 at 7:50 PM." Recovery Memo Extract "On the disclosure of accused A, one knife was recovered from a bush beside the public road. No independent witness was available; two police constables attested the seizure." How a Senior Advocate Breaks This Down FIR delay and timing impossibility. The incident is alleged at 9:00 PM on 12.03.2026, yet the medical record shows the injured was registered at hospital at 7:50 PM the same day — over an hour before the alleged attack. The injury exists before the incident the FIR describes. This single contradiction destabilises the entire timeline. Omnibus allegation, no specific role. The FIR says "all of them assaulted me", but PW-2 admits it was dark and could not say who struck the blows. There is no specific overt act attributed to A. Oral version contradicts medical evidence. The FIR speaks of "repeated knife blows", but the medical report records a single simple incised wound. The gravity asserted is not borne out by science — undercutting the attempt-to-murder colour. Weak recovery. The knife is recovered from a bush beside a public road — an open place accessible to anyone — with no independent panch witness and no blood or fingerprint link to A. Resulting defence theory. A is falsely implicated; presence rests on a single witness who admits poor visibility; the medical evidence contradicts the alleged ferocity; the recovery is from an open place without forensic linkage; and the FIR timeline is internally impossible. These together make a strong bail case and a strong reasonable-doubt case at trial. Common Mistakes Young Advocates Make Most of these are not mistakes of knowledge; they are mistakes of method. Each one is avoidable by following the steps above. Reading only the FIR and treating it as the whole case Ignoring the arrest and remand papers entirely Not making a chronology before arguing Failing to check delay between incident and FIR Treating the chargesheet as established truth Missing contradictions across documents Ignoring medical and post-mortem evidence Not checking the chain of custody of exhibits Going to court without a written court note Arguing facts without precise page references Interactive Final Checklist Before you argue, check this. The bar fills as you tick each item — do not stand up until it is complete. Before You Argue, Check This FIR delay checked and noted Sections verified against the facts Role attribution mapped per accused Arrest legality checked (Sec 35 & 47 BNSS) Witness chart prepared Contradictions marked with sources Medical report compared to oral version Recovery tested for independent witness and link Digital evidence verified (Sec 63 BSA) Bail grounds extracted from the file Case theory prepared in three sentences Court note ready with page references 0 of 12 complete Frequently Asked Questions How do lawyers read a criminal case file? As a system, not a story. They build a document index, prepare a chronology, extract the prosecution theory, separate facts alleged from facts proved, mark contradictions, test recovery and medical evidence, and only then frame defence theory and bail grounds — every point carrying a page reference. What should be checked first in a criminal case file? The FIR — date and time of incident versus registration, delay, place of occurrence, named versus unknown accused, exact allegations, sections invoked and role attribution. But the FIR is the starting point of the prosecution version, not its proof. How do senior advocates find bail grounds? They extract them from the file: no specific role, delay in FIR, contradictory statements, no recovery from the accused, chargesheet filed, long custody, no antecedents, co-accused on bail, a documentary-evidence case, and absence of flight or tampering risk — applying BNSS bail principles including default bail under Section 187. What is the difference between FIR and chargesheet? The FIR is the first information of a cognizable offence, recorded under Section 173 BNSS, which only sets the investigation in motion. The chargesheet — the final report under Section 193 BNSS — is filed after investigation and contains the evidence and material the prosecution intends to rely on at trial. How do you find contradictions in witness statements? Compare each statement against the FIR, against other statements, and against the medical, forensic and digital record. Capture timeline, role and presence inconsistencies in a contradiction chart with source-to-source references so they can be put to the witness in cross-examination. Why is chronology important in criminal cases? It exposes delay and impossibility. Once the incident, FIR, arrest, recovery, medical report and statements sit on a single timeline, gaps become visible — such as a medical record timed before the alleged incident. How do you analyze a chargesheet? Never read it randomly. Build a document index listing each document, its page, date and author and which side it helps. Then map every allegation to its supporting evidence, identify what is missing, and test recovery, medical and digital material. What documents are important for bail? The FIR (delay and role), arrest and remand papers (legality of detention), the chargesheet (to show investigation is complete), recovery memos, medical and forensic reports (weak links), and any order granting bail to a co-accused. How do you prepare a criminal trial strategy? Identify facts admitted and disputed, list strong and weak prosecution points, define a simple defence theory anchored to the record, plan cross-examination themes around contradictions, and map which applications and documents are needed at each stage. Can law students use this method for internships? Yes. The document index, chronology, contradiction chart and one-page strategy sheet are exactly the deliverables litigation chambers expect from interns, and they demonstrate structured file-reading rather than recited theory. Want more practical litigation playbooks? The EduLaw Advocate Playbook gives you structured legal strategy guides, case-reading systems, judgment notes and courtroom-ready frameworks — built for advocates who argue, not just read. Explore EduLaw Playbooks EduLaw Advocate Playbook · Educational content for lawyers, law students and legal researchers. Last updated 11 June 2026, reflecting the BNSS and BSA, 2023 in force from 1 July 2024. This guide is for education and training only and does not constitute legal advice. Case strategy, bail and trial decisions must be made by a qualified advocate on the specific facts and law applicable to the matter. Copied to clipboard // Reading progress bar var pb=document.getElementById('progress'); window.addEventListener('scroll',function(){ var h=document.documentElement; var sc=(h.scrollTop)/(h.scrollHeight-h.clientHeight); pb.style.width=(sc*100)+'%'; },{passive:true}); // Active TOC highlight var tocLinks=document.querySelectorAll('.toc a'); var sections=[].map.call(tocLinks,function(a){return document.querySelector(a.getAttribute('href'));}); window.addEventListener('scroll',function(){ var pos=window.scrollY+140,idx=-1; sections.forEach(function(s,i){if(s&&s.offsetTop Warning: the FIR time is earlier than the incident time. Re-check the dates — this itself may be a documentary error worth flagging.';return;} var hrs=Math.floor(d/3600000),days=Math.floor(hrs/24),rem=hrs%24,mins=Math.floor((d%3600000)/60000); var txt=' Delay: '+(days>0?days+' day(s), ':'')+rem+' hour(s), '+mins+' minute(s). '; if(hrs Prompt: Check whether this delay is explained in the FIR or witness statements. '; r.innerHTML=txt; } // Timeline builder var tlEvents=['Incident alleged','FIR registered','Accused arrested','Police custody sought','Recovery shown','Witness statements recorded','Medical / forensic report received','Chargesheet filed']; var tlIdx=0; function addTlRow(presetLabel){ var c=document.getElementById('tlRows'); var row=document.createElement('div');row.className='tl-row'; var label=(presetLabel!==undefined)?presetLabel:(tlEvents[tlIdx]||'');tlIdx++; row.innerHTML=' Date '+ ' Event '+ ' Remove '; c.appendChild(row); } addTlRow('Incident alleged');addTlRow('FIR registered');addTlRow('Accused arrested'); function buildTimeline(){ var rows=document.querySelectorAll('#tlRows .tl-row'),items=[]; rows.forEach(function(r){ var d=r.querySelector('.tl-date-in').value,l=r.querySelector('.tl-label-in').value; if(l)items.push({d:d,l:l}); }); items.sort(function(a,b){if(!a.d)return 1;if(!b.d)return -1;return new Date(a.d)-new Date(b.d);}); var out=document.getElementById('timelineOut'); if(!items.length){out.innerHTML=' Add at least one event with a label to build the timeline. ';return;} var html=''; items.forEach(function(it){ var ds=it.d?new Date(it.d).toLocaleDateString('en-IN',{day:'numeric',month:'short',year:'numeric'}):'Date not set'; html+=' '+ds+' '+it.l+' '; }); out.innerHTML=html; } // Progress checklists (generic) function wireProgress(id){ var fill=document.getElementById(id);if(!fill)return; var list=document.querySelector('[data-progress="'+id+'"]'); var boxes=list.querySelectorAll('input[type=checkbox]'); var countEl=document.getElementById(id+'Count'); function upd(){ var n=0;boxes.forEach(function(b){if(b.checked)n++;b.closest('li').classList.toggle('checked',b.checked);}); fill.style.width=(n/boxes.length*100)+'%'; if(countEl)countEl.textContent=n+' of '+boxes.length+(id==='digProg'?' verified':(id==='docProg'?' indexed':' complete')); } list.addEventListener('change',upd); list.querySelectorAll('li').forEach(function(li){ li.addEventListener('click',function(e){if(e.target.tagName!=='INPUT'){var cb=li.querySelector('input');cb.checked=!cb.checked;upd();}}); }); } ['docProg','digProg','finalProg'].forEach(wireProgress); // Witness cross-exam generator document.querySelectorAll('#witnessList li, #bailList li').forEach(function(li){ li.addEventListener('click',function(e){if(e.target.tagName!=='INPUT'){var cb=li.querySelector('input');cb.checked=!cb.checked;cb.dispatchEvent(new Event('change',{bubbles:true}));}}); }); document.getElementById('witnessList').addEventListener('change',function(){ this.querySelectorAll('li').forEach(function(li){li.classList.toggle('checked',li.querySelector('input').checked);}); }); function genCx(){ var boxes=document.querySelectorAll('#witnessList input:checked'),r=document.getElementById('cxResult');r.classList.add('show'); if(!boxes.length){r.innerHTML='Tick the red flags that apply to this witness to generate cross-examination areas.';return;} var html=' Possible cross-examination areas generated: '; boxes.forEach(function(b){html+=' '+b.getAttribute('data-cx')+' ';}); html+=' ';r.innerHTML=html; } // Bail generator document.getElementById('bailList').addEventListener('change',function(){ this.querySelectorAll('li').forEach(function(li){li.classList.toggle('checked',li.querySelector('input').checked);}); }); function genBail(){ var boxes=document.querySelectorAll('#bailList input:checked'),r=document.getElementById('bailResult');r.classList.add('show'); if(!boxes.length){r.innerHTML='Select the grounds supported by the file to assemble an argument framework.';return;} var args=[];boxes.forEach(function(b){args.push(b.getAttribute('data-arg'));}); var txt=' Suggested bail argument framework: It is respectfully submitted that the applicant be enlarged on bail for the following reasons: '; txt+=args.map(function(a,i){return (i+1)+') '+a;}).join('; ')+'. '; txt+='In these circumstances, continued custody serves no investigative or evidentiary purpose, and the applicant undertakes to abide by such conditions as this Court may impose.'; r.innerHTML=txt; } // Copy templates function copyTpl(btn){ var pre=btn.parentNode.querySelector('pre'); var t=pre.innerText; if(navigator.clipboard&&navigator.clipboard.writeText){navigator.clipboard.writeText(t).then(showToast,fallbackCopy.bind(null,t));} else fallbackCopy(t); } function fallbackCopy(t){ var ta=document.createElement('textarea');ta.value=t;document.body.appendChild(ta);ta.select(); try{document.execCommand('copy');showToast();}catch(e){}document.body.removeChild(ta); } var toast=document.getElementById('toast'),toastT; function showToast(){toast.classList.add('show');clearTimeout(toastT);toastT=setTimeout(function(){toast.classList.remove('show');},1800);}