1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3993],{80985:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin/crm",function(){return n(72218)}])},99534:function(e,t,n){"use strict";n.d(t,{$4:function(){return j},Af:function(){return b},Gu:function(){return h},Hy:function(){return i},IU:function(){return p},LH:function(){return u},Mz:function(){return l},NA:function(){return v},OV:function(){return m},Qq:function(){return g},SZ:function(){return c},VT:function(){return o},Ve:function(){return S},Zr:function(){return f},_V:function(){return d},aq:function(){return N},i0:function(){return C},nO:function(){return x},xn:function(){return s},yI:function(){return a},yS:function(){return y}});var r=n(84858);let a=()=>(0,r.SC)("/api/admin/crm/stages"),i=e=>(0,r.SC)("/api/admin/crm/stages",{method:"POST",body:JSON.stringify({title:e})}),s=(e,t)=>(0,r.SC)(`/api/admin/crm/stages/${e}`,{method:"PATCH",body:JSON.stringify({title:t})}),l=(e,t)=>(0,r.SC)(`/api/admin/crm/stages/${e}/move`,{method:"POST",body:JSON.stringify({direction:t})}),d=e=>(0,r.SC)(`/api/admin/crm/stages/${e}`,{method:"DELETE"}),c=e=>{let{filter:t,q:n,minStars:a,tags:i}=e,s=new URLSearchParams({filter:t});return n&&s.set("q",n),a&&s.set("minStars",String(a)),(null==i?void 0:i.length)&&s.set("tags",i.join(",")),(0,r.SC)(`/api/admin/crm/board?${s.toString()}`)},o=e=>(0,r.SC)("/api/admin/crm/cards/search-phone",{method:"POST",body:JSON.stringify({phone:e})}),u=e=>(0,r.SC)("/api/admin/crm/cards",{method:"POST",body:JSON.stringify(e)}),x=e=>(0,r.SC)(`/api/admin/crm/cards/${e}`),m=(e,t)=>(0,r.SC)(`/api/admin/crm/cards/${e}`,{method:"PATCH",body:JSON.stringify(t)}),g=(e,t,n)=>(0,r.SC)(`/api/admin/crm/cards/${e}/stage`,{method:"PATCH",body:JSON.stringify({stageId:t,order:n})}),p=(e,t)=>{let n=new URLSearchParams;return Object.entries(t).forEach(e=>{let[t,r]=e;void 0!==r&&""!==r&&n.set(t,Array.isArray(r)?r.join(","):String(r))}),(0,r.SC)(`/api/admin/crm/cards/${e}/search-residences?${n.toString()}`)},f=e=>(0,r.SC)(`/api/admin/crm/neighborhoods${e?`?cityId=${e}`:""}`),h=e=>(0,r.SC)(`/api/admin/crm/cards/${e}/residences`),b=(e,t)=>(0,r.SC)(`/api/admin/crm/cards/${e}/residences`,{method:"POST",body:JSON.stringify({residenceId:t})}),y=(e,t)=>(0,r.SC)(`/api/admin/crm/cards/${e}/residences/${t}`,{method:"DELETE"}),C=e=>(0,r.SC)(`/api/admin/crm/cards/${e}/residences`,{method:"DELETE"}),j=e=>(0,r.SC)(`/api/admin/crm/cards/${e}/send-link`,{method:"POST"}),v=(e,t)=>(0,r.SC)(`/api/admin/crm/cards/${e}/residences/${t}/send-link`,{method:"POST"}),N=(e,t)=>(0,r.SC)(`/api/admin/crm/cards/${e}/reservation`,{method:"POST",body:JSON.stringify({residenceId:t})}),S=e=>(0,r.SC)(`/api/admin/crm/cards/${e}/guest-history`)},19365:function(e,t,n){"use strict";n.d(t,{n:function(){return i}});var r=n(85893),a=n(67294);function i(e){let{value:t,onChange:n}=e,[i,s]=(0,a.useState)(null),l=i??t??0;return(0,r.jsx)("span",{className:"inline-flex items-center gap-x-2",onMouseLeave:()=>s(null),children:[1,2,3].map(e=>(0,r.jsx)("button",{type:"button",onMouseEnter:()=>s(e),onClick:r=>{r.stopPropagation(),n(t===e?null:e)},className:"leading-none","aria-label":`${e} ستارÙ`,children:(0,r.jsx)("i",{className:`${e<=l?"icon-StarFill text-[#FFB800]":"icon-Star text-gray-D2D2D7"} text-14`})},e))})}},18730:function(e,t,n){"use strict";n.d(t,{Ps:function(){return i},U4:function(){return s},sM:function(){return a}});var r=n(85893);let a=[{value:"NO_DOCS",label:"بدÙÙ Ù
دارک"},{value:"POOL",label:"استخردار"},{value:"PARKING",label:"پارکÛÙÚ¯ دار"},{value:"LUXURY",label:"ÙÙکس"},{value:"CHEAP",label:"ارزاÙ"}],i={NO_DOCS:{bg:"#F0F0F0",text:"#6C6A7D",border:"#C4CAD3"},POOL:{bg:"#E8F1FF",text:"#1B4F9C",border:"#5B9BFF"},PARKING:{bg:"#FFF4E0",text:"#B26A00",border:"#FFB74D"},LUXURY:{bg:"#F1EAFE",text:"#5B32B0",border:"#B18AF0"},CHEAP:{bg:"#03D6BB14",text:"#015046",border:"#03D6BB"}};function s(e){let{options:t,value:n,onChange:a}=e;return(0,r.jsx)("div",{className:"flex flex-wrap gap-8",children:t.map(e=>{let t=n.includes(e.value),s=i[e.value]??i.NO_DOCS;return(0,r.jsx)("button",{type:"button","aria-pressed":t,onClick:()=>{var t;return t=e.value,void a(n.includes(t)?n.filter(e=>e!==t):[...n,t])},style:t?{backgroundColor:s.bg,color:s.text,borderColor:s.border}:void 0,className:`px-14 py-8 rounded-10 text-13 leading-20 border transition ${t?"font-m":"border-gray-E5E5E6 text-gray-6C6A7D hover:border-gray-C4CAD3"}`,children:e.label},e.value)})})}},72218:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return j}});var r=n(85893),a=n(67294),i=n(11163),s=n(44389),l=n(28627),d=n(49759),c=n(32474),o=n(99534),u=n(19365);function x(e){let{actors:t}=e;return t.length?(0,r.jsx)("span",{className:"inline-flex items-center",children:t.slice(0,4).map((e,n)=>(0,r.jsx)("span",{title:e.name??void 0,style:{marginRight:0===n?0:-8,zIndex:t.length-n},className:"relative w-24 h-24 rounded-full border-2 border-white bg-gray-F0F0F0 overflow-hidden flex items-center justify-center",children:e.avatarUrl?(0,r.jsx)("img",{src:(0,c.vD)(e.avatarUrl,96),alt:e.name??"",className:"w-full h-full object-cover"}):(0,r.jsx)("span",{className:"text-10 leading-none text-gray-6C6A7D font-m",children:(e.name??"Ø").trim().charAt(0)})},e.id))}):null}var m=n(18730);let g=Object.fromEntries(m.sM.map(e=>[e.value,e.label])),p={GUEST:"Ù
ÙÙ
اÙ",HOST:"Ù
ÛØ²Ø¨Ø§Ù",OTHER:"طر٠Ù
ÙØ§Ø¨Ù"};function f(e){var t;let{card:n,onStarsChange:a}=e,s=(0,i.useRouter)(),l=(null===(t=n.lastCall)||void 0===t?void 0:t.direction)==="OUTBOUND",d=n.lastCall?p[n.lastCall.party]??"":"";return(0,r.jsxs)("div",{onClick:()=>s.push(`/admin/crm/${n.id}`),className:"bg-white rounded-14 p-14 flex flex-col gap-y-8 cursor-pointer border border-gray-E5E5E6 hover:shadow-[0_4px_16px_rgba(24,39,58,0.1)] transition",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between gap-x-8",children:[(0,r.jsx)("span",{className:"text-12 leading-18 font-m text-gray-6C6A7D",children:n.city??"بدÙÙ Ø´ÙØ±"}),(0,r.jsx)(u.n,{value:n.stars,onChange:a})]}),(0,r.jsxs)("div",{className:"flex items-center gap-x-6 text-13 leading-20 text-gray-6C6A7D",dir:"ltr",children:[(0,r.jsx)("i",{className:"icon-PhoneFill text-12"}),(0,r.jsx)("span",{children:n.phone})]}),(0,r.jsxs)("div",{className:"flex items-center justify-between gap-x-8",children:[(0,r.jsx)("span",{className:"text-14 leading-22 font-m text-black truncate",children:n.guestName||"بدÙÙ ÙØ§Ù
"}),(0,r.jsx)(x,{actors:n.touchedBy})]}),n.lastCall&&(0,r.jsxs)("div",{className:"flex items-center justify-between gap-x-8 text-12 leading-18",children:[(0,r.jsxs)("span",{className:"inline-flex items-center gap-x-6",children:[(0,r.jsx)("span",{className:"w-20 h-20 rounded-full flex items-center justify-center text-white shrink-0",style:{backgroundColor:l?"#E53935":"#03B37E"},children:(0,r.jsx)("i",{className:"icon-PhoneFill text-10"})}),(0,r.jsxs)("span",{className:"text-gray-6C6A7D",children:[l?"با":"از"," ",d]})]}),(0,r.jsx)("span",{className:"text-11 leading-16 text-gray-9B9BAA whitespace-nowrap",children:(0,c.A1)(n.lastCall.createdAt)[0]})]}),n.lastLog&&(0,r.jsx)("p",{className:"text-12 leading-18 text-gray-6C6A7D",style:{display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},children:n.lastLog.summary}),(n.nightsCount||n.guestsCount)&&(0,r.jsxs)("div",{className:"flex items-center gap-x-10 text-11 leading-16 text-gray-6C6A7D",children:[!!n.nightsCount&&(0,r.jsxs)("span",{children:[(0,c.N)(n.nightsCount)," شب"]}),!!n.guestsCount&&(0,r.jsxs)("span",{children:[(0,c.N)(n.guestsCount)," ÙÙØ±"]})]}),n.tags.length>0&&(0,r.jsx)("div",{className:"flex flex-wrap gap-6 pt-4",children:n.tags.map(e=>{let t=m.Ps[e]??m.Ps.NO_DOCS;return(0,r.jsx)("span",{style:{backgroundColor:t.bg,color:t.text},className:"px-8 py-2 rounded-8 text-11 leading-18 font-m",children:g[e]??e},e)})})]})}let h=["#FFC13B","#5B9BFF","#8B5CF6","#03D6BB","#F97066","#2DD4BF"];function b(e,t){let n=parseInt(e.slice(1),16);return`rgba(${n>>16&255}, ${n>>8&255}, ${255&n}, ${t})`}function y(e){let{stage:t,index:n,onRename:i,onDelete:s,onMove:d,onStarsChange:o}=e,[u,x]=(0,a.useState)(!1),[m,g]=(0,a.useState)(t.title),[p,y]=(0,a.useState)(!1),C=h[n%h.length];function j(){x(!1);let e=m.trim();e&&e!==t.title?i(e):g(t.title)}return(0,r.jsxs)("div",{style:{backgroundColor:b(C,.08)},className:"w-[280px] shrink-0 flex flex-col rounded-16 max-h-full",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between gap-x-8 px-14 py-12",children:[u?(0,r.jsx)("input",{autoFocus:!0,value:m,onChange:e=>g(e.target.value),onBlur:j,onKeyDown:e=>{"Enter"===e.key&&j(),"Escape"===e.key&&(g(t.title),x(!1))},className:"flex-1 min-w-0 px-8 py-4 rounded-8 border border-primary-main text-13 leading-20 outline-none"}):(0,r.jsxs)("button",{onClick:()=>x(!0),title:"Ø¨Ø±Ø§Û ÙÛØ±Ø§ÛØ´ Ú©ÙÛÚ© Ú©Ù",className:"flex-1 min-w-0 flex items-center gap-x-8 text-right text-13 leading-20 font-m text-black",children:[(0,r.jsx)("span",{className:"w-8 h-8 rounded-full shrink-0",style:{backgroundColor:C}}),(0,r.jsx)("span",{className:"truncate",children:t.title}),(0,r.jsx)("span",{className:"w-22 h-22 shrink-0 rounded-full flex items-center justify-center text-11 text-white",style:{backgroundColor:C},children:(0,c.N)(t.cards.length)})]}),(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsx)("button",{onClick:()=>y(e=>!e),"aria-label":"ØªÙØ¸ÛÙ
ات Ù
رØÙÙ",className:"w-24 h-24 rounded-8 flex items-center justify-center text-gray-6C6A7D hover:bg-white transition",children:(0,r.jsx)("i",{className:"icon-Details text-14"})}),p&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"fixed inset-0 z-20",onClick:()=>y(!1)}),(0,r.jsxs)("div",{className:"absolute left-0 top-full mt-4 z-30 w-[180px] bg-white rounded-12 border border-gray-E5E5E6 shadow-[0_8px_24px_rgba(24,39,58,0.14)] py-6",children:[(0,r.jsx)("button",{onClick:()=>{y(!1),d("prev")},className:"w-full px-14 py-8 text-13 leading-20 text-black hover:bg-gray-F5F5F7 text-right",children:"جابجاÛÛ Ø¨Ù ÙØ¨Ù"}),(0,r.jsx)("button",{onClick:()=>{y(!1),d("next")},className:"w-full px-14 py-8 text-13 leading-20 text-black hover:bg-gray-F5F5F7 text-right",children:"جابجاÛÛ Ø¨Ù Ø¨Ø¹Ø¯"}),(0,r.jsx)("button",{onClick:()=>{y(!1),x(!0)},className:"w-full px-14 py-8 text-13 leading-20 text-black hover:bg-gray-F5F5F7 text-right",children:"ÙÛØ±Ø§ÛØ´ ÙØ§Ù
"}),(0,r.jsx)("button",{onClick:()=>{y(!1),window.confirm(`Ù
رØÙÙâÛ \xab${t.title}\xbb ØØ°Ù Ø´ÙØ¯Ø`)&&s()},className:"w-full px-14 py-8 text-13 leading-20 text-[#E53935] hover:bg-[#FFEBEB] text-right",children:"ØØ°Ù"})]})]})]})]}),(0,r.jsx)(l.bK,{droppableId:String(t.id),children:(e,n)=>(0,r.jsxs)("div",{ref:e.innerRef,...e.droppableProps,style:n.isDraggingOver?{backgroundColor:b(C,.22)}:void 0,className:"flex-1 min-h-[80px] overflow-y-auto px-10 pb-10 flex flex-col gap-y-10 rounded-b-16 transition-colors",children:[t.cards.map((e,t)=>(0,r.jsx)(l._l,{draggableId:String(e.id),index:t,children:(t,n)=>(0,r.jsx)("div",{ref:t.innerRef,...t.draggableProps,...t.dragHandleProps,style:{...t.draggableProps.style,opacity:n.isDragging?.85:1},children:(0,r.jsx)(f,{card:e,onStarsChange:t=>o(e.id,t)}
1)})},e.id)),e.placeholder]})})]})}let C=[{key:"today",label:"اÙ
Ø±ÙØ²"},{key:"yesterday",label:"Ø¯ÛØ±Ùز"},{key:"all",label:"ÙÙ
Ù"}];function j(){let e=(0,i.useRouter)(),[t,n]=(0,a.useState)("today"),[u,x]=(0,a.useState)(""),[m,g]=(0,a.useState)("");(0,a.useEffect)(()=>{let e=setTimeout(()=>g(u.trim()),350);return()=>clearTimeout(e)},[u]);let{data:p,isLoading:f,mutate:h}=(0,s.u)(`crm-board-${t}-${m}`,()=>(0,o.SZ)({filter:t,q:m||void 0}));async function b(e){if(!p)return;let{source:t,destination:n,draggableId:r}=e;if(!n||t.droppableId===n.droppableId&&t.index===n.index)return;let a=p.find(e=>String(e.id)===t.droppableId),i=p.find(e=>String(e.id)===n.droppableId),s=a.cards.find(e=>String(e.id)===r),l=i.cards.filter(e=>e.id!==s.id),d=l[n.index-1],c=l[n.index],u=d&&c?(d.order+c.order)/2:d?d.order+1:c?c.order-1:0;h(e=>null==e?void 0:e.map(e=>{if(e.id===a.id&&e.id!==i.id)return{...e,cards:e.cards.filter(e=>e.id!==s.id)};if(e.id===i.id){let t=e.id===a.id?e.cards.filter(e=>e.id!==s.id):e.cards,r=[...t];return r.splice(n.index,0,{...s,stageId:i.id,order:u}),{...e,cards:r}}return e}),{revalidate:!1});try{await (0,o.Qq)(s.id,i.id,u)}finally{h()}}async function j(e,t,n){h(r=>null==r?void 0:r.map(r=>r.id===e?{...r,cards:r.cards.map(e=>e.id===t?{...e,stars:n}:e)}:r),{revalidate:!1}),await (0,o.OV)(t,{stars:n}),h()}async function v(){let e=window.prompt("عÙÙØ§Ù Ù
رØÙÙâÛ ØªØ§Ø²ÙØ");(null==e?void 0:e.trim())&&(await (0,o.Hy)(e.trim()),h())}return(0,r.jsx)(d.Z,{children:(0,r.jsxs)("div",{className:"flex flex-col gap-y-16 h-[calc(100vh-32px)]",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between gap-x-16 flex-wrap gap-y-10",children:[(0,r.jsx)("h1",{className:"text-18 leading-28 font-m text-black",children:"Ø¯Ø±Ø®ÙØ§Ø³ØªâÙØ§ â CRM رزر٠تÙÙÙÛ"}),(0,r.jsx)(c.zx,{onClick:()=>e.push("/admin/crm/new"),children:"+ Ø¯Ø±Ø®ÙØ§Ø³Øª تازÙ"})]}),(0,r.jsx)(c.Zb,{className:"px-16 py-12 flex flex-col gap-y-12",children:(0,r.jsxs)("div",{className:"flex items-center justify-between gap-x-16 flex-wrap gap-y-10",children:[(0,r.jsx)(c.Qm,{tabs:C,value:t,onChange:n}),(0,r.jsx)(c.Hf,{value:u,onChange:x,placeholder:"جستجÙÛ ÙØ§Ù
Ø Ø´Ù
Ø§Ø±Ù ÛØ§ Ø´ÙØ±..."})]})}),f||!p?(0,r.jsx)(c.Od,{className:"h-[400px]"}):0===p.length?(0,r.jsx)(c.ub,{text:"ÙÛÚ Ù
رØÙÙâØ§Û ØªØ¹Ø±ÛÙ ÙØ´Ø¯Ù"}):(0,r.jsx)(l.Z5,{onDragEnd:b,children:(0,r.jsxs)("div",{className:"flex-1 flex gap-x-14 overflow-x-auto pb-10",children:[p.map((e,t)=>(0,r.jsx)(y,{stage:e,index:t,onRename:async t=>{await (0,o.xn)(e.id,t),h()},onDelete:async()=>{try{await (0,o._V)(e.id),h()}catch(e){window.alert(e instanceof Error?e.message:"ØØ°Ù ÙØ´Ø¯")}},onMove:async t=>{await (0,o.Mz)(e.id,t),h()},onStarsChange:(t,n)=>j(e.id,t,n)},e.id)),(0,r.jsx)("button",{onClick:v,className:"w-[220px] shrink-0 h-[46px] rounded-16 border border-dashed border-gray-D2D2D7 text-13 leading-20 text-gray-6C6A7D hover:border-primary-main hover:text-primary-dark transition",children:"+ Ø§ÙØ²Ùد٠Ù
رØÙÙ"})]})})]})})}}},function(e){e.O(0,[5062,4389,5287,9759,9774,2888,179],function(){return e(e.s=80985)}),_N_E=e.O()}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.