![]() 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/static/chunks/ |
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6068],{6068:(e,l,a)=>{a.d(l,{A:()=>x});var s=a(37876),t=a(14232),r=a(89099),i=a(10553),o=a(35667),n=a(22885),d=a(86739),c=a(65390),u=a(97685),m=a(54587),b=a.n(m);let x=e=>{var l,a,m,x;let{modalMode:h}=e,p=(0,r.useRouter)(),{data:g,status:y}=(0,i.useSession)(),[f,v]=(0,t.useState)(!1),[N,j]=(0,t.useState)({title:"",caseType:"CIVIL",priority:"MEDIUM",budget:"",description:"",assignedTo:"",isPublic:!1}),[w,C]=(0,t.useState)(null),[T,E]=(0,t.useState)(null);if(t.useEffect(()=>{"loading"!==y&&(g||p.push("/auth/login"))},[g,y,p]),"loading"===y)return(0,s.jsx)("div",{className:"max-w-2xl mx-auto px-4 py-8",children:(0,s.jsxs)("div",{className:"text-center",children:[(0,s.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-600 mx-auto"}),(0,s.jsx)("p",{className:"mt-2 text-gray-600",children:"Loading..."})]})});if(!g)return null;let I=e=>{let{name:l,value:a,type:s}=e.target,t="checkbox"===s?e.target.checked:void 0;j(e=>({...e,[l]:"checkbox"===s?t:a}))},k=async e=>{if(e.preventDefault(),!N.title||!N.description||!T)return void u.Ay.error("Please fill in all required fields and upload a logo");v(!0);try{let e="";if(T){let l=new FormData;l.append("file",T);let a=await fetch("/api/upload",{method:"POST",body:l});if(!a.ok){let e=await a.json().catch(()=>({error:"Unknown error"}));throw console.error("Upload failed:",a.status,e),Error("Failed to upload logo: ".concat(e.error||a.statusText))}e=(await a.json()).url}let r=await fetch("/api/cases",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...N,logoUrl:e,status:"PENDING",budget:N.budget?parseFloat(N.budget):null,assignedTo:N.assignedTo||null,isPublic:N.isPublic})});if(r.ok){var l,a,s,t;u.Ay.success("Case created successfully!"),(null==g||null==(l=g.user)?void 0:l.role)==="CLIENT"?p.push("/client/dashboard"):(null==g||null==(a=g.user)?void 0:a.role)==="LAWYER"?p.push("/lawyer/dashboard"):((null==g||null==(s=g.user)?void 0:s.role)==="ADMIN"||null==g||null==(t=g.user)||t.role,p.push("/admin/cases"))}else{let e=await r.json();u.Ay.error(e.error||"Failed to create case")}}catch(e){console.error("Error creating case:",e),u.Ay.error(e instanceof Error?e.message:"Failed to create case")}finally{v(!1)}},L=(null==g||null==(l=g.user)?void 0:l.role)==="ADMIN"||(null==g||null==(a=g.user)?void 0:a.role)==="SUPERADMIN",A=(null==g||null==(m=g.user)?void 0:m.role)==="LAWYER",P=(null==g||null==(x=g.user)?void 0:x.role)==="CLIENT";return(0,s.jsxs)("div",{className:"max-w-2xl mx-auto px-4 py-8",children:[(0,s.jsx)(o.P.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"mb-8",children:(0,s.jsxs)("div",{className:"flex items-center gap-4 mb-4",children:[!h&&(0,s.jsx)("button",{onClick:()=>p.back(),className:"p-2 text-gray-600 hover:text-gray-800 transition-colors",children:(0,s.jsx)(n.A,{className:"h-5 w-5"})}),(0,s.jsxs)("div",{children:[(0,s.jsx)("h1",{className:"text-3xl font-bold text-gray-900",children:"Create New Case"}),(0,s.jsx)("p",{className:"text-gray-600",children:L?"Create a new case in the system":A?"Create a case for client representation":"Create a case to hire a lawyer for representation"})]})]})}),(0,s.jsx)(o.P.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,s.jsxs)("div",{className:"flex items-start",children:[(0,s.jsx)(d.A,{className:"h-5 w-5 text-blue-400 mr-2 mt-0.5"}),(0,s.jsxs)("div",{className:"text-sm text-blue-800",children:[(0,s.jsx)("strong",{children:"Universal Case System"}),(0,s.jsx)("br",{}),"This case will be integrated into the unified case management system accessible by all authorized roles.",P&&" Creating a case helps lawyers understand your legal needs and provide better representation.",A&&" You can assign this case to team members or handle it yourself.",L&&" You can assign this case to any lawyer or keep it unassigned for review."]})]})}),(0,s.jsxs)(o.P.form,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.2},onSubmit:k,className:"bg-white rounded-lg shadow-sm border border-gray-200 p-6",children:[(0,s.jsxs)("h2",{className:"text-xl font-semibold text-gray-900 mb-6 flex items-center",children:[(0,s.jsx)(c.A,{className:"h-5 w-5 mr-2 text-blue-600"}),"Case Information"]}),(0,s.jsxs)("div",{className:"space-y-6",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Case Logo *"}),(0,s.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:()=>{var e;return null==(e=document.getElementById("case-logo-input"))?void 0:e.click()},style:{minHeight:120},children:[w?(0,s.jsx)(b(),{src:w,alt:"Case Logo Preview",width:96,height:96,className:"rounded shadow mb-2"}):(0,s.jsx)("span",{className:"text-blue-400",children:"Drag & drop or click to upload a logo"}),(0,s.jsx)("input",{id:"case-logo-input",type:"file",accept:"image/*",className:"hidden",onChange:e=>{var l;let a=null==(l=e.target.files)?void 0:l[0];a&&(E(a),C(URL.createObjectURL(a)))}})]}),w&&(0,s.jsx)("div",{className:"text-xs text-gray-500 mt-1",children:"Logo preview shown above"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Case Title *"}),(0,s.jsx)("input",{type:"text",name:"title",value:N.title,onChange:I,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,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Case Type"}),(0,s.jsx)("select",{name:"caseType",value:N.caseType,onChange:I,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,s.jsx)("option",{value:e.value,children:e.label},e.value))})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Priority"}),(0,s.jsx)("select",{name:"priority",value:N.priority,onChange:I,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,s.jsx)("option",{value:e.value,children:e.label},e.value))})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Budget (optional)"}),(0,s.jsx)("input",{type:"number",name:"budget",value:N.budget,onChange:I,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,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Description *"}),(0,s.jsx)("textarea",{name:"description",value:N.description,onChange:I,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})]}),(L||A)&&(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Assign To (Lawyer ID, optional)"}),(0,s.jsx)("input",{type:"text",name:"assignedTo",value:N.assignedTo,onChange:I,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,s.jsxs)("div",{className:"flex items-center",children:[(0,s.jsx)("input",{type:"checkbox",name:"isPublic",checked:!!N.isPublic,onChange:I,className:"h-4 w-4 text-blue-600 border-gray-300 rounded focus:ring-blue-500"}),(0,s.jsx)("label",{className:"ml-2 block text-sm text-gray-700",children:"Make this case public (visible to all lawyers)"})]})]}),(0,s.jsx)("div",{className:"mt-8 flex justify-end",children:(0,s.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:f,children:f?"Submitting...":"Create Case"})})]})]})}},22885:(e,l,a)=>{a.d(l,{A:()=>s});let s=(0,a(11713).A)("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]])}}]);