1import{j as e}from"./jsx-runtime-D_zvdyIk.js";import{r as x,u as $}from"./createLucideIcon-CiWnlb16.js";import{a as M,dB as R,d as A,e as m,pl as O,pm as z,pn as L,po as q,pp as B,pq as K,o as V,gE as Y,pr as w,ps as G,pt as H,bb as D,pu as U,pv as J,L as Q,pw as S,aa as W,px as X}from"./loginCallback-DUlVA6A0.js";import{a as k}from"./Select-YNaQnfBW.js";import{T as Z}from"./index-CQOuJFSK.js";import{C as ee}from"./Close-C9FyhMtz.js";import te from"./PlanCreateForm-Ce0Ivd6g.js";import se from"./ReportCreateForm-DJLunwZM.js";import{u as ae}from"./notistack.esm-h7EINNRQ.js";import{C as oe}from"./Collapse-CjKK4Wtk.js";import{I as le}from"./index-C0C2KPEQ.js";import{F as ne}from"./FileDownloadOutlined-DXpBlf-f.js";import"./config.release-CKeoGYk7.js";import"./ErrorMessage-BzkwuuEb.js";import"./CheckCircle-HampXhRV.js";import"./DeleteOutline-CMp1eq1T.js";import"./TransitionGroupContext-BqazGbpp.js";import"./utils-CrHD0CeB.js";const re=M(e.jsx("path",{d:"M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.89-2-2-2m0 16H5V7h14zm-5.5-6c0 .83-.67 1.5-1.5 1.5s-1.5-.67-1.5-1.5.67-1.5 1.5-1.5 1.5.67 1.5 1.5M12 9c-2.73 0-5.06 1.66-6 4 .94 2.34 3.27 4 6 4s5.06-1.66 6-4c-.94-2.34-3.27-4-6-4m0 6.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5"}),"Preview");function P({title:s,onClose:n,children:o,widthClass:c="w-full max-w-[880px]",sideMenuWidth:f=100}){return x.useEffect(()=>{const d=p=>{p.key==="Escape"&&n()};document.addEventListener("keydown",d);const u=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",d),document.body.style.overflow=u}},[n]),R.createPortal(e.jsx("div",{className:"fixed inset-0 z-[999999999] flex items-center justify-center overflow-y-auto bg-[rgba(15,23,42,0.45)] p-6",style:{paddingLeft:f+24},onMouseDown:n,children:e.jsxs("div",{className:`relative ${c} max-h-[90vh] my-8 bg-white rounded-xl shadow-[0_20px_60px_rgba(0,0,0,0.25)] flex flex-col overflow-y-auto`,onMouseDown:d=>d.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center justify-between px-8 py-5 border-b border-[#e0e9f1]",children:[e.jsx("h2",{className:"m-0 text-[20px] font-bold tracking-[0.3px] text-[var(--page-content-title)]",children:s}),e.jsx("button",{type:"button",title:"ÐакÑÑÑÑ",onClick:n,className:"cursor-pointer inline-flex items-center justify-center w-8 h-8 rounded-md text-[#627d98] hover:bg-[#e1f1fa] hover:text-[#2a86b3] transition-colors",children:e.jsx(ee,{className:"",fontSize:"small"})})]}),e.jsx("div",{className:"p-8",children:o})]})}),document.body)}const h=14,y=[{value:0,label:"ÐÑе"},{value:1,label:"ÐланÑ"},{value:2,label:"ÐÑÑÑÑÑ"}],F="px-5 py-2.5 rounded-md font-semibold text-white cursor-pointer transition-colors whitespace-nowrap",ie=`${F} bg-[#2aa3d0] shadow-[0_2px_5px_rgba(42,163,208,0.3)] hover:bg-[#2a86b3]`,de=`${F} bg-[#0e9d4c] shadow-[0_2px_5px_rgba(14,157,76,0.3)] hover:bg-[#0b8540]`,_=s=>{if(!s)return null;const n=s.getFullYear(),o=String(s.getMonth()+1).padStart(2,"0"),c=String(s.getDate()).padStart(2,"0");return`${n}-${o}-${c}`},ce=({type:s})=>e.jsx("span",{className:`inline-block px-2.5 py-1 rounded-full text-xs font-semibold ${s===1?"bg-[#e6f4fb] text-[#2189b3]":"bg-[#e7f7ee] text-[#0e9d4c]"}`,children:s===1?"Ðлан":"ÐÑÑÑÑ"}),pe=({item:s,isExpanded:n,onToggle:o,onEdit:c})=>{const f=`${s.readjustmentType}-${s.id}`,{enqueueSnackbar:d}=ae(),[u,p]=x.useState({}),g={anchorOrigin:{vertical:"top",horizontal:"right"}},v=async t=>{if(u[t.id]===void 0)try{p(l=>({...l,[t.id]:0})),await X({fileId:t.fileId||t.id,fileName:t.value,documentPlace:13,id:t.id},l=>{p(r=>({...r,[t.id]:l}))})}catch(l){d(l?.response?.data?.message||"ÐÑибка ÑкаÑÐ¸Ð²Ð°Ð½Ð¸Ñ Ñайла",{variant:"warning",...g})}finally{p(l=>{const r={...l};return delete r[t.id],r})}};return e.jsxs("div",{className:`border rounded-lg bg-white overflow-hidden transition-all shadow-[0_2px_5px_rgba(0,0,0,0.03)] ${n?"border-[#2aa3d0] shadow-[0_4px_12px_rgba(42,163,208,0.15)]":"border-[#e0e9f1]"}`,children:[e.jsxs("div",{className:`flex items-center gap-3 px-4 py-3 transition-colors cursor-pointer ${n?"bg-[#e1f1fa]":"hover:bg-[#e1f1fa]"}`,onClick:()=>o(f),children:[e.jsx("span",{className:"shrink-0",children:e.jsx(ce,{type:s.readjustmentType})}),e.jsx("span",{className:"text-sm font-semibold text-[#334e68] shrink-0 w-[120px] lg:w-[160px] truncate",title:s.debtor?.value,children:s.debtor?.value}),e.jsx("span",{className:"text-sm text-[#334e68] flex-1 min-w-0 truncate",title:s.title,children:s.title}),e.jsx("span",{className:"text-sm text-[#627d98] whitespace-nowrap",children:W(s.date)}),e.jsxs("span",{className:"text-xs text-[#627d98] whitespace-nowrap shrink-0",children:[s.documents.length," док."]}),e.jsx("button",{className:"btn-icon-action shrink-0",title:"ÐÑоÑмоÑÑ",onClick:t=>{t.stopPropagation(),c(s)},children:e.jsx(re,{fontSize:"small"})})]}),e.jsx(oe,{in:n,timeout:"auto",unmountOnExit:!0,children:e.jsx("div",{className:"border-t border-[#e0e9f1] p-5 bg-transparent",children:e.jsx("div",{className:"flex flex-col gap-1 max-h-[260px] overflow-auto",children:s.documents.map(t=>{const l=u[t.id],r=l!==void 0;return e.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded-md text-sm text-[#334e68] hover:bg-[#e1f1fa] transition-colors",children:[e.jsx(le,{fontSize:"small",className:"!fill-[#2aa3d0] shrink-0"}),e.jsx("span",{className:"truncate flex-1",children:t.value}),r?e.jsxs("div",{className:"flex items-center gap-3 min-w-[200px] shrink-0",children:[e.jsx("div",{className:"h-2 w-full bg-[#eef2f7] rounded-full overflow-hidden flex-1",children:e.jsx("div",{className:"h-full bg-[#2aa3d0] transition-all duration-200",style:{width:`${l}%`}})}),e.jsxs("span",{className:"text-xs text-[#64748b] w-10 text-right tabular-nums shrink-0",children:[l,"%"]})]}):e.jsx("button",{onClick:()=>v(t),className:"shrink-0 p-1 hover:bg-[#d0e8f5] rounded-full transition-colors cursor-pointer",title:"СкаÑаÑÑ Ñайл",children:e.jsx(ne,{fontSize:"small",className:"!fill-[#2aa3d0]"})})]},t.id)})})})})]})};function Fe(){$();const s=A(),n=m(O),o=m(z),c=m(L),f=m(q),d=m(B),u=m(K),[p,g]=x.use
1State(null),v=a=>g(i=>i===a?null:a),[t,l]=x.useState(null),r=()=>l(null),N=a=>a.documents.map(i=>({id:i.id,name:i.value})),{debtors:I,debtorsGroupByStatus:b}=m(V),E=x.useMemo(()=>{if(console.log(b),b)return Object.entries(b).sort(([a],[i])=>Number(i)-Number(a)).map(([a,i])=>({label:Number(a)===Y.Active?"ÐкÑивнÑе":"ÐавеÑÑеннÑе",options:i.map(C=>({value:C.id,label:C.value}))}))},[b]),j=()=>{s(S(1)),s(w({startFields:{filters:o,pagination:{count:h,offset:0}}}))};x.useEffect(()=>{s(w({startFields:{filters:o,pagination:{count:h,offset:0}}}))},[]),x.useEffect(()=>{j()},[o]);const T=o.debtorId?{value:o.debtorId,label:I.find(a=>a.id===o.debtorId)?.value}:null;return e.jsxs("div",{className:"w-full bg-white grid grid-cols-1 md:grid-cols-[220px_minmax(0,1fr)] overflow-hidden m-0 p-0 box-border text-[#334e68]",children:[e.jsxs("div",{className:"text-[0.8rem] min-w-0 bg-[#e9f7ff] border-b md:border-b-0 md:border-r border-[#e0e9f1] p-4 flex flex-col shadow-[2px_0_5px_rgba(0,0,0,0.02)]",children:[e.jsx(k,{options:E,label:"Ðолжник",value:T,defaultValue:null,isClearable:!0,isSearchable:!0,placeholder:"ÐоиÑк...",noOptionsMessage:"ÐиÑего не найдено",onChange:a=>s(G(a?.value||null))}),e.jsx(k,{options:y,label:"Тип",value:y.find(a=>a.value===o.type)??y[0],isClearable:!0,isSearchable:!1,placeholder:"Тип",onChange:a=>s(H(a?.value))}),e.jsx(D,{label:"ÐаÑа оÑ:",selectsRange:!1,selected:o.dateFrom?new Date(o.dateFrom):null,maxDate:new Date,onChange:a=>s(U(_(a)))}),e.jsx(D,{label:"ÐаÑа до:",selectsRange:!1,selected:o.dateTo?new Date(o.dateTo):null,maxDate:new Date,onChange:a=>s(J(_(a)))})]}),e.jsxs("div",{className:"min-w-0 overflow-x-hidden overflow-y-auto flex flex-col gap-5 pt-4 px-4 lg:pt-6 lg:px-6",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsx("h2",{className:"m-0 text-[20px] lg:text-[22px] font-bold tracking-[0.3px] text-[var(--page-content-title)]",children:"ÐÐ»Ð°Ð½Ñ Ð¸ оÑÑÑÑÑ"}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2.5",children:[e.jsx("button",{className:ie,onClick:()=>l({type:"plan",mode:"create"}),children:"ÐобавиÑÑ Ð¿Ð»Ð°Ð½"}),e.jsx("button",{className:de,onClick:()=>l({type:"report",mode:"create"}),children:"ÐобавиÑÑ Ð¾ÑÑÑÑ"})]})]}),c?e.jsx(Q,{}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex flex-col gap-2.5",children:n.length>0?n.map(a=>e.jsx(pe,{item:a,isExpanded:p===`${a.readjustmentType}-${a.id}`,onToggle:v,onEdit:i=>l({type:i.readjustmentType===1?"plan":"report",mode:"edit",item:i})},`${a.readjustmentType}-${a.id}`)):e.jsx("div",{className:"px-4 py-10 text-center text-[#627d98]",children:"ÐиÑего не найдено"})}),e.jsx("div",{className:"p-5 flex justify-end",children:e.jsx(Z,{currentPage:d,setCurrentPage:S,offset:u,request:w,requestConfig:{filters:o},count:h,totalPages:Math.ceil(f/h)})})]})]}),t?.type==="plan"&&e.jsx(P,{title:t.mode==="edit"?"РедакÑиÑование плана":"Ðобавление плана",onClose:r,children:e.jsx(te,{mode:t.mode,entityId:t.item?.id,initial:t.mode==="edit"&&t.item?{debtor:t.item.debtor?{id:t.item.debtor.id,value:t.item.debtor.value}:null,typeId:t.item.typeId??null,date:t.item.date,documents:N(t.item)}:void 0,onClose:r,onSaved:j})}),t?.type==="report"&&e.jsx(P,{title:t.mode==="edit"?"РедакÑиÑование оÑÑÑÑа":"Ðобавление оÑÑÑÑа",onClose:r,children:e.jsx(se,{mode:t.mode,entityId:t.item?.id,initial:t.mode==="edit"&&t.item?{debtor:t.item.debtor?{id:t.item.debtor.id,value:t.item.debtor.value}:null,plan:t.item.plan??null,typeId:t.item.typeId??null,date:t.item.date,documents:N(t.item)}:void 0,onClose:r,onSaved:j})})]})}export{Fe as default};
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.