![]() Server : Apache/2 System : Linux server-15-235-50-60 5.15.0-164-generic #174-Ubuntu SMP Fri Nov 14 20:25:16 UTC 2025 x86_64 User : gositeme ( 1004) PHP Version : 8.2.29 Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname Directory : /home/gositeme/domains/lavocat.ca/private_html/.next/server/chunks/ |
"use strict";exports.id=1115,exports.ids=[1115],exports.modules={81680:(e,a,l)=>{l.d(a,{A:()=>s});let s=(0,l(72386).A)("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]])},91115:(e,a,l)=>{l.a(e,async(e,s)=>{try{l.d(a,{A:()=>g});var t=l(8732),r=l(82015),i=l.n(r),o=l(44233),n=l(4722),d=l(63220),c=l(81680),u=l(5134),m=l(30703),b=l(42893),x=l(56761),h=l.n(x),p=e([d,b]);[d,b]=p.then?(await p)():p;let g=({modalMode:e})=>{let a=(0,o.useRouter)(),{data:l,status:s}=(0,n.useSession)(),[x,p]=(0,r.useState)(!1),[g,y]=(0,r.useState)({title:"",caseType:"CIVIL",priority:"MEDIUM",budget:"",description:"",assignedTo:"",isPublic:!1}),[f,v]=(0,r.useState)(null),[N,j]=(0,r.useState)(null);if(i().useEffect(()=>{"loading"!==s&&(l||a.push("/auth/login"))},[l,s,a]),"loading"===s)return(0,t.jsx)("div",{className:"max-w-2xl mx-auto px-4 py-8",children:(0,t.jsxs)("div",{className:"text-center",children:[(0,t.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-600 mx-auto"}),(0,t.jsx)("p",{className:"mt-2 text-gray-600",children:"Loading..."})]})});if(!l)return null;let w=e=>{let{name:a,value:l,type:s}=e.target,t="checkbox"===s?e.target.checked:void 0;y(e=>({...e,[a]:"checkbox"===s?t:l}))},C=async e=>{if(e.preventDefault(),!g.title||!g.description||!N)return void b.default.error("Please fill in all required fields and upload a logo");p(!0);try{let e="";if(N){let a=new FormData;a.append("file",N);let l=await fetch("/api/upload",{method:"POST",body:a});if(!l.ok){let e=await l.json().catch(()=>({error:"Unknown error"}));throw console.error("Upload failed:",l.status,e),Error(`Failed to upload logo: ${e.error||l.statusText}`)}e=(await l.json()).url}let s=await fetch("/api/cases",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...g,logoUrl:e,status:"PENDING",budget:g.budget?parseFloat(g.budget):null,assignedTo:g.assignedTo||null,isPublic:g.isPublic})});if(s.ok)b.default.success("Case created successfully!"),l?.user?.role==="CLIENT"?a.push("/client/dashboard"):l?.user?.role==="LAWYER"?a.push("/lawyer/dashboard"):(l?.user?.role==="ADMIN"||l?.user?.role,a.push("/admin/cases"));else{let e=await s.json();b.default.error(e.error||"Failed to create case")}}catch(e){console.error("Error creating case:",e),b.default.error(e instanceof Error?e.message:"Failed to create case")}finally{p(!1)}},T=l?.user?.role==="ADMIN"||l?.user?.role==="SUPERADMIN",I=l?.user?.role==="LAWYER",E=l?.user?.role==="CLIENT";return(0,t.jsxs)("div",{className:"max-w-2xl mx-auto px-4 py-8",children:[(0,t.jsx)(d.motion.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"mb-8",children:(0,t.jsxs)("div",{className:"flex items-center gap-4 mb-4",children:[!e&&(0,t.jsx)("button",{onClick:()=>a.back(),className:"p-2 text-gray-600 hover:text-gray-800 transition-colors",children:(0,t.jsx)(c.A,{className:"h-5 w-5"})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h1",{className:"text-3xl font-bold text-gray-900",children:"Create New Case"}),(0,t.jsx)("p",{className:"text-gray-600",children:T?"Create a new case in the system":I?"Create a case for client representation":"Create a case to hire a lawyer for representation"})]})]})}),(0,t.jsx)(d.motion.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.1},className:"bg-blue-50 border border-blue-200 rounded-md p-4 mb-6",children:(0,t.jsxs)("div",{className:"flex items-start",children:[(0,t.jsx)(u.A,{className:"h-5 w-5 text-blue-400 mr-2 mt-0.5"}),(0,t.jsxs)("div",{className:"text-sm text-blue-800",children:[(0,t.jsx)("strong",{children:"Universal Case System"}),(0,t.jsx)("br",{}),"This case will be integrated into the unified case management system accessible by all authorized roles.",E&&" Creating a case helps lawyers understand your legal needs and provide better representation.",I&&" You can assign this case to team members or handle it yourself.",T&&" You can assign this case to any lawyer or keep it unassigned for review."]})]})}),(0,t.jsxs)(d.motion.form,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.2},onSubmit:C,className:"bg-white rounded-lg shadow-sm border border-gray-200 p-6",children:[(0,t.jsxs)("h2",{className:"text-xl font-semibold text-gray-900 mb-6 flex items-center",children:[(0,t.jsx)(m.A,{className:"h-5 w-5 mr-2 text-blue-600"}),"Case Information"]}),(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Case Logo *"}),(0,t.jsxs)("div",{className:"w-full flex flex-col items-center justify-center border-2 border-dashed border-blue-400 rounded-md p-4 cursor-pointer bg-blue-50 hover:bg-blue-100",onClick:()=>document.getElementById("case-logo-input")?.click(),style:{minHeight:120},children:[f?(0,t.jsx)(h(),{src:f,alt:"Case Logo Preview",width:96,height:96,className:"rounded shadow mb-2"}):(0,t.jsx)("span",{className:"text-blue-400",children:"Drag & drop or click to upload a logo"}),(0,t.jsx)("input",{id:"case-logo-input",type:"file",accept:"image/*",className:"hidden",onChange:e=>{let a=e.target.files?.[0];a&&(j(a),v(URL.createObjectURL(a)))}})]}),f&&(0,t.jsx)("div",{className:"text-xs text-gray-500 mt-1",children:"Logo preview shown above"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Case Title *"}),(0,t.jsx)("input",{type:"text",name:"title",value:g.title,onChange:w,placeholder:"Brief description of your case",className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500",required:!0})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Case Type"}),(0,t.jsx)("select",{name:"caseType",value:g.caseType,onChange:w,className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500",children:[{value:"CIVIL",label:"Civil Litigation"},{value:"CRIMINAL",label:"Criminal Defense"},{value:"FAMILY",label:"Family Law"},{value:"CORPORATE",label:"Corporate Law"},{value:"REAL_ESTATE",label:"Real Estate"},{value:"INTELLECTUAL_PROPERTY",label:"Intellectual Property"},{value:"EMPLOYMENT",label:"Employment Law"},{value:"IMMIGRATION",label:"Immigration"},{value:"MEDIATION",label:"Mediation"},{value:"INVESTIGATION",label:"Investigation"},{value:"EXPERT_TESTIMONY",label:"Expert Testimony"},{value:"NOTARIAL",label:"Notarial Services"},{value:"OTHER",label:"Other"}].map(e=>(0,t.jsx)("option",{value:e.value,children:e.label},e.value))})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Priority"}),(0,t.jsx)("select",{name:"priority",value:g.priority,onChange:w,className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500",children:[{value:"LOW",label:"Low Priority"},{value:"MEDIUM",label:"Medium Priority"},{value:"HIGH",label:"High Priority"},{value:"URGENT",label:"Urgent"}].map(e=>(0,t.jsx)("option",{value:e.value,children:e.label},e.value))})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Budget (optional)"}),(0,t.jsx)("input",{type:"number",name:"budget",value:g.budget,onChange:w,placeholder:"Proposed budget for the case",className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500",min:"0"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Description *"}),(0,t.jsx)("textarea",{name:"description",value:g.description,onChange:w,placeholder:"Describe your case in detail",className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500",rows:4,required:!0})]}),(T||I)&&(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Assign To (Lawyer ID, optional)"}),(0,t.jsx)("input",{type:"text",name:"assignedTo",value:g.assignedTo,onChange:w,placeholder:"Lawyer ID to assign this case",className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"})]}),(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)("input",{type:"checkbox",name:"isPublic",checked:!!g.isPublic,onChange:w,className:"h-4 w-4 text-blue-600 border-gray-300 rounded focus:ring-blue-500"}),(0,t.jsx)("label",{className:"ml-2 block text-sm text-gray-700",children:"Make this case public (visible to all lawyers)"})]})]}),(0,t.jsx)("div",{className:"mt-8 flex justify-end",children:(0,t.jsx)("button",{type:"submit",className:"bg-blue-600 text-white px-6 py-2 rounded-lg font-semibold hover:bg-blue-700 transition-colors disabled:opacity-50",disabled:x,children:x?"Submitting...":"Create Case"})})]})]})};s()}catch(e){s(e)}})}};