1import{x as w,eZ as A,e_ as T,e$ as M,f0 as N,r as i,j as a,G as R,m as C,b5 as k}from"./theme-3dfVej7W.js";import"./purify.es-LQkvcK5U.js";import{u as F}from"./useDebouncedRemoteSearch-D_evYOsJ.js";import{C as L}from"./index-BKUOnk1C.js";import{T as h}from"./index-I1ZxXO3B.js";import{A as B}from"./index-ClyUGHm2.js";import{S as x}from"./AntdIcon-B8e_FEAo.js";import{M as E}from"./index-C016Db5J.js";import{F as I,T as O}from"./index-C86gn5Ct.js";import"./vite-preload-helper-BXl3LOEh.js";import"./index-CPNG8-3L.js";import"./EllipsisOutlined-fLaExTxN.js";import"./PlusOutlined-DJbYRZlH.js";import"./isMobile-B_S5qVvp.js";import"./index-CwLtvCkV.js";import"./Sider-CaqjhNAo.js";import"./useBreakpoint-DBaSuQQQ.js";import"./index-C63dYVM1.js";import"./index-D10blwUV.js";import"./useForm-Cmblz3t1.js";function ne(){const{notification:m}=w.useApp(),c=A(),[y,u]=T(),[b,r]=M(),[f,{isLoading:_}]=N(),[s,p]=i.useState(null),[n,d]=i.useState(null),[l,o]=i.useState(null),{search:j}=F({delay:300,minLength:2,onSearch:e=>y(e)}),g=i.useMemo(()=>{const e={};return(u.data??[]).forEach(t=>{e[String(t.id)]={id:t.id,name:t.name_ru??"",bin:t.iin_bin??""}}),e},[u.data]),v=i.useMemo(()=>(r.data??[]).find(e=>e.budget_type.id===n)?.levels??[],[r.data,n]),S=async()=>{if(!(!s||n==null||l==null))try{await f({admin_id:s.id,budget_type_id:n,ac_level:l}).unwrap(),m.success({message:"ÐапÑÐ¾Ñ Ð¾ÑпÑавлен",description:`ÐдминиÑÑÑаÑоÑÑ Ð¾ÑÑеÑноÑÑи «${s.name}» оÑпÑавлен запÑоÑ.`}),p(null),d(null),o(null)}catch(e){m.error({message:k(e)??"Ðе ÑдалоÑÑ Ð¾ÑпÑавиÑÑ Ð·Ð°Ð¿ÑоÑ"})}};return a.jsx("div",{className:"w-full",children:a.jsxs(L,{title:"ÐдминиÑÑÑаÑоÑÑ Ð¾ÑÑеÑноÑÑи",children:[a.jsx(h.Title,{level:5,children:"ÐоиÑк админиÑÑÑаÑоÑа"}),a.jsxs("div",{className:"flex gap-4 mt-4 flex-wrap items-start",children:[a.jsx(B,{className:"min-w-96",placeholder:"ÐÐРили наименование оÑганизаÑии",onSearch:j,options:Object.values(g).map(e=>({value:String(e.id),label:a.jsxs("div",{className:"flex flex-col",children:[a.jsx("div",{className:"font-medium",children:e.name}),a.jsx("span",{className:"text-neutral-500 text-sm",children:e.bin})]})})),onSelect:e=>{const t=g[e];p(t),d(null),o(null),b(t.id)}}),a.jsx(x,{className:"min-w-64",placeholder:"Ðид бÑджеÑа",value:n,disabled:!s,loading:r.isFetching,options:(r.data??[]).map(e=>({value:e.budget_type.id,label:[e.budget_type.code,e.budget_type.name_ru].filter(Boolean).join(" â ")})),onChange:e=>{d(e),o(null)}}),a.jsx(x,{className:"min-w-48",placeholder:"УÑÐ¾Ð²ÐµÐ½Ñ Ð¾ÑÑеÑноÑÑи",value:l,disabled:n==null,options:v.map(e=>({value:e,label:String(e)})),onChange:o}),a.jsx(R,{type:"primary",disabled:!s||n==null||l==null,loading:_,onClick:()=>E.confirm({title:"ÐÑпÑавиÑÑ Ð·Ð°Ð¿ÑÐ¾Ñ Ð°Ð´Ð¼Ð¸Ð½Ð¸ÑÑÑаÑоÑÑ Ð¾ÑÑеÑноÑÑи?",content:`${s?.name} (${s?.bin})`,okText:"ÐÑпÑавиÑÑ",cancelText:"ÐÑмена",onOk:S}),children:"ÐÑпÑавиÑÑ Ð·Ð°Ð¿ÑоÑ"})]}),a.jsx(I,{rowKey:"id",className:"mt-6",loading:c.isFetching,dataSource:c.data??[],columns:[{title:"ÐÑганизаÑиÑ",key:"admin",render:(e,t)=>a.jsxs(a.Fragment,{children:[a.jsx("div",{children:t.admin_name??"â"}),a.jsx(h.Text,{type:"secondary",children:t.admin_bin??""})]})},{title:"ÐÑджеÑ",key:"budget",render:(e,t)=>t.budget_type?[t.budget_type.code,t.budget_type.name_ru].filter(Boolean).join(" â "):"â"},{title:"УÑÐ¾Ð²ÐµÐ½Ñ Ð¾ÑÑеÑноÑÑи",dataIndex:"ac_level",width:120,render:e=>e??"â"},{title:"СÑаÑÑÑ",key:"status",render:(e,t)=>a.jsx(O,{children:t.status})},{title:"ÐÑиÑина оÑклонениÑ",dataIndex:"reject_reason",render:e=>e??"â"},{title:"ÐаÑа запÑоÑа",key:"crdate",width:140,render:(e,t)=>t.crdate?C(t.crdate).format("YYYY-MM-DD HH:mm"):"â"}]})]})})}export{ne 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.