1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6525],{84477:function(e,t,a){(window.__NEXT_P=window.__NEXT_P||[]).push(["/customers",function(){return a(20981)}])},79115:function(e,t,a){"use strict";a.d(t,{ZM:function(){return b},ZP:function(){return j}});var l=a(74902),s=a(87462),i=a(4942),n=a(97685),r=a(71002),o=a(67294),c=a(94184),d=a.n(c),u=a(93879),m=a(23061),h=a(98947),v=a(10711),g=a(7383),C=a(79338),p=a(78235),x=a(84476),f=function(e,t){var a={};for(var l in e)Object.prototype.hasOwnProperty.call(e,l)&&0>t.indexOf(l)&&(a[l]=e[l]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var s=0,l=Object.getOwnPropertySymbols(e);s<l.length;s++)0>t.indexOf(l[s])&&Object.prototype.propertyIsEnumerable.call(e,l[s])&&(a[l[s]]=e[l[s]]);return a},y=function(e){var t,a=e.prefixCls,l=e.children,n=e.actions,r=e.extra,c=e.className,u=e.colStyle,m=f(e,["prefixCls","children","actions","extra","className","colStyle"]),h=o.useContext(b),g=h.grid,C=h.itemLayout,y=(0,o.useContext(v.E_).getPrefixCls)("list",a),_=n&&n.length>0&&o.createElement("ul",{className:"".concat(y,"-item-action"),key:"actions"},n.map(function(e,t){return o.createElement("li",{key:"".concat(y,"-item-action-").concat(t)},e,t!==n.length-1&&o.createElement("em",{className:"".concat(y,"-item-action-split")}))})),S=o.createElement(g?"div":"li",(0,s.Z)({},m,{className:d()("".concat(y,"-item"),(0,i.Z)({},"".concat(y,"-item-no-flex"),!("vertical"===C?!!r:(o.Children.forEach(l,function(e){"string"==typeof e&&(t=!0)}),!(t&&o.Children.count(l)>1)))),c)}),"vertical"===C&&r?[o.createElement("div",{className:"".concat(y,"-item-main"),key:"content"},l,_),o.createElement("div",{className:"".concat(y,"-item-extra"),key:"extra"},r)]:[l,_,(0,x.Tm)(r,{key:"extra"})]);return g?o.createElement(p.Z,{flex:1,style:u},S):S};y.Meta=function(e){var t=e.prefixCls,a=e.className,l=e.avatar,i=e.title,n=e.description,r=f(e,["prefixCls","className","avatar","title","description"]),c=(0,o.useContext(v.E_).getPrefixCls)("list",t),u=d()("".concat(c,"-item-meta"),a),m=o.createElement("div",{className:"".concat(c,"-item-meta-content")},i&&o.createElement("h4",{className:"".concat(c,"-item-meta-title")},i),n&&o.createElement("div",{className:"".concat(c,"-item-meta-description")},n));return o.createElement("div",(0,s.Z)({},r,{className:u}),l&&o.createElement("div",{className:"".concat(c,"-item-meta-avatar")},l),(i||n)&&m)};var _=function(e,t){var a={};for(var l in e)Object.prototype.hasOwnProperty.call(e,l)&&0>t.indexOf(l)&&(a[l]=e[l]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var s=0,l=Object.getOwnPropertySymbols(e);s<l.length;s++)0>t.indexOf(l[s])&&Object.prototype.propertyIsEnumerable.call(e,l[s])&&(a[l[s]]=e[l[s]]);return a},b=o.createContext({});function S(e){var t,a=e.pagination,c=void 0!==a&&a,p=e.prefixCls,x=e.bordered,f=e.split,y=e.className,S=e.children,j=e.itemLayout,T=e.loadMore,E=e.grid,N=e.dataSource,k=void 0===N?[]:N,I=e.size,w=e.header,Z=e.footer,A=e.loading,M=e.rowKey,O=e.renderItem,D=e.locale,R=_(e,["pagination","prefixCls","bordered","split","className","children","itemLayout","loadMore","grid","dataSource","size","header","footer","loading","rowKey","renderItem","locale"]),L=c&&"object"===(0,r.Z)(c)?c:{},P=o.useState(L.defaultCurrent||1),U=(0,n.Z)(P,2),B=U[0],V=U[1],F=o.useState(L.defaultPageSize||10),z=(0,n.Z)(F,2),H=z[0],Y=z[1],q=o.useContext(v.E_),Q=q.getPrefixCls,G=q.renderEmpty,W=q.direction,K={},X=function(e){return function(t,a){V(t),Y(a),c&&c[e]&&c[e](t,a)}},$=X("onChange"),J=X("onShowSizeChange"),ee=function(e,t){var a;return O?((a="function"==typeof M?M(e):"string"==typeof M?e[M]:e.key)||(a="list-item-".concat(t)),K[t]=a,O(e,t)):null},et=Q("list",p),ea=void 0!==A&&A;"boolean"==typeof ea&&(ea={spinning:ea});var el=ea&&ea.spinning,es="";switch(I){case"large":es="lg";break;case"small":es="sm"}var ei=d()(et,(t={},(0,i.Z)(t,"".concat(et,"-vertical"),"vertical"===j),(0,i.Z)(t,"".concat(et,"-").concat(es),es),(0,i.Z)(t,"".concat(et,"-split"),void 0===f||f),(0,i.Z)(t,"".concat(et,"-bordered"),void 0!==x&&x),(0,i.Z)(t,"".concat(et,"-loading"),el),(0,i.Z)(t,"".concat(et,"-grid"),!!E),(0,i.Z)(t,"".concat(et,"-something-after-last-item"),!!(T||c||Z)),(0,i.Z)(t,"".concat(et,"-rtl"),"rtl"===W),t),y),en=(0,s.Z)((0,s.Z)((0,s.Z)({},{current:1,total:0}),{total:k.length,current:B,pageSize:H}),c||{}),er=Math.ceil(en.total/en.pageSize);en.current>er&&(en.current=er);var eo=c?o.createElement("div",{className:"".concat(et,"-pagination")},o.createElement(g.Z,(0,s.Z)({},en,{onChange:$,onShowSizeChange:J}))):null,ec=(0,l.Z)(k);c&&k.length>(en.current-1)*en.pageSize&&(ec=(0,l.Z)(k).splice((en.current-1)*en.pageSize,en.pageSize));var ed=(0,m.Z)(),eu=o.useMemo(function(){for(var e=0;e<h.c4.length;e+=1){var t=h.c4[e];if(ed[t])return t}},[ed]),em=o.useMemo(function(){if(E){var e=eu&&E[eu]?E[eu]:E.column;if(e)return{width:"".concat(100/e,"%"),maxWidth:"".concat(100/e,"%")}}}
1,[null==E?void 0:E.column,eu]),eh=el&&o.createElement("div",{style:{minHeight:53}});if(ec.length>0){var ev=ec.map(function(e,t){return ee(e,t)}),eg=o.Children.map(ev,function(e,t){return o.createElement("div",{key:K[t],style:em},e)});eh=E?o.createElement(C.Z,{gutter:E.gutter},eg):o.createElement("ul",{className:"".concat(et,"-items")},ev)}else S||el||(eh=o.createElement("div",{className:"".concat(et,"-empty-text")},D&&D.emptyText||G("List")));var eC=en.position||"bottom";return o.createElement(b.Provider,{value:{grid:E,itemLayout:j}},o.createElement("div",(0,s.Z)({className:ei},R),("top"===eC||"both"===eC)&&eo,w&&o.createElement("div",{className:"".concat(et,"-header")},w),o.createElement(u.Z,ea,eh,S),Z&&o.createElement("div",{className:"".concat(et,"-footer")},Z),T||("bottom"===eC||"both"===eC)&&eo))}b.Consumer,S.Item=y;var j=S},20981:function(e,t,a){"use strict";a.r(t),a.d(t,{default:function(){return eE}});var l=a(85893),s=a(19484),i=a.n(s),n=a(19893),r=a(51259),o=a(59305),c=a(56469),d=a(99380),u=a(79850),m=a(93879),h=a(70449),v=a(47871),g=a(72370),C=a(67294),p=a(11163),x=a(16517),f=a(33956),y=a(27407),_=a(57517),b=a(41664),S=a.n(b),j=a(2525),T=a(14733),E=a(44839),N=a(17245),k=a(95249),I=a(67371),w=a(29838),Z=a(10227),A=a(17702),M=a(45506),O=e=>{let{visible:t,onCancel:a,onComplete:s}=e,{companyDetails:i}=(0,x.v9)(e=>e.authReducer),n=(0,C.useMemo)(()=>(null==i?void 0:i.industry)===A.Q7.AGRICULTURE?A.$8:(null==i?void 0:i.industry)===A.Q7.E_COMMERCE?A.$8.filter(e=>![...M.XL,A.R1.DEALER].includes(e.value)):A.$8.filter(e=>!M.XL.includes(e.value)),[i]),r=(0,C.useMemo)(()=>i&&i.industry===A.Q7.AGRICULTURE?A.PT:A.X_,[i]);return(0,l.jsx)(w.Z,{title:"Upload Customers",type:"customers",fields:[{label:"ID",key:"id"},{label:"Internal ID",key:"internalId"},{label:"Internal Name",key:"internalName"},{label:"Name",key:"name",validators:[{validate:"required"}]},{label:"Type",key:"type",type:"select",options:n,validators:[{validate:"required"}]},{label:"Manager Name",key:"accountManagerName"},{label:"Contact Person Name",key:"managerName"},{label:"Contact Person Designation",key:"managerTitle"},{label:"Phone",key:"phone",validators:[{validate:"required"}]},{label:"Source",key:"source",type:"select",options:[{value:"FACEBOOK",label:"Facebook"},{value:"MESSENGER",label:"Messenger"},{value:"WHATSAPP",label:"Whatsapp"},{value:"INSTAGRAM",label:"Instagram"},{value:"TIKTOK",label:"TikTok"},{value:"WEBSITE",label:"Website"},{value:"PHONE_CALL",label:"Phone Call"},{value:"OFFLINE",label:"Offline"},{value:"UP_SELL",label:"Up Sell"},{value:"OTHER",label:"Other"}]},{label:"Address",key:"address",validators:[{validate:"required"}]},{label:"Email",key:"email"},{label:"Latitude",key:"latitude"},{label:"Longitude",key:"longitude"},{label:"District",key:"district"},{label:"Division",key:"division"},{label:"Payment Method",key:"paymentMethod",type:"select",options:r},{label:"Payment Terms",key:"paymentTerms"}],firstStepPrompt:"Download the CSV file containing all the data related to your customers.",secondStepPrompt:"Edit the CSV file by adding new rows and editing existing rows. Rows without a value in the ID column will be created while rows with an ID will update the customer.",visible:t,onCancel:a,onComplete:s,downloadTask:Z.g.downloadDistributorsCsv,uploadTask:Z.g.uploadDistributorsCsv})},D=a(74512),R=a(47006),L=a(30381),P=a.n(L),U=a(3161),B=a(33418),V=a(44606),F=a(23406),z=a.n(F),H=a(45697),Y=a.n(H),q=a(69377),Q=a(79115),G=a(8549),W=a(38660),K=a(38819);let X=e=>{let{visible:t,onCancel:a}=e,s=(0,x.I0)(),{permissions:i}=(0,x.v9)(e=>e.authReducer),{customerTags:n}=(0,x.v9)(e=>e.distributorsReducer),[r,o]=(0,C.useState)(!1),[m,h]=(0,C.useState)(""),[v,g]=(0,C.useState)(!1),[p,f]=(0,C.useState)(!1),[b,S]=(0,C.useState)(null),[j,T]=(0,C.useState)({}),[E,N]=(0,C.useState)(!1);(0,C.useEffect)(()=>{i.viewCustomerTags&&k()},[i]);let k=async()=>{N(!0),await s((0,y.Ld)({includeDefaultTags:!0})),N(!1)},I=async()=>{g(!0);try{await W.G.createCustomerTag({name:(null==m?void 0:m.trim())||""}),u.Z.success({message:"New Customer Tag Added",description:"New customer tag added successfully!",placement:"bottomLeft"}),o(!1),h(""),i.viewCustomerTags&&await k()}catch(e){u.Z.error({message:"Unable to Add New Customer Tag",description:e.message,placement:"bottomLeft"})}finally{g(!1)}},w=async()=>{g(!0);let e=[];for(let t in j){let{id:a,name:l}=j[t];e.push({id:a,name:l})}try{await W.G.updateCustomerTags({tags:e}
1),u.Z.success({message:"Customer Tags Updated",description:"Customer tags updated successfully!",placement:"bottomLeft"}),T({}),S(null),f(!1),i.viewCustomerTags&&await k()}catch(e){u.Z.error({message:"Unable To Update Customer Tags",description:e.message,placement:"bottomLeft"})}finally{g(!1)}},Z=e=>{var t;return!(!(null==b?void 0:null===(t=b.name)||void 0===t?void 0:t.trim())||e.name===(null==b?void 0:b.name))};return(0,l.jsxs)(q.Z,{title:"Customer Tag",visible:t,centered:!0,footer:null,width:420,onCancel:a,bodyStyle:{display:"flex",flexDirection:"column",justifyContent:"flex-start",alignItems:"center",rowGap:"16px"},children:[n.length||E?(0,l.jsx)(Q.ZP,{className:z().list,bordered:!0,dataSource:n,loading:E,renderItem:e=>{var t;return(0,l.jsx)(Q.ZP.Item,{className:z().listItem,actions:p&&e.companyId&&e.id!==(null==b?void 0:b.id)?[(0,l.jsx)(c.Z,{type:"primary",icon:(0,l.jsx)("img",{src:"/img/edit-black.svg",alt:"Edit Icon",width:16,height:16}),size:"small",onClick:()=>S(j[e.id]||e)},"edit")]:[],style:{position:"relative"},children:p&&e.id===(null==b?void 0:b.id)?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(K.Z,{containerClassName:z().customerTagInput,title:"Customer Tag",placeholder:"Customer Tag",value:(null==b?void 0:b.name)||"",onChange:e=>S(t=>({...t,name:e.target.value}))}),(0,l.jsxs)("div",{className:z().editCustomerTagActions,children:[(0,l.jsx)(c.Z,{className:z().editButton,icon:(0,l.jsx)("img",{src:Z(e)?"/img/checkmark-white.svg":"/img/checkmark.svg",alt:"Check Icon",width:18,height:18}),size:"small",type:"primary",disabled:!Z(e),onClick:()=>{T(t=>({...t,[e.id]:b})),S(null)}}),(0,l.jsx)(c.Z,{className:"".concat(z().editButton," ").concat(z().cancelButton),size:"small",onClick:()=>{T(t=>{let a={...t};return delete a[e.id],a}),S(null)},children:(0,l.jsx)("svg",{className:z().closeIcon,children:(0,l.jsx)("use",{href:"/img/close-black.svg#icon"})})})]})]}):(0,l.jsx)(d.default.Text,{strong:!0,children:(null===(t=j[e.id])||void 0===t?void 0:t.name)||e.name})},e.id)},rowKey:"id",size:"small",split:!0}):(0,l.jsx)(G.Z,{style:{width:"100%",margin:"0px"}}),r?(0,l.jsxs)("div",{className:z().addCustomerTagContainer,children:[(0,l.jsx)(K.Z,{title:"Customer Tag",placeholder:"Customer Tag",value:m,onChange:e=>h(e.target.value)}),(0,l.jsxs)("div",{className:z().addCustomerTagActions,children:[(0,l.jsx)(c.Z,{className:z().actionButton,block:!0,onClick:()=>{o(!1),h("")},style:{width:"100%"},children:"Cancel"}),(0,l.jsx)(c.Z,{className:z().actionButton,block:!0,type:"primary",loading:v,disabled:!(null==m?void 0:m.trim()),onClick:I,style:{width:"100%"},children:"Add"})]})]}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(c.Z,{className:z().actionButton,block:!0,type:"primary",icon:(0,l.jsx)("img",{src:"/img/plus-white.svg",alt:"Plus Icon"}),disabled:p,onClick:()=>o(!0),style:{width:"100%"},children:"Add Customer Tag"}),p?(0,l.jsxs)("div",{className:z().addCustomerTagActions,children:[(0,l.jsx)(c.Z,{className:z().actionButton,block:!0,onClick:()=>{f(!1),T({})},style:{width:"100%"},children:"Cancel"}),(0,l.jsx)(c.Z,{className:z().actionButton,block:!0,type:"primary",loading:v,disabled:(0,_.Qr)(j),onClick:w,style:{width:"100%"},children:"Update"})]}):n.length?(0,l.jsx)(c.Z,{className:z().actionButton,block:!0,onClick:()=>f(!0),style:{width:"100%"},children:"Edit"}):null]})]})};X.propTypes={visible:Y().bool,onCancel:Y().func},X.defaultProps={visible:!1,onCancel:()=>null};var $=a(91624),J=a(30369),ee=a(27440),et=a.n(ee),ea=a(12301),el=a(16821),es=a(28498),ei=a(22e3),en=a(57838);let er=[{label:"Pending",value:A.orderStatuses.SALES_ORDER_REQUESTED_STATUS},{label:"On Hold",value:A.orderStatuses.SALES_ORDER_ON_HOLD_STATUS},{label:"Approved",value:A.orderStatuses.SALES_ORDER_APPROVED_STATUS},{label:"Processing",value:A.orderStatuses.SALES_ORDER_PROCESSING_STATUS},{label:"Shipped",value:A.orderStatuses.SALES_ORDER_SHIPPED_STATUS},{label:"In-Transit",value:A.orderStatuses.SALES_ORDER_IN_TRANSIT_STATUS},{label:"Delivered",value:A.orderStatuses.SALES_ORDER_COMPLETED_STATUS},{label:"Flagged",value:A.orderStatuses.SALES_ORDER_FLAGGED_STATUS},{label:"Cancelled",value:A.orderStatuses.SALES_ORDER_CANCELLED_STATUS}];var eo=e=>{let{visible:t,onCancel:a}=e,s=(0,x.I0)(),{customerTags:i}=(0,x.v9)(e=>e.distributorsReducer),{allOrderSources:n}=(0,el.E)(),{companyDetails:r}=(0,x.v9)(e=>e.authReducer),[o,d]=(0,C.useState)(!1),[m,h]=(0,C.useState)(null),[v,g]=(0,C.useState)([]),[p,f]=(0,C.useState)(!1),[b,S]=(0,C.useState)(null),[j,T]=(0,C.useState)(null),[E,N]=(0,C.useState)(null),[k,I]=(0,C.useState)(null),[w,Z]=(0,C.useState)(null),[M,O]=(0,C.useState)(),[D,R]=(0,C.useState)(),[L,U]=(0,C.useState)([]),[B,V]=(0,C.useState)(!1),[F,z]=(0,C.useState)(null),[H,Y]=(0,C.useState)([]),[Q,G]=(0,C.useState)(!1),[K,X]=(0,C.useState)(),[ee,eo]=(0,C.useState)(),[ec,ed]=(0,C.useState)(null),[eu,em]=(0,C.useState)([]),[eh,ev]=(0,C.useState)(!1),[eg,eC]=(0,C.useState)(null),[ep,ex]=(0,C.useState)([]),[ef,ey]=(0,C.useState)(!1),[e_,eb]=(0,C.useState)(),[eS,ej]=(0,C.useState)([]),[eT,eE]=(0,C.useState)(!1),[eN,ek]=(0,C.useState)(null),[eI,ew]=(0,C.useState)(!1);(0,C.useEffect)(()=>{t&&(eD(),eL(),eM())},[t]),(0,C.useEffect)(()=>{v.length&&v.length===i.length?f(!0):f(!1)},[v]);let eZ=(0,C.useMemo)(()=>b&&j||E&&k||w||v.length>0||M||D||H.length>0||K||ee||0===M&&0===D||eu.length>0||e_||eN||ep.length>0,[b,j,E,k,w,v,M,D,H,K,ee,eu,e_,eN,ep]),eA=async()=>{try{if(!eZ)return;let e={};b&&(e.fromDate=P()(b).startOf("day").toDate()),j&&(e.toDate=P()(j).endOf("day").toDate()),E&&(e.lastOrderFromDate=P()(E).startOf("day").toDate()),k&&(e.lastOrderToDate=P()(k).endOf("day").toDate()),w&&(e.noOrderSinceDate=P()(w).startOf("day").toDate()),v.length>0&&(e.customerTagIds=v.map(e=>e.id)),H.length>0&&(e.districts=H.map(e=>e.value)),eu.length>0&&(e.statuses=eu.map(e=>e.value)),eN&&(e.productId=eN.value),ep.length>0&&(e.sources=ep.map(e=>e.value)),e.minOrderFrequency=M,e.maxOrderFrequency=D,e.minTotalDeliveredSalesAmount=K,e.maxTotalDeliveredSalesAmount=ee,e.smsCount=e_,ew(!0),await W.G.downloadCSV(e)}catch(e){u.Z.error({message:"Unable to Export Distributors",description:e.message,placement:"bottomLeft"})}finally{ew(!1),a()}},eM=async()=>{eE(!0);let{data:e}=await en.Q.index({});ej(e.results),eE(!1)},eO=async e=>({data:i.filter(t=>t.name.toLowerCase().includes(e.toLowerCase()))}),eD=async()=>{d(!0),await s((0,y.Ld)({includeDefaultTags:!0})),d(!1)},eR=async e=>({data:L.filter(t=>t.label.toLowerCase().includes(e.toLowerCase()))}),eL=async()=>{V(!0);try{let{data:e}=await W.G.districts();U((null==e?void 0:e.length)?e.map(e=>({value:e,label:e})):[])}catch(e){u.Z.error({message:"Unable to Get Districts",description:e.message,placement:"bottomLeft"})}finally{V(!1)}}
1,eP=async e=>({data:A.orderStatuses.filter(t=>t.label.toLowerCase().includes(e.toLowerCase()))}),eU=async e=>({data:n.filter(t=>t.label.toLowerCase().includes(e.toLowerCase()))});return(0,l.jsx)(q.Z,{title:"Export",visible:t,onCancel:a,width:940,okText:"Apply",footer:(0,l.jsxs)("div",{className:et().footer,children:[(0,l.jsx)(c.Z,{style:{marginRight:"auto"},onClick:()=>{S(null),T(null),N(null),I(null),Z(null),h(null),g([]),f(!1),O(),R(),z(null),Y([]),G(!1),X(),eo(),ed(null),em([]),ev(!1),eb(),ek(null),eC(null),ex([]),ey(!1)},disabled:!eZ,children:"Reset Filter"},"reset"),(0,l.jsx)(c.Z,{onClick:a,children:"Cancel"},"cancel"),(0,l.jsx)(c.Z,{type:"primary",loading:eI,disabled:!eZ,onClick:eA,children:"Export As CSV"},"apply")]}),children:(0,l.jsxs)("div",{className:et().exportModalContainer,children:[(0,l.jsxs)("div",{className:et().section,children:[(0,l.jsxs)("div",{className:et().sectionItem,children:[(0,l.jsx)("h3",{className:et().label,children:"Creation Date Range"}),(0,l.jsx)(J.Z,{style:{flex:1},title:"From",type:"date",value:b?P()(b):null,onChange:e=>S(null==e?void 0:e.toDate())})]}),(0,l.jsx)("div",{className:et().sectionItem,children:(0,l.jsx)(J.Z,{style:{flex:1},title:"To",type:"date",value:j?P()(j):null,onChange:e=>T(null==e?void 0:e.toDate()),disabledDate:e=>e&&e.valueOf()<P()(b)})}),(0,l.jsxs)("div",{className:et().sectionItem,children:[(0,l.jsx)("h3",{className:et().label,children:"No Order Since"}),(0,l.jsx)(J.Z,{type:"date",title:"No Order Since",tooltip:"Customer who have not placed order since this date.",value:w?P()(w):null,onChange:e=>Z(null==e?void 0:e.toDate())})]})]}),(0,l.jsxs)("div",{className:et().section,children:[(0,l.jsxs)("div",{className:et().sectionItem,style:{alignSelf:"flex-start"},children:[(0,l.jsx)("h3",{className:et().label,children:"Last Order Date"}),(0,l.jsx)(J.Z,{title:"From",type:"date",value:E?P()(E):null,onChange:e=>N(null==e?void 0:e.toDate())})]}),(0,l.jsxs)("div",{className:et().sectionItem,style:{alignSelf:"flex-start"},children:[(0,l.jsx)("h3",{className:et().label,style:{visibility:"hidden"},children:"Last Order Date"}),(0,l.jsx)(J.Z,{title:"To",type:"date",value:k?P()(k):null,onChange:e=>I(null==e?void 0:e.toDate()),disabledDate:e=>e&&e.valueOf()<P()(E)})]}),(null==r?void 0:r.industry)===A.Q7.E_COMMERCE?(0,l.jsxs)("div",{className:et().sectionItem,children:[(0,l.jsx)("h3",{className:et().label,children:"Customer Tag"}),(0,l.jsx)(ea.Z,{searchTask:eO,defaultOptions:i,isLoading:o,title:"Customer Tag",selectedTitle:"Selected Customer Tags",labelIndex:"name",valueIndex:"id",placeholder:"Select Customer Tag",onChange:e=>{let{data:t}=e;h(e),v.find(e=>{let{id:a}=e;return a===t.id})?g(v.filter(e=>{let{id:a}=e;return a!==t.id})):g(v.concat([t]))},onClear:()=>h(null),value:m,setValue:h,areAllValuesSelected:p,setAreAllValuesSelected:f,onAreAllValuesSelectedChange:e=>{g(e?i:[]),h(null)},selectedValues:v,setSelectedValues:g,popupContainer:()=>document.querySelector(".ant-modal-body")})]}):(0,l.jsx)("div",{className:et().sectionItem})]}),(null==r?void 0:r.industry)===A.Q7.E_COMMERCE&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:et().section,children:[(0,l.jsxs)("div",{className:et().sectionItem,style:{alignSelf:"flex-start"},children:[(0,l.jsx)("h3",{className:et().label,children:"Order Frequency"}),(0,l.jsx)(es.Z,{title:"Min",type:"number",value:M,onChange:e=>{if(e<0){O(0);return}e>D&&(0,_.UE)(D)&&R(e),O(e)}})]}),(0,l.jsxs)("div",{className:et().sectionItem,style:{alignSelf:"flex-start"},children:[(0,l.jsx)("h3",{className:et().label,style:{visibility:"hidden"},children:"Order Frequency"}),(0,l.jsx)(es.Z,{title:"Max",type:"number",min:M,value:D,onChange:e=>{if(e<0){R(0);return}R(e)}})]}),(0,l.jsxs)("div",{className:et().sectionItem,children:[(0,l.jsx)("h3",{className:et().label,children:"Customer Districts"}),(0,l.jsx)(ea.Z,{searchTask:eR,defaultOptions:L,isLoading:B,title:"Customer Districts",selectedTitle:"Selected Customer Districts",labelIndex:"label",valueIndex:"value",placeholder:"Select Customer District",onChange:e=>{let{value:t}=e;z(e),H.find(e=>e.value===t)?Y(H.filter(e=>e.value!==t)):Y(H.concat([e]))},onClear:()=>z(null),value:F,setValue:z,areAllValuesSelected:Q,setAreAllValuesSelected:G,onAreAllValuesSelectedChange:e=>{Y(e?L:[]),z(null)},selectedValues:H,setSelectedValues:Y,popupContainer:()=>document.querySelector(".ant-modal-body")})]})]}),(0,l.jsxs)("div",{className:et().section,children:[(0,l.jsxs)("div",{className:et().sectionItem,style:{alignSelf:"flex-start"},children:[(0,l.jsx)("h3",{className:et().label,children:"Total Delivered Order Value"}),(0,l.jsx)(es.Z,{title:"Min",type:"number",value:K,onChange:e=>{if(e<0){X(0);return}e>ee&&(0,_.UE)(ee)&&eo(e),X(e)}})]}),(0,l.jsxs)("div",{className:et().sectionItem,style:{alignSelf:"flex-start"},children:[(0,l.jsx)("h3",{className:et().label,style:{visibility:"hidden"},children:"Total Delivered Order Value"}),(0,l.jsx)(es.Z,{title:"Max",type:"number",min:K,value:ee,onChange:e=>{if(e<0){eo(0);return}eo(e)}})]}),(0,l.jsxs)("div",{className:et().sectionItem,children:[(0,l.jsx)("h3",{className:et().label,children:"Order Status"}),(0,l.jsx)(ea.Z,{searchTask:eP,defaultOptions:er,title:"Order Status",selectedTitle:"Selected Order Statuses",labelIndex:"label",valueIndex:"value",placeholder:"Select Order Statuses",onChange:e=>{let{value:t}=e;ed(e),eu.find(e=>e.value===t)?em(eu.filter(e=>e.value!==t)):em(eu.concat([e]))},onClear:()=>ed(null),value:ec,setValue:ed,areAllValuesSelected:eh,setAreAllValuesSelected:ev,onAreAllValuesSelectedChange:e=>{em(e?er:[]),ed(null)},selectedValues:eu,setSelectedValues:em,popupContainer:()=>document.querySelector(".ant-modal-body")})]})]}),(0,l.jsxs)("div",{className:et().section,children:[(null==r?void 0:r.isDistributorNotificationsEnabled)&&(0,l.jsxs)("div",{className:et().sectionItem,style:{alignSelf:"flex-start"},children:[(0,l.jsx)("h3",{className:et().label,children:"SMS Count"}),(0,l.jsx)(es.Z,{title:"SMS Count",type:"number",value:e_,onChange:e=>{if(e<0){eb(0);return}eb(e)}})]}),(0,l.jsxs)("div",{className:et().sectionItem,style:{alignSelf:"flex-start"},children:[(0,l.jsx)("h3",{className:et().label,children:"By Product"}),(0,l.jsx)(ei.Z,{placeholder:"Product Name, SKU, or Internal ID",isLoading:eT,defaultOptions:eS,searchTask:e=>en.Q.index({searchTerm:e}),customLabel:e=>e.name,customDescription:e=>{var t,a;return(0,l.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[(0,l.jsx)("div",{children:e.sku||"No SKU"}),e.parentProductId&&(0,l.jsx)($.Z,{bordered:!1,className:et().productTag,children:"Variant"}),(null===(t=e.variants)||void 0===t?void 0:t.length)>0&&(0,l.jsx)($.Z,{bordered:!1,className:et().productTag,children:"Base Product"}),!(null===(a=e.variants)||void 0===a?void 0:a.length)&&!e.parentProductId&&(0,l.jsx)($.Z,{bordered:!1,className:et().productTag,children:"Simple Product"})]})},valueIndex:"id",onChange:ek,onClear:()=>ek(null),value:eN,allowClear:!0})]}),(0,l.jsxs)("div",{className:et().sectionItem,children:[(0,l.jsx)("h3",{className:et().label,children:"Source"}),(0,l.jsx)(ea.Z,{searchTask:eU,defaultOptions:n,title:"Source",selectedTitle:"Selected Sources",labelIndex:"label",valueIndex:"value",placeholder:"Select Sources",onChange:e=>{let{value:t}=e;eC(e),ep.find(e=>e.value===t)?ex(ep.filter(e=>e.value!==t)):ex(ep.concat([e]))},onClear:()=>eC(null),value:eg,setValue:eC,areAllValuesSelected:ef,setAreAllValuesSelected:ey,onAreAllValuesSelectedChange:e=>{ex(e?n:[]),eC(null)},selectedValues:ep,setSelectedValues:ex,popupContainer:()=>document.querySelector(".ant-modal-body")})]})]})]})]})})},ec=a(95919),ed=a(18098),eu=a(99992),em=a(11765),eh=a(71174),ev=a(37228),eg=a(13219),eC=a.n(eg),ep=a(25121),ex=a(53971),ef=a(3711);let{Panel:ey}=eu.default,e_=e=>{let{visible:t,onCancel:a}=e,s=(0,x.I0)(),{permissions:i,companyId:n,preferences:r}=(0,x.v9)(e=>e.authReducer),[d,m]=(0,C.useState)(r.storeCustomerEmailEnabled),[h,v]=(0,C.useState)(r.storeCustomerAdditionalInformationEnabled),[g,p]=(0,C.useState)(!1),f=(0,C.useMemo)(()=>
1d!==r.storeCustomerEmailEnabled||h!==r.storeCustomerAdditionalInformationEnabled,[r,d,h]);(0,C.useEffect)(()=>{r&&(m(r.storeCustomerEmailEnabled),v(r.storeCustomerAdditionalInformationEnabled))},[r]);let y=async()=>{p(!0);try{let e=[{key:"storeCustomerEmailEnabled",value:d,type:"CUSTOMER"},{key:"storeCustomerAdditionalInformationEnabled",value:h,type:"CUSTOMER"}].filter(e=>e.value!==r[e.key]).map(e=>({key:(0,ex.T)(e.key),value:e.value,type:"CUSTOMER"}));await s((0,ep.ex)(n,{preferences:e})),await s((0,ef.YI)()),u.Z.success({description:"Preferences has been saved successfully",message:"Success",placement:"bottomLeft"})}catch(e){m(r.isDefaultShippingDateEnabled),v(r.storeCustomerAdditionalInformationEnabled),u.Z.error({message:"Unable to Save Preferences",description:e.message,placement:"bottomLeft"})}finally{a(),p(!1)}};return(0,l.jsx)(q.Z,{title:"Preferences",visible:t,onCancel:a,width:1e3,footer:[(0,l.jsx)(c.Z,{shape:"round",disabled:!1,onClick:a,children:"Cancel"},1),(0,l.jsx)(c.Z,{type:"primary",shape:"round",disabled:!f||!i.editOrderPreference,onClick:y,loading:g,children:"Save"},2)],children:(0,l.jsx)("div",{className:eC().container,children:(0,l.jsxs)(eu.default,{ghost:!0,expandIcon:e=>{let{isActive:t}=e;return t?(0,l.jsx)(eh.Z,{}):(0,l.jsx)(I.Z,{})},style:{fontSize:"18px"},children:[(0,l.jsx)(ey,{header:"Customer Email Preference",children:(0,l.jsxs)("div",{style:{display:"flex",gap:12,alignItems:"center",justifyItems:"center"},children:[(0,l.jsxs)("div",{className:eC().infoText,style:{fontSize:14},children:["Store Customer's Email",(0,l.jsx)(o.Z,{title:"Enabling/Disabling will define whether to store Email for a customer.",children:(0,l.jsx)(ev.Z,{style:{marginLeft:8}})})]}),(0,l.jsx)(em.Z,{checkedChildren:"Enabled",unCheckedChildren:"Disabled",checked:d,onChange:m})]})},"1"),(0,l.jsx)(ey,{header:"Customer Additional Information Preference",children:(0,l.jsxs)("div",{style:{display:"flex",gap:12,alignItems:"center",justifyItems:"center"},children:[(0,l.jsxs)("div",{className:eC().infoText,style:{fontSize:14},children:["Store Customer's Additional Info",(0,l.jsx)(o.Z,{title:"Enabling/Disabling will define whether to store additional information for a customer.",children:(0,l.jsx)(ev.Z,{style:{marginLeft:8}})})]}),(0,l.jsx)(em.Z,{checkedChildren:"Enabled",unCheckedChildren:"Disabled",checked:h,onChange:v})]})},"2")]})})})};e_.propTypes={visible:Y().bool,onCancel:Y().func},e_.defaultProps={visible:!1,onCancel:()=>{}};var eb=a(78155);let eS=[{title:"Customer Phone #",key:"phone",render:e=>e.phone?(0,l.jsx)("div",{children:e.phone}):(0,l.jsx)("div",{className:i().unassigned,children:"No Phone"})},{title:"Customer #",key:"customerID",render:e=>(0,l.jsx)(S(),{href:"/customers/".concat(e.id),className:i().link,children:e.internalId?e.internalId:"C-".concat(e.shortId)})},{title:"Area Manager",key:"areaManager",render:e=>e.type===A.R1.E_COMMERCE_CUSTOMER?(0,l.jsx)("div",{className:i().unassigned,children:"N/A"}):e.accountManager?"".concat(e.accountManager.name):(0,l.jsx)("div",{className:i().unassigned,children:"Not Assigned"})},{title:"Customer",key:"name",render:e=>(0,l.jsx)("div",{style:{display:"flex"},children:"".concat(e.name).concat(e.internalName?" (".concat(e.internalName,")"):"")})},{title:"Customer Type",dataIndex:"type",key:"type",render:e=>(0,_.Nb)(null==e?void 0:e.toLowerCase())},{title:"Division",key:"division",render:e=>{if(e.locations&&e.locations[0])return e.locations[0].division}},{title:"District",key:"district",render:e=>{if(e.locations&&e.locations[0])return e.locations[0].district}},{title:"Location",key:"location",render:e=>{let{locations:t,name:a}=e;if(t){let t=e.locations,s=e=>{let t="";a!==e.label&&(t=e.label);let l=t;return t||(l=e.address),l};if(t)return e.locations.map(e=>(0,l.jsx)("div",{className:i().location,children:s(e)},e.id))}}},{title:"Payment Type",dataIndex:"paymentMethod",key:"paymentMethod",render:e=>(0,_.Nb)(e)},{title:"Created At",dataIndex:"createdAt",key:"createdAt",render:e=>P()(e).format("DD MMM, YYYY")},{title:"Last Order Date",key:"last-order-created-at",render:e=>{let{lastSalesOrderCreatedAt:t}=e;return t?P()(t).format("MMM D, YYYY"):(0,l.jsx)("div",{className:i().unassigned,children:"No previous orders"})},sorter:!0}],ej=[{label:"Graph",value:"graph",icon:"/img/plot.svg"},{label:"List",value:"list",icon:"/img/list.svg"}],eT=()=>{let e=(0,p.useRouter)(),{view:t}=e.query,a=(0,x.I0)(),{totalCount:s,page:n,distributors:b,metrics:w,trend:Z}=(0,x.v9)(e=>e.distributorsReducer),{companyDetails:M,permissions:L,preferences:F}=(0,x.v9)(e=>e.authReducer),[z,H]=(0,C.useState)(ej[1].value),[Y,q]=(0,C.useState)(!1),[Q,G]=(0,C.useState)(!1),[W,K]=(0,C.useState)(!1),[$,J]=(0,C.useState)(!1),[ee,et]=(0,C.useState)(!1),[ea,el]=(0,C.useState)(!1),[es,ei]=(0,C.useState)(!1),[en,er]=(0,C.useState)(!1),[eu,em]=(0,C.useState)(),[eh,ev]=(0,C.useState)(!1),[eg,eC]=(0,C.useState)(),{searchParams:ep,isSearchApplied:ex,setSearchParams:ef}=(0,f.Z)(),[ey,eT]=(0,C.useState)(1),[eE,eN]=(0,C.useState)(!1),[ek,eI]=(0,C.useState)([]),[ew,eZ]=(0,eb._)(A.uf.CUSTOMER_TABLE_FILTER_COLUMNS_MAP,{}),[eA,eM]=(0,C.useState)(!1),eO=(0,C.useMemo)(()=>{var e;return(null==M?void 0:M.industry)!==A.Q7.E_COMMERCE||!!M.isBulkUploadEnabled&&null!==(e=M.bulkUploadFlags)&&void 0!==e&&!!e.isCustomerUploadEnabled},[M]),eD=(0,C.useMemo)(()=>
1{if(!eg)return[];let e=Object.values(eg).reduce((e,t)=>e+t.count,0),t={},a=1;for(let l of Object.values(eg)){let s=l.administrativeLevel;!t[s]&&(t[s]={key:String(a),type:"division",division:s,totalDistricts:0,total:0,children:[]},a++);let i=t[s],n=i.children.length+1;i.children.push({key:"".concat(i.key,"-").concat(n),type:"district",division:l.subAdministrativeLevel,totalDistricts:"-",total:l.count,marketShare:(l.count/e*100).toFixed(1)}),i.total+=l.count,i.totalDistricts+=1}return Object.values(t).map(t=>({...t,children:t.children.sort((e,t)=>t.total-e.total),marketShare:(t.total/e*100).toFixed(1)})).sort((e,t)=>t.total-e.total)},[eg]),eR=(0,C.useMemo)(()=>[{id:"Counts",data:Z.map(e=>({y:e.count,x:e.month}))}],[Z]),eL=[{title:"ID",key:"customerID",render:e=>{let{id:t,internalId:a,shortId:s,type:n}=e;return(0,l.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[(0,l.jsx)(S(),{href:"/customers/".concat(t),className:i().link,children:a||"C-".concat(s)}),(0,l.jsx)("div",{style:{fontSize:12},children:n===A.R1.E_COMMERCE_CUSTOMER?"E-Commerce Customer":(0,_.Nb)(null==n?void 0:n.toLowerCase())})]})}},{title:"Contact",key:"contact",render:e=>(0,l.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[e.phone?(0,l.jsxs)("div",{className:i().customerPhoneContainer,children:[e.phone,(0,l.jsx)(ed.Z,{text:e.phone,style:{width:20,height:20}}),(0,l.jsx)(o.Z,{trigger:["hover"],title:"Click to chat with the customer on WhatsApp",children:(0,l.jsx)("a",{target:"_blank",href:"https://wa.me/".concat(e.phone),rel:"noreferrer",children:(0,l.jsx)("img",{src:"/img/source_whatsapp.svg"})})})]}):(0,l.jsx)("div",{className:i().unassigned,children:"No Phone"}),F.storeCustomerEmailEnabled?e.email?(0,l.jsxs)("span",{style:{gap:4},children:[e.email,(0,l.jsx)(ed.Z,{text:e.email,style:{width:20,height:20}})]}):(0,l.jsx)("div",{className:i().unassigned,children:"No Email"}):null]})},{title:"Name",key:"name",render:e=>{var t,a,s;return(0,l.jsxs)("div",{style:{display:"flex",flexDirection:"column",justifyContent:"flex-start",alignItems:"flex-start",gap:8},children:[(0,l.jsx)("div",{children:"".concat(e.name).concat(e.internalName?" (".concat(e.internalName,")"):"")}),(null==e?void 0:null===(t=e.customerTag)||void 0===t?void 0:t.name)&&(0,l.jsxs)("span",{style:{fontSize:10},children:["Tag:"," ",(0,l.jsx)("strong",{className:i().customerTag,children:e.customerTag.name})]}),((null==e?void 0:e.source)||(null==e?void 0:e.customOrderSource))&&(0,l.jsxs)("span",{style:{fontSize:10},children:["Source:"," ",(0,l.jsx)("strong",{className:i().customerSource,style:{background:(null==e?void 0:null===(a=e.customOrderSource)||void 0===a?void 0:a.color)||A.FB[null==e?void 0:e.source]},children:(null==e?void 0:null===(s=e.customOrderSource)||void 0===s?void 0:s.name)||(0,_.Nb)(e.source.toLowerCase())})]})]})}},{title:"Manager",key:"areaManager",render:e=>{let{type:t,accountManager:a}=e;return t===A.R1.E_COMMERCE_CUSTOMER?(0,l.jsx)("div",{className:i().unassigned,children:"N/A"}):(null==a?void 0:a.name)?a.name:(0,l.jsx)("div",{className:i().unassigned,children:"Not Assigned"})}},{title:"Location",key:"location",render:e=>{let{locations:t,name:a}=e;if(t)return t.map(e=>(0,l.jsxs)("div",{className:i().locationContainer,children:[e.district&&(0,l.jsx)("div",{className:i().badge,children:e.district}),e.label!==a?(0,l.jsx)("div",{className:i().location,children:e.label||e.address}):(0,l.jsx)("div",{className:i().location,children:e.address})]},e.id))}},{title:"Orders",key:"orderFrequency",width:80,render:e=>{let{_count:t}=e;return t?t.salesOrders:0}},{title:"Created At",key:"createdAt",render:e=>(0,l.jsx)("div",{children:P()(e.createdAt).format("MMM D, YYYY")})},{title:"Last Order Date",key:"last-order-created-at",render:e=>{let{lastSalesOrderCreatedAt:t}=e;return t?P()(t).format("MMM D, YYYY"):(0,l.jsx)("div",{className:i().unassigned,children:"No previous orders"})},sorter:!0},{title:"SMS Count",key:"sms",width:120,render:e=>(0,l.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:12},children:[e.smsCount,(0,l.jsx)(o.Z,{title:"Send Promotional SMS",children:(0,l.jsx)("div",{children:(0,l.jsx)(c.Z,{size:"small",onClick:()=>{em(e),er(!0)},icon:(0,l.jsx)(j.Z,{})})})})]})},{title:"Additional Info",key:"additionalInfo",render:e=>e.additionalInformation?(0,l.jsx)(d.default.Text,{ellipsis:{tooltip:e.additionalInformation},children:e.additionalInformation}):(0,l.jsx)("div",{className:i().unassigned,children:"N/A"})}];(0,C.useEffect)(()=>{t?H(t):H(ej[1].value)},[t]),(0,C.useEffect)(()=>{L.viewDistributors&&eP()},[L]),(0,C.useEffect)(()=>{L.viewDistributors&&eB()},[ep,L]),(0,C.useEffect)(()=>{"graph"===z&&M&&eV()},[z,M]),(0,C.useEffect)(()=>{L.viewDistributors&&"graph"===z&&eU()},[ey,z]);let eP=async()=>{K(!0),await a((0,y.s_)({types:ez()?[A.R1.E_COMMERCE_CUSTOMER,A.R1.DISTRIBUTOR,A.R1.RETAILER]:void 0})),K(!1)},eU=async()=>{J(!0),await a((0,y.H_)({year:ey})),J(!1)},eB=async()=>{q(!0),await a((0,y.Ts)({page:0,types:ez()?[A.R1.E_COMMERCE_CUSTOMER,A.R1.DISTRIBUTOR,A.R1.RETAILER]:void 0,salesOrderCount:!0,...ep})),q(!1)},eV=async()=>{try{if(eh)return;ev(!0);let e=await R.GQ.fetchDistributorRegions(M.companyId);eC(e)}catch(e){u.Z.error({message:"Unable to Retrieve Map Data",description:e.message,placement:"bottomLeft"})}finally{ev(!1)}},eF=async e=>{q(!0),await a((0,y.Ts)({page:e-1,salesOrderCount:!0,...ep})),q(!1)},ez=()=>(null==M?void 0:M.industry)===A.Q7.E_COMMERCE,eH=(0,C.useMemo)(()=>(null==M?void 0:M.industry)!==A.Q7.E_COMMERCE?[...eS]:(null==M?void 0:M.isDistributorNotificationsEnabled)?[...eL]:[...eL].filter(e=>"sms"!==e.key),[M]),eY=function(){let e=!(arguments.length>0)||void 0===arguments[0]||arguments[0];return eH.reduce((t,a)=>{let{key:l}=a;return{...t,[l]:e}},{})},eq=()=>eH.reduce((e,t)=>
1{let{key:a}=t;return["additionalInfo"].includes(a)?{...e,[a]:!1}:{...e,[a]:!0}},{}),eQ=()=>eI(eH.filter(e=>{let{key:t}=e;return ew[t]}));return(0,C.useEffect)(()=>{eQ()},[ew,M]),(0,C.useEffect)(()=>{(0,_.Qr)(ew)&&eZ(eq())},[M,ew]),(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:i().container,children:[(0,l.jsxs)("div",{className:i().contentHeader,children:[(0,l.jsx)("h2",{style:{margin:0,marginBottom:"auto"},children:"Customers"}),(0,l.jsxs)("div",{className:i().metrics,children:[(0,l.jsxs)("div",{className:i().metric,children:[(0,l.jsxs)("div",{className:i().metricTitleContainer,children:[(0,l.jsx)("p",{className:i().metricTitle,children:"Total Customers"}),(0,l.jsx)(o.Z,{title:"Total customers in the system.",placement:"bottom",children:(0,l.jsx)("img",{src:"/img/info.svg",style:{width:16,height:16},alt:"Alert icon"})})]}),(0,l.jsx)("h3",{className:i().metricTotal,children:W?(0,l.jsx)(m.Z,{size:"small"}):w.total})]}),(0,l.jsxs)("div",{className:i().metric,children:[(0,l.jsxs)("div",{className:i().metricTitleContainer,children:[(0,l.jsx)("p",{className:i().metricTitle,children:"New Customers"}),(0,l.jsx)(o.Z,{title:"Newly added customers within the last 30 days.",placement:"bottom",children:(0,l.jsx)("img",{src:"/img/info.svg",style:{width:16,height:16},alt:"Alert icon"})})]}),(0,l.jsx)("h3",{className:i().metricTotal,style:{color:"#288EA5"},children:W?(0,l.jsx)(m.Z,{size:"small"}):w.new})]}),(0,l.jsxs)("div",{className:i().metric,children:[(0,l.jsxs)("div",{className:i().metricTitleContainer,children:[(0,l.jsx)("p",{className:i().metricTitle,children:"Active Customers"}),(0,l.jsx)(o.Z,{title:"This card shows the number of unique customers who placed at least one new order within the last 30 days.",placement:"bottom",children:(0,l.jsx)("img",{src:"/img/info.svg",style:{width:16,height:16},alt:"Alert icon"})})]}),(0,l.jsx)("h3",{className:i().metricTotal,style:{color:"#1CB89B"},children:W?(0,l.jsx)(m.Z,{size:"small"}):w.active})]})]}),(0,l.jsxs)("div",{className:i().contentHeaderContainer,children:[ej.map(t=>(0,l.jsx)("div",{className:z===t.value?i().filterButtonSelected:i().filterButton,onClick:()=>e.push("".concat(A.Hb.CUSTOMERS,"?view=").concat(t.value)),children:(0,l.jsx)("img",{src:t.icon})},t.value)),(0,l.jsx)(c.Z,{icon:(0,l.jsx)("img",{style:{width:24,height:24,marginTop:-2},src:"/img/preference-icon.svg"}),onClick:()=>eM(!0)}),(0,l.jsx)(h.Z,{trigger:["click"],overlay:()=>(0,l.jsxs)(v.Z,{children:[M.industry===A.Q7.E_COMMERCE&&(0,l.jsx)(v.Z.Item,{disabled:!L.viewCustomerTags,icon:(0,l.jsx)(T.Z,{}),onClick:()=>ei(!0),children:"Add Customer Tag"},"1"),(0,l.jsx)(v.Z.Item,{disabled:!L.uploadDistributors||!eO,icon:(0,l.jsx)(E.Z,{}),onClick:()=>et(!0),children:"Upload Customers"},"2"),(0,l.jsx)(v.Z.Item,{icon:(0,l.jsx)(N.Z,{}),onClick:()=>G(!0),disabled:!L.exportDistributors,children:"Export As CSV"},"3"),ez()&&(null==M?void 0:M.isDistributorNotificationsEnabled)&&(0,l.jsx)(v.Z.Item,{icon:(0,l.jsx)(j.Z,{}),onClick:()=>{er(!0),em(null)},children:"Send Promotional SMS"},"4")]}),children:(0,l.jsx)(c.Z,{children:"Action"})}),(0,l.jsx)(c.Z,{type:"primary",className:i().actionButton,disabled:!L.addDistributors,onClick:()=>ez()?el(!0):e.push("/add-customer"),children:"Add Customer"})]})]}),ex&&(0,l.jsxs)("div",{className:i().filterCountContainer,children:["You have filtered ",s," customer(s)."]}),(0,l.jsxs)("div",{className:i().content,children:[z===ej[1].value&&(0,l.jsx)(r.Z,{refresh:()=>eF(n+1),style:{marginTop:"24px"},loading:Y,columns:ek,onChange:(e,t,a,l)=>{"paginate"!==l.action&&("last-order-created-at"===a.columnKey?ep.sortLastOrderCreatedAt="ascend"===a.order?"asc":"descend"===a.order?"desc":void 0:ep.sortLastOrderCreatedAt=void 0,ef(ep))},dataSource:b,pagination:{pageSize:50,total:s,position:["topRight"],onChange:eF,showSizeChanger:!1,current:n+1},scroll:{y:"calc(100vh - 380px)"},rowKey:"id",empty:ex?(0,l.jsx)(V.Z,{showFallbackAction:!0}):null,filter:!0,filterTrigger:"click",filterPlacement:"bottomLeft",filterVisible:eE,onFilterVisibleChange:eN,filterContent:(0,l.jsxs)("div",{className:i().filterOptions,children:[(0,l.jsx)("h4",{children:"Columns"}),(0,l.jsx)("div",{children:(0,l.jsx)(g.Z,{checked:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Object.values(e).every(e=>!0===e)}(ew),value:"isAllChecked",onChange:e=>{if(e.target.checked)return eZ(eY(!0));eZ(eY(!1))},children:"Select All"})}),eH.map(e=>(0,l.jsx)("div",{children:(0,l.jsx)(g.Z,{checked:ew[e.key],value:e.key,onChange:t=>eZ({...ew,[e.key]:t.target.checked}),children:e.title})},e.key))]})}),z===ej[0].value&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:i().containerBox,children:[(0,l.jsxs)("h3",{children:["New Customer Trend",(0,l.jsx)(o.Z,{title:"Monthly new customer acquisitions over the past years",placement:"top",children:(0,l.jsx)("img",{src:"/img/info.svg",alt:"Info icon",className:i().infoIcon})})]}),(0,l.jsxs)("div",{className:i().graphContainer,children:[(0,l.jsx)(c.Z,{type:"primary",icon:(0,l.jsx)(k.Z,{}),loading:$,onClick:()=>eT(ey+1)}),$?(0,l.jsx)("div",{style:{height:245,width:"calc(100vw - 64px)",display:"flex"},children:(0,l.jsx)(m.Z,{style:{margin:"auto"},size:"large"})}):(0,l.jsx)("div",{style:{height:245,width:"calc(100vw - 64px)"},children:(0,l.jsx)(U.fH,{colors:["#298EA4"],data:eR,margin:{top:50,right:50,bottom:50,left:50},padding:.3,axisTop:null,axisRight:null,axisBottom:{tickSize:5,tickPadding:5,tickRotation:0,legendPosition:"middle",format:e=>P()(e).format("MMM, YYYY")},axisLeft:{tickSize:5,tickPadding:3,tickRotation:0,legendPosition:"middle"},tooltip:e=>{let{point:t}=e;return(0,l.jsxs)("div",{className:i().customerTooltip,children:[(0,l.jsx)("div",{className:i().customerTooltipDate,children:P()(t.data.x).format("MMM, YYYY")}),(0,l.jsxs)("div",{className:i().customerTooltipCount,children:["New Customers Count: ",t.data.y]})]})},theme:{axis:{legend:{text:{fill:"#64748B"}},fontSize:"12px"}},pointSize:2,pointBorderWidth:4,pointColor:{theme:"background"},pointBorderColor:{from:"serieColor"},useMesh:!0,labelSkipWidth:12,labelSkipHeight:12,labelTextColor:{from:"color",modifiers:[["dar
1ker",1.6]]},defs:[(0,B.c$)("gradientA",[{offset:0,color:"inherit"},{offset:100,color:"inherit",opacity:0}])],fill:[{match:"*",id:"gradientA"}],enableArea:!0})}),(0,l.jsx)(c.Z,{type:"primary",icon:(0,l.jsx)(I.Z,{}),loading:$,disabled:1===ey,onClick:()=>eT(ey-1)})]})]}),(0,l.jsxs)("div",{className:i().containerBox,children:[(0,l.jsxs)("h3",{className:i().subTitle,children:["Division-wise Customer Analytics",(0,l.jsx)(o.Z,{title:"Complete breakdown of customers by administrative divisions",placement:"top",children:(0,l.jsx)("img",{src:"/img/info.svg",alt:"Info icon",className:i().infoIcon})})]}),(0,l.jsx)("div",{children:(0,l.jsx)(r.Z,{columns:[{title:"Division",dataIndex:"division",render:(e,t)=>(0,l.jsxs)("span",{className:"division-cell",children:["division"===t.type?(0,l.jsx)("img",{src:"/img/invoice-pin.svg",alt:"Division Pin",className:i().divisionPin}):(0,l.jsx)("span",{className:i().childDot}),e]})},{title:"Districts",key:"totalDistricts",dataIndex:"totalDistricts"},{title:"Total Customers",key:"total",dataIndex:"total"},{title:"Market Share",key:"marketShare",render:e=>"".concat(e.marketShare,"%")}],dataSource:eD,rowClassName:e=>"district"===e.type?i().antTableRowChildrenBg:"",rowKey:"key",pagination:!1})})]})]})]})]}),ee&&(0,l.jsx)(O,{visible:ee,onCancel:()=>et(!1),onComplete:()=>{eF(0),eP(),eU()}}),es&&(0,l.jsx)(X,{visible:es,onCancel:()=>ei(!1)}),Q?(0,l.jsx)(eo,{visible:Q,onCancel:()=>G(!1)}):null,en?(0,l.jsx)(ec.Z,{selectedCustomer:eu,onCancel:()=>{er(!1)},onComplete:()=>{er(!1),eF(n+1)},visible:en}):null,eA?(0,l.jsx)(e_,{visible:eA,onCancel:()=>eM(!1)}):null,(0,l.jsx)(D.Z,{open:ea,onClose:()=>el(!1),onCreateCustomer:()=>{eF(n),eP(),eU()}})]})};eT.getLayout=function(e){return(0,l.jsx)(n.Z,{children:e})};var eE=eT},23406:function(e){e.exports={list:"AddCustomerTagModal_list__xg6qK",editCustomerTagActions:"AddCustomerTagModal_editCustomerTagActions__UmkQQ",actionButton:"AddCustomerTagModal_actionButton__k52ap",addCustomerTagContainer:"AddCustomerTagModal_addCustomerTagContainer__FW_bO",addCustomerTagActions:"AddCustomerTagModal_addCustomerTagActions__MFo7i",listItem:"AddCustomerTagModal_listItem__F0_52",customerTagInput:"AddCustomerTagModal_customerTagInput__4hjpG",editButton:"AddCustomerTagModal_editButton__bSDNV",cancelButton:"AddCustomerTagModal_cancelButton__ZkNFx",closeIcon:"AddCustomerTagModal_closeIcon___Z7MO"}},13219:function(e){e.exports={container:"CustomersPreferenceModal_container__H2IU5",dateTimePreference:"CustomersPreferenceModal_dateTimePreference__Wj92U",infoText:"CustomersPreferenceModal_infoText__2V6f9"}},27440:function(e){e.exports={dash:"DistributorsExportModal_dash__0pXh8",label:"DistributorsExportModal_label__Nn387",section:"DistributorsExportModal_section__n5AQh",sectionItem:"DistributorsExportModal_sectionItem__BrSGy",footer:"DistributorsExportModal_footer__PqOAE",exportModalContainer:"DistributorsExportModal_exportModalContainer__cSeZ8",productTag:"DistributorsExportModal_productTag__CRvb6",productTagAlt:"DistributorsExportModal_productTagAlt__W9lOq"}},19484:function(e){e.exports={container:"Customers_container__sCQ9d",containerBox:"Customers_containerBox___spwh",contentHeader:"Customers_contentHeader__gDCPH",contentHeaderContainer:"Customers_contentHeaderContainer__3O_xj",subTitle:"Customers_subTitle__0wgCf",filterOptions:"Customers_filterOptions__i_ljO",filterButton:"Customers_filterButton__a51Fs",filterButtonSelected:"Customers_filterButtonSelected__aGjy5",table:"Customers_table__sFWPV",distributorMarker:"Customers_distributorMarker__tALQH",mapContainer:"Customers_mapContainer__h4PXL",districtLabel:"Customers_districtLabel__NBhWb",link:"Customers_link__2vNgw",unassigned:"Customers_unassigned__LMuZI",distributorInfo:"Customers_distributorInfo__7nCKM",dialogTitle:"Customers_dialogTitle__rkMgq",valueTitle:"Customers_valueTitle__Vgcrr",value:"Customers_value__YLhgs",dialogInfoContainer:"Customers_dialogInfoContainer__Pa0mK",metrics:"Customers_metrics__dMp_T",metric:"Customers_metric__t3Q18",metricLogoContainer:"Customers_metricLogoContainer__GcrTE",metricLogo:"Customers_metricLogo__YP_c_",metricTitleContainer:"Customers_metricTitleContainer__toajF",metricTitle:"Customers_metricTitle__RVlWk",metricTotal:"Customers_metricTotal__sTk7u",locationContainer:"Customers_locationContainer__o4IEE",location:"Customers_location__QdF4x",phone:"Customers_phone__H7Adc",badge:"Customers_badge__kL_Hw",rangeDot:"Customers_rangeDot__sVCLF",regi
1onOverlayContainer:"Customers_regionOverlayContainer__nTXu8",regionHeader:"Customers_regionHeader__HU126",regionCount:"Customers_regionCount__utWDm",subRegionHeader:"Customers_subRegionHeader__UFspY",subRegionHeaderSelected:"Customers_subRegionHeaderSelected__N2eZt",graphContainer:"Customers_graphContainer__fZ4UP",customerTooltip:"Customers_customerTooltip__mCPT8",customerTooltipCount:"Customers_customerTooltipCount__HxCsr",customerTag:"Customers_customerTag__E_mBI",customerSource:"Customers_customerSource__Ck93Q",filterCountContainer:"Customers_filterCountContainer__EY9Cu",infoIcon:"Customers_infoIcon__juLFy",antTableRowChildrenBg:"Customers_antTableRowChildrenBg__jqqjX",childDot:"Customers_childDot__wqA_c",divisionPin:"Customers_divisionPin__PJDuO"}}},function(e){e.O(0,[3291,3161,4512,5919,2888,9774,179],function(){return e(e.s=84477)}),_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.