Files
dailygrubs_console_build/build/static/js/2476.71296e1c.chunk.js

1 line
16 KiB
JavaScript

"use strict";(self.webpackChunkmantis_material_react=self.webpackChunkmantis_material_react||[]).push([[2476],{82476:function(e,o,n){n.r(o);var r=n(1413),t=n(74165),i=n(15861),c=n(29439),s=n(47313),l=n(70501),a=n(42832),d=n(48119),x=n(61113),u=n(57829),h=n(9019),f=n(84488),p=n(54882),g=n(47131),_=n(51629),A=n(66835),b=n(23477),m=n(24076),E=n(67478),S=n(57861),P=n(61689),v=n(62323),R=n(56573),Z=n(10658),C=n.n(Z),j=n(58467),T=n(22539),I=n(11577),w=n(46417),y="0 8px 24px rgba(15, 23, 42, 0.08)",k="#0f172a",W="#64748b",z="#94a3b8",H="#e2e8f0",L="#f1f5f9",D="#f8fafc",O=function(e,o){return"".concat(e).concat(o)},B=function(e){return O(e,"08")},U=function(e){return O(e,"18")},K=function(e){return O(e,"26")},M=function(e){return O(e,"55")},N="#662582",F=[{idx:0,billStatus:0,label:"All",color:N,icon:T.VHP,countKey:"totalcount"},{idx:1,billStatus:1,label:"Open",color:"#f59e0b",icon:T.Ley,countKey:"pendingcount"},{idx:2,billStatus:2,label:"Overdue",color:"#ef4444",icon:T.C1n,countKey:"overduecount"},{idx:3,billStatus:3,label:"Paid",color:"#10b981",icon:T.ZSR,countKey:"paidcount"}];function Y(e){return new Intl.NumberFormat("en-IN",{style:"currency",currency:"INR",minimumFractionDigits:2}).format(e||0)}o.default=function(){var e=(0,j.s0)(),o=(0,s.useState)(0),n=(0,c.Z)(o,2),Z=n[0],O=n[1],V=(0,s.useState)(10),G=(0,c.Z)(V,2),q=G[0],X=G[1],Q=(0,s.useState)(0),J=(0,c.Z)(Q,2),$=J[0],ee=J[1],oe=(0,s.useState)([]),ne=(0,c.Z)(oe,2),re=ne[0],te=ne[1],ie=(0,s.useState)(0),ce=(0,c.Z)(ie,2),se=ce[0],le=ce[1],ae=(0,s.useState)(!1),de=(0,c.Z)(ae,2),xe=de[0],ue=de[1],he=(0,s.useState)({}),fe=(0,c.Z)(he,2),pe=fe[0],ge=fe[1],_e=(0,s.useState)(""),Ae=(0,c.Z)(_e,2),be=Ae[0],me=Ae[1],Ee=(0,s.useState)(""),Se=(0,c.Z)(Ee,2),Pe=Se[0],ve=Se[1],Re=localStorage.getItem("tenantid"),Ze=(0,s.useRef)(null);(0,s.useEffect)((function(){var e=function(e){"k"===e.key&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),Ze.current&&Ze.current.focus()),"Escape"===e.key&&document.activeElement===Ze.current&&Ze.current.blur()};return document.addEventListener("keydown",e),function(){return document.removeEventListener("keydown",e)}}),[]),(0,s.useEffect)((function(){var e=setTimeout((function(){return ve(be)}),350);return function(){return clearTimeout(e)}}),[be]);var Ce=function(){var e=(0,i.Z)((0,t.Z)().mark((function e(){var o;return(0,t.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,R.Z.get("".concat({NODE_ENV:"production",PUBLIC_URL:"",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0,FAST_REFRESH:!0,REACT_APP_API_URL:"https://mock-data-api-nextjs.vercel.app/",REACT_APP_AUTH0_CLIENT_ID:"",REACT_APP_AUTH0_DOMAIN:"",REACT_APP_AWS_APP_CLIENT_ID:"",REACT_APP_AWS_POOL_ID:"",REACT_APP_FIREBASE_API_KEY:"",REACT_APP_FIREBASE_APP_ID:"",REACT_APP_FIREBASE_AUTH_DOMAIN:"",REACT_APP_FIREBASE_MEASUREMENT_ID:"",REACT_APP_FIREBASE_MESSAGING_SENDER_ID:"",REACT_APP_FIREBASE_PROJECT_ID:"",REACT_APP_FIREBASE_STORAGE_BUCKET:"",REACT_APP_GOOGLE_MAPS_API_KEY:"AIzaSyCF4KatYCI3vqz1_H3kiHeyS3yCMfYToh8",REACT_APP_RIDER_ACCESS_ID:"AAAAILMpCEU:APA91bEavuOllBI6sFgYtxXAgNmAVwNA-MnCMHLGlR4_t7UqpLajAkdn3T0CZr_zaLBknLyim9ytFLMZgbeXmKqTad_PKCbqlYjHpaizVrLXtecxqyEy4UktIacK2UvHVUATHL-7VQQk",REACT_APP_VERSION:"v2.1.0"}.REACT_APP_URL,"/invoice/getinvoiceinsight/?tenantid=").concat(Re));case 3:o=e.sent,ge(o.data.details||{}),e.next=10;break;case 7:e.prev=7,e.t0=e.catch(0),console.log("insightResponse",e.t0);case 10:case"end":return e.stop()}}),e,null,[[0,7]])})));return function(){return e.apply(this,arguments)}}();(0,s.useEffect)((function(){Ce()}),[]);var je=function(){var e=(0,i.Z)((0,t.Z)().mark((function e(){var o,n;return(0,t.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return ue(!0),e.prev=1,o="".concat({NODE_ENV:"production",PUBLIC_URL:"",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0,FAST_REFRESH:!0,REACT_APP_API_URL:"https://mock-data-api-nextjs.vercel.app/",REACT_APP_AUTH0_CLIENT_ID:"",REACT_APP_AUTH0_DOMAIN:"",REACT_APP_AWS_APP_CLIENT_ID:"",REACT_APP_AWS_POOL_ID:"",REACT_APP_FIREBASE_API_KEY:"",REACT_APP_FIREBASE_APP_ID:"",REACT_APP_FIREBASE_AUTH_DOMAIN:"",REACT_APP_FIREBASE_MEASUREMENT_ID:"",REACT_APP_FIREBASE_MESSAGING_SENDER_ID:"",REACT_APP_FIREBASE_PROJECT_ID:"",REACT_APP_FIREBASE_STORAGE_BUCKET:"",REACT_APP_GOOGLE_MAPS_API_KEY:"AIzaSyCF4KatYCI3vqz1_H3kiHeyS3yCMfYToh8",REACT_APP_RIDER_ACCESS_ID:"AAAAILMpCEU:APA91bEavuOllBI6sFgYtxXAgNmAVwNA-MnCMHLGlR4_t7UqpLajAkdn3T0CZr_zaLBknLyim9ytFLMZgbeXmKqTad_PKCbqlYjHpaizVrLXtecxqyEy4UktIacK2UvHVUATHL-7VQQk",REACT_APP_VERSION:"v2.1.0"}.REACT_APP_URL,"/invoice/getallinvoice/?billstatus=").concat(se,"&tenantid=").concat(Re),e.next=5,R.Z.get(o);case 5:n=e.sent,te(n.data.details||[]),e.next=12;break;case 9:e.prev=9,e.t0=e.catch(1),console.log("fetchdeliverylist",e.t0);case 12:return e.prev=12,ue(!1),e.finish(12);case 15:case"end":return e.stop()}}),e,null,[[1,9,12,15]])})));return function(){return e.apply(this,arguments)}}();(0,s.useEffect)((function(){je(),O(0)}),[se]);var Te=(re||[]).filter((function(e){return String(e.invoiceno||"").toLowerCase().includes(String(Pe||"").toLowerCase())})),Ie=function(e){var o=F[e];ee(e),le(o.billStatus),me("")},we=F.map((function(e){var o;return(0,r.Z)((0,r.Z)({},e),{},{value:null!==(o=null===pe||void 0===pe?void 0:pe[e.countKey])&&void 0!==o?o:0})}));return(0,w.jsxs)(w.Fragment,{children:[xe&&(0,w.jsx)(I.Z,{}),(0,w.jsx)(l.Z,{elevation:0,sx:{mb:{xs:1,md:1.25},px:{xs:1.5,sm:2},py:{xs:1,sm:1.25},borderRadius:2,border:"1px solid",borderColor:H,background:"linear-gradient(135deg, ".concat(B(N)," 0%, ").concat(B("#9255AB")," 100%)"),boxShadow:y},children:(0,w.jsxs)(a.Z,{direction:"row",alignItems:"center",spacing:1.25,children:[(0,w.jsx)(d.Z,{variant:"rounded",sx:{width:36,height:36,bgcolor:N,color:"#fff",borderRadius:1.5,boxShadow:"0 4px 12px ".concat(K(N))},children:(0,w.jsx)(T.VHP,{size:19})}),(0,w.jsxs)(a.Z,{spacing:.125,children:[(0,w.jsx)(x.Z,{variant:"h3",sx:{fontWeight:800,color:k,lineHeight:1.1,fontSize:{xs:"1.1rem",sm:"1.25rem",md:"1.375rem"}},children:"Invoices"}),(0,w.jsxs)(a.Z,{direction:"row",alignItems:"center",spacing:.75,children:[(0,w.jsx)(u.Z,{sx:{width:7,height:7,borderRadius:"50%",bgcolor:"#10b981",boxShadow:"0 0 0 3px rgba(16,185,129,0.18)"}}),(0,w.jsxs)(x.Z,{sx:{fontSize:11.5,color:W,fontWeight:600},children:["Live \xb7 ",F[$].label]})]})]})]})}),(0,w.jsx)(h.ZP,{container:!0,spacing:{xs:1,sm:1.25,md:1.5},children:we.map((function(e){var o=e.icon,n=$===e.idx;return(0,w.jsx)(h.ZP,{item:!0,xs:6,sm:6,md:3,children:(0,w.jsxs)(l.Z,{elevation:0,onClick:function(){return Ie(e.idx)},sx:{cursor:"pointer",position:"relative",overflow:"hidden",px:{xs:1.25,sm:1.5},py:{xs:.875,sm:1.125},borderRadius:2,border:"1px solid",borderColor:n?M(e.color):H,background:"#fff",boxShadow:n?"0 4px 14px ".concat(K(e.color)):"none",transition:"transform 0.15s, box-shadow 0.15s, border-color 0.15s","&:hover":{transform:"translateY(-1px)",boxShadow:y,borderColor:M(e.color)}},children:[(0,w.jsx)(u.Z,{sx:{position:"absolute",top:0,left:0,bottom:0,width:3,background:e.color}}),(0,w.jsxs)(a.Z,{direction:"row",alignItems:"center",justifyContent:"space-between",spacing:1,sx:{pl:.5},children:[(0,w.jsxs)(a.Z,{spacing:.125,sx:{minWidth:0,flex:1},children:[(0,w.jsxs)(x.Z,{sx:{color:W,fontWeight:700,letterSpacing:.4,textTransform:"uppercase",fontSize:10.5,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",lineHeight:1.2},children:[e.label," Invoices"]}),(0,w.jsx)(x.Z,{sx:{fontWeight:800,color:k,lineHeight:1.15,fontSize:{xs:"0.95rem",sm:"1.1rem",md:"1.2rem"}},noWrap:!0,children:pe&&null!=pe[e.countKey]?pe[e.countKey]:(0,w.jsx)(f.Z,{sx:{width:40},animation:"wave"})})]}),(0,w.jsx)(d.Z,{variant:"rounded",sx:{width:30,height:30,bgcolor:U(e.color),color:e.color,borderRadius:1.25,flexShrink:0},children:(0,w.jsx)(o,{size:15})})]})]})},e.label)}))}),(0,w.jsx)(l.Z,{elevation:0,sx:{mt:{xs:1,md:1.25},p:{xs:.875,md:1.125},borderTopLeftRadius:2,borderTopRightRadius:2,borderBottomLeftRadius:0,borderBottomRightRadius:0,border:"1px solid",borderColor:H,borderBottom:0,background:"#fff"},children:(0,w.jsxs)(a.Z,{direction:"row",alignItems:"center",justifyContent:"space-between",gap:1.5,sx:{flexWrap:"wrap-reverse"},children:[(0,w.jsx)(a.Z,{direction:"row",spacing:.75,sx:{flex:1,overflowX:"auto",py:.5,px:.25,"&::-webkit-scrollbar":{height:6},"&::-webkit-scrollbar-thumb":{backgroundColor:H,borderRadius:4}},children:F.map((function(e){var o,n=e.icon,r=$===e.idx,t=null!==(o=null===pe||void 0===pe?void 0:pe[e.countKey])&&void 0!==o?o:0;return(0,w.jsxs)(u.Z,{onClick:function(){return Ie(e.idx)},sx:{display:"inline-flex",alignItems:"center",gap:{xs:.625,md:.875},pl:.5,pr:{xs:1,md:1.25},py:.5,flexShrink:0,cursor:"pointer",borderRadius:999,border:"1.5px solid ".concat(r?e.color:M(e.color)),bgcolor:r?e.color:B(e.color),color:r?"#fff":e.color,fontWeight:700,boxShadow:r?"0 6px 18px ".concat(K(e.color)):"none",transition:"all 0.18s","&:hover":{borderColor:e.color,boxShadow:r?"0 6px 18px ".concat(K(e.color)):"0 0 0 3px ".concat(K(e.color))}},children:[(0,w.jsx)(d.Z,{sx:{width:{xs:22,md:26},height:{xs:22,md:26},bgcolor:r?"rgba(255,255,255,0.22)":U(e.color),color:r?"#fff":e.color},children:(0,w.jsx)(n,{size:13})}),(0,w.jsx)(x.Z,{variant:"caption",sx:{fontWeight:800,fontSize:{xs:11.5,md:13},lineHeight:1},children:e.label}),(0,w.jsx)(u.Z,{sx:{minWidth:{xs:22,md:26},height:{xs:18,md:22},px:.625,display:"inline-flex",alignItems:"center",justifyContent:"center",borderRadius:999,fontSize:{xs:10,md:11},fontWeight:800,bgcolor:r?"rgba(255,255,255,0.22)":"#fff",color:r?"#fff":e.color,border:r?"none":"1px solid ".concat(M(e.color))},children:t})]},e.label)}))}),(0,w.jsx)(u.Z,{sx:{width:{xs:"100%",sm:260,lg:300},flex:{xs:"1 1 100%",sm:"0 0 auto"}},children:(0,w.jsxs)(u.Z,{sx:{display:"flex",alignItems:"center",gap:.75,px:1.25,py:.5,borderRadius:999,bgcolor:B(N),border:"1.5px solid ".concat(M(N)),transition:"all 0.18s","&:focus-within":{borderColor:N,boxShadow:"0 0 0 3px ".concat(K(N))}},children:[(0,w.jsx)(T.vU7,{size:16,style:{color:N,flexShrink:0}}),(0,w.jsx)(p.ZP,{inputRef:Ze,placeholder:"Search invoice no (ctrl+k)",value:be,onChange:function(e){return me(e.target.value)},autoComplete:"off",sx:{flex:1,fontSize:13,fontWeight:600,color:k,"& input::placeholder":{color:z,opacity:1}}}),be&&(0,w.jsx)(g.Z,{size:"small",onClick:function(){return me("")},sx:{p:.25,color:N},children:(0,w.jsx)(T.lUB,{size:14})})]})})]})}),(0,w.jsxs)(l.Z,{elevation:0,sx:{borderTopLeftRadius:0,borderTopRightRadius:0,borderBottomLeftRadius:2,borderBottomRightRadius:2,border:"1px solid",borderColor:H,overflow:"hidden",background:"#fff"},children:[(0,w.jsx)(_.Z,{sx:{minHeight:320,maxHeight:{xs:"calc(100vh - 380px)",md:"calc(100vh - 350px)"},overflow:"auto","&::-webkit-scrollbar":{width:10,height:10},"&::-webkit-scrollbar-thumb":{backgroundColor:M(N),borderRadius:8,"&:hover":{backgroundColor:N}},"&::-webkit-scrollbar-track":{backgroundColor:D}},children:(0,w.jsxs)(A.Z,{stickyHeader:!0,size:"small",sx:{minWidth:880},children:[(0,w.jsx)(b.Z,{children:(0,w.jsxs)(m.Z,{sx:{"& th":{backgroundColor:D,color:W,fontSize:10.5,fontWeight:800,letterSpacing:.5,textTransform:"uppercase",whiteSpace:"nowrap",borderBottom:"1px solid ".concat(H),py:.75,px:1}},children:[(0,w.jsx)(E.Z,{children:"#"}),(0,w.jsx)(E.Z,{children:"Client"}),(0,w.jsx)(E.Z,{children:"Invoice Id"}),(0,w.jsx)(E.Z,{children:"Invoice Date"}),(0,w.jsx)(E.Z,{children:"Due Date"}),(0,w.jsx)(E.Z,{align:"center",children:"Count"}),(0,w.jsx)(E.Z,{align:"right",children:"Amount"}),(0,w.jsx)(E.Z,{align:"center",children:"Action"})]})}),(0,w.jsxs)(S.Z,{children:[xe&&0===Te.length&&Array.from({length:10}).map((function(e,o){return(0,w.jsx)(m.Z,{children:Array.from({length:8}).map((function(e,o){return(0,w.jsx)(E.Z,{sx:{borderBottom:"1px solid ".concat(L),py:.625,px:1},children:(0,w.jsx)(f.Z,{animation:"wave",height:20})},o)}))},"sk-".concat(o))})),!xe&&0===Te.length&&(0,w.jsx)(m.Z,{children:(0,w.jsx)(E.Z,{colSpan:8,sx:{py:7,borderBottom:"none"},children:(0,w.jsxs)(a.Z,{alignItems:"center",spacing:1.25,children:[(0,w.jsx)(d.Z,{variant:"rounded",sx:{width:56,height:56,bgcolor:U("#94a3b8"),color:z,borderRadius:2},children:(0,w.jsx)(T.VHP,{size:26})}),(0,w.jsxs)(x.Z,{sx:{fontWeight:700,color:k,fontSize:14},children:["No ",F[$].label.toLowerCase()," invoices"]}),(0,w.jsx)(x.Z,{sx:{color:W,fontSize:12},children:be?"Try a different invoice number or clear the search.":"Switch tabs above to load invoices."}),be&&(0,w.jsxs)(u.Z,{component:"button",onClick:function(){return me("")},sx:{mt:.5,border:"none",cursor:"pointer",display:"inline-flex",alignItems:"center",gap:.5,height:28,px:1,fontSize:12,fontWeight:700,color:N,borderRadius:1.25,background:"transparent","&:hover":{bgcolor:B(N)}},children:[(0,w.jsx)(T.lUB,{size:14})," Clear search"]})]})})}),Te.slice(Z*q,Z*q+q).map((function(o,n){var r,t=F[$];return(0,w.jsxs)(m.Z,{sx:{cursor:"pointer",transition:"background-color 0.12s, box-shadow 0.12s","& td":{borderBottom:"1px solid ".concat(L),py:.5,px:1,verticalAlign:"middle"},"&:hover":{backgroundColor:B(N),boxShadow:"inset 3px 0 0 ".concat(N)}},onClick:function(){ue(!0),setTimeout((function(){ue(!1),e("/nearle/invoice/preview",{state:o})}),300)},children:[(0,w.jsx)(E.Z,{children:(0,w.jsx)(x.Z,{sx:{fontWeight:700,fontSize:12,color:z},children:Z*q+n+1})}),(0,w.jsxs)(E.Z,{children:[(0,w.jsx)(x.Z,{sx:{fontSize:12.5,fontWeight:700,color:k,lineHeight:1.25},noWrap:!0,children:o.tenantname}),(0,w.jsx)(x.Z,{sx:{fontSize:11,fontWeight:600,color:W,lineHeight:1.3},noWrap:!0,children:o.contactperson})]}),(0,w.jsx)(E.Z,{children:(0,w.jsxs)(u.Z,{sx:{display:"inline-flex",alignItems:"center",gap:.5,px:.875,py:.25,borderRadius:999,bgcolor:B(N),border:"1px solid ".concat(M(N)),color:N,fontSize:11,fontWeight:800,whiteSpace:"nowrap"},children:[(0,w.jsx)(T.VHP,{size:11})," ",o.invoiceno]})}),(0,w.jsx)(E.Z,{children:o.transactiondate?(0,w.jsxs)(a.Z,{spacing:0,sx:{lineHeight:1.1},children:[(0,w.jsx)(x.Z,{sx:{fontSize:12.5,fontWeight:800,color:k,lineHeight:1.15},noWrap:!0,children:C()(o.transactiondate).format("hh:mm A")}),(0,w.jsx)(x.Z,{sx:{fontSize:10.5,fontWeight:600,color:z,lineHeight:1.2},noWrap:!0,children:C()(o.transactiondate).format("DD MMM YYYY")})]}):(0,w.jsx)(x.Z,{sx:{fontSize:12,color:z,fontWeight:700},children:"\u2014"})}),(0,w.jsx)(E.Z,{children:o.duedate?(0,w.jsxs)(a.Z,{spacing:0,sx:{lineHeight:1.1},children:[(0,w.jsx)(x.Z,{sx:{fontSize:12.5,fontWeight:800,color:k,lineHeight:1.15},noWrap:!0,children:C()(o.duedate).format("hh:mm A")}),(0,w.jsx)(x.Z,{sx:{fontSize:10.5,fontWeight:600,color:z,lineHeight:1.2},noWrap:!0,children:C()(o.duedate).format("DD MMM YYYY")})]}):(0,w.jsx)(x.Z,{sx:{fontSize:12,color:z,fontWeight:700},children:"\u2014"})}),(0,w.jsx)(E.Z,{align:"center",children:(0,w.jsxs)(u.Z,{sx:{display:"inline-flex",alignItems:"center",gap:.5,px:.875,py:.25,borderRadius:999,bgcolor:B("#0ea5e9"),border:"1px solid ".concat(M("#0ea5e9")),color:"#0ea5e9",fontSize:12,fontWeight:800},children:[(0,w.jsx)(T.ByW,{size:11})," ",null!==(r=o.itemcount)&&void 0!==r?r:0]})}),(0,w.jsx)(E.Z,{align:"right",children:(0,w.jsx)(x.Z,{sx:{fontWeight:800,color:t.color,fontSize:13,whiteSpace:"nowrap"},children:Y(o.totalamount)})}),(0,w.jsx)(E.Z,{align:"center",children:(0,w.jsx)(P.Z,{title:"Preview Invoice",children:(0,w.jsx)(g.Z,{size:"small",onClick:function(n){n.stopPropagation(),ue(!0),setTimeout((function(){ue(!1),e("/nearle/invoice/preview",{state:o})}),300)},sx:{bgcolor:B(N),border:"1px solid ".concat(M(N)),color:N,borderRadius:999,p:.75,"&:hover":{bgcolor:U(N),borderColor:N}},children:(0,w.jsx)(T.t2l,{size:14})})})})]},"".concat(o.invoiceno,"-").concat(n))}))]})]})}),(0,w.jsx)(v.Z,{rowsPerPageOptions:[5,10,25,100],component:"div",count:Te.length,rowsPerPage:q,page:Z,onPageChange:function(e,o){return O(o)},onRowsPerPageChange:function(e){X(+e.target.value),O(0)},sx:{borderTop:"1px solid ".concat(L),"& .MuiTablePagination-toolbar":{color:W,fontWeight:600}}})]})]})}}}]);