1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6796],{87083:function(e,t,a){(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin/reservations",function(){return a(56156)}])},56156:function(e,t,a){"use strict";a.r(t),a.d(t,{default:function(){return b}});var s=a(85893),l=a(67294),n=a(41664),r=a.n(n),i=a(44389),o=a(49759),c=a(84858),d=a(35157),p=a(15822),x=a(37515),m=a(57635),h=a(20646),y=a(32474);let u=[{key:"HOST_APPROVAL",label:"در Ø§ÙØªØ¸Ø§Ø± تاÛÛØ¯ Ù
ÛØ²Ø¨Ø§Ù",tone:"yellow"},{key:"SECOND_PAYMENT",label:"در Ø§ÙØªØ¸Ø§Ø± پرداخت ÙÙØ§ÛÛ",tone:"yellow"},{key:"DONE",label:"تکÙ
Û٠شدÙ",tone:"green"},{key:"CANCEL",label:"ÙØºÙ شدÙ",tone:"red"},{key:"EXPIRED",label:"Ù
ÙÙØ¶Û شدÙ",tone:"gray"}],g=Object.fromEntries(u.map(e=>[e.key,e])),j="HOST_APPROVAL,SECOND_PAYMENT,DONE",N=[{key:j,label:"جارÛ"},...u.map(e=>({key:e.key,label:e.label})),{key:"all",label:"ÙÙ
Ù"}],w=[{key:"today",label:"اÙ
Ø±ÙØ²"},{key:"yesterday",label:"Ø¯ÛØ±Ùز"},{key:"all",label:"ÙÙ
Ù ØªØ§Ø±ÛØ®âÙØ§"}];function f(e){let{name:t,phone:a}=e;return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"text-14 leading-20 text-black",children:t||"بدÙÙ ÙØ§Ù
"}),(0,s.jsx)("div",{className:"text-12 leading-18 text-gray-6C6A7D",dir:"ltr",children:a})]})}function b(){let{router:e,getString:t,getNumber:a,update:n}=(0,p.o)(),[u,b]=(0,l.useState)(!1),v=a("page",1),A=t("state",j),k=t("date","today"),C=t("q"),S=(0,x.ik)(e.query.filters),R=t("sortBy"),P=R?{key:R,dir:t("sortDir","asc")}:null;function D(e){let t=(0,y.dx)(P,e);n({sortBy:null==t?void 0:t.key,sortDir:null==t?void 0:t.dir,page:void 0})}let E=new URLSearchParams({page:String(v),pageSize:String(20),...A&&"all"!==A?{state:A}:{},...k&&"all"!==k?{date:k}:{},...C?{q:C}:{},...S.length?{filters:(0,x.IU)(S)}:{},...P?{sortBy:P.key,sortDir:P.dir}:{}}),{data:_,isLoading:O,mutate:F}=(0,i.u)(e.isReady?`/api/admin/reservations?${E.toString()}`:null,e=>(0,c.Px)(e)),{data:K}=(0,i.u)("/api/admin/reservations/filter-fields",e=>(0,c.SC)(e)),B=!!K&&Object.values(K).some(e=>"multiselect"===e.type),{data:I}=(0,i.u)(B?"/api/admin/amenities":null,e=>(0,c.SC)(e));return(0,l.useEffect)(()=>{_&&(0,d.g)("reservations",_.items.map(e=>e.id),e.asPath)},[_,e.asPath]),(0,s.jsxs)(o.Z,{title:"رزرÙÙØ§",breadcrumb:(0,s.jsx)(r(),{href:"/admin",children:"Ø¯Ø§Ø´Ø¨ÙØ±Ø¯"}),actions:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(y.Qm,{tabs:w,value:k,onChange:function(e){n({date:e,page:void 0})}}),(0,s.jsx)(y.Qm,{tabs:N,value:A,onChange:function(e){n({state:e,page:void 0})}})]}),toolbar:(0,s.jsxs)(y.o8,{children:[(0,s.jsxs)("div",{className:"flex items-center gap-x-10 flex-1 min-w-[240px]",children:[(0,s.jsx)(m.R,{value:C,onChange:e=>n({q:e,page:void 0}),onPick:function(e,t){n({q:void 0,filters:(0,x.IU)([...S,{field:e,operator:"equals",value:t}]),page:void 0},"push")},suggestionsUrl:"/api/admin/reservations/search-suggestions",placeholder:"کد Ø±Ø²Ø±ÙØ ÙØ§Ù
ÛØ§ Ù
ÙØ¨Ø§ÛÙ Ù
ÙÙ
ا٠٠Ù
ÛØ²Ø¨Ø§Ù..."}),(0,s.jsx)(y.hA,{icon:"icon-Filters",label:"ÙÛÙØªØ± Ù¾ÛØ´Ø±ÙتÙ",active:u||S.length>0,onClick:()=>b(e=>!e)}),(0,s.jsx)("span",{className:"text-13 leading-20 text-gray-6C6A7D whitespace-nowrap",children:_?`${(0,y.N)(_.meta.total)} رزرÙ`:"â¦"})]}),(0,s.jsxs)("div",{className:"flex items-center gap-x-8",children:[(0,s.jsx)(y.rP,{icon:"icon-Refresh",label:"Ø¨Ø§Ø±Ú¯Ø°Ø§Ø±Û Ù
جدد",onClick:()=>F()}),_&&(0,s.jsx)(y.p0,{page:v,pageSize:20,total:_.meta.total,pageCount:_.meta.pageCount,onPage:e=>n({page:e})})]})]}),children:[(0,s.jsxs)("div",{className:"flex flex-col gap-y-16 mb-16",children:[(0,s.jsx)(h.R,{open:u,onClose:()=>b(!1),fields:K,amenities:I,rows:S,onApply:e=>{n({filters:(0,x.IU)(e),page:void 0},"push"),b(!1)}}),(0,s.jsx)(h.V,{rows:S,fields:K,amenities:I,onRemove:function(e){n({filters:(0,x.IU)(S.filter((t,a)=>a!==e)),page:void 0})}})]}),O&&(0,s.jsx)("div",{className:"grid gap-12",children:Array.from({length:8}).map((e,t)=>(0,s.jsx)(y.Od,{className:"h-[56px]"},t))}),_&&0===_.items.length&&(0,s.jsx)(y.Zb,{children:(0,s.jsx)(y.ub,{text:"رزرÙÛ Ø¨Ø§ اÛÙ ÙÛÙØªØ± Ù¾ÛØ¯Ø§ ÙØ´Ø¯"})}),_&&_.items.length>0&&(0,s.jsx)(y.Zb,{className:"overflow-x-auto",children:(0,s.jsxs)("table",{className:"w-full min-w-[1360px] text-right border-collapse",children:[(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{className:"bg-gray-F5F5F7 text-12 leading-18 text-gray-6C6A7D",children:[(0,s.jsx)("th",{className:"px-12 py-12 font-m whitespace-nowrap",children:"ردÛÙ"}),(0,s.jsx)(y.Re,{label:"کد رزرÙ",sortKey:"reference",sort:P,onSort:D,className:"font-m whitespace-nowrap"}),(0,s.jsx)(y.Re,{label:"ثبت رزرÙ",sortKey:"createdAt",sort:P,onSort:D,className:"font-m whitespace-nowrap"}),(0,s.jsx)(y.Re,{label:"Ø´Ø±ÙØ¹ Ø§ÙØ§Ù
ت",sortKey:"startDate",sort:P,onSort:D,className:"font-m whitespace-nowrap"}),(0,s.jsx)(y.Re,{label:"Ù
ÙÙ
اÙ",sortKey:"guest",sort:P,onSort:D,className:"font-m whitespace-nowrap"}),(0,s.jsx)(y.Re,{label:"Ù
ÛØ²Ø¨Ø§Ù",sortKey:"host",sort:P,onSort:D,className:"font-m whitespace-nowrap"}
1),(0,s.jsx)(y.Re,{label:"شب",sortKey:"daysCount",sort:P,onSort:D,className:"font-m whitespace-nowrap"}),(0,s.jsx)(y.Re,{label:"Ù
Ø¨ÙØº Ú©Ù (تÙÙ
اÙ)",sortKey:"totalAmount",sort:P,onSort:D,className:"font-m whitespace-nowrap"}),(0,s.jsx)(y.Re,{label:"Ù¾Ø±Ø¯Ø§Ø®ØªÛ (تÙÙ
اÙ)",sortKey:"paidAmount",sort:P,onSort:D,className:"font-m whitespace-nowrap"}),(0,s.jsx)(y.Re,{label:"سÙÙ
ÙÛØ¯ÙÙ
ا (تÙÙ
اÙ)",sortKey:"websiteShare",sort:P,onSort:D,className:"font-m whitespace-nowrap"}),(0,s.jsx)("th",{className:"px-12 py-12 font-m whitespace-nowrap",children:"Ø´ÙØ±"}),(0,s.jsx)(y.Re,{label:"ÙØ¶Ø¹Ûت",sortKey:"state",sort:P,onSort:D,className:"font-m whitespace-nowrap"}),(0,s.jsx)("th",{className:"px-12 py-12 font-m whitespace-nowrap",children:"Ø±Ø²Ø±Ù ÙØ¨ÙÛ Ù
ÙÙ
اÙ"})]})}),(0,s.jsx)("tbody",{className:"divide-y divide-gray-F0F0F0",children:_.items.map((e,t)=>{let[a,l]=(0,y.A1)(e.createdAt),n=g[e.state];return(0,s.jsxs)("tr",{className:"hover:bg-gray-F5F5F7 transition",children:[(0,s.jsx)("td",{className:"px-12 py-12 text-13 text-gray-6C6A7D",children:(0,y.N)((v-1)*20+t+1)}),(0,s.jsx)("td",{className:"px-12 py-12 whitespace-nowrap",children:(0,s.jsx)(r(),{href:`/admin/reservations/${e.id}`,className:"text-14 font-m text-primary-dark",title:e.residence.name,children:e.reference})}),(0,s.jsxs)("td",{className:"px-12 py-12 whitespace-nowrap",children:[(0,s.jsx)("div",{className:"text-13 leading-20 text-black",children:a}),(0,s.jsx)("div",{className:"text-12 leading-18 text-gray-6C6A7D",children:l})]}),(0,s.jsx)("td",{className:"px-12 py-12 text-13 whitespace-nowrap",children:(0,y.IY)(e.startDate)}),(0,s.jsx)("td",{className:"px-12 py-12",children:(0,s.jsx)(f,{...e.guest})}),(0,s.jsx)("td",{className:"px-12 py-12",children:(0,s.jsx)(f,{...e.host})}),(0,s.jsx)("td",{className:"px-12 py-12 text-14",children:(0,y.N)(e.daysCount)}),(0,s.jsx)("td",{className:"px-12 py-12 text-14 font-m whitespace-nowrap",children:(0,y.N)(e.totalAmount)}),(0,s.jsxs)("td",{className:"px-12 py-12 text-14 whitespace-nowrap",children:[(0,y.N)(e.paidAmount),e.paidAmount<e.totalAmount&&(0,s.jsxs)("div",{className:"text-11 leading-16 text-gray-6C6A7D",children:["Ù
Ø§ÙØ¯Ù ",(0,y.N)(e.totalAmount-e.paidAmount)]})]}),(0,s.jsx)("td",{className:"px-12 py-12 text-14 whitespace-nowrap",children:null==e.websiteShare?(0,s.jsx)("span",{className:"text-gray-9B9BAA",children:"â"}):(0,y.N)(e.websiteShare)}),(0,s.jsx)("td",{className:"px-12 py-12 text-13 whitespace-nowrap",children:e.city||(0,s.jsx)("span",{className:"text-gray-9B9BAA",children:"â"})}),(0,s.jsx)("td",{className:"px-12 py-12 whitespace-nowrap",children:(0,s.jsx)(y.Ct,{tone:(null==n?void 0:n.tone)??"gray",children:(null==n?void 0:n.label)??e.state})}),(0,s.jsx)("td",{className:"px-12 py-12 text-14",children:e.guestPreviousCount>0?(0,y.N)(e.guestPreviousCount):(0,s.jsx)("span",{className:"text-gray-9B9BAA",children:"Û°"})})]},e.id)})})]})})]})}}},function(e){e.O(0,[4389,9759,8907,9774,2888,179],function(){return e(e.s=87083)}),_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.