1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7585],{3594:function(e,t,a){(window.__NEXT_P=window.__NEXT_P||[]).push(["/report/cs-performance",function(){return a(10674)}])},70850:function(e,t,a){"use strict";var n=a(85893),d=a(28611),l=a(27484),s=a.n(l);let r=e=>{let{value:t,onChange:a,style:l={},className:r=""}=e,i=[{label:"Yesterday",value:[s()().add(-1,"d"),s()().add(-1,"d")]},{label:"Today",value:[s()(),s()()]},{label:"This Month",value:[s()().startOf("month"),s()()]},{label:"Last Month",value:[s()().add(-1,"month").startOf("month"),s()().add(-1,"month").endOf("month")]},{label:"Last 7 Days",value:[s()().add(-7,"d"),s()()]},{label:"Last 14 Days",value:[s()().add(-14,"d"),s()()]},{label:"Last 30 Days",value:[s()().add(-30,"d"),s()()]},{label:"Last 90 Days",value:[s()().add(-90,"d"),s()()]}];return(0,n.jsx)(d.Z.RangePicker,{className:r,style:l,value:t,onChange:a,presets:i})};t.Z=r},10674:function(e,t,a){"use strict";a.r(t),a.d(t,{default:function(){return b}});var n=a(85893),d=a(67294),l=a(9008),s=a.n(l),r=a(92477),i=a(34041),o=a(71230),c=a(15746),u=a(76920),x=a(27484),p=a.n(x),h=a(4393),f=a(53575),m=a(83473),j=e=>{let{title:t="Top Sales",loading:a,data:l,field:s,perc:r=!1}=e,[i,u]=(0,d.useState)([]);return(0,d.useEffect)(()=>{u(l.map(e=>({name:e.name,count:e[s]})).sort((e,t)=>t.count-e.count))},[l]),(0,n.jsx)(h.Z,{bodyStyle:{padding:16},title:t,loading:a,children:i.map((e,t)=>e.count?(0,n.jsxs)(o.Z,{gutter:12,children:[(0,n.jsx)(c.Z,{flex:"none",children:(0,n.jsx)(f.Z,{count:t+1,style:{background:"#314659",color:"#fafafa"}})}),(0,n.jsx)(c.Z,{flex:"auto",children:e.name}),(0,n.jsx)(c.Z,{flex:"none",children:r?"".concat(e.count,"%"):(0,m.W_)(e.count)})]},t):null)})},g=a(7851),y=a(70850),v=()=>{let[e]=r.Z.useForm(),[t,a]=(0,d.useState)(!0),[l,s]=(0,d.useState)([]),[x,h]=(0,d.useState)([]),[f,v]=(0,d.useState)({date:[p()().subtract(30,"days"),p()().subtract(0,"days")],product:""}),Z=e=>{e.q||b()},b=()=>{let t=e.getFieldsValue();v(t)};(0,d.useEffect)(()=>{g.api.get("/api/product/select").then(e=>{let{data:t}=e.data;h(t.map(e=>({value:e.id||e._id,label:e.name})))})},[]),(0,d.useEffect)(()=>{let{date:e=[],cs:t="",product:n=""}=f||{};if(!Array.isArray(e)||2!==e.length||!e[0]||!e[1])return;let d=e[0].format("YYYY-MM-DD"),l=e[1].format("YYYY-MM-DD");a(!0),g.api.get("/api/dashboard/cs-performance",{params:{from:d,to:l,cs:t,product:n}}).then(e=>{let{data:t}=e;s(t.sort((e,t)=>t.closing-e.closing)),a(!1)})},[f]);let R=(e,t,a,n)=>{let{field:d,order:r}=a;Array.isArray(d)?"ascend"==r?s(l.sort((e,t)=>e[d[0]][d[1]]-t[d[0]][d[1]])):s(l.sort((e,t)=>t[d[0]][d[1]]-e[d[0]][d[1]])):"ascend"==r?s(l.sort((e,t)=>e[d]-t[d])):s(l.sort((e,t)=>t[d]-e[d]))};return(0,n.jsxs)("div",{children:[(0,n.jsxs)(r.Z,{form:e,onValuesChange:Z,className:"search-field",initialValues:f,layout:"inline",style:{width:"100%",background:"#FFF",padding:16,margin:"8px 1px"},children:[(0,n.jsx)(r.Z.Item,{children:"Filter:"}),(0,n.jsx)(r.Z.Item,{name:"date",children:(0,n.jsx)(y.Z,{style:{minWidth:250}})}),(0,n.jsx)(r.Z.Item,{name:"product",initialValue:"",children:(0,n.jsx)(i.Z,{dropdownMatchSelectWidth:!1,placeholder:"Semua Produk",options:[{value:"",label:"Semua Produk"},...x]})})]}),(0,n.jsxs)(o.Z,{gutter:[8,8],children:[(0,n.jsx)(c.Z,{span:8,children:(0,n.jsx)(j,{title:"Top Paid Ratio",loading:t,data:l,field:"paidRatio",perc:!0})}),(0,n.jsx)(c.Z,{span:8,children:(0,n.jsx)(j,{title:"Top Sales",loading:t,data:l,field:"lead"})}),(0,n.jsx)(c.Z,{span:8,children:(0,n.jsx)(j,{title:"Top Revenue",loading:t,data:l,field:"netRev"})}),(0,n.jsx)(c.Z,{span:24,children:(0,n.jsx)(u.Z,{bordered:!0,scroll:{x:!0},dataSource:l,onChange:R,loading:t,pagination:!1,columns:[{title:"Nama CS",dataIndex:"name"},{title:"Order",dataIndex:"lead"},{title:"Paid",dataIndex:"paid"},{title:"Paid Ratio",dataIndex:"paidRatio",render:e=>"".concat(e||0,"%")},{title:"Quantity",dataIndex:"quantity"},{title:"Unpaid",dataIndex:"unpaid"},{title:"Gross Revenue",dataIndex:"grossRev",render:e=>"Rp".concat((0,m.W_)(e||0))},{title:"Net Revenue",dataIndex:"netRev",render:e=>"Rp".concat((0,m.W_)(e||0))},{title:"Gross Profit",dataIndex:"grossProfit",render:e=>"Rp".concat((0,m.W_)(e||0))},{title:"Total COD",dataIndex:"cod"},{title:"COD On Process",dataIndex:"codProcess"},{title:"COD Success",dataIndex:"codSuccess"},{title:"COD Failed",dataIndex:"codFailed"},{title:"COD Rate",dataIndex:"codRate",render:e=>"".concat(e||0,"%")}
1]})})]})]})};function Z(){return(0,n.jsxs)(d.Fragment,{children:[(0,n.jsxs)(s(),{children:[(0,n.jsx)("title",{children:"Report CS"}),(0,n.jsx)("meta",{name:"Report CS Lincah.id",content:"Report CS Lincah.id"})]}),(0,n.jsx)("main",{children:(0,n.jsx)(v,{})})]})}Z.layout="main";var b=Z}},function(e){e.O(0,[4310,4393,2808,5742,4533,6920,8611,9774,2888,179],function(){return e(e.s=3594)}),_N_E=e.O()}]);
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.