1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7345],{83308:function(e,t,s){(window.__NEXT_P=window.__NEXT_P||[]).push(["/products",function(){return s(62669)}])},62669:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return C}});var n=s(47568),l=s(97582),a=s(85893),r=s(66311),c=s(67294),i=s(95756),o=s(14117),d=s(11163),u=function(){var e=(0,d.useRouter)();return(0,a.jsx)(o.Z,{header:"Products",children:(0,a.jsx)("div",{className:"row",children:(0,a.jsx)("div",{className:"col-md-12",children:(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsx)("h2",{children:"Sell your products and see all sales here"}),(0,a.jsx)("p",{children:"Start selling your products today!"}),(0,a.jsx)(i.z,{text:"Activate",onClick:function(){return e.push("/apps/all")}})]})})})})},h=s(65667),m=s(24461),x=s(39269),f=function(e){var t=e.items,s=e.title,n=e.type,l=(0,d.useRouter)();return(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{style:{fontSize:"1.2rem",fontWeight:600},children:s}),t.map((function(e,t){return 0===t?(0,a.jsxs)("div",{className:"d-flex align-items-center mt-3 mb-3 hover-gray",style:{borderRadius:4,cursor:"pointer"},onClick:function(){return l.push("/products/".concat(e.source_object_id))},children:[(0,a.jsx)("div",{children:(0,a.jsx)("img",{src:e.productImage,width:"80",style:{borderRadius:4}})}),(0,a.jsxs)("div",{style:{padding:"0px 20px"},children:[(0,a.jsx)("div",{style:{fontSize:"1.2rem",fontWeight:600},children:"topSales"===n?x.F.display(e.total_sales_amount/100,e.total_sales_currency):e.total_sales_number}),(0,a.jsx)("div",{style:{fontSize:"0.8rem"},children:e.name.length>50?e.name.substring(0,50)+"...":e.name})]})]},t):(0,a.jsxs)("div",{className:"d-flex align-items-center mt-3 mb-3 hover-gray",style:{borderRadius:4,cursor:"pointer"},onClick:function(){return l.push("/products/".concat(e.source_object_id))},children:[(0,a.jsx)("div",{children:(0,a.jsx)("img",{src:e.productImage,width:"50",style:{borderRadius:4}})}),(0,a.jsxs)("div",{style:{padding:"0px 20px"},children:[(0,a.jsx)("div",{style:{fontSize:"1rem",fontWeight:600},children:"topSales"===n?x.F.display(e.total_sales_amount/100,e.total_sales_currency):e.total_sales_number}),(0,a.jsx)("div",{style:{fontSize:"0.8rem"},children:e.name.length>50?e.name.substring(0,50)+"...":e.name})]})]},t)}))]})},p=function(){var e=(0,c.useState)([]),t=e[0],s=e[1],r=(0,c.useState)(!0),i=r[0],d=r[1];(0,c.useEffect)((function(){u()}),[]);var u=function(){var e=(0,n.Z)((function(){var e;return(0,l.__generator)(this,(function(t){switch(t.label){case 0:return d(!0),[4,h.Z.getTop10Products()];case 1:return e=t.sent(),s(e),d(!1),[2]}}))}));return function(){return e.apply(this,arguments)}}();return(0,a.jsx)("div",{children:(0,a.jsx)("div",{className:"container mt-5",children:(0,a.jsx)("div",{className:"row justify-content-center",children:(0,a.jsx)("div",{className:"col-md-12",children:(0,a.jsx)(o.Z,{header:"Top 10 Products",children:i?(0,a.jsx)("div",{className:"text-center",children:(0,a.jsx)(m.Z,{})}):(0,a.jsxs)("div",{className:"row",children:[(0,a.jsx)("div",{className:"col-md-6",children:(0,a.jsx)(f,{items:t.topSales.slice(0,5),title:"Most sold",type:"topSales"})}),(0,a.jsx)("div",{className:"col-md-6",children:(0,a.jsx)(f,{items:t.topPopular.slice(0,5),title:"Most popular",type:"topPopular"})})]})})})})})})},j=s(29815),v=s(72221),_=s(57437),g=(s(30381),s(41664),s(8193)),y=s(61895),b=(s(67259),s(58126)),N=s(75728),k=s(49247),w=function(e){var t=e.item;return(0,a.jsx)("th",{style:{textTransform:"capitalize"},children:t.title})},S=function(e){var t,s=function(e,t,s){var n=(0,j.Z)(E),l=n.indexOf(t);e.target.checked?n.push(t):l>-1&&n.splice(l,1),R(n),M((function(e){var t=(0,j.Z)(e);return t[s]=!e[s],t}))},r=(0,c.useContext)(y.Vo),i=r[0],u=(r[1],(0,d.useRouter)()),h=(0,c.useState)(1),f=h[0],p=h[1],S=(0,c.useState)(e.pages),P=S[0],Z=S[1],C=(0,c.useState)([]),A=C[0],z=C[1],B=(0,c.useState)([]),E=B[0],R=B[1],F=(0,c.useState)(!0),T=(F[0],F[1]),I=(0,c.useState)([]),U=I[0],W=I[1],O=(0,c.useState)([]),D=O[0],M=O[1],X=(0,c.useState)(!1),H=X[0],L=X[1],V=(0,c.useState)(!1),q=V[0],G=V[1];(0,c.useEffect)((function(){for(var t,s=D,n=0;n<e.rows.length;n++)s[n]=!1;Z(e.pages),M(s),z(null===(t=e.rows)||void 0===t?void 0:t.map((function(e){return{id:e.source_object_id,name:e.name,total_sales_number:e.total_sales_number,total_sales_amount:e.total_sales_amount,total_sales_currency:e.total_sales_currency}}))),L(!1),T(!0)}),[]);var J=function(){var t=(0,n.Z)((function(t,s){var n,a,r;return(0,l.__generator)(this,(function(t){switch(t.label){case 0:return L(!0),[4,_.Z.get("https://api.donorflow.net".concat(e.apiUrlPath,"?page=").concat(s),{headers:{Authorization:"Bearer "+i.token}})];case 1:return a=t.sent(),r=null===(n=a.data.data)||void 0===n?void 0:n.map((function(e){return{id:e.source_object_id,name:e.name,total_sales_number:e.total_sales_number,total_sales_amount:e.total_sales_amount,total_sales_currency:e.total_sales_currency}})),z(r),p(s),L(!1),[2]}}))}));return function(e,s){return t.apply(this,arguments)}}(),K=function(){var e=(0,n.Z)((function(e){var t,s;return(0,l.__generator)(this,(function(n){if(t=[],e.target.checked)for(t=E,t=[],s=0;s<A.length;s++)t.push(A[s].id);return R(t),M(D.map((function(){return e.target.checked}))),[2]}))}
1));return function(t){return e.apply(this,arguments)}}(),Q=function(){var t=(0,n.Z)((function(t){var s,n,a,r;return(0,l.__generator)(this,(function(l){switch(l.label){case 0:return t.preventDefault(),(s=t.target.value)&&s.length>=3?[4,_.Z.get("https://api.donorflow.net".concat(e.apiUrlPath,"/search/").concat(s),{headers:{Authorization:"Bearer "+i.token}})]:[3,2];case 1:return(n=l.sent()).data.length>0&&(r=null===(a=n.data)||void 0===a?void 0:a.map((function(e){return{id:e.source_object_id,name:e.name,total_sales_number:e.total_sales_number,total_sales_amount:e.total_sales_amount,total_sales_currency:e.total_sales_currency}})),W(r),G(!0)),[3,3];case 2:G(!1),W([]),l.label=3;case 3:return[2]}}))}));return function(e){return t.apply(this,arguments)}}();return(0,a.jsx)(a.Fragment,{children:(0,a.jsxs)(o.Z,{style:{minHeight:500},header:e.title?e.title:"",children:[e.showSearch?(0,a.jsxs)("div",{className:"row justify-content-start",children:[(0,a.jsxs)("div",{className:"col-md-4 mt-2 mb-2 pb-2 text-right",children:[(0,a.jsxs)("div",{className:"d-flex",children:[(0,a.jsx)("div",{style:{fontSize:23,color:"#BBBBBB",marginRight:10},children:(0,a.jsx)(g.RB5,{})}),(0,a.jsx)("input",{type:"text",name:"df_search",onChange:Q,className:"shadow-sm focus:ring-indigo-500 focus:border-indigo-500 block w-full sm:text-sm border-gray-300 rounded-md",placeholder:"Type your search here..."})]}),(0,a.jsx)(b.Z,{height:20})]}),(0,a.jsx)("div",{className:"col-md-8 mt-2 mb-2 pb-2 text-right",style:{flex:1},children:e.showExport?(0,a.jsx)(N.Z,{type:e.search}):null})]}):null,(0,a.jsxs)("table",{className:"table table-hover",children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{children:[e.selectAll?(0,a.jsxs)("td",{colSpan:"4",style:{textAlign:"left"},children:[(0,a.jsxs)("label",{for:"selectAll",className:"clickable",style:{display:"flex",textAlign:"left",justifyContent:"left",alignItems:"center"},children:[(0,a.jsx)("div",{style:{width:30},children:(0,a.jsx)("input",{id:"selectAll",type:"checkbox",onClick:function(e){return K(e)}})}),(0,a.jsxs)("div",{style:{width:200,paddingLeft:10},children:[0==E.length?"All":"Unselect all"," (",E.length,")"]})]}),(0,a.jsx)(a.Fragment,{children:(0,a.jsx)(k.Z,{className:"pl-3",data:E,dkey:i.dkey,resource:e.resource,removeContacts:function(t){e.refresh&&(e.refresh(),M([]),R([]))}})})]}):null,null===(t=e.columns)||void 0===t?void 0:t.map((function(e,t){return(0,a.jsx)(w,{item:e},t)}))]})}),(0,a.jsx)("tbody",{children:q?null===U||void 0===U?void 0:U.map((function(t,n){return(0,a.jsxs)("tr",{style:D[n]?{background:"#e5edff"}:{background:"#ffffff"},className:"tablerow",children:[e.selectAll?(0,a.jsx)("td",{children:(0,a.jsx)("input",{type:"checkbox",checked:D[n],onClick:function(e){s(e,t.id,n)}})}):null,(0,a.jsx)("td",{className:"clickable",onClick:function(){return u.push("".concat(e.linkPath,"/").concat(t.id))},children:t.name}),(0,a.jsx)("td",{className:"clickable",onClick:function(){return u.push("".concat(e.linkPath,"/").concat(t.id))},children:t.total_sales_number}),(0,a.jsx)("td",{className:"clickable",onClick:function(){return u.push("".concat(e.linkPath,"/").concat(t.id))},children:x.F.display(t.total_sales_amount/100,t.total_sales_currency)})]},n)})):null===A||void 0===A?void 0:A.map((function(t,n){return(0,a.jsxs)("tr",{style:D[n]?{background:"#e5edff"}:{background:"#ffffff"},className:"tablerow",children:[e.selectAll?(0,a.jsx)("td",{children:(0,a.jsx)("input",{type:"checkbox",checked:D[n],onClick:function(e){s(e,t.id,n)}})}):null,(0,a.jsx)("td",{className:"clickable",onClick:function(){return u.push("".concat(e.linkPath,"/").concat(t.id))},children:t.name}),(0,a.jsx)("td",{className:"clickable",onClick:function(){return u.push("".concat(e.linkPath,"/").concat(t.id))},children:t.total_sales_number}),(0,a.jsx)("td",{className:"clickable",onClick:function(){return u.push("".concat(e.linkPath,"/").concat(t.id))},children:x.F.display(t.total_sales_amount/100,t.total_sales_currency)})]},n)}))})]}),q?(0,a.jsxs)("div",{className:"p-3 text-muted d-none",children:["Showing ",U.length," search results."]}):(0,a.jsx)(a.Fragment,{children:(0,a.jsxs)("div",{className:"p-3 text-muted",children:[P?"Showing page "+f+" of "+P+" pages.":null," Total of ",e.total?e.total:"0"," ",e.resource,". ",H?(0,a.jsx)(m.Z,{}):null]})}),!q&&(0,a.jsx)(v.Z,{count:P,page:f,onChange:J})]})})},P=s(7861),Z=s(56318),C=function(e){(0,P.Z)();var t=(0,c.useState)([]),s=t[0],i=t[1],o=(0,c.useState)(!1),d=o[0],x=o[1],f=(0,c.useState)({}),j=f[0],v=f[1];(0,c.useEffect)((function(){_()}),[]);var _=function(){var e=(0,n.Z)((function(){var e;return(0,l.__generator)(this,(function(t){switch(t.label){case 0:return x(!0),[],[4,h.Z.getProducts()];case 1:return e=t.sent(),i(e.data),v(e),x(!1),[2]}}))}));return function(){return e.apply(this,arguments)}}();return d||0!==s.length?(0,a.jsxs)(r.Z,{title:"Products",children:[(0,a.jsxs)("div",{className:"",children:[(0,a.jsxs)("div",{className:"row justify-content-center",children:[(0,a.jsx)("div",{className:"col-md-8",style:{fontSize:30,fontWeight:700},children:"Products"}),(0,a.jsx)("div",{className:"col-md-4 text-right"})]}),(0,a.jsx)("div",{className:"row",children:(0,a.jsx)("div",{className:"col",children:(0,a.jsx)(p,{})})}),(0,a.jsx)(b.Z,{height:40}),(0,a.jsx)("div",{className:"row",children:(0,a.jsx)("div",{className:"col-md-12",children:d?(0,a.jsx)("div",{className:"text-center",children:(0,a.jsx)(m.Z,{})}):(0,a.jsx)(S,{title:"All products",rows:s,data:j,columns:[{title:"Name"},{title:"Items sold"},{title:"Date sold"}],showSearch:!0,linkPath:"/products",currentPage:null===j||void 0===j?void 0:j.currentPage,pages:null===j||void 0===j?void 0:j.pages,perPage:null===j||void 0===j?void 0:j.perPage,previousPage:null===j||void 0===j?void 0:j.previousPage,nextPage:null===j||void 0===j?void 0:j.nextPage,total:null===j||void 0===j?void 0:j.total,apiUrlPath:null===j||void 0===j?void 0:j.basePath,selectAll:!1})})})]}),(0,a.jsx)(Z.Z,{})]}):(0,a.jsxs)(r.Z,{title:"Products",children:[(0,a.jsx)(b.Z,{height:40}),(0,a.jsx)("div",{className:"container",children:(0,a.jsx)("div",{className:"row justify-content-center",children:(0,a.jsx)("div",{className:"col-md-12",children:(0,a.jsx)(u,{})})})})]})}}},function(e){e.O(0,[3714,1551,2016,4885,4617,1664,6587,8767,8886,8427,8240,9464,883,2972,1162,4376,7441,8091,3486,2221,4835,6311,813,540,9774,2888,179],(function(){return t=83308,e(e.s=t);var t}));var t=e.O();_N_E=t}]);
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.