PageSourceSearch

https://secondsutra.com/assets/UserDetails-C6bHC-R_.js

js secondsutra.com collected 2026-09-24 14:02:29 UTC 162,799 bytes, 4 lines download raw bytes

1import{aQ as Ue,j as e,fS as ui,fT as xi,fU as mi,fV as gi,r as h,bA as pi,bP as ji,W as S,bB as fi,fW as bi,dO as yi,F as ls,H as Vt,fX as vi,fY as _i,fZ as $n,f_ as wi,f$ as Si,i as Ci,e7 as ki,eF as Ni,cL as Be,U as b,aD as Te,e4 as rs,dZ as et,T as ge,B as q,_ as U,bH as xe,dQ as Fn,aE as Qe,aF as pe,aG as w,cc as Ze,aH as mt,aJ as Ie,dP as Ai,aB as it,bM as yt,cy as Re,e9 as On,cY as Bt,cZ as ts,dI as Bn,g0 as on,g1 as Ii,aZ as ye,aK as cn,d_ as Le,I as re,g2 as Dn,D as lt,g as rt,e6 as Mt,el as Mi,g3 as Pi,e5 as Vn,g4 as zi,g5 as Ht,eO as Wt,g6 as Tt,g7 as Wi,g8 as ds,g9 as hn,cg as jt,ga as Ti,gb as Li,gc as Ei,ev as Un,ew as Ee,ei as Je,gd as Ri,ay as Xe,ge as $i,gf as Fi,gg as Hn,gh as Gn,gi as Yn,gj as qn,gk as Oi,gl as Kn,gm as Zn,gn as tt,go as Gt,gp as Bi,e as gt,gq as Di,gr as Vi,gs as Xn,gt as It,bW as Ui,bX as Hi,gu as Gi,gv as Yi,gw as qi,gx as Ki,gy as Zi,bh as Xi,gz as Ji,dH as Qi,aI as el,gA as tl,C as Ut,gB as sl,gC as al,gD as Jn,gE as Qn,gF as ei,$ as ti,gG as nl,gH as il,aa as ll,gI as rl,eo as ss,gJ as dl,gK as ol,gL as cl,gM as hl,gN as ul,f as pt,gO as xl,c$ as ml,m as gl,bz as si,aS as pl,gP as jl,gQ as fl,gR as bl,gS as yl,gT as vl,e8 as _l,ea as wl,n as as,d0 as Sl,ae as Cl,c as ai,a_ as kl,gU as Nl,gV as Al,gW as Il,gX as Ml,gY as Pl,gZ as zl,g_ as Wl,g$ as Tl,h0 as Ll,h1 as El,h2 as Rl,dS as $l,h3 as Fl,h4 as Ol,h5 as Bl,h6 as Dl,h7 as Vl,h8 as Ul,et as Hl,h9 as Gl,ha as Yl,hb as ql,hc as Kl,hd as Zl,em as un,en as qt,aj as Xl,f3 as Jl,eq as Ql,bF as xn,ej as Kt,ek as mn,f1 as er,he as tr,cB as gn,hf as sr,hg as ar,bx as nr,hh as ir,hi as lr,aY as pn,ez as rr,h as dr}from"./index-ySeiRI4v.js";import{S as jn,c as fn}from"./react-select.esm-B6jsS4s7.js";import{H as or,b as cr,d as Lt,e as os,f as Et,S as hr,F as ur,U as xr,w as mr,C as gr,M as pr,a as jr,A as fr,P as br}from"./crm.utils-CASPJ7_p.js";import{A as bn}from"./AutoCompleteHint-Dd4kFl27.js";import{A as yr}from"./ArrowDropDown-C_Sqb1NB.js";import{D as yn}from"./DateTimePicker-D7YVMCyN.js";import{T as _t}from"./TableContainer-CnQ9_yJa.js";import{T as wt,a as St,b as De,c as Ct}from"./TableRow-C8hlvloP.js";import{T as c}from"./TableCell-Cf2T25O8.js";import{u as vr,s as _r,J as wr,S as Sr,w as vn,a as Cr,b as kr}from"./JourneyTimeline-CDrNr9XL.js";import{S as Nr}from"./Snackbar-DeDwRWBp.js";import"./createSuper-CURCJVod.js";import"./ClickAwayListener-Bfis-iox.js";const Ar=Ue(e.jsx("path",{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6z"}),"AddOutlined"),Ir=Ue([e.jsx("path",{d:"M21 10V4c0-1.1-.9-2-2-2H3c-1.1 0-1.99.9-1.99 2L1 16c0 1.1.9 2 2 2h11v-5c0-1.66 1.34-3 3-3zm-10 1L3 6V4l8 5 8-5v2z"},"0"),e.jsx("path",{d:"M21 14v4c0 1.1-.9 2-2 2s-2-.9-2-2v-4.5c0-.28.22-.5.5-.5s.5.22.5.5V18h2v-4.5c0-1.38-1.12-2.5-2.5-2.5S15 12.12 15 13.5V18c0 2.21 1.79 4 4 4s4-1.79 4-4v-4z"},"1")],"AttachEmail"),_n=Ue(e.jsx("path",{d:"M15.41 7.41 14 6l-6 6 6 6 1.41-1.41L10.83 12z"}),"ChevronLeftOutlined"),wn=Ue(e.jsx("path",{d:"M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"}),"ChevronRightOutlined"),Mr=Ue(e.jsx("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}),"CloseOutlined"),Pr=Ue(e.jsx("path",{d:"M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2m0 16H8V7h11z"}),"ContentCopyOutlined"),zr=Ue(e.jsx("path",{d:"m14.06 9.02.92.92L5.92 19H5v-.92zM17.66 3c-.25 0-.51.1-.7.29l-1.83 1.83 3.75 3.75 1.83-1.83c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.2-.2-.45-.29-.71-.29m-3.6 3.19L3 17.25V21h3.75L17.81 9.94z"}),"EditOutlined"),Wr=Ue(e.jsx("path",{d:"M20 19.59V8l-6-6H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c.45 0 .85-.15 1.19-.4l-4.43-4.43c-.8.52-1.74.83-2.76.83-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5c0 1.02-.31 1.96-.83 2.75zM9 13c0 1.66 1.34 3 3 3s3-1.34 3-3-1.34-3-3-3-3 1.34-3 3"}),"FindInPage"),Tr=Ue(e.jsx("path",{d:"M8.59 16.59 13.17 12 8.59 7.41 10 6l6 6-6 6z"}),"KeyboardArrowRight"),Dt=Ue(e.jsx("path",{d:"M3 17.25V21h3.75L17.81 9.94l-3.75-3.75zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34a.996.996 0 0 0-1.41 0l-1.83 1.83 3.75 3.75z"}),"ModeEdit"),Lr=Ue(e.jsx("path",{d:"M20 15.5c-1.25 0-2.45-.2-3.57-.57-.35-.11-.74-.03-1.02.24l-2.2 2.2c-2.83-1.44-5.15-3.75-6.59-6.58l2.2-2.21c.28-.27.36-.66.25-1.01C8.7 6.45 8.5 5.25 8.5 4c0-.55-.45-1-1-1H4c-.55 0-1 .45-1 1 0 9.39 7.61 17 17 17 .55 0 1-.45 1-1v-3.5c0-.55-.45-1-1-1M12 3v10l3-3h6V3z"}),"PermPhoneMsg");function Pt(t){"@babel/helpers - typeof";return Pt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(s){return typeof s}:function(s){return s&&typeof Symbol=="function"&&s.constructor===Symbol&&s!==Symbol.prototype?"symbol":typeof s},Pt(t)}function Sn(t,s){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);
1s&&(r=r.filter(function(p){return Object.getOwnPropertyDescriptor(t,p).enumerable})),i.push.apply(i,r)}return i}function nt(t){for(var s=1;s<arguments.length;s++){var i=arguments[s]!=null?arguments[s]:{};s%2?Sn(Object(i),!0).forEach(function(r){Er(t,r,i[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):Sn(Object(i)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(i,r))})}return t}function Er(t,s,i){return s=Rr(s),s in t?Object.defineProperty(t,s,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[s]=i,t}function Rr(t){var s=$r(t,"string");return Pt(s)==="symbol"?s:String(s)}function $r(t,s){if(Pt(t)!=="object"||t===null)return t;var i=t[Symbol.toPrimitive];if(i!==void 0){var r=i.call(t,s||"default");if(Pt(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(s==="string"?String:Number)(t)}var Fr=ui({name:"search-box",connector:!0}),Or=function(s,i){return i(s)},Br=function(s){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:mi;return xi(s,Fr()),function(r){var p=r||{},x=p.queryHook,a=x===void 0?Or:x,m,n;return{$$type:"ais.searchBox",init:function(v){var W=v.instantSearchInstance;s(nt(nt({},this.getWidgetRenderState(v)),{},{instantSearchInstance:W}),!0)},render:function(v){var W=v.instantSearchInstance;s(nt(nt({},this.getWidgetRenderState(v)),{},{instantSearchInstance:W}),!1)},dispose:function(v){var W=v.state;return i(),W.setQueryParameter("query",void 0)},getRenderState:function(v,W){return nt(nt({},v),{},{searchBox:this.getWidgetRenderState(W)})},getWidgetRenderState:function(v){var W=v.helper,l=v.instantSearchInstance,N=v.state;return m||(m=function(F){a(F,function(A){return W.setQuery(A).search()})},n=function(){W.setQuery("").search()}),{query:N.query||"",refine:m,clear:n,widgetParams:r,isSearchStalled:l.status==="stalled"}},getWidgetUiState:function(v,W){var l=W.searchParameters,N=l.query||"";return N===""||v&&v.query===N?v:nt(nt({},v),{},{query:N})},getWidgetSearchParameters:function(v,W){var l=W.uiState;return v.setQueryParameter("query",l.query||"")}}}};function Dr(t,s){return gi(Br,t,s)}function Vr(t){const s=/(?:ss|SS|zm|ZM)\d+/g,i=t.match(s);return i||[]}function Ur({zm_id:t}){var x,a,m,n,f,v,W,l,N,C,F,A,T,M,B,D,I,$,E,_,j,R,H,J,V,y,G,k,L,O;const{data:s,isLoading:i}=bi(t),{data:r}=yi({user_id:t,status:"approved"});function p(){window.open("/view-profile/"+t,"_blank")}return i?"...Loading":e.jsxs("div",{role:"button",onClick:p,className:"mt-2 flex rounded-2xl border",children:[e.jsx("div",{children:e.jsx("img",{width:"100px",height:"100px",src:(a=(x=r==null?void 0:r.data)==null?void 0:x[0])==null?void 0:a.thumb_image_url,alt:"empty"})}),e.jsxs("div",{className:"flex-grow p-1",children:[e.jsxs("div",{children:[e.jsxs("span",{className:"text-base capitalize",children:[(n=(m=s==null?void 0:s.data)==null?void 0:m.user_details)==null?void 0:n.name," "]}),"(",t,")"]}),e.jsx("p",{className:"mt-2 text-sm",children:[`${(v=(f=s==null?void 0:s.data)==null?void 0:f.user_details)==null?void 0:v.age} yrs`,(l=(W=s==null?void 0:s.data)==null?void 0:W.user_details)==null?void 0:l.height,(F=(C=(N=s==null?void 0:s.data)==null?void 0:N.user_details)==null?void 0:C.matrimony_profile)==null?void 0:F.marital_status,(M=(T=(A=s==null?void 0:s.data)==null?void 0:A.user_details)==null?void 0:T.matrimony_profile)==null?void 0:M.highest_education,(I=(D=(B=s==null?void 0:s.data)==null?void 0:B.user_details)==null?void 0:D.matrimony_profile)==null?void 0:I.occupation,(_=(E=($=s==null?void 0:s.data)==null?void 0:$.user_details)==null?void 0:E.matrimony_profile)==null?void 0:_.annual_income,(H=(R=(j=s==null?void 0:s.data)==null?void 0:j.user_details)==null?void 0:R.matrimony_profile)==null?void 0:H.mother_tongue,(y=(V=(J=s==null?void 0:s.data)==null?void 0:J.user_details)==null?void 0:V.matrimony_profile)==null?void 0:y.eating_habits,(k=(G=s==null?void 0:s.data)==null?void 0:G.user_details)==null?void 0:k.city,(O=(L=s==null?void 0:s.data)==null?void 0:L.user_details)==null?void 0:O.state].filter(K=>K).map((K,te)=>e.jsxs("span",{children:[te!==0&&e.jsx("span",{children:"•"})," ",K," "]},K))})]})]})}function Hr(t){const[s,i]=h.useState(!1),r=h.useMemo(()=>t.comment?Vr(t.comment):[],[t.comment]);return r.length===0?null:e.jsx("div",{children:e.jsxs(pi,{expanded:s,onChange:(p,x)=>i(x),children:[e.jsx(ji,{expandIcon:e.jsx(yr,{}),"aria-controls":"panel1-content",id:"panel1-header",children:e.jsx(S,{component:"span",children:"View Profiles"})}),s&&e.jsx(fi,{children:r.map(p=>e.jsx(Ur,{zm_id:p}))})]})})}const Gr=({topicId:t,setUserTags:s,userTags:i,tags:r,refetch:p,user_id:x,notification_preference:a,ph:m})=>{const[n]=ls(),f=Vt(),[v,W]=h.useState(5),[l,N]=h.useState("-updated_at"),[C,F]=h.useState("no"),[A,T]=h.useState(""),[M,B]=h.useState(!1),{data:D,isPending:I,refetch:$}=vi(t,v,A,l,C),{data:E,isPending:_}
1=_i(),j=D==null?void 0:D.data.results,[R,H]=h.useState([]),[J,V]=h.useState(null),[y,G]=h.useState(""),[k,L]=h.useState(null),[O,K]=h.useState(null),[te,ve]=h.useState(null),[o,Y]=h.useState({}),{user:X}=Vt(),{mutateAsync:fe}=$n(t.toString());h.useEffect(()=>{j&&j.length>0&&H(j)},[j]);const{mutateAsync:Ce,isPending:_e}=wi(t.toString()),{mutateAsync:oe,isPending:be}=Si(t.toString()),{control:ce,handleSubmit:ie,reset:we,formState:{isValid:ke},watch:ee,setValue:ae,getValues:le,setError:Ne}=Ci({defaultValues:{content:"",isTodo:!1,todoDate:null,assignedTo:null,priority:null,template_id:null,whatsapp_template:null,send_whatsapp_template:!0,link_ssid:null,push_ss_ids:null},mode:"onChange"});h.useEffect(()=>{le("isTodo")?(ae("assignedTo",X==null?void 0:X.id),ae("priority","high")):(ae("assignedTo",null),ae("priority",null))},[le("isTodo")]);const je=ee("content")||"";h.useEffect(()=>{if(je.includes("calllater")){ae("isTodo",!0);const d=new Date,P=d.getDay();let Z;P===4?Z=4:Z=3,d.setDate(d.getDate()+Z);const de=d.getDay();de===6?d.setDate(d.getDate()+2):de===0&&d.setDate(d.getDate()+1),ae("todoDate",d.toISOString())}else ae("isTodo",!1),ae("todoDate",null)},[je,ae]);const ue=ee("isTodo"),Ae=ee("send_whatsapp_template"),Pe=ee("template_id");h.useEffect(()=>{(Ae||Pe==3)&&te&&(te==null?void 0:te.length)>0&&ae("whatsapp_template",te[0],{shouldDirty:!0,shouldValidate:!0}),!Ae&&Pe!=3&&ae("whatsapp_template",null)},[Ae,te,ae,Pe]);const[ze,He]=h.useState([]),{data:$e}=ki(),st=ee("push_ss_ids")||"",{data:qe}=Ni(st,x.toString()),he=()=>{var P;if(!st)return!0;const d=st.split(",").map(Z=>Z.trim()).filter(Boolean);return((P=qe==null?void 0:qe.data)==null?void 0:P.length)===d.length},ht=async d=>{var se,Q,me,Me;if(d.whatsapp_template=="profile_shared_to_prospect"&&!d.link_ssid)return Ne("link_ssid",{message:"SS_ID is required for the whatsapp template"});if((d.template_id===3||d.template_id===21)&&!he())return Ne("push_ss_ids",{message:"One or more of the provided SS IDs are invalid."});const P={template_id:d.template_id,comment:d.content,is_todo:d.isTodo,follow_up:d.todoDate,assignee:d.assignedTo,priority:d.priority,whatsapp_template:d.whatsapp_template,link_ssid:d.link_ssid,push_ss_ids:d.push_ss_ids},Z={name:(se=f.user)==null?void 0:se.name,email:(Q=f.user)==null?void 0:Q.email,zm_id:(me=f.user)==null?void 0:me.zm_id,id:(Me=f.user)==null?void 0:Me.id},{data:de}=await Ce(P);de.user=Z,de.assignee=$e==null?void 0:$e.data.find(Ke=>Ke.id==d.assignedTo),H(Ke=>[de,...Ke]),p(),we()},at=d=>{const P={year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"};return new Date(d).toLocaleDateString(void 0,P)},Se=d=>{V(d.id),G(d.comment)},ut=()=>{V(null),G("")},ft=async d=>{if(y.length<=5){U.error("Comment must be at least 5 characters");return}await oe({id:d,comment:y,template_id:k});const P=R.map(Z=>Z.id===d?{...Z,comment:y,template_id:k}:Z);H(P),V(null),G("")};function Fe(d){const P=new Date,Z=new Date(d);return(P.getTime()-Z.getTime())/(1e3*60*60)<=24}return h.useEffect(()=>{const d=n==null?void 0:n.get("comment_id");if(d){const P=document.getElementById(`comment-id-${d}`);if(!P)return;P.scrollIntoView({behavior:"smooth",block:"center"})}},[n]),e.jsxs(Be,{sx:{p:3},children:[e.jsxs(b,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2},children:[e.jsx(S,{variant:"h6",children:"Comments"}),e.jsxs(b,{sx:{py:3,minWidth:200,display:"flex",gap:1},children:[e.jsx(Te,{sx:{flex:1},fullWidth:!0,children:e.jsx(rs,{sx:{minWidth:300},multiple:!0,disableCloseOnSelect:!0,options:((r==null?void 0:r.data)||[]).filter(d=>!i.some(P=>P.id===d.id)).map(d=>({id:d.id,name:d.name,color:d.color})),getOptionLabel:d=>d.name,isOptionEqualToValue:(d,P)=>d.id===P.id,value:ze||[],onChange:(d,P)=>{He(P)},renderTags:(d,P)=>{const de=d.slice(0,2),se=d.length-2;return e.jsxs(b,{sx:{display:"flex",flexWrap:"wrap",alignItems:"center",justifyContent:"center",gap:.5},children:[de.map((Q,me)=>h.createElement(et,{...P({index:me}),key:Q.id,label:Q.name,size:"small",sx:{backgroundColor:Q.color,color:"white"}})),se>0&&e.jsx(et,{label:`+${se}`,size:"small",sx:{backgroundColor:"#888",color:"white"}})]})},renderOption:(d,P)=>h.createElement("li",{...d,key:P.id},e.jsx(et,{label:P.name,size:"small",sx:{backgroundColor:P.color,color:"white",mr:1}})),renderInput:d=>e.jsx(ge,{...d,size:"small",placeholder:"Add Tags"}),ListboxProps:{style:{maxHeight:300,overflowY:"scroll"}}})}),e.jsx(q,{onClick:()=>
1{if(ze.length>0){const P=[...i,...ze].filter((de,se,Q)=>se===Q.findIndex(me=>me.id===de.id)),Z=P.map(de=>de.id);fe(Z).then(()=>{s(P),He([]),p(),U.success("Tags Updated Successfully")}).catch(()=>U.error("Failed to update tags"))}},children:"Add Tags"})]})]}),e.jsx(b,{sx:{mb:3},children:e.jsxs(xe,{container:!0,spacing:2,alignItems:"center",children:[e.jsx(xe,{item:!0,xs:12,md:4,children:e.jsx(ge,{fullWidth:!0,size:"small",placeholder:"Search comments, users, or assignees...",value:A,onChange:d=>T(d.target.value),InputProps:{startAdornment:e.jsx(Fn,{sx:{color:"text.secondary"}})}})}),e.jsx(xe,{item:!0,xs:12,md:4,children:e.jsxs(Te,{fullWidth:!0,size:"small",children:[e.jsx(Qe,{children:"Sort by"}),e.jsxs(pe,{value:l,label:"Sort by",onChange:d=>N(d.target.value),children:[e.jsx(w,{value:"-created_at",children:"Created At"}),e.jsx(w,{value:"-updated_at",children:"Updated At"}),e.jsx(w,{value:"-follow_up",children:"Follow Up"})]})]})}),e.jsx(xe,{item:!0,xs:12,md:4,children:e.jsxs(Te,{fullWidth:!0,size:"small",children:[e.jsx(Qe,{children:"Todo Status"}),e.jsxs(pe,{value:C,label:"Todo Status",onChange:d=>F(d.target.value),children:[e.jsx(w,{value:"no",children:"No Todo"}),e.jsx(w,{value:"yes",children:"Any Todo"}),e.jsx(w,{value:"yes:no",children:"Todo Not Completed"}),e.jsx(w,{value:"yes:yes",children:"Todo Completed"})]})]})})]})}),e.jsx(b,{sx:{mb:3},children:e.jsxs("form",{onSubmit:ie(ht),children:[te&&te.length>0&&ee("template_id")!=3&&e.jsxs(b,{sx:{display:"flex",flexDirection:"column",gap:1.5,my:3},children:[e.jsx(Ze,{name:"send_whatsapp_template",control:ce,render:({field:d})=>e.jsx(mt,{control:e.jsx(Ie,{...d,checked:!!d.value}),label:"Send WhatsApp Template"})}),ee("send_whatsapp_template")&&(a==null?void 0:a.find(d=>d.notification_type=="whatsapp"&&d.is_enabled==!1))&&e.jsxs("p",{className:"text-sm text-red-800",children:[e.jsx(Ai,{})," This user has turned off WhatsApp notifications in their profile settings."]}),e.jsxs("div",{className:"flex items-center justify-center gap-2",children:[(ee("template_id")===3||ee("template_id")===21)&&e.jsx(Ze,{name:"push_ss_ids",control:ce,render:({field:d,fieldState:P})=>{var Z;return e.jsx(ge,{...d,fullWidth:!0,size:"small",label:"Push notification SS IDs (comma separated)",placeholder:"e.g. SS123, ZM456",error:!!P.error,helperText:(Z=P.error)==null?void 0:Z.message})}}),ee("whatsapp_template")=="profile_shared_to_prospect"&&e.jsx(Ze,{name:"link_ssid",control:ce,render:({field:d,fieldState:P})=>{var Z;return e.jsx(ge,{...d,fullWidth:!0,size:"small",label:"Link SSID",placeholder:"Enter link SSID",error:!!P.error,helperText:(Z=P.error)==null?void 0:Z.message})}}),ee("send_whatsapp_template")&&ee("template_id")!=3&&e.jsx(Ze,{name:"whatsapp_template",control:ce,render:({field:d})=>e.jsx(Te,{fullWidth:!0,size:"small",children:e.jsx(pe,{...d,children:te.map((P,Z)=>e.jsx(w,{value:P,children:P},Z))})})}),ee("whatsapp_template")&&e.jsx(q,{onClick:()=>{B(!0)},children:"Preview"})]})]}),(je.includes("#noresponse #attempt2")||je.includes("#noresponse #attempt3")||je.includes("#noresponse #attempt4")||je.includes("#noresponse #attempt1"))&&e.jsxs(b,{sx:{display:"flex",gap:3,mb:2,borderRadius:1},children:[e.jsx(mt,{control:e.jsx(Ie,{checked:!0,disabled:!0}),label:e.jsxs(S,{variant:"body2",sx:{fontWeight:500},children:[ee("template_id")==3?"Whatsapp":"Email"," Sent"]})}),e.jsx(mt,{control:e.jsx(Ie,{checked:!0,disabled:!0}),label:e.jsx(S,{variant:"body2",sx:{fontWeight:500},children:"Push Notification Sent"})})]}),e.jsx(Ze,{name:"content",control:ce,rules:{required:"Note content is required",minLength:{value:5,message:"Note must be at least 5 characters"}},render:({field:d,fieldState:P})=>{var Z;return e.jsx(bn,{type:"create",inputValue:d.value||"",options:E==null?void 0:E.data,setInputValue:d.onChange,error:!!P.error,helperText:(Z=P.error)==null?void 0:Z.message,setTemplateId:de=>ae("template_id",de),setWhatsappTemplate:de=>ve(de),template_id:ee("template_id"),placeholder:"Enter your note here...",label:"Note",disabled:_})}}),e.jsx(Ze,{name:"isTodo",control:ce,render:({field:d})=>e.jsx(mt,{control:e.jsx(Ie,{...d,checked:d.value}),label:"Mark as Todo"})}),ue&&e.jsxs(b,{sx:{mb:2},children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx(Ze,{name:"todoDate",control:ce,render:({field:d})=>e.jsx(yn,{sx:{flex:1},value:d.value?it(d.value):null,format:"DD/MM/YYYY hh:mm A",closeOnSelect:!1,minDateTime:it(),viewRenderers:{hours:yt,minutes:yt,
1seconds:yt},onChange:P=>d.onChange(P==null?void 0:P.toISOString()),slotProps:{textField:{size:"small",fullWidth:!0},actionBar:{actions:["clear","accept"]}}})}),e.jsx(Ze,{name:"priority",control:ce,render:({field:d})=>e.jsx(e.Fragment,{children:e.jsx("div",{className:"space-y-2",children:e.jsxs(pe,{fullWidth:!0,sx:{flex:1},value:d.value,onChange:P=>d.onChange(P.target.value),children:[e.jsx(w,{value:"high",children:"High Priority"}),e.jsx(w,{value:"medium",children:"Medium Priority"}),e.jsx(w,{value:"low",children:"Low Priority"})]})})})})]}),e.jsx(Ze,{name:"assignedTo",rules:{validate:d=>ue?!!d||"Assigned To is required when Todo is selected":!0},control:ce,render:({field:d})=>e.jsx(e.Fragment,{children:$e&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(Qe,{sx:{color:"black",mt:2},children:"Assigned To"}),e.jsx(pe,{fullWidth:!0,sx:{flex:1},value:d.value,onChange:P=>d.onChange(P.target.value),children:$e.data.map(P=>e.jsx(w,{value:P.id,children:P.name}))})]})})})]}),e.jsxs(b,{sx:{display:"flex",justifyContent:"flex-end",gap:1},children:[e.jsx(q,{variant:"outlined",onClick:()=>{we()},children:"Reset"}),e.jsx(q,{variant:"contained",type:"submit",disabled:!ke||_e,children:"Save Comment"})]})]})}),_e||be||I?e.jsx(b,{sx:{display:"flex",justifyContent:"center",py:4},children:e.jsx(Re,{})}):R&&R.length>0?R.map(d=>{var P,Z,de;return e.jsx("div",{id:`comment-id-${d.id}`,children:e.jsx(On,{alignItems:"flex-start",sx:{px:0},children:e.jsx(Bt,{variant:"outlined",sx:{width:"100%",border:n.get("comment_id")===d.id.toString()?"2px solid var(--primary)":""},children:e.jsx(ts,{children:e.jsxs(Bn,{spacing:2,children:[J===d.id?e.jsxs(e.Fragment,{children:[e.jsx(bn,{setTemplateId:se=>L(se),disabled:!Fe(d.created_at),inputValue:y,template_id:k,type:"edit",placeholder:"Edit note...",label:"Note",options:E==null?void 0:E.data,setInputValue:se=>G(se)}),d.is_todo&&e.jsxs(e.Fragment,{children:[e.jsx(yn,{label:"Due Date",format:"DD/MM/YYYY hh:mm A",closeOnSelect:!1,minDateTime:it(),viewRenderers:{hours:yt,minutes:yt,seconds:yt},slotProps:{textField:{size:"small",fullWidth:!0},actionBar:{actions:["clear","accept"]}},slots:{openPickerIcon:d.follow_up?on:Ii},value:it(d.follow_up),onAccept:async se=>{if(!se){await oe({id:d.id,follow_up:null}),U.success("Updation Success");const Q=R.map(me=>me.id===d.id?{...me,follow_up:null}:me);H(Q);return}try{const Q=se.toISOString();await oe({id:d.id,follow_up:Q}),U.success("Updation Success");const me=R.map(Me=>Me.id===d.id?{...Me,follow_up:Q}:Me);H(me)}catch(Q){console.error("Failed to update follow_up date:",Q)}}}),e.jsxs(Te,{children:[e.jsx(Qe,{id:`priority-label-${d.id}`,children:"Select Priority"}),e.jsxs(pe,{id:`priority-label-${d.id}`,labelId:`priority-label-${d.id}`,label:"Select Priority",fullWidth:!0,sx:{flex:1},value:d.priority??"",onChange:async se=>{const Q=se.target.value;if(Q)try{await oe({id:d.id,priority:Q}),U.success("Priority updated");const me=R.map(Me=>Me.id===d.id?{...Me,priority:Q}:Me);H(me)}catch(me){console.error("Failed to update priority:",me),U.error("Failed to update priority")}},renderValue:se=>se?se.charAt(0).toUpperCase()+se.slice(1)+" Priority":"Select Priority",children:[e.jsx(w,{value:"high",children:"High Priority"}),e.jsx(w,{value:"medium",children:"Medium Priority"}),e.jsx(w,{value:"low",children:"Low Priority"})]})]})]})]}):e.jsxs(e.Fragment,{children:[e.jsx(S,{variant:"body1",sx:{whiteSpace:"pre-wrap"},children:or(d.comment)}),d.virtual_meet&&e.jsxs("p",{className:"text-[12px] text-gray-500",children:["Virtual Meet Comment between"," ",d.virtual_meet.participant_1_name," and"," ",d.virtual_meet.participant_2_name]})]}),e.jsx(Hr,{comment:d.comment}),d.is_todo&&e.jsxs(xe,{container:!0,spacing:2,alignItems:"center",children:[((P=d.comment)==null?void 0:P.includes("#assisted_lead"))&&!d.is_done&&e.jsx(xe,{item:!0,xs:12,sm:8,md:6,children:e.jsxs(Te,{fullWidth:!0,size:"small",children:[e.jsx(Qe,{id:`assisted-reason-label-${d.id}`,children:"Select Reason"}),e.jsxs(pe,{labelId:`assisted-reason-label-${d.id}`,label:"Select Reason",value:o[d.id]||"",onChange:se=>Y(Q=>({...Q,[d.id]:se.target.value})),children:[e.jsx(w,{value:"assisted_purchased",children:"Purchased Assisted Plan"}),e.jsx(w,{value:"assisted_dropped",children:"Decided Not to purchase Assisted"}),e.jsx(w,{value:"continue_assisted_follow_up",children:e.jsxs(b,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%"},children:[e.jsx("span",{children:"Follow-up Required"}),e.jsx(ye,{title:"Next follow up will be after three days",children:e.jsx(cn,{fontSize:"small",sx:{color:"action.active",ml:1}})})]})})]})]})}),(((Z=d.comment)==null?void 0:Z.includes("#low_interest_response"))||((de=d.comment)==null?void 0:de.includes("#profile_by_parents_others")))&&!d.is_done&&e.jsx(xe,{item:!0,xs:12,sm:8,md:6,children:e.jsxs(Te,{fullWidth:!0,size:"small",children:[e.jsx(Qe,{id:`assisted-reason-label-${d.id}`,children:"Select Reason"}),e.jsxs(pe,{labelId:`assisted-reason-label-${d.id}`,label:"Select Reason",value:o[d.id]||"",onChange:se=>Y(Q=>({...Q,[d.id]:se.target.value})),children:[e.jsx(w,{value:"interested_in_assisted",children:"Interested in Assisted"}),e.jsx(w,{value:"not_interested_in_assisted",children:"Not Interested in Assisted"}),e.jsx(w,{value:"continue_assisted_follow_up",children:e.jsxs(b,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%"},children:[e.jsx("span",{children:"Follow-up Required"}),e.jsx(ye,{title:`Next follow up will be after ${d.comment.includes("#low_interest_response")?1:3} days`,children:e.jsx(cn,{fontSize:"small",sx:{color:"action.active",ml:1}})})]})})]})]})}),e.jsx(xe,{item:!0,children:e.jsx(mt,{control:e.jsx(Ie,{checked:!!d.is_done,onChange:async se=>{var $t,kt,u;const Q=se.target.checked,me=($t=d.comment)==null?void 0:$t.includes("#assisted_lead"),Me=((kt=d.comment)==null?void 0:kt.includes("#low_interest_response"))||((u=d.comment)==null?void 0:u.includes("#profile_by_parents_others")),Ke=o[d.id];if(Q&&me&&!Ke){U.error("Please select a reason before marking as done");return}if(Q&&Me&&!Ke){U.error("Please select a reason before marking as done");return}try{await oe({id:d.id,is_done:Q,follow_up:null,done_reason:Q&&(me||Me)?Ke:null});const Nt=R.map(bt=>bt.id===d.id?{...bt,is_done:Q,follow_up:null}:bt);H(Nt),$(),p(),U.success("Updation Success")}catch(Nt){console.error("Failed to update is_done:",Nt)}}}),label:"Mark as Done"})})]}),d.follow_up&&e.jsxs(S,{variant:"caption",color:"text.secondary",children:["Due Date: ",at(d.follow_up)]}),d.priority&&e.jsxs(S,{variant:"caption",color:"text.secondary",children:["Pri
1ority: ",d.priority]}),d.assignee&&e.jsxs(S,{variant:"caption",color:"text.secondary",children:["Assigned to: ",d==null?void 0:d.assignee.name]}),d.is_todo&&d.todo_completed_date_and_time&&e.jsxs(S,{variant:"caption",color:"text.secondary",children:["Todo Completed on:"," ",Le(d.todo_completed_date_and_time)]}),e.jsxs(b,{display:"flex",justifyContent:"space-between",alignItems:"center",flexWrap:"wrap",children:[e.jsxs(b,{children:[e.jsx(S,{variant:"caption",color:"text.secondary",children:e.jsx("a",{target:"_blank",referrerPolicy:"no-referrer",href:`/django/api/crm/call-recordings/?mobile=${m}&timestamp=${it(d.created_at).format("YYYYMMDD")}&name=Revathy`,children:at(d.created_at)})}),e.jsxs(S,{variant:"caption",color:"text.secondary",ml:1,children:["Created by ",d.user.name]})]}),e.jsx(b,{display:"flex",gap:1,alignItems:"center",children:J===d.id?e.jsxs(e.Fragment,{children:[e.jsx(q,{variant:"outlined",size:"small",onClick:ut,children:"Cancel"}),e.jsx(q,{variant:"contained",size:"small",disabled:!Fe(d.created_at)||be||_e,onClick:()=>ft(d.id),children:"Save"})]}):e.jsx(re,{size:"small",onClick:()=>{d.virtual_meet?K({meetId:d.virtual_meet.id,comment:d.comment}):Se(d)},children:e.jsx(on,{fontSize:"small"})})})]})]})})})})},d.id)}):e.jsx(S,{variant:"body2",color:"text.secondary",sx:{textAlign:"center",py:4},children:"No comments available. Add a comment to get started."}),D&&D.data.next&&e.jsx(q,{onClick:()=>{W(d=>d+5)},variant:"contained",children:"Load more"}),e.jsx(cr,{open:!!O,meetId:(O==null?void 0:O.meetId)||null,initialComment:O==null?void 0:O.comment,onClose:()=>K(null),onSuccess:$}),e.jsx(Yr,{isOpen:M,onClose:()=>B(!1),temp_name:ee("whatsapp_template")||"",user_id:x})]})};function Yr({isOpen:t,onClose:s,temp_name:i,user_id:r}){const{data:p,isLoading:x,error:a}=Dn({template_value:i,user_id:r});return e.jsx(lt,{open:t,onClose:s,children:e.jsxs(rt,{className:"max-h-96 max-w-2xl overflow-y-auto",children:[x&&e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(Re,{})}),a&&e.jsx("div",{className:"bg-destructive/10 text-destructive rounded-lg p-4",children:"Failed to load text items. Please try again."}),p&&!x&&e.jsx("h3",{children:p.data.raw_message})]})})}const qr=[{heading:"Email",items:[{notification_type:"email",category:"recommendation",label:"Match Recommendations"},{notification_type:"email",category:"activity",label:"Profile View Alerts"}]},{heading:"App",items:[{notification_type:"web_push",category:"recommendation",label:"Recommendation & Promotional"},{notification_type:"web_push",category:"activity",label:"Activity Alerts"}]},{heading:"Whatsapp",items:[{notification_type:"whatsapp",category:"activity",label:"Activity Alerts"}]}];function Kr({preferences:t}){const s=(i,r)=>{const p=t==null?void 0:t.find(x=>x.notification_type===i&&x.category===r);return p?p.is_enabled:!0};return e.jsxs(b,{sx:{mt:3},children:[e.jsx(S,{variant:"subtitle1",sx:{fontWeight:600,mb:1},children:"Notification Settings"}),e.jsx(Mt,{sx:{mb:2}}),qr.map(i=>e.jsxs(b,{sx:{mb:1.5},children:[e.jsx(S,{variant:"caption",sx:{fontSize:"0.75rem",color:"text.secondary"},children:i.heading}),i.items.map(r=>e.jsxs(b,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:1,py:.5},children:[e.jsx(S,{variant:"body2",children:r.label}),e.jsx(et,{size:"small",variant:"outlined",color:s(r.notification_type,r.category)?"success":"error",label:s(r.notification_type,r.category)?"On":"Off"})]},`${r.notification_type}-${r.category}`))]},i.heading))]})}function Rt({zm_id:t,name:s,age:i,imageUrl:r,badge:p,avatarShape:x="circle"}){return e.jsxs(b,{sx:{display:"flex",alignItems:"center",gap:1.5,minWidth:200},children:[e.jsxs(b,{sx:{position:"relative",flexShrink:0},children:[e.jsx(b,{component:"img",src:r||Mi,alt:s||t,sx:{width:40,height:40,borderRadius:x==="circle"?9999:"4px",objectFit:"cover",boxShadow:1}}),p]}),e.jsxs(b,{sx:{display:"flex",flexDirection:"column",gap:.25},children:[e.jsx(S,{sx:{cursor:"pointer"},onClick:a=>{a.stopPropagation(),window.open(`${window.location.origin}/view-profile/${t}`)},variant:"body2",color:"primary",fontWeight:"medium",children:t}),e.jsx(S,{variant:"body2",sx:{wordBreak:"break-word"},children:s||"-"}),i?e.jsx(et,{label:`${i} years`,size:"small",color:"primary",variant:"outlined",sx:{alignSelf:"flex-start"}}):null]})]})}function Cn({userId:t,mailbox_type:s,id:i,setAdminMailVisible:r,setSelectedIds:p}){var K,te,ve;const[x,a]=h.useState({tags:[]}),[m,n]=h.useState("all"),[f,v]=h.useState(["accepted","rejected"]),W=h.useMemo(()=>s==="accepted,rejected"?f.join(","):s,[s,f]),{data:l,isPending:N}=Pi(t,W,x.tags.join(","),m),[C,F]=h.useState([]),A=Vn(),{data:T,refetch:M}=zi(),[B,D]=h.useState(l?l.data.map(o=>o.id).join(","):void 0),{data:I}=Ht(B,i),$=h.useMemo(()=>(l==null?void 0:l.data)||[],[l]),{data:E,isFetching:_}=Wt(t,$.map(o=>o.id)),j=h.useMemo(()=>$.length>0&&$.every(o=>C.includes(o.zm_id)),[$,C]),R=h.useMemo(()=>$.length>0&&$.some(o=>C.includes(o.zm_id))&&!j,[$,C,j]),{mutateAsync:H}=Tt(),{mutateAsync:J}=Wi(),V=(K=A==null?void 0:A.data)==null?void 0:K.data;h.useEffect(()=>{if(l!=null&&l.data&&(l==null?void 0:l.data.length)>0){const o=l==null?void 0:l.data.map(Y=>Y.id).join(",");D(o)}},[l]);const[y,G]=h.useState({});h.useEffect(()=>{if(I!=null&&I.data){const o={};
1Object.entries(I.data).forEach(([Y,X])=>{o[Y]=(X==null?void 0:X.meeting_status)??""}),G(o)}},[I]),h.useEffect(()=>{T!=null&&T.data&&a({tags:T.data.map(o=>o.id)})},[T==null?void 0:T.data]);const k=o=>{F(Y=>Y.includes(o)?Y.filter(X=>X!==o):[...Y,o])},L=()=>{F(j?[]:$.map(o=>o.zm_id))},O=h.useMemo(()=>{const o=x.tags.sort(),Y=((T==null?void 0:T.data)||[]).map(X=>X.id).sort();return JSON.stringify(o)!==JSON.stringify(Y)},[x,T]);return e.jsx(b,{sx:{padding:4,margin:"0 auto"},children:!N&&e.jsxs(b,{children:[e.jsxs(b,{display:"flex",justifyContent:"space-between",alignItems:"center",children:[e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsx(S,{variant:"h6",children:"Actions:"}),e.jsx(q,{disabled:C.length==0,onClick:()=>{r(),p(C)},sx:{ml:1},children:"Send Profiles"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[s==="accepted,rejected"&&e.jsxs(b,{sx:{my:2,display:"flex",alignItems:"center",gap:1,border:"1px solid #ccc",borderRadius:1,px:2,py:.5},children:[e.jsx(S,{variant:"body2",sx:{fontWeight:"bold",color:"rgba(0, 0, 0, 0.6)"},children:"Show:"}),e.jsxs(b,{display:"flex",alignItems:"center",children:[e.jsx(mt,{control:e.jsx(Ie,{sx:{padding:.5},checked:f.includes("accepted"),disabled:f.length===1&&f.includes("accepted"),onChange:()=>{f.includes("accepted")?f.length>1&&v(f.filter(o=>o!=="accepted")):v([...f,"accepted"])},size:"small"}),label:"Accepted"}),e.jsx(mt,{control:e.jsx(Ie,{sx:{padding:.5},checked:f.includes("rejected"),disabled:f.length===1&&f.includes("rejected"),onChange:()=>{f.includes("rejected")?f.length>1&&v(f.filter(o=>o!=="rejected")):v([...f,"rejected"])},size:"small"}),label:"Rejected"})]})]}),e.jsxs(b,{sx:{my:2,display:"flex",gap:1},children:[e.jsx(Qe,{sx:{color:"black",my:1,flex:1},children:"Interest Direction"}),e.jsxs(pe,{value:m,onChange:o=>n(o.target.value),children:[e.jsx(w,{value:"all",children:"All"}),e.jsx(w,{value:"sent",children:"Sent"}),e.jsx(w,{value:"received",children:"Received"})]})]}),e.jsxs(b,{sx:{my:2,display:"flex",gap:1},children:[e.jsx(Qe,{sx:{color:"black",my:1,flex:1},children:"Exclude Tags"}),e.jsx(Te,{children:e.jsx(rs,{sx:{width:"300px"},multiple:!0,disableCloseOnSelect:!0,options:(V==null?void 0:V.filter(o=>!x.tags.includes(o.id)))||[],getOptionLabel:o=>o.name,isOptionEqualToValue:(o,Y)=>o.id===Y.id,value:(V==null?void 0:V.filter(o=>x.tags.includes(o.id)))||[],onChange:(o,Y)=>{const X=Y.map(fe=>fe.id);a({...x,tags:X})},renderTags:(o,Y)=>e.jsx(b,{sx:{display:"flex",flexWrap:"wrap",gap:.5},children:o.map((X,fe)=>h.createElement(et,{...Y({index:fe}),key:X.id,label:X.name,size:"small",sx:{backgroundColor:X.color,color:"white"}}))}),renderOption:(o,Y)=>h.createElement("li",{...o,key:Y.id},e.jsx(et,{label:Y.name,size:"small",sx:{backgroundColor:Y.color,color:"white",mr:1}})),renderInput:o=>e.jsx(ge,{...o,size:"small"}),ListboxProps:{style:{overflowY:"scroll"}}})}),e.jsx(q,{variant:"contained",color:"primary",disabled:!O,onClick:async()=>{const o=x.tags.join(",");await J({tags:o}),M()},children:"Save"})]})]})]}),e.jsxs(_t,{component:Be,children:[e.jsxs(wt,{sx:{minWidth:800,overflowX:"scroll"},"aria-label":"suggested profiles table",children:[e.jsx(St,{children:e.jsxs(De,{sx:{backgroundColor:"#f5f5f5"},children:[e.jsx(c,{padding:"checkbox",children:e.jsx(Ie,{indeterminate:R,checked:j,onChange:L})}),e.jsx(c,{sx:{fontWeight:"bold",wordBreak:"break-word"},children:"Profile"}),e.jsx(c,{sx:{fontWeight:"bold"},children:"Mailbox Status"}),e.jsx(c,{sx:{fontWeight:"bold"},children:e.jsx(Lt,{matches:E==null?void 0:E.data})}),e.jsx(c,{sx:{fontWeight:"bold"},children:"Proposal Status"}),e.jsx(c,{sx:{fontWeight:"bold"},children:"Interest Direction"}),e.jsx(c,{sx:{fontWeight:"bold"},children:"Profile Shared Status"}),e.jsx(c,{sx:{fontWeight:"bold"},children:"Annual Income"}),e.jsx(c,{sx:{fontWeight:"bold"},children:"Target Audience"}),e.jsx(c,{sx:{fontWeight:"bold"},children:"City"}),e.jsx(c,{sx:{fontWeight:"bold"},children:"Caste"}),e.jsx(c,{sx:{fontWeight:"bold"},children:"Education"}),s=="accepted,rejected"&&e.jsx(c,{sx:{fontWeight:"bold"},children:"Interest Accepted Date"}),e.jsx(c,{sx:{fontWeight:"bold"},children:"Marital Status With Children Status"}),e.jsx(c,{sx:{fontWeight:"bold"},children:"Ready to Accept Kids"}),s=="pending"&&e.jsx(e.Fragment,{children:e.jsx(c,{sx:{fontWeight:"bold"},children:"Interest Updated at"})})]})}),e.jsx(Ct,{children:(I==null?void 0:I.data)&&l&&((te=l==null?void 0:l.data)==null?void 0:te.length)>0&&(l==null?void 0:l.data.map(o=>{var Y,X,fe,Ce,_e,oe,be,ce,ie,we,ke,ee,ae,le,Ne,je,ue,Ae,Pe,ze,He,$e,st,qe,he,ht,at;return e.jsxs(De,{onClick:()=>{window.open(`${window.location.origin}/user/${o==null?void 0:o.zm_id}`)},sx:{"&:last-child td, &:last-child th":{border:0},"&:hover":{backgroundColor:"whitesmoke",cursor:"pointer"}},children:[e.jsx(c,{padding:"checkbox",onClick:Se=>Se.stopPropagation(),children:e.jsx(Ie,{checked:C.includes(o.zm_id),onChange:()=>k(o.zm_id)})}),e.jsx(c,{component:"th",scope:"row",children:e.jsx(Rt,{zm_id:o.zm_id,name:o.name,age:o.age,imageUrl:(Y=o==null?void 0:o.images.find(Se=>Se.is_primary))==null?void 0:Y.thumb_image_url,badge:os(o)?e.jsx("div",{className:"absolute -right-2 -top-3",children:e.jsx(ds,{})}):null})}),e.jsx(c,{children:((X=o==null?void 0:o.mailbox)==null?void 0:X.status)||"-"}),e.jsx(c,{children:e.jsx(Et,{matches:E==null?void 0:E.data,is_loading:_,candidate_id:o.id,candidate_zm_id:o.zm_id,candidate_name:o.name})}),e.jsx(c,{children:e.jsxs(pe,{renderValue:Se=>Se?Se.charAt(0).toUpperCase()+Se.slice(1).replace(/_/g," "):e.jsx("em",{children:"Select Proposal Status"}),displayEmpty:!0,value:y[o.id]||"",onClick:Se=>Se.stopPropagation(),onMouseDown:Se=>Se.stopPropagation(),onChange:async Se=>{var ft,Fe,d,P;const ut=Se.target.value;G(Z=>({...Z,[o.id]:ut})),(ft=I.data)!=null&&ft[o.id]||H({user_id:i,connected_user_id:o.id,meeting_status:ut,type:"post"}),(Fe=I.data)!=null&&Fe[o.id]&&H({connection_id:(P=(d=I.data)==null?void 0:d[o.id])==null?void 0:P.id,meeting_status:ut,type:"patch"})},children:[e.jsx(w,{value:"",disabled:!0,children:e.jsx("em",{children:"Select Proposal Status"})}),e.jsx(w,{value:"attempted_to_contact",children:"Attempted To Contact"}),e.jsx(w,{value:"under_consideration",children:"Under consideration"}),e.jsx(w,{value:"accepted",children:"Accepted"}),e.jsx(w,{value:"rejected",children:"Rejected"}),e.jsx(w,{value:"meeting_scheduled",children:"Meeting scheduled"}),e.jsx(w,{value:"under_process",children:"Under process"}),e.jsx(w,{value:"meeting_held",children:"Meeting held"}),e.jsx(w,{value:"dropped",children:"Dropped"}),e.jsx(w,{value:"marriage_finalised",children:"Marriage Finalised"})]})}),e.jsx(c,{children:i==o.mailbox.sender_id?"Sent":"Received"}),e.jsx(c,{children:(Ce=(fe=I.data)==null?void 0:fe[o.id])!=null&&Ce.user_shared&&((oe=(_e=I.data)==null?void 0:_e[o.id])!=null&&oe.connected_user_shared)?"Both Shared with Each other":(ce=(be=I.data)==null?void 0:be[o.id])!=null&&ce.user_shared?`${(ke=(we=(ie=I==null?void 0:I.data)==null?void 0:ie[o.id])==null?void 0:we.user)==null?void 0:ke.name} Profile Shared with ${(le=(ae=(ee=I==null?void 0:I.data)==null?void 0:ee[o.id])==null?void 0:ae.connected_user)==null?void 0:le.name}`:(je=(Ne=I.data)==null?void 0:Ne[o.id])!=null&&je.connected_user_shared?`${(Pe=(Ae=(ue=I==null?void 0:I.data)==null?void 0:ue[o.id])==null?void 0:Ae.connected_user)==null?void 0:Pe.name} Profile Shared with ${($e=(He=(ze=I==null?void 0:I.data)==null?void 0:ze[o.id])==null?void 0:He.user)==null?void 0:$e.name}`:"Not Shared"}),e.jsx(c,{children:((st=o==null?void 0:o.matrimony_profile)==null?void 0:st.annual_income)||"-"}),e.jsx(c,{children:(qe=o==null?void 0:o.meta_data)!=null&&qe.target_audience?"Yes":"No"}),e.jsx(c,{children:o.city}),e.jsx(c,{children:((he=o==null?void 0:o.matrimony_profile)==null?void 0:he.caste)||"-"}),e.jsx(c,{children:((ht=o==null?void 0:o.matrimony_profile)==null?void 0:ht.highest_education)||"-"}),s=="accepted,rejected"&&e.jsx(c,{children:hn((at=o==null?void 0:o.mailbox)==null?void 0:at.accepted_at,"dd/MM/yyyy, h:m A")||"-"}),e.jsxs(c,{children:[o.matrimony_profile.marital_status," ",o.matrimony_profile.no_of_children?`, ${o.matrimony_profile.no_of_children&&o.matrimony_profile.no_of_children} ${o.matrimony_profile.no_of_children&&o.matrimony_profile.no_of_children===1?"child":"children"} ${o.matrimony_profile.children_living_status&&o.matrimony_profile.children_living_status==="with_me"?"living with me":"not living with me"}`:""]}),e.jsx(c,{children:jt(o.matrimony_profile.accept_matches_with_kids)}),s=="pending"&&e.jsx(e.Fragment,{children:e.jsx(c,{children:hn(o==null?void 0:o.mailbox.updated_at,"dd/MM/yyyy, h:m A")||"-"})})]},o==null?void 0:o.zm_id)}))})]}),(!l||((ve=l==null?void 0:l.data)==null?void 0:ve.length)==0)&&e.jsx("div",{className:"flex items-center justify-center py-3",children:e.jsx(S,{sx:{textAlign:"center"},children:"No users Found"})})]})]})})}function Zr({userId:t}){const{data:s,isPending:i}=Ti(t),[r,p]=h.useState(new Set),x=m=>{const n=new Set(r);n.has(m)?n.delete(m):n.add(m),p(n)},a=(m,n=50)=>m.length<=n?m:m.substring(0,n)+"...";return e.jsx(e.Fragment,{children:!i&&e.jsx(b,{sx:{padding:4,maxWidth:1200,margin:"0 auto"},children:e.jsx(b,{children:e.jsx(_t,{component:Be,children:e.jsxs(wt,{sx:{minWidth:800,overflowX:"scroll"},"aria-label":"suggested profiles table",children:[e.jsx(St,{children:e.jsxs(De,{sx:{backgroundColor:"#f5f5f5"},children:[e.jsx(c,{sx:{fontWeight:"bold"},children:"Id"}),e.jsx(c,{sx:{fontWeight:"bold"},children:"Action Flag"}),e.jsx(c,{sx:{fontWeight:"bold"},children:"Change Message"}),e.jsx(c,{sx:{fontWeight:"bold"},children:"Modal"}),e.jsx(c,{sx:{fontWeight:"bold"},children:"Action Time"})]})}),e.jsx(Ct,{children:s==null?void 0:s.data.map(m=>e.jsxs(De,{sx:{"&:last-child td, &:last-child th":{border:0},"&:hover":{backgroundColor:"whitesmoke",cursor:"pointer"}},children:[e.jsx(c,{component:"th",scope:"row",children:e.jsx(S,{sx:{cursor:"pointer"},children:m.id})}),e.jsx(c,{component:"th",scope:"row",children:e.jsx(S,{sx:{cursor:"pointer"},children:m.action_flag})}),e.jsx(c,{onClick:()=>x(m.id.toString()),sx:{cursor:"pointer",maxWidth:"300px",wordBreak:"break-word",display:"flex",alignItems:"center"},children:e.jsxs(S,{sx:{cursor:"pointer",display:"flex",alignItems:"center"},children:[r.has(m.id.toString())?e.jsx(Li,{sx:{fontSize:"16px",mr:.5}}):m.change_message.length>50?e.jsx(Tr,{sx:{fontSize:"16px",mr:.5}}):null,r.has(m.id.toString())?m.change_message:a(m.change_message)]})}),e.jsx(c,{children:m.content_type?m.content_type.name=="preference detail"?"Partner Preference":m.content_type.name=="user"?"My Profile":m.content_type.name:"-"}),e.jsx(c,{children:Le(m.action_time)||"-"})]},m.id))})]})})})})})}function kn({children:t,value:s,index:i}){return e.jsx("div",{hidden:s!==i,role:"tabpanel",children:s===i&&e.jsx(b,{sx:{p:2},children:t})})}function Xr({zm_id:t}){const[s,i]=h.useState(0),{data:r,refetch:p}=Ei(t),x=(a,m)=>{i(m)};return e.jsxs(b,{sx:{width:"100%"},children:[e.jsxs(Un,{value:s,onChange:x,"aria-label":"shared profiles tabs",indicatorColor:"primary",textColor:"primary",variant:"fullWidth",children:[e.jsx(Ee,{label:"Profiles Shared With This Profile"}),e.jsx(Ee,{label:"This Profile Shared With Others"})]}),e.jsx(kn,{value:s,index:0,children:e.jsx(Nn,{zm_id:t,refetch:()=>p(),statusData:r==null?void 0:r.data.shared_with_me,type:"shared_with_me"})}),e.jsx(kn,{value:s,index:1,children:e.jsx(Nn,{zm_id:t,refetch:()=>p(),statusData:r==null?void 0:r.data.shared_with_connection,type:"shared_with_connection"})})]})}function Nn({statusData:t,refetch:s,zm_id:i,type:r}){const{mutateAsync:p}=Tt(),x=h.useMemo(()=>(t||[]).map(n=>n.connected_user.id),[t]),{data:a,isFetching:m}=Wt(i,x);return e.jsx(b,{children:e.jsx(_t,{component:Be,children:e.jsxs(wt,{sx:{minWidth:800,overflowX:"scroll"},"aria-label":"suggested profiles table",children:[e.jsx(St,{children:e.jsxs(De,{sx:{backgroundColor:"#f5f5f5"},children:[e.jsx(c,{sx:{fontWeight:"bold"},children:"Proposal Status"}),e.jsx(c,{sx:{fontWeight:"bold"},children:e.jsx(Lt,{matches:a==null?void 0:a.data})}),e.jsx(c,{sx:{fontWeight:"bold"},children:"Email Template"}),e.jsx(c,{sx:{fontWeight:"bold",wordBreak:"break-word"},children:"Profile"}),e.jsx(c,{sx:{fontWeight:"bold"},children:"Marital Status with Children"}),e.jsx(c,{sx:{fontWeight:"bold"},children:"Ready to Accept Kids"}),e.jsx(c,{sx:{fontWeight:"bold"},children:"Annual Income"}),e.jsx(c,{sx:{fontWeight:"bold"},children:"City"}),e.jsx(c,{sx:{fontWeight:"bold"},children:"Education"}),e.jsx(c,{sx:{fontWeight:"bold"},children:"Created At"}),e.jsx(c,{sx:{fontWeight:"bold"},children:"Interest Sent on"})]})}),e.jsx(Ct,{children:t&&t.length>0&&t.map(n=>{var f,v,W,l,N,C,F,A,T,M,B,D,I,$,E,_,j,R,H,J,V,y,G,k;return e.jsxs(De,{onClick:()=>{var L;return window.open(`${window.location.origin}/user/${(L=n==null?void 0:n.connected_user)==null?void 0:L.zm_id}`)},sx:{"&:last-child td, &:last-child th":{border:0},"&:hover":{backgroundColor:"whitesmoke",cursor:"pointer"}},children:[e.jsx(c,{children:e.jsxs(pe,{renderValue:L=>L?L.charAt(0).toUpperCase()+L.slice(1).replace(/_/g," "):e.jsx("em",{children:"Select Proposal Status"}),displayEmpty:!0,defaultValue:n==null?void 0:n.meeting_status,onClick:L=>L.stopPropagation(),onMouseDown:L=>L.stopPropagation(),onChange:async L=>{const O=L.target.value;O&&(await p({connection_id:n==null?void 0:n.id,meeting_status:O,type:"patch"}),s())},children:[e.jsx(w,{value:"",disabled:!0,children:e.jsx("em",{children:"Select Proposal Status"})}),e.jsx(w,{value:"attempted_to_contact",children:"Attempted To Contact"}),e.jsx(w,{value:"under_consideration",children:"Under consideration"}),e.jsx(w,{value:"accepted",children:"Accepted"}),e.jsx(w,{value:"rejected",children:"Rejected"}),e.jsx(w,{value:"meeting_scheduled",children:"Meeting scheduled"}),e.jsx(w,{value:"under_process",children:"Under process"}),e.jsx(w,{value:"meeting_held",children:"Meeting held"}),e.jsx(w,{value:"dropped",children:"Dropped"}),e.jsx(w,{value:"marriage_finalised",children:"Marriage Finalised"})]})}),e.jsx(c,{children:e.jsx(Et,{matches:a==null?void 0:a.data,is_loading:m,candidate_id:(f=n==null?void 0:n.connected_user)==null?void 0:f.id,candidate_zm_id:(v=n==null?void 0:n.connected_user)==null?void 0:v.zm_id,candidate_name:(W=n==null?void 0:n.connected_user)==null?void 0:W.name})}),n.user_zm_id==i&&r=="shared_with_me"&&e.jsx(c,{children:e.jsx(ye,{title:`${n==null?void 0:n.connected_user.name} Profile shared with this profile using ${Je((n==null?void 0:n.connected_user_shared)||"")} Template`,children:e.jsx("div",{children:Je((n==null?void 0:n.connected_user_shared)||"")||"-"})})}),n.user_zm_id!=i&&r=="shared_with_me"&&e.jsx(c,{children:e.jsx(ye,{title:`${n==null?void 0:n.connected_user.name} Profile shared with this profile using ${Je((n==null?void 0:n.user_shared)||"")} Template`,children:e.jsx("div",{children:Je((n==null?void 0:n.user_shared)||"")||"-"})})}),n.user_zm_id==i&&r=="shared_with_connection"&&e.jsx(c,{children:e.jsx(ye,{title:`This Profile Shared with ${(l=n==null?void 0:n.connected_user)==null?void 0:l.name} using ${Je((n==null?void 0:n.user_shared)||"")} Template`,children:e.jsx("div",{children:Je((n==null?void 0:n.user_shared)||"")||"-"})})}),n.user_zm_id!=i&&r=="shared_with_connection"&&e.jsx(c,{children:e.jsx(ye,{title:`This Profile Shared with ${n==null?void 0:n.connected_user.name} using ${Je((n==null?void 0:n.connected_user_shared)||"")} Template`,children:e.jsx("div",{children:Je((n==null?void 0:n.connected_user_shared)||"")||"-"})})}),e.jsx(c,{component:"th",scope:"row",children:e.jsx(Rt,{zm_id:(N=n==null?void 0:n.connected_user)==null?void 0:N.zm_id,name:(C=n==null?void 0:n.connected_user)==null?void 0:C.name,age:(F=n==null?void 0:n.connected_user)==null?void 0:F.age,imageUrl:(M=(T=(A=n==null?void 0:n.connected_user)==null?void 0:A.images)==null?void 0:T.find(L=>
1L.is_primary))==null?void 0:M.thumb_image_url})}),e.jsxs(c,{children:[(B=n==null?void 0:n.connected_user)==null?void 0:B.marital_status," ",(D=n==null?void 0:n.connected_user)!=null&&D.no_of_children?`, ${((I=n==null?void 0:n.connected_user)==null?void 0:I.no_of_children)&&(($=n==null?void 0:n.connected_user)==null?void 0:$.no_of_children)} ${(E=n==null?void 0:n.connected_user)!=null&&E.no_of_children&&((_=n==null?void 0:n.connected_user)==null?void 0:_.no_of_children)===1?"child":"children"} ${((j=n==null?void 0:n.connected_user)==null?void 0:j.children_living_status)&&((R=n==null?void 0:n.connected_user)==null?void 0:R.children_living_status)}`:""]}),e.jsx(c,{children:jt((H=n==null?void 0:n.connected_user)==null?void 0:H.accept_matches_with_kids)}),e.jsx(c,{children:((J=n==null?void 0:n.connected_user)==null?void 0:J.annual_income)||"-"}),e.jsx(c,{children:(V=n==null?void 0:n.connected_user)==null?void 0:V.city}),e.jsx(c,{children:((y=n==null?void 0:n.connected_user)==null?void 0:y.highest_education)||"-"}),e.jsx(c,{children:Le((G=n==null?void 0:n.connected_user)==null?void 0:G.created_at)||"-"}),n.user_zm_id==i&&r=="shared_with_me"&&e.jsx(c,{children:Le((n==null?void 0:n.connected_user_shared_at)||"")}),n.user_zm_id!=i&&r=="shared_with_me"&&e.jsx(c,{children:Le((n==null?void 0:n.user_shared_at)||"")||"-"}),n.user_zm_id==i&&r=="shared_with_connection"&&e.jsx(c,{children:Le((n==null?void 0:n.user_shared_at)||"")||"-"}),n.user_zm_id!=i&&r=="shared_with_connection"&&e.jsx(c,{children:Le((n==null?void 0:n.connected_user_shared_at)||"")||"-"})]},(k=n==null?void 0:n.connected_user)==null?void 0:k.zm_id)})})]})})})}function An({userId:t,id:s,gender:i,default_option:r=Xe.ShortlistedByMe,setAdminMailVisible:p,setSelectedIds:x}){var J,V;const[a,m]=h.useState(1),[n,f]=h.useState(r),{data:v,isPending:W}=Ri(n,a,t),[l,N]=h.useState(void 0),{data:C}=Ht(l,s),[F,A]=h.useState({}),[T,M]=h.useState([]),B=h.useMemo(()=>{var y;return((y=v==null?void 0:v.data)==null?void 0:y.results)||[]},[v]),{data:D,isFetching:I}=Wt(t,B.map(y=>y.id)),$=h.useMemo(()=>B.length>0&&B.every(y=>T.includes(y.zm_id)),[B,T]),E=h.useMemo(()=>B.length>0&&B.some(y=>T.includes(y.zm_id))&&!$,[B,T,$]),_=y=>{M(G=>G.includes(y)?G.filter(k=>k!==y):[...G,y])},j=()=>{M($?[]:B.map(y=>y.zm_id))};function R(y,G){const k=G==="Female"?"Her":"Him";switch(y){case Xe.ShortlistedByMe:return`Shortlisted By ${k}`;case Xe.ShortlistedByOthers:return"Shortlisted By Others";case Xe.ViewedByMe:return`Viewed By ${k}`;case Xe.ViewedByOthers:return"Viewed By Others";default:return y}}h.useEffect(()=>{m(1)},[n]),h.useEffect(()=>{if(C!=null&&C.data){const y={};Object.entries(C.data).forEach(([G,k])=>{y[G]=(k==null?void 0:k.meeting_status)??""}),A(y)}},[C]);const{mutateAsync:H}=Tt();return h.useEffect(()=>{if(v!=null&&v.data&&(v==null?void 0:v.data.results.length)>0){const y=v==null?void 0:v.data.results.map(G=>G.id).join(",");N(y)}},[v]),e.jsx(e.Fragment,{children:!W&&e.jsx(b,{sx:{padding:4,margin:"0 auto"},children:e.jsxs(b,{children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsx(S,{variant:"h6",children:"Actions:"}),e.jsx(q,{disabled:T.length==0,onClick:()=>{p(),x(T)},sx:{ml:1},children:"Send Profiles"})]}),e.jsx(b,{sx:{display:"flex",justifyContent:"flex-end",mb:2},children:e.jsxs(pe,{disabled:!0,value:n,onChange:y=>f(y.target.value),size:"small",renderValue:y=>R(y,i),children:[e.jsxs(w,{value:Xe.ShortlistedByMe,children:["Shortlisted By ",i==="Female"?"Her":"Him"]}),e.jsx(w,{value:Xe.ShortlistedByOthers,children:"Shortlisted By Others"}),e.jsxs(w,{value:Xe.ViewedByMe,children:["Viewed By ",i==="Female"?"Her":"Him"]}),e.jsx(w,{value:Xe.ViewedByOthers,children:"Viewed By Others"})]})})]}),e.jsxs(_t,{component:Be,children:[e.jsxs(wt,{sx:{minWidth:800,overflowX:"scroll"},"aria-label":"suggested profiles table",children:[e.jsx(St,{children:e.jsxs(De,{sx:{backgroundColor:"#f5f5f5"},children:[e.jsx(c,{padding:"checkbox",children:e.jsx(Ie,{indeterminate:E,checked:$,onChange:j})}),e.jsx(c,{sx:{fontWeight:"bold",wordBreak:"break-word"},children:"Profile"}),e.jsx(c,{sx:{fontWeight:"bold"},children:e.jsx(Lt,{matches:D==null?void 0:D.data})}),e.jsx(c,{sx:{fontWeight:"bold"},children:"Proposal Status"}),e.jsx(c,{sx:{fontWeight:"bold"},children:"Profile Shared Status"}),e.jsx(c,{sx:{fontWeight:"bold"},children:"Marital Status with Children"}),e.jsx(c,{sx:{fontWeight:"bold"},children:"Ready to Accept Kids"}),e.jsx(c,{sx:{fontWeight:"bold"},children:"Annual Income"}),e.jsx(c,{sx:{fontWeight:"bold"},children:"City"}),e.jsx(c,{sx:{fontWeight:"bold"},children:"Caste"}),e.jsx(c,{sx:{fontWeight:"bold"},children:"Education"}),e.jsx(c,{sx:{fontWeight:"bold"},children:"Last seen"}),e.jsx(c,{sx:{fontWeight:"bold"},children:"Created At"})]})}),e.jsx(Ct,{children:C&&(v==null?void 0:v.data)&&(v==null?void 0:v.data.results.length)>0&&(v==null?void 0:v.data.results.map(y=>{var G,k,L,O,K,te,ve,o,Y,X,fe,Ce,_e,oe,be,ce,ie,we,ke,ee,ae;return e.jsxs(De,{onClick:()=>window.open(`${window.location.origin}/user/${y.zm_id}`),sx:{"&:last-child td, &:last-child th":{border:0},"&:hover":{backgroundColor:"whitesmoke",cursor:"pointer"}},children:[e.jsx(c,{padding:"checkbox",onClick:le=>le.stopPropagation(),children:e.jsx(Ie,{checked:T.includes(y.zm_id),onChange:()=>_(y.zm_id)})}),e.jsx(c,{component:"th",scope:"row",children:e.jsx(Rt,{zm_id:y.zm_id,name:y.name,age:y.age,imageUrl:(G=y==null?void 0:y.images.find(le=>le.is_primary))==null?void 0:G.thumb_image_url,badge:os(y)?e.jsx("div",{className:"absolute -right-2 -top-3",children:e.jsx(ds,{})}):null})}),e.jsx(c,{children:e.jsx(Et,{matches:D==null?void 0:D.data,is_loading:I,candidate_id:y.id,candidate_zm_id:y.zm_id,candidate_name:y.name})}),e.jsx(c,{children:e.jsxs(pe,{renderValue:le=>le?le.charAt(0).toUpperCase()+le.slice(1).replace(/_/g," "):e.jsx("em",{children:"Select Proposal Status"}),displayEmpty:!0,value:F[y.id]||"",onClick:le=>le.stopPropagation(),onMouseDown:le=>le.stopPropagation(),onChange:async le=>{var je,ue,Ae,Pe;const Ne=le.target.value;A(ze=>({...ze,[y.id]:Ne})),(je=C.data)!=null&&je[y.id]||H({user_id:s,connected_user_id:y.id,meeting_status:Ne,type:"post"}),(ue=C.data)!=null&&ue[y.id]&&H({connection_id:(Pe=(Ae=C.data)==null?void 0:Ae[y.id])==null?void 0:Pe.id,meeting_status:Ne,type:"patch"})},children:[e.jsx(w,{value:"",disabled:!0,children:e.jsx("em",{children:"Select Proposal Status"})}),e.jsx(w,{value:"attempted_to_contact",children:"Attempted To Contact"}),e.jsx(w,{value:"under_consideration",children:"Under consideration"}),e.jsx(w,{value:"accepted",children:"Accepted"}),e.jsx(w,{value:"rejected",children:"Rejected"}),e.jsx(w,{value:"meeting_scheduled",children:"Meeting scheduled"}),e.jsx(w,{value:"under_process",children:"Under process"}),e.jsx(w,{value:"meeting_held",children:"Meeting held"}),e.jsx(w,{value:"dropped",children:"Dropped"}),e.jsx(w,{value:"marriage_finalised",children:"Marriage Finalised"})]})}),e.jsx(c,{children:(L=(k=C.data)==null?void 0:k[y.id])!=null&&L.user_shared&&((K=(O=C.data)==null?void 0:O[y.id])!=null&&K.connected_user_shared)?"Both Shared with Each other":(ve=(te=C.data)==null?void 0:te[y.id])!=null&&ve.user_shared?`${(X=(Y=(o=C==null?void 0:C.data)==null?void 0:o[y.id])==null?void 0:Y.user)==null?void 0:X.name} Profile Shared with ${(_e=(Ce=(fe=C==null?void 0:C.data)==null?void 0:fe[y.id])==null?void 0:Ce.connected_user)==null?void 0:_e.name}`:(be=(oe=C.data)==null?void 0:oe[y.id])!=null&&be.connected_user_shared?`${(we=(ie=(ce=C==null?void 0:C.data)==null?void 0:ce[y.id])==null?void 0:ie.connected_user)==null?void 0:we.name} Profile Shared with ${(ae=(ee=(ke=C==null?void 0:C.data)==null?void 0:ke[y.id])==null?void 0:ee.user)==null?void 0:ae.name}`:"Not Shared"}),e.jsxs(c,{children:[y.marital_status," ",y.no_of_children?`, ${y.no_of_children&&y.no_of_children} ${y.no_of_children&&y.no_of_children=="1"?"child":"children"} ${(y==null?void 0:y.children_living_status)&&(y==null?void 0:y.children_living_status)}`:""]}),e.jsx(c,{children:jt(y.accept_matches_with_kids)}),e.jsx(c,{children:y.annual_income||"-"}),e.jsx(c,{children:y.city}),e.jsx(c,{children:y.caste||"-"}),e.jsx(c,{children:y.highest_education||"-"}),e.jsx(c,{children:y.last_seen?Le(y.last_seen):"-"}),e.jsx(c,{children:Le(y.created_at)||"-"})]},y.zm_id)}))})]}),(!v||((V=(J=v==null?void 0:v.data)==null?void 0:J.results)==null?void 0:V.length)==0)&&e.jsx("div",{className:"flex items-center justify-center py-3",children:e.jsx(S,{sx:{textAlign:"center"},children:"No users Found"})})]}),v&&e.jsx(Bn,{spacing:2,alignItems:"center",sx:{mt:2},children:e.jsx($i,{count:Math.ceil(v.data.count/10),page:a,onChange:(y,G)=>m(G),color:"primary"})})]})})})}const ni=({gender:t,hitsPerPage:s})=>e.jsx(Fi,{hitsPerPage:s||10,filters:`gender=${t=="Male"?"Female":"Male"}`}),Zt=[{key:"age",label:"Age"},{key:"height",label:"Height",format:Qr},{key:"annual_income",label:"Annual Income",suffix:"Lakhs"}],In=["country","state","city"],Jr=[{key:"marital_status",label:"Marital Status"},{key:"religion",label:"Religion"},{key:"caste",label:"Caste"},{key:"subcaste",label:"Subcaste"},{key:"mother_tongue",label:"Mother Tongue"},{key:"education",label:"Education"},{key:"occupation",label:"Occupation"},{key:"employed_in",label:"Employed In"},{key:"eating_habits",label:"Eating Habits"},{key:"drinking_habits",label:"Drinking Habits"},{key:"smoking_habit",label:"Smoking Habit"},{key:"star",label:"Star"},{key:"dosham",label:"Dosham"},{key:"disability",label:"Disability"},{key:"citizenship",label:"Citizenship"},{key:"single_parent",label:"Single Parent"},{key:"children_living_status",label:"Partner's Children"}];function Qr(t){const s=t.toString().split(".");return s.length===1?`${s[0]}'0"`:s[1].charAt(0)==="0"?`${s[0]}'${s[1].charAt(1)}"`:`${s[0]}'${s[1]}"`}function zt(t,s){return t[s]}function cs(t,s){return zt(t,`${s}_compulsory`)===!0}function ii(t){return t==null?"":Array.isArray(t)?t.map(s=>
1String(s).trim()).filter(Boolean).join(", "):typeof t=="boolean"?t?"Yes":"No":String(t).trim()}function Xt(t,s){const i=zt(t,`from_${s.key}`),r=zt(t,`to_${s.key}`);if(typeof i!="number"||typeof r!="number")return null;const p=s.format||(a=>String(a)),x=s.suffix?` ${s.suffix}`:"";return{label:s.label,value:`${p(i)}–${p(r)}${x}`,is_compulsory:cs(t,s.key)}}function ed(t){const s=In.map(i=>ii(zt(t,i))).filter(Boolean);return s.length?{label:"Location",value:s.join(", "),is_compulsory:In.some(i=>cs(t,i))}:null}function td(t){if(!t)return[];const s=[];return s.push(Xt(t,Zt[0])),s.push(Xt(t,Zt[1])),Jr.forEach(i=>{const r=ii(zt(t,i.key));r&&s.push({label:i.label,value:r,is_compulsory:cs(t,i.key)})}),s.push(ed(t)),s.push(Xt(t,Zt[2])),s.filter(i=>!!i)}const Jt=3;function li({preferences:t,is_loading:s,candidate_id:i}){const[r,p]=h.useState(!1),x=h.useMemo(()=>i==null?[]:td(t==null?void 0:t[String(i)]),[t,i]);if(s&&!x.length)return e.jsx(hr,{variant:"rounded",width:180,height:24});if(!x.length)return e.jsx(e.Fragment,{children:"-"});const a=x.length>Jt,m=r||!a?x:x.slice(0,Jt);return e.jsxs("span",{className:"inline-block min-w-[220px] max-w-[320px] align-top text-xs",style:{whiteSpace:"normal"},children:[m.map((n,f)=>e.jsxs("span",{children:[e.jsxs("span",{className:"text-gray-500",children:[n.label,": "]}),e.jsx("span",{className:"font-medium",children:n.value}),n.is_compulsory&&e.jsx("span",{className:"font-semibold text-primary",children:" (Compulsory)"}),f<m.length-1?", ":""]},n.label)),a&&e.jsx("button",{type:"button",onClick:n=>{n.stopPropagation(),p(f=>!f)},className:"ml-1 whitespace-nowrap font-semibold text-primary underline",children:r?"Show less":`+${x.length-Jt} more`})]})}function ri({users:t,setAdminMailVisible:s,setSelectedIds:i,toggleFilters:r,id:p,base_zm_id:x,CustomRefinement:a}){const[m,n]=h.useState(void 0),{data:f}=Ht(m,p),{mutateAsync:v}=Tt();h.useEffect(()=>{if(t&&(t==null?void 0:t.length)>0){const _=t.map(j=>j.id).join(",");n(_)}},[t]);const[W,l]=h.useState({}),[N,C]=h.useState([]),F=_=>{C(j=>j.includes(_)?j.filter(R=>R!==_):[...j,_])},A=h.useMemo(()=>t||[],[t]),{data:T,isFetching:M}=Wt(x,A.map(_=>_.id)),{data:B,isFetching:D}=Hn(x,A.map(_=>_.id)),I=h.useMemo(()=>A.length>0&&A.every(_=>N.includes(_.zm_id)),[A,N]),$=h.useMemo(()=>A.length>0&&A.some(_=>N.includes(_.zm_id))&&!I,[A,N,I]),E=()=>{C(I?[]:A.map(_=>_.zm_id))};return h.useEffect(()=>{if(f!=null&&f.data){const _={};Object.entries(f.data).forEach(([j,R])=>{_[j]=(R==null?void 0:R.meeting_status)??""}),l(_)}},[f]),e.jsx(e.Fragment,{children:f&&e.jsxs(b,{sx:{margin:"0 auto",width:"100%"},children:[e.jsxs("div",{className:"mb-2 flex items-center justify-start gap-2",children:[e.jsx(S,{variant:"h6",children:"Actions:"}),e.jsx(q,{disabled:N.length==0,onClick:()=>{s(),i(N)},sx:{ml:1},children:"Send Profiles"}),e.jsx(q,{variant:"contained",color:"primary",size:"medium",type:"button",onClick:()=>{r()},children:"Edit Filters"})]}),e.jsx("div",{className:"my-3",children:a}),e.jsx(b,{children:e.jsxs(_t,{component:Be,children:[e.jsxs(wt,{sx:{overflowX:"scroll"},"aria-label":"suggested profiles table",children:[e.jsx(St,{children:e.jsxs(De,{sx:{backgroundColor:"#f5f5f5"},children:[e.jsx(c,{padding:"checkbox",children:e.jsx(Ie,{indeterminate:$,checked:I,onChange:E})}),e.jsx(c,{sx:{fontWeight:"bold",wordBreak:"break-word"},children:"Profile"}),e.jsx(c,{sx:{fontWeight:"bold"},children:e.jsx(Lt,{matches:T==null?void 0:T.data})}),e.jsx(c,{sx:{fontWeight:"bold"},children:"Member's Preference"}),e.jsx(c,{sx:{fontWeight:"bold"},children:"Proposal Status"}),e.jsx(c,{sx:{fontWeight:"bold"},children:"Profile Shared Status"}),e.jsx(c,{sx:{fontWeight:"bold"},children:"Marital Status With Children Status"}),e.jsx(c,{sx:{fontWeight:"bold"},children:"Ready to Accept Kids"}),e.jsx(c,{sx:{fontWeight:"bold"},children:"Annual Income"}),e.jsx(c,{sx:{fontWeight:"bold"},children:"Family Status"}),e.jsx(c,{sx:{fontWeight:"bold"},children:"City"}),e.jsx(c,{sx:{fontWeight:"bold"},children:"Education"}),e.jsx(c,{sx:{fontWeight:"bold"},children:"Caste"}),e.jsx(c,{sx:{fontWeight:"bold"},children:"Last seen"}),e.jsx(c,{sx:{fontWeight:"bold"},children:"Created At"})]})}),e.jsx(Ct,{children:t&&t.length>0&&(t==null?void 0:t.map(_=>{var j,R,H,J,V,y,G,k,L,O,K,te,ve,o,Y,X,fe,Ce,_e,oe,be,ce;return e.jsxs(De,{onClick:()=>window.open(`${window.location.origin}/user/${_.zm_id}`),sx:{"&:last-child td, &:last-child th":{border:0},"&:hover":{backgroundColor:"whitesmoke",cursor:"pointer"}},children:[e.jsx(c,{padding:"checkbox",onClick:ie=>ie.stopPropagation(),children:e.jsx(Ie,{checked:N.includes(_.zm_id),onChange:()=>F(_.zm_id)})}),e.jsx(c,{component:"th",scope:"row",children:e.jsx(Rt,{zm_id:_.zm_id,name:_.n
1ame,age:_.age,imageUrl:(R=(j=_==null?void 0:_.images)==null?void 0:j.find(ie=>ie.is_primary))==null?void 0:R.thumb_image_url,badge:os(_)?e.jsx("div",{className:"absolute -right-2 -top-3",children:e.jsx(ds,{})}):null})}),e.jsx(c,{children:e.jsx(Et,{matches:T==null?void 0:T.data,is_loading:M,candidate_id:_.id,candidate_zm_id:_.zm_id,candidate_name:_.name})}),e.jsx(c,{children:e.jsx(li,{preferences:B==null?void 0:B.data,is_loading:D,candidate_id:_.id})}),e.jsx(c,{children:e.jsxs(pe,{renderValue:ie=>ie?ie.charAt(0).toUpperCase()+ie.slice(1).replace(/_/g," "):e.jsx("em",{children:"Select Proposal Status"}),displayEmpty:!0,value:W[_.id]||"",onClick:ie=>ie.stopPropagation(),onMouseDown:ie=>ie.stopPropagation(),onChange:async ie=>{var ke,ee,ae,le;const we=ie.target.value;l(Ne=>({...Ne,[_.id]:we})),(ke=f.data)!=null&&ke[_.id]||v({user_id:p,connected_user_id:_.id,meeting_status:we,type:"post"}),(ee=f.data)!=null&&ee[_.id]&&v({connection_id:(le=(ae=f.data)==null?void 0:ae[_.id])==null?void 0:le.id,meeting_status:we,type:"patch"})},children:[e.jsx(w,{value:"",disabled:!0,children:e.jsx("em",{children:"Select Proposal Status"})}),e.jsx(w,{value:"attempted_to_contact",children:"Attempted To Contact"}),e.jsx(w,{value:"under_consideration",children:"Under consideration"}),e.jsx(w,{value:"accepted",children:"Accepted"}),e.jsx(w,{value:"rejected",children:"Rejected"}),e.jsx(w,{value:"meeting_scheduled",children:"Meeting scheduled"}),e.jsx(w,{value:"under_process",children:"Under process"}),e.jsx(w,{value:"meeting_held",children:"Meeting held"}),e.jsx(w,{value:"dropped",children:"Dropped"}),e.jsx(w,{value:"marriage_finalised",children:"Marriage Finalised"})]})}),e.jsx(c,{children:(J=(H=f.data)==null?void 0:H[_.id])!=null&&J.user_shared&&((y=(V=f.data)==null?void 0:V[_.id])!=null&&y.connected_user_shared)?"Both Shared with Each other":(k=(G=f.data)==null?void 0:G[_.id])!=null&&k.user_shared?`${(K=(O=(L=f==null?void 0:f.data)==null?void 0:L[_.id])==null?void 0:O.user)==null?void 0:K.name} Profile Shared with ${(o=(ve=(te=f==null?void 0:f.data)==null?void 0:te[_.id])==null?void 0:ve.connected_user)==null?void 0:o.name}`:(X=(Y=f.data)==null?void 0:Y[_.id])!=null&&X.connected_user_shared?`${(_e=(Ce=(fe=f==null?void 0:f.data)==null?void 0:fe[_.id])==null?void 0:Ce.connected_user)==null?void 0:_e.name} Profile Shared with ${(ce=(be=(oe=f==null?void 0:f.data)==null?void 0:oe[_.id])==null?void 0:be.user)==null?void 0:ce.name}`:"Not Shared"}),e.jsxs(c,{children:[_.marital_status," ",_.no_of_children?`, ${_.no_of_children&&_.no_of_children} ${_.no_of_children&&_.no_of_children==="1"?"child":"children"} ${_.children_living_status&&`(${_.children_living_status})`}`:""]}),e.jsx(c,{children:jt(_==null?void 0:_.accept_matches_with_kids)}),e.jsx(c,{children:_.annual_income||"-"}),e.jsx(c,{children:_.family_status||"-"}),e.jsx(c,{children:_.city||"-"}),e.jsx(c,{children:_.highest_education||"-"}),e.jsx(c,{children:_.caste||"-"}),e.jsx(c,{children:Le(_.last_seen)||"-"}),e.jsx(c,{children:Le(_.created_at||"")})]},_.id)}))})]}),(!t||(t==null?void 0:t.length)==0)&&e.jsx("div",{className:"flex items-center justify-center py-3",children:e.jsx(S,{sx:{textAlign:"center"},children:"No users Found"})})]})})]})})}
1const sd={linkedin_status:"Linkedin verified",aadhaar_status:"Aadhaar verified",is_work_email_verified:"Work email verified",is_profile_pic_updated:"Profile with photo only",is_valid_phone:"Phone verified",mother_tongue:"Mother Tongue",profile:"Profile for",annual_income:"Annual Income",highest_education:"Highest Education",employed_in:"Employment Type",marital_status:"Marital Status",income_level:"Annual Income",single_parent:"Single Parent",verified:"Verified Status"},ad=({refinement:t})=>{const{operator:s,value:i}=t;return s==="<="?`to ${i}`:`from ${i}`},Mn=()=>{const{clearFilter:t,filter_string:s}=h.useContext(tt),i=Xn();return!i.canRefine&&s===""?null:e.jsx("div",{className:"mx-1 flex items-center whitespace-nowrap rounded-lg px-3 py-1",children:e.jsx(q,{variant:"text",color:"primary",size:"small",type:"button",onClick:()=>{t(),i.refine()},children:"Clear all"})})},Pn=({item:t,refine:s})=>{const i=sd[t.label]||t.label;if(t.label==="verified"){const r=["pan","aadhaar","driving_licence"],p=t.refinements.filter(a=>r.includes(a.label)),x=t.refinements.filter(a=>!r.includes(a.label));return e.jsxs(e.Fragment,{children:[p.length>0&&e.jsxs("div",{className:"mx-1 flex items-center whitespace-nowrap rounded-3xl border-2 border-[#e2e2e2] bg-white px-3 py-1",children:[e.jsx("span",{className:"mr-2 text-sm capitalize text-gray-700",children:"Govt. Id Verified"}),e.jsx("button",{type:"button",className:"ml-1 inline-flex items-center rounded-full bg-white px-1 py-1 text-sm text-gray-500 hover:text-gray-700 focus:outline-none",onClick:()=>{p.forEach(a=>s(a))},children:e.jsx("svg",{className:"h-4 w-4",fill:"currentColor",viewBox:"0 0 20 20",children:e.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})})]}),x.map(a=>e.jsxs("div",{className:"mx-1 flex items-center whitespace-nowrap rounded-3xl border-2 border-[#e2e2e2] bg-white px-3 py-1",children:[e.jsxs("span",{className:"mr-2 text-sm capitalize text-gray-700",children:[a.label," verified"]}),e.jsx("button",{type:"button",className:"ml-1 inline-flex items-center rounded-full bg-white px-1 py-1 text-sm text-gray-500 hover:text-gray-700 focus:outline-none",onClick:()=>s(a),children:e.jsx("svg",{className:"h-4 w-4",fill:"currentColor",viewBox:"0 0 20 20",children:e.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})})]},a.label))]})}return t.label=="single_parent"||t.label=="eating_habits"?t==null?void 0:t.refinements.map(r=>e.jsxs("div",{className:"mx-1 flex items-center whitespace-nowrap rounded-3xl border-2 border-[#e2e2e2] bg-white px-3 py-1",children:[e.jsx("span",{className:"mr-2 text-sm capitalize text-gray-700",children:r.value}),e.jsx("button",{type:"button",className:"ml-1 inline-flex items-center rounded-full bg-white px-1 py-1 text-sm text-gray-500 hover:text-gray-700 focus:outline-none",onClick:()=>{s(r)},children:e.jsx("svg",{className:"h-4 w-4",fill:"currentColor",viewBox:"0 0 20 20",children:e.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})})]})):e.jsxs("div",{className:"mx-1 flex items-center whitespace-nowrap rounded-3xl border-2 border-[#e2e2e2] bg-white px-3 py-1",children:[e.jsx("span",{className:"mr-2 text-sm capitalize text-gray-700",children:i}),t.label==="age"||t.label==="income_level"?e.jsx(nd,{item:t,refine:s}):e.jsx(id,{item:t,refine:s})]})},nd=({item:t,refine:s})=>e.jsx("div",{className:"flex gap-1",children:t.refinements.map(i=>e.jsxs("span",{className:"inline-flex items-center rounded-full border border-gray-300 bg-white px-2 py-1 text-xs",children:[e.jsx("span",{className:"text-gray-700",children:e.jsx(ad,{refinement:i})}),e.jsx("button",{type:"button",className:"ml-1 text-gray-500 hover:text-gray-700 focus:outline-none",onClick:()=>
1s(i),children:e.jsx("svg",{className:"h-4 w-4",fill:"currentColor",viewBox:"0 0 20 20",children:e.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})})]},i.label))}),id=({item:t,refine:s})=>e.jsx("button",{type:"button",className:"ml-1 inline-flex items-center rounded-full bg-white px-1 py-1 text-sm text-gray-500 hover:text-gray-700 focus:outline-none",onClick:()=>t.refinements.forEach(s),children:e.jsx("svg",{className:"h-4 w-4",fill:"currentColor",viewBox:"0 0 20 20",children:e.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})}),ld=()=>{var i;const{removeFilter:t,custom_filter_dict:s}=h.useContext(tt);return s!=null&&s.created_date?e.jsxs("div",{className:"mx-1 flex items-center whitespace-nowrap rounded-3xl bg-white px-3 py-1",children:[e.jsxs("span",{className:"mr-2 text-sm capitalize text-gray-700",children:["Date Filter: ",(i=s==null?void 0:s.created_date)==null?void 0:i.label]}),e.jsx("button",{type:"button",className:"ml-1 inline-flex items-center rounded-full bg-white px-1 py-1 text-sm text-gray-500 hover:text-gray-700 focus:outline-none",onClick:()=>t("created_date"),children:e.jsx("svg",{className:"h-4 w-4",fill:"currentColor",viewBox:"0 0 20 20",children:e.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})})]}):null},zn=()=>{var i;const{removeFilter:t,custom_filter_dict:s}=h.useContext(tt);return s!=null&&s.spotlight?e.jsxs("div",{className:"mx-1 flex items-center whitespace-nowrap rounded-3xl bg-white px-3 py-1",children:[e.jsx("span",{className:"mr-2 text-sm capitalize text-gray-700",children:(i=s==null?void 0:s.spotlight)==null?void 0:i.label}),e.jsx("button",{type:"button",className:"ml-1 inline-flex items-center rounded-full bg-white px-1 py-1 text-sm text-gray-500 hover:text-gray-700 focus:outline-none",onClick:()=>t("spotlight"),children:e.jsx("svg",{className:"h-4 w-4",fill:"currentColor",viewBox:"0 0 20 20",children:e.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})})]}):null},rd=()=>{const{filter_string:t}=h.useContext(tt),{items:s,refine:i}=Gt();return(s==null?void 0:s.length)===0&&(t===""||t==="gender=Male"||t==="gender=Female")?null:e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"hidden max-w-full overflow-x-auto md:block",children:e.jsxs("div",{className:"flex flex-nowrap items-start justify-between",children:[e.jsxs("div",{className:"flex flex-nowrap gap-2 overflow-x-auto lg:flex-wrap",children:[e.jsx(ld,{}),e.jsx(zn,{}),s.map((r,p)=>e.jsx(Pn,{item:{...r,refinements:r.refinements.map(x=>({...x,value:String(x.value),operator:x.operator||""}))},refine:x=>{"attribute"in x&&"type"in x&&i(x)}},p))]}),e.jsx("div",{className:"hidden lg:flex",children:e.jsx(Mn,{})})]})}),e.jsx("div",{className:"-ml-2 -mt-4 mb-5 block max-w-full overflow-x-auto md:hidden",children:e.jsxs("div",{className:"flex flex-nowrap items-start justify-between",children:[e.jsxs("div",{className:"flex flex-nowrap gap-2 overflow-x-auto lg:flex-wrap",children:[e.jsx(zn,{}),s.filter(r=>r.attribute==="age").map((r,p)=>e.jsx(Pn,{item:{...r,refinements:r.refinements.map(x=>({...x,value:String(x.value),operator:x.operator||""}))},refine:x=>{"attribute"in x&&"type"in x&&i(x)}},p))]}),e.jsx("div",{className:"hidden lg:block",children:e.jsx(Mn,{})})]})})]})},dd=({id:t,zm_id:s,toggleFilters:i,setAdminMailVisible:r,setSelectedIds:p,age:x})=>{const{items:a}=Gn(),{refresh:m,setUiState:n,status:f}=Yn(),v=Vt(A=>A.user),{handleRefetchFunction:W}=qn(),{data:l,isSuccess:N}=Oi({refetchOnWindowFocus:!1,enabled:!0},s);function C(A){var B,D,I,$,E,_;let T;A!=null&&A.from_age&&(A!=null&&A.to_age)&&(T={range:{age:`${A.from_age}:${A.to_age}`,income_level:Bi(l==null?void 0:l.data.data.from_annual_income,l==null?void 0:l.data.data.to_annual_income)}});const M={[`${gt.MEILISEARCH_INDEX}:release_timestamp:desc`]:{...T,refinementList:{state:l!=null&&l.data.data.state?(D=(B=l==null?void 0:l.data)==null?void 0:B.data)==null?void 0:D.state:[],religion:($=(I=l==null?void 0:l.data)==null?void 0:I.data)!=null&&$.religion?[(_=(E=l==null?void 0:l.data)==null?void 0:E.data)==null?void 0:_.religion]:[],height:Di(l==null?void 0:l.data.data.from_height,l==null?void 0:l.data.data.to_height),mother_tongue:l!=null&&l.data.data.mother_tongue?l==null?void 0:l.data.data.mother_tongue:[],city:l!=null&&l.data.data.city?l.data.data.city:[],country:l!=null&&l.data.data.country?l.data.data.country:[],highest_education:l!=null&&l.data.data.education?l.data.data.education:[],caste:l!=null&&l.data.data.caste?l.data.data.caste:[],star:l!=null&&l.data.data.star?l.data.data.star:[],eating_habits:l!=null&&l.data.data.eating_habits?l==null?void 0:l.data.data.eating_habits:[],smoking_habits:l!=null&&l.data.data.smoking_habit?l==null?void 0:l.data.data.smoking_habit:[]},menu:{single_parent:l!=null&&l.data.data.single_parent?l.data.data.single_parent[0]:"",disability:l!=null&&l.data.data.disability?l.data.data.disability:""}}};return n(M),!0}h.useEffect(()=>{var T,M,B,D;const A={from_age:(M=(T=l==null?void 0:l.data)==null?void 0:T.data)==null?void 0:M.from_age,to_age:(D=(B=l==null?void 0:l.data)==null?void 0:B.data)==null?void 0:D.to_age};
1if(!A.to_age||!A.from_age){const I=Vi(x);A.from_age=I==null?void 0:I.min,A.to_age=I==null?void 0:I.max}C(A)},[l,n,N,v]),h.useEffect(()=>{W(()=>m)},[W,m]),Kn(m);const F=h.useMemo(()=>f==="stalled"||f==="loading",[f]);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mt-4 max-w-full px-0 lg:px-2",children:F&&!(a!=null&&a.length)?e.jsx("div",{className:"flex w-full items-center justify-center",children:e.jsx(Re,{})}):e.jsxs(e.Fragment,{children:[(f==="stalled"||f==="loading")&&e.jsx("div",{className:"flex w-full items-center justify-center",children:e.jsx(Re,{})}),e.jsx(ri,{CustomRefinement:e.jsx(rd,{}),toggleFilters:i,title:"Matches based on your partner preferences",users:a,default_grid_cols:3,empty_info:{message:"It seems that the filters currently set don’t match any profiles.Please modify or reset your filters to find suitable matches."},setAdminMailVisible:r,setSelectedIds:p,id:t,base_zm_id:s})]})}),e.jsx(Zn,{scroll:!1})]})};h.createContext({isPending:!1,sort:void 0,defaultSort:void 0});function od({display_label:t,...s}){const{items:i,refine:r}=tl(s),{value:p}=i.find(a=>a.isRefined)||{value:""},x=i.reduce((a,m)=>a+m.count,0);return e.jsxs(Te,{fullWidth:!0,children:[e.jsx("label",{className:"mb-2 inline-block text-base font-light",children:t}),e.jsxs(pe,{size:"small",id:"create_profile_for_id",displayEmpty:!0,value:p,onChange:a=>{r(a.target.value)},children:[e.jsxs(w,{value:"",children:["All (",x,")"]}),i.map((a,m)=>{var n;return e.jsxs(w,{className:"capitalize",value:a.value,children:[(n=a.label)==null?void 0:n.replace(/_/g," ")," (",a.count,")"]},`${m+a.label}`)})]})]})}function xt({multiple:t,...s}){return t?e.jsx(It,{...s}):e.jsx(od,{...s})}function dt({display_label:t,...s}){const{items:i,refine:r,searchForItems:p,canToggleShowMore:x,isShowingMore:a,toggleShowMore:m}=Yi(s);return e.jsxs(e.Fragment,{children:[e.jsx("label",{className:"mb-2 inline-block text-base font-light",children:t}),e.jsx(ge,{fullWidth:!0,type:"text",placeholder:"Search",autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1,slotProps:{htmlInput:{maxLength:512},input:{startAdornment:e.jsx(Fn,{color:"info",fontSize:"small"})}},onChange:n=>p(n.currentTarget.value)}),e.jsx("ul",{className:"mt-2",children:i.map(n=>e.jsx("li",{className:"text-sm",children:e.jsxs("label",{className:"inline-flex cursor-pointer items-center",children:[e.jsx(Ie,{size:"small",checked:n.isRefined,onChange:()=>r(n.value),inputProps:{"aria-label":"controlled"}}),e.jsxs("span",{children:[e.jsx("span",{children:n.label}),e.jsxs("span",{children:[" (",n.count,")"]})]})]})},n.label))}),e.jsx(q,{variant:"text",onClick:m,disabled:!x,children:a?"- Show less":"+ Show more"})]})}const Wn=1;function ns({display_label:t,...s}){const{value:i,refine:r}=qi(s);return e.jsxs("label",{className:"inline-flex w-full justify-between",children:[e.jsx("span",{children:t}),e.jsx(Ki,{checked:i.isRefined,onChange:p=>{r({isRefined:!p.target.checked})}})]})}const ot=t=>t.map(s=>({...s,label:` ${s.label} `})),ct=({children:t})=>e.jsx("div",{className:"grid grid-cols-2 gap-4 space-y-2",children:t});function di(t){const{valueLabelFormat:s,attribute:i}=t,{start:r,range:p,canRefine:x,refine:a}=Zi(t),[m,n]=Xi.useState(null),f=h.useCallback(Ji.debounce(W=>{a(W)},500),[a]),v=(W,l,N)=>{if(!Array.isArray(l))return;let C=[0,1];!Array.isArray(m)||!(m!=null&&m[0])||!(m!=null&&m[1])?(n(l),C=l):(N===0?C=[Math.min(l[0],m[1]-Wn),m[1]]:C=[m[0],Math.max(l[1],m[0]+Wn)],n(C)),f(C)};return e.jsx("div",{className:"px-5 pt-10",children:e.jsx(Qi,{disabled:!x,valueLabelFormat:W=>i==="age"?`${W} ${s}`:`${W}${s}`,value:m||r,onChange:v,valueLabelDisplay:"on",min:p.min||18,max:p.max||100,disableSwap:!0})})}function cd({type:t}){const{items:s}=Gt(),i=t==="crm",r=h.useMemo(()=>{var x;const p=s.find(a=>a.attribute==="single_parent");return!!((x=p==null?void 0:p.refinements)!=null&&x.some(a=>typeof a.value=="string"&&a.value.toLowerCase().includes("with children")))},[s]);return e.jsxs(ct,{children:[e.jsxs("div",{className:"col-span-2",children:[e.jsx("h1",{className:"text-base font-light",children:"Select Age"}),e.jsx(di,{attribute:"age",valueLabelFormat:"yrs"})]}),e.jsx("div",{className:"col-span-2",children:e.jsx(It,{display_label:"Height",attribute:"height",limit:100})}),e.jsx("div",{className:"col-span-2",children:e.jsx(It,{attribute:"mother_tongue",limit:100,display_label:"Mother Tongues"})}),e.jsx("div",{className:"col-span-2",children:e.jsx(It,{display_label:"Profile Created For",attribute:"profile"})}),e.jsx("div",{className:"col-span-2",children:e.jsx(It,{display_label:"Marital Status",attribute:"marital_status"})}),e.jsx("div",{className:"col-span-2",children:e.jsx(xt,{display_label:"Parenting status",attribute:"single_parent",multiple:i})}),i&&r&&e.jsx("div",{className:"col-span-2",children:e.jsx(xt,{display_label:"No of children",attribute:"no_of_children",multiple:i})}),e.jsx("div",{className:"col-span-2",children:e.jsx(xt,{display_label:"Physical Status",attribute:"disability",multiple:i})}),e.jsx("div",{className:"col-span-2",children:e.jsx(xt,{display_label:"Eating Habits",attribute:"eating_habits",multiple:i})}),i&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"col-span-2",children:e.jsx(xt,{display_label:"Smoking Habits",attribute:"smoking_habit",multiple:i})}),e.jsx("div",{className:"col-span-2",children:e.jsx(xt,{display_label:"Drinking Habits",attribute:"drinking_habits",multiple:i})})]})]})}function hd({type:t}){return e.jsxs(ct,{children:[e.jsx("div",{className:"col-span-2 overflow-y-auto",children:e.jsx(dt,{display_label:"Religion",transformItems:ot,limit:5,showMore:!0,attribute:"religion"})}),e.jsx("div",{className:"col-span-2 overflow-y-auto",children:e.jsx(dt,{display_label:"Caste",transformItems:ot,limit:5,showMore:!0,attribute:"caste"})}),e.jsx("div",{className:"col-span-2",children:e.jsx(dt,{display_label:"Star",transformItems:ot,escapeFacetValues:!0,limit:5,showMore:!0,attribute:"star"})}),e.jsx("div",{className:"col-span-2",children:e.jsx(xt,{display_label:"Dosha(m)",attribute:"dosham",multiple:t==="crm"})})]})}function ud(){return e.jsxs(ct,{children:[e.jsxs("div",{className:"col-span-2",children:[e.jsx("h1",{className:"text-base font-light",children:"Annual Income In Lakhs"}),e.jsx(di,{attribute:"income_level",valueLabelFormat:"L"})]}),e.jsx("div",{className:"col-span-2 overflow-y-auto pr-2",children:e.jsx(dt,{display_label:"Highest Education",limit:5,showMore:!0,transformItems:ot,attribute:"highest_education"})}),e.jsx("div",{className:"col-span-2",children:e.jsx(dt,{display_label:"Employment Type",transformItems:ot,attribute:"employed_in"})})]})}function xd(){return e.jsxs(ct,{children:[e.jsx("div",{className:"col-span-2 overflow-y-auto",children:e.jsx(dt,{display_label:"Country",transformItems:ot,limit:5,showMore:!0,attribute:"country"})}),e.jsx("div",{className:"col-span-2 overflow-y-auto pr-2",children:e.jsx(dt,{display_label:"State",transformItems:ot,limit:5,showMore:!0,attribute:"state"})}),e.jsx("div",{className:"col-span-2 overflow-y-auto pr-2",children:e.jsx(dt,{display_label:"City",transformItems:ot,limit:5,showMore:!0,attribute:"city"})})]})}function md(){return e.jsx(ct,{children:e.jsx("div",{className:"col-span-2 px-1",children:e.jsx(ns,{attribute:"is_profile_pic_updated",display_label:"Profiles with photos only"})})})}function gd(){return e.jsxs(ct,{children:[e.jsx("div",{className:"col-span-2 px-1",children:e.jsx(ns,{attribute:"linkedin_
1status",display_label:"Linkedin Verified",on:"approved"})}),e.jsx("div",{className:"col-span-2 px-1",children:e.jsx(ns,{attribute:"aadhaar_status",display_label:"Aadhaar Verified",on:"approved"})})]})}function pd(){var r,p;const{handleFilterChange:t,custom_filter_dict:s,handleSpotlightChange:i}=h.useContext(tt);return e.jsxs(ct,{children:[e.jsx("div",{className:"col-span-2",children:e.jsxs(Te,{fullWidth:!0,children:[e.jsx("label",{className:"mb-2 inline-block text-base font-light",children:"Registration Period"}),e.jsxs(pe,{size:"small",id:"create_profile_for_id",displayEmpty:!0,value:((r=s==null?void 0:s.created_date)==null?void 0:r.selectedValue)||"",onChange:x=>{t(x.target.value)},children:[e.jsx(w,{value:"",children:"All"}),e.jsx(w,{value:"3",children:"Last 3 Days"}),e.jsx(w,{value:"7",children:"Last 7 Days"}),e.jsx(w,{value:"30",children:"Last 30 Days"})]})]})}),Ui()===Hi.SECOND_MARRIAGE&&e.jsx("div",{className:"col-span-2",children:e.jsxs(Te,{fullWidth:!0,children:[e.jsx("label",{className:"mb-2 inline-block text-base font-light",children:"Profile Type"}),e.jsxs(pe,{size:"small",id:"create_profile_for_id",displayEmpty:!0,value:((p=s==null?void 0:s.spotlight)==null?void 0:p.selectedValue)||"",onChange:x=>{i(!!x.target.value)},children:[e.jsx(w,{value:"",children:"All"}),e.jsx(w,{value:"true",children:"Spotlight Only"})]})]})})]})}const jd=({option:t,isSelected:s,onClick:i})=>e.jsxs("button",{type:"button",onClick:i,className:"transition- w-full text-left",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("label",{className:"font-medium",children:t.label}),e.jsx(el,{size:"small",checked:s,value:t.value,name:"radio-buttons",inputProps:{"aria-label":"A"}})]}),t.description&&e.jsx("p",{className:"text-sm text-gray-600",children:t.description})]});function fd(t){const{currentRefinement:s,options:i,refine:r}=Gi(t);return e.jsx("div",{className:"space-y-3",children:i.map(p=>e.jsx(jd,{option:p,isSelected:s===p.value,onClick:()=>r(p.value)},p.value))})}const bd=new Set(["age","height","mother_tongue","profile","marital_status","disability","eating_habits","smoking_habit","drinking_habits"]),yd=new Set(["is_profile_pic_updated","height","mother_tongue","profile","marital_status","disability"]),vd=new Set(["religion","caste","star","dosham"]),_d=new Set(["annual_income","highest_education","employed_in"]),wd=new Set(["country","state","city"]),Sd=({title:t,editMode:s,isOpen:i=!1,filter_count:r})=>{const[p,x]=h.useState(i);return e.jsxs("div",{className:"mt-3 w-full pb-3",children:[e.jsxs("button",{onClick:()=>x(!p),className:"flex w-full justify-between py-3",children:[e.jsxs("h2",{className:"inline-flex items-center justify-center",children:[t,r&&r>0?e.jsx("span",{className:"ml-3 inline-flex h-5 w-5 items-center justify-center rounded-full bg-primary text-sm text-white",children:r}):""]}),p?e.jsx(sl,{fontSize:"medium"}):e.jsx(al,{fontSize:"medium"})]}),e.jsx("div",{className:`${p?"":"h-0 overflow-hidden"} `,children:s})]})},Cd=({editMode:t})=>e.jsx("div",{className:"mt-5 w-full",children:t}),kd=[{title:"Basic Details",Component:cd},{title:"Religious Details",Component:hd},{title:"Professional Details",Component:ud},{title:"Location Details",Component:xd},{title:"Photo settings",Component:md},{title:"Verified settings",Component:gd},{title:"Filter by",Component:pd}],Nd=[{title:"Sort profiles on the basis of",Component:Ad}];function oi({hidden:t,onClose:s}){const[i,r]=h.useState("filter"),{items:p}=Gt(),x=h.useMemo(()=>{const a={basic:new Set,religion:new Set,professional:new Set,location:new Set,photo:new Set,filter_by_created_date:new Set};return!p||!Array.isArray(p)?{}:(p.forEach(m=>{bd.has(m.attribute)?a.basic.add(m.attribute):vd.has(m.attribute)?a.religion.add(m.attribute):_d.has(m.attribute)?a.professional.add(m.attribute):wd.has(m.attribute)?a.location.add(m.attribute):yd.has(m.attribute)&&a.photo.add(m.attribute)}),{"Basic Details":a.basic.size,"Location Details":a.location.size,"Religious Details":a.religion.size,"Professional Details":a.professional.size,"Photo settings":a.photo.size})},[p]);return e.jsxs("div",{className:`my-3 flex-col ${t?"hidden":"flex"} items-start rounded-2xl bg-white px-4 py-5`,children:[e.jsx("div",{className:"flex w-full justify-end",children:e.jsx(re,{onClick:s,children:e.jsx(Ut,{})})}),e.jsxs("div",{className:"flex w-full items-center justify-between",children:[e.jsx("button",{className:`border-b-2 text-lg ${i==="filter"?"border-primary font-medium":"border-transparent"}`,onClick:()=>r("filter"),children:"Filters"}),e.jsx("button",{className:`border-b-2 text-lg ${i==="sort"?"border-primary font-medium":"border-transparent"}`,onClick:()=>r("sort"),children:"Sort"})]}),e.jsx("div",{className:`${i==="filter"?"":"hidden"} child-border-b w-full`,children:kd.map(({title:a,Component:m})=>e.jsx(Sd,{title:a,editMode:e.jsx(m,{type:"crm"}),isOpen:a=="Basic Details",filter_count:x[a]},a))}),e.jsx("div",{className:`${i==="sort"?"":"hidden"} w-full`,children:Nd.map(({title:a,Component:m})=>e.jsx(Cd,{title:a,editMode:e.jsx(m,{})},a))})]})}function Ad(){const t=gt.MEILISEARCH_INDEX,s=[{value:`${t}:release_timestamp:desc`,label:"Recently Joined",description:"View the most recently created profiles first."},{value:`${t}:last_seen:desc`,label:"Recently Active",description:"Display members who have recently logged in."}];return e.jsx(ct,{children:e.jsx("div",{className:"col-span-2 flex w-full items-center justify-start gap-1",children:e.jsx(fd,{classNames:"w-full",items:s})})})}function ci({sidebar:t,children:s}){return e.jsxs("div",{className:"flex w-full",children:[t&&e.jsx("div",{className:"hidden lg:block fixed left-6 top-24 z-40 w-72 max-h-[calc(100vh-6rem)] overflow-y-auto rounded-2xl p-4",children:t}),e.jsx("div",{className:"mt-3 w-full overflow-scroll",children:s})]})}function Id({userId:t,id:s,setAdminMailVisible:i,setSelectedIds:r,gender:p,age:x}){const a=h.useMemo(()=>{const{searchClient:f}=Jn(gt.BACKEND_BASE_URL+`/v5/${t}/meilisearch_proxy/`,()=>localStorage.getItem(ti.ACCESS_TOKEN)||"");return f},[t]),[m,n]=h.useState(!1);return e.jsx(Qn,{children:e.jsxs(ei,{indexName:`${gt.MEILISEARCH_INDEX}:release_timestamp:desc`,searchClient:a,future:{preserveSharedStateOnUnmount:!0},children:[e.jsx(ni,{gender:p}),e.jsx(ci,{sidebar:e.jsx(oi,{onClose:()=>n(!1),hidden:!m}),children:e.jsx(dd,{age:x,setAdminMailVisible:i,setSelectedIds:r,toggleFilters:()=>n(!m),zm_id:t,id:s})})]})})}
1const Md={linkedin_status:"Linkedin verified",aadhaar_status:"Aadhaar verified",is_work_email_verified:"Work email verified",is_profile_pic_updated:"Profile with photo only",is_valid_phone:"Phone verified",mother_tongue:"Mother Tongue",profile:"Profile for",annual_income:"Annual Income",highest_education:"Highest Education",employed_in:"Employment Type",marital_status:"Marital Status",income_level:"Annual Income",single_parent:"Single Parent",verified:"Verified Status"},Pd=({refinement:t})=>{const{operator:s,value:i}=t;return s==="<="?`to ${i}`:`from ${i}`},Tn=()=>{const{clearFilter:t,filter_string:s}=h.useContext(tt),i=Xn();return!i.canRefine&&s===""?null:e.jsx("div",{className:"mx-1 flex items-center whitespace-nowrap rounded-lg px-3 py-1",children:e.jsx(q,{variant:"text",color:"primary",size:"small",type:"button",onClick:()=>{t(),i.refine()},children:"Clear all"})})},Ln=({item:t,refine:s})=>{const i=Md[t.label]||t.label;if(t.label==="verified"){const r=["pan","aadhaar","driving_licence"],p=t.refinements.filter(a=>r.includes(a.label)),x=t.refinements.filter(a=>!r.includes(a.label));return e.jsxs(e.Fragment,{children:[p.length>0&&e.jsxs("div",{className:"mx-1 flex items-center whitespace-nowrap rounded-3xl border-2 border-[#e2e2e2] bg-white px-3 py-1",children:[e.jsx("span",{className:"mr-2 text-sm capitalize text-gray-700",children:"Govt. Id Verified"}),e.jsx("button",{type:"button",className:"ml-1 inline-flex items-center rounded-full bg-white px-1 py-1 text-sm text-gray-500 hover:text-gray-700 focus:outline-none",onClick:()=>{p.forEach(a=>s(a))},children:e.jsx("svg",{className:"h-4 w-4",fill:"currentColor",viewBox:"0 0 20 20",children:e.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})})]}),x.map(a=>e.jsxs("div",{className:"mx-1 flex items-center whitespace-nowrap rounded-3xl border-2 border-[#e2e2e2] bg-white px-3 py-1",children:[e.jsxs("span",{className:"mr-2 text-sm capitalize text-gray-700",children:[a.label," verified"]}),e.jsx("button",{type:"button",className:"ml-1 inline-flex items-center rounded-full bg-white px-1 py-1 text-sm text-gray-500 hover:text-gray-700 focus:outline-none",onClick:()=>s(a),children:e.jsx("svg",{className:"h-4 w-4",fill:"currentColor",viewBox:"0 0 20 20",children:e.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})})]},a.label))]})}return t.label=="single_parent"||t.label=="eating_habits"?t==null?void 0:t.refinements.map(r=>e.jsxs("div",{className:"mx-1 flex items-center whitespace-nowrap rounded-3xl border-2 border-[#e2e2e2] bg-white px-3 py-1",children:[e.jsx("span",{className:"mr-2 text-sm capitalize text-gray-700",children:r.value}),e.jsx("button",{type:"button",className:"ml-1 inline-flex items-center rounded-full bg-white px-1 py-1 text-sm text-gray-500 hover:text-gray-700 focus:outline-none",onClick:()=>{s(r)},children:e.jsx("svg",{className:"h-4 w-4",fill:"currentColor",viewBox:"0 0 20 20",children:e.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})})]})):e.jsxs("div",{className:"mx-1 flex items-center whitespace-nowrap rounded-3xl border-2 border-[#e2e2e2] bg-white px-3 py-1",children:[e.jsx("span",{className:"mr-2 text-sm capitalize text-gray-700",children:i}),t.label==="age"||t.label==="income_level"?e.jsx(zd,{item:t,refine:s}):e.jsx(Wd,{item:t,refine:s})]})},zd=({item:t,refine:s})=>e.jsx("div",{className:"flex gap-1",children:t.refinements.map(i=>e.jsxs("span",{className:"inline-flex items-center rounded-full border border-gray-300 bg-white px-2 py-1 text-xs",children:[e.jsx("span",{className:"text-gray-700",children:e.jsx(Pd,{refinement:i})}),e.jsx("button",{type:"button",className:"ml-1 text-gray-500 hover:text-gray-700 focus:outline-none",onClick:()=>
1s(i),children:e.jsx("svg",{className:"h-4 w-4",fill:"currentColor",viewBox:"0 0 20 20",children:e.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})})]},i.label))}),Wd=({item:t,refine:s})=>e.jsx("button",{type:"button",className:"ml-1 inline-flex items-center rounded-full bg-white px-1 py-1 text-sm text-gray-500 hover:text-gray-700 focus:outline-none",onClick:()=>t.refinements.forEach(s),children:e.jsx("svg",{className:"h-4 w-4",fill:"currentColor",viewBox:"0 0 20 20",children:e.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})}),Td=()=>{var i;const{removeFilter:t,custom_filter_dict:s}=h.useContext(tt);return s!=null&&s.created_date?e.jsxs("div",{className:"mx-1 flex items-center whitespace-nowrap rounded-3xl bg-white px-3 py-1",children:[e.jsxs("span",{className:"mr-2 text-sm capitalize text-gray-700",children:["Date Filter: ",(i=s==null?void 0:s.created_date)==null?void 0:i.label]}),e.jsx("button",{type:"button",className:"ml-1 inline-flex items-center rounded-full bg-white px-1 py-1 text-sm text-gray-500 hover:text-gray-700 focus:outline-none",onClick:()=>t("created_date"),children:e.jsx("svg",{className:"h-4 w-4",fill:"currentColor",viewBox:"0 0 20 20",children:e.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})})]}):null},En=()=>{var i;const{removeFilter:t,custom_filter_dict:s}=h.useContext(tt);return s!=null&&s.spotlight?e.jsxs("div",{className:"mx-1 flex items-center whitespace-nowrap rounded-3xl bg-white px-3 py-1",children:[e.jsx("span",{className:"mr-2 text-sm capitalize text-gray-700",children:(i=s==null?void 0:s.spotlight)==null?void 0:i.label}),e.jsx("button",{type:"button",className:"ml-1 inline-flex items-center rounded-full bg-white px-1 py-1 text-sm text-gray-500 hover:text-gray-700 focus:outline-none",onClick:()=>t("spotlight"),children:e.jsx("svg",{className:"h-4 w-4",fill:"currentColor",viewBox:"0 0 20 20",children:e.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})})]}):null},Ld=()=>{const{filter_string:t}=h.useContext(tt),{items:s,refine:i}=Gt();return(s==null?void 0:s.length)===0&&(t===""||t==="gender=Male"||t==="gender=Female")?null:e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"hidden max-w-full overflow-x-auto md:block",children:e.jsxs("div",{className:"flex flex-nowrap items-start justify-between",children:[e.jsxs("div",{className:"flex flex-nowrap gap-2 overflow-x-auto lg:flex-wrap",children:[e.jsx(Td,{}),e.jsx(En,{}),s.map((r,p)=>e.jsx(Ln,{item:{...r,refinements:r.refinements.map(x=>({...x,value:String(x.value),operator:x.operator||""}))},refine:x=>{"attribute"in x&&"type"in x&&i(x)}},p))]}),e.jsx("div",{className:"hidden lg:flex",children:e.jsx(Tn,{})})]})}),e.jsx("div",{className:"-ml-2 -mt-4 mb-5 block max-w-full overflow-x-auto md:hidden",children:e.jsxs("div",{className:"flex flex-nowrap items-start justify-between",children:[e.jsxs("div",{className:"flex flex-nowrap gap-2 overflow-x-auto lg:flex-wrap",children:[e.jsx(En,{}),s.filter(r=>r.attribute==="age").map((r,p)=>e.jsx(Ln,{item:{...r,refinements:r.refinements.map(x=>({...x,value:String(x.value),operator:x.operator||""}))},refine:x=>{"attribute"in x&&"type"in x&&i(x)}},p))]}),e.jsx("div",{className:"hidden lg:block",children:e.jsx(Tn,{})})]})})]})},Ed=({id:t,zm_id:s,toggleFilters:i,setAdminMailVisible:r,setSelectedIds:p})=>{const{items:x}=Gn(),{refresh:a,status:m}=Yn(),{handleRefetchFunction:n}=qn();h.useEffect(()=>{n(()=>a)},[n,a]),Kn(a);const f=h.useMemo(()=>m==="stalled"||m==="loading",[m]);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mt-4 px-0 lg:px-2",children:f&&!(x!=null&&x.length)?e.jsx("div",{className:"flex w-full items-center justify-center",children:e.jsx(Re,{})}):e.jsxs(e.Fragment,{children:[(m==="stalled"||m==="loading")&&e.jsx("div",{className:"flex w-full items-center justify-center",children:e.jsx(Re,{})}),e.jsx(ri,{CustomRefinement:e.jsx(Ld,{}),toggleFilters:i,title:"Matches based on your partner preferences",users:x,default_grid_cols:3,empty_info:{message:"It seems that the filters currently set don’t match any profiles.Please modify or reset your filters to find suitable matches."},setAdminMailVisible:r,setSelectedIds:p,id:t,base_zm_id:s})]})}),e.jsx(Zn,{scroll:!1})]})};function Rd({defaultQuery:t,isLoadingDefault:s}){const{refine:i}=Dr(),[r,p]=h.useState(""),x=h.useRef(!1);h.useEffect(()=>{t&&!x.current&&(i(t),p(t),x.current=!0)},[t,i]);const a=()=>{const n=r.trim()?r.trim():t;i(n)},m=()=>{p(t),i(t)};return e.jsxs("div",{className:"mb-4 rounded-xl border border-blue-200 bg-blue-50 p-4 shadow-sm",children:[e.jsx("textarea",{id:"crm-ai-search-query-textarea",value:r,onChange:n=>p(n.target.value),rows:3,placeholder:s?"Loading default query…":"AI search query…",className:"w-full resize-y rounded-lg border border-blue-300 bg-white p-2 text-sm text-gray-800 shadow-inner focus:outline-none focus:ring-2 focus:ring-blue-400"}),e.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[e.jsx("button",{id:"crm-ai-query-apply-btn",type:"button",onClick:a,className:"rounded-lg bg-blue-600 px-4 py-1.5 text-sm font-medium text-white hover:bg-blue-700",children:"Search"}),e.jsx("button",{id:"crm-ai-query-reset-btn",type:"button",onClick:m,disabled:s||!t,className:"rounded-lg border border-gray-300 bg-white px-4 py-1.5 text-sm font-medium text-gray-600 hover:bg-gray-50 disabled:opacity-50",children:"Reset to Default"})]})]})}function $d({userId:t,id:s,setAdminMailVisible:i,setSelectedIds:r,age:p,gender:x}){var F;const a=h.useMemo(()=>{const{searchClient:A}=Jn(gt.BACKEND_BASE_URL+`/v5/meilisearch_proxy/ai-matches/${t}/`,()=>localStorage.getItem(ti.ACCESS_TOKEN)||"",{meiliSearchParams:{hybrid:{embedder:gt.EMBEDDER_NAME,semanticRatio:.5}}});return A},[t]),{data:m,isLoading:n}=nl(t),{data:f,isLoading:v}=il(t),W=h.useMemo(()=>{var T;const A=(T=m==null?void 0:m.data)==null?void 0:T.initial_ui_state;if(A)return A},[m]),[l,N]=h.useState(!1),C=((F=f==null?void 0:f.data)==null?void 0:F.query
1)??"";return n||!W?e.jsx("div",{className:"flex h-[50dvh] items-center justify-center",children:e.jsx(ll,{})}):e.jsx(Qn,{children:e.jsxs(ei,{indexName:`${gt.MEILISEARCH_INDEX}`,searchClient:a,future:{preserveSharedStateOnUnmount:!0},initialUiState:W,children:[e.jsx(ni,{gender:x,hitsPerPage:24}),e.jsxs(ci,{sidebar:e.jsx(oi,{onClose:()=>N(!1),hidden:!l}),children:[e.jsx(Rd,{defaultQuery:C,isLoadingDefault:v}),e.jsx(Ed,{setAdminMailVisible:i,setSelectedIds:r,toggleFilters:()=>N(!l),zm_id:t,id:s,age:p})]})]})})}function Fd({userId:t,id:s,setAdminMailVisible:i,setSelectedIds:r}){const[p,x]=h.useState("pending,accepted"),{data:a,isPending:m}=rl(t,p),[n,f]=h.useState([]),[v,W]=h.useState(void 0),{data:l}=Ht(v,s),N=h.useMemo(()=>(a==null?void 0:a.data)||[],[a]),{data:C,isFetching:F}=Wt(t,N.map(({user:j})=>j.id)),{data:A,isFetching:T}=Hn(t,N.map(({user:j})=>j.id)),M=h.useMemo(()=>N.length>0&&N.every(({user:j})=>n.includes(j.zm_id)),[N,n]),B=h.useMemo(()=>N.length>0&&N.some(({user:j})=>n.includes(j.zm_id))&&!M,[N,n,M]),{mutateAsync:D}=Tt();h.useEffect(()=>{if(a!=null&&a.data&&a.data.length>0){const j=a.data.map(R=>R.user.id).join(",");W(j)}else W(void 0)},[a]);const[I,$]=h.useState({});h.useEffect(()=>{if(l!=null&&l.data){const j={};Object.entries(l.data).forEach(([R,H])=>{j[R]=(H==null?void 0:H.meeting_status)??""}),$(j)}},[l]);const E=j=>{f(R=>R.includes(j)?R.filter(H=>H!==j):[...R,j])};if(m)return e.jsx(b,{sx:{display:"flex",justifyContent:"center",p:4},children:e.jsx(Re,{})});const _=()=>{f(M?[]:N.map(({user:j})=>j.zm_id))};return e.jsx(b,{sx:{padding:4,margin:"0 auto"},children:e.jsxs(b,{children:[e.jsxs(b,{display:"flex",justifyContent:"space-between",alignItems:"center",sx:{mb:2},children:[e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsx(S,{variant:"h6",children:"Actions:"}),e.jsx(q,{disabled:n.length===0,onClick:()=>{i(),r(n)},sx:{ml:1},children:"Send Profiles"})]}),e.jsxs(b,{display:"flex",alignItems:"center",gap:1,children:[e.jsx(S,{variant:"body2",sx:{fontWeight:"medium"},children:"Inbox Status:"}),e.jsxs(pe,{size:"small",value:p,onChange:j=>x(j.target.value),sx:{minWidth:120,height:40},children:[e.jsx(w,{value:"pending,accepted",children:"All"}),e.jsx(w,{value:"pending",children:"Pending"}),e.jsx(w,{value:"accepted",children:"Accepted"})]})]})]}),e.jsxs(_t,{component:Be,children:[e.jsxs(wt,{sx:{minWidth:800,overflowX:"scroll"},"aria-label":"must call profiles table",children:[e.jsx(St,{children:e.jsxs(De,{sx:{backgroundColor:"#f5f5f5"},children:[e.jsx(c,{padding:"checkbox",children:e.jsx(Ie,{indeterminate:B,checked:M,onChange:_})}),e.jsx(c,{sx:{fontWeight:"bold",wordBreak:"break-word"},children:"Profile"}),e.jsx(c,{sx:{fontWeight:"bold"},children:e.jsx(Lt,{matches:C==null?void 0:C.data})}),e.jsx(c,{sx:{fontWeight:"bold"},children:"Member's Preference"}),e.jsx(c,{sx:{fontWeight:"bold"},children:"Proposal Status"}),e.jsx(c,{sx:{fontWeight:"bold"},children:"Credit Balance"}),e.jsx(c,{sx:{fontWeight:"bold"},children:"Inbox Status"}),e.jsx(c,{sx:{fontWeight:"bold"},children:"Interest Direction"}),e.jsx(c,{sx:{fontWeight:"bold"},children:"Profile Shared Status"}),e.jsx(c,{sx:{fontWeight:"bold"},children:"Annual Income"}),e.jsx(c,{sx:{fontWeight:"bold"},children:"Target Audience"}),e.jsx(c,{sx:{fontWeight:"bold"},children:"City"}),e.jsx(c,{sx:{fontWeight:"bold"},children:"Caste"}),e.jsx(c,{sx:{fontWeight:"bold"},children:"Education"}),e.jsx(c,{sx:{fontWeight:"bold"},children:"Marital Status With Children Status"}),e.jsx(c,{sx:{fontWeight:"bold"},children:"Ready to Accept Kids"})]})}),e.jsx(Ct,{children:(l==null?void 0:l.data)&&N.length>0&&N.map(({user:j,mailbox:R})=>{var H,J,V,y,G,k,L,O,K,te,ve,o,Y,X,fe,Ce,_e,oe,be,ce,ie,we,ke,ee,ae,le,Ne,je;return e.jsxs(De,{onClick:()=>{window.open(`${window.location.origin}/user/${j==null?void 0:j.zm_id}`)},sx:{"&:last-child td, &:last-child th":{border:0},"&:hover":{backgroundColor:"whitesmoke",cursor:"pointer"}},children:[e.jsx(c,{padding:"checkbox",onClick:ue=>ue.stopPropagation(),children:e.jsx(Ie,{checked:n.includes(j.zm_id),onChange:()=>E(j.zm_id)})}),e.jsx(c,{component:"th",scope:"row",children:e.jsx(Rt,{zm_id:j.zm_id,name:j.name,age:j.age,avatarShape:"square",imageUrl:(H=j==null?void 0:j.images.find(ue=>ue.is_primary))==null?void 0:H.thumb_image_url,badge:e.jsxs(e.Fragment,{children:[j.current_plan_type&&j.current_plan_type!="ss_credits"?e.jsx(b,{component:"img",src:ss,sx:{position:"absolute",top:-4,right:-4,width:16,height:16,borderRadius:"50%",backgroundColor:"white",boxShadow:1}}):null,j.balance&&(j==null?void 0:j.balance)>0?e.jsx(b,{sx:{position:"absolute",top:-4,right:-4,width:16,height:16,borderRadius:"50%",backgroundColor:"white",boxShadow:1},children:e.jsx(dl,{className:"w-[16px] h-[16px]",fill:"#EFBF04",stroke:"#EFBF04"})}):null]})})}),e.jsx(c,{children:e.jsx(Et,{matches:C==null?void 0:C.data,is_loading:F,candidate_id:j.id,candidate_zm_id:j.zm_id,candidate_name:j.name})}),e.jsx(c,{children:e.jsx(li,{preferences:A==null?void 0:A.data,is_loading:T,candidate_id:j.id})}),e.jsx(c,{onClick:ue=>ue.stopPropagation(),children:e.jsxs(pe,{renderValue:ue=>
1ue?ue.charAt(0).toUpperCase()+ue.slice(1).replace(/_/g," "):e.jsx("em",{children:"Select Proposal Status"}),displayEmpty:!0,value:I[j.id]||"",onChange:async ue=>{var Pe,ze,He;const Ae=ue.target.value;$($e=>({...$e,[j.id]:Ae})),(Pe=l.data)!=null&&Pe[j.id]?D({connection_id:(He=(ze=l.data)==null?void 0:ze[j.id])==null?void 0:He.id,meeting_status:Ae,type:"patch"}):D({user_id:s,connected_user_id:j.id,meeting_status:Ae,type:"post"})},children:[e.jsx(w,{value:"",disabled:!0,children:e.jsx("em",{children:"Select Proposal Status"})}),e.jsx(w,{value:"attempted_to_contact",children:"Attempted To Contact"}),e.jsx(w,{value:"under_consideration",children:"Under consideration"}),e.jsx(w,{value:"accepted",children:"Accepted"}),e.jsx(w,{value:"rejected",children:"Rejected"}),e.jsx(w,{value:"meeting_scheduled",children:"Meeting scheduled"}),e.jsx(w,{value:"under_process",children:"Under process"}),e.jsx(w,{value:"meeting_held",children:"Meeting held"}),e.jsx(w,{value:"dropped",children:"Dropped"}),e.jsx(w,{value:"marriage_finalised",children:"Marriage Finalised"})]})}),e.jsx(c,{children:e.jsxs(b,{display:"flex",flexDirection:"column",gap:.5,children:[e.jsxs(S,{variant:"body2",children:["Available: ",j.balance??0]}),e.jsxs(S,{variant:"body2",color:"text.secondary",children:["Frozen: ",j.frozen_balance??0]})]})}),e.jsx(c,{children:R.status||"-"}),e.jsx(c,{children:R?s===(R==null?void 0:R.sender_id)?"Sent":"Received":"-"}),e.jsx(c,{children:(V=(J=l.data)==null?void 0:J[j.id])!=null&&V.user_shared&&((G=(y=l.data)==null?void 0:y[j.id])!=null&&G.connected_user_shared)?"Both Shared with Each other":(L=(k=l.data)==null?void 0:k[j.id])!=null&&L.user_shared?`${(te=(K=(O=l==null?void 0:l.data)==null?void 0:O[j.id])==null?void 0:K.user)==null?void 0:te.name} Profile Shared with ${(Y=(o=(ve=l==null?void 0:l.data)==null?void 0:ve[j.id])==null?void 0:o.connected_user)==null?void 0:Y.name}`:(fe=(X=l.data)==null?void 0:X[j.id])!=null&&fe.connected_user_shared?`${(oe=(_e=(Ce=l==null?void 0:l.data)==null?void 0:Ce[j.id])==null?void 0:_e.connected_user)==null?void 0:oe.name} Profile Shared with ${(ie=(ce=(be=l==null?void 0:l.data)==null?void 0:be[j.id])==null?void 0:ce.user)==null?void 0:ie.name}`:"Not Shared"}),e.jsx(c,{children:((we=j==null?void 0:j.matrimony_profile)==null?void 0:we.annual_income)||"-"}),e.jsx(c,{children:jt((ke=j==null?void 0:j.meta_data)==null?void 0:ke.target_audience)}),e.jsx(c,{children:j.city}),e.jsx(c,{children:((ee=j==null?void 0:j.matrimony_profile)==null?void 0:ee.caste)||"-"}),e.jsx(c,{children:((ae=j==null?void 0:j.matrimony_profile)==null?void 0:ae.highest_education)||"-"}),e.jsxs(c,{children:[(le=j==null?void 0:j.matrimony_profile)==null?void 0:le.marital_status," ",(Ne=j==null?void 0:j.matrimony_profile)!=null&&Ne.no_of_children?`, ${j.matrimony_profile.no_of_children} ${parseInt(j.matrimony_profile.no_of_children)===1?"child":"children"} ${j.matrimony_profile.children_living_status&&j.matrimony_profile.children_living_status==="with_me"?"living with me":"not living with me"}`:""]}),e.jsx(c,{children:jt((je=j==null?void 0:j.matrimony_profile)==null?void 0:je.accept_matches_with_kids)})]},j==null?void 0:j.zm_id)})})]}),N.length===0&&e.jsx("div",{className:"flex items-center justify-center py-3",children:e.jsx(S,{sx:{textAlign:"center"},children:"No users Found"})})]})]})})}const Ft=10,Rn=1;function Od({userId:t}){const[s,i]=h.useState(null),[r,p]=h.useState(30),[x,a]=h.useState(Rn),{data:m,isLoading:n,isFetching:f}=vr({zm_id:t,started_after:_r(r),page:x,page_size:Ft},!!t),v=h.useMemo(()=>(m==null?void 0:m.results)??[],[m]),W=(m==null?void 0:m.count)??0,l=!!(m!=null&&m.previous),N=!!(m!=null&&m.next),C=W===0?0:(x-1)*Ft+1,F=(x-1)*Ft+v.length;h.useEffect(()=>{s===null&&v.length>0&&i(v[0].id)},[v,s]);const A=M=>{p(M),a(Rn),i(null)},T=M=>{a(M),i(null)};return n?e.jsx(b,{sx:{p:2},children:e.jsx(S,{variant:"body2",color:"text.secondary",children:"Loading journeys…"})}):e.jsxs(b,{sx:{display:"grid",gap:2,gridTemplateColumns:{xs:"1fr",md:"300px 1fr"},alignItems:"start"},children:[e.jsxs(b,{children:[e.jsx("div",{className:"mb-2 flex flex-wrap gap-1",children:wr.map(M=>e.jsx("button",{type:"button",title:M.title,onClick:()=>A(M.days),className:`rounded-lg px-2 py-0.5 text-[11px] font-semibold ${r===M.days?"bg-slate-900 text-white":"border border-slate-300 text-slate-600 hover:bg-slate-50"}`,children:M.label},M.label))}),e.jsx(Be,{variant:"outlined",sx:{p:1,maxHeight:620,overflowY:"auto"},children:v.length===0?e.jsx(S,{variant:"body2",color:"text.secondary",sx:{p:1},children:r===null?"This member has never been enrolled on a workflow campaign.":`Nothing in the last ${r} days. Try a wider range.`}):e.jsx("ul",{className:"space-y-1",children:v.map(M=>e.jsx(Bd,{journey:M,active:M.id===s,onClick:()=>i(M.id)},M.id))})}),W>Ft&&e.jsxs("div",{className:"mt-2 flex items-center justify-between gap-2",children:[e.jsx("button",{type:"button",onClick:()=>T(x-1),disabled:!l||f,className:"rounded-lg border border-slate-300 px-2 py-0.5 text-[11px] font-semibold text-slate-600 enabled:hover:bg-slate-50 disabled:opacity-40",children:"‹ Prev"}),e.jsxs("span",{className:"font-mono text-[10px] text-slate-500",children:[C,"–",F," of ",W]}),e.jsx("button",{type:"button",onClick:()=>T(x+1),disabled:!N||f,className:"rounded-lg border border-slate-300 px-2 py-0.5 text-[11px] font-semibold text-slate-600 enabled:hover:bg-slate-50 disabled:opacity-40",children:"Next ›"})]})]}),e.jsx(Be,{variant:"outlined",sx:{p:2,maxHeight:620,overflowY:"auto"},children:e.jsx(Dd,{id:s})})]})}function Bd({journey:t,active:s,onClick:i}){return e.jsx("li",{children:e.jsxs("button",{type:"button",onClick:i,className:`w-full rounded-lg border px-2 py-1.5 text-left ${s?"border-slate-400 bg-slate-50":"border-slate-200 hover:bg-slate-50"}`,children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"truncate font-mono text-[11.5px] font-semibold text-slate-800",children:t.workflow}),t.is_test&&e.jsx("span",{className:"rounded bg-amber-50 px-1 text-[9px] font-semibold uppercase text-amber-700 ring-1 ring-amber-200",children:"test"}),e.jsx("span",{className:"ml-auto shrink-0",children:e.jsx(Sr,{status:t.status})})]}),e.jsxs("p",{className:"truncate font-mono text-[10px] text-slate-500",children:[t.steps_run," ran",t.sends.sent>0&&` · ${t.sends.sent} sent`,t.sends.skipped>0&&` · ${t.sends.skipped} skipped`,t.sends.failed>0&&` · ${t.sends.failed} failed`]}),e.jsx("p",{className:"truncate font-mono text-[10px] text-slate-400",children:t.status==="in_progress"&&t.next_run_at?`next ${vn(t.next_run_at)}`:`started ${vn(t.started_at)}`})]})})}function Dd({id:t}){const{data:s,isLoading:i}=Cr(t);return t?i||!s?e.jsx(S,{variant:"body2",color:"text.secondary",children:"Loading…"}):e.jsx(kr,{journey:s}):e.jsx(S,{variant:"body2",color:"text.secondary",children:"Pick a campaign on the left."})}function Ve({children:t,value:s,index:i}){return e.jsx("div",{hidden:s!==i,role:"tabpanel",children:s===i&&e.jsx(b,{sx:{p:2},children:t})})}
1function Vd({userId:t,id:s,gender:i,setAdminSendMatchesMailDialog:r,setSelectedIds:p,age:x}){const[a,m]=h.useState(window.location.href.startsWith("http://")?5:0),[n,f]=ls(),v=h.useRef(null);h.useEffect(()=>{n.get("tab")==="virtual_meet"&&v.current&&(m(9),setTimeout(()=>{var l;(l=v.current)==null||l.scrollIntoView({behavior:"smooth",block:"end"})},100),f())},[n,v]);const W=(l,N)=>{m(N)};return e.jsxs(b,{ref:v,sx:{width:"100%"},children:[e.jsxs(Un,{value:a,onChange:W,"aria-label":"profile tabs",indicatorColor:"primary",textColor:"primary",variant:"fullWidth",children:[e.jsx(Ee,{label:"Must Call"}),e.jsx(Ee,{label:"AI Suggested Profiles V2"}),e.jsx(Ee,{label:"Partner Preferences V2"}),e.jsx(Ee,{label:"Interest Pending"}),e.jsx(Ee,{label:"Interest Accepted/Rejected"}),e.jsx(Ee,{label:"Shortlisted Profiles"}),e.jsx(Ee,{label:"F2F Profiles"}),e.jsx(Ee,{label:"Shared Profiles"}),e.jsx(Ee,{label:"Activity Logs"}),e.jsx(Ee,{label:"Virtual Meets"}),e.jsx(Ee,{label:"Workflow Journeys"})]}),e.jsx(Ve,{value:a,index:0,children:e.jsx(Fd,{setSelectedIds:p,setAdminMailVisible:r,id:s,userId:t})}),e.jsx(Ve,{value:a,index:1,children:e.jsx($d,{setAdminMailVisible:r,setSelectedIds:p,id:s,userId:t,gender:i,age:x})}),e.jsx(Ve,{value:a,index:2,children:e.jsx(Id,{setAdminMailVisible:r,setSelectedIds:p,id:s,userId:t,gender:i,age:x})}),e.jsx(Ve,{value:a,index:3,children:e.jsx(Cn,{setSelectedIds:p,setAdminMailVisible:r,id:s,mailbox_type:"pending",userId:t})}),e.jsx(Ve,{value:a,index:4,children:e.jsx(Cn,{setSelectedIds:p,setAdminMailVisible:r,mailbox_type:"accepted,rejected",userId:t,id:s})}),e.jsx(Ve,{value:a,index:5,children:e.jsx(An,{setSelectedIds:p,setAdminMailVisible:r,id:s,userId:t,gender:i})}),e.jsx(Ve,{value:a,index:6,children:e.jsx(An,{setSelectedIds:p,setAdminMailVisible:r,id:s,default_option:"f2f",userId:t,gender:i})}),e.jsx(Ve,{value:a,index:7,children:e.jsx(Xr,{zm_id:t})}),e.jsx(Ve,{value:a,index:8,children:e.jsx(Zr,{userId:t})}),e.jsx(Ve,{value:a,index:9,children:e.jsx(ur,{type:"history",zm_id:t})}),e.jsx(Ve,{value:a,index:10,children:e.jsx(Od,{userId:t})})]})}const Ud="https://secondsutra.com/view-profile/",Qt="[Insert Profile Link]",vt=5;function Hd(t){return!t||t==0?"No Kid":t==1?"1 Kid":`${t} Kids`}function Gd(t){return t?t.toLowerCase()=="with_me"?"Kid with me":"Kid not with me":""}function Yd(t){return t===!0?"Ready to accept kids":"Not Ready to accept kids"}function qd(t,s){const i=t.no_of_children??0,r=Hd(i),x=[t.name,t.age!=null?`${t.age} yrs`:null,t.height,t.marital_status,t.highest_education,t.annual_income,t.religion,t.caste,t.city,r,...i>0?[Gd(t.children_living_status),Yd(t.accept_matches_with_kids)]:[]].filter(Boolean).join(" | ");return`Profile: ${Ud}${s}
2${x}`}function Kd({open:t,onClose:s,user_id:i,phone:r}){const{data:p,isPending:x}=ol(),[a,m]=h.useState(""),[n,f]=h.useState(""),[v,W]=h.useState([]),{data:l,isPending:N}=Dn({template_value:a,user_id:i}),{data:C,isPending:F}=cl(v),[A,T]=h.useState(""),M=h.useRef(""),{mutateAsync:B,isPending:D}=hl(),I=h.useMemo(()=>{var k,L;return!!((L=(k=l==null?void 0:l.data)==null?void 0:k.raw_message)!=null&&L.includes(Qt))},[l]),$=h.useMemo(()=>{const k=C==null?void 0:C.data;if(!k||k.length===0)return null;const L=k.map(O=>O.zm_id?qd(O,O.zm_id):null).filter(Boolean);return L.length===0?null:L.join(`
3
4`)},[C]);h.useEffect(()=>{var k;(k=l==null?void 0:l.data)!=null&&k.raw_message&&(M.current=l.data.raw_message,T(l.data.raw_message))},[l]),h.useEffect(()=>{if(!$)return;const k=M.current;k.includes(Qt)&&T(k.replace(Qt,$))},[$]);const E=k=>{navigator.clipboard.writeText(k),U.success("Copied Text Successfully!!")},{appUrl:_,webUrl:j}=h.useMemo(()=>{var O;const k=(O=l==null?void 0:l.data)==null?void 0:O.phone;if(!k||!A)return{appUrl:"",webUrl:""};const L=encodeURIComponent(A.trim());return{appUrl:`whatsapp://send?phone=${k}&text=${L}`,webUrl:`https://web.whatsapp.com/send?phone=${k}&text=${L}`}},[l,A]),R=h.useMemo(()=>(p==null?void 0:p.data)??[],[p]),H=k=>{m(k),W([]),f("")},J=()=>{const k=n.trim();if(!k)return;const L=k.split(/[,\s\n]+/).map(O=>O.trim().toUpperCase()).filter(O=>O.length>0);W(O=>{const K=[...O];for(const te of L)!K.includes(te)&&K.length<vt&&K.push(te);return K}),f("")},V=k=>{W(L=>L.filter(O=>O!==k)),M.current&&T(M.current)},y=h.useMemo(()=>
4{if(r)try{return ul(r)}catch{return null}},[r]),G=h.useCallback(async()=>{try{await B({chat_id:y,text:A}),U.success("Message Sent!")}catch(k){console.log(k),U.error("Error: Message not sent.")}},[A,B,y]);return e.jsxs(lt,{open:t,fullWidth:!0,maxWidth:"sm",onClose:s,children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(pt,{children:"Select WhatsApp Template"}),e.jsx(re,{onClick:s,sx:{mr:3},children:e.jsx(Ut,{})})]}),e.jsxs(rt,{dividers:!0,children:[x&&e.jsx(b,{sx:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:200},children:e.jsx(Re,{})}),!x&&(p==null?void 0:p.data)&&e.jsxs(Te,{fullWidth:!0,children:[e.jsx(xl,{sx:{mb:1,color:"black"},children:"Templates"}),e.jsx(rs,{options:R,getOptionLabel:k=>k.name,value:R.find(k=>k.value===a)??null,onChange:(k,L)=>H((L==null?void 0:L.value)??""),renderInput:k=>e.jsx(ge,{...k,placeholder:"Search templates…",size:"small"}),isOptionEqualToValue:(k,L)=>k.value===L.value})]}),e.jsxs(b,{children:[N&&a&&e.jsx(b,{sx:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:150},children:e.jsx(Re,{})}),!N&&l&&I&&e.jsxs(b,{sx:{mt:2,p:2,border:"1px solid",borderColor:"divider",borderRadius:2,bgcolor:"grey.50",display:"flex",flexDirection:"column",gap:1.5},children:[e.jsx(S,{variant:"subtitle2",fontWeight:600,children:"Insert Profile ID(s)"}),e.jsxs(S,{variant:"caption",color:"text.secondary",children:["Enter up to ",vt," ZM IDs. Separate multiple IDs with commas or spaces (e.g. ZM1367065, ZM1234567)."]}),e.jsxs(b,{sx:{display:"flex",gap:1},children:[e.jsx(ge,{size:"small",fullWidth:!0,placeholder:"e.g. ZM1367065, ZM1234567",value:n,onChange:k=>f(k.target.value.toUpperCase()),onKeyDown:k=>{k.key==="Enter"&&n.trim()&&J()},disabled:v.length>=vt}),e.jsx(q,{variant:"contained",size:"small",sx:{whiteSpace:"nowrap"},disabled:!n.trim()||v.length>=vt,onClick:J,children:"Fetch"})]}),v.length>0&&e.jsxs(b,{sx:{display:"flex",flexWrap:"wrap",gap:.5,mt:.5},children:[v.map(k=>e.jsx(et,{label:k,size:"small",onDelete:()=>V(k),color:"primary",variant:"outlined"},k)),v.length>=vt&&e.jsxs(S,{variant:"caption",color:"warning.main",sx:{alignSelf:"center",ml:1},children:["Maximum ",vt," IDs reached"]})]}),F&&v.length>0&&e.jsxs(b,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(Re,{size:14}),e.jsx(S,{variant:"caption",color:"text.secondary",children:"Fetching profile(s)… the message will update automatically."})]})]}),!N&&l&&e.jsxs(b,{sx:{display:"flex",flexDirection:"column",gap:2,mt:2},children:[e.jsxs(b,{sx:{display:"flex",flexDirection:"row",alignItems:"center"},children:[e.jsx(S,{variant:"subtitle1",children:"Message"}),e.jsx(re,{onClick:()=>E(A),children:e.jsx(ml,{})})]}),e.jsx(ge,{fullWidth:!0,multiline:!0,minRows:10,maxRows:20,value:A,onChange:k=>T(k.target.value)}),e.jsxs(b,{sx:{display:"flex",justifyContent:"flex-end",gap:1},children:[e.jsx(q,{disabled:j==="",href:j,target:"_blank",variant:"outlined",children:"Open in Web"}),e.jsx(q,{disabled:_==="",href:_,variant:"outlined",children:"Open in WhatsApp App"}),e.jsx(gl,{isLoading:D,disabled:!y||D,onClick:G,variant:"contained",color:"primary",children:"Send Directly"})]})]})]})]})]})}const is=300,Zd=si("div",{shouldForwardProp:t=>t!=="open"})(({theme:t})=>({flexGrow:1,padding:t.spacing(0),transition:t.transitions.create("margin",{easing:t.transitions.easing.sharp,duration:t.transitions.duration.leavingScreen}),marginRight:-is,variants:[{props:({open:s})=>s,style:{transition:t.transitions.create("margin",{easing:t.transitions.easing.easeOut,duration:t.transitions.duration.enteringScreen}),marginRight:0}}]})),Xd=si("div")(({theme:t})=>({display:"flex",alignItems:"center",padding:t.spacing(0,1),...t.mixins.toolbar,justifyContent:"flex-start"}));function Jd({open:t,onClose:s,user_email:i,user_id:r}){const p=pl(),{data:x,isLoading:a,isError:m,refetch:n}=jl(),{mutateAsync:f}=fl(),{mutateAsync:v}=bl(),{mutateAsync:W}=yl(),l=(x==null?void 0:x.data)||[],[N,C]=h.useState({subject:"",body:"",cc:[]}),[F,A]=h.useState(!1),[T,M]=h.useState(!1),[B,D]=h.useState(!1),[I,$]=h.useState(null),[E,_]=h.useState(""),[j,R]=h.useState(""),[H,J]=
4h.useState(""),[V,y]=h.useState({open:!1,message:"",severity:"success"}),G=()=>{E.trim()&&j.trim()&&H.trim()&&(_(""),R(""),J(""),M(!1),v({email_content:H,subject:j,template_name:E}).then(()=>{U.success("Template Added successfully"),n()}).catch(()=>{U.error("Something Went Wrong!")}))},k=()=>{I&&E.trim()&&j.trim()&&H.trim()&&(console.log("Needs Update Mutation for ID:",I.id),_(""),R(""),J(""),$(null),D(!1),f({email_content:H,subject:j,id:I.id,template_name:E}).then(()=>{U.success("Template Added successfully"),n()}).catch(()=>{U.error("Something Went Wrong!")}))},L=o=>{navigator.clipboard.writeText(o),y({open:!0,message:"Template copied to clipboard!",severity:"success"})},O=o=>{$(o),_(o.template_name),R(o.subject),J(o.email_content),D(!0)},K=o=>{const Y=l.find(X=>X.id===Number(o));Y&&(C({...N,subject:Y.subject,body:Y.email_content,id:Y.id}),y({open:!0,message:`Template "${Y.template_name}" loaded!`,severity:"info"}))},te=()=>{r&&N.subject.trim()&&N.body.trim()?(console.log("Email sent:",N),C({subject:"",body:"",cc:[]}),W({user_id:r,content:N.body,subject:N.subject,cc:N.cc}).then(()=>{U.success("Successfully sent the email")})):y({open:!0,message:"Please fill in all email fields",severity:"warning"})},ve=()=>{C({subject:"",body:"",cc:[]})};return e.jsxs(e.Fragment,{children:[e.jsxs(lt,{open:t,onClose:s,maxWidth:"lg",fullWidth:!0,children:[e.jsxs(pt,{sx:{fontWeight:"bold",fontSize:"1.3rem",display:"flex",justifyContent:"space-between",alignItems:"center"},children:["Mail Template Manager",e.jsx(re,{onClick:s,sx:{color:"inherit"},size:"small",children:e.jsx(Mr,{})})]}),e.jsxs(rt,{sx:{p:0,display:"flex",position:"relative",overflowX:"hidden"},children:[e.jsxs(Zd,{open:F,sx:{display:"flex",flexDirection:"column",p:2,overflow:"auto"},children:[e.jsx(b,{sx:{display:"flex",justifyContent:"flex-end",mb:1},children:e.jsx(re,{color:"primary",onClick:()=>A(!F),title:F?"Close templates":"Open templates",size:"small",children:F?e.jsx(wn,{}):e.jsx(_n,{})})}),e.jsxs(Te,{sx:{mb:2},children:[e.jsx(Qe,{children:"Load Template"}),e.jsx(pe,{value:N.id||"",label:"Load Template",onChange:o=>K(o.target.value),disabled:a||m,children:l.map(o=>e.jsx(w,{value:o.id,children:o.template_name},o.id))})]}),e.jsx(ge,{label:"To",fullWidth:!0,disabled:!0,value:i,placeholder:"[email protected]",sx:{mb:2}}),e.jsx(ge,{label:"CC",fullWidth:!0,value:N.cc.join(","),onChange:o=>C({...N,cc:o.target.value.trim().split(",")}),placeholder:"[email protected],[email protected]",sx:{mb:2}}),e.jsx(ge,{label:"Subject",fullWidth:!0,value:N.subject,onChange:o=>C({...N,subject:o.target.value}),placeholder:"Email subject",sx:{mb:2}}),e.jsx(ge,{label:"Body",fullWidth:!0,multiline:!0,rows:10,value:N.body,onChange:o=>C({...N,body:o.target.value}),placeholder:"Email body",sx:{mb:2,flex:1}}),e.jsxs(b,{sx:{display:"flex",gap:1,justifyContent:"flex-end"},children:[e.jsx(q,{variant:"outlined",onClick:ve,children:"Clear"}),e.jsx(q,{variant:"contained",color:"primary",onClick:te,children:"Send Email"})]})]}),e.jsxs(vl,{sx:{width:is,flexShrink:0,"& .MuiDrawer-paper":{width:is,position:"absolute",height:"100%"}},variant:"persistent",anchor:"right",open:F,children:[e.jsx(Xd,{children:e.jsx(re,{onClick:()=>A(!1),size:"small",children:p.direction==="rtl"?e.jsx(_n,{}):e.jsx(wn,{})})}),e.jsx(Mt,{}),e.jsxs(b,{sx:{p:2},children:[e.jsx(S,{variant:"h6",sx:{mb:2,fontWeight:"bold"},children:"Saved Templates"}),e.jsx(q,{variant:"contained",color:"primary",startIcon:e.jsx(Ar,{}),fullWidth:!0,onClick:()=>{_(""),R(""),J(""),$(null),M(!0)},size:"small",children:"Add New"})]}),e.jsx(Mt,{}),e.jsx(b,{sx:{flex:1,overflow:"auto",p:2},children:a?e.jsx(b,{sx:{display:"flex",justifyContent:"center",p:4},children:e.jsx(Re,{size:24})}):m?e.jsx(S,{color:"error",sx:{textAlign:"center",fontSize:"0.875rem"},children:"Failed to load templates."}):l.length===0?e.jsx(S,{color:"textSecondary",sx:{textAlign:"center",fontSize:"0.875rem"},children:"No templates yet"}):e.jsx(_l,{sx:{p:0},children:l.map(o=>e.jsxs(Be,{sx:{mb:1,p:1,backgroundColor:"#f5f5f5","&:hover":{backgroundColor:"#eeeeee"}},children:[e.jsx(On,{disablePadding:!0,secondaryAction:e.jsxs(b,{sx:{display:"flex",gap:.5},children:[e.jsx(re,{edge:"end",size:"small",onClick:()=>L(o.email_content),title:"Copy",children:e.jsx(Pr,{fontSize:"small"})}),e.jsx(re,{edge:"end",size:"small",onClick:()=>O(o),title:"Edit",children:e.jsx(zr,{fontSize:"small"})})]}),children:e.jsx(wl,{primary:o.template_name,secondary:o.subject,primaryTypographyProps:{variant:"subtitle2",noWrap:!0},secondaryTypographyProps:{variant:"caption",noWrap:!0}})}),e.jsxs("p",{className:"text-[10px]",children:["Created by ",o.user__name]})]},o.id))})})]})]})]}),e.jsxs(lt,{open:T,onClose:()=>M(!1),fullWidth:!0,children:[e.jsx(pt,{children:"Add New Template"}),e.jsx(rt,{children:e.jsxs(b,{sx:{pt:2,display:"flex",flexDirection:"column",gap:2},children:[e.jsx(ge,{autoFocus:!0,label:"Template Name",fullWidth:!0,value:E,onChange:o=>_(o.target.value),placeholder:"e.g., Welcome Email"}),e.jsx(ge,{label:"Subject",fullWidth:!0,value:j,onChange:o=>R(o.target.value),placeholder:"Enter the email subject"}),e.jsx(ge,{label:"Template Content",fullWidth:!0,multiline:!0,rows:6,value:H,onChange:o=>J(o.target.value),placeholder:"Enter the email template content"})]})}),e.jsxs(as,{children:[e.jsx(q,{onClick:()=>M(!1),children:"Cancel"}),e.jsx(q,{onClick:G,variant:"contained",color:"primary",children:"Add"})]})]}),e.jsxs(lt,{fullWidth:!0,open:B,onClose:()=>D(!1),children:[e.jsx(pt,{children:"Edit Template"}),e.jsx(rt,{children:e.jsxs(b,{sx:{pt:2,display:"flex",flexDirection:"column",gap:2},children:[e.jsx(ge,{label:"Template Name",fullWidth:!0,value:E,onChange:o=>_(o.target.value)}),e.jsx(ge,{label:"Subject",fullWidth:!0,value:j,onChange:o=>R(o.target.value)}),e.jsx(ge,{label:"Template Content",fullWidth:!0,multiline:!0,rows:6,value:H,onChange:o=>J(o.target.value)})]})}),e.jsxs(as,{children:[e.jsx(q,{onClick:()=>D(!1),children:"Cancel"}),e.jsx(q,{onClick:k,variant:"contained",color:"primary",children:"Update"})]})]}),e.jsx(Nr,{open:V.open,autoHideDuration:3e3,onClose:()=>y({...V,open:!1}),anchorOrigin:{vertical:"bottom",horizontal:"left"},children:e.jsx(Sl,{onClose:()=>y({...V,open:!1}),severity:V.severity,sx:{width:"100%"},children:V.message})})]})}const es=t=>{const s={year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"};return new Date(t).toLocaleDateString(void 0,s)},Qd=[{label:"Last 7 Days",value:"7"},{label:"Last 14 Days",value:"14"},{label:"Last 30 Days",value:"30"}];function Ot({label:t,savedValue:s,rows:i=1,isSaving:r,onSave:p,display_label:x}){const[a,m]=h.useState(!1),[n,f]=h.useState(s??"");h.useEffect(()=>{a||f(s??"")},[s,a]);const v=async()=>{const l=n.trim();if(!l){U.error(`Please enter ${t} before saving`);return}await p(l),m(!1)},W=()=>{f(s??""),m(!1)};return e.jsxs(b,{sx:{mb:2,p:1.5,backgroundColor:"#fff",borderRadius:1,boxShadow:"0 1px 3px rgba(0,0,0,0.1)",position:"relative"},children:[e.jsx(S,{variant:"body1",sx:{fontWeight:600,color:"#555",mb:.5},children:t}),a?e.jsxs(e.Fragment,{children:[e.jsx(ge,{value:n,onChange:l=>f(l.target.value),fullWidth:!0,multiline:!0,rows:i}),e.jsxs(b,{sx:{mt:1,display:"flex",justifyContent:"flex-end",gap:1},children:[e.jsx(q,{size:"small",variant:"outlined",disabled:r,onClick:W,children:"Cancel"}),e.jsx(q,{size:"small",variant:"contained",disabled:r,onClick:v,children:"Save"})]})]}):e.jsxs(e.Fragment,{children:[e.jsx(S,{variant:"body1",sx:{whiteSpace:"pre-wrap",color:"#333"},children:x||s||"-"}),e.jsx(re,{onClick:()=>m(!0),size:"small",sx:{position:"absolute",top:8,right:8},children:e.jsx(Dt,{fontSize:"small"})})]})]})}const po=()=>{var us,xs,ms,gs,ps,js,fs,bs,ys,vs,_s,ws,Ss,Cs,ks,Ns,As,Is,Ms,Ps,zs,Ws,Ts,Ls,Es,Rs,$s,Fs,Os,Bs,Ds,Vs,Us,Hs,Gs,Ys,qs,Ks,Zs,Xs,Js,Qs,ea,ta,sa,aa,na,ia,la,ra,da,oa,ca,ha,ua,xa,ma,ga,pa,ja,fa,ba,ya,va,_a,wa,Sa,Ca,ka,Na,Aa,Ia,Ma,Pa,za,Wa,Ta,La,Ea,Ra,$a,Fa,Oa,Ba,Da,Va,Ua,Ha,Ga,Ya,qa,Ka,Za,Xa,Ja,Qa,en,tn,sn,an,nn,ln,rn;const{id:t}=Cl(),s=ai(),{search:i}=kl(),[r,p]=ls(),x=Nl(g=>g.set_chat_id),{data:a,isLoading:m,refetch:n}=Al(t,{time_scope:r.get("time_scope")||void 0}),{data:f,refetch:v}=Il((xs=(us=a==null?void 0:a.data)==null?void 0:us.user)==null?void 0:xs.id,!0),{data:W}=Vn(),{mutateAsync:l}=Ml(((gs=(ms=a==null?void 0:a.data)==null?void 0:ms.id)==null?void 0:gs.toString())||""),{mutateAsync:N}=Pl(((js=(ps=a==null?void 0:a.data)==null?void 0:ps.id)==null?void 0:js.toString())||""),{mutateAsync:C}=$n(((bs=(fs=a==null?void 0:a.data)==null?void 0:fs.id)==null?void 0:bs.toString())||""),{data:F}
4=zl((vs=(ys=a==null?void 0:a.data)==null?void 0:ys.user)==null?void 0:vs.id),{mutateAsync:A,isPending:T}=Wl(((ws=(_s=a==null?void 0:a.data)==null?void 0:_s.id)==null?void 0:ws.toString())||""),{data:M}=Tl(t),{data:B}=Ll(t),{data:D}=El(t),{data:I}=Rl(a==null?void 0:a.data.user.zm_id),{data:$}=$l(a==null?void 0:a.data.user.zm_id),{data:E,refetch:_}=Fl((Cs=(Ss=a==null?void 0:a.data)==null?void 0:Ss.user)==null?void 0:Cs.zm_id),{mutateAsync:j,isPending:R}=Ol(),{mutateAsync:H,isPending:J}=Bl((Ns=(ks=a==null?void 0:a.data)==null?void 0:ks.user)==null?void 0:Ns.zm_id),{data:V}=Dl(((Is=(As=a==null?void 0:a.data)==null?void 0:As.user)==null?void 0:Is.zm_id)??null),[y,G]=h.useState(!1),[k,L]=h.useState(!1),O=h.useMemo(()=>{var g;return(((g=a==null?void 0:a.data)==null?void 0:g.comments)??[]).filter(z=>z.comment_type==="partner_expectation_change")},[(Ms=a==null?void 0:a.data)==null?void 0:Ms.comments]),{data:K}=Vl(),te=h.useMemo(()=>{var g,z;return((g=K==null?void 0:K.data)==null?void 0:g.includes("VideoVerificationApprove"))||((z=K==null?void 0:K.data)==null?void 0:z.includes("Video Verification Approve"))||!1},[K==null?void 0:K.data]),{mutateAsync:ve,isPending:o}=Ul((Ps=a==null?void 0:a.data)==null?void 0:Ps.id),[Y,X]=h.useState(!1),fe=async g=>{var z,ne,We,Ge;try{await ve({remarks:g.trim()||void 0}),U.success("Video verification approved successfully!"),X(!1),n()}catch(Oe){U.error(((ne=(z=Oe==null?void 0:Oe.response)==null?void 0:z.data)==null?void 0:ne.error)||((Ge=(We=Oe==null?void 0:Oe.response)==null?void 0:We.data)==null?void 0:Ge.message)||"Failed to approve video verification")}},Ce=async(g,z="post")=>{var We;const ne=(We=g==null?void 0:g.files)==null?void 0:We[0];if(!(ne!=null&&ne.path)){U.error("Upload did not return a file. Please try again.");return}try{await H({image_url:ne.path,type:z}),U.success("Image uploaded successfully!")}catch{U.error("Failed to save image. Please try again.")}},_e=async()=>{var g,z;if((z=(g=a==null?void 0:a.data)==null?void 0:g.user)!=null&&z.id)try{await j({user_id:a.data.user.id,onboarding_user:!0}),U.success("Intro call marked successfully!"),await _()}catch(ne){console.error("Error marking intro call:",ne),U.error("Failed to mark intro call")}},[oe,be]=h.useState([]),[ce,ie]=h.useState(!1);async function we(){U.success("Copied Login Link!")}const[ke,ee]=h.useState(!1),[ae,le]=h.useState(null),[Ne,je]=h.useState(null),[ue,Ae]=h.useState([]),[Pe,ze]=h.useState(!1),[He,$e]=h.useState(null),[st,qe]=h.useState(!1),{user:he}=Vt(),[ht,at]=h.useState(!1),{mutateAsync:Se,isPending:ut}=Hl(),{mutateAsync:ft}=Gl(),{data:Fe}=Yl((Ws=(zs=a==null?void 0:a.data)==null?void 0:zs.user)==null?void 0:Ws.zm_id),d=g=>{le(g),ee(!0)},P=async()=>{ae&&(await Se(ae),ee(!1),await n())},{data:Z}=ql((he!=null&&he.is_admin||he!=null&&he.is_staff)&&((Ls=(Ts=a==null?void 0:a.data)==null?void 0:Ts.user)!=null&&Ls.id)?(Rs=(Es=a==null?void 0:a.data)==null?void 0:Es.user)==null?void 0:Rs.id:null);h.useEffect(()=>{var g,z;(z=(g=a==null?void 0:a.data)==null?void 0:g.user)!=null&&z.tags&&be(a.data.user.tags)},[a]);const de=[{label:"Yes",value:"yes"},{label:"No",value:"no"}],se=h.useMemo(()=>{var z,ne,We;const g=[{label:"Meta Ads",value:"Meta Ads"},{label:"Google Ads",value:"Google Ads"},{label:"Google",value:"Google"},{label:"Facebook",value:"Facebook"},{label:"Instagram",value:"Instagram"},{label:"WhatsApp",value:"WhatsApp"},{label:"Live Chat",value:"Live Chat"},{label:"Facebook Ads",value:"Facebook Ads"},{label:"Instagram Ads",value:"Instagram Ads"},{label:"Facebook Organic",value:"Facebook Organic"},{label:"Instagram Organic",value:"Instagram Organic"},{label:"Audience Network Ads",value:"Audience Network Ads"},{label:"Google Organic",value:"Google Organic"},{label:"YouTube",value:"YouTube"},{label:"Android App",value:"Android App"},{label:"Direct",value:"Direct"},{label:"Other",value:"Other"},{label:"BioData",value:"Biodata"}];return(z=a==null?void 0:a.data)!=null&&z.source&&g.findIndex(Ge=>Ge.value===a.data.source)===-1&&g.push({label:(ne=a==null?void 0:a.data)==null?void 0:ne.source,value:(We=a==null?void 0:a.data)==null?void 0:We.source}),g},[a]),Q=g=>{const z=g.replace(/\.(\d{3})\d+/,".$1");
4return new Date(z).toLocaleString("en-IN",{day:"2-digit",month:"short",year:"numeric",hour:"numeric",minute:"2-digit",hour12:!0})},me=async g=>{if(g)try{await l(g.value),U.success("Lead Source Updated Successfully")}catch{U.error("Something Went Wrong")}},Me=async g=>{try{const z=g?g.value==="yes":null;await N(z),await n(),U.success("Interested in Assisted Status Updated Successfully")}catch{U.error("Something Went Wrong")}},Ke=g=>{p(z=>({...z,time_scope:g.target.value}))};function $t(g){ft(g).then(()=>{U.success("Copied to Phone")}).catch(z=>{console.log(z),U.error("some thing went wrong")})}const kt=h.useMemo(()=>{var We,Ge,Oe,Ye,At,dn;const g={ios:e.jsxs("p",{children:[" ",e.jsx("span",{className:"rounded bg-[#cf9a46] px-2 text-white",children:"Not-installed"})," "]}),android:e.jsxs("p",{children:[" ",e.jsx("span",{className:"rounded bg-[#cf9a46] px-2 text-white",children:"Not-installed"})," "]})},z=(Oe=(Ge=(We=M==null?void 0:M.data)==null?void 0:We.app_install_data)==null?void 0:Ge.android)==null?void 0:Oe.last_seen_timesince,ne=(dn=(At=(Ye=M==null?void 0:M.data)==null?void 0:Ye.app_install_data)==null?void 0:At.ios)==null?void 0:dn.last_seen_timesince;if(z){const Yt=(M==null?void 0:M.data.android_status)===!1;g.android=e.jsxs("p",{children:[" ",e.jsx("span",{className:"text-xs text-gray-400",children:"LA:"})," ",e.jsxs("span",{className:"text-sm",children:[z," ago"]})," ",e.jsx("br",{})," ",Yt&&e.jsxs("span",{children:["May be"," ",e.jsx("span",{className:"rounded bg-red-400 px-2 text-white",children:"un-installed"})," "]})," "]})}if(ne){const Yt=(M==null?void 0:M.data.ios_status)===!1;g.ios=e.jsxs("p",{children:[" ",e.jsx("span",{className:"text-xs text-gray-400",children:"LA:"})," ",e.jsxs("span",{className:"text-sm",children:[ne," ago"]})," ",e.jsx("br",{})," ",Yt&&e.jsxs("span",{children:["May be"," ",e.jsx("span",{className:"rounded bg-red-400 px-2 text-white",children:"un-installed"})," "]})," "]})}return g},[M]);if(m)return e.jsx(b,{sx:{display:"flex",justifyContent:"center",mt:4},children:e.jsx(Re,{})});if(!(a!=null&&a.data))return e.jsxs(b,{sx:{textAlign:"center",px:4,py:3,height:"80vh",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},children:[e.jsx(S,{variant:"h5",children:"User not found"}),e.jsx(q,{variant:"contained",startIcon:e.jsx(Kl,{}),onClick:()=>s(`/crm${i}`),sx:{mt:2},children:"Back to Users"})]});const{user:u,source:Nt,scheduled_activation_at:bt}=a.data,hi=(u==null?void 0:u.current_plan_type)!=="ss_6_month_assisted"&&(u==null?void 0:u.current_plan_type)!=="ss_1_year_assisted",hs={control:g=>({...g,minWidth:"200px",border:"1px solid #ccc",boxShadow:"none"}),menu:g=>({...g,width:"100%",zIndex:9999}),menuList:g=>({...g,maxHeight:"300px"})};return e.jsxs(b,{sx:{pt:8,maxWidth:"80%",mx:"auto"},children:[e.jsxs(b,{sx:{my:2,display:"flex",alignItems:"center",gap:2},children:[e.jsx(re,{onClick:()=>s(`/crm${i}`),children:e.jsx(Zl,{})}),e.jsxs(b,{children:[e.jsxs(S,{sx:{fontSize:"42px",fontWeight:600,display:"flex",alignItems:"center"},variant:"h5",children:[e.jsxs("span",{children:[u.name||"-"," ",(u==null?void 0:u.last_name)||""]}),e.jsxs("div",{className:"flex items-center",children:[(($s=u==null?void 0:u.meta_data)==null?void 0:$s.target_audience)&&e.jsx(ye,{title:"Target Audience",children:e.jsx("img",{className:"max-w-[40px] object-fill",src:un})}),"is_premium_active"in u&&(u==null?void 0:u.is_premium_active)&&e.jsx(ye,{title:e.jsxs("div",{children:[e.jsx("p",{children:qt(u==null?void 0:u.current_plan_type)}),e.jsx("p",{children:typeof((Fs=u==null?void 0:u.credit_account)==null?void 0:Fs.balance)=="number"&&`${(Os=u==null?void 0:u.credit_account)==null?void 0:Os.balance} Credits`})]}),children:e.jsx("img",{className:"ml-2 h-[35px] w-[35px]",src:ss})})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(S,{sx:{mt:1},children:["Last Seen: ",Xl(u.last_seen)||"-"]}),u.is_chat_disabled&&e.jsxs(S,{sx:{mt:1,color:"red"},children:["Chat Disabled by Admin on"," ",e.jsxs("span",{className:"ml-2 text-xs",children:["(",it(u==null?void 0:u.chat_disabled_on).format(Jl),")"]})]})]}),u.action_required&&e.jsxs(S,{sx:{mt:1},children:["Profile access restricted:"," ",u.action_required=="payment"?e.jsxs("span",{children:["User ",e.jsx("span",{className:"text-red-500",children:"not ready to pay"})]}):u.action_required]})]}),e.jsx(b,{sx:{display:"flex",flexWrap:"wrap",gap:.5,py:3},children:oe==null?void 0:oe.map(g=>e.jsx(et,{label:g.name,size:"small",sx:{backgroundColor:g.color,color:"white"},onDelete:()=>{const z=oe.filter(ne=>ne.id!==g.id);be(z),C(z.map(ne=>ne.id)).then(()=>
4U.success("Tags Updated Successfully")).catch(()=>U.error("Failed to update tags"))}},g.id))})]}),e.jsxs(Be,{sx:{p:3,mb:3},children:[e.jsxs(xe,{container:!0,spacing:3,children:[e.jsx(xe,{item:!0,xs:12,md:6,children:e.jsxs(Bt,{variant:"outlined",children:[e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",padding:"16px",gap:"16px"},children:[e.jsx("div",{className:"h-[296px] w-[261px]",children:e.jsx(xr,{images:a.data.user.images,show_redirect_crop:(he==null?void 0:he.is_admin)||(he==null?void 0:he.is_staff),show_status:he==null?void 0:he.is_admin,onModalOpen:d,handleImageDialogOpen:g=>{$e(g),ze(!0)},media_privacy:(Ds=(Bs=a==null?void 0:a.data)==null?void 0:Bs.user)==null?void 0:Ds.media_privacy})}),e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx(to,{credit_details:D==null?void 0:D.data,totalVirtualMeet:a.data.virtual_meet_count||0}),e.jsxs("div",{style:{flex:"1",minWidth:"200px"},children:[e.jsx(S,{variant:"subtitle2",gutterBottom:!0,sx:{color:"primary.main",fontWeight:600,mb:2},children:"Interests Statistics"}),e.jsx(xe,{container:!0,spacing:1,children:[["Interests Sent",(Vs=F==null?void 0:F.data)==null?void 0:Vs.total_sent],["Interests Received",(Us=F==null?void 0:F.data)==null?void 0:Us.total_received],["Interests Accepted",(Hs=F==null?void 0:F.data)==null?void 0:Hs.total_accepted],["Interests Rejected",(Gs=F==null?void 0:F.data)==null?void 0:Gs.total_rejected]].map(([g,z])=>e.jsx(xe,{item:!0,xs:3,children:e.jsxs(b,{sx:{display:"flex",flexDirection:"column",p:1,border:"1px solid #e0e0e0",borderRadius:1,backgroundColor:"#fafafa"},children:[e.jsx(S,{variant:"caption",sx:{fontSize:"0.7rem",color:"text.secondary"},children:g}),e.jsx(S,{variant:"h6",sx:{fontWeight:"bold",color:"primary.main"},children:z||"0"})]})},g))})]}),e.jsxs("div",{style:{flex:"1",minWidth:"200px"},children:[e.jsx(S,{variant:"subtitle2",gutterBottom:!0,sx:{color:"primary.main",fontWeight:600,mb:2},children:"Activity Timestamps"}),e.jsx(xe,{container:!0,spacing:1,children:[["Created At",u.created_at?Q(u.created_at):"-"],["Activated At",u.activated_at?Q(u.activated_at):"-"],["Last Login",u.last_login?Q(u.last_login):"-"],["Last Seen",u.last_seen?Q(u.last_seen):"-"]].map(([g,z])=>e.jsx(xe,{item:!0,xs:6,md:6,children:e.jsxs(b,{sx:{display:"flex",flexDirection:"column",p:1,border:"1px solid #e0e0e0",borderRadius:1,backgroundColor:"#fafafa",height:"100%"},children:[e.jsx(S,{variant:"caption",sx:{fontSize:"0.7rem",color:"text.secondary",whiteSpace:"normal",wordBreak:"break-word"},children:g}),e.jsx(S,{variant:"body2",sx:{fontWeight:"bold",color:"primary.main",fontSize:"0.8rem",mt:.5,whiteSpace:"normal",wordBreak:"break-word"},children:z})]})},g))})]}),e.jsx(b,{sx:{display:"flex",gap:2,justifyContent:"center",alignItems:"center"},children:e.jsx(Te,{size:"small",children:e.jsx(pe,{size:"small",value:r.get("time_scope")||"7",onChange:Ke,children:Qd.map(g=>e.jsx(w,{value:g.value,children:g.label},g.value))})})}),!!((Ks=(qs=(Ys=a==null?void 0:a.data)==null?void 0:Ys.user)==null?void 0:qs.activity)!=null&&Ks.length)&&e.jsxs("div",{style:{flex:"1",minWidth:"200px"},children:[e.jsxs(S,{variant:"subtitle2",gutterBottom:!0,sx:{color:"primary.main",fontWeight:600,mb:2},children:["User Statistics",e.jsxs("p",{className:"text-sx text-gray-400",children:["from"," ",new Date((Qs=(Js=(Xs=(Zs=a==null?void 0:a.data)==null?void 0:Zs.user)==null?void 0:Xs.activity)==null?void 0:Js[0])==null?void 0:Qs.period_start).toLocaleDateString(void 0,{weekday:"short",year:"numeric",month:"short",day:"numeric"})," ","to",(aa=(sa=(ta=(ea=a==null?void 0:a.data)==null?void 0:ea.user)==null?void 0:ta.activity)==null?void 0:sa[0])==null?void 0:aa.time_scope," days,"]})]}),e.jsx(xe,{container:!0,spacing:2,children:[["Missing Detail Requests",(ra=(la=(ia=(na=a==null?void 0:a.data)==null?void 0:na.user)==null?void 0:ia.activity)==null?void 0:la[0])==null?void 0:ra.missing_detail_request_count],["Mailbox",(ha=(ca=(oa=(da=a==null?void 0:a.data)==null?void 0:da.user)==null?void 0:oa.activity)==null?void 0:ca[0])==null?void 0:ha.mailbox_count],["Shortlisted",(ga=(ma=(xa=(ua=a==null?void 0:a.data)==null?void 0:ua.user)==null?void 0:xa.activity)==null?void 0:ma[0])==null?void 0:ga.shortlist_count],["Profile Viewed",(ba=(fa=(ja=(pa=a==null?void 0:a.data)==null?void 0:pa.user)==null?void 0:ja.activity)==null?void 0:fa[0])==null?void 0:ba.profile_view_count]].map(([g,z])=>e.jsx(xe,{item:!0,xs:3,sm:6,children:e.jsxs(b,{sx:{display:"flex",flexDirection:"column",p:1,border:"1px solid #e0e0e0",borderRadius:1,backgroundColor:"#fafafa"},children:[e.jsx(S,{variant:"caption",sx:{fontSize:"0.7rem",color:"text.secondary"},children:g}),e.jsx(S,{variant:"h6",sx:{fontWeight:"bold",color:"primary.main"},children:z||"0"})]})},g))})]}),!((_a=(va=(ya=a==null?void 0:a.data)==null?void 0:ya.user)==null?void 0:va.activity)!=null&&_a.length)&&e.jsx(S,{variant:"body2",color:"text.secondary",children:"No user statistics data available for this user at the moment."}),a.data.user.media_privacy!="public"&&((Sa=(wa=a.data)==null?void 0:wa.user)==null?void 0:Sa.gender)=="Male"&&e.jsx("span",{className:"self-start rounded-lg bg-[#EF4444] px-3 py-2 text-white",children:"Photo protected"})]})]}),e.jsxs(ts,{children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(S,{variant:"h6",gutterBottom:!0,children:"Personal Information"}),e.jsxs(S,{variant:"body2",children:["Profile Completion:"," ",(Fe==null?void 0:Fe.data.total)&&`${Math.floor(Fe==null?void 0:Fe.data.total)}%`||"-"]})]}),e.jsx(Mt,{sx:{mb:2}}
4),e.jsx(xe,{container:!0,spacing:2,children:[["Name",`${u.name||"-"} ${(u==null?void 0:u.last_name)||""}`],["Email",u.email],["ZM ID",u.zm_id],["Phone",u.phone],["Target Audience",(Ca=u.meta_data)!=null&&Ca.target_audience?"Yes":"No"],["Intro Call",e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs("span",{children:[(ka=E==null?void 0:E.data)!=null&&ka.onboarding_user?"Yes ":"No ",(Na=E==null?void 0:E.data)!=null&&Na.onboarding_user?e.jsxs("span",{className:"text-sm",children:["- ",(Ia=(Aa=E==null?void 0:E.data)==null?void 0:Aa.manager)==null?void 0:Ia.name," (",Le((Ma=E==null?void 0:E.data)==null?void 0:Ma.updated_at),")"]}):null]}),!((Pa=E==null?void 0:E.data)!=null&&Pa.onboarding_user)&&e.jsx(q,{variant:"outlined",size:"small",onClick:_e,disabled:R,sx:{py:.25,px:1,fontSize:"0.75rem"},children:"Mark as intro call completed"})]})],["Age",u.age],["Gender",u.gender],["Location",u.location_description||[u.city,u.state,u.country].filter(Boolean).join(", ")||"-"],["Education",(za=u.matrimony_profile)==null?void 0:za.highest_education],["Annual Income",(Wa=u.matrimony_profile)==null?void 0:Wa.annual_income],["No of Children",(Ta=u.matrimony_profile)==null?void 0:Ta.no_of_children],["Children Living Status",Je(((La=u.matrimony_profile)==null?void 0:La.children_living_status)||"-")],["Accept Matches With Kids",jt((Ea=u.matrimony_profile)==null?void 0:Ea.accept_matches_with_kids)],["Marital Status",(Ra=u.matrimony_profile)==null?void 0:Ra.marital_status],["Employed In",($a=u.matrimony_profile)==null?void 0:$a.employed_in],["Family Status",(Fa=u.matrimony_profile)==null?void 0:Fa.family_status],["Eating Habits",(Oa=u.matrimony_profile)==null?void 0:Oa.eating_habits],["Android App",kt.android],["IOS App",kt.ios],["Linkedin Status",e.jsx("a",{className:"text-primary underline",href:((Ba=u==null?void 0:u.meta_data)==null?void 0:Ba.linkedin_profile_url)||void 0,target:"_blank",children:u.linkedin_status})],["Govt Id Status",u.aadhaar_status||u.pan_status||u.driving_license_status||"-"],["Video Verification Status",u==null?void 0:u.video_verification_status],["Plan Type",qt(u==null?void 0:u.current_plan_type)],...hi?[]:[["Plan Start Date",Le(u==null?void 0:u.premium_start_date)],["Plan Expiry Date",`${Le(u==null?void 0:u.premium_end_date)} ${(()=>{const{months:g,days:z}=Ql(u==null?void 0:u.premium_start_date,u==null?void 0:u.premium_end_date),ne=[];return g&&ne.push(`${g} month${g>1?"s":""}`),z&&ne.push(`${z} day${z>1?"s":""}`),ne.length?`(${ne.join(" ")})`:""})()}`]],["Total Chat Messages sent",((Da=B==null?void 0:B.data)==null?void 0:Da.total_messages)||"-"],["Last chat message sent at",(Va=B==null?void 0:B.data)!=null&&Va.last_message_sent_at?it(B.data.last_message_sent_at).format("DD/MM/YYYY hh:mm A"):"-"]].map(([g,z])=>{var ne,We,Ge,Oe;return e.jsx(xe,{item:!0,xs:6,children:e.jsxs(b,{sx:{display:"flex",flexDirection:"column"},children:[e.jsx(S,{variant:"caption",sx:{fontSize:"0.75rem",color:"text.secondary",mb:1},children:g}),g=="Video Verification Status"&&e.jsx(S,{sx:{display:"flex",justifyContent:"center",flexDirection:"column",alignItems:"flex-start"},variant:"body1",children:e.jsxs("div",{className:"flex items-center",children:[z||"-",e.jsxs(b,{sx:{display:"flex",gap:1,alignItems:"center",ml:1},children:[V!=null&&V.data.image_url?e.jsx(q,{variant:"outlined",size:"small",onClick:()=>G(!0),sx:{py:.25,px:1,fontSize:"0.75rem"},children:"View Image"}):e.jsx(xn,{bare:!0,enableCrop:!1,fileNamePrefix:"verification_",parentFolder:"production-user-profiles",autoAddUserParam:!0,onSuccess:Ye=>Ce(Ye),u_id:u.id,onError:Ye=>U.error(Ye.message||"Upload failed"),children:({open_file_picker:Ye,uploading:At})=>e.jsx(q,{variant:"outlined",color:"secondary",size:"small",onClick:Ye,disabled:At||J,sx:{py:.25,px:1,fontSize:"0.75rem"},children:At?"Uploading…":J?"Saving…":"Upload Image"})}),te&&(u==null?void 0:u.video_verification_status)!=="approved"&&e.jsx(q,{variant:"contained",color:"success",size:"small",onClick:()=>X(!0),disabled:o,sx:{py:.25,px:1,fontSize:"0.75rem",textTransform:"none"},children:"Approve"})]})]})}),g=="ZM ID"&&e.jsxs(S,{sx:{display:"flex",justifyContent:"center",flexDirection:"column",alignItems:"flex-start"},variant:"body1",children:[e.jsxs("div",{className:"flex items-center",children:[z||"-",e.jsx("span",{className:"ml-1",children:u.status&&`- ${u.status}${u.hide_my_profile?"(hidden by user)":""}`}),u.is_spam&&e.jsx("span",{className:"ml-2 font-semibold text-red-500",children:"(Spam)"}),e.jsx(Kt,{text:u.zm_id,onCopy:()=>U.success("Copied SSId Successfully!"),children:e.jsx(re,{children:e.jsx(mn,{})})})]}),bt&&e.jsxs("span",{className:"text-xs text-secondary-gray",children:["Scheduled Activation:"," ",e.jsx("span",{className:"font-semibold",children:it(bt).format(er)})]}),e.jsx(Kt,{text:`${(ne=Z==null?void 0:Z.data)==null?void 0:ne.url}?is_staff=true`,onCopy:we,children:e.jsx(q,{variant:"text",children:"Copy Login Link"})})]}),g=="Govt Id Status"&&e.jsx("div",{children:e.jsx(ye,{placement:"bottom",title:e.jsxs(e.Fragment,{children:[e.jsxs("span",{children:["Aadhaar: ",u.aadhaar_status||"-"]}),e.jsx("br",{}),e.jsxs("span",{children:["Pan: ",u.pan_status||"-"]}),e.jsx("br",{}),e.jsxs("span",{children:["Driving Licence:"," ",u.driving_license_status||"-"]}),e.jsx("br",{})]}),children:e.jsx("span",{className:"text-wrap",children:z||"-"})})}),g=="Phone"&&e.jsxs(S,{sx:{display:"flex",alignItems:"center"},variant:"body1",children:[z||"-",e.jsx(Kt,{onCopy:()=>U.success("Copied Successfully!"),text:z,children:e.jsx(re,{onClick:Ye=>Ye.stopPropagation(),children:e.jsx(mn,{})})}),e.jsx(re,{onClick:()=>$t(z||"-"),children:e.jsx(tr,{})}),e.jsx(re,{onClick:()=>{window.open(`https://wa.me/${mr(z)}`,"_blank")},children:e.jsx(gn,{})})]}),(g=="Android App"||g=="IOS App")&&z,g=="Name"&&e.jsxs("div",{className:"flex items-center",children:[e.jsxs("p",{className:"max-w-[80%]",children:[" ",e.jsxs("a",{className:"mr-2 block text-primary underline",target:"_blank",href:`/view-profile/${u==null?void 0:u.zm_id}`,rel:"noreferrer",children:[(u==null?void 0:u.name)||"-"," ",(u==null?void 0:u.last_name)||""]})," "]}),e.jsxs("div",{className:"flex items-center",children:[((We=u==null?void 0:u.meta_data)==null?void 0:We.target_audience)&&e.jsx(ye,{title:"Target Audience",children:e.jsx("img",{className:"max-w-[25px] object-fill",src:un})}),"is_premium_active"in u&&(u==null?void 0:u.is_premium_active)&&e.jsx(ye,{title:e.jsxs("div",{children:[e.jsx("p",{children:qt(u==null?void 0:u.current_plan_type)}),e.jsx("p",{children:typeof((Ge=u==null?void 0:u.credit_account)==null?void 0:Ge.balance)=="number"&&`${(Oe=u==null?void 0:u.credit_account)==null?void 0:Oe.balance} Credits`})]}),children:e.jsx("img",{className:"ml-1 h-[25px] w-[25px]",src:ss})})]})]}),g!="ZM ID"&&g!="Phone"&&g!="Android App"&&g!="IOS App"&&g!="Name"&&g!="Video Verification Status"&&g!="Govt Id Status"&&e.jsx(S,{variant:"body1",children:z||"-"})]})},g)})}),e.jsx(Kr,{preferences:I==null?void 0:I.data})]})]})}),e.jsxs(xe,{item:!0,xs:12,md:6,children:[e.jsx(Bt,{variant:"outlined",sx:{mb:2,display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",py:3},children:e.jsxs(b,{sx:{width:"100%",px:2},children:[e.jsx(b,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2},children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx(S,{variant:"h6",children:"User Summary"}),e.jsx(re,{target:"_blank",href:sr(u.phone),children:e.jsx(Wr,{})}),e.jsx(re,{target:"_blank",href:ar(u.phone),children:e.jsx(Lr,{})}),e.jsx(re,{onClick:()=>
4{u.phone&&x(u.phone)},children:e.jsx(nr,{})})]})}),e.jsxs(b,{sx:{p:2,borderRadius:2},children:[e.jsx(Ot,{label:"Key Observations",savedValue:(Ua=a==null?void 0:a.data)==null?void 0:Ua.notes,rows:4,isSaving:T,onSave:async g=>{await A({note:g}),await n(),U.success("Note Updated!")}}),e.jsx(Ot,{label:"Partner Expectations",savedValue:(Ha=a==null?void 0:a.data)==null?void 0:Ha.actual_partner_preference,rows:2,isSaving:T,onSave:async g=>{await A({actual_partner_preference:g}),await n(),U.success("Preference Updated!")}}),O.length>0&&e.jsxs(b,{sx:{mt:-1.5,mb:2,px:1.5,display:"flex",alignItems:"center",justifyContent:"space-between",gap:1,flexWrap:"wrap"},children:[e.jsxs(S,{variant:"caption",sx:{color:"#777"},children:[es(O[0].created_at)," ","Updated By"," ",((Ga=O[0].user)==null?void 0:Ga.name)||"Unknown"]}),O.length>1&&e.jsx(q,{size:"small",onClick:()=>L(!0),sx:{textTransform:"none",p:0,minWidth:0},children:"View previous history"})]}),e.jsx(Ot,{label:"Best Time to Call",savedValue:(Ya=a==null?void 0:a.data)==null?void 0:Ya.call_time,rows:1,isSaving:T,onSave:async g=>{await A({call_time:g}),await n(),U.success("Call Time Updated!")}}),e.jsx(Ot,{label:"Matchmaker's Insight (viewable by users)",savedValue:`${((qa=f==null?void 0:f.data)==null?void 0:qa.special_description)??""}`,rows:1,isSaving:!1,onSave:async g=>{await ir(a==null?void 0:a.data.user.id,g),v(),U.success("Description Updated!")},display_label:`${((Ka=f==null?void 0:f.data)==null?void 0:Ka.special_description)??"-"} ${(Za=f==null?void 0:f.data)!=null&&Za.change_request_pending?"(Change request pending)":""}`}),e.jsxs(b,{sx:{mb:2,p:1.5,backgroundColor:"#fff",borderRadius:1,boxShadow:"0 1px 3px rgba(0,0,0,0.1)",position:"relative"},children:[e.jsx(S,{variant:"body1",sx:{fontWeight:600,color:"#555",mb:.5},children:"Preferred Contact Method"}),e.jsx(S,{variant:"body1",className:"!w-max",sx:{whiteSpace:"pre-wrap",backgroundColor:($==null?void 0:$.data.preferred_contact_method)=="Both Call & WhatsApp"?"#3CCD78":($==null?void 0:$.data.preferred_contact_method)=="Call Only"?"#007DFF":"#FF505F",color:"white",borderRadius:1,p:.5},children:($==null?void 0:$.data.preferred_contact_method)||"-"})]}),e.jsx(b,{sx:{textAlign:"right",mt:1},children:e.jsxs(S,{variant:"caption",sx:{color:"#777"},children:[((Xa=a==null?void 0:a.data)==null?void 0:Xa.notes_updated_at)&&es((Ja=a==null?void 0:a.data)==null?void 0:Ja.notes_updated_at)," ",((en=(Qa=a==null?void 0:a.data)==null?void 0:Qa.notes_updated_by)==null?void 0:en.name)&&`Updated By ${a.data.notes_updated_by.name}`]})})]})]})}),e.jsxs(Bt,{variant:"outlined",sx:{mb:2},children:[e.jsxs(ts,{className:"flex items-center gap-2",children:[e.jsx(S,{variant:"h6",children:"User Details"}),e.jsx(re,{onClick:()=>je(a.data.user.zm_id||null),children:e.jsx(lr,{})}),e.jsx(re,{onClick:()=>qe(!0),children:e.jsx(Ir,{})}),e.jsx(re,{onClick:()=>at(!0),children:e.jsx(gn,{})}),e.jsx(re,{onClick:()=>{ie(!0)},children:e.jsx(gr,{})})]}),e.jsx(Mt,{}),e.jsxs(xe,{container:!0,spacing:2,p:2,children:[e.jsx(xe,{item:!0,xs:12,md:4,children:e.jsxs(b,{sx:{display:"flex",flexDirection:"column"},children:[e.jsxs(S,{variant:"caption",sx:{fontSize:"0.75rem",color:"text.secondary",mb:.5},children:["Leads Source"," ",e.jsx(ye,{title:`UTM Source: ${u==null?void 0:u.utm_source}`,children:e.jsx("span",{className:"ml-1 inline-flex h-4 w-4 items-center justify-center rounded-full border border-blue-400 text-blue-400",children:e.jsx("i",{className:"material-icons",style:{fontSize:12,verticalAlign:"middle"},children:"i"})})})]}),e.jsx(jn,{components:{DropdownIndicator:g=>{const{selectProps:{menuIsOpen:z}}=g;return e.jsx(fn.DropdownIndicator,{...g,children:z?e.jsx(pn,{}):e.jsx(Dt,{})})}},onChange:g=>me(g),placeholder:"Lead Source",defaultValue:se.find(g=>g.value===Nt),options:se,styles:hs,menuPortalTarget:document.body,menuPosition:"fixed"})]})}),e.jsx(xe,{item:!0,xs:12,md:4,children:e.jsxs(b,{sx:{display:"flex",flexDirection:"column"},children:[e.jsx(S,{variant:"caption",sx:{fontSize:"0.75rem",color:"text.secondary",mb:.5},children:"Interested In Assisted"}),e.jsx(jn,{components:{DropdownIndicator:g=>{const{selectProps:{menuIsOpen:z}}=g;return e.jsx(fn.DropdownIndicator,{...g,children:z?e.jsx(pn,{}):e.jsx(Dt,{})})}},onChange:g=>Me(g),placeholder:"",isClearable:!0,value:((tn=a==null?void 0:a.data)==null?void 0:tn.interested_in_assisted)===!0?de.find(g=>g.value==="yes"):((sn=a==null?void 0:a.data)==null?void 0:sn.interested_in_assisted)===!1?de.find(g=>g.value==="no"):null,options:de,styles:hs,menuPortalTarget:document.body,menuPosition:"fixed"})]})})]})]}),e.jsx(Gr,{setUserTags:g=>be(g),tags:W,userTags:oe,topicId:a.data.id||"",refetch:()=>n(),user_id:a.data.user.id,notification_preference:I==null?void 0:I.data,ph:(nn=(an=a==null?void 0:a.data)==null?void 0:an.user)==null?void 0:nn.phone})]})]}),e.jsx("div",{className:"mt-5",children:e.jsx(Vd,{setSelectedIds:g=>
4Ae(g),setAdminSendMatchesMailDialog:()=>je(a.data.user.zm_id||null),gender:a.data.user.gender,id:a.data.user.id,age:a.data.user.age,userId:a.data.user.zm_id})})]}),e.jsx(pr,{isModalOpen:Pe,handleCloseModel:()=>ze(!1),children:e.jsx(jr,{images:a.data.user.images,selected_image:He,onModalOpen:d,show_status:he==null?void 0:he.is_admin,media_privacy:(ln=a==null?void 0:a.data)==null?void 0:ln.user.media_privacy})}),e.jsx(rr,{onConfirm:P,loading:ut,open:ke,onClose:()=>ee(!ke)}),e.jsx(fr,{profile_name:a.data.user.name,handleClose:()=>je(null),zm_id:Ne,selected_ids:ue,profile_img:(rn=a.data.user)==null?void 0:rn.images.find(g=>g.is_primary),profile_gender:a.data.user.gender}),e.jsx(Kd,{user_id:a.data.user.id,open:ht,onClose:()=>at(!ht),phone:a.data.user.phone}),e.jsx(br,{onClose:()=>ie(!1),open:ce,setSelectedIds:g=>Ae(g),setOpenMailModal:()=>{je(a.data.user.zm_id)},profile_zm_ids:[a.data.user.zm_id]}),e.jsx(Jd,{user_email:a.data.user.email,user_id:a.data.user.id,open:st,onClose:()=>qe(!1)}),e.jsxs(lt,{open:k,onClose:()=>L(!1),maxWidth:"sm",fullWidth:!0,children:[e.jsxs(pt,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",pr:1},children:["Partner Expectations History",e.jsx(re,{size:"small",onClick:()=>L(!1),children:e.jsx(Ut,{fontSize:"small"})})]}),e.jsx(rt,{dividers:!0,children:O.map(g=>{var z;return e.jsxs(b,{sx:{mb:2,pb:2,borderBottom:"1px solid #eee","&:last-child":{mb:0,pb:0,borderBottom:"none"}},children:[e.jsxs(S,{variant:"caption",sx:{color:"#777"},children:[es(g.created_at)," — ",((z=g.user)==null?void 0:z.name)||"Unknown"]}),e.jsx(S,{variant:"body2",sx:{whiteSpace:"pre-wrap",color:"#333",mt:.5},children:g.comment.replace("#robot #partner_expectation_change","").trim()})]},g.id)})})]}),e.jsxs(lt,{open:y,onClose:()=>G(!1),maxWidth:"sm",fullWidth:!0,children:[e.jsxs(pt,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",pr:1},children:["Verification Image",e.jsxs(b,{sx:{display:"flex",gap:.5},children:[e.jsx(xn,{bare:!0,enableCrop:!1,fileNamePrefix:"verification_",parentFolder:"production-user-profiles",autoAddUserParam:!0,u_id:u.id,onSuccess:g=>Ce(g,"patch"),onError:g=>U.error(g.message||"Upload failed"),children:({open_file_picker:g,uploading:z})=>e.jsx(ye,{title:"Replace image",children:e.jsx("span",{children:e.jsx(re,{onClick:g,disabled:z||J,size:"small",children:e.jsx(Dt,{fontSize:"small"})})})})}),e.jsx(re,{onClick:()=>G(!1),size:"small",children:e.jsx(Ut,{fontSize:"small"})})]})]}),e.jsx(rt,{sx:{display:"flex",justifyContent:"center",p:2},children:J?e.jsxs(b,{sx:{display:"flex",flexDirection:"column",alignItems:"center",gap:2,py:4},children:[e.jsx(Re,{size:32}),e.jsx(S,{variant:"body2",color:"text.secondary",children:"Saving new image…"})]}):V!=null&&V.data.image_url?e.jsx("img",{src:V==null?void 0:V.data.image_url,alt:"Verification",style:{maxWidth:"100%",maxHeight:"70vh",objectFit:"contain",borderRadius:8}}):null})]}),e.jsx(eo,{open:Y,onClose:()=>X(!1),userName:(u==null?void 0:u.name)||(u==null?void 0:u.zm_id),onConfirm:fe,isLoading:o})]})};function eo({open:t,onClose:s,userName:i,onConfirm:r,isLoading:p}){const[x,a]=h.useState("");return h.useEffect(()=>{t||a("")},[t]),e.jsxs(lt,{open:t,onClose:()=>{p||s()},maxWidth:"xs",fullWidth:!0,children:[e.jsx(pt,{sx:{fontWeight:600},children:"Approve Video Verification"}),e.jsxs(rt,{children:[e.jsxs(dr,{sx:{mb:2},children:["Are you sure you want to approve video verification for"," ",e.jsx("strong",{children:i||"this user"}),"? This will mark their profile as video verified, notify the user, and record this action under your account."]}),e.jsx(ge,{fullWidth:!0,label:"Optional Remarks / Notes",placeholder:"e.g. Verified via WhatsApp call on 7th Sep",value:x,onChange:m=>a(m.target.value),multiline:!0,rows:2,size:"small",autoFocus:!0})]}),e.jsxs(as,{sx:{px:3,pb:2},children:[e.jsx(q,{onClick:s,disabled:p,variant:"outlined",size:"small",children:"Cancel"}),e.jsx(q,{onClick:()=>r(x),disabled:p,variant:"contained",color:"success",size:"small",children:p?"Approving…":"Confirm Approve"})]})]})}function to({credit_details:t,totalVirtualMeet:s=0}){const i=h.useMemo(()=>!t||typeof t.total_deduction_other!="number"||typeof t.total_deposit!="number"?0:t.total_deduction_other/t.total_deposit*100,[t]),r=h.useMemo(()=>!t||typeof t.total_deduction_meet!="number"||typeof t.total_deposit!="number"?0:t.total_deduction_meet/t.total_deposit*100,[t]),p=h.useMemo(()=>!t||typeof t.total_deduction_refund!="number"||typeof t.total_deposit!="number"?0:t.total_deduction_refund/t.total_deposit*100,[t]),x=h.useMemo(()=>typeof(t==null?void 0:t.balance)=="number"&&typeof(t==null?void 0:t.total_deposit_remaining)=="number"&&t.balance!=t.total_deposit_remaining?e.jsxs("span",{className:"text-xs text-red-500",children:[e.jsx("br",{})," Incorrect Balance ",t.balance," credits"]}):"",[t]),a=ai();return e.jsxs(Be,{className:"mx-auto w-full max-w-2xl",sx:{borderRadius:"12px",padding:"12px",backgroundColor:"#ffffff"},children:[e.jsxs(b,{children:[e.jsxs(S,{variant:"h5",className:"font-semibold text-gray-800",sx:{fontSize:"0.8rem",fontWeight:600,mb:1},children:["Credits Overview",x]}),e.jsx("hr",{className:"mb-2"})]}),e.jsxs(b,{className:"space-y-3",children:[e.jsxs(b,{className:"flex items-center justify-between",children:[e.jsxs(S,{fontSize:"0.7rem",className:"font-medium text-gray-700",children:["Used:"," ",e.jsxs("span",{className:"text-[14px] font-semibold",children:[(t==null?void 0:t.total_deduction)||0," Credits"]})]}),e.jsxs(S,{fontSize:"0.7rem",className:"font-medium text-gray-700",children:["Remaining:"," ",e.jsx(ye,{title:(t==null?void 0:t.balance)||0,children:e.jsxs("span",{className:"text-[14px] font-semibold",children:[(t==null?void 0:t.total_deposit_remaining)||0," Credits"]})})]})]}),e.jsxs(b,{className:"space-y-2",children:[e.jsxs(b,{className:"flex h-6 w-full overflow-hidden rounded-md bg-gray-200",children:[e.jsx(ye,{title:`${(t==null?void 0:t.total_deduction_refund)||0} refunded`,children:e.jsx(b,{className:"bg-red-500 transition-all duration-300 ease-out",sx:{width:`${p}%`}})}),e.jsx(ye,{title:`${(t==null?void 0:t.total_deduction_other)||0} other`,children:e.jsx(b,{className:"bg-gray-500 transition-all duration-300 ease-out",sx:{width:`${i}%`}})}),e.jsx(ye,{title:`${(t==null?void 0:t.total_deduction_meet)||0} Virtual meet`,children:e.jsx(b,{className:"bg-orange-400 transition-all duration-300 ease-out",sx:{width:`${r}%`}})}),e.jsx(ye,{title:`${(t==null?void 0:t.total_deposit_remaining)||0} Remaining`,children:e.jsx(b,{className:"flex-1 bg-green-500"})})]}),e.jsxs(b,{className:"flex justify-between text-sm font-medium text-gray-700",children:[e.jsxs(S,{variant:"body2",className:"font-medium",children:["₹ ",t==null?void 0:t.total_amount_used]}),e.jsxs(S,{variant:"body2",className:"font-medium",children:["₹",t==null?void 0:t.total_deposit_remaining_price]})]})]}),e.jsxs(b,{className:"flex items-center justify-between border-t border-gray-200 pt-4",children:[e.jsx(b,{className:"flex items-center gap-3",children:e.jsxs(S,{fontSize:"0.7rem",variant:"body2",className:"font-medium text-gray-700",children:["Total Purchased - ",(t==null?void 0:t.total_deposit)||0," / ₹",t==null?void 0:t.total_amount_collected]})}),e.jsxs(b,{className:"flex items-center gap-2",children:[e.jsxs(S,{fontSize:"0.7rem",variant:"body2",className:"font-medium text-gray-700",children:["Total Virtual Meet - ",s]}),e.jsx(S,{onClick:()=>{a("?tab=virtual_meet")},fontSize:"0.7rem",className:"cursor-pointer text-primary underline",children:"View More"})]})]})]})]})}export{po 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.