1import{c as he,fn as y,e as me,q as pe,f as ue,o as ge,bf as fe,bV as P,u as ee,b as E,r as c,fB as V,cz as xe,j as e,R as ye,p as n,bg as te,ai as je,cU as G,X as ve,fC as Se,g as W,bl as U,fD as z,Z as B,a5 as Y,A as Te,d as Q,a0 as Ce,T as be}from"./index-C1a3HxlB.js";import{P as ke,A as we}from"./AdminLayout-CsMb3pLm.js";import"./orderAdminStore-DG-0Hxjh.js";import"./productStore-BzktfEGT.js";import{A as D}from"./customerStore-BvprU_IZ.js";import"./index-DIzfO98g.js";import{L as Re}from"./next-link-BddBRzfL.js";import{u as Ie}from"./useScroll-CD9j_h1m.js";import{a as Ne,b as Pe,g as J}from"./commonState-Cid520RM.js";import{A as Ae}from"./settingShopAPI-COy8T8mn.js";import{A as _e}from"./reportAPI-CKhzNlAr.js";import{B as M}from"./button-DSXT93CA.js";import{M as Ee}from"./ModalTime-DeblnIdm.js";import{X as _}from"./xlsx.min-8JHG2Dom.js";import{applyReportStyle as Me}from"./excelHelper-D9ynkCRx.js";import{F as De}from"./Table-ClKPr6-U.js";import{M as Le}from"./index-BEAxdetJ.js";import{S as Fe}from"./index-1vnx_M-r.js";import{I as Ke}from"./index-CLYO9l17.js";import"./RootLayout-BAheRqvi.js";import"./next-head-CcvB56AX.js";import"./roleHelper-Ci1_qgp6.js";import"./authAPI-CzceA-2Q.js";import"./eventStore-B1adoLMy.js";import"./importOrderAPI-CGFUtTvI.js";import"./index-dR40OaQY.js";import"./compact-item-BZV5F90b.js";import"./dayjs.min-DQp6iGTW.js";import"./index-C0eaMEnH.js";import"./PurePanel-C36Xh8ye.js";import"./motion-vrmuGtMa.js";import"./useMergedState-xhaDmWGK.js";import"./useLayoutEffect-DiZMJoKc.js";import"./CalendarOutlined-6Hteuf5o.js";import"./index-Qfwo1G3T.js";import"./index-DjGQqOtx.js";import"./Portal-Bo3WlVCB.js";import"./useId-DajQNqhA.js";import"./isMobile-DjGTsQxe.js";import"./context-M3hn88kI.js";import"./statusUtils-WCFktl_7.js";import"./index-Cm7M08xr.js";import"./slide-CD80jWmc.js";import"./roundedArrow-CPTKCeIL.js";import"./useLocale-BVzrbY_A.js";import"./styleChecker-B2U_vfpG.js";import"./pickAttrs-DMXgaOk2.js";import"./addEventListener-DQRPOmJ4.js";import"./css-BgTlr-Pn.js";import"./index-BVIINqDw.js";import"./Overflow-BvpP50ur.js";import"./motion-B-mhyME-.js";import"./index-DgG3HguV.js";import"./CheckOutlined-CdC3Qsil.js";import"./DownOutlined-And_SgWY.js";import"./SearchOutlined-DtHuqb-7.js";import"./useBreakpoint-DjqZ_j6x.js";import"./responsiveObserver-Cxr5FzX8.js";import"./RightOutlined-LPt1jIRs.js";import"./index-CpWdkGAL.js";import"./index-DiKDYgH6.js";import"./index-DgE1VqUN.js";import"./dropdown-CE5lspIh.js";import"./EllipsisOutlined-BQ68rZQI.js";import"./index-a3HQo8Vz.js";import"./zoom-D1NJJVhA.js";import"./colors-BgE7WD0J.js";import"./collapse-BbEVqHco.js";import"./index-BBXH9-Yi.js";import"./useFlexGapSupport-Bjo_BNyE.js";import"./styleChecker-C_E3tUjr.js";import"./index-ifvB_K8R.js";import"./getDataOrAriaProps-BQfWqyDD.js";import"./ActionButton-jFc4KA3W.js";import"./index-BeP5Rwzs.js";import"./TextArea-CLOAefOL.js";import"./EyeOutlined--5iMMHnO.js";const x=he((d,l)=>({isLoading:!1,isEnd:!1,textSearch:"",pageInfo:{currentPage:1,totalPage:0},scrollInfo:{value:0},timeFilter:Ne("all"),listContacts:[],counter:{[y.Hom_Nay]:0,[y.Sap_Toi]:0},sortInfo:{field:ke.time,sortType:"DESC"},activeTab:y.Hom_Nay,startCustomTime:ue(ge(new Date().getFullYear(),new Date().getMonth())),endCustomTime:me(pe(new Date().getFullYear(),new Date().getMonth())),loadStatistic:async()=>{function i(h){if(!h.error){let v=l().pageInfo,T=l().activeTab,j=h.data;d({counter:j,pageInfo:{currentPage:v.currentPage||1,totalPage:Math.ceil((j[T]||0)/P)}})}}let u=await D.apiCountRemindReturns();return i(u),u},loadContacts:async(i,u,h,v,T)=>{if(l().isLoading)return;d({isLoading:!0});function k(o){let s=l().pageInfo;if(!o.error){let C=o.contacts.length<fe;if(i==1||!T){let g={isEnd:C,isLoading:!1,pageInfo:{...s,currentPage:i},listContacts:o.contacts};if(o.count){let S=l().counter,w=Math.ceil(o.count/P);S[u]=o.count,g.counter=S,g.pageInfo.totalPage=w}d(g)}else{let g=l().listContacts;d({isEnd:C,isLoading:!1,pageInfo:{...s,currentPage:i},listContacts:g.concat(o.contacts)})}}}let b=await D.apiListRemindReturns(i,u,h,v);return k(b),b},resetParams:()=>{let i=Pe();d({...i,activeTab:0})},setStore:i=>{d(i)}}));function ze({isShowing:d,hide:l,contact:i}){var S,w,R;if(!d)return null;let u=ee(),h=E(),[v,T]=c.useState([]),[j,k]=c.useState(0),[b,o]=c.useState(""),s=c.useRef(i),[C,g]=c.useState({mapProducts:{},result:[]});return c.useEffect(()=>{Promise.all([Ae.apiGetRemindShare(),D.apiDetailCustomer(i.contactId),_e.apiProductBoughtByCustomer(i.contactId)]).then(([a,m,N])=>{var I;s.current=m.customer,T(a.remindShare),k(0),o(V(h,s.current,(I=a.remindShare[0])==null?void 0:I.content)),N.error||g({mapProducts:N.mapProducts,result:N.result})})},[]),d?xe.createPortal(e.jsxs(ye.Fragment,{children:[e.jsx("div",{className:"modal-overlay"}),e.jsx("div",{id:"modal-share-product",children:e.jsx("div",{className:"modal-wrapper","aria-modal":!0,"aria-hidden":!0,tabIndex:-1,role:"dialog",children:e.jsxs("div",{className:"modal",style:{maxWidth:1e3,width:1e3,paddingTop:20},children:[e.jsxs("div",{style:{marginBottom:20},children:[e.jsxs("div",{className:"title",style:{fontSize:18,textAlign:"center"}
1,children:["Gá»i lá»i nhắc tá»i:"," ",e.jsx("span",{style:{color:n.primary},children:i[te.fullName]})]}),e.jsxs("div",{style:{justifyContent:"center",display:"flex",gap:20,marginTop:5},children:["SÄT:",[s.current.phone,...s.current.extraPhones||[]].map(a=>e.jsxs("div",{style:{display:"flex",gap:5},children:[e.jsx("span",{children:je(a)}),e.jsx("span",{style:{display:"flex",cursor:"pointer",fontSize:18,color:n.gray_gray},onClick:()=>navigator.clipboard.writeText(a),children:e.jsx("ion-icon",{name:"copy-outline"})})]}))]}),s.current.address&&e.jsxs("div",{style:{justifyContent:"center",display:"flex",gap:20,marginTop:5},children:["Äá»a chá»:"," ",G(s.current.address)]}),s.current.textNote&&e.jsxs("div",{style:{justifyContent:"flex-start",display:"flex",gap:20,marginTop:5,color:n.gray_gray},children:["Ghi chú: ",e.jsx("span",{style:{color:n.primary},children:s.current.textNote})]}),C.result.length>0&&e.jsxs("div",{style:{justifyContent:"flex-start",display:"flex",alignItems:"center",gap:5,marginTop:5,color:n.gray_gray},children:["Sá» dụng gần Äây:"," ",e.jsx("div",{style:{display:"flex",gap:5},children:[...C.result].splice(0,5).map((a,m)=>e.jsx("div",{style:{backgroundColor:n.gray_e,borderRadius:5,padding:5,color:n.primary},children:C.mapProducts[a.classifyId].productName},m))})]})]}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between"},children:[e.jsx("div",{style:{display:"flex",gap:20},children:v.map((a,m)=>e.jsx("div",{style:{backgroundColor:m==j?n.primary:n.gray_d,padding:5,borderRadius:5,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center"},onClick:()=>{k(m),o(V(h,s.current,v[m].content))},children:a.name},m))}),e.jsxs(M,{onClick:()=>{u.push("/setting/shareRemind")},style:{display:"flex",alignItems:"center",gap:5},children:[e.jsx("ion-icon",{name:"create-outline",style:{fontSize:18,marginTop:-2}}),e.jsx("span",{children:"Sá»a mẫu"})]})]}),e.jsx("textarea",{style:{outline:"none",minHeight:200,width:"100%",marginTop:10,marginBottom:10,borderColor:n.gray_d,padding:10,borderRadius:5},value:b,onChange:a=>o(a.target.value)}),e.jsxs("div",{style:{display:"flex",gap:10},children:[i.phone&&e.jsx("a",{href:`https://zalo.me/${i.phone}`,target:"_blank",children:"Zalo"}),((S=i==null?void 0:i.socialNetwork)==null?void 0:S.facebook)&&e.jsx("a",{href:i.socialNetwork.facebook,target:"_blank",children:"Facebook"}),((w=i==null?void 0:i.socialNetwork)==null?void 0:w.messenger)&&e.jsx("a",{href:i.socialNetwork.facebook,target:"_blank",children:"Messenger"}),((R=i==null?void 0:i.socialNetwork)==null?void 0:R.zalo)&&e.jsx("a",{href:i.socialNetwork.zalo,target:"_blank",children:"Zalo 2"})]}),e.jsxs("div",{style:{display:"flex",gap:10,justifyContent:"flex-end"},children:[e.jsx(M,{type:"primary",onClick:()=>{navigator.clipboard.writeText(b)},children:"Copy ná»i dung"}),e.jsx(M,{type:"default",onClick:()=>l(),children:"Äóng"})]})]})})})]}),document.body):null}function Be(){E();let d=x(t=>t.counter),l=x(t=>t.activeTab),i=x(t=>t.startCustomTime),u=x(t=>t.endCustomTime),h=x(t=>t.pageInfo),v=x(t=>t.scrollInfo);x(t=>t.sortInfo);let T=x(t=>t.listContacts),j=x(t=>t.loadContacts),k=x(t=>t.loadStatistic),b=x(t=>t.isLoading),o=x(t=>t.setStore),s=E(t=>t.saleSettings),C=E(t=>t.updateSettingInfo);const g=ee();let S=Ie(v.value),[w,R]=c.useState(!1),[a,m]=c.useState({setTimeReturn:!1,remindAuto:0,defaultPeriod:60}),[N,I]=c.useState(!1),[A,O]=c.useState(!1);async function ie(){if(!A){O(!0);try{const t=[];let r=1;const f=200;for(;r<=f;){const p=await D.apiListRemindReturns(r,l,i,u);if(p.error||!p.contacts||p.contacts.length===0)break;for(const K of p.contacts)t.push(K);if(p.contacts.length<P)break;r++}if(t.length===0){B("Không có khách hà ng nà o Äá» xuất");return}const H=["STT","Tên khách hà ng","SÄT","Äá»a chá»","Ngà y nhắc","Ghi chú"],oe=["Tá»NG",`${t.length} khách`,"","","",""],le=t.map((p,K)=>{const de=[p.phone,...p.extraPhones||[]].filter(Boolean).join(", ");return[K+1,p.fullName||"",de,G(p.address)||"",p.remindTimeReturn?Y(p.remindTimeReturn):"",p.remindNote||""]}),X=[H,oe,...le],Z=_.utils.aoa_to_sheet(X);Me(Z,H.length,X.length,[0]);const q=_.utils.book_new();_.utils.book_append_sheet(q,Z,"Khach can nhac");const F=new Date,ce=`Lich-nhac-khach_${String(F.getDate()).padStart(2,"0")}${String(F.getMonth()+1).padStart(2,"0")}${F.getFullYear()}.xlsx`;_.writeFile(q,ce)}catch(t){console.log("export remind error",t),B("Không xuất ÄÆ°á»£c file Excel")}finally{O(!1)}}}const re=[{shortText:"Không áp dụng",longText:"Tắt tÃnh nÄng tá»± Äá»ng nhắc khách",value:z.None},{shortText:"Cá» Äá»nh",longText:"Dá»±a theo giá trá» chu kỳ mặc Äá»nh Äá» thiết láºp thá»i gian nhắc khách tiếp theo",value:z.Fixed},{shortText:"Linh Äá»ng",longText:"Dá»±a và o 2 ÄÆ¡n gần nhất Äá» tÃnh ra thá»i gian nhắc khách tiếp theo",value:z.Flexible}];let[L,$]=c.useState({contact:null,show:!1});c.useEffect(()=>{console.log("xxx ================================ ",S),o({scrollInfo:{value:S}})},[S]),c.useEffect(()=>{k()},[]),c.useEffect(()=>{if(g.query){let t=parseInt(g.query.remindStatus)||y.Hom_Nay,r=J("thismonth")[0],f=J("thismonth")[1];t!=l&&o({activeTab:t}),j(h.currentPage,t,r,f,!1)}},[g.query]),c.useEffect(()=>{window.scrollTo({top:v.value})},[T]),c.useEffect(()=>{m({setTimeReturn:s.setTimeReturn||!1,remindAuto:s.remindAuto||0,defaultPeriod:s.defaultPeriod||60})},[s]);const ae=[{title:"STT",render:(t,r,f)=>e.jsxs("span",{children:[" ",f+1+P*(h.currentPage-1)]})},{title:"Tên khách hà ng",render:(t,r,f)=>e.jsx("div",{className:"profile",onClick:()=>{g.push(`/member/detail?contactId=${r.contactId}`)},children:e.jsx("div",{className:"profile-text",children:e.jsx("div",{className:"name",children:r.fullName})})})},{title:e.jsx("div",{style:{textAlign:"left"},children:"Äá»a chá»"}),render:(t,r,f)=>e.jsx("div",{style:{textAlign:"left"},children:e.jsx("div",{children:G(r.address)})})},{title:e.jsx("div",{style:{textAlign:"center"},children:"Ngà y nhắc"}),render:(t,r,f)=>e.jsx("div",{style:{textAlign:"center",color:n.red},children:e.jsx("div",{children:Y(r.remindTimeReturn)})})},{title:e.jsx("div",{style:{textAlign:"center",minWidth:100},children:"Ghi chú"}),render:(t,r,f)=>e.jsx("div",{style:{textAlign:"left"},children:e.jsx("div",{children:r.remindNote})})},{title:e.jsx("div",{}),render:(t,r,f)=>e.jsx("div",{style:{textAlign:"center",color:n.primary,cursor:"pointer",fontSize:22},onClick:()=>{$({show:!0,contact:r})},children:e.jsx("ion-icon",{name:"send-outline"})})}];function ne(t,r,f){o({pageInfo:{...h,currentPage:t.current}}),j(t.current,l,i,u,!1)}async function se(t){(await Te.apiUpdateSettingInfo({[Q.saleSettings]:t})).error||(C({[Q.saleSettings]:t}),Ce("Cáºp nháºt cà i Äặt thà nh công"))}return e.jsxs(e.Fragment,{children:[e.jsxs("div",{id:"paybook-remind",children:[e.jsxs("div",{className:"head-bar",id:"fixed-head-bar",children:[e.jsxs("button",{className:"back",onClick:()=>ve.back(),children:[e.jsx("ion-icon",{name:"arrow-back-circle"}),e.jsx("span",{children:"Quay lại"})]}),e.jsx("div",{className:"name",children:"Lá»ch nhắc khách"}),e.jsxs("div",{className:"head-right",style:{display:"flex",gap:16,alignItems:"center"},children:[e.jsx("div",{style:{color:A?n.gray_gray:n.primary,marginBottom:-10,cursor:A?"wait":"pointer",fontSize:28},onClick:()=>{A||ie()},title:"Xuất Excel khách cần nhắc",children:e.jsx("ion-icon",{name:"cloud-download-outline"})}),e.jsx("div",{style:{color:n.primary,marginBottom:-10,cursor:"pointer",fontSize:28},onClick:()=>R(!0),children:e.jsx("ion-icon",{name:"settings-outline"})})]})]}),e.jsx("div",{className:"customer-table",children:e.jsxs("div",{className:"wrapper",children:[e.jsxs("div",{className:"head-tab",children:[Se.map((t,r)=>e.jsx(Re,{href:`/member/remind?remindStatus=${t.id}`,replace:!0,children:e.jsxs("a",{className:`tab-item ${l==t.id?"active":""}`,onClick:()=>{o({activeTab:t.id,sortInfo:{field:te.createdAt,sortType:"DESC"},pageInfo:{currentPage:1,totalPage:Math.ceil((d[t.id]||0)/P)}}),j(1,t.id,null,null,!1)},children:[e.jsx("span",{children:t.label}),d[t.id]>
10?e.jsx("span",{className:"number",children:d[t.id]}):null]})},r)),e.jsxs("div",{className:`tab-item ${y.Khac==l?"active":""}`,onClick:()=>{I(!0)},children:[l==y.Khac?e.jsxs("span",{children:[W(i)," - ",W(u)]}):e.jsx("span",{children:"Khác"}),d[y.Khac]>0&&l==y.Khac?e.jsx("span",{className:"number",children:d[y.Khac]}):null]})]}),e.jsx("div",{className:"body-content",children:e.jsx(De,{columns:ae,rowKey:t=>t.contactId,dataSource:T,pagination:{current:h.currentPage,pageSize:U,total:h.totalPage*U,showSizeChanger:!1},loading:b,onChange:ne})})]})})]}),e.jsx(Le,{title:e.jsx("div",{style:{textAlign:"center"},children:"Cà i Äặt nhắc khách"}),open:w,onCancel:()=>R(!1),footer:[],width:800,children:e.jsxs("div",{style:{marginBottom:5,gap:10,display:"flex",flexDirection:"column"},children:[e.jsxs("div",{style:{display:"flex",gap:10,alignItems:"flex-start"},children:[e.jsxs("div",{style:{flex:1},children:[e.jsx("div",{style:{fontWeight:"500"},children:"Äặt thá»i gian nhắc khách khi tạo ÄÆ¡n"}),e.jsx("div",{style:{color:n.gray_gray,fontSize:14},children:"Thiết láºp thá»i gian Äá» app gá»i thông báo nhắc khách quay lại"})]}),e.jsx(Fe,{checked:a.setTimeReturn,onChange:t=>{m({...a,setTimeReturn:t})}})]}),re.map(t=>e.jsxs("div",{style:{backgroundColor:a.remindAuto==t.value?n.primary:n.gray_e,padding:10,borderRadius:5,cursor:"pointer"},onClick:r=>{m({...a,remindAuto:t.value})},children:[e.jsx("h4",{children:t.shortText}),e.jsx("div",{style:{},children:t.longText})]},t.value)),e.jsxs("div",{style:{display:"flex",gap:10,alignItems:"flex-start"},children:[e.jsxs("div",{children:[e.jsx("div",{style:{flex:1,fontWeight:"500"},children:"Giá trá» chu kỳ mặc Äá»nh"}),e.jsx("div",{style:{color:n.gray_gray,fontSize:14},children:"Ãp dụng khi tá»± Äá»ng nhắc khách vá»i các khách chá» má»i có 1 ÄÆ¡n Äầu tiên hoặc nhắc khách cá» Äá»nh"})]}),e.jsx(Ke,{style:{width:150},type:"number",value:a.defaultPeriod.toString(),onChange:t=>{m({...a,defaultPeriod:parseInt(t.target.value)})}}),e.jsx("div",{style:{color:n.primary},children:"Ngà y"})]}),e.jsx("div",{style:{textAlign:"center"},children:e.jsx(M,{type:"primary",onClick:()=>{let t=a.defaultPeriod;isNaN(t)||!t?B("Giá trá» chu kỳ mặc Äá»nh cần lá»n hÆ¡n 0"):se({...s,setTimeReturn:a.setTimeReturn,remindAuto:a.remindAuto,defaultPeriod:t}),R(!1)},children:"Cáºp nháºt"})})]})}),e.jsx(ze,{contact:L.contact,isShowing:L.show,hide:()=>$({...L,show:!1})}),e.jsx(Ee,{startTime:i,endTime:u,timeLabel:"thismonth",hide:()=>I(!1),showTimeModal:N,onConfirm:(t,r,f)=>{I(!1),o({startCustomTime:t,endCustomTime:r,activeTab:y.Khac}),j(h.currentPage,y.Khac,t,r,!1)}})]})}function di(){return e.jsx(we,{activeMenu:be.khach_hang,children:e.jsx(Be,{})})}export{di 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.