1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9267],{66086:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin/reservations/calendar-management",function(){return t(10524)}])},10524:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return x}});var r=t(10253),a=t(36305),i=t(85893),o=t(67294),s=t(41664),c=t.n(s),l=t(49759),d=t(84858),u=t(32474),m=t(33496),h=[{value:"all",label:"ÙÙ
Ù Ø§ÙØ§Ù
تگاÙâÙØ§"},{value:"suit",label:"ÙÛÙØ§ Ù Ø³ÙØ¦ÛتâÙØ§"},{value:"boomgardi",label:"بÙÙ
âگردÛâÙØ§"},{value:"hotel",label:"ÙØªÙâÙØ§"}];function x(){var e=function(e){X(!1),H(function(n){var t=new Map(n),r="res:".concat(e.id);return t.has(r)?t.delete(r):t.set(r,{kind:"residence",id:e.id,residenceId:e.id,label:e.name}),t})},n=function(e,n){X(!1),H(function(t){var r=new Map(t),a="room:".concat(n.id);return r.has(a)?r.delete(a):r.set(a,{kind:"room",id:n.id,residenceId:e.id,label:"".concat(e.name," â ").concat(n.name)}),r})},t=function(e){X(!1);var n=e.rooms.every(function(e){return G.has("room:".concat(e.id))});H(function(t){var r=new Map(t),a=!0,i=!1,o=void 0;try{for(var s,c=e.rooms[Symbol.iterator]();!(a=(s=c.next()).done);a=!0){var l=s.value,d="room:".concat(l.id);n?r.delete(d):r.set(d,{kind:"room",id:l.id,residenceId:e.id,label:"".concat(e.name," â ").concat(l.name)})}}catch(e){i=!0,o=e}finally{try{a||null==c.return||c.return()}finally{if(i)throw o}}return r})},s=function(e,n){var t=new Map(e);if("BOOMGARDI"===n.type||"HOTEL"===n.type){var r=!0,a=!1,i=void 0;try{for(var o,s=n.rooms[Symbol.iterator]();!(r=(o=s.next()).done);r=!0){var c=o.value;t.set("room:".concat(c.id),{kind:"room",id:c.id,residenceId:n.id,label:"".concat(n.name," â ").concat(c.name)})}}catch(e){a=!0,i=e}finally{try{r||null==s.return||s.return()}finally{if(a)throw i}}}else t.set("res:".concat(n.id),{kind:"residence",id:n.id,residenceId:n.id,label:n.name});return t},x=(0,r.Z)((0,o.useState)("all"),2),g=x[0],v=x[1],b=(0,r.Z)((0,o.useState)(""),2),y=b[0],j=b[1],w=(0,r.Z)((0,o.useState)(""),2),N=w[0],k=w[1],C=(0,r.Z)((0,o.useState)(1),2),E=C[0],S=C[1],F=(0,r.Z)((0,o.useState)([]),2),Z=F[0],I=F[1],T=(0,r.Z)((0,o.useState)(!1),2),M=T[0],R=T[1],_=(0,r.Z)((0,o.useState)(0),2),A=_[0],O=_[1],B=(0,r.Z)((0,o.useState)(new Set),2),D=B[0],P=B[1],z=(0,r.Z)((0,o.useState)(new Map),2),G=z[0],H=z[1],L=(0,r.Z)((0,o.useState)(!1),2),U=L[0],X=L[1];(0,o.useEffect)(function(){var e=setTimeout(function(){return k(y.trim())},300);return function(){return clearTimeout(e)}},[y]),(0,o.useEffect)(function(){S(1),I([])},[N,g]),(0,o.useEffect)(function(){if(!N){I([]),O(0);return}var e=!1;return R(!0),(0,d.Px)("/api/admin/residences?q=".concat(encodeURIComponent(N),"&tab=").concat(g,"&page=").concat(E,"&pageSize=").concat(8,"&sort=newest")).then(function(n){e||(I(function(e){return 1===E?n.items:(0,a.Z)(e).concat((0,a.Z)(n.items))}),O(n.meta.total))}).finally(function(){return!e&&R(!1)}),function(){e=!0}},[N,g,E]),(0,o.useEffect)(function(){U&&H(function(e){var n=new Map(e),t=!0,r=!1,a=void 0;try{for(var i,o=Z[Symbol.iterator]();!(t=(i=o.next()).done);t=!0){var c=i.value;n=s(n,c)}}catch(e){r=!0,a=e}finally{try{t||null==o.return||o.return()}finally{if(r)throw a}}return n})},[Z,U]);var q=(0,o.useMemo)(function(){return(0,a.Z)(G.values())},[G]),J=(0,o.useMemo)(function(){return q.map(function(e){return{residenceId:e.residenceId,roomId:"room"===e.kind?e.id:void 0,label:e.label}})},[q]);return(0,i.jsxs)(l.Z,{title:"Ù
Ø¯ÛØ±Ûت تÙÙÛÙ
",breadcrumb:(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(c(),{href:"/admin",children:"Ø¯Ø§Ø´Ø¨ÙØ±Ø¯"})," / ",(0,i.jsx)(c(),{href:"/admin/reservations",children:"رزرÙÙØ§"})]}),children:[(0,i.jsxs)("div",{className:"flex items-center gap-x-12 mb-16 flex-wrap gap-y-8",children:[(0,i.jsx)("div",{className:"w-[220px]",children:(0,i.jsx)(u.Ph,{value:g,onChange:function(e){return v(e.target.value)},children:h.map(function(e){return(0,i.jsx)("option",{value:e.value,children:e.label},e.value)})})}),(0,i.jsxs)("div",{className:"relative w-[420px] max-w-full",children:[(0,i.jsx)("i",{className:"icon-Search absolute right-14 top-1/2 -translate-y-1/2 text-15 text-gray-9B9BAA pointer-events-none"}),(0,i.jsx)(u.II,{value:y,onChange:function(e){return j(e.target.value)},placeholder:"ÙØ§Ù
ÛØ§ کد Ø§ÙØ§Ù
ØªÚ¯Ø§ÙØ ÙØ§Ù
ÛØ§ Ø´Ù
ارÙâÛ Ù
ÛØ²Ø¨Ø§Ù...",className:"!pr-38"})]}),G.size>0&&(0,i.jsxs)("span",{className:"text-13 leading-20 text-gray-6C6A7D",children:[(0,i.jsx)("b",{className:"text-black",children:(0,u.N)(G.size)})," Ù
ÙØ±Ø¯ Ø§ÙØªØ®Ø§Ø¨ شدÙ",(0,i.jsx)("button",{type:"button",onClick:function(){X(!1),H(new Map)},className:"mr-10 text-primary-dark font-m",children:"پاک Ú©Ø±Ø¯Ù Ø§ÙØªØ®Ø§Ø¨"})]})]}),(0,i.jsxs)("div",{className:"grid lg:grid-cols-14 gap-16 items-start",children:[(0,i.jsx)(u.Zb,{className:"lg:col-span-4 p-0 overflow-hidden h-[640px] flex flex-col",children:N?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)("div",{className:"flex items-center justify-between gap-x-8 px-14 py-10 bg-gray-616E7C shrink-0",children:[(0,i.jsxs)("label",{className:"flex items-center gap-x-8 cursor-pointer",children:[(0,i.jsx)(f,{checked:U,onChange:function(){X(function(e){var n=!e;return H(function(e){if(!n)return new Map;var t=new Map(e),r=!0,a=!1,i=void 0;try{for(var o,c=Z[Symbol.iterator]();!(r=(o=c.next()).done);r=!0){var l=o.value;t=s(t,l)}}catch(e){a=!0,i=e}finally{try{r||null==c.return||c.return()}finally{if(a)throw i}}return t}),n})},light:!0}),(0,i.jsx)("span",{className:"text-13 leading-20 text-white",children:"ÙÛØ³Øª Ø§ÙØ§Ù
تگاÙâÙØ§"})]}),(0,i.jsxs)(u.Ct,{tone:"gray",children:[(0,u.N)(A)," Ø§ÙØ§Ù
تگاÙ"]})]}),(0,i.jsxs)("div",{className:"flex-1 overflow-y-auto p-10 flex flex-col gap-y-8",children:[Z.map(function(r){return(0,i.jsx)(p,{row:r,expanded:D.has(r.id),onToggleExpand:function(){return P(function(e){var n=new Set(e);return n.has(r.id)?n.delete(r.id):n.add(r.id),n})},residenceChecked:G.has("res:".concat(r.id)),allRoomsChecked:!!r.rooms.length&&r.rooms.every(function(e){return G.has("room:".concat(e.id))}),someRoomsChecked:r.rooms.some(function(e){return G.has("room:".concat(e.id))}),roomChecked:function(e){return G.has("room:".concat(e))},onToggleResidence:function(){return e(r)},onToggleAllRooms:function(){return t(r)},onToggleRoom:function(e){return n(r,e)}},r.id)}),M&&(0,i.jsx)(u.Od,{className:"h-[80px]"}),!M&&0===Z.length&&(0,i.jsx)(u.ub,{text:"ÙØªÛجÙâØ§Û Ù¾ÛØ¯Ø§ ÙØ´Ø¯"}),!M&&Z.length<A&&(0,i.jsx)(u.zx,{variant:"secondary",onClick:function(){return S(function(e){return e+1})},children:"Ù
Ø´Ø§ÙØ¯Ù Ø¨ÛØ´ØªØ±"})]})]}):(0,i.jsx)("div",{className:"flex-1 flex items-center justify-center p-24",children:(0,i.jsx)(u.ub,{text:"Ø¨Ø±Ø§Û Ø´Ø±ÙØ¹Ø ÙØ§Ù
ÛØ§ کد Ø§ÙØ§Ù
ØªÚ¯Ø§Ù ÛØ§ Ù
ÛØ²Ø¨Ø§Ù را جستâÙØ¬Ù Ú©ÙÛØ¯"})})}),(0,i.jsx)("div",{className:"lg:col-span-10",children:0===J.length?(0,i.jsx)(u.Zb,{className:"p-24 h-[640px] flex items-center justify-center",children:(0,i.jsx)(u.ub,{text:"از ÙÙØ±Ø³Øª سÙ
ت Ø±Ø§Ø³ØªØ ÛÚ© ÛØ§ ÚÙØ¯ Ø§ÙØ§Ù
تگاÙ/Ø§ØªØ§Ù Ø§ÙØªØ®Ø§Ø¨ Ú©ÙÛØ¯"})}):(0,i.jsx)(m.Z,{targets:J})})]})]})}function f(e){var n=e.checked,t=e.indeterminate,r=e.onChange,a=e.light;return(0,i.jsxs)("button",{type:"button",role:"checkbox","aria-checked":t?"mixed":n,onClick:function(e){e.stopPropagation(),r()},className:"w-22 h-22 shrink-0 rounded-6 border-2 flex items-center justify-center transition ".concat(n||t?"bg-primary-main border-primary-main":a?"bg-white/10 border-white/60 hover:border-white":"bg-white border-gray-C4CAD3 hover:border-primary-main"),children:[n&&!t&&(0,i.jsx)("i",{className:"icon-Tick text-13 text-white"}),t&&(0,i.jsx)("span",{className:"w-10 h-2 rounded-full bg-white"})]})}function p(e){var n,t,r,a=e.row,o=e.expanded,s=e.onToggleExpand,l=e.residenceChecked,d=e.allRoomsChecked,m=e.someRoomsChecked,h=e.roomChecked,x=e.onToggleResidence,p=e.onToggleAllRooms,g=e.onToggleRoom,v="BOOMGARDI"===a.type||"HOTEL"===a.type;return(0,i.jsxs)("div",{className:"rounded-12 border p-10 ".concat(m||l?"border-primary-main bg-primary-light/20":"border-gray-E8E8E8"),children:[(0,i.jsxs)("div",{className:"flex items-center gap-x-8",children:[v?(0,i.jsx)(f,{checked:d,indeterminate:m,onChange:p}):(0,i.jsx)(f,{checked:l,onChange:x}),(0,i.jsx)("span",{className:"w-36 h-36 shrink-0 rounded-full overflow-hidden bg-gray-F5F9FF",children:!!a.images[0]&&(0,i.jsx)("img",{src:(0,u.vD)(a.images[0].url,96),alt:"",className:"w-full h-full object-cover"})}),(0,i.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,i.jsx)("p",{className:"text-13 leading-20 text-black truncate",title:a.name,children:a.name}),(0,i.jsx)("p",{className:"text-11 leading-16 text-gray-616E7C truncate",children:(n=a.location)?n.parent?"".concat(n.parent.name,"Ø ").concat(n.name):n.name:"â"})]}),v?(0,i.jsx)("button",{type:"button",onClick:s,className:"w-28 h-28 rounded-8 bg-gray-F4F5F6 shrink-0",children:(0,i.jsx)("i",{className:o?"icon-FlashUp text-16":"icon-FlashDown text-16"})}):!!a.rooms.length&&(0,i.jsxs)("span",{className:"text-11 text-gray-616E7C shrink-0",children:[(0,u.N)(a.rooms.length)," اتاÙ"]})]}),(0,i.jsxs)("div",{className:"flex items-center justify-between mt-8 pt-8 border-t border-gray-F0F0F0",children:[(0,i.jsxs)(c(),{href:"/admin/residences/".concat(a.publicId),className:"text-11 text-primary-dark",children:["کد ",(0,u.N)(a.publicId)]}),(0,i.jsx)("span",{className:"text-11 text-gray-616E7C truncate",dir:"ltr",children:(null===(t=a.host)||void 0===t?void 0:t.name)||(null===(r=a.host)||void 0===r?void 0:r.phone)})]}),v&&o&&(0,i.jsxs)("div",{className:"flex flex-col gap-y-6 mt-8",children:[a.rooms.map(function(e){return(0,i.jsxs)("label",{className:"flex items-center gap-x-8 rounded-8 border border-gray-E8E8E8 bg-gray-F4F5F6 p-8 cursor-pointer",children:[(0,i.jsx)(f,{checked:h(e.id),onChange:function(){return g(e)}}),(0,i.jsx)("span",{className:"text-12 text-black",children:e.name})]},e.id)}),0===a.rooms.length&&(0,i.jsx)("p",{className:"text-11 text-gray-9B9BAA",children:"اتاÙÛ Ø«Ø¨Øª ÙØ´Ø¯Ù"})]})]})}}},function(e){e.O(0,[4885,9791,8289,9759,3496,9774,2888,179],function(){return e(e.s=66086)}),_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.