1import{az as F,a as w,b as M,d as A,j as e,q as S,ay as C,b1 as Y,r as j,M as L,I as V,B as W,s as U,S as E}from"./index-BJsnW-wr.js";import{I as H}from"./index.es-Ck7_p88h.js";import{s as O}from"./index-BrUtw_S4.js";import{T as _}from"./index-BjozU9ur.js";import{P as R}from"./paperclip-C7_3mIak.js";import{C as v}from"./circle-check-big-CcoU7ukA.js";import{C as q}from"./clock-C6ZxPx_7.js";import{K as J}from"./KedenDocumentViewModal-4LZ7hYTt.js";import{U as K}from"./index-B-npO-y5.js";import{C as z}from"./circle-x-CZziU-O8.js";import{R as Q}from"./index-C0qhYkxS.js";import{F as I}from"./index-Uuhpf9jm.js";import{S as G}from"./send-CBQufOJH.js";import"./index-DmuVq8ET.js";import"./TextLayer-BHGG73pZ.js";import"./tiny-invariant-CopsF_GD.js";import"./download-C9kXtWED.js";import"./chevron-left-B8frVpXD.js";import"./chevron-right-DDZdJPqh.js";import"./refresh-cw-CgglY1qd.js";import"./index-RGAA5-34.js";import"./DeleteOutlined-76cLY9SE.js";import"./progress-M6bcxpiF.js";import"./upload-DcfkEwJY.js";var f=(s=>(s.UNDER_REVIEW="UNDER_REVIEW",s.RESOLVED="RESOLVED",s.REJECTED="REJECTED",s))(f||{});const $=s=>{var r,n,m,g;const t=F({queryKey:["complaints-journal",s.filters,s.sort,s.sortColumn],queryFn:({pageParam:i=0})=>w.post("/cargo/shipment-inspection-event-complaint/page",{...s,page:i}).then(a=>a.data),getNextPageParam:(i,a)=>{const c=i.totalPages||0,h=a.length;return h<c?h:void 0},initialPageParam:0});return{data:((r=t.data)==null?void 0:r.pages.flatMap(i=>i.content))??[],isLoading:t.isLoading,hasNextPage:t.hasNextPage,fetchNextPage:t.fetchNextPage,totalElements:(g=(m=(n=t.data)==null?void 0:n.pages)==null?void 0:m[0])==null?void 0:g.totalElements}},X=()=>{const s=M();return A({onSuccess:t=>{s.invalidateQueries({queryKey:["complaints-journal"]}),O.success((t==null?void 0:t.status)===f.RESOLVED?"Ðалоба ÑÑпеÑно обÑабоÑана":"Ðалоба оÑклонена")},mutationFn:t=>w.patch(`/cargo/shipment-inspection-event-complaint/${t==null?void 0:t.complaintId}/review`,{...t,complaintId:void 0}).then(o=>o.data)})},{Text:y,Paragraph:Z}=S,ee={UNDER_REVIEW:{label:"Ðа ÑаÑÑмоÑÑении",color:"#f59e0b",bgColor:"#fef3c7",iconBg:"#fef3c7",icon:e.jsx(q,{className:"w-5 h-5 text-yellow-400"})},RESOLVED:{label:"РеÑено",color:"#10b981",bgColor:"#d1fae5",iconBg:"#d1fae5",icon:e.jsx(v,{className:"w-5 h-5 text-green-400"})},REJECTED:{label:"ÐÑказано",color:"#ef4444",bgColor:"#fee2e2",iconBg:"#fee2e2",icon:e.jsx(v,{className:"w-5 h-5 text-rose-400"})}},se=({complaint:s,onClick:t})=>{var r;const o=ee[s.status];return e.jsx("div",{onClick:()=>t(s),className:` 2 bg-white border border-[#e2e8f0] rounded-lg p-4 3 hover:border-[#3b82f6] hover:shadow-sm 4 transition-all cursor-pointer w-full 5 `,children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-full flex items-center justify-center flex-shrink-0",style:{backgroundColor:o.iconBg},children:o.icon}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1 flex-wrap",children:[e.jsx(y,{strong:!0,style:{color:"#0f172b",fontSize:14},children:s.userId}),e.jsx(_,{style:{color:o.color,backgroundColor:o.bgColor,border:"none",borderRadius:999,fontSize:12,fontWeight:500,lineHeight:"20px",padding:"0 8px",margin:0},children:o.label})]}),e.jsxs(y,{style:{color:"#71717a",fontSize:12,display:"block"},className:"mb-2",children:["РейÑ: ",s.shipmentId," ⢠",C(s.createdAt).format("YYYY-MM-DD HH:mm")]}),e.jsx(y,{strong:!0,style:{color:"#0f172b",fontSize:12,display:"block"},className:"mb-1",children:s.inspectorUserId}),e.jsx(Z,{ellipsis:{rows:2},style:{color:"#71717a",fontSize:14,marginBottom:8},children:s.comment}),((r=s.fileIds)==null?void 0:r.length)>0&&e.jsxs(Y,{size:4,children:[e.jsx(R,{className:"w-3 h-3",style:{color:"#71717a"}}),e.jsxs(y,{style:{color:"#71717a",fontSize:12},children:[s.fileIds.length," ",s.fileIds.length===1?"Ñайл":"Ñайла"]})]})]})]})})},{Text:l}=S,{TextArea:te}=V,oe=({complaint:s})=>e.jsxs("div",{className:"bg-[#f8fafc] rounded-lg p-4",children:[e.jsx(l,{strong:!0,style:{fontSize:14,color:"#0f172b",dis
5play:"block",marginBottom:12},children:"ÐнÑоÑмаÑÐ¸Ñ Ð¾ водиÑеле"}),e.jsx("div",{className:"grid grid-cols-2 gap-3",children:[{label:"ÐодиÑелÑ",value:s.userId||""},{label:"ТелеÑон",value:s.userId||""},{label:"ÐÐ¾Ð¼ÐµÑ ÑейÑа",value:s.shipmentId||""},{label:"ÐаÑа обÑаÑениÑ",value:C(s.createdAt).format("YYYY-MM-DD HH:mm")}].map(({label:t,value:o})=>e.jsxs("div",{children:[e.jsx(l,{style:{fontSize:12,color:"#71717a",display:"block",marginBottom:2},children:t}),e.jsx(l,{style:{fontSize:14,fontWeight:500,color:"#0f172b"},children:o})]},t))})]}),re=({complaint:s})=>e.jsxs("div",{children:[e.jsx(l,{strong:!0,style:{fontSize:14,color:"#0f172b",display:"block",marginBottom:8},children:"ÐпиÑание жалобÑ"}),e.jsxs("div",{className:"bg-[#f8fafc] rounded-lg p-4",children:[e.jsx(l,{style:{fontSize:12,fontWeight:500,color:"#f59e0b",display:"block",marginBottom:8},children:"ТеÑ
ниÑеÑÐºÐ°Ñ Ð¿Ñоблема"}),e.jsx(l,{style:{fontSize:14,color:"#0f172b"},children:s.comment})]})]}),k=({files:s})=>s!=null&&s.length?e.jsxs("div",{children:[e.jsx(l,{strong:!0,style:{fontSize:14,color:"#0f172b",display:"block",marginBottom:8},children:"ÐÑиложеннÑе ÑайлÑ"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:s.map(t=>e.jsx("div",{className:"bg-[#f8fafc] flex-1 rounded-lg p-3 flex items-center gap-2 hover:bg-[#f1f5f9] transition-colors",children:e.jsx(J,{doc:{fileId:t}})},t))})]}):null,le=({status:s,comment:t,reviewedAt:o,fileIds:r})=>{const n=s===f.REJECTED;return e.jsxs("div",{className:"space-y-3",children:[t&&e.jsxs("div",{children:[e.jsx(l,{strong:!0,style:{fontSize:14,color:"#0f172b",display:"block",marginBottom:8},children:"ÐÑÐ²ÐµÑ Ð°Ð´Ð¼Ð¸Ð½Ð¸ÑÑÑаÑоÑа"}),e.jsxs("div",{className:"bg-blue-50 rounded-lg p-4",children:[e.jsx(l,{style:{fontSize:14,color:"#0f172b"},children:t}),o&&e.jsx(l,{style:{fontSize:12,color:"#71717a",display:"block",marginTop:8},children:C(o).format("YYYY-MM-DD HH:mm")})]})]}),e.jsx(k,{files:r}),e.jsx("div",{className:U("bg-green-100 rounded-xl p-4 flex flex-col items-center gap-2",{"bg-rose-100":n}),children:n?e.jsxs(e.Fragment,{children:[e.jsx(z,{className:"w-7 h-7 text-[#ef4444]"}),e.jsx(l,{style:{color:"#ef4444",fontWeight:500,fontSize:14},children:"Ðалоба оÑклонена"})]}):e.jsxs(e.Fragment,{children:[e.jsx(v,{className:"w-7 h-7 text-[#10b981]"}),e.jsx(l,{style:{color:"#10b981",fontWeight:500,fontSize:14},children:"Ðалоба ÑÑпеÑно обÑабоÑана"})]})})]})},ne=({type:s,complaintId:t,onSuccess:o})=>{const[r,n]=j.useState(""),[m,g]=j.useState([]),[i,a]=j.useState([]),{mutateAsync:c,isPending:h}=X(),D=async()=>{const d={complaintId:t,status:s==="resolve"?f.RESOLVED:f.REJECTED,inspectorComment:r,inspectorFileIds:i};await c(d,{onSuccess:o})},B=s==="resolve";return e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx(l,{strong:!0,style:{fontSize:14,color:"#0f172b"},children:B?"ÐÑÐ²ÐµÑ Ð½Ð° жалобÑ":"ÐÑиÑина оÑказа"}),e.jsx(te,{rows:4,placeholder:"ÐведиÑе ÑекÑÑ Ð¾ÑвеÑа...",value:r,onChange:d=>n(d.target.value),style:{resize:"none"}}),e.jsx(K,{multiple:!0,maxCount:5,accept:"image/*,video/*,.pdf,.doc,.docx",fileList:m,onChange:({fileList:d,file:x})=>{if(g(d),x.status==="done"&&x.response){const u=x.response.fileId??x.response.id;u&&!i.includes(u)&&a(b=>[...b,u])}},onRemove:d=>{var u,b;const x=((u=d.response)==null?void 0:u.fileId)??((b=d.response)==null?void 0:b.id);x&&a(P=>P.filter(T=>T!==x))},style:{borderRadius:8},children:e.jsxs(I,{vertical:!0,align:"center",gap:4,style:{padding:"10px 0"},children:[e.jsx(R,{className:"w-5 h-5 text-gray-400"}),e.jsx(l,{style:{color:"#9ca3af",fontSize:13},children:"ÐÑикÑепиÑÑ ÑайлÑ"})]})}),e.jsx(I,{gap:8,children:e.jsxs(W,{block:!0,type:"primary",loading:h,onClick:D,disabled:!r.trim(),children:[e.jsx(G,{className:"size-4"}),"ÐÑпÑавиÑÑ Ð¾ÑвеÑ"]})})]})},ie=({rate:s})=>typeof s!="number"?null:e.jsxs("div",{children:[e.jsx(l,{strong:!0,style:{fontSize:14,color:"#0f172b",display:"block",marginBottom:8},children:"ÐÑенка пÑоезда"}),e.jsxs("div",{className:"bg-[#f8fafc] rounded-lg p-4 flex items-center gap-3",children:[e.jsx(Q,{disabled:!0,value:s}),e.jsxs(l,{style:{fontSize:14,fontWeight:500,color:"#71717a"},children:[s," из 5"]})]})]}),ae=({complaint:s,onClose:t})=>{const[o,r]=j.useState(null),n=()=>{r(null),t()};if(s)return e.jsx(L,{open:!!s,onCancel:n,title:e.jsxs(l,{strong:!0,style:{fontSize:18,color:"#0f172b"},children:["ÐеÑали Ð¶Ð°Ð»Ð¾Ð±Ñ #",(s==null?void 0:s.id)??"..."]}),width:670,centered:!0,footer:null,destroyOnHidden:!0,styles:{body:{maxHeight:"80vh",overflowY:"auto"},header:{paddingBottom:16}},children:e.jsxs("div",{className:"space-y-5",children:[e.jsx(oe,{complaint:s}),e.jsx(ie,{rate:s.rate}),e.jsx(re,{complaint:s}),e.jsx(k,{files:s.fileIds}),s.status===f.UNDER_REVIEW?e.jsx(e.Fragment,{children:o?e.jsx(ne,{type:o,complaintId:s.id,onSuccess:n}):e.jsxs("div",{className:"flex gap-3 pt-2",children:[e.jsxs("button",{onClick:()=>r("resolve"),className:"flex-1 bg-[#3b82f6] text-white rounded-lg px-4 py-2.5 text-sm font-medium hover:bg-[#2563eb] transition-colors flex items-center justify-center gap-2",children:[e.jsx(v,{className:"w-4 h-4"}),"ÐÑÑабоÑаÑÑ Ð¶Ð°Ð»Ð¾Ð±Ñ"]}),e.jsxs("button",{onClick:()=>r("reject"),className:"flex-1 bg-white border border-[#ef4444] text-[#ef4444] rounded-lg px-4 py-2.5 text-sm font-medium hover:bg-[#fef2f2] transition-colors flex items-center justify-center gap-2",children:[e.jsx(z,{className:"w-4 h-4"}),"ÐÑказаÑÑ"]})]})}):e.jsx(le,{comment:s==null?void 0:s.inspectorComment,reviewedAt:s==null?void 0:s.inspectorReviewedAt,status:s==null?void 0:s.status,fileIds:s==null?void 0:s.inspectorFileIds})]})})},{Text:N}=S,p=()=>e.jsx("div",{className:"border border-[#e2e8f0] rounded-lg p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(E.Avatar,{active:!0,size:40,shape:"circle"}),e.jsx("div",{className:"flex-1",children:e.jsx(E,{active:!0,paragraph:{rows:2},title:{width:"60%"}})})]})}),Pe=()=>{const[s,t]=j.useState(null),[o]=j.useState({page:0,size:10,sort:"DESC",sortColumn:"createdAt",filters:{}}),{data:r,isLoading:n,hasNextPage:m,fetchNextPage:g,totalElements:i}=$(o),a=r.filter(c=>c.status===f.UNDER_REVIEW).length;return n?e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx(p,{}),e.jsx(p,{}),e.jsx(p,{})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsx(N,{strong:!0,style:{fontSize:18,color:"#0f172b"},children:"УпÑавление жалобами"}),e.jsxs(N,{style:{fontSize:12,color:"#62748e"},children:["Ðа ÑаÑÑмоÑÑении: ",a]})]}),e.jsx(H,{dataLength:r.length,next:g,hasMore:!!m,loader:e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx(p,{}),e.jsx(p,{})]}),endMessage:r.length>0&&e.jsxs(N,{style:{display:"block",textAlign:"center",color:"#a1a1aa",fontSize:12,padding:"16px 0"},children:["ÐÑего жалоб: ",i]}),children:e.jsx("div",{className:"flex flex-col gap-4",children:r.map(c=>e.jsx(se,{complaint:c,onClick:h=>t(h)},c.id))})}),e.jsx(ae,{complaint:s,onClose:()=>t(null)})]})};export{Pe 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.