1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[95931],{61019:(e,a,t)=>{t.d(a,{IK:()=>o,J1:()=>m,KO:()=>n,VO:()=>d,d6:()=>u,ei:()=>i,yl:()=>c});var s=t(12115),r=t(18419),l=t(13872);function i(e){let{currentOrganization:a}=(0,r.E)(),{selectedYear:t}=(0,l.Dk)(),[i,n]=(0,s.useState)([]),[d,c]=(0,s.useState)(!0),[o,u]=(0,s.useState)(null),m=(0,s.useCallback)(async()=>{if(!(null==a?void 0:a.id))return void c(!1);try{c(!0);let s=new URLSearchParams({organization_id:a.id,academic_year:t});(null==e?void 0:e.status)&&s.append("status",e.status);let r=await window.fetch("/api/legal-tracking?".concat(s)),l=await r.json();l.success?(n(l.data||[]),u(null)):u(l.error)}catch(e){u(e.message)}finally{c(!1)}},[null==a?void 0:a.id,t,null==e?void 0:e.status]);return(0,s.useEffect)(()=>{m()},[m]),{data:i,loading:d,error:o,refetch:m}}function n(){let{currentOrganization:e}=(0,r.E)(),{selectedYear:a}=(0,l.Dk)(),[t,i]=(0,s.useState)(null),[n,d]=(0,s.useState)(!0),c=(0,s.useCallback)(async()=>{if(!(null==e?void 0:e.id))return void d(!1);try{d(!0);let t=await window.fetch("/api/legal-tracking?organization_id=".concat(e.id,"&academic_year=").concat(a,"&summary=true")),s=await t.json();s.success&&i(s.data)}catch(e){console.error("[useLegalTrackingSummary] Error:",e)}finally{d(!1)}},[null==e?void 0:e.id,a]);return(0,s.useEffect)(()=>{c()},[c]),{summary:t,loading:n,refetch:c}}function d(e){let{currentOrganization:a}=(0,r.E)(),{selectedYear:t}=(0,l.Dk)(),[i,n]=(0,s.useState)(null),[d,c]=(0,s.useState)(!0),[o,u]=(0,s.useState)(null),m=(0,s.useCallback)(async()=>{if(!e||!(null==a?void 0:a.id))return void c(!1);try{c(!0);let s=await window.fetch("/api/legal-tracking/".concat(e,"?organization_id=").concat(a.id,"&academic_year=").concat(t)),r=await s.json();r.success?(n(r.data),u(null)):u(r.error||"Hukuki takip detayı okunamadı")}catch(e){console.error("[useLegalTrackingDetail] Error:",e),u((null==e?void 0:e.message)||"Hukuki takip detayı okunamadı")}finally{c(!1)}},[e,null==a?void 0:a.id,t]);return(0,s.useEffect)(()=>{m()},[m]),{detail:i,loading:d,hata:o,refetch:m}}async function c(e){return(await fetch("/api/legal-tracking",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json()}async function o(e,a,t){return(await fetch("/api/legal-tracking/".concat(e),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:a,...t})})).json()}async function u(e){return(await fetch("/api/legal-tracking/notes",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json()}async function m(e,a){return(await fetch("/api/legal-tracking/notes?id=".concat(e,"&organization_id=").concat(a),{method:"DELETE"})).json()}},95931:(e,a,t)=>{t.r(a),t.d(a,{LegalTrackingModal:()=>h,default:()=>b});var s=t(95155),r=t(12115),l=t(78686),i=t(34788),n=t(35354),d=t(79564),c=t(57419),o=t(23916),u=t(28570),m=t(49214),x=t(61019),y=t(18419),g=t(77303);function h(e){var a;let{isOpen:t,onClose:h,studentId:b,studentName:p,studentClass:f,debtAmount:v=0,overdueDays:j=0,existingTrackingId:N,onUpdate:_}=e,{currentOrganization:k}=(0,y.E)(),{detail:w,loading:C,refetch:A}=(0,x.VO)(N||null),[S,z]=(0,r.useState)("info"),[E,T]=(0,r.useState)(!1),[D,O]=(0,r.useState)(""),[K,L]=(0,r.useState)(!1),[H,J]=(0,r.useState)(!0),[P,B]=(0,r.useState)({status:"gecikmis",lawyer_name:"",lawyer_phone:"",lawyer_email:"",case_number:"",notary_name:"",notary_document_no:"",notary_date:"",icra_dairesi:"",icra_dosya_no:"",icra_tarihi:""});if((0,r.useEffect)(()=>{w&&B({status:w.status,lawyer_name:w.lawyer_name||"",lawyer_phone:w.lawyer_phone||"",lawyer_email:w.lawyer_email||"",case_number:w.case_number||"",notary_name:w.notary_name||"",notary_document_no:w.notary_document_no||"",notary_date:w.notary_date||"",icra_dairesi:w.icra_dairesi||"",icra_dosya_no:w.icra_dosya_no||"",icra_tarihi:w.icra_tarihi||""})},[w]),!t)return null;let R=async()=>{if(!(null==k?void 0:k.id))return void g.Ay.error("Organizasyon bulunamadı");L(!0);try{let e=await (0,x.yl)({organization_id:k.id,student_id:b,debt_amount:v,overdue_days:j,...P});e.success?(g.Ay.success("Hukuki takip kaydedildi"),T(!1),A(),null==_||_()):g.Ay.error(e.error||"Kaydetme baÅarısız")}catch(e){g.Ay.error(e.message)}finally{L(!1)}},I=async e=>{if(!N)return void B(a=>({...a,status:e}));L(!0);try{let a=await (0,x.IK)(N,e);a.success?(g.Ay.success("Durum g\xfcncellendi"),A(),null==_||_()):g.Ay.error(a.error)}catch(e){g.Ay.error(e.message)}finally{L(!1)}},M=async e=>{if((null==k?void 0:k.id)&&window.confirm("Bu not silinecek. Onaylıyor musunuz?")){L(!0);try{let a=await (0,x.J1)(e,k.id);a.success?(g.Ay.success("Not silindi"),A()):g.Ay.error(a.error||"Not silinemedi")}catch(e){g.Ay.error(e.message)}finally{L(!1)}}},V=async()=>
1{if(D.trim()&&N&&(null==k?void 0:k.id)){L(!0);try{let e=await (0,x.d6)({legal_tracking_id:N,organization_id:k.id,note_text:D.trim()});e.success?(g.Ay.success("Not eklendi"),O(""),A()):g.Ay.error(e.error)}catch(e){g.Ay.error(e.message)}finally{L(!1)}}},F=e=>e?new Date(e).toLocaleDateString("tr-TR",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit"}):"-",G=m.u[P.status];return(0,s.jsxs)("div",{className:"fixed inset-0 z-50 overflow-y-auto",children:[(0,s.jsx)("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm",onClick:h}),(0,s.jsx)("div",{className:"relative min-h-screen flex items-center justify-center p-4",children:(0,s.jsxs)("div",{className:"relative bg-white rounded-2xl shadow-2xl w-full max-w-2xl max-h-[90vh] overflow-hidden",children:[(0,s.jsx)("div",{className:"px-6 py-4 border-b ".concat(G.bgColor),children:(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsx)("div",{className:"w-10 h-10 rounded-xl ".concat(G.bgColor," flex items-center justify-center"),children:(0,s.jsx)(l.A,{className:G.textColor,size:20})}),(0,s.jsxs)("div",{children:[(0,s.jsx)("h2",{className:"text-lg font-bold text-gray-900",children:"Hukuki Takip Dosyası"}),(0,s.jsxs)("p",{className:"text-sm text-gray-600",children:[p," ",f?"(".concat(f,")"):""]})]})]}),(0,s.jsx)("button",{onClick:h,className:"p-2 hover:bg-white/50 rounded-lg transition",children:(0,s.jsx)(i.A,{size:20,className:"text-gray-500"})})]})}),(0,s.jsx)("div",{className:"overflow-y-auto max-h-[calc(90vh-180px)]",children:C?(0,s.jsx)("div",{className:"p-8 flex items-center justify-center",children:(0,s.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-marka-600"})}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"p-6 border-b border-gray-100",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,s.jsx)("span",{className:"text-sm font-medium text-gray-500",children:"Mevcut Durum"}),!E&&N&&(0,s.jsx)("button",{onClick:()=>T(!0),className:"text-sm text-marka-600 hover:text-marka-700 font-medium",children:"D\xfczenle"})]}),(0,s.jsx)("div",{className:"flex flex-wrap gap-2 mb-4",children:m.g.map(e=>(0,s.jsx)("button",{onClick:()=>I(e.value),disabled:K,className:"px-3 py-2 rounded-lg text-sm font-medium border transition ".concat(P.status===e.value?"".concat(m.u[e.value].bgColor," ").concat(m.u[e.value].textColor," ").concat(m.u[e.value].borderColor):"bg-white border-gray-200 text-gray-600 hover:border-gray-300"),children:e.label},e.value))}),(0,s.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,s.jsxs)("div",{className:"bg-gray-50 rounded-xl p-4",children:[(0,s.jsx)("div",{className:"text-xs text-gray-500 mb-1",children:"Bor\xe7 Tutarı"}),(0,s.jsxs)("div",{className:"text-xl font-bold text-gray-900",children:["âº",((null==w?void 0:w.debt_amount)||v).toLocaleString("tr-TR")]})]}),(0,s.jsxs)("div",{className:"bg-gray-50 rounded-xl p-4",children:[(0,s.jsx)("div",{className:"text-xs text-gray-500 mb-1",children:"Gecikme S\xfcresi"}),(0,s.jsxs)("div",{className:"text-xl font-bold text-amber-600",children:[(null==w?void 0:w.overdue_days)||j," g\xfcn"]})]})]})]}),(E||!N)&&(0,s.jsxs)("div",{className:"p-6 border-b border-gray-100 space-y-4",children:[(0,s.jsxs)("h3",{className:"font-semibold text-gray-900 flex items-center gap-2",children:[(0,s.jsx)(n.A,{size:16}),"Dosya Bilgileri"]}),("avukat"===P.status||"icra"===P.status)&&(0,s.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"Avukat Adı"}),(0,s.jsx)("input",{type:"text",value:P.lawyer_name,onChange:e=>B(a=>({...a,lawyer_name:e.target.value})),className:"w-full px-3 py-2 border border-gray-200 rounded-lg text-sm focus:ring-2 focus:ring-marka-500/20 focus:border-marka-500",placeholder:"Av. Ahmet Demir"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"Dosya No"}),(0,s.jsx)("input",{type:"text",value:P.case_number,onChange:e=>B(a=>({...a,case_number:e.target.value})),className:"w-full px-3 py-2 border border-gray-200 rounded-lg text-sm focus:ring-2 focus:ring-marka-500/20 focus:border-marka-500",placeholder:"2025/12345"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"Avukat Telefon"}),(0,s.jsx)("input",{type:"text",value:P.lawyer_phone,onChange:e=>B(a=>({...a,lawyer_phone:e.target.value})),className:"w-full px-3 py-2 border border-gray-200 rounded-lg text-sm",placeholder:"0532 123 45 67"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"Avukat E-posta"}),(0,s.jsx)("input",{type:"email",value:P.lawyer_email,onChange:e=>B(a=>({...a,lawyer_email:e.target.value})),className:"w-full px-3 py-2 border border-gray-200 rounded-lg text-sm",placeholder:"[email protected]"})]})]}),"ihtarname"===P.status&&(0,s.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"Noter"}),(0,s.jsx)("input",{type:"text",value:P.notary_name,onChange:e=>B(a=>({...a,notary_name:e.target.value})),className:"w-full px-3 py-2 border border-gray-200 rounded-lg text-sm",placeholder:"Ankara 24. Noter"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"Evrak No"}),(0,s.jsx)("input",{type:"text",value:P.notary_document_no,onChange:e=>B(a=>({...a,notary_document_no:e.target.value})),className:"w-full px-3 py-2 border border-gray-200 rounded-lg text-sm",placeholder:"2024/5678"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"Tarih"}),(0,s.jsx)("input",{type:"date",value:P.notary_date,onChange:e=>B(a=>({...a,notary_date:e.target.value})),className:"w-full px-3 py-2 border border-gray-200 rounded-lg text-sm"})]})]}),"icra"===P.status&&(0,s.jsxs)("div",{className:"grid grid-cols-2 gap-4 mt-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"İcra Dairesi"}),(0,s.jsx)("input",{type:"text",value:P.icra_dairesi,onChange:e=>B(a=>({...a,icra_dairesi:e.target.value})),className:"w-full px-3 py-2 border border-gray-200 rounded-lg text-sm",placeholder:"Ankara 5. İcra Dairesi"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"İcra Dosya No"}),(0,s.jsx)("input",{type:"text",value:P.icra_dosya_no,onChange:e=>B(a=>({...a,icra_dosya_no:e.target.value})),className:"w-full px-3 py-2 border border-gray-200 rounded-lg text-sm",placeholder:"2025/1234 E."})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"İcra Tarihi"}),(0,s.jsx)("input",{type:"date",value:P.icra_tarihi,onChange:e=>B(a=>({...a,icra_tarihi:e.target.value})),className:"w-full px-3 py-2 border border-gray-200 rounded-lg text-sm"})]})]}),(0,s.jsxs)("div",{className:"flex justify-end gap-2 pt-4",children:[E&&(0,s.jsx)("button",{onClick:()=>T(!1),className:"px-4 py-2 text-gray-600 hover:bg-gray-100 rounded-lg text-sm font-medium transition",children:"İptal"}),(0,s.jsx)("button",{onClick:R,disabled:K,className:"px-4 py-2 bg-marka-600 text-white rounded-lg text-sm font-medium hover:bg-marka-700 transition disabled:opacity-50",children:K?"Kaydediliyor...":"Kaydet"})]})]}),N&&(null==w?void 0:w.history)&&w.history.length>0&&(0,s.jsxs)("div",{className:"p-6 border-b border-gray-100",children:[(0,s.jsxs)("button",{onClick:()=>J(!H),className:"flex items-center justify-between w-full mb-4",children:[(0,s.jsxs)("h3",{className:"font-semibold text-gray-900 flex items-center gap-2",children:[(0,s.jsx)(d.A,{size:16}),"S\xfcre\xe7 Tarih\xe7esi (",(w.history||[]).length,")"]}),H?(0,s.jsx)(c.A,{size:16}):(0,s.jsx)(o.A,{size:16})]}),H&&(0,s.jsx)("div",{className:"space-y-3 max-h-60 overflow-y-auto",children:(w.history||[]).map((e,a)=>(0,s.jsxs)("div",{className:"flex gap-3",children:[(0,s.jsxs)("div",{className:"flex flex-col items-center",children:[(0,s.jsx)("div",{className:"w-3 h-3 rounded-full ".concat("status_change"===e.action_type?"bg-marka-500":"note_added"===e.action_type?"bg-amber-500":"bg-gray-400")}),a<(w.history||[]).length-1&&(0,s.jsx)("div",{className:"w-0.5 flex-1 bg-gray-200 mt-1"})]}),(0,s.jsxs)("div",{className:"flex-1 pb-4",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsx)("span",{className:"font-medium text-sm text-gray-900",children:e.action_title}),(0,s.jsx)("span",{className:"text-xs text-gray-400",children:F(e.created_at)})]}),e.action_description&&(0,s.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:e.action_description}),e.created_by_name&&(0,s.jsxs)("p",{className:"text-[10px] text-gray-600 mt-1",children:["â ",e.created_by_name]})]})]},e.id))})]}),N&&(0,s.jsxs)("div",{className:"p-6",children:[(0,s.jsxs)("h3",{className:"font-semibold text-gray-900 flex items-center gap-2 mb-4",children:[(0,s.jsx)(n.A,{size:16}),"Notlar (",(null==w||null==(a=w.notes)?void 0:a.length)||0,")"]}),(0,s.jsxs)("div",{className:"flex gap-2 mb-4",children:[(0,s.jsx)("textarea",{value:D,onChange:e=>O(e.target.value),placeholder:"Not ekle...",className:"flex-1 px-3 py-2 border border-gray-200 rounded-lg text-sm resize-none h-20 focu
1s:ring-2 focus:ring-marka-500/20 focus:border-marka-500"}),(0,s.jsx)("button",{onClick:V,disabled:!D.trim()||K,className:"px-4 py-2 bg-marka-600 text-white rounded-lg text-sm font-medium hover:bg-marka-700 transition disabled:opacity-50 self-end",children:(0,s.jsx)(u.A,{size:16})})]}),(null==w?void 0:w.notes)&&w.notes.length>0&&(0,s.jsx)("div",{className:"space-y-2 max-h-40 overflow-y-auto",children:w.notes.map(e=>(0,s.jsxs)("div",{className:"p-3 rounded-lg text-sm ".concat(e.is_important?"bg-amber-50 border border-amber-200":"bg-gray-50"),children:[(0,s.jsx)("p",{className:"text-gray-700",children:e.note_text}),(0,s.jsxs)("div",{className:"flex items-center justify-between mt-2 text-xs text-gray-400",children:[(0,s.jsx)("span",{children:e.created_by_name||"Anonim"}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("span",{children:F(e.created_at)}),(0,s.jsx)("button",{onClick:()=>M(e.id),disabled:K,title:"Notu sil",className:"text-red-500 hover:text-red-700 disabled:opacity-40",children:"Sil"})]})]})]},e.id))})]})]})}),(0,s.jsx)("div",{className:"px-6 py-4 border-t border-gray-100 bg-gray-50 flex justify-end gap-2",children:(0,s.jsx)("button",{onClick:h,className:"px-4 py-2 text-gray-600 hover:bg-gray-100 rounded-lg text-sm font-medium transition",children:"Kapat"})})]})})]})}let b=h}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.